react-semaphor 0.1.215 → 0.1.216
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-DO8B0l2Z.js → dashboard-controls-AyLbHPY7.js} +9 -9
- package/dist/chunks/{dashboard-controls-gCssNmJm.js → dashboard-controls-CE14Z5GT.js} +9 -8
- package/dist/chunks/{dashboard-json-DqjdMwqj.js → dashboard-json-BlcehrzA.js} +1 -1
- package/dist/chunks/{dashboard-json-BZdOqyyK.js → dashboard-json-CB-PjFQp.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-BxEopSPW.js → dashboard-summary-settings-dialog-95pmx2I6.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-Diz1-VIZ.js → dashboard-summary-settings-dialog-ZzGDw_NF.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-Bq0O78OS.js → edit-dashboard-visual-BCzL8qte.js} +2 -2
- package/dist/chunks/{edit-dashboard-visual-CWytKzAl.js → edit-dashboard-visual-DE2g9so9.js} +1 -1
- package/dist/chunks/{editor-action-buttons-D3hMMbWz.js → editor-action-buttons-BkCIjblw.js} +1 -1
- package/dist/chunks/{editor-action-buttons-CdrejHS2.js → editor-action-buttons-CL_G2bSD.js} +2 -2
- package/dist/chunks/{index-BkklWRT2.js → index-BL3sySXQ.js} +162 -162
- package/dist/chunks/{index-Cxj7oWTZ.js → index-C0uTSIns.js} +10798 -10782
- package/dist/chunks/normalize-dashboard-for-dirty-check-B7NQDI1H.js +1 -0
- package/dist/chunks/normalize-dashboard-for-dirty-check-Bn27S0PN.js +69 -0
- package/dist/chunks/{notification-bell-BTWYtgvh.js → notification-bell-DZukXqhn.js} +3 -3
- package/dist/chunks/{notification-bell-D1NnHIWO.js → notification-bell-ym2iwJpw.js} +1 -1
- package/dist/chunks/{resource-management-panel-DATz276M.js → resource-management-panel-BVKxC2EW.js} +1 -1
- package/dist/chunks/{resource-management-panel-BnRwLkjR.js → resource-management-panel-DGVVs8UM.js} +3 -3
- package/dist/chunks/use-debounced-dirty-check-BwAbnX_5.js +59 -0
- package/dist/chunks/use-debounced-dirty-check-XHSwAefL.js +1 -0
- package/dist/chunks/{use-role-aware-display-preferences-ASD7plKm.js → use-role-aware-display-preferences-c-dmtisM.js} +1 -1
- package/dist/chunks/{use-role-aware-display-preferences-DP-Ng_hb.js → use-role-aware-display-preferences-v3z-8Fyh.js} +1 -1
- package/dist/chunks/{use-visual-utils-873PUDHm.js → use-visual-utils-Ba5nPP3L.js} +1 -1
- package/dist/chunks/{use-visual-utils-C_9jH8bu.js → use-visual-utils-CaYg_mFN.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 +19 -18
- package/dist/shared/index.cjs +1 -1
- package/dist/shared/index.js +5 -4
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunks/normalize-dashboard-for-dirty-check-D9x96J2F.js +0 -1
- package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +0 -119
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-BL3sySXQ.js"),f=require("react");require("react-dom");const _=require("./notification-bell-ym2iwJpw.js"),bs=require("./use-role-aware-display-preferences-c-dmtisM.js"),ys=require("./date-formatter-Sz6QDaM8.js"),Fe=require("./dashboard-summary-settings-dialog-ZzGDw_NF.js"),Ss=require("./use-debounced-dirty-check-XHSwAefL.js"),ge=require("./normalize-dashboard-for-dirty-check-B7NQDI1H.js"),Re=require("./editor-action-buttons-BkCIjblw.js");function Ds(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(n,a,r.get?r:{enumerable:!0,get:()=>t[a]})}}return n.default=t,Object.freeze(n)}const k=Ds(f);/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const
|
|
6
|
+
*/const Ns=s.createLucideIcon("FilterX",[["path",{d:"M13.013 3H2l8 9.46V19l4 2v-8.54l.9-1.055",key:"1fi1da"}],["path",{d:"m22 3-5 5",key:"12jva0"}],["path",{d:"m17 3 5 5",key:"k36vhe"}]]);/**
|
|
7
7
|
* @license lucide-react v0.453.0 - ISC
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const
|
|
11
|
+
*/const ws=s.createLucideIcon("Glasses",[["circle",{cx:"6",cy:"15",r:"4",key:"vux9w4"}],["circle",{cx:"18",cy:"15",r:"4",key:"18o8ve"}],["path",{d:"M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2",key:"1ag4bs"}],["path",{d:"M2.5 13 5 7c.7-1.3 1.4-2 3-2",key:"1hm1gs"}],["path",{d:"M21.5 13 19 7c-.7-1.3-1.5-2-3-2",key:"1r31ai"}]]);/**
|
|
12
12
|
* @license lucide-react v0.453.0 - ISC
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const
|
|
16
|
+
*/const Cs=s.createLucideIcon("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
|
|
17
17
|
* @license lucide-react v0.453.0 - ISC
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const
|
|
21
|
+
*/const Ls=s.createLucideIcon("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
|
22
22
|
* @license lucide-react v0.453.0 - ISC
|
|
23
23
|
*
|
|
24
24
|
* This source code is licensed under the ISC license.
|
|
25
25
|
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const
|
|
26
|
+
*/const Ms=s.createLucideIcon("ShieldX",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);/**
|
|
27
27
|
* @license lucide-react v0.453.0 - ISC
|
|
28
28
|
*
|
|
29
29
|
* This source code is licensed under the ISC license.
|
|
30
30
|
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const
|
|
31
|
+
*/const As=s.createLucideIcon("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);var ve={exports:{}},xe={};/**
|
|
32
32
|
* @license React
|
|
33
33
|
* use-sync-external-store-shim.production.js
|
|
34
34
|
*
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
*
|
|
37
37
|
* This source code is licensed under the MIT license found in the
|
|
38
38
|
* LICENSE file in the root directory of this source tree.
|
|
39
|
-
*/var Ue;function
|
|
39
|
+
*/var Ue;function ks(){if(Ue)return xe;Ue=1;var t=f;function n(d,m){return d===m&&(d!==0||1/d===1/m)||d!==d&&m!==m}var a=typeof Object.is=="function"?Object.is:n,r=t.useState,l=t.useEffect,c=t.useLayoutEffect,u=t.useDebugValue;function p(d,m){var h=m(),j=r({inst:{value:h,getSnapshot:m}}),b=j[0].inst,y=j[1];return c(function(){b.value=h,b.getSnapshot=m,x(b)&&y({inst:b})},[d,h,m]),l(function(){return x(b)&&y({inst:b}),d(function(){x(b)&&y({inst:b})})},[d]),u(h),h}function x(d){var m=d.getSnapshot;d=d.value;try{var h=m();return!a(d,h)}catch{return!0}}function v(d,m){return m()}var i=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?v:p;return xe.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:i,xe}var fe={};/**
|
|
40
40
|
* @license React
|
|
41
41
|
* use-sync-external-store-shim.development.js
|
|
42
42
|
*
|
|
@@ -44,4 +44,4 @@
|
|
|
44
44
|
*
|
|
45
45
|
* This source code is licensed under the MIT license found in the
|
|
46
46
|
* LICENSE file in the root directory of this source tree.
|
|
47
|
-
*/var Pe;function Is(){return Pe||(Pe=1,process.env.NODE_ENV!=="production"&&function(){function t(h,j){return h===j&&(h!==0||1/h===1/j)||h!==h&&j!==j}function n(h,j){i||l.startTransition===void 0||(i=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var b=j();if(!d){var y=j();c(b,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}y=u({inst:{value:b,getSnapshot:j}});var w=y[0].inst,M=y[1];return x(function(){w.value=b,w.getSnapshot=j,a(w)&&M({inst:w})},[h,b,j]),p(function(){return a(w)&&M({inst:w}),h(function(){a(w)&&M({inst:w})})},[h]),v(b),b}function a(h){var j=h.getSnapshot;h=h.value;try{var b=j();return!c(h,b)}catch{return!0}}function r(h,j){return j()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var l=f,c=typeof Object.is=="function"?Object.is:t,u=l.useState,p=l.useEffect,x=l.useLayoutEffect,v=l.useDebugValue,i=!1,d=!1,m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:n;fe.useSyncExternalStore=l.useSyncExternalStore!==void 0?l.useSyncExternalStore:m,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),fe}process.env.NODE_ENV==="production"?ve.exports=As():ve.exports=Is();var ks=ve.exports;function Es(){const{setTheme:t}=s.useTheme(),n=s.useDashboardStore(a=>a.actions.setDashboardTheme);return e.jsxs(s.DropdownMenu,{children:[e.jsx(s.DropdownMenuTrigger,{asChild:!0,children:e.jsxs(s.Button,{className:"h-7 p-2",variant:"ghost",size:"sm",children:[e.jsx(Ms,{strokeWidth:1.5,className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),e.jsx(Cs,{strokeWidth:1.5,className:"absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),e.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),e.jsxs(s.DropdownMenuContent,{align:"end",children:[e.jsx(s.DropdownMenuItem,{onClick:()=>{t("light"),n("light")},children:"Light"}),e.jsx(s.DropdownMenuItem,{onClick:()=>{t("dark"),n("dark")},children:"Dark"}),e.jsx(s.DropdownMenuItem,{onClick:()=>{t("system"),n("system")},children:"System"})]})]})}async function Ts(t,n,a,r,l){if(!l)return null;const c=JSON.stringify(a),u=`${t}/v1/lens`;return await s.postRequest(u,l,{name:n,template:c,filterValues:r,operation:"create"})}async function je(t,n,a){if(!a)return null;const{id:r,template:l,filterValues:c,isDefault:u,shared:p}=n,x=`${t}/v1/lens`;return await s.postRequest(x,a,{lensId:r,template:l,filterValues:c,isDefault:u,shared:p,operation:"update"})}async function Os(t,n,a){if(!a)return null;const r=`${t}/v1/lens`;return await s.postRequest(r,a,{operation:"delete",lensId:n})}function _s(){const[t,n]=f.useState(""),[a,r]=f.useState(!1),l=s.useDashboardStore(y=>y.lenses),{setLenses:c,setSelectedLensId:u}=s.useDashboardActions(),[p,x]=f.useState(!1),[v,i]=f.useState(!1),d=s.useDashboardStore(y=>y.dashboard),m=s.useDashboardStore(y=>y.filterValues),{authToken:h,tokenProps:j}=s.useSemaphorContext();async function b(){x(!0);const y=await Ts(j.apiServiceUrl,t,d,m,h==null?void 0:h.accessToken);y&&(c([...l||[],y]),u(y.id),i(!1)),x(!1)}return e.jsxs(s.Dialog,{open:v,onOpenChange:i,children:[e.jsx(s.DialogTrigger,{asChild:!0,children:e.jsxs(s.Button,{variant:"secondary",className:"h-7 p-2",size:"sm",children:[e.jsx(s.Plus,{className:"mr-2 h-4 w-4"}),"Lens"]})}),e.jsxs(s.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(s.DialogHeader,{children:[e.jsx(s.DialogTitle,{children:"Create Lens"}),e.jsx(s.DialogDescription,{children:"Lenses are private by default and are only visible to you."})]}),e.jsx("div",{className:"grid gap-4 py-4",children:e.jsxs("div",{className:"grid grid-cols-8 items-center gap-4",children:[e.jsx(s.Label,{className:"text-right",children:"Name"}),e.jsx(s.Input,{value:t,onChange:y=>{n(y.target.value)},id:"name",className:"col-span-7 focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"})]})}),a&&e.jsx("p",{className:"text-sm",children:"The lens name already exists. Use a differnet name."}),e.jsx(s.DialogFooter,{children:e.jsx(s.Button,{size:"sm",variant:"outline",type:"submit",onClick:b,disabled:p,children:p?"Creating...":"Add"})})]})]})}function Fs(){const[t,n]=f.useState(!1),a=s.useDashboardStore(d=>d.lenses),r=s.useDashboardStore(d=>d.selectedLensId),{setLenses:l,setSelectedLensId:c}=s.useDashboardActions(),{authToken:u,tokenProps:p}=s.useSemaphorContext();async function x(d){c(d)}async function v(d){if(await Os(p.apiServiceUrl,d,u==null?void 0:u.accessToken)){const h=a==null?void 0:a.filter(j=>j.id!==d);l(h||[]),c("original")}}async function i(d){const m=a==null?void 0:a.map(b=>b.id===d.id?{...b,isDefault:!d.isDefault}:{...b,isDefault:!1});l(m||[]);const h={...d,isDefault:!d.isDefault};await je(p.apiServiceUrl,h,u==null?void 0:u.accessToken);const j=a==null?void 0:a.find(b=>b.isDefault);if(j&&j.id!==d.id){const b={...j,isDefault:!1};await je(p.apiServiceUrl,b,u==null?void 0:u.accessToken)}}return e.jsxs(s.DropdownMenu,{open:t,onOpenChange:n,children:[e.jsx(s.DropdownMenuTrigger,{asChild:!0,children:e.jsx(s.IconButton,{tooltip:"Lenses",className:"h-7 p-2",children:e.jsx(Ns,{className:"h-4 w-4"})})}),e.jsxs(s.DropdownMenuContent,{align:"end",className:"w-60",children:[e.jsx(s.DropdownMenuLabel,{className:"px-3",children:"Lenses"}),e.jsx(s.DropdownMenuSeparator,{}),e.jsxs(s.DropdownMenuRadioGroup,{value:r,onValueChange:x,children:[e.jsx(s.DropdownMenuRadioItem,{value:"original",children:"Original"}),a==null?void 0:a.map(d=>e.jsxs(s.DropdownMenuRadioItem,{className:"group flex justify-between gap-2",value:d.id,children:[e.jsx("p",{children:d.name}),e.jsxs("span",{className:"flex items-center gap-3",children:[e.jsx(s.House,{onClick:m=>{m.preventDefault(),i(d)},className:s.cn("size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",{invisible:!d.isDefault,"text-green-500":d.isDefault}),strokeWidth:1.5}),e.jsx(s.Cross2Icon,{onClick:m=>{m.preventDefault(),v(d.id)},className:"invisible size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",strokeWidth:1.5})]})]},d.id))]})]})]})}const Rs=async(t,n,a)=>{const r=`${t}/management/v1/groups`;return await s.postRequestRegular(r,n,a)},Us=async(t,n,a)=>{const r=`${t}/management/v1/groups/${a}`,l=await fetch(r,{method:"DELETE",headers:{Authorization:`Bearer ${n}`}});if(!l.ok){const c=await l.text();throw new Error(c||"Failed to delete group")}},Ps=async(t,n,a,r)=>{const l=`${t}/management/v1/groups/${a}/members`;return await s.postRequestRegular(l,n,r)},Gs=async(t,n,a,r)=>{const l=`${t}/management/v1/groups/${a}/members`,c=await fetch(l,{method:"DELETE",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(r)});if(!c.ok){const u=await c.text();throw new Error(u||"Failed to remove group members")}};function Bs(){const{authToken:t,tokenProps:n}=s.useSemaphorContext(),a=s.useQueryClient();return s.useMutation({mutationFn:r=>Rs(n.apiServiceUrl,(t==null?void 0:t.accessToken)||"",r),onSuccess:()=>{a.invalidateQueries({queryKey:["groups"]}),s.ue.success("Group created successfully")},onError:r=>{console.error("Failed to create group:",r),s.ue.error("Failed to create group",{description:r.message})}})}function qs(){const{authToken:t,tokenProps:n}=s.useSemaphorContext(),a=s.useQueryClient();return s.useMutation({mutationFn:r=>Us(n.apiServiceUrl,(t==null?void 0:t.accessToken)||"",r),onSuccess:(r,l)=>{a.invalidateQueries({queryKey:["groups"]}),a.removeQueries({queryKey:["group",l]}),s.ue.success("Group deleted successfully")},onError:r=>{console.error("Failed to delete group:",r),s.ue.error("Failed to delete group",{description:r.message})}})}function Hs(){const{authToken:t,tokenProps:n}=s.useSemaphorContext(),a=s.useQueryClient();return s.useMutation({mutationFn:({groupId:r,data:l})=>Ps(n.apiServiceUrl,(t==null?void 0:t.accessToken)||"",r,l),onSuccess:(r,l)=>{a.invalidateQueries({queryKey:["group",l.groupId]}),a.invalidateQueries({queryKey:["group-members",l.groupId]}),a.invalidateQueries({queryKey:["groups"]}),s.ue.success("Members added successfully")},onError:r=>{console.error("Failed to add group members:",r),s.ue.error("Failed to add members",{description:r.message})}})}function zs(){const{authToken:t,tokenProps:n}=s.useSemaphorContext(),a=s.useQueryClient();return s.useMutation({mutationFn:({groupId:r,data:l})=>Gs(n.apiServiceUrl,(t==null?void 0:t.accessToken)||"",r,l),onSuccess:(r,l)=>{a.invalidateQueries({queryKey:["group",l.groupId]}),a.invalidateQueries({queryKey:["group-members",l.groupId]}),a.invalidateQueries({queryKey:["groups"]}),s.ue.success("Members removed successfully")},onError:r=>{console.error("Failed to remove group members:",r),s.ue.error("Failed to remove members",{description:r.message})}})}function Vs({onSuccess:t,tenantId:n,isTenantUser:a}){const[r,l]=f.useState(""),[c,u]=f.useState(""),[p,x]=f.useState({}),v=Bs(),i=()=>{const m={};return r.trim()?r.length<3?m.name="Group name must be at least 3 characters":r.length>50&&(m.name="Group name must be less than 50 characters"):m.name="Group name is required",c&&c.length>200&&(m.description="Description must be less than 200 characters"),x(m),Object.keys(m).length===0},d=async m=>{if(m.preventDefault(),!i())return;const h={name:r.trim(),description:c.trim()||void 0,type:a?"TENANT_GROUP":"ORG_GROUP",...a&&n?{tenantId:n}:{}};try{await v.mutateAsync(h),l(""),u(""),x({}),t()}catch(j){console.error("Failed to create group:",j)}};return e.jsxs("form",{onSubmit:d,className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(s.Label,{htmlFor:"group-name",children:["Group Name ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(s.Input,{id:"group-name",placeholder:"e.g., Marketing Team, Engineering Squad",value:r,onChange:m=>{l(m.target.value),p.name&&x(h=>({...h,name:""}))},className:p.name?"border-destructive":"",disabled:v.isPending}),p.name&&e.jsx("p",{className:"text-sm text-destructive",children:p.name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(s.Label,{htmlFor:"group-description",children:["Description",e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(optional)"})]}),e.jsx(s.Textarea,{id:"group-description",placeholder:"Describe the purpose of this group...",value:c,onChange:m=>{u(m.target.value),p.description&&x(h=>({...h,description:""}))},className:p.description?"border-destructive":"",disabled:v.isPending,rows:3}),p.description&&e.jsx("p",{className:"text-sm text-destructive",children:p.description}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[c.length,"/200 characters"]})]}),e.jsx("div",{className:"rounded-lg border bg-muted/50 p-4",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx(s.CircleAlert,{className:"h-4 w-4 mt-0.5 text-muted-foreground"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"This group will be accessible to users in your workspace. You can add members after creating the group."})]})})]}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx(s.Button,{type:"button",variant:"outline",onClick:()=>{l(""),u(""),x({})},disabled:v.isPending,children:"Clear"}),e.jsx(s.Button,{type:"submit",disabled:v.isPending||!r.trim(),children:v.isPending?e.jsxs(e.Fragment,{children:[e.jsx(s.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(s.Users,{className:"mr-2 h-4 w-4"}),"Create Group"]})})]})]})}function $s(){return ks.useSyncExternalStore(Qs,()=>!0,()=>!1)}function Qs(){return()=>{}}var be="Avatar",[Ks]=s.createContextScope(be),[Ws,Be]=Ks(be),qe=I.forwardRef((t,n)=>{const{__scopeAvatar:a,...r}=t,[l,c]=I.useState("idle");return e.jsx(Ws,{scope:a,imageLoadingStatus:l,onImageLoadingStatusChange:c,children:e.jsx(s.Primitive.span,{...r,ref:n})})});qe.displayName=be;var He="AvatarImage",ze=I.forwardRef((t,n)=>{const{__scopeAvatar:a,src:r,onLoadingStatusChange:l=()=>{},...c}=t,u=Be(He,a),p=Js(r,c),x=s.useCallbackRef(v=>{l(v),u.onImageLoadingStatusChange(v)});return s.useLayoutEffect2(()=>{p!=="idle"&&x(p)},[p,x]),p==="loaded"?e.jsx(s.Primitive.img,{...c,ref:n,src:r}):null});ze.displayName=He;var Ve="AvatarFallback",$e=I.forwardRef((t,n)=>{const{__scopeAvatar:a,delayMs:r,...l}=t,c=Be(Ve,a),[u,p]=I.useState(r===void 0);return I.useEffect(()=>{if(r!==void 0){const x=window.setTimeout(()=>p(!0),r);return()=>window.clearTimeout(x)}},[r]),u&&c.imageLoadingStatus!=="loaded"?e.jsx(s.Primitive.span,{...l,ref:n}):null});$e.displayName=Ve;function Ge(t,n){return t?n?(t.src!==n&&(t.src=n),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function Js(t,{referrerPolicy:n,crossOrigin:a}){const r=$s(),l=I.useRef(null),c=r?(l.current||(l.current=new window.Image),l.current):null,[u,p]=I.useState(()=>Ge(c,t));return s.useLayoutEffect2(()=>{p(Ge(c,t))},[c,t]),s.useLayoutEffect2(()=>{const x=d=>()=>{p(d)};if(!c)return;const v=x("loaded"),i=x("error");return c.addEventListener("load",v),c.addEventListener("error",i),n&&(c.referrerPolicy=n),typeof a=="string"&&(c.crossOrigin=a),()=>{c.removeEventListener("load",v),c.removeEventListener("error",i)}},[c,a,n]),u}var Qe=qe,Ke=ze,We=$e;const ye=I.forwardRef(({className:t,...n},a)=>e.jsx(Qe,{ref:a,className:s.cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...n}));ye.displayName=Qe.displayName;const Xs=I.forwardRef(({className:t,...n},a)=>e.jsx(Ke,{ref:a,className:s.cn("aspect-square h-full w-full",t),...n}));Xs.displayName=Ke.displayName;const Se=I.forwardRef(({className:t,...n},a)=>e.jsx(We,{ref:a,className:s.cn("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...n}));Se.displayName=We.displayName;function Ys({open:t,onOpenChange:n,group:a,onUpdate:r}){const[l,c]=f.useState("members"),[u,p]=f.useState(""),[x,v]=f.useState([]),[i,d]=f.useState([]),{data:m,isLoading:h,refetch:j}=s.useGroupMembers(a.id),b=a.type==="TENANT_GROUP"?"tenant":"organization",{users:y,isLoading:w}=s.useUnifiedUsers({type:b,tenantId:a.tenantId||void 0,active:!0,limit:100}),M=Hs(),k=zs(),C=(m==null?void 0:m.members)||[],F=f.useMemo(()=>new Set(C.map(g=>g.userId)),[C]),T=f.useMemo(()=>y.filter(g=>!F.has(g.id)),[y,F]),R=f.useMemo(()=>{if(!u)return T;const g=u.toLowerCase();return T.filter(N=>{var A,O;return((A=N.name)==null?void 0:A.toLowerCase().includes(g))||((O=N.email)==null?void 0:O.toLowerCase().includes(g))})},[T,u]),S=f.useMemo(()=>{if(!u)return C;const g=u.toLowerCase();return C.filter(N=>{var A,O,J,D;return((O=(A=N.user)==null?void 0:A.name)==null?void 0:O.toLowerCase().includes(g))||((D=(J=N.user)==null?void 0:J.email)==null?void 0:D.toLowerCase().includes(g))})},[C,u]),U=async()=>{if(x.length!==0)try{await M.mutateAsync({groupId:a.id,data:{userIds:x,userType:b==="tenant"?"tenant":"org"}}),v([]),c("members"),j(),r==null||r()}catch(g){console.error("Failed to add members:",g)}},P=async()=>{if(i.length!==0)try{await k.mutateAsync({groupId:a.id,data:{userIds:i}}),d([]),j(),r==null||r()}catch(g){console.error("Failed to remove members:",g)}},G=g=>{v(N=>N.includes(g)?N.filter(A=>A!==g):[...N,g])},B=g=>{d(N=>N.includes(g)?N.filter(A=>A!==g):[...N,g])};return e.jsx(e.Fragment,{children:e.jsx(s.Dialog,{open:t,onOpenChange:n,children:e.jsxs(s.DialogContent,{className:"max-w-3xl max-h-[80vh]","aria-describedby":"group-members-description",children:[e.jsxs(s.DialogHeader,{children:[e.jsx(s.DialogTitle,{children:a.name}),e.jsx("div",{className:"flex items-center gap-2 mt-1",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:[C.length," ",C.length===1?"member":"members"]})}),e.jsxs("p",{id:"group-members-description",className:"sr-only",children:["Add or remove members from the ",a.name," group"]})]}),e.jsxs(s.Tabs,{value:l,onValueChange:g=>{c(g),p(""),d([])},className:"mt-4",children:[e.jsxs(s.TabsList,{className:"grid w-full grid-cols-2",children:[e.jsx(s.TabsTrigger,{value:"members",children:"Current Members"}),e.jsx(s.TabsTrigger,{value:"add",children:"Add Members"})]}),e.jsxs(s.TabsContent,{value:"members",className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(s.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(s.Input,{placeholder:"Search members...",value:u,onChange:g=>p(g.target.value),className:"pl-10"})]}),e.jsx(s.ScrollArea,{className:i.length>0?"h-[300px]":"h-[350px]",children:h?e.jsx("div",{className:"space-y-2",children:[1,2,3].map(g=>e.jsx(s.Skeleton,{className:"h-16 w-full"},g))}):S.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(s.Users,{className:"h-12 w-12 mb-3 opacity-50"}),e.jsx("p",{className:"text-sm font-medium",children:u?"No members found":"No members yet"}),e.jsx("p",{className:"text-xs mt-1",children:u?"Try a different search":'Switch to the "Add Members" tab to add people to this group'})]}):e.jsx("div",{className:"space-y-2",children:S.map(g=>e.jsx(Zs,{member:g,selected:i.includes(g.userId),onToggle:()=>B(g.userId)},g.id))})}),i.length>0&&e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:[i.length," member",i.length!==1?"s":""," selected"]}),e.jsx(s.Button,{variant:"destructive",size:"sm",onClick:P,disabled:k.isPending,children:k.isPending?e.jsxs(e.Fragment,{children:[e.jsx(s.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Removing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(s.Trash2,{className:"mr-2 h-4 w-4"}),"Remove Selected"]})})]})]}),e.jsxs(s.TabsContent,{value:"add",className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(s.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(s.Input,{placeholder:"Search users to add...",value:u,onChange:g=>p(g.target.value),className:"pl-10"})]}),e.jsx(s.ScrollArea,{className:"h-[300px]",children:w?e.jsx("div",{className:"space-y-2",children:[1,2,3].map(g=>e.jsx(s.Skeleton,{className:"h-16 w-full"},g))}):R.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(s.UserPlus,{className:"h-12 w-12 mb-3 opacity-50"}),e.jsx("p",{className:"text-sm font-medium",children:"No available users"}),e.jsx("p",{className:"text-xs mt-1",children:u?"Try a different search":"All eligible users are already members"})]}):e.jsx("div",{className:"space-y-2",children:R.map(g=>e.jsx(et,{user:g,selected:x.includes(g.id),onToggle:()=>G(g.id)},g.id))})}),x.length>0&&e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:[x.length," user",x.length!==1?"s":""," selected"]}),e.jsx(s.Button,{onClick:U,disabled:M.isPending,children:M.isPending?e.jsxs(e.Fragment,{children:[e.jsx(s.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Adding..."]}):e.jsxs(e.Fragment,{children:[e.jsx(s.UserPlus,{className:"mr-2 h-4 w-4"}),"Add Members"]})})]})]})]})]})})})}function Zs({member:t,selected:n,onToggle:a}){var l,c,u,p;const r=((c=(l=t.user)==null?void 0:l.name)==null?void 0:c.split(" ").map(x=>x[0]).join("").toUpperCase())||"?";return e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg border bg-card hover:bg-muted/50 cursor-pointer",onClick:a,children:[e.jsx(s.Checkbox,{checked:n}),e.jsx(ye,{className:"h-8 w-8",children:e.jsx(Se,{className:"text-xs",children:r})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium",children:((u=t.user)==null?void 0:u.name)||"Unknown User"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:(p=t.user)==null?void 0:p.email})]})]})}function et({user:t,selected:n,onToggle:a}){var l;const r=((l=t.name)==null?void 0:l.split(" ").map(c=>c[0]).join("").toUpperCase())||"?";return e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg border bg-card hover:bg-muted/50 cursor-pointer",onClick:a,children:[e.jsx(s.Checkbox,{checked:n}),e.jsx(ye,{className:"h-8 w-8",children:e.jsx(Se,{className:"text-xs",children:r})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium",children:t.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t.email})]})]})}function st({open:t,onOpenChange:n}){const[a,r]=f.useState("groups"),[l,c]=f.useState(""),[u,p]=f.useState(null),[x,v]=f.useState(!1),[i,d]=f.useState(null),{tokenProps:m}=s.useSemaphorContext(),{currentUser:h}=s.useCurrentUserInfo(),j=qs(),b=(h==null?void 0:h.type)==="tenant",y=m==null?void 0:m.tenantId,{groups:w,isLoading:M,refetch:k}=s.useGroups({type:b?"TENANT_GROUP":"all",tenantId:b?y:void 0,includeMembers:!1}),C=w.filter(S=>{var U;return S.name.toLowerCase().includes(l.toLowerCase())||((U=S.description)==null?void 0:U.toLowerCase().includes(l.toLowerCase()))}),F=async()=>{if(i)try{await j.mutateAsync(i.id),d(null),k()}catch(S){console.error("Failed to delete group:",S)}},T=S=>{p(S),v(!0)},R=()=>{r("groups"),k()};return e.jsxs(e.Fragment,{children:[e.jsx(s.Dialog,{open:t,onOpenChange:n,children:e.jsxs(s.DialogContent,{className:"max-w-4xl max-h-[80vh]",children:[e.jsxs(s.DialogHeader,{children:[e.jsxs(s.DialogTitle,{className:"flex items-center gap-2",children:[e.jsx(s.Users,{className:"h-5 w-5"}),"Group Management"]}),e.jsx(s.DialogDescription,{children:"Manage your groups, create new groups, and control group membership"})]}),e.jsxs(s.Tabs,{value:a,onValueChange:r,className:"mt-4",children:[e.jsxs(s.TabsList,{className:"grid w-full grid-cols-2",children:[e.jsxs(s.TabsTrigger,{value:"groups",className:"flex items-center gap-2",children:[e.jsx(s.Users,{className:"h-4 w-4"}),"Groups"]}),e.jsxs(s.TabsTrigger,{value:"create",className:"flex items-center gap-2",children:[e.jsx(s.Plus,{className:"h-4 w-4"}),"Create Group"]})]}),e.jsx(s.TabsContent,{value:"groups",className:"mt-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(s.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(s.Input,{placeholder:"Search groups...",value:l,onChange:S=>c(S.target.value),className:"pl-10"})]}),e.jsx(s.ScrollArea,{className:"h-[400px]",children:M?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(S=>e.jsx(s.Skeleton,{className:"h-24 w-full"},S))}):C.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(s.Users,{className:"h-12 w-12 mb-3 opacity-50"}),e.jsx("p",{className:"text-sm font-medium",children:"No groups found"}),e.jsx("p",{className:"text-xs mt-1",children:l?"Try a different search":"Create your first group to get started"})]}):e.jsx("div",{className:"space-y-3",children:C.map(S=>e.jsx(tt,{group:S,onManageMembers:()=>T(S),onDelete:()=>d(S),currentUserId:h==null?void 0:h.id},S.id))})})]})}),e.jsx(s.TabsContent,{value:"create",className:"mt-4",children:e.jsx(Vs,{onSuccess:R,tenantId:y,isTenantUser:b})})]})]})}),u&&e.jsx(Ys,{open:x,onOpenChange:v,group:u,onUpdate:()=>k()}),e.jsx(s.AlertDialog,{open:!!i,onOpenChange:()=>d(null),children:e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:"Delete Group"}),e.jsxs(s.AlertDialogDescription,{children:['Are you sure you want to delete "',i==null?void 0:i.name,'"? This action cannot be undone and will remove all members from the group.']})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(s.AlertDialogCancel,{children:"Cancel"}),e.jsx(s.AlertDialogAction,{onClick:F,disabled:j.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:j.isPending?e.jsxs(e.Fragment,{children:[e.jsx(s.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):"Delete Group"})]})]})})]})}function tt({group:t,onManageMembers:n,onDelete:a,currentUserId:r}){const l=t.createdBy===r;return e.jsx("div",{className:"rounded-lg border bg-card p-4 transition-colors hover:bg-muted/50",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium",children:t.name}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.description})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(s.Users,{className:"h-3 w-3"}),t.memberCount," ",t.memberCount===1?"member":"members"]}),e.jsxs("span",{children:["Created ",ys.format(new Date(t.createdAt),"MMM d, yyyy")]})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(s.Button,{variant:"ghost",size:"sm",onClick:n,title:"Manage members",children:e.jsx(s.UserPlus,{className:"h-4 w-4"})}),l&&e.jsx(s.Button,{variant:"ghost",size:"sm",onClick:a,title:"Delete group",className:"text-destructive hover:text-destructive",children:e.jsx(s.Trash2,{className:"h-4 w-4"})})]})]})})}function at(){var Ee,Te,Oe,_e;_.useExportRecovery(),_.useExportPolling();const{authToken:t,tokenProps:n,id:a}=s.useSemaphorContext(),{isLocalDev:r}=s.useDashboardPreferences(),{permissions:l}=bs.useRoleAwareDisplayPreferences(),c=s.useHasDashboardId(),{isLoading:u}=s.useDashboardQuery();s.useDashboardStore(o=>o.theme);const p=s.useDashboardStore(o=>o.lenses),x=s.useDashboardStore(o=>o.selectedLensId),v=p==null?void 0:p.find(o=>o.id===x),i=s.useDashboardStore(o=>o.dashboard);s.useDashboardStore(o=>o.selectedSheetId);const d=s.useDashboardStore(o=>o.isDashboardEditing),{setDashboardTitle:m}=s.useDashboardStore(o=>o.actions),[h,j]=f.useState(!1),[b,y]=f.useState(!1),[w,M]=f.useState(!1),[k,C]=f.useState(!1),[F,T]=f.useState(!1),[R,S]=f.useState(!1),[U,P]=f.useState(!1),[G,B]=f.useState(null),[g,N]=f.useState(!1),A=s.useDashboardStore(o=>o.isDashboardPanelOpen),O=s.useDashboardStore(o=>o.actions.setIsDashboardPanelOpen),J=s.useDashboardStore(o=>o.filterValues),D=s.useDashboardStore(o=>o.isVisualEditing);s.useEditorStore(o=>o.card);const H=s.useManagementStore(o=>o.selectedDashboard),X=s.useManagementStore(o=>o.initialDashboard);s.useManagementStore(o=>o.selectedVisual),s.useDashboardStore(o=>o.selectedFrameId),s.useEditorStore(o=>o.frame);const Y=H?(Te=H==null?void 0:H.permissions)==null?void 0:Te.canEdit:(Ee=X==null?void 0:X.permissions)==null?void 0:Ee.canEdit,re=s.useDashboardStore(o=>o.showFilters),Je=s.useAssistantLayoutStore(o=>o.setPanelOpen),Xe=s.useDashboardStore(o=>o.showDashboardJSON),ne=s.useDashboardStore(o=>o.onSaveFunction),Ye=s.useDashboardStore(o=>o.actions.setShowFilters),{setIsDashboardEditing:De,setShowDashboardJSON:Ne}=s.useDashboardStore(o=>o.actions),{setInitialDashboard:we,clearSelectedDashboard:oe}=s.useManagementStore(o=>o.actions),{resources:Z}=s.useResourceManagement(s.ResourceType.DASHBOARD),{data:ie}=s.useUserPreferences(),Ze=((Oe=ie==null?void 0:ie.preference)==null?void 0:Oe.defaultDashboardId)||null,{mutate:es,isPending:ss}=s.useDefaultDashboardMutation(),{currentUser:ts}=s.useCurrentUserInfo(),as=s.canUserManageGroups(ts),q=H||X,Ce=q?{id:q.id,title:(i==null?void 0:i.title)||q.title||"Dashboard"}:null,{handleAddNewFrame:rs}=s.useAddNewFrame(),[le,ce]=f.useState(!1),[ns,z]=f.useState(!1),[V,ee]=f.useState("close"),$=s.useUpdateResource(s.ResourceType.DASHBOARD),[E,de]=f.useState(null),os=async(o,L)=>{if(!(i!=null&&i.id)){console.log("No dashboard ID found");return}console.log("Updating dashboard title:",{dashboardId:i.id,newTitle:o,previousTitle:L}),$.mutate({resourceId:i.id,data:{title:o}},{onSuccess:()=>{console.log("Dashboard title updated successfully"),s.ue.success("Dashboard title updated")},onError:W=>{console.error("Failed to update dashboard title:",W),s.ue.error("Failed to update dashboard title"),m(L)}})};f.useEffect(()=>{if(Z&&Z.length>0){const o=i==null?void 0:i.id;if(o){const L=Z.find(W=>W.id===o);L&&we(L)}}},[Z,i==null?void 0:i.id,we]);const se=n.orgUserId||n.tenantId,Le=d&&!D&&se&&Y,{setDashboard:ue}=s.useDashboardStore(o=>o.actions),is=()=>{De(!0)},me=()=>{De(!1),Ne(!1),de(null)};_.usePristineSnapshotInitializer(d,i,E,o=>de(o));const{isDirty:Me,isDirtyPending:ls,resetDirty:te}=ae.useDebouncedDirtyCheck(i,E,300,1e3,ae.serializeDashboardForDirtyCheck),Ae=f.useCallback(()=>E?ae.serializeDashboardForDirtyCheck(i)!==ae.serializeDashboardForDirtyCheck(E):!1,[i,E]),he=Me||ls,Q=le||$.isPending,cs=()=>{Ae()?(ee("close"),z(!0)):(me(),te())},ds=async()=>{await pe({closeAfterSave:!0,navigateHomeAfterSave:V==="home"})},us=()=>{E&&ue(E),me(),V==="home"&&oe(),ee("close"),z(!1),te()},ms=()=>{E&&(ue(E),te())},hs=()=>{if(d&&Ae()){ee("home"),z(!0);return}oe()};async function pe(o){const L=(o==null?void 0:o.closeAfterSave)??g,W=(o==null?void 0:o.navigateHomeAfterSave)??!1;N(L),L&&z(!1);const vs=s.cloneDeep(i);P(!0),B(null),ce(!0);const js={template:i};$.mutate({resourceId:i.id,data:js},{onSuccess:()=>{ce(!1),s.ue.success("Dashboard saved!"),de(vs),P(!1),N(!1),L&&(me(),te(),W&&oe()),ee("close")},onError:()=>{ce(!1),B("Failed to save dashboard. Please try again."),s.ue.error("Failed to save dashboard")}})}async function ps(){if(j(!0),!x||!v)return;const o=JSON.stringify(i),L={...v,template:o,filterValues:J};await je(n.apiServiceUrl,L,t==null?void 0:t.accessToken),s.ue.success("Lens saved"),ne==null||ne(i),j(!1)}const Ie=(v==null?void 0:v.name)||i.title;$.isPending&&console.log("Title during update:",{title:Ie,dashboardStateTitle:i.title,dashboardId:i==null?void 0:i.id,currentLensName:v==null?void 0:v.name});const ke=n.orgUserId||n.tenantId&&n.endUserId&&n.endUserEmail,gs=!!ke&&!!(t!=null&&t.accessToken)&&!!(n!=null&&n.apiServiceUrl),xs=c,K=(i==null?void 0:i.id)||null,ge=!!K&&Ze===K,fs=()=>{K&&es({dashboardId:ge?null:K})};return e.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between gap-2 overflow-x-auto border-b px-4 py-2",role:"dashboard-controls",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[ke&&e.jsxs(e.Fragment,{children:[e.jsx(s.IconButton,{"aria-label":"Manage Dashboards",tooltip:"Manage Dashboards",onClick:()=>{O(!A)},className:"h-7 p-2",children:e.jsx(ws,{className:"h-4 w-4"})}),xs&&!D&&e.jsx(s.IconButton,{"aria-label":"Dashboard Hub",tooltip:"Dashboard Hub",onClick:hs,className:"h-7 p-2",children:e.jsx(s.House,{className:"h-4 w-4"})})]}),!D&&c&&(u?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.LoaderCircle,{className:"h-3 w-3 animate-spin text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(s.EditableText,{value:Ie||"Untitled Dashboard",onSave:o=>{console.log("EditableText onSave called:",{newTitle:o,canEditDashboard:Y,dashboardId:i==null?void 0:i.id});const L=(i==null?void 0:i.title)||"";m(o),os(o,L)},isEditable:Y&&!v,displayClassName:"text-sm font-medium",inputClassName:"text-sm font-medium",placeholder:"Dashboard Title",isPending:$.isPending}),gs&&K&&e.jsx(s.TooltipProvider,{children:e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{variant:"ghost",size:"icon",onClick:fs,disabled:ss||!(t!=null&&t.accessToken)||!(n!=null&&n.apiServiceUrl),className:"h-7 w-7",children:e.jsx(s.Star,{className:s.cn("h-4 w-4 transition-colors",ge?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-400")})})}),e.jsx(s.TooltipContent,{children:e.jsx("p",{children:ge?"Remove as default dashboard":"Make this a default dashboard"})})]})})]}))]}),e.jsxs("div",{className:"flex items-center gap-2",children:[D&&e.jsxs(e.Fragment,{children:[e.jsx(_.AdvancedModeToggle,{className:"mr-2"}),e.jsx(_.VisualEditingControls,{className:"h-7"})]}),r&&!D&&e.jsxs(e.Fragment,{children:[e.jsx(s.IconButton,{tooltip:"Copy Token",onClick:()=>{var o;t!=null&&t.accessToken&&((o=navigator==null?void 0:navigator.clipboard)!=null&&o.writeText?navigator.clipboard.writeText(t.accessToken).then(()=>s.ue.success("Token copied to clipboard")).catch(()=>s.ue.error("Unable to copy token")):s.ue.error("Clipboard not available"))},className:"h-7 p-2",children:e.jsx(s.Copy,{className:"h-4 w-4"})}),e.jsx(s.IconButton,{tooltip:"Invalidate Token",onClick:()=>s.invalidateToken(n.apiServiceUrl),className:"h-7 p-2",children:e.jsx(Ls,{className:"h-4 w-4"})})]}),!D&&c&&e.jsx(s.DownloadPdf,{}),!D&&c&&e.jsx(_.NotificationBell,{}),!D&&c&&((_e=q==null?void 0:q.permissions)==null?void 0:_e.canShare)&&e.jsx(s.IconButton,{tooltip:"Share Dashboard",onClick:()=>y(!0),className:"h-7 p-2",children:e.jsx(s.Share2,{className:"h-4 w-4"})}),!D&&d&&l.canUseFilters&&c&&e.jsxs(s.Button,{className:"h-7 px-2",variant:"outline",onClick:()=>{re||Je("dashboard",!1),Ye(!re)},size:"sm",children:[re?e.jsx(Ds,{className:"mr-2 h-4 w-4"}):e.jsx(s.Filter,{className:"mr-2 h-4 w-4"}),"Filter"]}),d&&!D&&se&&r&&c&&e.jsx(_s,{}),!D&&se&&r&&c&&e.jsx(Fs,{}),d&&!D&&se&&v&&r&&c&&e.jsxs(s.Button,{className:"h-7 p-2",variant:"secondary",disabled:h,onClick:ps,size:"sm",children:[e.jsx(Re.Save,{className:"mr-2 h-4 w-4"}),"Save Lens"]}),d&&!D&&c&&e.jsxs(s.Button,{variant:"outline",className:"h-7 p-2",size:"sm",disabled:!d,onClick:()=>rs(),children:[e.jsx(s.Plus,{className:"mr-2 h-4 w-4"}),"Visual"]}),!D&&!d&&Y&&c&&e.jsxs(s.Button,{variant:"outline",className:"h-7 p-2",onClick:is,size:"sm",children:[e.jsx(s.Pencil,{className:"mr-2 h-4 w-4"}),"Edit"]}),Le&&c&&Me&&e.jsxs(s.Button,{variant:"outline",className:"h-7 p-2",onClick:ms,size:"sm",disabled:Q,children:[e.jsx(s.Undo2,{className:"mr-2 h-4 w-4"}),"Undo"]}),Le&&c&&e.jsxs("div",{className:"relative inline-flex",children:[e.jsxs(s.Button,{className:s.cn("h-7 p-2",!he&&"opacity-60"),disabled:Q||!he,onClick:()=>pe(),size:"sm",children:[Q?e.jsx(s.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(Re.Save,{className:"mr-2 h-4 w-4"}),Q?"Saving...":"Save"]}),he&&!Q&&e.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute -right-1 -top-1 h-2.5 w-2.5 rounded-full bg-orange-500 ring-2 ring-background"})]}),!D&&d&&r&&c&&e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(s.Button,{className:"h-7 p-2",onClick:()=>Ne(!Xe),size:"sm",variant:"ghost",children:e.jsx(s.Code,{className:"h-4 w-4"})})}),!D&&r&&e.jsx(Es,{}),d&&!D&&c&&e.jsxs(s.Button,{variant:"outline",className:"h-7 p-2",onClick:cs,children:[e.jsx(s.Cross2Icon,{className:"mr-2 h-4 w-4"}),"Close"]}),!D&&c&&e.jsxs(s.DropdownMenu,{children:[e.jsx(s.DropdownMenuTrigger,{asChild:!0,children:e.jsx(s.IconButton,{tooltip:"More Options",className:"h-7 p-2",children:e.jsx(s.EllipsisVertical,{className:"h-4 w-4"})})}),e.jsxs(s.DropdownMenuContent,{align:"end",children:[e.jsxs(s.DropdownMenuItem,{onClick:()=>C(!0),children:[e.jsx(s.Clock,{className:"mr-2 h-4 w-4"}),"Schedule Dashboard"]}),as&&e.jsxs(s.DropdownMenuItem,{onClick:()=>M(!0),children:[e.jsx(s.Users,{className:"mr-2 h-4 w-4"}),"Manage Groups"]}),e.jsxs(s.DropdownMenuItem,{onClick:()=>T(!0),children:[e.jsx(s.Calendar,{className:"mr-2 h-4 w-4"}),"Calendar Preferences"]}),e.jsxs(s.DropdownMenuItem,{onClick:()=>S(!0),children:[e.jsx(s.FileText,{className:"mr-2 h-4 w-4"}),"Summary Settings"]})]})]}),b&&Ce&&e.jsx(s.ShareDialog,{resource:Ce,resourceType:s.ResourceType.DASHBOARD,onClose:()=>y(!1)}),e.jsx(st,{open:w,onOpenChange:M}),(i==null?void 0:i.id)&&e.jsx(s.EmailScheduleDialog,{open:k,onOpenChange:C,dashboardId:i.id,dashboardName:i==null?void 0:i.title}),e.jsx(Fe.CalendarPreferencesDialog,{open:F,onOpenChange:T}),e.jsx(Fe.DashboardSummarySettingsDialog,{open:R,onOpenChange:S,dashboard:i,disabled:!d,onApply:o=>ue({...i,summary:o})}),e.jsx(s.AlertDialog,{open:U,onOpenChange:o=>{!o&&le&&!G||(P(o),o||(B(null),N(!1)))},children:e.jsxs(s.AlertDialogContent,{className:"max-w-sm",children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:G?"Save failed":"Saving dashboard"}),e.jsx(s.AlertDialogDescription,{className:"pt-2",children:G?"We could not save the dashboard. Please try again.":"Please wait while we save your changes."})]}),e.jsx(s.AlertDialogFooter,{className:"flex-col gap-2 sm:flex-row sm:justify-end",children:G?e.jsxs(e.Fragment,{children:[e.jsx(s.AlertDialogCancel,{onClick:()=>{P(!1),B(null),N(!1)},className:"m-0",children:"Close"}),e.jsx(s.AlertDialogAction,{onClick:()=>pe({closeAfterSave:g,navigateHomeAfterSave:V==="home"}),className:"m-0",children:"Retry"})]}):e.jsxs(s.AlertDialogAction,{disabled:!0,className:"m-0 cursor-default",children:[e.jsx(s.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]})})]})}),e.jsx(_.UnsavedChangesAlert,{open:ns,onOpenChange:o=>{z(o)},onSave:ds,onDiscard:us,isSaving:le,saveLabel:V==="home"?"Save & Return to Hub":"Save & Close",discardLabel:V==="home"?"Discard & Return to Hub":"Discard"})]})]})}exports.default=at;
|
|
47
|
+
*/var Pe;function Is(){return Pe||(Pe=1,process.env.NODE_ENV!=="production"&&function(){function t(h,j){return h===j&&(h!==0||1/h===1/j)||h!==h&&j!==j}function n(h,j){i||l.startTransition===void 0||(i=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var b=j();if(!d){var y=j();c(b,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}y=u({inst:{value:b,getSnapshot:j}});var w=y[0].inst,M=y[1];return x(function(){w.value=b,w.getSnapshot=j,a(w)&&M({inst:w})},[h,b,j]),p(function(){return a(w)&&M({inst:w}),h(function(){a(w)&&M({inst:w})})},[h]),v(b),b}function a(h){var j=h.getSnapshot;h=h.value;try{var b=j();return!c(h,b)}catch{return!0}}function r(h,j){return j()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var l=f,c=typeof Object.is=="function"?Object.is:t,u=l.useState,p=l.useEffect,x=l.useLayoutEffect,v=l.useDebugValue,i=!1,d=!1,m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:n;fe.useSyncExternalStore=l.useSyncExternalStore!==void 0?l.useSyncExternalStore:m,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),fe}process.env.NODE_ENV==="production"?ve.exports=ks():ve.exports=Is();var Es=ve.exports;function Ts(){const{setTheme:t}=s.useTheme(),n=s.useDashboardStore(a=>a.actions.setDashboardTheme);return e.jsxs(s.DropdownMenu,{children:[e.jsx(s.DropdownMenuTrigger,{asChild:!0,children:e.jsxs(s.Button,{className:"h-7 p-2",variant:"ghost",size:"sm",children:[e.jsx(As,{strokeWidth:1.5,className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),e.jsx(Ls,{strokeWidth:1.5,className:"absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),e.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),e.jsxs(s.DropdownMenuContent,{align:"end",children:[e.jsx(s.DropdownMenuItem,{onClick:()=>{t("light"),n("light")},children:"Light"}),e.jsx(s.DropdownMenuItem,{onClick:()=>{t("dark"),n("dark")},children:"Dark"}),e.jsx(s.DropdownMenuItem,{onClick:()=>{t("system"),n("system")},children:"System"})]})]})}async function Os(t,n,a,r,l){if(!l)return null;const c=JSON.stringify(a),u=`${t}/v1/lens`;return await s.postRequest(u,l,{name:n,template:c,filterValues:r,operation:"create"})}async function je(t,n,a){if(!a)return null;const{id:r,template:l,filterValues:c,isDefault:u,shared:p}=n,x=`${t}/v1/lens`;return await s.postRequest(x,a,{lensId:r,template:l,filterValues:c,isDefault:u,shared:p,operation:"update"})}async function _s(t,n,a){if(!a)return null;const r=`${t}/v1/lens`;return await s.postRequest(r,a,{operation:"delete",lensId:n})}function Fs(){const[t,n]=f.useState(""),[a,r]=f.useState(!1),l=s.useDashboardStore(y=>y.lenses),{setLenses:c,setSelectedLensId:u}=s.useDashboardActions(),[p,x]=f.useState(!1),[v,i]=f.useState(!1),d=s.useDashboardStore(y=>y.dashboard),m=s.useDashboardStore(y=>y.filterValues),{authToken:h,tokenProps:j}=s.useSemaphorContext();async function b(){x(!0);const y=await Os(j.apiServiceUrl,t,d,m,h==null?void 0:h.accessToken);y&&(c([...l||[],y]),u(y.id),i(!1)),x(!1)}return e.jsxs(s.Dialog,{open:v,onOpenChange:i,children:[e.jsx(s.DialogTrigger,{asChild:!0,children:e.jsxs(s.Button,{variant:"secondary",className:"h-7 p-2",size:"sm",children:[e.jsx(s.Plus,{className:"mr-2 h-4 w-4"}),"Lens"]})}),e.jsxs(s.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(s.DialogHeader,{children:[e.jsx(s.DialogTitle,{children:"Create Lens"}),e.jsx(s.DialogDescription,{children:"Lenses are private by default and are only visible to you."})]}),e.jsx("div",{className:"grid gap-4 py-4",children:e.jsxs("div",{className:"grid grid-cols-8 items-center gap-4",children:[e.jsx(s.Label,{className:"text-right",children:"Name"}),e.jsx(s.Input,{value:t,onChange:y=>{n(y.target.value)},id:"name",className:"col-span-7 focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"})]})}),a&&e.jsx("p",{className:"text-sm",children:"The lens name already exists. Use a differnet name."}),e.jsx(s.DialogFooter,{children:e.jsx(s.Button,{size:"sm",variant:"outline",type:"submit",onClick:b,disabled:p,children:p?"Creating...":"Add"})})]})]})}function Rs(){const[t,n]=f.useState(!1),a=s.useDashboardStore(d=>d.lenses),r=s.useDashboardStore(d=>d.selectedLensId),{setLenses:l,setSelectedLensId:c}=s.useDashboardActions(),{authToken:u,tokenProps:p}=s.useSemaphorContext();async function x(d){c(d)}async function v(d){if(await _s(p.apiServiceUrl,d,u==null?void 0:u.accessToken)){const h=a==null?void 0:a.filter(j=>j.id!==d);l(h||[]),c("original")}}async function i(d){const m=a==null?void 0:a.map(b=>b.id===d.id?{...b,isDefault:!d.isDefault}:{...b,isDefault:!1});l(m||[]);const h={...d,isDefault:!d.isDefault};await je(p.apiServiceUrl,h,u==null?void 0:u.accessToken);const j=a==null?void 0:a.find(b=>b.isDefault);if(j&&j.id!==d.id){const b={...j,isDefault:!1};await je(p.apiServiceUrl,b,u==null?void 0:u.accessToken)}}return e.jsxs(s.DropdownMenu,{open:t,onOpenChange:n,children:[e.jsx(s.DropdownMenuTrigger,{asChild:!0,children:e.jsx(s.IconButton,{tooltip:"Lenses",className:"h-7 p-2",children:e.jsx(ws,{className:"h-4 w-4"})})}),e.jsxs(s.DropdownMenuContent,{align:"end",className:"w-60",children:[e.jsx(s.DropdownMenuLabel,{className:"px-3",children:"Lenses"}),e.jsx(s.DropdownMenuSeparator,{}),e.jsxs(s.DropdownMenuRadioGroup,{value:r,onValueChange:x,children:[e.jsx(s.DropdownMenuRadioItem,{value:"original",children:"Original"}),a==null?void 0:a.map(d=>e.jsxs(s.DropdownMenuRadioItem,{className:"group flex justify-between gap-2",value:d.id,children:[e.jsx("p",{children:d.name}),e.jsxs("span",{className:"flex items-center gap-3",children:[e.jsx(s.House,{onClick:m=>{m.preventDefault(),i(d)},className:s.cn("size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",{invisible:!d.isDefault,"text-green-500":d.isDefault}),strokeWidth:1.5}),e.jsx(s.Cross2Icon,{onClick:m=>{m.preventDefault(),v(d.id)},className:"invisible size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",strokeWidth:1.5})]})]},d.id))]})]})]})}const Us=async(t,n,a)=>{const r=`${t}/management/v1/groups`;return await s.postRequestRegular(r,n,a)},Ps=async(t,n,a)=>{const r=`${t}/management/v1/groups/${a}`,l=await fetch(r,{method:"DELETE",headers:{Authorization:`Bearer ${n}`}});if(!l.ok){const c=await l.text();throw new Error(c||"Failed to delete group")}},Gs=async(t,n,a,r)=>{const l=`${t}/management/v1/groups/${a}/members`;return await s.postRequestRegular(l,n,r)},Bs=async(t,n,a,r)=>{const l=`${t}/management/v1/groups/${a}/members`,c=await fetch(l,{method:"DELETE",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(r)});if(!c.ok){const u=await c.text();throw new Error(u||"Failed to remove group members")}};function qs(){const{authToken:t,tokenProps:n}=s.useSemaphorContext(),a=s.useQueryClient();return s.useMutation({mutationFn:r=>Us(n.apiServiceUrl,(t==null?void 0:t.accessToken)||"",r),onSuccess:()=>{a.invalidateQueries({queryKey:["groups"]}),s.ue.success("Group created successfully")},onError:r=>{console.error("Failed to create group:",r),s.ue.error("Failed to create group",{description:r.message})}})}function Hs(){const{authToken:t,tokenProps:n}=s.useSemaphorContext(),a=s.useQueryClient();return s.useMutation({mutationFn:r=>Ps(n.apiServiceUrl,(t==null?void 0:t.accessToken)||"",r),onSuccess:(r,l)=>{a.invalidateQueries({queryKey:["groups"]}),a.removeQueries({queryKey:["group",l]}),s.ue.success("Group deleted successfully")},onError:r=>{console.error("Failed to delete group:",r),s.ue.error("Failed to delete group",{description:r.message})}})}function zs(){const{authToken:t,tokenProps:n}=s.useSemaphorContext(),a=s.useQueryClient();return s.useMutation({mutationFn:({groupId:r,data:l})=>Gs(n.apiServiceUrl,(t==null?void 0:t.accessToken)||"",r,l),onSuccess:(r,l)=>{a.invalidateQueries({queryKey:["group",l.groupId]}),a.invalidateQueries({queryKey:["group-members",l.groupId]}),a.invalidateQueries({queryKey:["groups"]}),s.ue.success("Members added successfully")},onError:r=>{console.error("Failed to add group members:",r),s.ue.error("Failed to add members",{description:r.message})}})}function Vs(){const{authToken:t,tokenProps:n}=s.useSemaphorContext(),a=s.useQueryClient();return s.useMutation({mutationFn:({groupId:r,data:l})=>Bs(n.apiServiceUrl,(t==null?void 0:t.accessToken)||"",r,l),onSuccess:(r,l)=>{a.invalidateQueries({queryKey:["group",l.groupId]}),a.invalidateQueries({queryKey:["group-members",l.groupId]}),a.invalidateQueries({queryKey:["groups"]}),s.ue.success("Members removed successfully")},onError:r=>{console.error("Failed to remove group members:",r),s.ue.error("Failed to remove members",{description:r.message})}})}function $s({onSuccess:t,tenantId:n,isTenantUser:a}){const[r,l]=f.useState(""),[c,u]=f.useState(""),[p,x]=f.useState({}),v=qs(),i=()=>{const m={};return r.trim()?r.length<3?m.name="Group name must be at least 3 characters":r.length>50&&(m.name="Group name must be less than 50 characters"):m.name="Group name is required",c&&c.length>200&&(m.description="Description must be less than 200 characters"),x(m),Object.keys(m).length===0},d=async m=>{if(m.preventDefault(),!i())return;const h={name:r.trim(),description:c.trim()||void 0,type:a?"TENANT_GROUP":"ORG_GROUP",...a&&n?{tenantId:n}:{}};try{await v.mutateAsync(h),l(""),u(""),x({}),t()}catch(j){console.error("Failed to create group:",j)}};return e.jsxs("form",{onSubmit:d,className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(s.Label,{htmlFor:"group-name",children:["Group Name ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(s.Input,{id:"group-name",placeholder:"e.g., Marketing Team, Engineering Squad",value:r,onChange:m=>{l(m.target.value),p.name&&x(h=>({...h,name:""}))},className:p.name?"border-destructive":"",disabled:v.isPending}),p.name&&e.jsx("p",{className:"text-sm text-destructive",children:p.name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(s.Label,{htmlFor:"group-description",children:["Description",e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(optional)"})]}),e.jsx(s.Textarea,{id:"group-description",placeholder:"Describe the purpose of this group...",value:c,onChange:m=>{u(m.target.value),p.description&&x(h=>({...h,description:""}))},className:p.description?"border-destructive":"",disabled:v.isPending,rows:3}),p.description&&e.jsx("p",{className:"text-sm text-destructive",children:p.description}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[c.length,"/200 characters"]})]}),e.jsx("div",{className:"rounded-lg border bg-muted/50 p-4",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx(s.CircleAlert,{className:"h-4 w-4 mt-0.5 text-muted-foreground"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"This group will be accessible to users in your workspace. You can add members after creating the group."})]})})]}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx(s.Button,{type:"button",variant:"outline",onClick:()=>{l(""),u(""),x({})},disabled:v.isPending,children:"Clear"}),e.jsx(s.Button,{type:"submit",disabled:v.isPending||!r.trim(),children:v.isPending?e.jsxs(e.Fragment,{children:[e.jsx(s.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(s.Users,{className:"mr-2 h-4 w-4"}),"Create Group"]})})]})]})}function Qs(){return Es.useSyncExternalStore(Ks,()=>!0,()=>!1)}function Ks(){return()=>{}}var be="Avatar",[Ws]=s.createContextScope(be),[Js,Be]=Ws(be),qe=k.forwardRef((t,n)=>{const{__scopeAvatar:a,...r}=t,[l,c]=k.useState("idle");return e.jsx(Js,{scope:a,imageLoadingStatus:l,onImageLoadingStatusChange:c,children:e.jsx(s.Primitive.span,{...r,ref:n})})});qe.displayName=be;var He="AvatarImage",ze=k.forwardRef((t,n)=>{const{__scopeAvatar:a,src:r,onLoadingStatusChange:l=()=>{},...c}=t,u=Be(He,a),p=Xs(r,c),x=s.useCallbackRef(v=>{l(v),u.onImageLoadingStatusChange(v)});return s.useLayoutEffect2(()=>{p!=="idle"&&x(p)},[p,x]),p==="loaded"?e.jsx(s.Primitive.img,{...c,ref:n,src:r}):null});ze.displayName=He;var Ve="AvatarFallback",$e=k.forwardRef((t,n)=>{const{__scopeAvatar:a,delayMs:r,...l}=t,c=Be(Ve,a),[u,p]=k.useState(r===void 0);return k.useEffect(()=>{if(r!==void 0){const x=window.setTimeout(()=>p(!0),r);return()=>window.clearTimeout(x)}},[r]),u&&c.imageLoadingStatus!=="loaded"?e.jsx(s.Primitive.span,{...l,ref:n}):null});$e.displayName=Ve;function Ge(t,n){return t?n?(t.src!==n&&(t.src=n),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function Xs(t,{referrerPolicy:n,crossOrigin:a}){const r=Qs(),l=k.useRef(null),c=r?(l.current||(l.current=new window.Image),l.current):null,[u,p]=k.useState(()=>Ge(c,t));return s.useLayoutEffect2(()=>{p(Ge(c,t))},[c,t]),s.useLayoutEffect2(()=>{const x=d=>()=>{p(d)};if(!c)return;const v=x("loaded"),i=x("error");return c.addEventListener("load",v),c.addEventListener("error",i),n&&(c.referrerPolicy=n),typeof a=="string"&&(c.crossOrigin=a),()=>{c.removeEventListener("load",v),c.removeEventListener("error",i)}},[c,a,n]),u}var Qe=qe,Ke=ze,We=$e;const ye=k.forwardRef(({className:t,...n},a)=>e.jsx(Qe,{ref:a,className:s.cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...n}));ye.displayName=Qe.displayName;const Ys=k.forwardRef(({className:t,...n},a)=>e.jsx(Ke,{ref:a,className:s.cn("aspect-square h-full w-full",t),...n}));Ys.displayName=Ke.displayName;const Se=k.forwardRef(({className:t,...n},a)=>e.jsx(We,{ref:a,className:s.cn("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...n}));Se.displayName=We.displayName;function Zs({open:t,onOpenChange:n,group:a,onUpdate:r}){const[l,c]=f.useState("members"),[u,p]=f.useState(""),[x,v]=f.useState([]),[i,d]=f.useState([]),{data:m,isLoading:h,refetch:j}=s.useGroupMembers(a.id),b=a.type==="TENANT_GROUP"?"tenant":"organization",{users:y,isLoading:w}=s.useUnifiedUsers({type:b,tenantId:a.tenantId||void 0,active:!0,limit:100}),M=zs(),I=Vs(),C=(m==null?void 0:m.members)||[],F=f.useMemo(()=>new Set(C.map(g=>g.userId)),[C]),T=f.useMemo(()=>y.filter(g=>!F.has(g.id)),[y,F]),R=f.useMemo(()=>{if(!u)return T;const g=u.toLowerCase();return T.filter(N=>{var A,O;return((A=N.name)==null?void 0:A.toLowerCase().includes(g))||((O=N.email)==null?void 0:O.toLowerCase().includes(g))})},[T,u]),S=f.useMemo(()=>{if(!u)return C;const g=u.toLowerCase();return C.filter(N=>{var A,O,J,D;return((O=(A=N.user)==null?void 0:A.name)==null?void 0:O.toLowerCase().includes(g))||((D=(J=N.user)==null?void 0:J.email)==null?void 0:D.toLowerCase().includes(g))})},[C,u]),U=async()=>{if(x.length!==0)try{await M.mutateAsync({groupId:a.id,data:{userIds:x,userType:b==="tenant"?"tenant":"org"}}),v([]),c("members"),j(),r==null||r()}catch(g){console.error("Failed to add members:",g)}},P=async()=>{if(i.length!==0)try{await I.mutateAsync({groupId:a.id,data:{userIds:i}}),d([]),j(),r==null||r()}catch(g){console.error("Failed to remove members:",g)}},G=g=>{v(N=>N.includes(g)?N.filter(A=>A!==g):[...N,g])},B=g=>{d(N=>N.includes(g)?N.filter(A=>A!==g):[...N,g])};return e.jsx(e.Fragment,{children:e.jsx(s.Dialog,{open:t,onOpenChange:n,children:e.jsxs(s.DialogContent,{className:"max-w-3xl max-h-[80vh]","aria-describedby":"group-members-description",children:[e.jsxs(s.DialogHeader,{children:[e.jsx(s.DialogTitle,{children:a.name}),e.jsx("div",{className:"flex items-center gap-2 mt-1",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:[C.length," ",C.length===1?"member":"members"]})}),e.jsxs("p",{id:"group-members-description",className:"sr-only",children:["Add or remove members from the ",a.name," group"]})]}),e.jsxs(s.Tabs,{value:l,onValueChange:g=>{c(g),p(""),d([])},className:"mt-4",children:[e.jsxs(s.TabsList,{className:"grid w-full grid-cols-2",children:[e.jsx(s.TabsTrigger,{value:"members",children:"Current Members"}),e.jsx(s.TabsTrigger,{value:"add",children:"Add Members"})]}),e.jsxs(s.TabsContent,{value:"members",className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(s.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(s.Input,{placeholder:"Search members...",value:u,onChange:g=>p(g.target.value),className:"pl-10"})]}),e.jsx(s.ScrollArea,{className:i.length>0?"h-[300px]":"h-[350px]",children:h?e.jsx("div",{className:"space-y-2",children:[1,2,3].map(g=>e.jsx(s.Skeleton,{className:"h-16 w-full"},g))}):S.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(s.Users,{className:"h-12 w-12 mb-3 opacity-50"}),e.jsx("p",{className:"text-sm font-medium",children:u?"No members found":"No members yet"}),e.jsx("p",{className:"text-xs mt-1",children:u?"Try a different search":'Switch to the "Add Members" tab to add people to this group'})]}):e.jsx("div",{className:"space-y-2",children:S.map(g=>e.jsx(et,{member:g,selected:i.includes(g.userId),onToggle:()=>B(g.userId)},g.id))})}),i.length>0&&e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:[i.length," member",i.length!==1?"s":""," selected"]}),e.jsx(s.Button,{variant:"destructive",size:"sm",onClick:P,disabled:I.isPending,children:I.isPending?e.jsxs(e.Fragment,{children:[e.jsx(s.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Removing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(s.Trash2,{className:"mr-2 h-4 w-4"}),"Remove Selected"]})})]})]}),e.jsxs(s.TabsContent,{value:"add",className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(s.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(s.Input,{placeholder:"Search users to add...",value:u,onChange:g=>p(g.target.value),className:"pl-10"})]}),e.jsx(s.ScrollArea,{className:"h-[300px]",children:w?e.jsx("div",{className:"space-y-2",children:[1,2,3].map(g=>e.jsx(s.Skeleton,{className:"h-16 w-full"},g))}):R.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(s.UserPlus,{className:"h-12 w-12 mb-3 opacity-50"}),e.jsx("p",{className:"text-sm font-medium",children:"No available users"}),e.jsx("p",{className:"text-xs mt-1",children:u?"Try a different search":"All eligible users are already members"})]}):e.jsx("div",{className:"space-y-2",children:R.map(g=>e.jsx(st,{user:g,selected:x.includes(g.id),onToggle:()=>G(g.id)},g.id))})}),x.length>0&&e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:[x.length," user",x.length!==1?"s":""," selected"]}),e.jsx(s.Button,{onClick:U,disabled:M.isPending,children:M.isPending?e.jsxs(e.Fragment,{children:[e.jsx(s.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Adding..."]}):e.jsxs(e.Fragment,{children:[e.jsx(s.UserPlus,{className:"mr-2 h-4 w-4"}),"Add Members"]})})]})]})]})]})})})}function et({member:t,selected:n,onToggle:a}){var l,c,u,p;const r=((c=(l=t.user)==null?void 0:l.name)==null?void 0:c.split(" ").map(x=>x[0]).join("").toUpperCase())||"?";return e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg border bg-card hover:bg-muted/50 cursor-pointer",onClick:a,children:[e.jsx(s.Checkbox,{checked:n}),e.jsx(ye,{className:"h-8 w-8",children:e.jsx(Se,{className:"text-xs",children:r})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium",children:((u=t.user)==null?void 0:u.name)||"Unknown User"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:(p=t.user)==null?void 0:p.email})]})]})}function st({user:t,selected:n,onToggle:a}){var l;const r=((l=t.name)==null?void 0:l.split(" ").map(c=>c[0]).join("").toUpperCase())||"?";return e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg border bg-card hover:bg-muted/50 cursor-pointer",onClick:a,children:[e.jsx(s.Checkbox,{checked:n}),e.jsx(ye,{className:"h-8 w-8",children:e.jsx(Se,{className:"text-xs",children:r})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium",children:t.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t.email})]})]})}function tt({open:t,onOpenChange:n}){const[a,r]=f.useState("groups"),[l,c]=f.useState(""),[u,p]=f.useState(null),[x,v]=f.useState(!1),[i,d]=f.useState(null),{tokenProps:m}=s.useSemaphorContext(),{currentUser:h}=s.useCurrentUserInfo(),j=Hs(),b=(h==null?void 0:h.type)==="tenant",y=m==null?void 0:m.tenantId,{groups:w,isLoading:M,refetch:I}=s.useGroups({type:b?"TENANT_GROUP":"all",tenantId:b?y:void 0,includeMembers:!1}),C=w.filter(S=>{var U;return S.name.toLowerCase().includes(l.toLowerCase())||((U=S.description)==null?void 0:U.toLowerCase().includes(l.toLowerCase()))}),F=async()=>{if(i)try{await j.mutateAsync(i.id),d(null),I()}catch(S){console.error("Failed to delete group:",S)}},T=S=>{p(S),v(!0)},R=()=>{r("groups"),I()};return e.jsxs(e.Fragment,{children:[e.jsx(s.Dialog,{open:t,onOpenChange:n,children:e.jsxs(s.DialogContent,{className:"max-w-4xl max-h-[80vh]",children:[e.jsxs(s.DialogHeader,{children:[e.jsxs(s.DialogTitle,{className:"flex items-center gap-2",children:[e.jsx(s.Users,{className:"h-5 w-5"}),"Group Management"]}),e.jsx(s.DialogDescription,{children:"Manage your groups, create new groups, and control group membership"})]}),e.jsxs(s.Tabs,{value:a,onValueChange:r,className:"mt-4",children:[e.jsxs(s.TabsList,{className:"grid w-full grid-cols-2",children:[e.jsxs(s.TabsTrigger,{value:"groups",className:"flex items-center gap-2",children:[e.jsx(s.Users,{className:"h-4 w-4"}),"Groups"]}),e.jsxs(s.TabsTrigger,{value:"create",className:"flex items-center gap-2",children:[e.jsx(s.Plus,{className:"h-4 w-4"}),"Create Group"]})]}),e.jsx(s.TabsContent,{value:"groups",className:"mt-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(s.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(s.Input,{placeholder:"Search groups...",value:l,onChange:S=>c(S.target.value),className:"pl-10"})]}),e.jsx(s.ScrollArea,{className:"h-[400px]",children:M?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(S=>e.jsx(s.Skeleton,{className:"h-24 w-full"},S))}):C.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(s.Users,{className:"h-12 w-12 mb-3 opacity-50"}),e.jsx("p",{className:"text-sm font-medium",children:"No groups found"}),e.jsx("p",{className:"text-xs mt-1",children:l?"Try a different search":"Create your first group to get started"})]}):e.jsx("div",{className:"space-y-3",children:C.map(S=>e.jsx(at,{group:S,onManageMembers:()=>T(S),onDelete:()=>d(S),currentUserId:h==null?void 0:h.id},S.id))})})]})}),e.jsx(s.TabsContent,{value:"create",className:"mt-4",children:e.jsx($s,{onSuccess:R,tenantId:y,isTenantUser:b})})]})]})}),u&&e.jsx(Zs,{open:x,onOpenChange:v,group:u,onUpdate:()=>I()}),e.jsx(s.AlertDialog,{open:!!i,onOpenChange:()=>d(null),children:e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:"Delete Group"}),e.jsxs(s.AlertDialogDescription,{children:['Are you sure you want to delete "',i==null?void 0:i.name,'"? This action cannot be undone and will remove all members from the group.']})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(s.AlertDialogCancel,{children:"Cancel"}),e.jsx(s.AlertDialogAction,{onClick:F,disabled:j.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:j.isPending?e.jsxs(e.Fragment,{children:[e.jsx(s.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):"Delete Group"})]})]})})]})}function at({group:t,onManageMembers:n,onDelete:a,currentUserId:r}){const l=t.createdBy===r;return e.jsx("div",{className:"rounded-lg border bg-card p-4 transition-colors hover:bg-muted/50",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium",children:t.name}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.description})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(s.Users,{className:"h-3 w-3"}),t.memberCount," ",t.memberCount===1?"member":"members"]}),e.jsxs("span",{children:["Created ",ys.format(new Date(t.createdAt),"MMM d, yyyy")]})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(s.Button,{variant:"ghost",size:"sm",onClick:n,title:"Manage members",children:e.jsx(s.UserPlus,{className:"h-4 w-4"})}),l&&e.jsx(s.Button,{variant:"ghost",size:"sm",onClick:a,title:"Delete group",className:"text-destructive hover:text-destructive",children:e.jsx(s.Trash2,{className:"h-4 w-4"})})]})]})})}function rt(){var Ee,Te,Oe,_e;_.useExportRecovery(),_.useExportPolling();const{authToken:t,tokenProps:n,id:a}=s.useSemaphorContext(),{isLocalDev:r}=s.useDashboardPreferences(),{permissions:l}=bs.useRoleAwareDisplayPreferences(),c=s.useHasDashboardId(),{isLoading:u}=s.useDashboardQuery();s.useDashboardStore(o=>o.theme);const p=s.useDashboardStore(o=>o.lenses),x=s.useDashboardStore(o=>o.selectedLensId),v=p==null?void 0:p.find(o=>o.id===x),i=s.useDashboardStore(o=>o.dashboard);s.useDashboardStore(o=>o.selectedSheetId);const d=s.useDashboardStore(o=>o.isDashboardEditing),{setDashboardTitle:m}=s.useDashboardStore(o=>o.actions),[h,j]=f.useState(!1),[b,y]=f.useState(!1),[w,M]=f.useState(!1),[I,C]=f.useState(!1),[F,T]=f.useState(!1),[R,S]=f.useState(!1),[U,P]=f.useState(!1),[G,B]=f.useState(null),[g,N]=f.useState(!1),A=s.useDashboardStore(o=>o.isDashboardPanelOpen),O=s.useDashboardStore(o=>o.actions.setIsDashboardPanelOpen),J=s.useDashboardStore(o=>o.filterValues),D=s.useDashboardStore(o=>o.isVisualEditing);s.useEditorStore(o=>o.card);const H=s.useManagementStore(o=>o.selectedDashboard),X=s.useManagementStore(o=>o.initialDashboard);s.useManagementStore(o=>o.selectedVisual),s.useDashboardStore(o=>o.selectedFrameId),s.useEditorStore(o=>o.frame);const Y=H?(Te=H==null?void 0:H.permissions)==null?void 0:Te.canEdit:(Ee=X==null?void 0:X.permissions)==null?void 0:Ee.canEdit,ae=s.useDashboardStore(o=>o.showFilters),Je=s.useAssistantLayoutStore(o=>o.setPanelOpen),Xe=s.useDashboardStore(o=>o.showDashboardJSON),re=s.useDashboardStore(o=>o.onSaveFunction),Ye=s.useDashboardStore(o=>o.actions.setShowFilters),{setIsDashboardEditing:De,setShowDashboardJSON:Ne}=s.useDashboardStore(o=>o.actions),{setInitialDashboard:we,clearSelectedDashboard:ne}=s.useManagementStore(o=>o.actions),{resources:Z}=s.useResourceManagement(s.ResourceType.DASHBOARD),{data:oe}=s.useUserPreferences(),Ze=((Oe=oe==null?void 0:oe.preference)==null?void 0:Oe.defaultDashboardId)||null,{mutate:es,isPending:ss}=s.useDefaultDashboardMutation(),{currentUser:ts}=s.useCurrentUserInfo(),as=s.canUserManageGroups(ts),q=H||X,Ce=q?{id:q.id,title:(i==null?void 0:i.title)||q.title||"Dashboard"}:null,{handleAddNewFrame:rs}=s.useAddNewFrame(),[ie,le]=f.useState(!1),[ns,z]=f.useState(!1),[V,ee]=f.useState("close"),$=s.useUpdateResource(s.ResourceType.DASHBOARD),[E,ce]=f.useState(null),os=async(o,L)=>{if(!(i!=null&&i.id)){console.log("No dashboard ID found");return}console.log("Updating dashboard title:",{dashboardId:i.id,newTitle:o,previousTitle:L}),$.mutate({resourceId:i.id,data:{title:o}},{onSuccess:()=>{console.log("Dashboard title updated successfully"),s.ue.success("Dashboard title updated")},onError:W=>{console.error("Failed to update dashboard title:",W),s.ue.error("Failed to update dashboard title"),m(L)}})};f.useEffect(()=>{if(Z&&Z.length>0){const o=i==null?void 0:i.id;if(o){const L=Z.find(W=>W.id===o);L&&we(L)}}},[Z,i==null?void 0:i.id,we]);const se=n.orgUserId||n.tenantId,Le=d&&!D&&se&&Y,{setDashboard:de}=s.useDashboardStore(o=>o.actions),is=()=>{De(!0)},ue=()=>{De(!1),Ne(!1),ce(null)};_.usePristineSnapshotInitializer(d,i,E,o=>ce(o));const{isDirty:Me,isDirtyPending:ls,resetDirty:te}=Ss.useDebouncedDirtyCheck(i,E,300,1e3,ge.serializeDashboardForDirtyCheck),Ae=f.useCallback(()=>E?ge.serializeDashboardForDirtyCheck(i)!==ge.serializeDashboardForDirtyCheck(E):!1,[i,E]),me=Me||ls,Q=ie||$.isPending,cs=()=>{Ae()?(ee("close"),z(!0)):(ue(),te())},ds=async()=>{await he({closeAfterSave:!0,navigateHomeAfterSave:V==="home"})},us=()=>{E&&de(E),ue(),V==="home"&&ne(),ee("close"),z(!1),te()},ms=()=>{E&&(de(E),te())},hs=()=>{if(d&&Ae()){ee("home"),z(!0);return}ne()};async function he(o){const L=(o==null?void 0:o.closeAfterSave)??g,W=(o==null?void 0:o.navigateHomeAfterSave)??!1;N(L),L&&z(!1);const vs=s.cloneDeep(i);P(!0),B(null),le(!0);const js={template:i};$.mutate({resourceId:i.id,data:js},{onSuccess:()=>{le(!1),s.ue.success("Dashboard saved!"),ce(vs),P(!1),N(!1),L&&(ue(),te(),W&&ne()),ee("close")},onError:()=>{le(!1),B("Failed to save dashboard. Please try again."),s.ue.error("Failed to save dashboard")}})}async function ps(){if(j(!0),!x||!v)return;const o=JSON.stringify(i),L={...v,template:o,filterValues:J};await je(n.apiServiceUrl,L,t==null?void 0:t.accessToken),s.ue.success("Lens saved"),re==null||re(i),j(!1)}const ke=(v==null?void 0:v.name)||i.title;$.isPending&&console.log("Title during update:",{title:ke,dashboardStateTitle:i.title,dashboardId:i==null?void 0:i.id,currentLensName:v==null?void 0:v.name});const Ie=n.orgUserId||n.tenantId&&n.endUserId&&n.endUserEmail,gs=!!Ie&&!!(t!=null&&t.accessToken)&&!!(n!=null&&n.apiServiceUrl),xs=c,K=(i==null?void 0:i.id)||null,pe=!!K&&Ze===K,fs=()=>{K&&es({dashboardId:pe?null:K})};return e.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between gap-2 overflow-x-auto border-b px-4 py-2",role:"dashboard-controls",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[Ie&&e.jsxs(e.Fragment,{children:[e.jsx(s.IconButton,{"aria-label":"Manage Dashboards",tooltip:"Manage Dashboards",onClick:()=>{O(!A)},className:"h-7 p-2",children:e.jsx(Cs,{className:"h-4 w-4"})}),xs&&!D&&e.jsx(s.IconButton,{"aria-label":"Dashboard Hub",tooltip:"Dashboard Hub",onClick:hs,className:"h-7 p-2",children:e.jsx(s.House,{className:"h-4 w-4"})})]}),!D&&c&&(u?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.LoaderCircle,{className:"h-3 w-3 animate-spin text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(s.EditableText,{value:ke||"Untitled Dashboard",onSave:o=>{console.log("EditableText onSave called:",{newTitle:o,canEditDashboard:Y,dashboardId:i==null?void 0:i.id});const L=(i==null?void 0:i.title)||"";m(o),os(o,L)},isEditable:Y&&!v,displayClassName:"text-sm font-medium",inputClassName:"text-sm font-medium",placeholder:"Dashboard Title",isPending:$.isPending}),gs&&K&&e.jsx(s.TooltipProvider,{children:e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{variant:"ghost",size:"icon",onClick:fs,disabled:ss||!(t!=null&&t.accessToken)||!(n!=null&&n.apiServiceUrl),className:"h-7 w-7",children:e.jsx(s.Star,{className:s.cn("h-4 w-4 transition-colors",pe?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-400")})})}),e.jsx(s.TooltipContent,{children:e.jsx("p",{children:pe?"Remove as default dashboard":"Make this a default dashboard"})})]})})]}))]}),e.jsxs("div",{className:"flex items-center gap-2",children:[D&&e.jsxs(e.Fragment,{children:[e.jsx(_.AdvancedModeToggle,{className:"mr-2"}),e.jsx(_.VisualEditingControls,{className:"h-7"})]}),r&&!D&&e.jsxs(e.Fragment,{children:[e.jsx(s.IconButton,{tooltip:"Copy Token",onClick:()=>{var o;t!=null&&t.accessToken&&((o=navigator==null?void 0:navigator.clipboard)!=null&&o.writeText?navigator.clipboard.writeText(t.accessToken).then(()=>s.ue.success("Token copied to clipboard")).catch(()=>s.ue.error("Unable to copy token")):s.ue.error("Clipboard not available"))},className:"h-7 p-2",children:e.jsx(s.Copy,{className:"h-4 w-4"})}),e.jsx(s.IconButton,{tooltip:"Invalidate Token",onClick:()=>s.invalidateToken(n.apiServiceUrl),className:"h-7 p-2",children:e.jsx(Ms,{className:"h-4 w-4"})})]}),!D&&c&&e.jsx(s.DownloadPdf,{}),!D&&c&&e.jsx(_.NotificationBell,{}),!D&&c&&((_e=q==null?void 0:q.permissions)==null?void 0:_e.canShare)&&e.jsx(s.IconButton,{tooltip:"Share Dashboard",onClick:()=>y(!0),className:"h-7 p-2",children:e.jsx(s.Share2,{className:"h-4 w-4"})}),!D&&d&&l.canUseFilters&&c&&e.jsxs(s.Button,{className:"h-7 px-2",variant:"outline",onClick:()=>{ae||Je("dashboard",!1),Ye(!ae)},size:"sm",children:[ae?e.jsx(Ns,{className:"mr-2 h-4 w-4"}):e.jsx(s.Filter,{className:"mr-2 h-4 w-4"}),"Filter"]}),d&&!D&&se&&r&&c&&e.jsx(Fs,{}),!D&&se&&r&&c&&e.jsx(Rs,{}),d&&!D&&se&&v&&r&&c&&e.jsxs(s.Button,{className:"h-7 p-2",variant:"secondary",disabled:h,onClick:ps,size:"sm",children:[e.jsx(Re.Save,{className:"mr-2 h-4 w-4"}),"Save Lens"]}),d&&!D&&c&&e.jsxs(s.Button,{variant:"outline",className:"h-7 p-2",size:"sm",disabled:!d,onClick:()=>rs(),children:[e.jsx(s.Plus,{className:"mr-2 h-4 w-4"}),"Visual"]}),!D&&!d&&Y&&c&&e.jsxs(s.Button,{variant:"outline",className:"h-7 p-2",onClick:is,size:"sm",children:[e.jsx(s.Pencil,{className:"mr-2 h-4 w-4"}),"Edit"]}),Le&&c&&Me&&e.jsxs(s.Button,{variant:"outline",className:"h-7 p-2",onClick:ms,size:"sm",disabled:Q,children:[e.jsx(s.Undo2,{className:"mr-2 h-4 w-4"}),"Undo"]}),Le&&c&&e.jsxs("div",{className:"relative inline-flex",children:[e.jsxs(s.Button,{className:s.cn("h-7 p-2",!me&&"opacity-60"),disabled:Q||!me,onClick:()=>he(),size:"sm",children:[Q?e.jsx(s.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(Re.Save,{className:"mr-2 h-4 w-4"}),Q?"Saving...":"Save"]}),me&&!Q&&e.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute -right-1 -top-1 h-2.5 w-2.5 rounded-full bg-orange-500 ring-2 ring-background"})]}),!D&&d&&r&&c&&e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(s.Button,{className:"h-7 p-2",onClick:()=>Ne(!Xe),size:"sm",variant:"ghost",children:e.jsx(s.Code,{className:"h-4 w-4"})})}),!D&&r&&e.jsx(Ts,{}),d&&!D&&c&&e.jsxs(s.Button,{variant:"outline",className:"h-7 p-2",onClick:cs,children:[e.jsx(s.Cross2Icon,{className:"mr-2 h-4 w-4"}),"Close"]}),!D&&c&&e.jsxs(s.DropdownMenu,{children:[e.jsx(s.DropdownMenuTrigger,{asChild:!0,children:e.jsx(s.IconButton,{tooltip:"More Options",className:"h-7 p-2",children:e.jsx(s.EllipsisVertical,{className:"h-4 w-4"})})}),e.jsxs(s.DropdownMenuContent,{align:"end",children:[e.jsxs(s.DropdownMenuItem,{onClick:()=>C(!0),children:[e.jsx(s.Clock,{className:"mr-2 h-4 w-4"}),"Schedule Dashboard"]}),as&&e.jsxs(s.DropdownMenuItem,{onClick:()=>M(!0),children:[e.jsx(s.Users,{className:"mr-2 h-4 w-4"}),"Manage Groups"]}),e.jsxs(s.DropdownMenuItem,{onClick:()=>T(!0),children:[e.jsx(s.Calendar,{className:"mr-2 h-4 w-4"}),"Calendar Preferences"]}),e.jsxs(s.DropdownMenuItem,{onClick:()=>S(!0),children:[e.jsx(s.FileText,{className:"mr-2 h-4 w-4"}),"Summary Settings"]})]})]}),b&&Ce&&e.jsx(s.ShareDialog,{resource:Ce,resourceType:s.ResourceType.DASHBOARD,onClose:()=>y(!1)}),e.jsx(tt,{open:w,onOpenChange:M}),(i==null?void 0:i.id)&&e.jsx(s.EmailScheduleDialog,{open:I,onOpenChange:C,dashboardId:i.id,dashboardName:i==null?void 0:i.title}),e.jsx(Fe.CalendarPreferencesDialog,{open:F,onOpenChange:T}),e.jsx(Fe.DashboardSummarySettingsDialog,{open:R,onOpenChange:S,dashboard:i,disabled:!d,onApply:o=>de({...i,summary:o})}),e.jsx(s.AlertDialog,{open:U,onOpenChange:o=>{!o&&ie&&!G||(P(o),o||(B(null),N(!1)))},children:e.jsxs(s.AlertDialogContent,{className:"max-w-sm",children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:G?"Save failed":"Saving dashboard"}),e.jsx(s.AlertDialogDescription,{className:"pt-2",children:G?"We could not save the dashboard. Please try again.":"Please wait while we save your changes."})]}),e.jsx(s.AlertDialogFooter,{className:"flex-col gap-2 sm:flex-row sm:justify-end",children:G?e.jsxs(e.Fragment,{children:[e.jsx(s.AlertDialogCancel,{onClick:()=>{P(!1),B(null),N(!1)},className:"m-0",children:"Close"}),e.jsx(s.AlertDialogAction,{onClick:()=>he({closeAfterSave:g,navigateHomeAfterSave:V==="home"}),className:"m-0",children:"Retry"})]}):e.jsxs(s.AlertDialogAction,{disabled:!0,className:"m-0 cursor-default",children:[e.jsx(s.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]})})]})}),e.jsx(_.UnsavedChangesAlert,{open:ns,onOpenChange:o=>{z(o)},onSave:ds,onDiscard:us,isSaving:ie,saveLabel:V==="home"?"Save & Return to Hub":"Save & Close",discardLabel:V==="home"?"Discard & Return to Hub":"Discard"})]})]})}exports.default=rt;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { jsxs as a, jsx as e, Fragment as k } from "react/jsx-runtime";
|
|
2
|
-
import { bS as Z, cS as Na, u as w, c8 as $e, c9 as Be, B as L, cb as Ke, cc as H, cT as Qe, Z as xs, l as P, m as We, cU as Sa, c7 as Je, n as Xe, o as Ze, p as Ye, q as Ds, L as Ge, Q as oe, G as wa, ac as j, cV as xa, cg as Da, cW as Ca, cX as vs, cY as Cs, c as X, cZ as Ls, U as be, c_ as ye, I as E, c$ as Es, cH as La, d0 as Ea, H as q, cf as V, d1 as es, d2 as Aa, d3 as ka, d4 as Re, d5 as Ma, d6 as Oa, d7 as As, d8 as ks, d9 as ge, da as ve, cD as Pe, cm as Fe, db as je, ch as Ms, dc as He, dd as Os, e as Is, de as Ia, cp as Ts, cq as _s, cr as Us, cs as Gs, ct as Rs, cu as Ps, cv as Fs, cw as qe, c6 as Ta, df as _a, bG as Ua, a1 as bs, bO as pe, dg as Ga, bP as Ra, as as Ie, dh as Pa, di as Fa, dj as ja, bj as Ha, dk as qa, dl as Va, bZ as za, b_ as $a, b$ as Ba, dm as Ka, c1 as Qa, cd as Wa, a_ as Ja, dn as Xa, dp as Za, dq as Ya, dr as et, ds as st, dt as at, ca as tt, ae as rt, cj as nt, du as ot, au as it, af as lt, ay as ct } from "./index-
|
|
2
|
+
import { bS as Z, cS as Na, u as w, c8 as $e, c9 as Be, B as L, cb as Ke, cc as H, cT as Qe, Z as xs, l as P, m as We, cU as Sa, c7 as Je, n as Xe, o as Ze, p as Ye, q as Ds, L as Ge, Q as oe, G as wa, ac as j, cV as xa, cg as Da, cW as Ca, cX as vs, cY as Cs, c as X, cZ as Ls, U as be, c_ as ye, I as E, c$ as Es, cH as La, d0 as Ea, H as q, cf as V, d1 as es, d2 as Aa, d3 as ka, d4 as Re, d5 as Ma, d6 as Oa, d7 as As, d8 as ks, d9 as ge, da as ve, cD as Pe, cm as Fe, db as je, ch as Ms, dc as He, dd as Os, e as Is, de as Ia, cp as Ts, cq as _s, cr as Us, cs as Gs, ct as Rs, cu as Ps, cv as Fs, cw as qe, c6 as Ta, df as _a, bG as Ua, a1 as bs, bO as pe, dg as Ga, bP as Ra, as as Ie, dh as Pa, di as Fa, dj as ja, bj as Ha, dk as qa, dl as Va, bZ as za, b_ as $a, b$ as Ba, dm as Ka, c1 as Qa, cd as Wa, a_ as Ja, dn as Xa, dp as Za, dq as Ya, dr as et, ds as st, dt as at, ca as tt, ae as rt, cj as nt, du as ot, au as it, af as lt, ay as ct } from "./index-C0uTSIns.js";
|
|
3
3
|
import * as _ from "react";
|
|
4
4
|
import js, { useState as S, useMemo as fe, useEffect as dt, useCallback as ut } from "react";
|
|
5
5
|
import "react-dom";
|
|
6
|
-
import { b as mt, u as ht, c as pt, A as ft, V as gt, N as vt, U as bt } from "./notification-bell-
|
|
7
|
-
import { u as yt } from "./use-role-aware-display-preferences-
|
|
6
|
+
import { b as mt, u as ht, c as pt, A as ft, V as gt, N as vt, U as bt } from "./notification-bell-DZukXqhn.js";
|
|
7
|
+
import { u as yt } from "./use-role-aware-display-preferences-v3z-8Fyh.js";
|
|
8
8
|
import { d as Nt } from "./date-formatter-Y8Za1ib3.js";
|
|
9
|
-
import { C as St, D as wt } from "./dashboard-summary-settings-dialog-
|
|
10
|
-
import { u as xt
|
|
11
|
-
import {
|
|
9
|
+
import { C as St, D as wt } from "./dashboard-summary-settings-dialog-95pmx2I6.js";
|
|
10
|
+
import { u as xt } from "./use-debounced-dirty-check-BwAbnX_5.js";
|
|
11
|
+
import { s as Te } from "./normalize-dashboard-for-dirty-check-Bn27S0PN.js";
|
|
12
|
+
import { S as ys } from "./editor-action-buttons-CL_G2bSD.js";
|
|
12
13
|
/**
|
|
13
14
|
* @license lucide-react v0.453.0 - ISC
|
|
14
15
|
*
|
|
@@ -1155,7 +1156,7 @@ function tr({
|
|
|
1155
1156
|
] })
|
|
1156
1157
|
] }) });
|
|
1157
1158
|
}
|
|
1158
|
-
function
|
|
1159
|
+
function fr() {
|
|
1159
1160
|
var hs, ps, fs, gs;
|
|
1160
1161
|
mt(), ht();
|
|
1161
1162
|
const {
|
|
@@ -1677,5 +1678,5 @@ function pr() {
|
|
|
1677
1678
|
);
|
|
1678
1679
|
}
|
|
1679
1680
|
export {
|
|
1680
|
-
|
|
1681
|
+
fr as default
|
|
1681
1682
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),a=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),a=require("./index-BL3sySXQ.js");require("react");require("react-dom");function i(){const o=a.useDashboardStore(e=>e.dashboard),r=a.useDashboardStore(e=>e.actions.setDashboard),t=a.useDashboardStore(e=>e.showDashboardJSON),n=a.useDashboardStore(e=>e.actions.setShowDashboardJSON);return s.jsxs("div",{className:a.cn("relative p-2",{hidden:!t}),children:[s.jsxs(a.Button,{variant:"secondary",size:"sm",className:"absolute right-2 top-2 z-10 h-8",onClick:()=>n(!1),children:[s.jsx(a.X,{className:"mr-2 h-4 w-4"}),"Close"]}),s.jsx(a.de,{onChange:e=>{if(e)try{JSON.parse(e),r(JSON.parse(e))}catch{}},defaultLanguage:"json",className:"h-[550px] overflow-y-auto",value:JSON.stringify(o,null,2),options:{minimap:{enabled:!1},glyphMargin:!1,wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:12,renderLineHighlight:"none"}})]})}exports.default=i;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as e, jsxs as s, Fragment as oe } from "react/jsx-runtime";
|
|
2
2
|
import de, { useState as h, useCallback as L, useEffect as G, useMemo as z } from "react";
|
|
3
|
-
import { l as ue, m as X, n as J, o as K, p as Z, q, R as j, r as F, L as b, c as C, P as me, s as he, B as P, C as fe, t as pe, v as ve, w as be, x as Se, y as ge, z as O, A as B, E as W, F as ye, G as Q, H as we, I as A, S as xe, J as Ne, K as Ce, M as Te, N as ke, O as R, Q as Ie } from "./index-
|
|
3
|
+
import { l as ue, m as X, n as J, o as K, p as Z, q, R as j, r as F, L as b, c as C, P as me, s as he, B as P, C as fe, t as pe, v as ve, w as be, x as Se, y as ge, z as O, A as B, E as W, F as ye, G as Q, H as we, I as A, S as xe, J as Ne, K as Ce, M as Te, N as ke, O as R, Q as Ie } from "./index-C0uTSIns.js";
|
|
4
4
|
function Ee() {
|
|
5
5
|
var k, I, E, N;
|
|
6
6
|
const { authToken: a, tokenProps: r } = ue(), [l, S] = h(!1), [p, g] = h(!1), [x, y] = h(!1), [v, o] = h(null), [u, n] = h(null), w = u || {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),l=require("react"),a=require("./index-BkklWRT2.js");function W(){var N,C,T,y;const{authToken:s,tokenProps:r}=a.useSemaphorContext(),[i,S]=l.useState(!1),[x,v]=l.useState(!1),[j,b]=l.useState(!1),[p,u]=l.useState(null),[m,n]=l.useState(null),g=m||{tz:((C=(N=r==null?void 0:r.params)==null?void 0:N.calendarContext)==null?void 0:C.tz)||null,weekStart:((y=(T=r==null?void 0:r.params)==null?void 0:T.calendarContext)==null?void 0:y.weekStart)??null},d=l.useCallback(async()=>{if(!(!(s!=null&&s.accessToken)||!(r!=null&&r.apiServiceUrl))){S(!0),u(null);try{const c=await fetch(`${r.apiServiceUrl}/v1/user-preferences/calendar`,{method:"GET",headers:{Authorization:`Bearer ${s.accessToken}`}});if(!c.ok){const h=await c.json().catch(()=>({}));throw new Error(h.error||"Failed to fetch preferences")}const o=await c.json();n({tz:o.tz,weekStart:o.weekStart,source:o.source,isInherited:o.isInherited,userHasPrefs:o.userHasPrefs,inherited:o.inherited})}catch(c){const o=c instanceof Error?c.message:"Unknown error";u(o)}finally{S(!1)}}},[s,r]);l.useEffect(()=>{d()},[d]);const f=l.useCallback(async c=>{if(!(s!=null&&s.accessToken)||!(r!=null&&r.apiServiceUrl))return u("Not authenticated"),!1;v(!0),u(null);try{const o=await fetch(`${r.apiServiceUrl}/v1/user-preferences/calendar`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s.accessToken}`},body:JSON.stringify(c)});if(!o.ok){const h=await o.json().catch(()=>({}));throw new Error(h.error||"Failed to update preferences")}return await d(),!0}catch(o){const h=o instanceof Error?o.message:"Unknown error";return u(h),!1}finally{v(!1)}},[s,r,d]),w=l.useCallback(async()=>{if(!(s!=null&&s.accessToken)||!(r!=null&&r.apiServiceUrl))return u("Not authenticated"),!1;b(!0),u(null);try{const c=await fetch(`${r.apiServiceUrl}/v1/user-preferences/calendar`,{method:"DELETE",headers:{Authorization:`Bearer ${s.accessToken}`}});if(!c.ok){const h=await c.json().catch(()=>({}));throw new Error(h.error||"Failed to clear preferences")}const o=await c.text();if(o)try{const h=JSON.parse(o);return n({tz:h.tz,weekStart:h.weekStart,source:h.source,isInherited:h.isInherited??!0,userHasPrefs:!1,inherited:h.inherited}),!0}catch{}return await d(),!0}catch(c){const o=c instanceof Error?c.message:"Unknown error";return u(o),!1}finally{b(!1)}},[s,r,d]);return{preferences:g,isLoading:i,isSaving:x,isClearing:j,error:p,updatePreferences:f,clearPreferences:w,refetch:d}}const I=[{value:"America/New_York",label:"Eastern Time (US & Canada)"},{value:"America/Chicago",label:"Central Time (US & Canada)"},{value:"America/Denver",label:"Mountain Time (US & Canada)"},{value:"America/Los_Angeles",label:"Pacific Time (US & Canada)"},{value:"America/Phoenix",label:"Arizona"},{value:"America/Anchorage",label:"Alaska"},{value:"Pacific/Honolulu",label:"Hawaii"},{value:"Europe/London",label:"London"},{value:"Europe/Paris",label:"Paris, Berlin, Rome"},{value:"Asia/Tokyo",label:"Tokyo"},{value:"Asia/Shanghai",label:"Beijing, Shanghai"},{value:"Asia/Kolkata",label:"Mumbai, New Delhi"},{value:"Australia/Sydney",label:"Sydney"},{value:"UTC",label:"UTC"}],M=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:6,label:"Saturday"}];function G(){try{const s=Intl;if(s.supportedValuesOf)return s.supportedValuesOf("timeZone")}catch{}return I.map(s=>s.value)}function V(s){switch(s){case"tenant":return"tenant";case"organization":return"organization";case"system":return"system";default:return"default"}}function L(s){const r=I.find(i=>i.value===s);return r?r.label:s}function X(s){const r=M.find(i=>i.value===s);return r?r.label:String(s)}function q({open:s,onOpenChange:r}){var E,P,A;const{preferences:i,isLoading:S,isSaving:x,isClearing:v,updatePreferences:j,clearPreferences:b}=W(),p=i.tz||((E=i.inherited)==null?void 0:E.tz)||Intl.DateTimeFormat().resolvedOptions().timeZone,u=i.weekStart??((P=i.inherited)==null?void 0:P.weekStart)??1,[m,n]=l.useState(!i.userHasPrefs),[g,d]=l.useState(!1),[f,w]=l.useState(p),[N,C]=l.useState(u),[T,y]=l.useState(!1),c=l.useMemo(()=>G(),[]),o=l.useMemo(()=>c.filter(t=>!I.some(R=>R.value===t)),[c]),h=l.useMemo(()=>L(f),[f]),F=i.inherited?L(i.inherited.tz):"UTC",H=i.inherited?X(i.inherited.weekStart):"Monday",B=V((A=i.inherited)==null?void 0:A.source);l.useEffect(()=>{if(!s){d(!1);return}g||(i.userHasPrefs!==void 0&&n(!i.userHasPrefs),w(p),C(u))},[s,g,i.userHasPrefs,p,u]);const _=async()=>{if(S){a.ue.error("Preferences are still loading. Please try again.");return}m?await b()?(a.ue.success("Now using default settings. Please refresh the page to apply changes.",{duration:5e3}),r(!1)):a.ue.error("Failed to save preferences. Please try again."):await j({tz:f,weekStart:N})?(a.ue.success("Preferences saved. Please refresh the page to apply changes.",{duration:5e3}),r(!1)):a.ue.error("Failed to save preferences. Please try again.")},$=()=>{r(!1)},D=x||v,O=D||S;return e.jsx(a.Dialog,{open:s,onOpenChange:r,children:e.jsxs(a.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:"Calendar Preferences"}),e.jsx(a.DialogDescription,{children:"Set your timezone and week start preferences for date calculations and displays."})]}),e.jsxs("div",{className:"space-y-6 py-4",children:[e.jsxs(a.RadioGroup,{value:m?"defaults":"custom",onValueChange:t=>{d(!0),n(t==="defaults")},className:"space-y-3",children:[e.jsxs("div",{className:a.cn("flex items-start space-x-3 rounded-lg border p-4 cursor-pointer transition-colors",m?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"),onClick:()=>{d(!0),n(!0)},children:[e.jsx(a.RadioGroupItem,{value:"defaults",id:"mode-defaults"}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsxs(a.Label,{htmlFor:"mode-defaults",className:"cursor-pointer font-medium",children:["Use ",B," defaults"]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[F,", Week starts ",H]})]})]}),e.jsxs("div",{className:a.cn("flex items-start space-x-3 rounded-lg border p-4 cursor-pointer transition-colors",m?"border-border hover:border-muted-foreground/50":"border-primary bg-primary/5"),onClick:()=>{d(!0),n(!1)},children:[e.jsx(a.RadioGroupItem,{value:"custom",id:"mode-custom"}),e.jsx(a.Label,{htmlFor:"mode-custom",className:"cursor-pointer font-medium",children:"Use custom settings"})]})]}),e.jsxs("div",{className:a.cn("space-y-6 transition-opacity",m&&"opacity-50 pointer-events-none"),children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(a.Label,{children:"Timezone"}),e.jsxs(a.Popover,{open:T,onOpenChange:y,modal:!0,children:[e.jsx(a.PopoverTrigger,{asChild:!0,children:e.jsxs(a.Button,{variant:"outline",role:"combobox","aria-expanded":T,className:"w-full justify-between",disabled:m,children:[h,e.jsx(a.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(a.PopoverContent,{className:"z-50 w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(a.Command,{className:"overflow-visible",children:[e.jsx(a.CommandInput,{placeholder:"Search timezones..."}),e.jsxs(a.CommandList,{children:[e.jsx(a.CommandEmpty,{children:"No timezone found."}),e.jsx(a.CommandGroup,{heading:"Common",children:I.map(t=>e.jsxs(a.CommandItem,{value:`${t.value} ${t.label}`,onSelect:()=>{d(!0),w(t.value),y(!1)},children:[e.jsx(a.Check,{className:a.cn("mr-2 h-4 w-4",f===t.value?"opacity-100":"opacity-0")}),e.jsx("span",{className:"flex-1",children:t.label}),e.jsx("span",{className:"text-xs text-muted-foreground",children:t.value})]},t.value))}),e.jsx(a.CommandSeparator,{}),e.jsx(a.CommandGroup,{heading:"All Timezones",children:o.map(t=>e.jsxs(a.CommandItem,{value:t,onSelect:()=>{d(!0),w(t),y(!1)},children:[e.jsx(a.Check,{className:a.cn("mr-2 h-4 w-4",f===t?"opacity-100":"opacity-0")}),t]},t))})]})]})})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(a.Label,{children:"Week Starts On"}),e.jsx(a.RadioGroup,{value:String(N),onValueChange:t=>{d(!0),C(Number(t))},className:"flex gap-4",disabled:m,children:M.map(t=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(a.RadioGroupItem,{value:String(t.value),id:`week-start-${t.value}`,disabled:m}),e.jsx(a.Label,{htmlFor:`week-start-${t.value}`,className:a.cn("cursor-pointer font-normal",m&&"cursor-not-allowed"),children:t.label})]},t.value))})]})]})]}),e.jsxs(a.DialogFooter,{children:[e.jsx(a.Button,{variant:"outline",onClick:$,disabled:D,children:"Cancel"}),e.jsx(a.Button,{onClick:_,disabled:O,children:D?e.jsxs(e.Fragment,{children:[e.jsx(a.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save"})]})]})})}const k=6,z=1,U=20;function Z(s){return Number.isNaN(s)?k:Math.min(U,Math.max(z,s))}function J({open:s,onOpenChange:r,dashboard:i,onApply:S,disabled:x=!1}){const[v,j]=l.useState(!1),[b,p]=l.useState("top"),[u,m]=l.useState(String(k)),n=i.summary;l.useEffect(()=>{s&&(j((n==null?void 0:n.enabled)===!0),p((n==null?void 0:n.position)==="bottom"?"bottom":"top"),m(String((n==null?void 0:n.maxItems)??k)))},[s,n==null?void 0:n.enabled,n==null?void 0:n.position,n==null?void 0:n.maxItems]);const g=l.useMemo(()=>Z(Number.parseInt(u||`${k}`,10)),[u]),d=()=>{S({enabled:v,position:b,maxItems:g}),r(!1)};return e.jsx(a.Dialog,{open:s,onOpenChange:r,children:e.jsxs(a.DialogContent,{className:"sm:max-w-[420px]",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:"Summary Settings"}),e.jsx(a.DialogDescription,{children:"Configure dashboard-level summary display. Card-level summary settings still control which cards contribute."})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{htmlFor:"dashboard-summary-enabled",children:"Enable Dashboard Summary"}),e.jsx(a.SmallSwitch,{id:"dashboard-summary-enabled",checked:v,disabled:x,onCheckedChange:j})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(a.Label,{htmlFor:"dashboard-summary-position",children:"Position"}),e.jsxs(a.Select,{value:b,disabled:x,onValueChange:f=>p(f),children:[e.jsx(a.SelectTrigger,{id:"dashboard-summary-position",children:e.jsx(a.SelectValue,{placeholder:"Select position"})}),e.jsxs(a.SelectContent,{children:[e.jsx(a.SelectItem,{value:"top",children:"Top"}),e.jsx(a.SelectItem,{value:"bottom",children:"Bottom"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(a.Label,{htmlFor:"dashboard-summary-max-items",children:"Max Items"}),e.jsx(a.Input,{id:"dashboard-summary-max-items",type:"number",min:z,max:U,disabled:x,value:u,onChange:f=>m(f.target.value),onBlur:()=>m(String(g))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Display limit only. Computation is unchanged."})]}),x&&e.jsx("p",{className:"text-xs text-amber-700",children:"Enter dashboard edit mode to modify summary settings."})]}),e.jsxs(a.DialogFooter,{children:[e.jsx(a.Button,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsx(a.Button,{onClick:d,disabled:x,children:"Apply"})]})]})})}exports.CalendarPreferencesDialog=q;exports.DashboardSummarySettingsDialog=J;
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),l=require("react"),a=require("./index-BL3sySXQ.js");function W(){var N,C,T,y;const{authToken:s,tokenProps:r}=a.useSemaphorContext(),[i,S]=l.useState(!1),[x,v]=l.useState(!1),[j,b]=l.useState(!1),[p,u]=l.useState(null),[m,n]=l.useState(null),g=m||{tz:((C=(N=r==null?void 0:r.params)==null?void 0:N.calendarContext)==null?void 0:C.tz)||null,weekStart:((y=(T=r==null?void 0:r.params)==null?void 0:T.calendarContext)==null?void 0:y.weekStart)??null},d=l.useCallback(async()=>{if(!(!(s!=null&&s.accessToken)||!(r!=null&&r.apiServiceUrl))){S(!0),u(null);try{const c=await fetch(`${r.apiServiceUrl}/v1/user-preferences/calendar`,{method:"GET",headers:{Authorization:`Bearer ${s.accessToken}`}});if(!c.ok){const h=await c.json().catch(()=>({}));throw new Error(h.error||"Failed to fetch preferences")}const o=await c.json();n({tz:o.tz,weekStart:o.weekStart,source:o.source,isInherited:o.isInherited,userHasPrefs:o.userHasPrefs,inherited:o.inherited})}catch(c){const o=c instanceof Error?c.message:"Unknown error";u(o)}finally{S(!1)}}},[s,r]);l.useEffect(()=>{d()},[d]);const f=l.useCallback(async c=>{if(!(s!=null&&s.accessToken)||!(r!=null&&r.apiServiceUrl))return u("Not authenticated"),!1;v(!0),u(null);try{const o=await fetch(`${r.apiServiceUrl}/v1/user-preferences/calendar`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s.accessToken}`},body:JSON.stringify(c)});if(!o.ok){const h=await o.json().catch(()=>({}));throw new Error(h.error||"Failed to update preferences")}return await d(),!0}catch(o){const h=o instanceof Error?o.message:"Unknown error";return u(h),!1}finally{v(!1)}},[s,r,d]),w=l.useCallback(async()=>{if(!(s!=null&&s.accessToken)||!(r!=null&&r.apiServiceUrl))return u("Not authenticated"),!1;b(!0),u(null);try{const c=await fetch(`${r.apiServiceUrl}/v1/user-preferences/calendar`,{method:"DELETE",headers:{Authorization:`Bearer ${s.accessToken}`}});if(!c.ok){const h=await c.json().catch(()=>({}));throw new Error(h.error||"Failed to clear preferences")}const o=await c.text();if(o)try{const h=JSON.parse(o);return n({tz:h.tz,weekStart:h.weekStart,source:h.source,isInherited:h.isInherited??!0,userHasPrefs:!1,inherited:h.inherited}),!0}catch{}return await d(),!0}catch(c){const o=c instanceof Error?c.message:"Unknown error";return u(o),!1}finally{b(!1)}},[s,r,d]);return{preferences:g,isLoading:i,isSaving:x,isClearing:j,error:p,updatePreferences:f,clearPreferences:w,refetch:d}}const I=[{value:"America/New_York",label:"Eastern Time (US & Canada)"},{value:"America/Chicago",label:"Central Time (US & Canada)"},{value:"America/Denver",label:"Mountain Time (US & Canada)"},{value:"America/Los_Angeles",label:"Pacific Time (US & Canada)"},{value:"America/Phoenix",label:"Arizona"},{value:"America/Anchorage",label:"Alaska"},{value:"Pacific/Honolulu",label:"Hawaii"},{value:"Europe/London",label:"London"},{value:"Europe/Paris",label:"Paris, Berlin, Rome"},{value:"Asia/Tokyo",label:"Tokyo"},{value:"Asia/Shanghai",label:"Beijing, Shanghai"},{value:"Asia/Kolkata",label:"Mumbai, New Delhi"},{value:"Australia/Sydney",label:"Sydney"},{value:"UTC",label:"UTC"}],M=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:6,label:"Saturday"}];function G(){try{const s=Intl;if(s.supportedValuesOf)return s.supportedValuesOf("timeZone")}catch{}return I.map(s=>s.value)}function V(s){switch(s){case"tenant":return"tenant";case"organization":return"organization";case"system":return"system";default:return"default"}}function L(s){const r=I.find(i=>i.value===s);return r?r.label:s}function X(s){const r=M.find(i=>i.value===s);return r?r.label:String(s)}function q({open:s,onOpenChange:r}){var E,P,A;const{preferences:i,isLoading:S,isSaving:x,isClearing:v,updatePreferences:j,clearPreferences:b}=W(),p=i.tz||((E=i.inherited)==null?void 0:E.tz)||Intl.DateTimeFormat().resolvedOptions().timeZone,u=i.weekStart??((P=i.inherited)==null?void 0:P.weekStart)??1,[m,n]=l.useState(!i.userHasPrefs),[g,d]=l.useState(!1),[f,w]=l.useState(p),[N,C]=l.useState(u),[T,y]=l.useState(!1),c=l.useMemo(()=>G(),[]),o=l.useMemo(()=>c.filter(t=>!I.some(R=>R.value===t)),[c]),h=l.useMemo(()=>L(f),[f]),F=i.inherited?L(i.inherited.tz):"UTC",H=i.inherited?X(i.inherited.weekStart):"Monday",B=V((A=i.inherited)==null?void 0:A.source);l.useEffect(()=>{if(!s){d(!1);return}g||(i.userHasPrefs!==void 0&&n(!i.userHasPrefs),w(p),C(u))},[s,g,i.userHasPrefs,p,u]);const _=async()=>{if(S){a.ue.error("Preferences are still loading. Please try again.");return}m?await b()?(a.ue.success("Now using default settings. Please refresh the page to apply changes.",{duration:5e3}),r(!1)):a.ue.error("Failed to save preferences. Please try again."):await j({tz:f,weekStart:N})?(a.ue.success("Preferences saved. Please refresh the page to apply changes.",{duration:5e3}),r(!1)):a.ue.error("Failed to save preferences. Please try again.")},$=()=>{r(!1)},D=x||v,O=D||S;return e.jsx(a.Dialog,{open:s,onOpenChange:r,children:e.jsxs(a.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:"Calendar Preferences"}),e.jsx(a.DialogDescription,{children:"Set your timezone and week start preferences for date calculations and displays."})]}),e.jsxs("div",{className:"space-y-6 py-4",children:[e.jsxs(a.RadioGroup,{value:m?"defaults":"custom",onValueChange:t=>{d(!0),n(t==="defaults")},className:"space-y-3",children:[e.jsxs("div",{className:a.cn("flex items-start space-x-3 rounded-lg border p-4 cursor-pointer transition-colors",m?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"),onClick:()=>{d(!0),n(!0)},children:[e.jsx(a.RadioGroupItem,{value:"defaults",id:"mode-defaults"}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsxs(a.Label,{htmlFor:"mode-defaults",className:"cursor-pointer font-medium",children:["Use ",B," defaults"]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[F,", Week starts ",H]})]})]}),e.jsxs("div",{className:a.cn("flex items-start space-x-3 rounded-lg border p-4 cursor-pointer transition-colors",m?"border-border hover:border-muted-foreground/50":"border-primary bg-primary/5"),onClick:()=>{d(!0),n(!1)},children:[e.jsx(a.RadioGroupItem,{value:"custom",id:"mode-custom"}),e.jsx(a.Label,{htmlFor:"mode-custom",className:"cursor-pointer font-medium",children:"Use custom settings"})]})]}),e.jsxs("div",{className:a.cn("space-y-6 transition-opacity",m&&"opacity-50 pointer-events-none"),children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(a.Label,{children:"Timezone"}),e.jsxs(a.Popover,{open:T,onOpenChange:y,modal:!0,children:[e.jsx(a.PopoverTrigger,{asChild:!0,children:e.jsxs(a.Button,{variant:"outline",role:"combobox","aria-expanded":T,className:"w-full justify-between",disabled:m,children:[h,e.jsx(a.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(a.PopoverContent,{className:"z-50 w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(a.Command,{className:"overflow-visible",children:[e.jsx(a.CommandInput,{placeholder:"Search timezones..."}),e.jsxs(a.CommandList,{children:[e.jsx(a.CommandEmpty,{children:"No timezone found."}),e.jsx(a.CommandGroup,{heading:"Common",children:I.map(t=>e.jsxs(a.CommandItem,{value:`${t.value} ${t.label}`,onSelect:()=>{d(!0),w(t.value),y(!1)},children:[e.jsx(a.Check,{className:a.cn("mr-2 h-4 w-4",f===t.value?"opacity-100":"opacity-0")}),e.jsx("span",{className:"flex-1",children:t.label}),e.jsx("span",{className:"text-xs text-muted-foreground",children:t.value})]},t.value))}),e.jsx(a.CommandSeparator,{}),e.jsx(a.CommandGroup,{heading:"All Timezones",children:o.map(t=>e.jsxs(a.CommandItem,{value:t,onSelect:()=>{d(!0),w(t),y(!1)},children:[e.jsx(a.Check,{className:a.cn("mr-2 h-4 w-4",f===t?"opacity-100":"opacity-0")}),t]},t))})]})]})})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(a.Label,{children:"Week Starts On"}),e.jsx(a.RadioGroup,{value:String(N),onValueChange:t=>{d(!0),C(Number(t))},className:"flex gap-4",disabled:m,children:M.map(t=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(a.RadioGroupItem,{value:String(t.value),id:`week-start-${t.value}`,disabled:m}),e.jsx(a.Label,{htmlFor:`week-start-${t.value}`,className:a.cn("cursor-pointer font-normal",m&&"cursor-not-allowed"),children:t.label})]},t.value))})]})]})]}),e.jsxs(a.DialogFooter,{children:[e.jsx(a.Button,{variant:"outline",onClick:$,disabled:D,children:"Cancel"}),e.jsx(a.Button,{onClick:_,disabled:O,children:D?e.jsxs(e.Fragment,{children:[e.jsx(a.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save"})]})]})})}const k=6,z=1,U=20;function Z(s){return Number.isNaN(s)?k:Math.min(U,Math.max(z,s))}function J({open:s,onOpenChange:r,dashboard:i,onApply:S,disabled:x=!1}){const[v,j]=l.useState(!1),[b,p]=l.useState("top"),[u,m]=l.useState(String(k)),n=i.summary;l.useEffect(()=>{s&&(j((n==null?void 0:n.enabled)===!0),p((n==null?void 0:n.position)==="bottom"?"bottom":"top"),m(String((n==null?void 0:n.maxItems)??k)))},[s,n==null?void 0:n.enabled,n==null?void 0:n.position,n==null?void 0:n.maxItems]);const g=l.useMemo(()=>Z(Number.parseInt(u||`${k}`,10)),[u]),d=()=>{S({enabled:v,position:b,maxItems:g}),r(!1)};return e.jsx(a.Dialog,{open:s,onOpenChange:r,children:e.jsxs(a.DialogContent,{className:"sm:max-w-[420px]",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:"Summary Settings"}),e.jsx(a.DialogDescription,{children:"Configure dashboard-level summary display. Card-level summary settings still control which cards contribute."})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{htmlFor:"dashboard-summary-enabled",children:"Enable Dashboard Summary"}),e.jsx(a.SmallSwitch,{id:"dashboard-summary-enabled",checked:v,disabled:x,onCheckedChange:j})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(a.Label,{htmlFor:"dashboard-summary-position",children:"Position"}),e.jsxs(a.Select,{value:b,disabled:x,onValueChange:f=>p(f),children:[e.jsx(a.SelectTrigger,{id:"dashboard-summary-position",children:e.jsx(a.SelectValue,{placeholder:"Select position"})}),e.jsxs(a.SelectContent,{children:[e.jsx(a.SelectItem,{value:"top",children:"Top"}),e.jsx(a.SelectItem,{value:"bottom",children:"Bottom"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(a.Label,{htmlFor:"dashboard-summary-max-items",children:"Max Items"}),e.jsx(a.Input,{id:"dashboard-summary-max-items",type:"number",min:z,max:U,disabled:x,value:u,onChange:f=>m(f.target.value),onBlur:()=>m(String(g))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Display limit only. Computation is unchanged."})]}),x&&e.jsx("p",{className:"text-xs text-amber-700",children:"Enter dashboard edit mode to modify summary settings."})]}),e.jsxs(a.DialogFooter,{children:[e.jsx(a.Button,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsx(a.Button,{onClick:d,disabled:x,children:"Apply"})]})]})})}exports.CalendarPreferencesDialog=q;exports.DashboardSummarySettingsDialog=J;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as a, jsx as e, Fragment as fe } from "react/jsx-runtime";
|
|
2
|
-
import { bS as ke, dv as vr, I as Tt, Y as de, a1 as E, dw as va, dx as Cr, L as P, J as Q, K as X, M as Z, N as ee, O as K, c0 as Ie, B as Y, c7 as dt, dy as $a, dz as Xs, dA as Zs, dB as el, dC as tl, dD as ja, ab as Nt, X as Be, dE as Dn, ch as In, m as Ht, n as Yt, o as Wt, p as Qt, q as xa, c4 as nt, c1 as Xe, bZ as Ze, b_ as Ge, b$ as Ue, dF as Ns, dG as En, u as Se, G as yn, dH as Xt, cm as da, dd as et, dI as al, c as ae, c6 as nl, dJ as wr, dK as Sr, dL as kr, dM as ga, dN as Tr, dO as sl, dP as Ar, cS as ll, dQ as Dr, dR as rl, dS as Ir, dT as On, dU as Er, dV as Et, dW as vt, dX as Mn, U as Or, dY as Mr, bT as ua, bU as Kt, bV as Gt, bW as Ca, bX as bt, bY as _t, dZ as Nn, d_ as zt, d$ as We, e0 as $t, H as Zt, e1 as Fr, e2 as Ra, e3 as La, e4 as Pa, e5 as Fn, dq as ea, e6 as wa, e7 as Rr, R as Sa, e8 as Rn, e9 as ma, cn as Ln, ea as il, r as Ot, cN as Lr, eb as yt, ec as At, ed as Pr, ee as Dt, e as Pn, cK as Vn, Z as ol, ef as Bn, eg as Vr, eh as cl, ei as dl, ej as xt, dl as nn, ek as Br, el as zr, em as $r, en as ul, am as ml, eo as hl, ep as jr, eq as qr, er as Kr, es as qa, et as Gr, eu as Ur, ev as vs, ew as _r, a2 as Ka, a9 as zn, ex as Jr, ey as $n, cU as Hr, ac as tt, ez as Yr, eA as Wr, d7 as jn, d8 as qn, d9 as Vt, da as Oa, eB as Qr, dm as Xr, eC as pl, eD as Zr, eE as ei, cD as Ga, cB as Qe, eF as ti, eG as ai, eH as Cs, eI as ni, P as ut, s as mt, t as ht, c8 as Kn, c9 as Gn, cb as Un, cV as fl, cg as Ut, eJ as Ct, eK as jt, eL as qt, eM as Mt, eN as ta, eO as si, aH as li, eP as ri, eQ as ii, eR as oi, eS as ci, cJ as Jt, eT as di, eU as gl, eV as ui, eW as mi, l as ka, eX as hi, eY as xl, eZ as pi, e_ as fi, e$ as gi, f0 as xi, f1 as bi, f2 as yi, f3 as vn, f4 as Ni, f5 as vi, f6 as Ci, f7 as Cn, f8 as ws, f9 as wi, fa as Si, fb as ki, fc as Ti, fd as Ai, fe as bl, ff as _n, Q as Oe, fg as ba, fh as Va, fi as Di, fj as aa, fk as Te, fl as Ae, fm as De, fn as Ii, fo as Ei, fp as Oi, fq as Mi, fr as wt, fs as Ia, ft as Ss, fu as Fi, dr as yl, S as Ee, fv as Ri, fw as Li, fx as Pi, v as na, w as sa, x as la, y as ra, z as ia, A as oa, fy as Vi, fz as Bi, fA as ks, fB as zi, E as ha, fC as $i, fD as sn, fE as Ts, fF as it, fG as ji, fH as qi, fI as Ki, fJ as Gi, fK as Ta, fL as Ui, fM as ln, fN as Nl, fO as _i, fP as Ji, fQ as Hi, fR as Ba, fS as Yi, fT as Wi, fU as Bt, fV as Jn, fW as Hn, fX as vl, fY as Qi, cA as Cl, fZ as Xi, f_ as Ua, du as Zi, f$ as Le, g0 as As, bK as eo, bG as to, g1 as ao, g2 as no, g3 as so, g4 as lo, g5 as ro, bd as Ds, g6 as Is, g7 as io, g8 as oo, g9 as wl, ga as co, gb as Sl, gc as uo, gd as mo, ge as ho, gf as po, gg as fo, gh as go, gi as xo, gj as bo, gk as yo, gl as No, gm as kl, gn as vo, go as Co, gp as wo, gq as So, gr as ko, gs as To, gt as Ao, gu as Tl, ca as Do, gv as Io, gw as Eo, gx as Oo, gy as Mo, gz as Fo, gA as Al, gB as Ro, c$ as Dl, gC as _a, gD as Il, gE as El, b2 as Ea, gF as Ja, gG as Lo, gH as Ol, gI as Es, cF as Po, gJ as Os, gK as Vo, gL as Bo, gM as zo, gN as Ma, gO as $o, gP as Yn, gQ as Fa, gR as jo, gS as qo, gT as za, gU as Ko, C as Go, gV as Uo, gW as ya, gX as St, gY as wn, gZ as Sn, g_ as Na, g$ as Ml, h0 as ca, ak as _o, h1 as Jo, h2 as rn, h3 as Ho, h4 as on, h5 as Yo, h6 as Ms, h7 as Wo, h8 as Qo, h9 as Xo, ha as Zo, cc as rt, hb as ec, hc as tc, hd as ac, he as Ha, cj as Ya, hf as Fs, hg as Fl, dg as cn, hh as nc, hi as sc, hj as lc, a3 as rc } from "./index-
|
|
2
|
+
import { bS as ke, dv as vr, I as Tt, Y as de, a1 as E, dw as va, dx as Cr, L as P, J as Q, K as X, M as Z, N as ee, O as K, c0 as Ie, B as Y, c7 as dt, dy as $a, dz as Xs, dA as Zs, dB as el, dC as tl, dD as ja, ab as Nt, X as Be, dE as Dn, ch as In, m as Ht, n as Yt, o as Wt, p as Qt, q as xa, c4 as nt, c1 as Xe, bZ as Ze, b_ as Ge, b$ as Ue, dF as Ns, dG as En, u as Se, G as yn, dH as Xt, cm as da, dd as et, dI as al, c as ae, c6 as nl, dJ as wr, dK as Sr, dL as kr, dM as ga, dN as Tr, dO as sl, dP as Ar, cS as ll, dQ as Dr, dR as rl, dS as Ir, dT as On, dU as Er, dV as Et, dW as vt, dX as Mn, U as Or, dY as Mr, bT as ua, bU as Kt, bV as Gt, bW as Ca, bX as bt, bY as _t, dZ as Nn, d_ as zt, d$ as We, e0 as $t, H as Zt, e1 as Fr, e2 as Ra, e3 as La, e4 as Pa, e5 as Fn, dq as ea, e6 as wa, e7 as Rr, R as Sa, e8 as Rn, e9 as ma, cn as Ln, ea as il, r as Ot, cN as Lr, eb as yt, ec as At, ed as Pr, ee as Dt, e as Pn, cK as Vn, Z as ol, ef as Bn, eg as Vr, eh as cl, ei as dl, ej as xt, dl as nn, ek as Br, el as zr, em as $r, en as ul, am as ml, eo as hl, ep as jr, eq as qr, er as Kr, es as qa, et as Gr, eu as Ur, ev as vs, ew as _r, a2 as Ka, a9 as zn, ex as Jr, ey as $n, cU as Hr, ac as tt, ez as Yr, eA as Wr, d7 as jn, d8 as qn, d9 as Vt, da as Oa, eB as Qr, dm as Xr, eC as pl, eD as Zr, eE as ei, cD as Ga, cB as Qe, eF as ti, eG as ai, eH as Cs, eI as ni, P as ut, s as mt, t as ht, c8 as Kn, c9 as Gn, cb as Un, cV as fl, cg as Ut, eJ as Ct, eK as jt, eL as qt, eM as Mt, eN as ta, eO as si, aH as li, eP as ri, eQ as ii, eR as oi, eS as ci, cJ as Jt, eT as di, eU as gl, eV as ui, eW as mi, l as ka, eX as hi, eY as xl, eZ as pi, e_ as fi, e$ as gi, f0 as xi, f1 as bi, f2 as yi, f3 as vn, f4 as Ni, f5 as vi, f6 as Ci, f7 as Cn, f8 as ws, f9 as wi, fa as Si, fb as ki, fc as Ti, fd as Ai, fe as bl, ff as _n, Q as Oe, fg as ba, fh as Va, fi as Di, fj as aa, fk as Te, fl as Ae, fm as De, fn as Ii, fo as Ei, fp as Oi, fq as Mi, fr as wt, fs as Ia, ft as Ss, fu as Fi, dr as yl, S as Ee, fv as Ri, fw as Li, fx as Pi, v as na, w as sa, x as la, y as ra, z as ia, A as oa, fy as Vi, fz as Bi, fA as ks, fB as zi, E as ha, fC as $i, fD as sn, fE as Ts, fF as it, fG as ji, fH as qi, fI as Ki, fJ as Gi, fK as Ta, fL as Ui, fM as ln, fN as Nl, fO as _i, fP as Ji, fQ as Hi, fR as Ba, fS as Yi, fT as Wi, fU as Bt, fV as Jn, fW as Hn, fX as vl, fY as Qi, cA as Cl, fZ as Xi, f_ as Ua, du as Zi, f$ as Le, g0 as As, bK as eo, bG as to, g1 as ao, g2 as no, g3 as so, g4 as lo, g5 as ro, bd as Ds, g6 as Is, g7 as io, g8 as oo, g9 as wl, ga as co, gb as Sl, gc as uo, gd as mo, ge as ho, gf as po, gg as fo, gh as go, gi as xo, gj as bo, gk as yo, gl as No, gm as kl, gn as vo, go as Co, gp as wo, gq as So, gr as ko, gs as To, gt as Ao, gu as Tl, ca as Do, gv as Io, gw as Eo, gx as Oo, gy as Mo, gz as Fo, gA as Al, gB as Ro, c$ as Dl, gC as _a, gD as Il, gE as El, b2 as Ea, gF as Ja, gG as Lo, gH as Ol, gI as Es, cF as Po, gJ as Os, gK as Vo, gL as Bo, gM as zo, gN as Ma, gO as $o, gP as Yn, gQ as Fa, gR as jo, gS as qo, gT as za, gU as Ko, C as Go, gV as Uo, gW as ya, gX as St, gY as wn, gZ as Sn, g_ as Na, g$ as Ml, h0 as ca, ak as _o, h1 as Jo, h2 as rn, h3 as Ho, h4 as on, h5 as Yo, h6 as Ms, h7 as Wo, h8 as Qo, h9 as Xo, ha as Zo, cc as rt, hb as ec, hc as tc, hd as ac, he as Ha, cj as Ya, hf as Fs, hg as Fl, dg as cn, hh as nc, hi as sc, hj as lc, a3 as rc } from "./index-C0uTSIns.js";
|
|
3
3
|
import * as kn from "react";
|
|
4
4
|
import Tn, { useState as _, useRef as at, useEffect as be, useCallback as Ke, useMemo as ie, useContext as Wn, Suspense as ic } from "react";
|
|
5
|
-
import { C as oc, e as Qn, u as st, V as cc } from "./editor-action-buttons-
|
|
5
|
+
import { C as oc, e as Qn, u as st, V as cc } from "./editor-action-buttons-CL_G2bSD.js";
|
|
6
6
|
import { createPortal as dc } from "react-dom";
|
|
7
7
|
/**
|
|
8
8
|
* @license lucide-react v0.453.0 - ISC
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-BL3sySXQ.js"),I=require("react"),fe=require("./editor-action-buttons-BkCIjblw.js"),Lt=require("react-dom");function Mt(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(n,a,r.get?r:{enumerable:!0,get:()=>t[a]})}}return n.default=t,Object.freeze(n)}const as=Mt(I);/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const e=require("./index-
|
|
1
|
+
"use strict";const e=require("./index-BL3sySXQ.js"),a=require("react/jsx-runtime"),k=require("./use-visual-utils-CaYg_mFN.js"),f=require("react");/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { bS as T, a1 as u, bT as B, bU as ee, bV as ae, bW as te, bX as se, bY as re, u as F, bO as le, bZ as oe, b_ as ne, b$ as ie, c0 as de, c as g, c1 as ue, c2 as ce, Y as q, B as I, E as pe, U as D, Z as U, V as K, c3 as j, H as O, c4 as H, X, I as S } from "./index-
|
|
1
|
+
import { bS as T, a1 as u, bT as B, bU as ee, bV as ae, bW as te, bX as se, bY as re, u as F, bO as le, bZ as oe, b_ as ne, b$ as ie, c0 as de, c as g, c1 as ue, c2 as ce, Y as q, B as I, E as pe, U as D, Z as U, V as K, c3 as j, H as O, c4 as H, X, I as S } from "./index-C0uTSIns.js";
|
|
2
2
|
import { jsx as m, jsxs as f, Fragment as x } from "react/jsx-runtime";
|
|
3
|
-
import { u as me, a as M } from "./use-visual-utils-
|
|
3
|
+
import { u as me, a as M } from "./use-visual-utils-Ba5nPP3L.js";
|
|
4
4
|
import { useMemo as C, useState as G } from "react";
|
|
5
5
|
/**
|
|
6
6
|
* @license lucide-react v0.453.0 - ISC
|