react-semaphor 0.1.115 → 0.1.117
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-BQDmKxxN.js → dashboard-controls-BVyKYGSS.js} +264 -251
- package/dist/chunks/{dashboard-controls-YDGnMyyK.js → dashboard-controls-BfjTgw7o.js} +4 -4
- package/dist/chunks/{dashboard-json-BHAPV0Eh.js → dashboard-json-D6wa6YoM.js} +1 -1
- package/dist/chunks/{dashboard-json-D-gw81va.js → dashboard-json-DT3-XQFT.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-CadUC2o0.js → edit-dashboard-visual-B783wHIy.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-D8DmYTKj.js → edit-dashboard-visual-BiAkxXjP.js} +165 -165
- package/dist/chunks/{editor-action-buttons-Cz-qv-g3.js → editor-action-buttons-BmFpFk-_.js} +2 -2
- package/dist/chunks/{editor-action-buttons-CJ1R-8qC.js → editor-action-buttons-CiZYTAan.js} +1 -1
- package/dist/chunks/{index-Bf4pgVkQ.js → index-BYYUZIiS.js} +2894 -2889
- package/dist/chunks/{index-WFJ2bdm0.js → index-Cwi4U3XN.js} +67 -67
- package/dist/chunks/resource-management-panel-C9DAKT2s.js +6 -0
- package/dist/chunks/resource-management-panel-xtVaOdeV.js +895 -0
- package/dist/chunks/{schedule-dashboard-DlYi6cPQ.js → schedule-dashboard-BjjU3_uS.js} +1 -1
- package/dist/chunks/{schedule-dashboard-BJ0PeQTb.js → schedule-dashboard-bnGqtUi1.js} +3 -3
- package/dist/chunks/{use-visual-utils-DlzVpKYl.js → use-visual-utils-B-h2YrMC.js} +1 -1
- package/dist/chunks/{use-visual-utils-DlurLDVv.js → use-visual-utils-DTdxZgvk.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 +4 -4
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/resource-management-panel-BXzn0kHW.js +0 -6
- package/dist/chunks/resource-management-panel-ByY6ZxCb.js +0 -878
|
@@ -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-Cwi4U3XN.js"),f=require("react");require("react-dom");const O=require("./schedule-dashboard-BjjU3_uS.js"),ne=require("./editor-action-buttons-CiZYTAan.js");function Ce(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 D=Ce(f);/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -8,12 +8,12 @@
|
|
|
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 ke=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"}]]);/**
|
|
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 Le=s.createLucideIcon("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
|
17
17
|
* @license lucide-react v0.453.0 - ISC
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
@@ -23,4 +23,4 @@
|
|
|
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 Pe=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 Te=s.requireShim();function Ae(){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(Pe,{strokeWidth:1.5,className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),e.jsx(ke,{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 Fe(t,n,a,r,i){if(!i)return null;const o=JSON.stringify(a),c=`${t}/v1/lens`;return await s.postRequest(c,i,{name:n,template:o,filterValues:r,operation:"create"})}async function K(t,n,a){if(!a)return null;const{id:r,template:i,filterValues:o,isDefault:c,shared:m}=n,h=`${t}/v1/lens`;return await s.postRequest(h,a,{lensId:r,template:i,filterValues:o,isDefault:c,shared:m,operation:"update"})}async function Ee(t,n,a){if(!a)return null;const r=`${t}/v1/lens`;return await s.postRequest(r,a,{operation:"delete",lensId:n})}function Re(){const[t,n]=f.useState(""),[a,r]=f.useState(!1),i=s.useDashboardStore(w=>w.lenses),{setLenses:o,setSelectedLensId:c}=s.useDashboardActions(),[m,h]=f.useState(!1),[g,u]=f.useState(!1),l=s.useDashboardStore(w=>w.dashboard),p=s.useDashboardStore(w=>w.filterValues),{authToken:j,tokenProps:v}=s.useSemaphorContext();async function y(){h(!0);const w=O.getDashbaordStateWithoutData(l),C=await Fe(v.apiServiceUrl,t,w,p,j==null?void 0:j.accessToken);C&&(o([...i||[],C]),c(C.id),u(!1)),h(!1)}return e.jsxs(s.Dialog,{open:g,onOpenChange:u,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$1,{value:t,onChange:w=>{n(w.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:y,disabled:m,children:m?"Creating...":"Add"})})]})]})}function Ge(){const[t,n]=f.useState(!1),a=s.useDashboardStore(l=>l.lenses),r=s.useDashboardStore(l=>l.selectedLensId),{setLenses:i,setSelectedLensId:o}=s.useDashboardActions(),{authToken:c,tokenProps:m}=s.useSemaphorContext();async function h(l){o(l)}async function g(l){if(await Ee(m.apiServiceUrl,l,c==null?void 0:c.accessToken)){const j=a==null?void 0:a.filter(v=>v.id!==l);i(j||[]),o("original")}}async function u(l){const p=a==null?void 0:a.map(y=>y.id===l.id?{...y,isDefault:!l.isDefault}:{...y,isDefault:!1});i(p||[]);const j={...l,isDefault:!l.isDefault};await K(m.apiServiceUrl,j,c==null?void 0:c.accessToken);const v=a==null?void 0:a.find(y=>y.isDefault);if(v&&v.id!==l.id){const y={...v,isDefault:!1};await K(m.apiServiceUrl,y,c==null?void 0:c.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(Me,{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:h,children:[e.jsx(s.DropdownMenuRadioItem,{value:"original",children:"Original"}),a==null?void 0:a.map(l=>e.jsxs(s.DropdownMenuRadioItem,{className:"group flex justify-between gap-2",value:l.id,children:[e.jsx("p",{children:l.name}),e.jsxs("span",{className:"flex items-center gap-3",children:[e.jsx(s.House,{onClick:p=>{p.preventDefault(),u(l)},className:s.cn("size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",{invisible:!l.isDefault,"text-green-500":l.isDefault}),strokeWidth:1.5}),e.jsx(s.Cross2Icon,{onClick:p=>{p.preventDefault(),g(l.id)},className:"invisible size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",strokeWidth:1.5})]})]},l.id))]})]})]})}function Oe({iconClassName:t}){const[n,a]=f.useState(!1),[r,i]=f.useState(""),[o,c]=f.useState(!1),m=s.useDashboardStore(l=>l.isDownloadingPdf),{tokenProps:h}=s.useSemaphorContext();async function g(){const l=s.ue.loading("Generating PDF... may take up to 60 seconds");try{await s.downloadPdf(h.apiServiceUrl),s.ue.dismiss(l),s.ue.success("PDF downloaded successfully!",{duration:2e3})}catch(p){s.ue.dismiss(l),s.ue.error("Failed to download PDF",{description:"Please try again or contact support.",richColors:!0}),console.error("PDF download error:",p)}}async function u(){if(!r)return;a(!1),i(""),c(!1);const l=s.ue.loading("Generating protected PDF... may take up to 60 seconds");try{await s.downloadPdf(h.apiServiceUrl,r),s.ue.dismiss(l),s.ue.success("Protected PDF downloaded successfully!",{duration:2e3,position:"top-right"})}catch(p){s.ue.dismiss(l),s.ue.error("Failed to download protected PDF. Please try again."),console.error("Protected PDF download error:",p)}}return e.jsxs(e.Fragment,{children:[e.jsxs(s.DropdownMenu,{modal:!1,children:[e.jsx(s.DropdownMenuTrigger,{asChild:!0,children:e.jsx(s.Button,{variant:"ghost",size:"sm",className:"h-7 p-2",disabled:m,children:e.jsx(s.Download,{className:s.cn("size-4",t)})})}),e.jsxs(s.DropdownMenuContent,{align:"end",children:[e.jsxs(s.DropdownMenuItem,{onClick:g,children:[e.jsx(s.File,{className:"mr-2 h-4 w-4"}),"Download PDF"]}),e.jsxs(s.DropdownMenuItem,{onClick:()=>a(!0),children:[e.jsx(s.Lock,{className:"mr-2 h-4 w-4"}),"Download Protected PDF"]})]})]}),e.jsx(s.Dialog,{open:n,onOpenChange:a,children:e.jsxs(s.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(s.DialogHeader,{children:[e.jsx(s.DialogTitle,{children:"Download Protected PDF"}),e.jsx(s.DialogDescription,{children:"Enter a password to protect your PDF. The PDF will be encrypted and require this password to open."})]}),e.jsx("div",{className:"grid gap-4 py-4",children:e.jsxs("div",{className:"grid gap-2",children:[e.jsx(s.Label,{htmlFor:"password",children:"Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(s.Input$1,{id:"password",type:o?"text":"password",value:r,onChange:l=>i(l.target.value),placeholder:"Enter password",className:"pr-10",onKeyDown:l=>{l.key==="Enter"&&r&&u()}}),e.jsx(s.Button,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>c(!o),children:o?e.jsx(s.EyeOff,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(s.Eye,{className:"h-4 w-4 text-muted-foreground"})})]})]})}),e.jsxs(s.DialogFooter,{children:[e.jsx(s.Button,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e.jsx(s.Button,{onClick:u,disabled:!r,children:"Download"})]})]})})]})}const Ue=async(t,n,a)=>{const r=`${t}/management/v1/groups`;return await s.postRequestRegular(r,n,a)},Be=async(t,n,a)=>{const r=`${t}/management/v1/groups/${a}`,i=await fetch(r,{method:"DELETE",headers:{Authorization:`Bearer ${n}`}});if(!i.ok){const o=await i.text();throw new Error(o||"Failed to delete group")}},qe=async(t,n,a,r)=>{const i=`${t}/management/v1/groups/${a}/members`;return await s.postRequestRegular(i,n,r)},$e=async(t,n,a,r)=>{const i=`${t}/management/v1/groups/${a}/members`,o=await fetch(i,{method:"DELETE",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(r)});if(!o.ok){const c=await o.text();throw new Error(c||"Failed to remove group members")}};function ze(){const{authToken:t,tokenProps:n}=s.useSemaphorContext(),a=s.useQueryClient();return s.useMutation({mutationFn:r=>Ue(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 _e(){const{authToken:t,tokenProps:n}=s.useSemaphorContext(),a=s.useQueryClient();return s.useMutation({mutationFn:r=>Be(n.apiServiceUrl,(t==null?void 0:t.accessToken)||"",r),onSuccess:(r,i)=>{a.invalidateQueries({queryKey:["groups"]}),a.removeQueries({queryKey:["group",i]}),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 Qe(){const{authToken:t,tokenProps:n}=s.useSemaphorContext(),a=s.useQueryClient();return s.useMutation({mutationFn:({groupId:r,data:i})=>qe(n.apiServiceUrl,(t==null?void 0:t.accessToken)||"",r,i),onSuccess:(r,i)=>{a.invalidateQueries({queryKey:["group",i.groupId]}),a.invalidateQueries({queryKey:["group-members",i.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 He(){const{authToken:t,tokenProps:n}=s.useSemaphorContext(),a=s.useQueryClient();return s.useMutation({mutationFn:({groupId:r,data:i})=>$e(n.apiServiceUrl,(t==null?void 0:t.accessToken)||"",r,i),onSuccess:(r,i)=>{a.invalidateQueries({queryKey:["group",i.groupId]}),a.invalidateQueries({queryKey:["group-members",i.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 Ve({onSuccess:t,tenantId:n,isTenantUser:a}){const[r,i]=f.useState(""),[o,c]=f.useState(""),[m,h]=f.useState({}),g=ze(),u=()=>{const p={};return r.trim()?r.length<3?p.name="Group name must be at least 3 characters":r.length>50&&(p.name="Group name must be less than 50 characters"):p.name="Group name is required",o&&o.length>200&&(p.description="Description must be less than 200 characters"),h(p),Object.keys(p).length===0},l=async p=>{if(p.preventDefault(),!u())return;const j={name:r.trim(),description:o.trim()||void 0,type:a?"TENANT_GROUP":"ORG_GROUP",...a&&n?{tenantId:n}:{}};try{await g.mutateAsync(j),i(""),c(""),h({}),t()}catch(v){console.error("Failed to create group:",v)}};return e.jsxs("form",{onSubmit:l,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$1,{id:"group-name",placeholder:"e.g., Marketing Team, Engineering Squad",value:r,onChange:p=>{i(p.target.value),m.name&&h(j=>({...j,name:""}))},className:m.name?"border-destructive":"",disabled:g.isPending}),m.name&&e.jsx("p",{className:"text-sm text-destructive",children:m.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:o,onChange:p=>{c(p.target.value),m.description&&h(j=>({...j,description:""}))},className:m.description?"border-destructive":"",disabled:g.isPending,rows:3}),m.description&&e.jsx("p",{className:"text-sm text-destructive",children:m.description}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[o.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:()=>{i(""),c(""),h({})},disabled:g.isPending,children:"Clear"}),e.jsx(s.Button,{type:"submit",disabled:g.isPending||!r.trim(),children:g.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 Ke(t,n=[]){let a=[];function r(o,c){const m=D.createContext(c),h=a.length;a=[...a,c];const g=l=>{var C;const{scope:p,children:j,...v}=l,y=((C=p==null?void 0:p[t])==null?void 0:C[h])||m,w=D.useMemo(()=>v,Object.values(v));return e.jsx(y.Provider,{value:w,children:j})};g.displayName=o+"Provider";function u(l,p){var y;const j=((y=p==null?void 0:p[t])==null?void 0:y[h])||m,v=D.useContext(j);if(v)return v;if(c!==void 0)return c;throw new Error(`\`${l}\` must be used within \`${o}\``)}return[g,u]}const i=()=>{const o=a.map(c=>D.createContext(c));return function(m){const h=(m==null?void 0:m[t])||o;return D.useMemo(()=>({[`__scope${t}`]:{...m,[t]:h}}),[m,h])}};return i.scopeName=t,[r,We(i,...n)]}function We(...t){const n=t[0];if(t.length===1)return n;const a=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const c=r.reduce((m,{useScope:h,scopeName:g})=>{const l=h(o)[`__scope${g}`];return{...m,...l}},{});return D.useMemo(()=>({[`__scope${n.scopeName}`]:c}),[c])}};return a.scopeName=n.scopeName,a}function Je(t){const n=D.useRef(t);return D.useEffect(()=>{n.current=t}),D.useMemo(()=>(...a)=>{var r;return(r=n.current)==null?void 0:r.call(n,...a)},[])}var W=globalThis!=null&&globalThis.document?D.useLayoutEffect:()=>{},Xe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],J=Xe.reduce((t,n)=>{const a=s.createSlot(`Primitive.${n}`),r=D.forwardRef((i,o)=>{const{asChild:c,...m}=i,h=c?a:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(h,{...m,ref:o})});return r.displayName=`Primitive.${n}`,{...t,[n]:r}},{});function Ye(){return Te.useSyncExternalStore(Ze,()=>!0,()=>!1)}function Ze(){return()=>{}}var X="Avatar",[es]=Ke(X),[ss,ie]=es(X),le=D.forwardRef((t,n)=>{const{__scopeAvatar:a,...r}=t,[i,o]=D.useState("idle");return e.jsx(ss,{scope:a,imageLoadingStatus:i,onImageLoadingStatusChange:o,children:e.jsx(J.span,{...r,ref:n})})});le.displayName=X;var ce="AvatarImage",de=D.forwardRef((t,n)=>{const{__scopeAvatar:a,src:r,onLoadingStatusChange:i=()=>{},...o}=t,c=ie(ce,a),m=ts(r,o),h=Je(g=>{i(g),c.onImageLoadingStatusChange(g)});return W(()=>{m!=="idle"&&h(m)},[m,h]),m==="loaded"?e.jsx(J.img,{...o,ref:n,src:r}):null});de.displayName=ce;var ue="AvatarFallback",me=D.forwardRef((t,n)=>{const{__scopeAvatar:a,delayMs:r,...i}=t,o=ie(ue,a),[c,m]=D.useState(r===void 0);return D.useEffect(()=>{if(r!==void 0){const h=window.setTimeout(()=>m(!0),r);return()=>window.clearTimeout(h)}},[r]),c&&o.imageLoadingStatus!=="loaded"?e.jsx(J.span,{...i,ref:n}):null});me.displayName=ue;function oe(t,n){return t?n?(t.src!==n&&(t.src=n),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function ts(t,{referrerPolicy:n,crossOrigin:a}){const r=Ye(),i=D.useRef(null),o=r?(i.current||(i.current=new window.Image),i.current):null,[c,m]=D.useState(()=>oe(o,t));return W(()=>{m(oe(o,t))},[o,t]),W(()=>{const h=l=>()=>{m(l)};if(!o)return;const g=h("loaded"),u=h("error");return o.addEventListener("load",g),o.addEventListener("error",u),n&&(o.referrerPolicy=n),typeof a=="string"&&(o.crossOrigin=a),()=>{o.removeEventListener("load",g),o.removeEventListener("error",u)}},[o,a,n]),c}var he=le,pe=de,xe=me;const Y=D.forwardRef(({className:t,...n},a)=>e.jsx(he,{ref:a,className:s.cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...n}));Y.displayName=he.displayName;const as=D.forwardRef(({className:t,...n},a)=>e.jsx(pe,{ref:a,className:s.cn("aspect-square h-full w-full",t),...n}));as.displayName=pe.displayName;const Z=D.forwardRef(({className:t,...n},a)=>e.jsx(xe,{ref:a,className:s.cn("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...n}));Z.displayName=xe.displayName;function rs({open:t,onOpenChange:n,group:a,onUpdate:r}){const[i,o]=f.useState("members"),[c,m]=f.useState(""),[h,g]=f.useState([]),[u,l]=f.useState([]),{data:p,isLoading:j,refetch:v}=s.useGroupMembers(a.id),y=a.type==="TENANT_GROUP"?"tenant":"organization",{users:w,isLoading:C}=s.useUnifiedUsers({type:y,tenantId:a.tenantId||void 0,active:!0,limit:100}),T=Qe(),P=He(),M=(p==null?void 0:p.members)||[],R=f.useMemo(()=>new Set(M.map(x=>x.userId)),[M]),b=f.useMemo(()=>w.filter(x=>!R.has(x.id)),[w,R]),I=f.useMemo(()=>{if(!c)return b;const x=c.toLowerCase();return b.filter(S=>{var L,F;return((L=S.name)==null?void 0:L.toLowerCase().includes(x))||((F=S.email)==null?void 0:F.toLowerCase().includes(x))})},[b,c]),N=f.useMemo(()=>{if(!c)return M;const x=c.toLowerCase();return M.filter(S=>{var L,F,q,E;return((F=(L=S.user)==null?void 0:L.name)==null?void 0:F.toLowerCase().includes(x))||((E=(q=S.user)==null?void 0:q.email)==null?void 0:E.toLowerCase().includes(x))})},[M,c]),A=async()=>{if(h.length!==0)try{await T.mutateAsync({groupId:a.id,data:{userIds:h,userType:y==="tenant"?"tenant":"org"}}),g([]),o("members"),v(),r==null||r()}catch(x){console.error("Failed to add members:",x)}},_=async()=>{if(u.length!==0)try{await P.mutateAsync({groupId:a.id,data:{userIds:u}}),l([]),v(),r==null||r()}catch(x){console.error("Failed to remove members:",x)}},Q=x=>{g(S=>S.includes(x)?S.filter(L=>L!==x):[...S,x])},U=x=>{l(S=>S.includes(x)?S.filter(L=>L!==x):[...S,x])};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:[M.length," ",M.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:i,onValueChange:x=>{o(x),m(""),l([])},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$1,{placeholder:"Search members...",value:c,onChange:x=>m(x.target.value),className:"pl-10"})]}),e.jsx(s.ScrollArea,{className:u.length>0?"h-[300px]":"h-[350px]",children:j?e.jsx("div",{className:"space-y-2",children:[1,2,3].map(x=>e.jsx(s.Skeleton,{className:"h-16 w-full"},x))}):N.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:c?"No members found":"No members yet"}),e.jsx("p",{className:"text-xs mt-1",children:c?"Try a different search":'Switch to the "Add Members" tab to add people to this group'})]}):e.jsx("div",{className:"space-y-2",children:N.map(x=>e.jsx(ns,{member:x,selected:u.includes(x.userId),onToggle:()=>U(x.userId)},x.id))})}),u.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:[u.length," member",u.length!==1?"s":""," selected"]}),e.jsx(s.Button,{variant:"destructive",size:"sm",onClick:_,disabled:P.isPending,children:P.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$1,{placeholder:"Search users to add...",value:c,onChange:x=>m(x.target.value),className:"pl-10"})]}),e.jsx(s.ScrollArea,{className:"h-[300px]",children:C?e.jsx("div",{className:"space-y-2",children:[1,2,3].map(x=>e.jsx(s.Skeleton,{className:"h-16 w-full"},x))}):I.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:c?"Try a different search":"All eligible users are already members"})]}):e.jsx("div",{className:"space-y-2",children:I.map(x=>e.jsx(os,{user:x,selected:h.includes(x.id),onToggle:()=>Q(x.id)},x.id))})}),h.length>0&&e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:[h.length," user",h.length!==1?"s":""," selected"]}),e.jsx(s.Button,{onClick:A,disabled:T.isPending,children:T.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 ns({member:t,selected:n,onToggle:a}){var i,o,c,m;const r=((o=(i=t.user)==null?void 0:i.name)==null?void 0:o.split(" ").map(h=>h[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(Y,{className:"h-8 w-8",children:e.jsx(Z,{className:"text-xs",children:r})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium",children:((c=t.user)==null?void 0:c.name)||"Unknown User"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:(m=t.user)==null?void 0:m.email})]})]})}function os({user:t,selected:n,onToggle:a}){var i;const r=((i=t.name)==null?void 0:i.split(" ").map(o=>o[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(Y,{className:"h-8 w-8",children:e.jsx(Z,{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 is({open:t,onOpenChange:n}){const[a,r]=f.useState("groups"),[i,o]=f.useState(""),[c,m]=f.useState(null),[h,g]=f.useState(!1),[u,l]=f.useState(null),{tokenProps:p}=s.useSemaphorContext(),{currentUser:j}=s.useCurrentUserInfo(),v=_e(),y=(j==null?void 0:j.type)==="tenant",w=p==null?void 0:p.tenantId,{groups:C,isLoading:T,refetch:P}=s.useGroups({type:y?"TENANT_GROUP":"all",tenantId:y?w:void 0,includeMembers:!1}),M=C.filter(N=>{var A;return N.name.toLowerCase().includes(i.toLowerCase())||((A=N.description)==null?void 0:A.toLowerCase().includes(i.toLowerCase()))}),R=async()=>{if(u)try{await v.mutateAsync(u.id),l(null),P()}catch(N){console.error("Failed to delete group:",N)}},b=N=>{m(N),g(!0)},I=()=>{r("groups"),P()};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$1,{placeholder:"Search groups...",value:i,onChange:N=>o(N.target.value),className:"pl-10"})]}),e.jsx(s.ScrollArea,{className:"h-[400px]",children:T?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(N=>e.jsx(s.Skeleton,{className:"h-24 w-full"},N))}):M.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:i?"Try a different search":"Create your first group to get started"})]}):e.jsx("div",{className:"space-y-3",children:M.map(N=>e.jsx(ls,{group:N,onManageMembers:()=>b(N),onDelete:()=>l(N),currentUserId:j==null?void 0:j.id},N.id))})})]})}),e.jsx(s.TabsContent,{value:"create",className:"mt-4",children:e.jsx(Ve,{onSuccess:I,tenantId:w,isTenantUser:y})})]})]})}),c&&e.jsx(rs,{open:h,onOpenChange:g,group:c,onUpdate:()=>P()}),e.jsx(s.AlertDialog,{open:!!u,onOpenChange:()=>l(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 "',u==null?void 0:u.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:R,disabled:v.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:v.isPending?e.jsxs(e.Fragment,{children:[e.jsx(s.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):"Delete Group"})]})]})})]})}function ls({group:t,onManageMembers:n,onDelete:a,currentUserId:r}){const i=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 ",s.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"})}),i&&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 cs(){var te,ae,re;const{authToken:t,tokenProps:n,id:a}=s.useSemaphorContext(),{isLocalDev:r}=s.useDashboardPreferences(),{permissions:i}=s.useRoleAwareDisplayPreferences(),o=s.useHasDashboardId(),{isLoading:c}=s.useDashboardQuery();s.useDashboardStore(d=>d.theme);const m=s.useDashboardStore(d=>d.lenses),h=s.useDashboardStore(d=>d.selectedLensId),g=m==null?void 0:m.find(d=>d.id===h),u=s.useDashboardStore(d=>d.dashboard);s.useDashboardStore(d=>d.selectedSheetId);const l=s.useDashboardStore(d=>d.isDashboardEditing),{setDashboardTitle:p}=s.useDashboardStore(d=>d.actions),[j,v]=f.useState(!1),[y,w]=f.useState(!1),[C,T]=f.useState(!1),P=s.useDashboardStore(d=>d.isDashboardPanelOpen),M=s.useDashboardStore(d=>d.actions.setIsDashboardPanelOpen),R=s.useDashboardStore(d=>d.filterValues),b=s.useDashboardStore(d=>d.isVisualEditing);s.useEditorStore(d=>d.card);const I=s.useManagementStore(d=>d.selectedDashboard),N=s.useManagementStore(d=>d.initialDashboard);s.useManagementStore(d=>d.selectedVisual),s.useDashboardStore(d=>d.selectedFrameId),s.useEditorStore(d=>d.frame);const A=I?(ae=I==null?void 0:I.permissions)==null?void 0:ae.canEdit:(te=N==null?void 0:N.permissions)==null?void 0:te.canEdit,_=s.useDashboardStore(d=>d.showFilters),Q=s.useDashboardStore(d=>d.showDashboardJSON),U=s.useDashboardStore(d=>d.onSaveFunction),x=s.useDashboardStore(d=>d.actions.setShowFilters),{setIsDashboardEditing:S,setShowDashboardJSON:L}=s.useDashboardStore(d=>d.actions),{setInitialDashboard:F,clearSelectedDashboard:q}=s.useManagementStore(d=>d.actions),{resources:E}=s.useResourceManagement(s.ResourceType.DASHBOARD),{currentUser:ge}=s.useCurrentUserInfo(),fe=s.canUserManageGroups(ge),G=I||N,ee=G?{id:G.id,title:(u==null?void 0:u.title)||G.title||"Dashboard"}:null,{handleAddNewFrame:je}=s.useAddNewFrame(),[H,V]=f.useState(!1),$=s.useUpdateResource(s.ResourceType.DASHBOARD),ve=async(d,k)=>{if(!(u!=null&&u.id)){console.log("No dashboard ID found");return}console.log("Updating dashboard title:",{dashboardId:u.id,newTitle:d,previousTitle:k}),$.mutate({resourceId:u.id,data:{title:d}},{onSuccess:()=>{console.log("Dashboard title updated successfully"),s.ue.success("Dashboard title updated")},onError:B=>{console.error("Failed to update dashboard title:",B),s.ue.error("Failed to update dashboard title"),p(k)}})};f.useEffect(()=>{if(E&&E.length>0){const d=u==null?void 0:u.id;if(d){const k=E.find(B=>B.id===d);k&&F(k)}}},[E,u==null?void 0:u.id,F]);const z=n.orgUserId||n.tenantId,be=l&&!b&&z&&A,ye=()=>{S(!0)};async function Ne(){const d=O.getDashbaordStateWithoutData(u);V(!0);const k={template:d};$.mutate({resourceId:d.id,data:k},{onSuccess:()=>{V(!1),s.ue.success("Dashboard saved!")},onError:()=>{V(!1),s.ue.error("Failed to save dashboard")}})}async function De(){if(v(!0),!h||!g)return;const d=O.getDashbaordStateWithoutData(u),k=JSON.stringify(d),B={...g,template:k,filterValues:R};await K(n.apiServiceUrl,B,t==null?void 0:t.accessToken),s.ue.success("Lens saved"),U==null||U(d),v(!1)}const se=(g==null?void 0:g.name)||u.title;$.isPending&&console.log("Title during update:",{title:se,dashboardStateTitle:u.title,dashboardId:u==null?void 0:u.id,currentLensName:g==null?void 0:g.name});const we=n.orgUserId||n.tenantId&&n.endUserId&&n.endUserEmail,Se=o;return e.jsxs("div",{className:"flex h-11 items-center justify-between gap-2 border-b px-4 py-2",role:"dashboard-controls",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[we&&e.jsxs(e.Fragment,{children:[e.jsx(s.IconButton,{"aria-label":"Manage Dashboards",tooltip:"Manage Dashboards",onClick:()=>{M(!P)},className:"h-7 p-2",children:e.jsx(Le,{className:"h-4 w-4"})}),Se&&!b&&e.jsx(s.IconButton,{"aria-label":"Dashboard Hub",tooltip:"Dashboard Hub",onClick:()=>q(),className:"h-7 p-2",children:e.jsx(s.House,{className:"h-4 w-4"})})]}),!b&&o&&(c?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.jsx(s.EditableText,{value:se||"Untitled Dashboard",onSave:d=>{console.log("EditableText onSave called:",{newTitle:d,canEditDashboard:A,dashboardId:u==null?void 0:u.id});const k=(u==null?void 0:u.title)||"";p(d),ve(d,k)},isEditable:A&&!g,displayClassName:"text-sm font-medium",inputClassName:"text-sm font-medium",placeholder:"Dashboard Title",isPending:$.isPending}))]}),e.jsxs("div",{className:"flex items-center gap-2",children:[b&&e.jsxs(e.Fragment,{children:[e.jsx(O.AdvancedModeToggle,{className:"mr-2"}),e.jsx(O.VisualEditingControls,{className:"h-7"})]}),r&&!b&&e.jsx(s.IconButton,{tooltip:"Invalidate Token",onClick:()=>s.invalidateToken(n.apiServiceUrl),className:"h-7 p-2",children:e.jsx(Ie,{className:"h-4 w-4"})}),!b&&o&&e.jsx(Oe,{}),!b&&o&&e.jsx(O.ScheduleDashboard,{}),!b&&o&&fe&&e.jsx(s.IconButton,{tooltip:"Manage Groups",onClick:()=>T(!0),className:"h-7 p-2",children:e.jsx(s.Users,{className:"h-4 w-4"})}),!b&&o&&((re=G==null?void 0:G.permissions)==null?void 0:re.canShare)&&e.jsx(s.IconButton,{tooltip:"Share Dashboard",onClick:()=>w(!0),className:"h-7 p-2",children:e.jsx(s.Share2,{className:"h-4 w-4"})}),!_&&!b&&l&&i.canUseFilters&&o&&e.jsx(s.Button,{className:"h-7 p-2",variant:"outline",onClick:()=>x(!0),size:"sm",children:e.jsx(s.Filter,{className:"h-4 w-4"})}),l&&!b&&z&&r&&o&&e.jsx(Re,{}),!b&&z&&r&&o&&e.jsx(Ge,{}),l&&!b&&z&&g&&r&&o&&e.jsxs(s.Button,{className:"h-7 p-2",variant:"secondary",disabled:j,onClick:De,size:"sm",children:[e.jsx(ne.Save,{className:"mr-2 h-4 w-4"}),"Save Lens"]}),l&&!b&&o&&e.jsxs(s.Button,{variant:"outline",className:"h-7 p-2",size:"sm",disabled:!l,onClick:()=>je(),children:[e.jsx(s.Plus,{className:"mr-2 h-4 w-4"}),"Visual"]}),!b&&!l&&i.canEdit&&o&&e.jsxs(s.Button,{variant:"outline",className:"h-7 p-2",onClick:ye,size:"sm",children:[e.jsx(s.Pencil,{className:"mr-2 h-4 w-4"}),"Edit"]}),be&&o&&e.jsxs(s.Button,{className:"h-7 p-2",disabled:H,onClick:Ne,size:"sm",children:[H?e.jsx(s.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(ne.Save,{className:"mr-2 h-4 w-4"}),H?"Saving...":"Save"]}),!b&&l&&r&&o&&e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(s.Button,{className:"h-7 p-2",onClick:()=>L(!Q),size:"sm",variant:"ghost",children:e.jsx(s.Code,{className:"h-4 w-4"})})}),!b&&r&&e.jsx(Ae,{}),l&&!b&&o&&e.jsxs(s.Button,{variant:"outline",className:"h-7 p-2",onClick:()=>{S(!1),L(!1)},children:[e.jsx(s.Cross2Icon,{className:"mr-2 h-4 w-4"}),"Close"]}),y&&ee&&e.jsx(s.ShareDialog,{resource:ee,resourceType:s.ResourceType.DASHBOARD,onClose:()=>w(!1)}),e.jsx(is,{open:C,onOpenChange:T})]})]})}exports.default=cs;
|
|
26
|
+
*/const Pe=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 Te=s.requireShim();function Ae(){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(Pe,{strokeWidth:1.5,className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),e.jsx(Le,{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 Fe(t,n,a,r,i){if(!i)return null;const o=JSON.stringify(a),l=`${t}/v1/lens`;return await s.postRequest(l,i,{name:n,template:o,filterValues:r,operation:"create"})}async function K(t,n,a){if(!a)return null;const{id:r,template:i,filterValues:o,isDefault:l,shared:m}=n,h=`${t}/v1/lens`;return await s.postRequest(h,a,{lensId:r,template:i,filterValues:o,isDefault:l,shared:m,operation:"update"})}async function Ee(t,n,a){if(!a)return null;const r=`${t}/v1/lens`;return await s.postRequest(r,a,{operation:"delete",lensId:n})}function Re(){const[t,n]=f.useState(""),[a,r]=f.useState(!1),i=s.useDashboardStore(w=>w.lenses),{setLenses:o,setSelectedLensId:l}=s.useDashboardActions(),[m,h]=f.useState(!1),[g,u]=f.useState(!1),c=s.useDashboardStore(w=>w.dashboard),p=s.useDashboardStore(w=>w.filterValues),{authToken:j,tokenProps:b}=s.useSemaphorContext();async function y(){h(!0);const w=O.getDashbaordStateWithoutData(c),C=await Fe(b.apiServiceUrl,t,w,p,j==null?void 0:j.accessToken);C&&(o([...i||[],C]),l(C.id),u(!1)),h(!1)}return e.jsxs(s.Dialog,{open:g,onOpenChange:u,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$1,{value:t,onChange:w=>{n(w.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:y,disabled:m,children:m?"Creating...":"Add"})})]})]})}function Ge(){const[t,n]=f.useState(!1),a=s.useDashboardStore(c=>c.lenses),r=s.useDashboardStore(c=>c.selectedLensId),{setLenses:i,setSelectedLensId:o}=s.useDashboardActions(),{authToken:l,tokenProps:m}=s.useSemaphorContext();async function h(c){o(c)}async function g(c){if(await Ee(m.apiServiceUrl,c,l==null?void 0:l.accessToken)){const j=a==null?void 0:a.filter(b=>b.id!==c);i(j||[]),o("original")}}async function u(c){const p=a==null?void 0:a.map(y=>y.id===c.id?{...y,isDefault:!c.isDefault}:{...y,isDefault:!1});i(p||[]);const j={...c,isDefault:!c.isDefault};await K(m.apiServiceUrl,j,l==null?void 0:l.accessToken);const b=a==null?void 0:a.find(y=>y.isDefault);if(b&&b.id!==c.id){const y={...b,isDefault:!1};await K(m.apiServiceUrl,y,l==null?void 0:l.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(Me,{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:h,children:[e.jsx(s.DropdownMenuRadioItem,{value:"original",children:"Original"}),a==null?void 0:a.map(c=>e.jsxs(s.DropdownMenuRadioItem,{className:"group flex justify-between gap-2",value:c.id,children:[e.jsx("p",{children:c.name}),e.jsxs("span",{className:"flex items-center gap-3",children:[e.jsx(s.House,{onClick:p=>{p.preventDefault(),u(c)},className:s.cn("size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",{invisible:!c.isDefault,"text-green-500":c.isDefault}),strokeWidth:1.5}),e.jsx(s.Cross2Icon,{onClick:p=>{p.preventDefault(),g(c.id)},className:"invisible size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",strokeWidth:1.5})]})]},c.id))]})]})]})}function Oe({iconClassName:t}){const[n,a]=f.useState(!1),[r,i]=f.useState(""),[o,l]=f.useState(!1),m=s.useDashboardStore(c=>c.isDownloadingPdf),{tokenProps:h}=s.useSemaphorContext();async function g(){const c=s.ue.loading("Generating PDF... may take up to 60 seconds");try{await s.downloadPdf(h.apiServiceUrl),s.ue.dismiss(c),s.ue.success("PDF downloaded successfully!",{duration:2e3})}catch(p){s.ue.dismiss(c),s.ue.error("Failed to download PDF",{description:"Please try again or contact support.",richColors:!0}),console.error("PDF download error:",p)}}async function u(){if(!r)return;a(!1),i(""),l(!1);const c=s.ue.loading("Generating protected PDF... may take up to 60 seconds");try{await s.downloadPdf(h.apiServiceUrl,r),s.ue.dismiss(c),s.ue.success("Protected PDF downloaded successfully!",{duration:2e3,position:"top-right"})}catch(p){s.ue.dismiss(c),s.ue.error("Failed to download protected PDF. Please try again."),console.error("Protected PDF download error:",p)}}return e.jsxs(e.Fragment,{children:[e.jsxs(s.DropdownMenu,{modal:!1,children:[e.jsx(s.DropdownMenuTrigger,{asChild:!0,children:e.jsx(s.Button,{variant:"ghost",size:"sm",className:"h-7 p-2",disabled:m,children:e.jsx(s.Download,{className:s.cn("size-4",t)})})}),e.jsxs(s.DropdownMenuContent,{align:"end",children:[e.jsxs(s.DropdownMenuItem,{onClick:g,children:[e.jsx(s.File,{className:"mr-2 h-4 w-4"}),"Download PDF"]}),e.jsxs(s.DropdownMenuItem,{onClick:()=>a(!0),children:[e.jsx(s.Lock,{className:"mr-2 h-4 w-4"}),"Download Protected PDF"]})]})]}),e.jsx(s.Dialog,{open:n,onOpenChange:a,children:e.jsxs(s.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(s.DialogHeader,{children:[e.jsx(s.DialogTitle,{children:"Download Protected PDF"}),e.jsx(s.DialogDescription,{children:"Enter a password to protect your PDF. The PDF will be encrypted and require this password to open."})]}),e.jsx("div",{className:"grid gap-4 py-4",children:e.jsxs("div",{className:"grid gap-2",children:[e.jsx(s.Label,{htmlFor:"password",children:"Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(s.Input$1,{id:"password",type:o?"text":"password",value:r,onChange:c=>i(c.target.value),placeholder:"Enter password",className:"pr-10",onKeyDown:c=>{c.key==="Enter"&&r&&u()}}),e.jsx(s.Button,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>l(!o),children:o?e.jsx(s.EyeOff,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(s.Eye,{className:"h-4 w-4 text-muted-foreground"})})]})]})}),e.jsxs(s.DialogFooter,{children:[e.jsx(s.Button,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e.jsx(s.Button,{onClick:u,disabled:!r,children:"Download"})]})]})})]})}const Ue=async(t,n,a)=>{const r=`${t}/management/v1/groups`;return await s.postRequestRegular(r,n,a)},Be=async(t,n,a)=>{const r=`${t}/management/v1/groups/${a}`,i=await fetch(r,{method:"DELETE",headers:{Authorization:`Bearer ${n}`}});if(!i.ok){const o=await i.text();throw new Error(o||"Failed to delete group")}},qe=async(t,n,a,r)=>{const i=`${t}/management/v1/groups/${a}/members`;return await s.postRequestRegular(i,n,r)},$e=async(t,n,a,r)=>{const i=`${t}/management/v1/groups/${a}/members`,o=await fetch(i,{method:"DELETE",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(r)});if(!o.ok){const l=await o.text();throw new Error(l||"Failed to remove group members")}};function ze(){const{authToken:t,tokenProps:n}=s.useSemaphorContext(),a=s.useQueryClient();return s.useMutation({mutationFn:r=>Ue(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 _e(){const{authToken:t,tokenProps:n}=s.useSemaphorContext(),a=s.useQueryClient();return s.useMutation({mutationFn:r=>Be(n.apiServiceUrl,(t==null?void 0:t.accessToken)||"",r),onSuccess:(r,i)=>{a.invalidateQueries({queryKey:["groups"]}),a.removeQueries({queryKey:["group",i]}),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 Qe(){const{authToken:t,tokenProps:n}=s.useSemaphorContext(),a=s.useQueryClient();return s.useMutation({mutationFn:({groupId:r,data:i})=>qe(n.apiServiceUrl,(t==null?void 0:t.accessToken)||"",r,i),onSuccess:(r,i)=>{a.invalidateQueries({queryKey:["group",i.groupId]}),a.invalidateQueries({queryKey:["group-members",i.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 He(){const{authToken:t,tokenProps:n}=s.useSemaphorContext(),a=s.useQueryClient();return s.useMutation({mutationFn:({groupId:r,data:i})=>$e(n.apiServiceUrl,(t==null?void 0:t.accessToken)||"",r,i),onSuccess:(r,i)=>{a.invalidateQueries({queryKey:["group",i.groupId]}),a.invalidateQueries({queryKey:["group-members",i.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 Ve({onSuccess:t,tenantId:n,isTenantUser:a}){const[r,i]=f.useState(""),[o,l]=f.useState(""),[m,h]=f.useState({}),g=ze(),u=()=>{const p={};return r.trim()?r.length<3?p.name="Group name must be at least 3 characters":r.length>50&&(p.name="Group name must be less than 50 characters"):p.name="Group name is required",o&&o.length>200&&(p.description="Description must be less than 200 characters"),h(p),Object.keys(p).length===0},c=async p=>{if(p.preventDefault(),!u())return;const j={name:r.trim(),description:o.trim()||void 0,type:a?"TENANT_GROUP":"ORG_GROUP",...a&&n?{tenantId:n}:{}};try{await g.mutateAsync(j),i(""),l(""),h({}),t()}catch(b){console.error("Failed to create group:",b)}};return e.jsxs("form",{onSubmit:c,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$1,{id:"group-name",placeholder:"e.g., Marketing Team, Engineering Squad",value:r,onChange:p=>{i(p.target.value),m.name&&h(j=>({...j,name:""}))},className:m.name?"border-destructive":"",disabled:g.isPending}),m.name&&e.jsx("p",{className:"text-sm text-destructive",children:m.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:o,onChange:p=>{l(p.target.value),m.description&&h(j=>({...j,description:""}))},className:m.description?"border-destructive":"",disabled:g.isPending,rows:3}),m.description&&e.jsx("p",{className:"text-sm text-destructive",children:m.description}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[o.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:()=>{i(""),l(""),h({})},disabled:g.isPending,children:"Clear"}),e.jsx(s.Button,{type:"submit",disabled:g.isPending||!r.trim(),children:g.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 Ke(t,n=[]){let a=[];function r(o,l){const m=D.createContext(l),h=a.length;a=[...a,l];const g=c=>{var C;const{scope:p,children:j,...b}=c,y=((C=p==null?void 0:p[t])==null?void 0:C[h])||m,w=D.useMemo(()=>b,Object.values(b));return e.jsx(y.Provider,{value:w,children:j})};g.displayName=o+"Provider";function u(c,p){var y;const j=((y=p==null?void 0:p[t])==null?void 0:y[h])||m,b=D.useContext(j);if(b)return b;if(l!==void 0)return l;throw new Error(`\`${c}\` must be used within \`${o}\``)}return[g,u]}const i=()=>{const o=a.map(l=>D.createContext(l));return function(m){const h=(m==null?void 0:m[t])||o;return D.useMemo(()=>({[`__scope${t}`]:{...m,[t]:h}}),[m,h])}};return i.scopeName=t,[r,We(i,...n)]}function We(...t){const n=t[0];if(t.length===1)return n;const a=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const l=r.reduce((m,{useScope:h,scopeName:g})=>{const c=h(o)[`__scope${g}`];return{...m,...c}},{});return D.useMemo(()=>({[`__scope${n.scopeName}`]:l}),[l])}};return a.scopeName=n.scopeName,a}function Je(t){const n=D.useRef(t);return D.useEffect(()=>{n.current=t}),D.useMemo(()=>(...a)=>{var r;return(r=n.current)==null?void 0:r.call(n,...a)},[])}var W=globalThis!=null&&globalThis.document?D.useLayoutEffect:()=>{},Xe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],J=Xe.reduce((t,n)=>{const a=s.createSlot(`Primitive.${n}`),r=D.forwardRef((i,o)=>{const{asChild:l,...m}=i,h=l?a:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(h,{...m,ref:o})});return r.displayName=`Primitive.${n}`,{...t,[n]:r}},{});function Ye(){return Te.useSyncExternalStore(Ze,()=>!0,()=>!1)}function Ze(){return()=>{}}var X="Avatar",[es]=Ke(X),[ss,ie]=es(X),ce=D.forwardRef((t,n)=>{const{__scopeAvatar:a,...r}=t,[i,o]=D.useState("idle");return e.jsx(ss,{scope:a,imageLoadingStatus:i,onImageLoadingStatusChange:o,children:e.jsx(J.span,{...r,ref:n})})});ce.displayName=X;var le="AvatarImage",de=D.forwardRef((t,n)=>{const{__scopeAvatar:a,src:r,onLoadingStatusChange:i=()=>{},...o}=t,l=ie(le,a),m=ts(r,o),h=Je(g=>{i(g),l.onImageLoadingStatusChange(g)});return W(()=>{m!=="idle"&&h(m)},[m,h]),m==="loaded"?e.jsx(J.img,{...o,ref:n,src:r}):null});de.displayName=le;var ue="AvatarFallback",me=D.forwardRef((t,n)=>{const{__scopeAvatar:a,delayMs:r,...i}=t,o=ie(ue,a),[l,m]=D.useState(r===void 0);return D.useEffect(()=>{if(r!==void 0){const h=window.setTimeout(()=>m(!0),r);return()=>window.clearTimeout(h)}},[r]),l&&o.imageLoadingStatus!=="loaded"?e.jsx(J.span,{...i,ref:n}):null});me.displayName=ue;function oe(t,n){return t?n?(t.src!==n&&(t.src=n),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function ts(t,{referrerPolicy:n,crossOrigin:a}){const r=Ye(),i=D.useRef(null),o=r?(i.current||(i.current=new window.Image),i.current):null,[l,m]=D.useState(()=>oe(o,t));return W(()=>{m(oe(o,t))},[o,t]),W(()=>{const h=c=>()=>{m(c)};if(!o)return;const g=h("loaded"),u=h("error");return o.addEventListener("load",g),o.addEventListener("error",u),n&&(o.referrerPolicy=n),typeof a=="string"&&(o.crossOrigin=a),()=>{o.removeEventListener("load",g),o.removeEventListener("error",u)}},[o,a,n]),l}var he=ce,pe=de,xe=me;const Y=D.forwardRef(({className:t,...n},a)=>e.jsx(he,{ref:a,className:s.cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...n}));Y.displayName=he.displayName;const as=D.forwardRef(({className:t,...n},a)=>e.jsx(pe,{ref:a,className:s.cn("aspect-square h-full w-full",t),...n}));as.displayName=pe.displayName;const Z=D.forwardRef(({className:t,...n},a)=>e.jsx(xe,{ref:a,className:s.cn("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...n}));Z.displayName=xe.displayName;function rs({open:t,onOpenChange:n,group:a,onUpdate:r}){const[i,o]=f.useState("members"),[l,m]=f.useState(""),[h,g]=f.useState([]),[u,c]=f.useState([]),{data:p,isLoading:j,refetch:b}=s.useGroupMembers(a.id),y=a.type==="TENANT_GROUP"?"tenant":"organization",{users:w,isLoading:C}=s.useUnifiedUsers({type:y,tenantId:a.tenantId||void 0,active:!0,limit:100}),T=Qe(),P=He(),M=(p==null?void 0:p.members)||[],R=f.useMemo(()=>new Set(M.map(x=>x.userId)),[M]),v=f.useMemo(()=>w.filter(x=>!R.has(x.id)),[w,R]),I=f.useMemo(()=>{if(!l)return v;const x=l.toLowerCase();return v.filter(S=>{var k,F;return((k=S.name)==null?void 0:k.toLowerCase().includes(x))||((F=S.email)==null?void 0:F.toLowerCase().includes(x))})},[v,l]),N=f.useMemo(()=>{if(!l)return M;const x=l.toLowerCase();return M.filter(S=>{var k,F,q,E;return((F=(k=S.user)==null?void 0:k.name)==null?void 0:F.toLowerCase().includes(x))||((E=(q=S.user)==null?void 0:q.email)==null?void 0:E.toLowerCase().includes(x))})},[M,l]),A=async()=>{if(h.length!==0)try{await T.mutateAsync({groupId:a.id,data:{userIds:h,userType:y==="tenant"?"tenant":"org"}}),g([]),o("members"),b(),r==null||r()}catch(x){console.error("Failed to add members:",x)}},_=async()=>{if(u.length!==0)try{await P.mutateAsync({groupId:a.id,data:{userIds:u}}),c([]),b(),r==null||r()}catch(x){console.error("Failed to remove members:",x)}},Q=x=>{g(S=>S.includes(x)?S.filter(k=>k!==x):[...S,x])},U=x=>{c(S=>S.includes(x)?S.filter(k=>k!==x):[...S,x])};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:[M.length," ",M.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:i,onValueChange:x=>{o(x),m(""),c([])},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$1,{placeholder:"Search members...",value:l,onChange:x=>m(x.target.value),className:"pl-10"})]}),e.jsx(s.ScrollArea,{className:u.length>0?"h-[300px]":"h-[350px]",children:j?e.jsx("div",{className:"space-y-2",children:[1,2,3].map(x=>e.jsx(s.Skeleton,{className:"h-16 w-full"},x))}):N.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:l?"No members found":"No members yet"}),e.jsx("p",{className:"text-xs mt-1",children:l?"Try a different search":'Switch to the "Add Members" tab to add people to this group'})]}):e.jsx("div",{className:"space-y-2",children:N.map(x=>e.jsx(ns,{member:x,selected:u.includes(x.userId),onToggle:()=>U(x.userId)},x.id))})}),u.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:[u.length," member",u.length!==1?"s":""," selected"]}),e.jsx(s.Button,{variant:"destructive",size:"sm",onClick:_,disabled:P.isPending,children:P.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$1,{placeholder:"Search users to add...",value:l,onChange:x=>m(x.target.value),className:"pl-10"})]}),e.jsx(s.ScrollArea,{className:"h-[300px]",children:C?e.jsx("div",{className:"space-y-2",children:[1,2,3].map(x=>e.jsx(s.Skeleton,{className:"h-16 w-full"},x))}):I.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:l?"Try a different search":"All eligible users are already members"})]}):e.jsx("div",{className:"space-y-2",children:I.map(x=>e.jsx(os,{user:x,selected:h.includes(x.id),onToggle:()=>Q(x.id)},x.id))})}),h.length>0&&e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:[h.length," user",h.length!==1?"s":""," selected"]}),e.jsx(s.Button,{onClick:A,disabled:T.isPending,children:T.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 ns({member:t,selected:n,onToggle:a}){var i,o,l,m;const r=((o=(i=t.user)==null?void 0:i.name)==null?void 0:o.split(" ").map(h=>h[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(Y,{className:"h-8 w-8",children:e.jsx(Z,{className:"text-xs",children:r})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium",children:((l=t.user)==null?void 0:l.name)||"Unknown User"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:(m=t.user)==null?void 0:m.email})]})]})}function os({user:t,selected:n,onToggle:a}){var i;const r=((i=t.name)==null?void 0:i.split(" ").map(o=>o[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(Y,{className:"h-8 w-8",children:e.jsx(Z,{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 is({open:t,onOpenChange:n}){const[a,r]=f.useState("groups"),[i,o]=f.useState(""),[l,m]=f.useState(null),[h,g]=f.useState(!1),[u,c]=f.useState(null),{tokenProps:p}=s.useSemaphorContext(),{currentUser:j}=s.useCurrentUserInfo(),b=_e(),y=(j==null?void 0:j.type)==="tenant",w=p==null?void 0:p.tenantId,{groups:C,isLoading:T,refetch:P}=s.useGroups({type:y?"TENANT_GROUP":"all",tenantId:y?w:void 0,includeMembers:!1}),M=C.filter(N=>{var A;return N.name.toLowerCase().includes(i.toLowerCase())||((A=N.description)==null?void 0:A.toLowerCase().includes(i.toLowerCase()))}),R=async()=>{if(u)try{await b.mutateAsync(u.id),c(null),P()}catch(N){console.error("Failed to delete group:",N)}},v=N=>{m(N),g(!0)},I=()=>{r("groups"),P()};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$1,{placeholder:"Search groups...",value:i,onChange:N=>o(N.target.value),className:"pl-10"})]}),e.jsx(s.ScrollArea,{className:"h-[400px]",children:T?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(N=>e.jsx(s.Skeleton,{className:"h-24 w-full"},N))}):M.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:i?"Try a different search":"Create your first group to get started"})]}):e.jsx("div",{className:"space-y-3",children:M.map(N=>e.jsx(cs,{group:N,onManageMembers:()=>v(N),onDelete:()=>c(N),currentUserId:j==null?void 0:j.id},N.id))})})]})}),e.jsx(s.TabsContent,{value:"create",className:"mt-4",children:e.jsx(Ve,{onSuccess:I,tenantId:w,isTenantUser:y})})]})]})}),l&&e.jsx(rs,{open:h,onOpenChange:g,group:l,onUpdate:()=>P()}),e.jsx(s.AlertDialog,{open:!!u,onOpenChange:()=>c(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 "',u==null?void 0:u.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:R,disabled:b.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:b.isPending?e.jsxs(e.Fragment,{children:[e.jsx(s.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):"Delete Group"})]})]})})]})}function cs({group:t,onManageMembers:n,onDelete:a,currentUserId:r}){const i=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 ",s.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"})}),i&&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 ls(){var te,ae,re;const{authToken:t,tokenProps:n,id:a}=s.useSemaphorContext(),{isLocalDev:r}=s.useDashboardPreferences(),{permissions:i}=s.useRoleAwareDisplayPreferences(),o=s.useHasDashboardId(),{isLoading:l}=s.useDashboardQuery();s.useDashboardStore(d=>d.theme);const m=s.useDashboardStore(d=>d.lenses),h=s.useDashboardStore(d=>d.selectedLensId),g=m==null?void 0:m.find(d=>d.id===h),u=s.useDashboardStore(d=>d.dashboard);s.useDashboardStore(d=>d.selectedSheetId);const c=s.useDashboardStore(d=>d.isDashboardEditing),{setDashboardTitle:p}=s.useDashboardStore(d=>d.actions),[j,b]=f.useState(!1),[y,w]=f.useState(!1),[C,T]=f.useState(!1),P=s.useDashboardStore(d=>d.isDashboardPanelOpen),M=s.useDashboardStore(d=>d.actions.setIsDashboardPanelOpen),R=s.useDashboardStore(d=>d.filterValues),v=s.useDashboardStore(d=>d.isVisualEditing);s.useEditorStore(d=>d.card);const I=s.useManagementStore(d=>d.selectedDashboard),N=s.useManagementStore(d=>d.initialDashboard);s.useManagementStore(d=>d.selectedVisual),s.useDashboardStore(d=>d.selectedFrameId),s.useEditorStore(d=>d.frame);const A=I?(ae=I==null?void 0:I.permissions)==null?void 0:ae.canEdit:(te=N==null?void 0:N.permissions)==null?void 0:te.canEdit,_=s.useDashboardStore(d=>d.showFilters),Q=s.useDashboardStore(d=>d.showDashboardJSON),U=s.useDashboardStore(d=>d.onSaveFunction),x=s.useDashboardStore(d=>d.actions.setShowFilters),{setIsDashboardEditing:S,setShowDashboardJSON:k}=s.useDashboardStore(d=>d.actions),{setInitialDashboard:F,clearSelectedDashboard:q}=s.useManagementStore(d=>d.actions),{resources:E}=s.useResourceManagement(s.ResourceType.DASHBOARD),{currentUser:ge}=s.useCurrentUserInfo(),fe=s.canUserManageGroups(ge),G=I||N,ee=G?{id:G.id,title:(u==null?void 0:u.title)||G.title||"Dashboard"}:null,{handleAddNewFrame:je}=s.useAddNewFrame(),[H,V]=f.useState(!1),$=s.useUpdateResource(s.ResourceType.DASHBOARD),be=async(d,L)=>{if(!(u!=null&&u.id)){console.log("No dashboard ID found");return}console.log("Updating dashboard title:",{dashboardId:u.id,newTitle:d,previousTitle:L}),$.mutate({resourceId:u.id,data:{title:d}},{onSuccess:()=>{console.log("Dashboard title updated successfully"),s.ue.success("Dashboard title updated")},onError:B=>{console.error("Failed to update dashboard title:",B),s.ue.error("Failed to update dashboard title"),p(L)}})};f.useEffect(()=>{if(E&&E.length>0){const d=u==null?void 0:u.id;if(d){const L=E.find(B=>B.id===d);L&&F(L)}}},[E,u==null?void 0:u.id,F]);const z=n.orgUserId||n.tenantId,ve=c&&!v&&z&&A,ye=()=>{S(!0)};async function Ne(){const d=O.getDashbaordStateWithoutData(u);V(!0);const L={template:d};$.mutate({resourceId:d.id,data:L},{onSuccess:()=>{V(!1),s.ue.success("Dashboard saved!")},onError:()=>{V(!1),s.ue.error("Failed to save dashboard")}})}async function De(){if(b(!0),!h||!g)return;const d=O.getDashbaordStateWithoutData(u),L=JSON.stringify(d),B={...g,template:L,filterValues:R};await K(n.apiServiceUrl,B,t==null?void 0:t.accessToken),s.ue.success("Lens saved"),U==null||U(d),b(!1)}const se=(g==null?void 0:g.name)||u.title;$.isPending&&console.log("Title during update:",{title:se,dashboardStateTitle:u.title,dashboardId:u==null?void 0:u.id,currentLensName:g==null?void 0:g.name});const we=n.orgUserId||n.tenantId&&n.endUserId&&n.endUserEmail,Se=o;return e.jsxs("div",{className:"flex h-11 items-center justify-between gap-2 border-b px-4 py-2",role:"dashboard-controls",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[we&&e.jsxs(e.Fragment,{children:[e.jsx(s.IconButton,{"aria-label":"Manage Dashboards",tooltip:"Manage Dashboards",onClick:()=>{M(!P)},className:"h-7 p-2",children:e.jsx(ke,{className:"h-4 w-4"})}),Se&&!v&&e.jsx(s.IconButton,{"aria-label":"Dashboard Hub",tooltip:"Dashboard Hub",onClick:()=>q(),className:"h-7 p-2",children:e.jsx(s.House,{className:"h-4 w-4"})})]}),!v&&o&&(l?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.jsx(s.EditableText,{value:se||"Untitled Dashboard",onSave:d=>{console.log("EditableText onSave called:",{newTitle:d,canEditDashboard:A,dashboardId:u==null?void 0:u.id});const L=(u==null?void 0:u.title)||"";p(d),be(d,L)},isEditable:A&&!g,displayClassName:"text-sm font-medium",inputClassName:"text-sm font-medium",placeholder:"Dashboard Title",isPending:$.isPending}))]}),e.jsxs("div",{className:"flex items-center gap-2",children:[v&&e.jsxs(e.Fragment,{children:[e.jsx(O.AdvancedModeToggle,{className:"mr-2"}),e.jsx(O.VisualEditingControls,{className:"h-7"})]}),r&&!v&&e.jsxs(e.Fragment,{children:[e.jsx(s.IconButton,{tooltip:"Copy Token",onClick:()=>{t!=null&&t.accessToken&&(navigator.clipboard.writeText(t.accessToken),s.ue.success("Token copied to clipboard"))},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(Ie,{className:"h-4 w-4"})})]}),!v&&o&&e.jsx(Oe,{}),!v&&o&&e.jsx(O.ScheduleDashboard,{}),!v&&o&&fe&&e.jsx(s.IconButton,{tooltip:"Manage Groups",onClick:()=>T(!0),className:"h-7 p-2",children:e.jsx(s.Users,{className:"h-4 w-4"})}),!v&&o&&((re=G==null?void 0:G.permissions)==null?void 0:re.canShare)&&e.jsx(s.IconButton,{tooltip:"Share Dashboard",onClick:()=>w(!0),className:"h-7 p-2",children:e.jsx(s.Share2,{className:"h-4 w-4"})}),!_&&!v&&c&&i.canUseFilters&&o&&e.jsx(s.Button,{className:"h-7 p-2",variant:"outline",onClick:()=>x(!0),size:"sm",children:e.jsx(s.Filter,{className:"h-4 w-4"})}),c&&!v&&z&&r&&o&&e.jsx(Re,{}),!v&&z&&r&&o&&e.jsx(Ge,{}),c&&!v&&z&&g&&r&&o&&e.jsxs(s.Button,{className:"h-7 p-2",variant:"secondary",disabled:j,onClick:De,size:"sm",children:[e.jsx(ne.Save,{className:"mr-2 h-4 w-4"}),"Save Lens"]}),c&&!v&&o&&e.jsxs(s.Button,{variant:"outline",className:"h-7 p-2",size:"sm",disabled:!c,onClick:()=>je(),children:[e.jsx(s.Plus,{className:"mr-2 h-4 w-4"}),"Visual"]}),!v&&!c&&i.canEdit&&o&&e.jsxs(s.Button,{variant:"outline",className:"h-7 p-2",onClick:ye,size:"sm",children:[e.jsx(s.Pencil,{className:"mr-2 h-4 w-4"}),"Edit"]}),ve&&o&&e.jsxs(s.Button,{className:"h-7 p-2",disabled:H,onClick:Ne,size:"sm",children:[H?e.jsx(s.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(ne.Save,{className:"mr-2 h-4 w-4"}),H?"Saving...":"Save"]}),!v&&c&&r&&o&&e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(s.Button,{className:"h-7 p-2",onClick:()=>k(!Q),size:"sm",variant:"ghost",children:e.jsx(s.Code,{className:"h-4 w-4"})})}),!v&&r&&e.jsx(Ae,{}),c&&!v&&o&&e.jsxs(s.Button,{variant:"outline",className:"h-7 p-2",onClick:()=>{S(!1),k(!1)},children:[e.jsx(s.Cross2Icon,{className:"mr-2 h-4 w-4"}),"Close"]}),y&&ee&&e.jsx(s.ShareDialog,{resource:ee,resourceType:s.ResourceType.DASHBOARD,onClose:()=>w(!1)}),e.jsx(is,{open:C,onOpenChange:T})]})]})}exports.default=ls;
|
|
@@ -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-Cwi4U3XN.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,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as o, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { u as s, c as l, B as h, X as d, d as c } from "./index-
|
|
2
|
+
import { u as s, c as l, B as h, X as d, d as c } from "./index-BYYUZIiS.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "react-dom";
|
|
5
5
|
function N() {
|
|
@@ -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-Cwi4U3XN.js"),A=require("react"),Je=require("./editor-action-buttons-CiZYTAan.js"),et=require("react-dom"),st=require("./use-visual-utils-DTdxZgvk.js"),tt=require("./use-click-outside-B9T3lmcw.js");function at(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(a,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return a.default=t,Object.freeze(a)}const Ue=at(A);/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|