react-semaphor 0.1.302 → 0.1.304
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/appearance/index.cjs +1 -1
- package/dist/appearance/index.js +1 -1
- package/dist/brand-studio/index.cjs +5 -5
- package/dist/brand-studio/index.js +334 -385
- package/dist/chunks/common-types-C6cAQgyh.js +9 -0
- package/dist/chunks/common-types-nBuCd3u2.js +1 -0
- package/dist/chunks/{dashboard-controls-CZuC_QjN.js → dashboard-controls-CyFZfGaN.js} +800 -776
- package/dist/chunks/dashboard-controls-DCZnUFI0.js +47 -0
- package/dist/chunks/{dashboard-filter-controls-button-kfb_T18o.js → dashboard-filter-controls-button-DI7XUgZK.js} +142 -142
- package/dist/chunks/{dashboard-filter-controls-button-2I1ltWQ9.js → dashboard-filter-controls-button-YQZ-oeN5.js} +3 -3
- package/dist/chunks/{dashboard-json-Df6v2Jem.js → dashboard-json-C6R2qixD.js} +3 -3
- package/dist/chunks/{dashboard-json-C3v6rBdp.js → dashboard-json-Z8jz16Yj.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-DKAaWq-G.js → dashboard-summary-settings-dialog-BlD77h63.js} +2 -2
- package/dist/chunks/{dashboard-summary-settings-dialog-BBALEHJQ.js → dashboard-summary-settings-dialog-DJyY-PB9.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-CGBYahAK.js → edit-dashboard-visual-CNGc1zcN.js} +33 -33
- package/dist/chunks/{edit-dashboard-visual-D8L0cl_U.js → edit-dashboard-visual-CfRJXwDR.js} +167 -168
- package/dist/chunks/{index-uRJmUpof.js → index-CJdxSyQq.js} +679 -656
- package/dist/chunks/index-D2vz3gvd.js +1360 -0
- package/dist/chunks/index-DRlMUglg.js +4 -0
- package/dist/chunks/{index-BmoR3VQT.js → index-GHhvGdF9.js} +42745 -40322
- package/dist/chunks/{palette-326-dgn0.js → palette-BqJlrRto.js} +7 -2
- package/dist/chunks/{palette-jd7xiGTg.js → palette-DD-i7bNS.js} +23 -3
- package/dist/chunks/{resource-management-panel-C_c-BwrC.js → resource-management-panel-7Y4ITzGH.js} +65 -65
- package/dist/chunks/{resource-management-panel-DrcEEARD.js → resource-management-panel-Bdus73Iu.js} +1 -1
- package/dist/chunks/{rotate-ccw-BugHcM1w.js → rotate-ccw-CdGW8Rxm.js} +1 -1
- package/dist/chunks/{rotate-ccw-yFwqBFJZ.js → rotate-ccw-X8MbX_hF.js} +1 -1
- package/dist/chunks/{save-CaybXtdd.js → save-CFBIhbHD.js} +1 -1
- package/dist/chunks/{save-DU0FXUlM.js → save-j-clxFtx.js} +1 -1
- package/dist/chunks/{switch-CZtMtqEj.js → switch-BFhVVwh9.js} +4285 -3275
- package/dist/chunks/switch-BH17qlxH.js +163 -0
- package/dist/chunks/use-create-flow-overlay-state-CSytlf2H.js +16 -0
- package/dist/chunks/{use-create-flow-overlay-state-84Xe8VrP.js → use-create-flow-overlay-state-CllZvyvE.js} +318 -316
- package/dist/chunks/{use-visual-utils-lp5DfmvL.js → use-visual-utils-CDO4kVX5.js} +1 -1
- package/dist/chunks/{use-visual-utils-z3ifg6Fd.js → use-visual-utils-CyjLzcDG.js} +2 -2
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +5 -5
- package/dist/index.cjs +1 -1
- package/dist/index.js +61 -60
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +6 -6
- package/dist/types/dashboard.d.ts +168 -0
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.js +8 -11
- package/dist/types/main.d.ts +195 -2
- package/dist/types/shared.d.ts +120 -0
- package/dist/types/surfboard.d.ts +168 -0
- package/dist/types/types.d.ts +168 -0
- package/package.json +1 -1
- package/dist/chunks/braces-CpOcaBNm.js +0 -6
- package/dist/chunks/braces-TYclg8Hl.js +0 -23
- package/dist/chunks/dashboard-controls-BkuB9TQX.js +0 -47
- package/dist/chunks/index-Cxb9UUro.js +0 -4
- package/dist/chunks/index-eM6MU4q_.js +0 -1361
- package/dist/chunks/switch-AmoR1YIA.js +0 -163
- package/dist/chunks/use-create-flow-overlay-state-CiKVJGWF.js +0 -16
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("./switch-AmoR1YIA.js"),s=require("./index-eM6MU4q_.js"),b=require("react");require("./index-Cxb9UUro.js");require("react-dom");const $=require("./dashboard-filter-controls-button-2I1ltWQ9.js"),ot=require("./index-D7KJindZ.js"),xs=require("./dashboard-summary-settings-dialog-BBALEHJQ.js"),it=require("./use-debounced-dirty-check-XHSwAefL.js"),Fe=require("./normalize-dashboard-for-dirty-check-BXRUMVb2.js"),gs=require("./use-create-flow-overlay-state-CiKVJGWF.js"),bs=require("./save-CaybXtdd.js"),lt=require("./palette-326-dgn0.js"),ct=require("./braces-CpOcaBNm.js");function dt(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:()=>t[r]})}}return n.default=t,Object.freeze(n)}const I=dt(b);/**
|
|
2
|
-
* @license lucide-react v0.453.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const ut=o.createLucideIcon("Glasses",[["circle",{cx:"6",cy:"15",r:"4",key:"vux9w4"}],["circle",{cx:"18",cy:"15",r:"4",key:"18o8ve"}],["path",{d:"M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2",key:"1ag4bs"}],["path",{d:"M2.5 13 5 7c.7-1.3 1.4-2 3-2",key:"1hm1gs"}],["path",{d:"M21.5 13 19 7c-.7-1.3-1.5-2-3-2",key:"1r31ai"}]]);/**
|
|
7
|
-
* @license lucide-react v0.453.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const mt=o.createLucideIcon("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
|
|
12
|
-
* @license lucide-react v0.453.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const ht=o.createLucideIcon("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
|
|
17
|
-
* @license lucide-react v0.453.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const pt=o.createLucideIcon("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
|
22
|
-
* @license lucide-react v0.453.0 - ISC
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the ISC license.
|
|
25
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const ft=o.createLucideIcon("ShieldX",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);/**
|
|
27
|
-
* @license lucide-react v0.453.0 - ISC
|
|
28
|
-
*
|
|
29
|
-
* This source code is licensed under the ISC license.
|
|
30
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const xt=o.createLucideIcon("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);var Re={exports:{}},_e={};/**
|
|
32
|
-
* @license React
|
|
33
|
-
* use-sync-external-store-shim.production.js
|
|
34
|
-
*
|
|
35
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
36
|
-
*
|
|
37
|
-
* This source code is licensed under the MIT license found in the
|
|
38
|
-
* LICENSE file in the root directory of this source tree.
|
|
39
|
-
*/var vs;function gt(){if(vs)return _e;vs=1;var t=b;function n(g,f){return g===f&&(g!==0||1/g===1/f)||g!==g&&f!==f}var r=typeof Object.is=="function"?Object.is:n,a=t.useState,i=t.useEffect,u=t.useLayoutEffect,d=t.useDebugValue;function m(g,f){var h=f(),l=a({inst:{value:h,getSnapshot:f}}),y=l[0].inst,C=l[1];return u(function(){y.value=h,y.getSnapshot=f,x(y)&&C({inst:y})},[g,h,f]),i(function(){return x(y)&&C({inst:y}),g(function(){x(y)&&C({inst:y})})},[g]),d(h),h}function x(g){var f=g.getSnapshot;g=g.value;try{var h=f();return!r(g,h)}catch{return!0}}function v(g,f){return f()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?v:m;return _e.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:p,_e}var Ue={};/**
|
|
40
|
-
* @license React
|
|
41
|
-
* use-sync-external-store-shim.development.js
|
|
42
|
-
*
|
|
43
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
44
|
-
*
|
|
45
|
-
* This source code is licensed under the MIT license found in the
|
|
46
|
-
* LICENSE file in the root directory of this source tree.
|
|
47
|
-
*/var ys;function bt(){return ys||(ys=1,process.env.NODE_ENV!=="production"&&function(){function t(h,l){return h===l&&(h!==0||1/h===1/l)||h!==h&&l!==l}function n(h,l){p||i.startTransition===void 0||(p=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var y=l();if(!g){var C=l();u(y,C)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),g=!0)}C=d({inst:{value:y,getSnapshot:l}});var D=C[0].inst,w=C[1];return x(function(){D.value=y,D.getSnapshot=l,r(D)&&w({inst:D})},[h,y,l]),m(function(){return r(D)&&w({inst:D}),h(function(){r(D)&&w({inst:D})})},[h]),v(y),y}function r(h){var l=h.getSnapshot;h=h.value;try{var y=l();return!u(h,y)}catch{return!0}}function a(h,l){return l()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var i=b,u=typeof Object.is=="function"?Object.is:t,d=i.useState,m=i.useEffect,x=i.useLayoutEffect,v=i.useDebugValue,p=!1,g=!1,f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?a:n;Ue.useSyncExternalStore=i.useSyncExternalStore!==void 0?i.useSyncExternalStore:f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Ue}process.env.NODE_ENV==="production"?Re.exports=gt():Re.exports=bt();var vt=Re.exports;const je=["light","dark","system"];function yt(){const{theme:t,setTheme:n}=s.useTheme(),r=o.useDashboardStore(d=>d.actions.setDashboardTheme);function a(){const d=je.includes(t)?t:"system",m=je[(je.indexOf(d)+1)%je.length];n(m),r(m)}const i=t==="light"?xt:t==="dark"?pt:ht,u=t==="light"?"Theme: light (click for dark)":t==="dark"?"Theme: dark (click for system)":"Theme: system (click for light)";return e.jsx(o.Button,{type:"button",variant:"ghost",size:"xs",className:"h-7 w-7 p-0 text-muted-foreground hover:text-foreground",onClick:a,"aria-label":u,title:u,children:e.jsx(i,{className:"h-3.5 w-3.5",strokeWidth:1.5})})}async function St(t,n,r,a,i){if(!i)return null;const u=JSON.stringify(r),d=`${t}/v1/lens`;return await o.postRequest(d,i,{name:n,template:u,filterValues:a,operation:"create"})}async function qe(t,n,r){if(!r)return null;const{id:a,template:i,filterValues:u,isDefault:d,shared:m}=n,x=`${t}/v1/lens`;return await o.postRequest(x,r,{lensId:a,template:i,filterValues:u,isDefault:d,shared:m,operation:"update"})}async function jt(t,n,r){if(!r)return null;const a=`${t}/v1/lens`;return await o.postRequest(a,r,{operation:"delete",lensId:n})}const Dt="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";function wt({open:t,onOpenChange:n}={}){const[r,a]=b.useState(""),[i,u]=b.useState(!1),d=o.useDashboardStore(M=>M.lenses),{setLenses:m,setSelectedLensId:x}=o.useDashboardActions(),[v,p]=b.useState(!1),[g,f]=b.useState(!1),h=t!==void 0,l=h?t:g,y=M=>{h||f(M),n==null||n(M)},C=o.useDashboardStore(M=>M.dashboard),D=o.useDashboardStore(M=>M.filterValues),{authToken:w,tokenProps:N}=s.useSemaphorContext();async function E(){p(!0);const M=await St(N.apiServiceUrl,r,C,D,w==null?void 0:w.accessToken);M&&(m([...d||[],M]),x(M.id),y(!1)),p(!1)}return e.jsxs(s.Dialog,{open:l,onOpenChange:y,children:[h?null:e.jsx(s.DialogTrigger,{asChild:!0,children:e.jsxs(o.Button,{variant:"secondary",size:"xs",children:[e.jsx(s.Plus,{className:"h-3.5 w-3.5"}),"Lens"]})}),e.jsxs(s.DialogContent,{className:"rounded-control border-border/60 sm:max-w-[420px] sm:rounded-control",children:[e.jsxs(s.DialogHeader,{children:[e.jsx(s.DialogTitle,{className:"text-[15px]",children:"Create lens"}),e.jsx(s.DialogDescription,{className:"text-[13px] leading-5",children:"Lenses are private by default and are only visible to you."})]}),e.jsxs("div",{className:"space-y-1.5 py-1",children:[e.jsx(o.Label,{htmlFor:"lens-name",className:Dt,children:"Name"}),e.jsx(o.Input,{id:"lens-name",size:"xs",value:r,placeholder:"Monthly review, West region, …",onChange:M=>a(M.target.value)}),i&&e.jsx("p",{className:"text-[12px] text-destructive",children:"A lens with this name already exists. Pick a different one."})]}),e.jsxs(s.DialogFooter,{children:[e.jsx(o.Button,{variant:"outline",size:"xs",onClick:()=>y(!1),children:"Cancel"}),e.jsx(o.Button,{size:"xs",type:"submit",onClick:E,disabled:v||!r.trim(),children:v?"Creating…":"Create"})]})]})]})}function Ct({includeLabel:t=!1}={}){const n=o.useDashboardStore(p=>p.lenses),r=o.useDashboardStore(p=>p.selectedLensId),{setLenses:a,setSelectedLensId:i}=o.useDashboardActions(),{authToken:u,tokenProps:d}=s.useSemaphorContext();async function m(p){i(p)}async function x(p){if(await jt(d.apiServiceUrl,p,u==null?void 0:u.accessToken)){const f=n==null?void 0:n.filter(h=>h.id!==p);a(f||[]),i("original")}}async function v(p){const g=n==null?void 0:n.map(l=>l.id===p.id?{...l,isDefault:!p.isDefault}:{...l,isDefault:!1});a(g||[]);const f={...p,isDefault:!p.isDefault};await qe(d.apiServiceUrl,f,u==null?void 0:u.accessToken);const h=n==null?void 0:n.find(l=>l.isDefault);if(h&&h.id!==p.id){const l={...h,isDefault:!1};await qe(d.apiServiceUrl,l,u==null?void 0:u.accessToken)}}return e.jsxs(e.Fragment,{children:[t?e.jsxs(e.Fragment,{children:[e.jsx(s.DropdownMenuLabel,{className:"px-3",children:"Lenses"}),e.jsx(s.DropdownMenuSeparator,{})]}):null,e.jsxs(s.DropdownMenuRadioGroup,{value:r,onValueChange:m,children:[e.jsx(s.DropdownMenuRadioItem,{value:"original",children:"Original"}),n==null?void 0:n.map(p=>e.jsxs(s.DropdownMenuRadioItem,{className:"group flex justify-between gap-2",value:p.id,children:[e.jsx("p",{children:p.name}),e.jsxs("span",{className:"flex items-center gap-3",children:[e.jsx(s.House,{onClick:g=>{g.preventDefault(),v(p)},className:o.cn("size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",{invisible:!p.isDefault,"text-green-500":p.isDefault}),strokeWidth:1.5}),e.jsx(s.Cross2Icon,{onClick:g=>{g.preventDefault(),x(p.id)},className:"invisible size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",strokeWidth:1.5})]})]},p.id))]})]})}function Nt(){const{displayPreferences:t,shouldShowElement:n}=s.useDisplayPreferences(),{currentUser:r,userContext:a}=s.useCurrentUserInfo(),i=b.useMemo(()=>s.getRoleBasedDisplayOverrides(r),[r]),u=b.useMemo(()=>m=>i&&i[m]!==void 0&&i[m]===!1?!1:n(m),[i,n,t]),d=b.useMemo(()=>{var m,x,v,p,g;return{canEdit:((m=a==null?void 0:a.permissions)==null?void 0:m.canEdit)??s.canUserEdit(r),canUseFilters:((x=a==null?void 0:a.permissions)==null?void 0:x.canEdit)??s.canUserUseFilters(r),canManageDashboards:((v=a==null?void 0:a.permissions)==null?void 0:v.canCreateDashboard)??s.canUserManageDashboards(r),canCreateDashboards:((p=a==null?void 0:a.permissions)==null?void 0:p.canCreateDashboard)??s.canUserCreateDashboards(r),canAccessVisuals:((g=a==null?void 0:a.permissions)==null?void 0:g.canEdit)??s.canUserAccessVisuals(r)}},[r,a]);return{displayPreferences:t,shouldShowElement:u,permissions:d,currentUser:r}}const Mt=async(t,n,r)=>{const a=`${t}/management/v1/groups`;return await o.postRequestRegular(a,n,r)},It=async(t,n,r)=>{const a=`${t}/management/v1/groups/${r}`;await o.requestJsonRegular(a,n,"DELETE")},Et=async(t,n,r,a)=>{const i=`${t}/management/v1/groups/${r}/members`;return await o.postRequestRegular(i,n,a)},Lt=async(t,n,r,a)=>{const i=`${t}/management/v1/groups/${r}/members`;await o.requestJsonRegular(i,n,"DELETE",a)};function At(){const{authToken:t,tokenProps:n}=s.useSemaphorContext(),r=s.useQueryClient();return s.useMutation({mutationFn:a=>Mt(n.apiServiceUrl,(t==null?void 0:t.accessToken)||"",a),onSuccess:()=>{r.invalidateQueries({queryKey:["groups"]}),s.ue.success("Group created successfully")},onError:a=>{console.error("Failed to create group:",a),s.ue.error("Failed to create group",{description:o.getRequestErrorMessage(a,"Failed to create group")})}})}function Ot(){const{authToken:t,tokenProps:n}=s.useSemaphorContext(),r=s.useQueryClient();return s.useMutation({mutationFn:a=>It(n.apiServiceUrl,(t==null?void 0:t.accessToken)||"",a),onSuccess:(a,i)=>{r.invalidateQueries({queryKey:["groups"]}),r.removeQueries({queryKey:["group",i]}),s.ue.success("Group deleted successfully")},onError:a=>{console.error("Failed to delete group:",a),s.ue.error("Failed to delete group",{description:o.getRequestErrorMessage(a,"Failed to delete group")})}})}function kt(){const{authToken:t,tokenProps:n}=s.useSemaphorContext(),r=s.useQueryClient();return s.useMutation({mutationFn:({groupId:a,data:i})=>Et(n.apiServiceUrl,(t==null?void 0:t.accessToken)||"",a,i),onSuccess:(a,i)=>{r.invalidateQueries({queryKey:["group",i.groupId]}),r.invalidateQueries({queryKey:["group-members",i.groupId]}),r.invalidateQueries({queryKey:["groups"]}),s.ue.success("Members added successfully")},onError:a=>{console.error("Failed to add group members:",a),s.ue.error("Failed to add members",{description:o.getRequestErrorMessage(a,"Failed to add members")})}})}function Tt(){const{authToken:t,tokenProps:n}=s.useSemaphorContext(),r=s.useQueryClient();return s.useMutation({mutationFn:({groupId:a,data:i})=>Lt(n.apiServiceUrl,(t==null?void 0:t.accessToken)||"",a,i),onSuccess:(a,i)=>{r.invalidateQueries({queryKey:["group",i.groupId]}),r.invalidateQueries({queryKey:["group-members",i.groupId]}),r.invalidateQueries({queryKey:["groups"]}),s.ue.success("Members removed successfully")},onError:a=>{console.error("Failed to remove group members:",a),s.ue.error("Failed to remove members",{description:o.getRequestErrorMessage(a,"Failed to remove members")})}})}const Ss="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";function Pt({onSuccess:t,tenantId:n,isTenantUser:r}){const[a,i]=b.useState(""),[u,d]=b.useState(""),[m,x]=b.useState({}),v=At(),p=()=>{const f={};return a.trim()?a.length<3?f.name="Group name must be at least 3 characters":a.length>50&&(f.name="Group name must be less than 50 characters"):f.name="Group name is required",u&&u.length>200&&(f.description="Description must be less than 200 characters"),x(f),Object.keys(f).length===0},g=async f=>{if(f.preventDefault(),!p())return;const h={name:a.trim(),description:u.trim()||void 0,type:r?"TENANT_GROUP":"ORG_GROUP",...r&&n?{tenantId:n}:{}};try{await v.mutateAsync(h),i(""),d(""),x({}),t()}catch(l){console.error("Failed to create group:",l)}};return e.jsxs("form",{onSubmit:g,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(o.Label,{htmlFor:"group-name",className:Ss,children:["Group name ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(o.Input,{id:"group-name",size:"xs",placeholder:"e.g., Marketing Team, Engineering Squad",value:a,onChange:f=>{i(f.target.value),m.name&&x(h=>({...h,name:""}))},className:m.name?"border-destructive":"",disabled:v.isPending}),m.name&&e.jsx("p",{className:"text-[12px] text-destructive",children:m.name})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(o.Label,{htmlFor:"group-description",className:Ss,children:"Description (optional)"}),e.jsx(s.Textarea,{id:"group-description",placeholder:"Describe the purpose of this group…",value:u,onChange:f=>{d(f.target.value),m.description&&x(h=>({...h,description:""}))},className:`text-[13px] ${m.description?"border-destructive":""}`,disabled:v.isPending,rows:3}),m.description?e.jsx("p",{className:"text-[12px] text-destructive",children:m.description}):e.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[u.length,"/200"]})]}),e.jsxs("div",{className:"flex gap-2 text-[12px] text-muted-foreground",children:[e.jsx(o.Info,{className:"h-3.5 w-3.5 shrink-0 mt-0.5"}),e.jsx("p",{children:"This group will be accessible to users in your workspace. You can add members after creating it."})]}),e.jsxs("div",{className:"flex justify-end gap-1.5 pt-1",children:[e.jsx(o.Button,{type:"button",variant:"outline",size:"xs",onClick:()=>{i(""),d(""),x({})},disabled:v.isPending,children:"Clear"}),e.jsx(o.Button,{type:"submit",size:"xs",disabled:v.isPending||!a.trim(),children:v.isPending?e.jsxs(e.Fragment,{children:[e.jsx(o.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Creating…"]}):"Create group"})]})]})}function Ft(t,n=[]){let r=[];function a(u,d){const m=I.createContext(d);m.displayName=u+"Context";const x=r.length;r=[...r,d];const v=g=>{var D;const{scope:f,children:h,...l}=g,y=((D=f==null?void 0:f[t])==null?void 0:D[x])||m,C=I.useMemo(()=>l,Object.values(l));return e.jsx(y.Provider,{value:C,children:h})};v.displayName=u+"Provider";function p(g,f){var y;const h=((y=f==null?void 0:f[t])==null?void 0:y[x])||m,l=I.useContext(h);if(l)return l;if(d!==void 0)return d;throw new Error(`\`${g}\` must be used within \`${u}\``)}return[v,p]}const i=()=>{const u=r.map(d=>I.createContext(d));return function(m){const x=(m==null?void 0:m[t])||u;return I.useMemo(()=>({[`__scope${t}`]:{...m,[t]:x}}),[m,x])}};return i.scopeName=t,[a,_t(i,...n)]}function _t(...t){const n=t[0];if(t.length===1)return n;const r=()=>{const a=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(u){const d=a.reduce((m,{useScope:x,scopeName:v})=>{const g=x(u)[`__scope${v}`];return{...m,...g}},{});return I.useMemo(()=>({[`__scope${n.scopeName}`]:d}),[d])}};return r.scopeName=n.scopeName,r}var Ut=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ge=Ut.reduce((t,n)=>{const r=o.createSlot(`Primitive.${n}`),a=I.forwardRef((i,u)=>{const{asChild:d,...m}=i,x=d?r:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(x,{...m,ref:u})});return a.displayName=`Primitive.${n}`,{...t,[n]:a}},{});function Rt(){return vt.useSyncExternalStore(qt,()=>!0,()=>!1)}function qt(){return()=>{}}var $e="Avatar",[Gt]=Ft($e),[$t,ws]=Gt($e),Cs=I.forwardRef((t,n)=>{const{__scopeAvatar:r,...a}=t,[i,u]=I.useState("idle");return e.jsx($t,{scope:r,imageLoadingStatus:i,onImageLoadingStatusChange:u,children:e.jsx(Ge.span,{...a,ref:n})})});Cs.displayName=$e;var Ns="AvatarImage",Ms=I.forwardRef((t,n)=>{const{__scopeAvatar:r,src:a,onLoadingStatusChange:i=()=>{},...u}=t,d=ws(Ns,r),m=Bt(a,u),x=o.useCallbackRef(v=>{i(v),d.onImageLoadingStatusChange(v)});return o.useLayoutEffect2(()=>{m!=="idle"&&x(m)},[m,x]),m==="loaded"?e.jsx(Ge.img,{...u,ref:n,src:a}):null});Ms.displayName=Ns;var Is="AvatarFallback",Es=I.forwardRef((t,n)=>{const{__scopeAvatar:r,delayMs:a,...i}=t,u=ws(Is,r),[d,m]=I.useState(a===void 0);return I.useEffect(()=>{if(a!==void 0){const x=window.setTimeout(()=>m(!0),a);return()=>window.clearTimeout(x)}},[a]),d&&u.imageLoadingStatus!=="loaded"?e.jsx(Ge.span,{...i,ref:n}):null});Es.displayName=Is;function js(t,n){return t?n?(t.src!==n&&(t.src=n),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function Bt(t,{referrerPolicy:n,crossOrigin:r}){const a=Rt(),i=I.useRef(null),u=a?(i.current||(i.current=new window.Image),i.current):null,[d,m]=I.useState(()=>js(u,t));return o.useLayoutEffect2(()=>{m(js(u,t))},[u,t]),o.useLayoutEffect2(()=>{const x=g=>()=>{m(g)};if(!u)return;const v=x("loaded"),p=x("error");return u.addEventListener("load",v),u.addEventListener("error",p),n&&(u.referrerPolicy=n),typeof r=="string"&&(u.crossOrigin=r),()=>{u.removeEventListener("load",v),u.removeEventListener("error",p)}},[u,r,n]),d}var Ls=Cs,As=Ms,Os=Es;const Be=I.forwardRef(({className:t,...n},r)=>e.jsx(Ls,{ref:r,className:o.cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...n}));Be.displayName=Ls.displayName;const zt=I.forwardRef(({className:t,...n},r)=>e.jsx(As,{ref:r,className:o.cn("aspect-square h-full w-full",t),...n}));zt.displayName=As.displayName;const ze=I.forwardRef(({className:t,...n},r)=>e.jsx(Os,{ref:r,className:o.cn("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...n}));ze.displayName=Os.displayName;function Vt({open:t,onOpenChange:n,group:r,onUpdate:a}){const[i,u]=b.useState("members"),[d,m]=b.useState(""),[x,v]=b.useState([]),[p,g]=b.useState([]),{data:f,isLoading:h,refetch:l}=s.useGroupMembers(r.id),y=r.type==="TENANT_GROUP"?"tenant":"organization",{users:C,isLoading:D}=s.useUnifiedUsers({type:y,tenantId:r.tenantId||void 0,active:!0,limit:100}),w=kt(),N=Tt(),E=(f==null?void 0:f.members)||[],M=b.useMemo(()=>new Set(E.map(S=>S.userId)),[E]),P=b.useMemo(()=>C.filter(S=>!M.has(S.id)),[C,M]),_=b.useMemo(()=>{if(!d)return P;const S=d.toLowerCase();return P.filter(L=>{var F,G;return((F=L.name)==null?void 0:F.toLowerCase().includes(S))||((G=L.email)==null?void 0:G.toLowerCase().includes(S))})},[P,d]),j=b.useMemo(()=>{if(!d)return E;const S=d.toLowerCase();return E.filter(L=>{var F,G,te,K;return((G=(F=L.user)==null?void 0:F.name)==null?void 0:G.toLowerCase().includes(S))||((K=(te=L.user)==null?void 0:te.email)==null?void 0:K.toLowerCase().includes(S))})},[E,d]),R=async()=>{if(x.length!==0)try{await w.mutateAsync({groupId:r.id,data:{userIds:x,userType:y==="tenant"?"tenant":"org"}}),v([]),u("members"),l(),a==null||a()}catch(S){console.error("Failed to add members:",S)}},z=async()=>{if(p.length!==0)try{await N.mutateAsync({groupId:r.id,data:{userIds:p}}),g([]),l(),a==null||a()}catch(S){console.error("Failed to remove members:",S)}},q=S=>{v(L=>L.includes(S)?L.filter(F=>F!==S):[...L,S])},H=S=>{g(L=>L.includes(S)?L.filter(F=>F!==S):[...L,S])};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:r.name}),e.jsx("div",{className:"flex items-center gap-2 mt-1",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:[E.length," ",E.length===1?"member":"members"]})}),e.jsxs("p",{id:"group-members-description",className:"sr-only",children:["Add or remove members from the ",r.name," group"]})]}),e.jsxs(o.Tabs,{value:i,onValueChange:S=>{u(S),m(""),g([])},className:"mt-4",children:[e.jsxs(o.TabsList,{className:"grid w-full grid-cols-2",children:[e.jsx(o.TabsTrigger,{value:"members",children:"Current Members"}),e.jsx(o.TabsTrigger,{value:"add",children:"Add Members"})]}),e.jsxs(o.TabsContent,{value:"members",className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(s.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(o.Input,{placeholder:"Search members...",value:d,onChange:S=>m(S.target.value),className:"pl-10"})]}),e.jsx(o.ScrollArea,{className:p.length>0?"h-[300px]":"h-[350px]",children:h?e.jsx("div",{className:"space-y-2",children:[1,2,3].map(S=>e.jsx(s.Skeleton,{className:"h-16 w-full"},S))}):j.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(s.Users,{className:"h-12 w-12 mb-3 opacity-50"}),e.jsx("p",{className:"text-sm font-medium",children:d?"No members found":"No members yet"}),e.jsx("p",{className:"text-xs mt-1",children:d?"Try a different search":'Switch to the "Add Members" tab to add people to this group'})]}):e.jsx("div",{className:"space-y-2",children:j.map(S=>e.jsx(Ht,{member:S,selected:p.includes(S.userId),onToggle:()=>H(S.userId)},S.id))})}),p.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:[p.length," member",p.length!==1?"s":""," selected"]}),e.jsx(o.Button,{variant:"destructive",size:"sm",onClick:z,disabled:N.isPending,children:N.isPending?e.jsxs(e.Fragment,{children:[e.jsx(o.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Removing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(s.Trash2,{className:"mr-2 h-4 w-4"}),"Remove Selected"]})})]})]}),e.jsxs(o.TabsContent,{value:"add",className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(s.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(o.Input,{placeholder:"Search users to add...",value:d,onChange:S=>m(S.target.value),className:"pl-10"})]}),e.jsx(o.ScrollArea,{className:"h-[300px]",children:D?e.jsx("div",{className:"space-y-2",children:[1,2,3].map(S=>e.jsx(s.Skeleton,{className:"h-16 w-full"},S))}):_.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(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:d?"Try a different search":"All eligible users are already members"})]}):e.jsx("div",{className:"space-y-2",children:_.map(S=>e.jsx(Kt,{user:S,selected:x.includes(S.id),onToggle:()=>q(S.id)},S.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(o.Button,{onClick:R,disabled:w.isPending,children:w.isPending?e.jsxs(e.Fragment,{children:[e.jsx(o.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Adding..."]}):e.jsxs(e.Fragment,{children:[e.jsx(s.UserPlus,{className:"mr-2 h-4 w-4"}),"Add Members"]})})]})]})]})]})})})}function Ht({member:t,selected:n,onToggle:r}){var i,u,d,m;const a=((u=(i=t.user)==null?void 0:i.name)==null?void 0:u.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:r,children:[e.jsx(s.Checkbox,{checked:n}),e.jsx(Be,{className:"h-8 w-8",children:e.jsx(ze,{className:"text-xs",children:a})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium",children:((d=t.user)==null?void 0:d.name)||"Unknown User"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:(m=t.user)==null?void 0:m.email})]})]})}function Kt({user:t,selected:n,onToggle:r}){var i;const a=((i=t.name)==null?void 0:i.split(" ").map(u=>u[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:r,children:[e.jsx(s.Checkbox,{checked:n}),e.jsx(Be,{className:"h-8 w-8",children:e.jsx(ze,{className:"text-xs",children:a})}),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 Qt({open:t,onOpenChange:n}){const[r,a]=b.useState("groups"),[i,u]=b.useState(""),[d,m]=b.useState(null),[x,v]=b.useState(!1),[p,g]=b.useState(null),{tokenProps:f}=s.useSemaphorContext(),{currentUser:h}=s.useCurrentUserInfo(),l=Ot(),y=(h==null?void 0:h.type)==="tenant",C=f==null?void 0:f.tenantId,{groups:D,isLoading:w,refetch:N}=s.useGroups({type:y?"TENANT_GROUP":"all",tenantId:y?C:void 0,includeMembers:!1}),E=D.filter(j=>{var R;return j.name.toLowerCase().includes(i.toLowerCase())||((R=j.description)==null?void 0:R.toLowerCase().includes(i.toLowerCase()))}),M=async()=>{if(p)try{await l.mutateAsync(p.id),g(null),N()}catch(j){console.error("Failed to delete group:",j)}},P=j=>{m(j),v(!0)},_=()=>{a("groups"),N()};return e.jsxs(e.Fragment,{children:[e.jsx(s.Dialog,{open:t,onOpenChange:n,children:e.jsxs(s.DialogContent,{className:"max-h-[80vh] max-w-3xl rounded-[6px] border-border/60 sm:rounded-[6px]",children:[e.jsxs(s.DialogHeader,{children:[e.jsx(s.DialogTitle,{className:"text-[15px]",children:"Group management"}),e.jsx(s.DialogDescription,{className:"text-[13px] leading-5",children:"Manage groups, create new ones, and control membership."})]}),e.jsxs(o.Tabs,{value:r,onValueChange:a,className:"mt-2",children:[e.jsxs(o.TabsList,{className:"h-8 w-full justify-start gap-1 bg-transparent p-0 border-b border-border/60 rounded-none",children:[e.jsx(o.TabsTrigger,{value:"groups",className:"h-8 rounded-none border-b-2 border-transparent bg-transparent px-3 text-[13px] data-[state=active]:border-foreground data-[state=active]:bg-transparent data-[state=active]:shadow-none",children:"Groups"}),e.jsx(o.TabsTrigger,{value:"create",className:"h-8 rounded-none border-b-2 border-transparent bg-transparent px-3 text-[13px] data-[state=active]:border-foreground data-[state=active]:bg-transparent data-[state=active]:shadow-none",children:"Create group"})]}),e.jsx(o.TabsContent,{value:"groups",className:"mt-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(s.Search,{className:"absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),e.jsx(o.Input,{size:"xs",placeholder:"Search groups…",value:i,onChange:j=>u(j.target.value),className:"pl-7"})]}),e.jsx(o.ScrollArea,{className:"h-[400px]",children:w?e.jsx("div",{className:"space-y-2",children:[1,2,3].map(j=>e.jsx(s.Skeleton,{className:"h-16 w-full rounded-[6px]"},j))}):E.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx("p",{className:"text-[13px]",children:"No groups found."}),e.jsx("p",{className:"mt-1 text-[12px]",children:i?"Try a different search.":"Create your first group to get started."})]}):e.jsx("div",{className:"space-y-2 pr-2",children:E.map(j=>e.jsx(Wt,{group:j,onManageMembers:()=>P(j),onDelete:()=>g(j),currentUserId:h==null?void 0:h.id},j.id))})})]})}),e.jsx(o.TabsContent,{value:"create",className:"mt-4",children:e.jsx(Pt,{onSuccess:_,tenantId:C,isTenantUser:y})})]})]})}),d&&e.jsx(Vt,{open:x,onOpenChange:v,group:d,onUpdate:()=>N()}),e.jsx(s.AlertDialog,{open:!!p,onOpenChange:()=>g(null),children:e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:"Delete group"}),e.jsxs(s.AlertDialogDescription,{children:['Delete "',p==null?void 0:p.name,`"? This removes all members and can't be undone.`]})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(s.AlertDialogCancel,{children:"Cancel"}),e.jsx(s.AlertDialogAction,{onClick:M,disabled:l.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:l.isPending?e.jsxs(e.Fragment,{children:[e.jsx(o.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Deleting…"]}):"Delete group"})]})]})})]})}function Wt({group:t,onManageMembers:n,onDelete:r,currentUserId:a}){const i=t.createdBy===a;return e.jsx("div",{className:"rounded-[6px] border border-border/60 bg-card px-3 py-2.5 transition-colors hover:bg-muted/30",children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsx("h4",{className:"text-[13px] font-medium text-foreground",children:t.name}),t.description&&e.jsx("p",{className:"text-[12px] text-muted-foreground",children:t.description}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-[11px] text-muted-foreground",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(s.Users,{className:"h-3 w-3"}),t.memberCount," ",t.memberCount===1?"member":"members"]}),e.jsxs("span",{children:["Created ",ot.format(new Date(t.createdAt),"MMM d, yyyy")]})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[e.jsx(o.Button,{variant:"ghost",size:"xs",className:"h-7 w-7 p-0 text-muted-foreground hover:text-foreground",onClick:n,title:"Manage members","aria-label":"Manage members",children:e.jsx(s.UserPlus,{className:"h-3.5 w-3.5"})}),i&&e.jsx(o.Button,{variant:"ghost",size:"xs",className:"h-7 w-7 p-0 text-muted-foreground hover:bg-destructive/10 hover:text-destructive",onClick:r,title:"Delete group","aria-label":"Delete group",children:e.jsx(s.Trash2,{className:"h-3.5 w-3.5"})})]})]})})}function ee(t,n,r){var u,d;const a=(t.controls||[]).find(m=>m.id===r);if(a)return a.label;const i=(d=(u=o.findCardById(t,n))==null?void 0:u.controls)==null?void 0:d.find(m=>m.id===r);return(i==null?void 0:i.label)||r}function se(t,n){var r;return((r=o.findCardById(t,n))==null?void 0:r.title)||n}function Jt(t){const{errors:n,dashboard:r}=t;if(!r)return n;const a=new Map;for(const i of n){const u=i.match(/^Card '(.+)' binding for control '(.+)' maps to missing metric '(.+)'\.$/);if(u){const[,p,g]=u,f=`${p}:${g}:missing-metric`;a.has(f)||a.set(f,`"${se(r,p)}" has an outdated "${ee(r,p,g)}" mapping. Some choices still point to metrics that are no longer available on this card. Open the card controls and choose replacements.`);continue}const d=i.match(/^Card '(.+)' binding for control '(.+)' maps to missing group-by field '(.+)'\.$/);if(d){const[,p,g]=d,f=`${p}:${g}:missing-group-by`;a.has(f)||a.set(f,`"${se(r,p)}" has an outdated "${ee(r,p,g)}" mapping. Some choices still point to fields that are no longer available on this card. Open the card controls and choose replacements.`);continue}const m=i.match(/^Card '(.+)' binding for control '(.+)' maps to an invalid metric target\.$/);if(m){const[,p,g]=m,f=`${p}:${g}:invalid-metric`;a.has(f)||a.set(f,`"${se(r,p)}" has an invalid "${ee(r,p,g)}" metric mapping. Open the card controls and choose a valid metric for each option.`);continue}const x=i.match(/^Card '(.+)' binding for control '(.+)' maps to an invalid group-by target\.$/);if(x){const[,p,g]=x,f=`${p}:${g}:invalid-group-by`;a.has(f)||a.set(f,`"${se(r,p)}" has an invalid "${ee(r,p,g)}" field mapping. Open the card controls and choose a valid field for each option.`);continue}const v=i.match(/^Card '(.+)' binding for control '(.+)' requires at least one temporal group-by field\.$/);if(v){const[,p,g]=v,f=`${p}:${g}:missing-temporal-group-by`;a.has(f)||a.set(f,`"${se(r,p)}" can no longer use "${ee(r,p,g)}" for time grain because the card does not currently group by a date field.`);continue}a.set(i,i)}return Array.from(a.values())}const Yt=["enum","multi_enum","text","number","boolean","date"];function Xt({open:t,onOpenChange:n,initialMode:r="manage"}){var _;const a=r==="create",{forceClose:i,handleOpenChange:u,isCreateFlowActive:d,preventPassiveDismissDuringCreate:m,resolvedOpen:x,setIsCreateFlowActive:v}=gs.useCreateFlowOverlayState({open:t,onOpenChange:n,initialCreateFlowActive:r==="create",dismissMode:"explicit-only"}),p=o.useDashboardStore(j=>j.dashboard),g=o.useDashboardStore(j=>j.selectedSheetId),{updateSheetDocument:f}=o.useDashboardActions(),h=(_=p.sheets)==null?void 0:_.find(j=>j.id===g),l=(h==null?void 0:h.kind)==="document"&&!!h.document,y=b.useMemo(()=>l&&(h!=null&&h.document)?h.document.inputs||[]:[],[l,h==null?void 0:h.document]),C=b.useMemo(()=>y.filter(j=>j.kind==="control"),[y]),D=b.useMemo(()=>C.map(j=>j.control),[C]),w=b.useMemo(()=>ea(D),[D]),N=b.useMemo(()=>Zt(p),[p]),E=b.useCallback(()=>{if(a){i();return}v(!1)},[a,i,v]),M=b.useCallback((j,R,z)=>{!l||!(h!=null&&h.document)||f(h.id,q=>({...q,inputs:ta({currentInputs:q.inputs||[],nextControls:j,nextDefaultValues:R,change:z})}))},[l,h,f]);if(!l||!(h!=null&&h.document))return null;const P=d?"Add document control":"Document Controls";return e.jsx(s.Dialog,{open:x,onOpenChange:u,children:e.jsxs(s.DialogContent,{className:"flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",onEscapeKeyDown:m,onPointerDownOutside:m,children:[e.jsxs(s.DialogHeader,{className:d?"space-y-0":void 0,children:[e.jsx(s.DialogTitle,{className:"text-[15px]",children:P}),e.jsx(s.DialogDescription,{className:d?"sr-only":"text-[13px]",children:d?"Configure and add a document-local control input.":"Add document-local control inputs. They are stored on this document sheet and are not dashboard controls."})]}),e.jsx("div",{className:"min-h-0 overflow-y-auto pr-1",children:e.jsx(gs.ControlDefinitionListEditor,{scope:"dashboard",controls:D,reservedControlIds:N,defaultValues:w,usageByControlId:{},availableFieldChoices:[],availableMetricChoices:[],structuralParticipants:[],structuralParticipantIdsByControlId:{},allowedControlTypes:Yt,initialCreateFlow:r==="create",onCreateFlowActiveChange:v,onCreateFlowComplete:E,onChange:M,emptyMessage:"No document controls yet."})})]})})}function Zt(t){return(t.controls||[]).map(n=>n.id)}function ea(t){const n={};for(const r of t)r.defaultValue!==void 0&&(n[r.id]=r.defaultValue);return n}function sa(t,n){return n?Object.prototype.hasOwnProperty.call(n,t.id)?{...t,defaultValue:n[t.id]}:t.defaultValue===void 0?t:{...t,defaultValue:void 0}:t.defaultValue===void 0?t:{...t,defaultValue:void 0}}function ta({currentInputs:t,nextControls:n,nextDefaultValues:r,change:a}){const i=new Map(n.map(x=>[x.id,sa(x,r)])),u=(a==null?void 0:a.type)==="rename"?{oldId:a.oldId,newId:a.newId}:null,d=new Set,m=[];for(const x of t){if(x.kind!=="control"){m.push(x);continue}const v=i.get(x.control.id)||((u==null?void 0:u.oldId)===x.control.id?i.get(u.newId):void 0);v&&(d.add(v.id),m.push({...x,label:v.label,requiredAtExecution:v.requiredAtExecution,control:v}))}for(const x of i.values())d.has(x.id)||m.push(s.createDocumentControlInputFromControl({control:x,existingInputs:m}));return m}function Ds(t,n){return{dashboard:s.cloneDeep(t),semanticExecutionPayload:s.cloneDeep(n)}}function aa(){var cs,ds,us,ms,hs,ps;$.useExportRecovery(),$.useExportPolling();const{authToken:t,tokenProps:n,id:r}=s.useSemaphorContext(),{isLocalDev:a}=s.useDashboardPreferences(),{openBrandStudioPreview:i}=s.useBrandStudioPreview(),{permissions:u}=Nt(),d=s.useHasDashboardId(),{isLoading:m}=s.useDashboardQuery(),x=o.useDashboardStore(c=>c.theme),v=o.useDashboardStore(c=>c.isDownloadingPdf),p=o.useDashboardStore(c=>c.dashboardAssistantDraftScopeKey),g=o.useDashboardStore(c=>c.lenses),f=o.useDashboardStore(c=>c.selectedLensId),h=g==null?void 0:g.find(c=>c.id===f),l=o.useDashboardStore(c=>c.dashboard),y=o.useDashboardStore(c=>c.selectedSheetId),C=(cs=l==null?void 0:l.sheets)==null?void 0:cs.find(c=>c.id===y),D=o.isDocumentSheet(C),w=D?(ds=C==null?void 0:C.document)==null?void 0:ds.page:void 0,N=o.useDashboardStore(c=>c.isDashboardEditing),{setDashboardTitle:E}=o.useDashboardStore(c=>c.actions),[M,P]=b.useState(!1),[_,j]=b.useState(!1),[R,z]=b.useState(!1),[q,H]=b.useState(!1),[S,L]=b.useState(!1),[F,G]=b.useState(!1),[te,K]=b.useState(!1),[ks,Ve]=b.useState(!1),[De,ae]=b.useState(null),[Ts,ne]=b.useState(!1),[re,oe]=b.useState(null),[He,ie]=b.useState([]),[Ke,le]=b.useState(!1),Ps=o.useDashboardStore(c=>c.isDashboardPanelOpen),Fs=o.useDashboardStore(c=>c.actions.setIsDashboardPanelOpen),_s=o.useDashboardStore(c=>c.filterValues),O=o.useDashboardStore(c=>c.isVisualEditing);o.useEditorStore(c=>c.card);const Q=s.useManagementStore(c=>c.selectedDashboard),ce=s.useManagementStore(c=>c.initialDashboard);s.useManagementStore(c=>c.selectedVisual),o.useDashboardStore(c=>c.selectedFrameId),o.useEditorStore(c=>c.frame);const de=Q?(ms=Q==null?void 0:Q.permissions)==null?void 0:ms.canEdit:(us=ce==null?void 0:ce.permissions)==null?void 0:us.canEdit,ue=o.useDashboardStore(c=>c.showFilters),Qe=s.useAssistantLayoutStore(c=>c.setPanelOpen),We=o.useDashboardStore(c=>c.showDashboardJSON),we=o.useDashboardStore(c=>c.onSaveFunction),Je=o.useDashboardStore(c=>c.actions.setShowFilters),{setDocumentInspectorTab:Ye,setIsDashboardEditing:Xe,setShowDashboardJSON:Ze}=o.useDashboardStore(c=>c.actions),{setInitialDashboard:es,clearSelectedDashboard:Ce}=s.useManagementStore(c=>c.actions),{resources:me}=s.useResourceManagement(s.ResourceType.DASHBOARD),{data:Ne}=s.useUserPreferences(),Us=((hs=Ne==null?void 0:Ne.preference)==null?void 0:hs.defaultDashboardId)||null,{mutate:Rs,isPending:qs}=s.useDefaultDashboardMutation(),{currentUser:Gs}=s.useCurrentUserInfo(),$s=s.canUserManageGroups(Gs),V=Q||ce,ss=V?{id:V.id,title:(l==null?void 0:l.title)||V.title||"Dashboard"}:null,{handleAddNewFrame:Bs}=s.useAddNewFrame(),[Me,Ie]=b.useState(!1),[zs,W]=b.useState(!1),[Ee,he]=b.useState("close"),J=s.useUpdateResource(s.ResourceType.DASHBOARD),[T,pe]=b.useState(null),ts=b.useCallback(c=>{window.setTimeout(()=>{ae(c)},0)},[]),Vs=async(c,A)=>{if(!(l!=null&&l.id)){console.log("No dashboard ID found");return}console.log("Updating dashboard title:",{dashboardId:l.id,newTitle:c,previousTitle:A}),J.mutate({resourceId:l.id,data:{title:c}},{onSuccess:()=>{console.log("Dashboard title updated successfully"),s.ue.success("Dashboard title updated")},onError:U=>{console.error("Failed to update dashboard title:",U),s.ue.error("Failed to update dashboard title"),E(A)}})};b.useEffect(()=>{if(me&&me.length>0){const c=l==null?void 0:l.id;if(c){const A=me.find(U=>U.id===c);A&&es(A)}}},[me,l==null?void 0:l.id,es]);const Y=n.orgUserId||n.tenantId,Le=b.useMemo(()=>na({accessToken:t==null?void 0:t.accessToken,dashboardId:(l==null?void 0:l.id)||r||n.dashboard_id,selectedSheetId:D?y:void 0,pageSize:w==null?void 0:w.size,orientation:w==null?void 0:w.orientation,theme:x}),[t==null?void 0:t.accessToken,r,l==null?void 0:l.id,D,w==null?void 0:w.orientation,w==null?void 0:w.size,y,x,n.dashboard_id]),as=N&&!O&&Y&&de,{setDashboard:Ae}=o.useDashboardStore(c=>c.actions),Oe=o.useDashboardStore(c=>c.semanticExecutionPayload),Hs=()=>{Xe(!0)},ke=()=>{Xe(!1),Ze(!1),pe(null),ae(null)};b.useEffect(()=>{if(!N){T&&pe(null);return}T||!l||m||pe(Ds(l,Oe))},[l,T,N,m,Oe]);const fe=(T==null?void 0:T.dashboard)??null,{isDirty:ns,isDirtyPending:Ks,resetDirty:xe}=it.useDebouncedDirtyCheck(l,fe,300,1e3,Fe.serializeDashboardForDirtyCheck),rs=b.useCallback(()=>fe?Fe.serializeDashboardForDirtyCheck(l)!==Fe.serializeDashboardForDirtyCheck(fe):!1,[l,fe]),os=ns||Ks,ge=Me||J.isPending,Qs=()=>{rs()?(he("close"),W(!0)):(ke(),xe())},Ws=async()=>{await Te({closeAfterSave:!0,navigateHomeAfterSave:Ee==="home"})},Js=()=>{T&&Ae(T.dashboard,{semanticExecutionPayload:T.semanticExecutionPayload}),ke(),Ee==="home"&&Ce(),he("close"),W(!1),xe()},Ys=()=>{T&&(Ae(T.dashboard,{semanticExecutionPayload:T.semanticExecutionPayload}),xe())},Xs=()=>{if(N&&rs()){he("home"),W(!0);return}Ce()};async function Te(c){const A=o.useDashboardStore.getState().dashboard;if(!A)return;const U=(c==null?void 0:c.closeAfterSave)??Ke,at=(c==null?void 0:c.navigateHomeAfterSave)??!1;le(U),U&&W(!1);const nt=s.cloneDeep(A);ne(!0),oe(null),ie([]),Ie(!0);const rt={template:A};J.mutate({resourceId:A.id,data:rt},{onSuccess:k=>{var ve,ye,fs;const B=(k==null?void 0:k.id)||((ve=k==null?void 0:k.dashboard)==null?void 0:ve.id)||((ye=k==null?void 0:k.resource)==null?void 0:ye.id)||((fs=k==null?void 0:k.template)==null?void 0:fs.id)||null;if(!A.id&&B){const Pe=o.useAIInteractionStore.getState(),Se=Pe.pendingDashboardDraftMigration;(Se==null?void 0:Se.scopeKey)===p?Pe.actions.setPendingDashboardDraftMigrationExpectedDashboardId(B):Se&&Pe.actions.clearPendingDashboardDraftMigration()}Ie(!1),s.ue.success("Dashboard saved!"),pe(Ds(nt,o.useDashboardStore.getState().semanticExecutionPayload)),ne(!1),le(!1),U&&(ke(),xe(),at&&Ce()),he("close")},onError:k=>{Ie(!1),oe("Failed to save dashboard. Please try again.");const B=k.details,ve=Array.isArray(B==null?void 0:B.errors)?(B.errors||[]).filter(ye=>typeof ye=="string"):[];ie(Jt({errors:ve,dashboard:A||void 0})),s.ue.error("Failed to save dashboard")}})}async function Zs(){if(P(!0),!f||!h)return;const c=o.useDashboardStore.getState().dashboard;if(!c){P(!1);return}const A=JSON.stringify(c),U={...h,template:A,filterValues:_s};await qe(n.apiServiceUrl,U,t==null?void 0:t.accessToken),s.ue.success("Lens saved"),we==null||we(c),P(!1)}const is=(h==null?void 0:h.name)||l.title,X=!!(l!=null&&l.id);J.isPending&&console.log("Title during update:",{title:is,dashboardStateTitle:l.title,dashboardId:l==null?void 0:l.id,currentLensName:h==null?void 0:h.name});const ls=n.orgUserId||n.tenantId&&n.endUserId&&n.endUserEmail,et=!!ls&&!!(t!=null&&t.accessToken)&&!!(n!=null&&n.apiServiceUrl);b.useEffect(()=>{!X&&q&&H(!1)},[X,q]);const st=d,Z=(l==null?void 0:l.id)||null,be=!!Z&&Us===Z,tt=()=>{Z&&Rs({dashboardId:be?null:Z})};return e.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between gap-2 overflow-x-auto border-b px-4 py-2",role:"dashboard-controls",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[ls&&e.jsxs(e.Fragment,{children:[e.jsx(s.IconButton,{"aria-label":"Manage Dashboards",tooltip:"Manage Dashboards",onClick:()=>{Fs(!Ps)},className:"h-7 w-7 px-0",buttonProps:{size:"xs"},children:e.jsx(mt,{className:"h-3.5 w-3.5"})}),st&&!O&&e.jsx(s.IconButton,{"aria-label":"Dashboard Hub",tooltip:"Dashboard Hub",onClick:Xs,className:"h-7 w-7 px-0",buttonProps:{size:"xs"},children:e.jsx(s.House,{className:"h-3.5 w-3.5"})})]}),!O&&d&&(m?e.jsx("div",{className:"h-4 w-28 animate-pulse rounded-md bg-muted/70","aria-label":"Loading dashboard title",role:"status",children:e.jsx("span",{className:"sr-only",children:"Loading dashboard title"})}):e.jsxs(e.Fragment,{children:[e.jsx(s.EditableText,{value:is||"Untitled Dashboard",onSave:c=>{console.log("EditableText onSave called:",{newTitle:c,canEditDashboard:de,dashboardId:l==null?void 0:l.id});const A=(l==null?void 0:l.title)||"";E(c),Vs(c,A)},isEditable:de&&!h,displayClassName:"text-[13px] font-medium",inputClassName:"text-[13px] font-medium",placeholder:"Dashboard Title",isPending:J.isPending}),et&&Z&&e.jsx(o.TooltipProvider,{children:e.jsxs(o.Tooltip,{children:[e.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsx(o.Button,{variant:"ghost",size:"xs",onClick:tt,disabled:qs||!(t!=null&&t.accessToken)||!(n!=null&&n.apiServiceUrl),className:"w-7 px-0","aria-label":be?"Remove as default dashboard":"Make this a default dashboard",children:e.jsx(s.Star,{className:o.cn("h-3.5 w-3.5 transition-colors",be?"fill-foreground text-foreground":"text-muted-foreground hover:text-foreground")})})}),e.jsx(o.TooltipContent,{children:e.jsx("p",{children:be?"Remove as default dashboard":"Make this a default dashboard"})})]})})]}))]}),e.jsxs("div",{className:"flex items-center gap-2",children:[O&&e.jsxs(e.Fragment,{children:[e.jsx($.AdvancedModeToggle,{}),e.jsx($.VisualEditingControls,{})]}),!O&&d&&((ps=V==null?void 0:V.permissions)==null?void 0:ps.canShare)&&e.jsxs(o.Button,{variant:"outline",size:"xs",onClick:()=>j(!0),children:[e.jsx(s.Share2,{className:"h-3.5 w-3.5"}),"Share"]}),!O&&N&&u.canUseFilters&&d&&e.jsx($.DashboardFilterControlsButton,{showFilters:D?!1:ue,onToggleFilters:()=>{if(D&&y){Ye(y,"inputs");return}ue||Qe("dashboard",!1),Je(!ue)},onAddFilter:()=>{if(D&&y){Ye(y,"inputs");return}ue||(Qe("dashboard",!1),Je(!0))},onAddControl:()=>{ts("create")},onManageControls:()=>ts("manage")}),N&&!O&&d&&De?D?e.jsx(Xt,{open:!0,onOpenChange:c=>{c||ae(null)},initialMode:De}):e.jsx($.DashboardControlsSettings,{open:!0,onOpenChange:c=>{c||ae(null)},showTrigger:!1,initialMode:De}):null,N&&!O&&Y&&h&&a&&d&&e.jsxs(o.Button,{variant:"secondary",size:"xs",disabled:M,onClick:Zs,children:[e.jsx(bs.Save,{className:"h-3.5 w-3.5"}),"Save Lens"]}),N&&!O&&d&&!D&&e.jsxs(o.Button,{variant:"outline",size:"xs",disabled:!N,onClick:()=>Bs(),children:[e.jsx(s.Plus,{className:"h-3.5 w-3.5"}),"Visual"]}),!O&&!N&&de&&d&&e.jsxs(o.Button,{size:"xs",onClick:Hs,children:[e.jsx(s.Pencil,{className:"h-3.5 w-3.5"}),"Edit"]}),as&&d&&ns&&e.jsxs(o.Button,{variant:"outline",size:"xs",onClick:Ys,disabled:ge,children:[e.jsx(s.Undo2,{className:"h-3.5 w-3.5"}),"Undo"]}),as&&d&&e.jsxs(o.Button,{size:"xs",className:o.cn(!os&&"opacity-60"),disabled:ge||!os,onClick:()=>Te(),children:[ge?e.jsx(o.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(bs.Save,{className:"h-3.5 w-3.5"}),ge?"Saving...":"Save"]}),N&&!O&&d&&e.jsxs(o.Button,{variant:"outline",size:"xs",onClick:Qs,children:[e.jsx(s.Cross2Icon,{className:"h-3.5 w-3.5"}),"Close"]}),!O&&d&&e.jsx("div",{className:"ml-2",children:e.jsx($.NotificationBell,{})}),!O&&a&&e.jsx(yt,{}),!O&&d&&e.jsxs(s.DropdownMenu,{children:[e.jsx(s.DropdownMenuTrigger,{asChild:!0,children:e.jsx(s.IconButton,{tooltip:"More Options",className:"w-7 px-0 text-muted-foreground hover:text-foreground",buttonProps:{size:"xs",variant:"ghost","aria-label":"More dashboard options"},children:e.jsx(s.EllipsisVertical,{className:"h-3.5 w-3.5"})})}),e.jsxs(s.DropdownMenuContent,{align:"end",className:"w-56 rounded-control border border-border/60 p-1 shadow-sm",children:[e.jsx(s.DropdownMenuLabel,{children:"Reports"}),e.jsxs(s.DropdownMenuItem,{disabled:v,onSelect:()=>Ve(!0),children:[e.jsx(s.Download,{className:"h-3.5 w-3.5"}),"Export"]}),e.jsxs(s.DropdownMenuItem,{disabled:!X,onSelect:()=>{X&&H(!0)},children:[e.jsx(s.Clock,{className:"h-3.5 w-3.5"}),"Schedule"]}),e.jsx(s.DropdownMenuSeparator,{}),$s&&e.jsxs(e.Fragment,{children:[e.jsx(s.DropdownMenuLabel,{children:"Access"}),e.jsxs(s.DropdownMenuItem,{onClick:()=>z(!0),children:[e.jsx(s.Users,{className:"h-3.5 w-3.5"}),"Manage Groups"]}),e.jsx(s.DropdownMenuSeparator,{})]}),e.jsx(s.DropdownMenuLabel,{children:"Preferences"}),e.jsxs(s.DropdownMenuItem,{onClick:()=>L(!0),children:[e.jsx(s.Calendar,{className:"h-3.5 w-3.5"}),"Calendar Preferences"]}),e.jsxs(s.DropdownMenuItem,{onClick:()=>G(!0),children:[e.jsx(s.FileText,{className:"h-3.5 w-3.5"}),"Summary Settings"]}),a&&d&&e.jsxs(e.Fragment,{children:[e.jsx(s.DropdownMenuSeparator,{}),e.jsx(s.DropdownMenuLabel,{children:"Developer"}),e.jsxs(s.DropdownMenuItem,{onSelect:()=>{var c;t!=null&&t.accessToken&&((c=navigator==null?void 0:navigator.clipboard)!=null&&c.writeText?navigator.clipboard.writeText(t.accessToken).then(()=>s.ue.success("Token copied to clipboard")).catch(()=>s.ue.error("Unable to copy token")):s.ue.error("Clipboard not available"))},children:[e.jsx(s.Copy,{className:"h-3.5 w-3.5"}),"Copy token"]}),D&&e.jsxs(s.DropdownMenuItem,{disabled:!Le,onSelect:()=>{var c;if(!Le){s.ue.error("Open a document sheet with a token to copy the local PDF URL");return}(c=navigator==null?void 0:navigator.clipboard)!=null&&c.writeText?navigator.clipboard.writeText(Le).then(()=>s.ue.success("Local document PDF URL copied to clipboard")).catch(()=>s.ue.error("Unable to copy local document PDF URL")):s.ue.error("Clipboard not available")},children:[e.jsx(s.Copy,{className:"h-3.5 w-3.5"}),"Copy local document PDF URL"]}),e.jsxs(s.DropdownMenuItem,{onSelect:()=>o.invalidateToken(n.apiServiceUrl),children:[e.jsx(ft,{className:"h-3.5 w-3.5"}),"Invalidate token"]}),e.jsxs(s.DropdownMenuItem,{onSelect:i,children:[e.jsx(lt.Palette,{className:"h-3.5 w-3.5"}),"Brand Studio"]}),N&&e.jsxs(s.DropdownMenuItem,{onSelect:()=>Ze(!We),children:[e.jsx(ct.Braces,{className:"h-3.5 w-3.5"}),We?"Hide dashboard JSON":"Show dashboard JSON"]}),Y&&N&&e.jsxs(s.DropdownMenuItem,{onSelect:()=>K(!0),children:[e.jsx(s.Plus,{className:"h-3.5 w-3.5"}),"Add lens"]}),Y&&e.jsxs(s.DropdownMenuSub,{children:[e.jsxs(s.DropdownMenuSubTrigger,{children:[e.jsx(ut,{className:"h-3.5 w-3.5"}),"Lenses"]}),e.jsx(s.DropdownMenuSubContent,{className:"w-60",children:e.jsx(Ct,{})})]})]})]})]}),_&&ss&&e.jsx(s.ShareDialog,{resource:ss,resourceType:s.ResourceType.DASHBOARD,onClose:()=>j(!1)}),e.jsx(Qt,{open:R,onOpenChange:z}),X&&(l==null?void 0:l.id)&&e.jsx(s.EmailScheduleDialog,{open:q,onOpenChange:H,dashboardId:l.id,dashboardName:l==null?void 0:l.title}),e.jsx(xs.CalendarPreferencesDialog,{open:S,onOpenChange:L}),e.jsx(xs.DashboardSummarySettingsDialog,{open:F,onOpenChange:G,dashboard:l,disabled:!N,onApply:c=>Ae({...l,summary:c},{semanticExecutionPayload:Oe})}),a&&Y&&d&&e.jsx(wt,{open:te,onOpenChange:K}),d&&e.jsx(s.DownloadPdf,{open:ks,onOpenChange:Ve}),e.jsx(s.AlertDialog,{open:Ts,onOpenChange:c=>{!c&&Me&&!re||(ne(c),c||(oe(null),ie([]),le(!1)))},children:e.jsxs(s.AlertDialogContent,{className:"max-w-sm",children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:re?"Save failed":"Saving dashboard"}),e.jsx(s.AlertDialogDescription,{className:"pt-2",children:re?"We could not save the dashboard. Please try again.":"Please wait while we save your changes."}),He.length>0&&e.jsxs("div",{className:"space-y-1 rounded-md border border-destructive/20 bg-destructive/5 p-3 text-left",children:[e.jsx("div",{className:"text-sm font-medium text-destructive",children:"What needs attention"}),e.jsx("ul",{className:"list-disc space-y-1 pl-4 text-xs text-muted-foreground",children:He.slice(0,5).map(c=>e.jsx("li",{children:c},c))})]})]}),e.jsx(s.AlertDialogFooter,{className:"flex-col gap-2 sm:flex-row sm:justify-end",children:re?e.jsxs(e.Fragment,{children:[e.jsx(s.AlertDialogCancel,{onClick:()=>{ne(!1),oe(null),ie([]),le(!1)},className:"m-0",children:"Close"}),e.jsx(s.AlertDialogAction,{onClick:()=>Te({closeAfterSave:Ke,navigateHomeAfterSave:Ee==="home"}),className:"m-0",children:"Retry"})]}):e.jsxs(s.AlertDialogAction,{disabled:!0,className:"m-0 cursor-default",children:[e.jsx(o.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]})})]})}),e.jsx($.UnsavedChangesAlert,{open:zs,onOpenChange:c=>{W(c)},onSave:Ws,onDiscard:Js,isSaving:Me,saveLabel:"Save",discardLabel:"Discard"})]})]})}function na({accessToken:t,dashboardId:n,selectedSheetId:r,pageSize:a,orientation:i,theme:u}){if(!t||!r)return null;const d=new URL("http://localhost:5173/print-document");d.searchParams.set("token",t),n&&d.searchParams.set("dashboardId",n),d.searchParams.set("selectedSheetId",r),u&&d.searchParams.set("theme",u);const m=new URL("http://127.0.0.1:3002/");return m.searchParams.set("pdfMode","document"),m.searchParams.set("pageSize",a||"letter"),m.searchParams.set("orientation",i||"portrait"),m.searchParams.set("url",d.toString()),m.toString()}exports.default=aa;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
"use strict";const dt=(e,n)=>{if(typeof e=="number"){if(n===3)return{mode:"rgb",r:(e>>8&15|e>>4&240)/255,g:(e>>4&15|e&240)/255,b:(e&15|e<<4&240)/255};if(n===4)return{mode:"rgb",r:(e>>12&15|e>>8&240)/255,g:(e>>8&15|e>>4&240)/255,b:(e>>4&15|e&240)/255,alpha:(e&15|e<<4&240)/255};if(n===6)return{mode:"rgb",r:(e>>16&255)/255,g:(e>>8&255)/255,b:(e&255)/255};if(n===8)return{mode:"rgb",r:(e>>24&255)/255,g:(e>>16&255)/255,b:(e>>8&255)/255,alpha:(e&255)/255}}},Jt={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Wt=e=>dt(Jt[e.toLowerCase()],6),Kt=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,Qt=e=>{let n;return(n=e.match(Kt))?dt(parseInt(n[1],16),n[1].length):void 0},E="([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)",fe=`${E}%`,xn=`(?:${E}%|${E})`,e0=`(?:${E}(deg|grad|rad|turn)|${E})`,V="\\s*,\\s*",n0=new RegExp(`^rgba?\\(\\s*${E}${V}${E}${V}${E}\\s*(?:,\\s*${xn}\\s*)?\\)$`),t0=new RegExp(`^rgba?\\(\\s*${fe}${V}${fe}${V}${fe}\\s*(?:,\\s*${xn}\\s*)?\\)$`),r0=e=>{let n={mode:"rgb"},t;if(t=e.match(n0))t[1]!==void 0&&(n.r=t[1]/255),t[2]!==void 0&&(n.g=t[2]/255),t[3]!==void 0&&(n.b=t[3]/255);else if(t=e.match(t0))t[1]!==void 0&&(n.r=t[1]/100),t[2]!==void 0&&(n.g=t[2]/100),t[3]!==void 0&&(n.b=t[3]/100);else return;return t[4]!==void 0?n.alpha=Math.max(0,Math.min(1,t[4]/100)):t[5]!==void 0&&(n.alpha=Math.max(0,Math.min(1,+t[5]))),n},a0=(e,n)=>e===void 0?void 0:typeof e!="object"?Mn(e):e.mode!==void 0?e:n?{...e,mode:n}:void 0,lt=(e="rgb")=>n=>(n=a0(n,e))!==void 0?n.mode===e?n:N[n.mode][e]?N[n.mode][e](n):e==="rgb"?N[n.mode].rgb(n):N.rgb[e](N[n.mode].rgb(n)):void 0,N={},st={},be=[],ut={},i0=e=>e,b=e=>(N[e.mode]={...N[e.mode],...e.toMode},Object.keys(e.fromMode||{}).forEach(n=>{N[n]||(N[n]={}),N[n][e.mode]=e.fromMode[n]}),e.ranges||(e.ranges={}),e.difference||(e.difference={}),e.channels.forEach(n=>{if(e.ranges[n]===void 0&&(e.ranges[n]=[0,1]),!e.interpolate[n])throw new Error(`Missing interpolator for: ${n}`);typeof e.interpolate[n]=="function"&&(e.interpolate[n]={use:e.interpolate[n]}),e.interpolate[n].fixup||(e.interpolate[n].fixup=i0)}),st[e.mode]=e,(e.parse||[]).forEach(n=>{f0(n,e.mode)}),lt(e.mode)),o0=e=>st[e],f0=(e,n)=>{if(typeof e=="string"){if(!n)throw new Error("'mode' required when 'parser' is a string");ut[e]=n}else typeof e=="function"&&be.indexOf(e)<0&&be.push(e)},ln=/[^\x00-\x7F]|[a-zA-Z_]/,d0=/[^\x00-\x7F]|[-\w]/,d={Function:"function",Ident:"ident",Number:"number",Percentage:"percentage",ParenClose:")",None:"none",Hue:"hue",Alpha:"alpha"};let c=0;function ce(e){let n=e[c],t=e[c+1];return n==="-"||n==="+"?/\d/.test(t)||t==="."&&/\d/.test(e[c+2]):n==="."?/\d/.test(t):/\d/.test(n)}function sn(e){if(c>=e.length)return!1;let n=e[c];if(ln.test(n))return!0;if(n==="-"){if(e.length-c<2)return!1;let t=e[c+1];return!!(t==="-"||ln.test(t))}return!1}const l0={deg:1,rad:180/Math.PI,grad:9/10,turn:360};function ie(e){let n="";if((e[c]==="-"||e[c]==="+")&&(n+=e[c++]),n+=he(e),e[c]==="."&&/\d/.test(e[c+1])&&(n+=e[c++]+he(e)),(e[c]==="e"||e[c]==="E")&&((e[c+1]==="-"||e[c+1]==="+")&&/\d/.test(e[c+2])?n+=e[c++]+e[c++]+he(e):/\d/.test(e[c+1])&&(n+=e[c++]+he(e))),sn(e)){let t=ge(e);return t==="deg"||t==="rad"||t==="turn"||t==="grad"?{type:d.Hue,value:n*l0[t]}:void 0}return e[c]==="%"?(c++,{type:d.Percentage,value:+n}):{type:d.Number,value:+n}}function he(e){let n="";for(;/\d/.test(e[c]);)n+=e[c++];return n}function ge(e){let n="";for(;c<e.length&&d0.test(e[c]);)n+=e[c++];return n}function s0(e){let n=ge(e);return e[c]==="("?(c++,{type:d.Function,value:n}):n==="none"?{type:d.None,value:void 0}:{type:d.Ident,value:n}}function u0(e=""){let n=e.trim(),t=[],a;for(c=0;c<n.length;){if(a=n[c++],a===`
|
|
2
|
-
`||a===" "||a===" "){for(;c<n.length&&(n[c]===`
|
|
3
|
-
`||n[c]===" "||n[c]===" ");)c++;continue}if(a===",")return;if(a===")"){t.push({type:d.ParenClose});continue}if(a==="+"){if(c--,ce(n)){t.push(ie(n));continue}return}if(a==="-"){if(c--,ce(n)){t.push(ie(n));continue}if(sn(n)){t.push({type:d.Ident,value:ge(n)});continue}return}if(a==="."){if(c--,ce(n)){t.push(ie(n));continue}return}if(a==="/"){for(;c<n.length&&(n[c]===`
|
|
4
|
-
`||n[c]===" "||n[c]===" ");)c++;let r;if(ce(n)&&(r=ie(n),r.type!==d.Hue)){t.push({type:d.Alpha,value:r});continue}if(sn(n)&&ge(n)==="none"){t.push({type:d.Alpha,value:{type:d.None,value:void 0}});continue}return}if(/\d/.test(a)){c--,t.push(ie(n));continue}if(ln.test(a)){c--,t.push(s0(n));continue}return}return t}function c0(e){e._i=0;let n=e[e._i++];if(!n||n.type!==d.Function||n.value!=="color"||(n=e[e._i++],n.type!==d.Ident))return;const t=ut[n.value];if(!t)return;const a={mode:t},r=ct(e,!1);if(!r)return;const i=o0(t).channels;for(let o=0,f,s;o<i.length;o++)f=r[o],s=i[o],f.type!==d.None&&(a[s]=f.type===d.Number?f.value:f.value/100,s==="alpha"&&(a[s]=Math.max(0,Math.min(1,a[s]))));return a}function ct(e,n){const t=[];let a;for(;e._i<e.length;){if(a=e[e._i++],a.type===d.None||a.type===d.Number||a.type===d.Alpha||a.type===d.Percentage||n&&a.type===d.Hue){t.push(a);continue}if(a.type===d.ParenClose){if(e._i<e.length)return;continue}return}if(!(t.length<3||t.length>4)){if(t.length===4){if(t[3].type!==d.Alpha)return;t[3]=t[3].value}return t.length===3&&t.push({type:d.None,value:void 0}),t.every(r=>r.type!==d.Alpha)?t:void 0}}function h0(e,n){e._i=0;let t=e[e._i++];if(!t||t.type!==d.Function)return;let a=ct(e,n);if(a)return a.unshift(t.value),a}const Mn=e=>{if(typeof e!="string")return;const n=u0(e),t=n?h0(n,!0):void 0;let a,r=0,i=be.length;for(;r<i;)if((a=be[r++](e,t))!==void 0)return a;return n?c0(n):void 0};function p0(e,n){if(!n||n[0]!=="rgb"&&n[0]!=="rgba")return;const t={mode:"rgb"},[,a,r,i,o]=n;if(!(a.type===d.Hue||r.type===d.Hue||i.type===d.Hue))return a.type!==d.None&&(t.r=a.type===d.Number?a.value/255:a.value/100),r.type!==d.None&&(t.g=r.type===d.Number?r.value/255:r.value/100),i.type!==d.None&&(t.b=i.type===d.Number?i.value/255:i.value/100),o.type!==d.None&&(t.alpha=Math.min(1,Math.max(0,o.type===d.Number?o.value:o.value/100))),t}const b0=e=>e==="transparent"?{mode:"rgb",r:0,g:0,b:0,alpha:0}:void 0,g0=(e,n,t)=>e+t*(n-e),m0=e=>{let n=[];for(let t=0;t<e.length-1;t++){let a=e[t],r=e[t+1];a===void 0&&r===void 0?n.push(void 0):a!==void 0&&r!==void 0?n.push([a,r]):n.push(a!==void 0?[a,a]:[r,r])}return n},x0=e=>n=>{let t=m0(n);return a=>{let r=a*t.length,i=a>=1?t.length-1:Math.max(Math.floor(r),0),o=t[i];return o===void 0?void 0:e(o[0],o[1],r-i)}},l=x0(g0),k=e=>{let n=!1,t=e.map(a=>a!==void 0?(n=!0,a):1);return n?t:e},G={mode:"rgb",channels:["r","g","b","alpha"],parse:[p0,Qt,r0,Wt,b0,"srgb"],serialize:"srgb",interpolate:{r:l,g:l,b:l,alpha:{use:l,fixup:k}},gamut:!0,white:{r:1,g:1,b:1},black:{r:0,g:0,b:0}},Xe=(e=0)=>Math.pow(Math.abs(e),563/256)*Math.sign(e),Hn=e=>{let n=Xe(e.r),t=Xe(e.g),a=Xe(e.b),r={mode:"xyz65",x:.5766690429101305*n+.1855582379065463*t+.1882286462349947*a,y:.297344975250536*n+.6273635662554661*t+.0752914584939979*a,z:.0270313613864123*n+.0706888525358272*t+.9913375368376386*a};return e.alpha!==void 0&&(r.alpha=e.alpha),r},Le=e=>Math.pow(Math.abs(e),256/563)*Math.sign(e),Xn=({x:e,y:n,z:t,alpha:a})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r={mode:"a98",r:Le(e*2.0415879038107465-n*.5650069742788597-.3447313507783297*t),g:Le(e*-.9692436362808798+n*1.8759675015077206+.0415550574071756*t),b:Le(e*.0134442806320312-n*.1183623922310184+1.0151749943912058*t)};return a!==void 0&&(r.alpha=a),r},je=(e=0)=>{const n=Math.abs(e);return n<=.04045?e/12.92:(Math.sign(e)||1)*Math.pow((n+.055)/1.055,2.4)},J=({r:e,g:n,b:t,alpha:a})=>{let r={mode:"lrgb",r:je(e),g:je(n),b:je(t)};return a!==void 0&&(r.alpha=a),r},D=e=>{let{r:n,g:t,b:a,alpha:r}=J(e),i={mode:"xyz65",x:.4123907992659593*n+.357584339383878*t+.1804807884018343*a,y:.2126390058715102*n+.715168678767756*t+.0721923153607337*a,z:.0193308187155918*n+.119194779794626*t+.9505321522496607*a};return r!==void 0&&(i.alpha=r),i},Oe=(e=0)=>{const n=Math.abs(e);return n>.0031308?(Math.sign(e)||1)*(1.055*Math.pow(n,1/2.4)-.055):e*12.92},W=({r:e,g:n,b:t,alpha:a},r="rgb")=>{let i={mode:r,r:Oe(e),g:Oe(n),b:Oe(t)};return a!==void 0&&(i.alpha=a),i},U=({x:e,y:n,z:t,alpha:a})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=W({r:e*3.2409699419045226-n*1.537383177570094-.4986107602930034*t,g:e*-.9692436362808796+n*1.8759675015077204+.0415550574071756*t,b:e*.0556300796969936-n*.2039769588889765+1.0569715142428784*t});return a!==void 0&&(r.alpha=a),r},M0={...G,mode:"a98",parse:["a98-rgb"],serialize:"a98-rgb",fromMode:{rgb:e=>Xn(D(e)),xyz65:Xn},toMode:{rgb:e=>U(Hn(e)),xyz65:Hn}},w=e=>(e=e%360)<0?e+360:e,y0=(e,n)=>e.map((t,a,r)=>{if(t===void 0)return t;let i=w(t);return a===0||e[a-1]===void 0?i:n(i-w(r[a-1]))}).reduce((t,a)=>!t.length||a===void 0||t[t.length-1]===void 0?(t.push(a),t):(t.push(a+t[t.length-1]),t),[]),C=e=>y0(e,n=>Math.abs(n)<=180?n:n-360*Math.sign(n)),$=[-.14861,1.78277,-.29227,-.90649,1.97294,0],v0=Math.PI/180,k0=180/Math.PI;let Ln=$[3]*$[4],jn=$[1]*$[4],On=$[1]*$[2]-$[0]*$[3];const _0=({r:e,g:n,b:t,alpha:a})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=(On*t+e*Ln-n*jn)/(On+Ln-jn),i=t-r,o=($[4]*(n-r)-$[2]*i)/$[3],f={mode:"cubehelix",l:r,s:r===0||r===1?void 0:Math.sqrt(i*i+o*o)/($[4]*r*(1-r))};return f.s&&(f.h=Math.atan2(o,i)*k0-120),a!==void 0&&(f.alpha=a),f},$0=({h:e,s:n,l:t,alpha:a})=>{let r={mode:"rgb"};e=(e===void 0?0:e+120)*v0,t===void 0&&(t=0);let i=n===void 0?0:n*t*(1-t),o=Math.cos(e),f=Math.sin(e);return r.r=t+i*($[0]*o+$[1]*f),r.g=t+i*($[2]*o+$[3]*f),r.b=t+i*($[4]*o+$[5]*f),a!==void 0&&(r.alpha=a),r},ve=(e,n)=>{if(e.h===void 0||n.h===void 0||!e.s||!n.s)return 0;let t=w(e.h),a=w(n.h),r=Math.sin((a-t+360)/2*Math.PI/180);return 2*Math.sqrt(e.s*n.s)*r},z0=(e,n)=>{if(e.h===void 0||n.h===void 0)return 0;let t=w(e.h),a=w(n.h);return Math.abs(a-t)>180?t-(a-360*Math.sign(a-t)):a-t},ke=(e,n)=>{if(e.h===void 0||n.h===void 0||!e.c||!n.c)return 0;let t=w(e.h),a=w(n.h),r=Math.sin((a-t+360)/2*Math.PI/180);return 2*Math.sqrt(e.c*n.c)*r},R=e=>{let n=e.reduce((a,r)=>{if(r!==void 0){let i=r*Math.PI/180;a.sin+=Math.sin(i),a.cos+=Math.cos(i)}return a},{sin:0,cos:0}),t=Math.atan2(n.sin,n.cos)*180/Math.PI;return t<0?360+t:t},w0={mode:"cubehelix",channels:["h","s","l","alpha"],parse:["--cubehelix"],serialize:"--cubehelix",ranges:{h:[0,360],s:[0,4.614],l:[0,1]},fromMode:{rgb:_0},toMode:{rgb:$0},interpolate:{h:{use:l,fixup:C},s:l,l,alpha:{use:l,fixup:k}},difference:{h:ve},average:{h:R}},H=({l:e,a:n,b:t,alpha:a},r="lch")=>{n===void 0&&(n=0),t===void 0&&(t=0);let i=Math.sqrt(n*n+t*t),o={mode:r,l:e,c:i};return i&&(o.h=w(Math.atan2(t,n)*180/Math.PI)),a!==void 0&&(o.alpha=a),o},X=({l:e,c:n,h:t,alpha:a},r="lab")=>{t===void 0&&(t=0);let i={mode:r,l:e,a:n?n*Math.cos(t/180*Math.PI):0,b:n?n*Math.sin(t/180*Math.PI):0};return a!==void 0&&(i.alpha=a),i},ht=Math.pow(29,3)/Math.pow(3,3),pt=Math.pow(6,3)/Math.pow(29,3),y={X:.3457/.3585,Y:1,Z:(1-.3457-.3585)/.3585},B={X:.3127/.329,Y:1,Z:(1-.3127-.329)/.329};let qe=e=>Math.pow(e,3)>pt?Math.pow(e,3):(116*e-16)/ht;const bt=({l:e,a:n,b:t,alpha:a})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=(e+16)/116,i=n/500+r,o=r-t/200,f={mode:"xyz65",x:qe(i)*B.X,y:qe(r)*B.Y,z:qe(o)*B.Z};return a!==void 0&&(f.alpha=a),f},_e=e=>U(bt(e)),Ye=e=>e>pt?Math.cbrt(e):(ht*e+16)/116,gt=({x:e,y:n,z:t,alpha:a})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=Ye(e/B.X),i=Ye(n/B.Y),o=Ye(t/B.Z),f={mode:"lab65",l:116*i-16,a:500*(r-i),b:200*(i-o)};return a!==void 0&&(f.alpha=a),f},$e=e=>{let n=gt(D(e));return e.r===e.b&&e.b===e.g&&(n.a=n.b=0),n},me=1,mt=1,de=26/180*Math.PI,xe=Math.cos(de),Me=Math.sin(de),xt=100/Math.log(139/100),un=({l:e,c:n,h:t,alpha:a})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r={mode:"lab65",l:(Math.exp(e*me/xt)-1)/.0039},i=(Math.exp(.0435*n*mt*me)-1)/.075,o=i*Math.cos(t/180*Math.PI-de),f=i*Math.sin(t/180*Math.PI-de);return r.a=o*xe-f/.83*Me,r.b=o*Me+f/.83*xe,a!==void 0&&(r.alpha=a),r},cn=({l:e,a:n,b:t,alpha:a})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=n*xe+t*Me,i=.83*(t*xe-n*Me),o=Math.sqrt(r*r+i*i),f={mode:"dlch",l:xt/me*Math.log(1+.0039*e),c:Math.log(1+.075*o)/(.0435*mt*me)};return f.c&&(f.h=w((Math.atan2(i,r)+de)/Math.PI*180)),a!==void 0&&(f.alpha=a),f},qn=e=>un(H(e,"dlch")),Yn=e=>X(cn(e),"dlab"),T0={mode:"dlab",parse:["--din99o-lab"],serialize:"--din99o-lab",toMode:{lab65:qn,rgb:e=>_e(qn(e))},fromMode:{lab65:Yn,rgb:e=>Yn($e(e))},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-40.09,45.501],b:[-40.469,44.344]},interpolate:{l,a:l,b:l,alpha:{use:l,fixup:k}}},S0={mode:"dlch",parse:["--din99o-lch"],serialize:"--din99o-lch",toMode:{lab65:un,dlab:e=>X(e,"dlab"),rgb:e=>_e(un(e))},fromMode:{lab65:cn,dlab:e=>H(e,"dlch"),rgb:e=>cn($e(e))},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,51.484],h:[0,360]},interpolate:{l,c:l,h:{use:l,fixup:C},alpha:{use:l,fixup:k}},difference:{h:ke},average:{h:R}};function P0({h:e,s:n,i:t,alpha:a}){e=w(e!==void 0?e:0),n===void 0&&(n=0),t===void 0&&(t=0);let r=Math.abs(e/60%2-1),i;switch(Math.floor(e/60)){case 0:i={r:t*(1+n*(3/(2-r)-1)),g:t*(1+n*(3*(1-r)/(2-r)-1)),b:t*(1-n)};break;case 1:i={r:t*(1+n*(3*(1-r)/(2-r)-1)),g:t*(1+n*(3/(2-r)-1)),b:t*(1-n)};break;case 2:i={r:t*(1-n),g:t*(1+n*(3/(2-r)-1)),b:t*(1+n*(3*(1-r)/(2-r)-1))};break;case 3:i={r:t*(1-n),g:t*(1+n*(3*(1-r)/(2-r)-1)),b:t*(1+n*(3/(2-r)-1))};break;case 4:i={r:t*(1+n*(3*(1-r)/(2-r)-1)),g:t*(1-n),b:t*(1+n*(3/(2-r)-1))};break;case 5:i={r:t*(1+n*(3/(2-r)-1)),g:t*(1-n),b:t*(1+n*(3*(1-r)/(2-r)-1))};break;default:i={r:t*(1-n),g:t*(1-n),b:t*(1-n)}}return i.mode="rgb",a!==void 0&&(i.alpha=a),i}function A0({r:e,g:n,b:t,alpha:a}){e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=Math.max(e,n,t),i=Math.min(e,n,t),o={mode:"hsi",s:e+n+t===0?0:1-3*i/(e+n+t),i:(e+n+t)/3};return r-i!==0&&(o.h=(r===e?(n-t)/(r-i)+(n<t)*6:r===n?(t-e)/(r-i)+2:(e-n)/(r-i)+4)*60),a!==void 0&&(o.alpha=a),o}const N0={mode:"hsi",toMode:{rgb:P0},parse:["--hsi"],serialize:"--hsi",fromMode:{rgb:A0},channels:["h","s","i","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:l,fixup:C},s:l,i:l,alpha:{use:l,fixup:k}},difference:{h:ve},average:{h:R}};function C0({h:e,s:n,l:t,alpha:a}){e=w(e!==void 0?e:0),n===void 0&&(n=0),t===void 0&&(t=0);let r=t+n*(t<.5?t:1-t),i=r-(r-t)*2*Math.abs(e/60%2-1),o;switch(Math.floor(e/60)){case 0:o={r,g:i,b:2*t-r};break;case 1:o={r:i,g:r,b:2*t-r};break;case 2:o={r:2*t-r,g:r,b:i};break;case 3:o={r:2*t-r,g:i,b:r};break;case 4:o={r:i,g:2*t-r,b:r};break;case 5:o={r,g:2*t-r,b:i};break;default:o={r:2*t-r,g:2*t-r,b:2*t-r}}return o.mode="rgb",a!==void 0&&(o.alpha=a),o}function R0({r:e,g:n,b:t,alpha:a}){e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=Math.max(e,n,t),i=Math.min(e,n,t),o={mode:"hsl",s:r===i?0:(r-i)/(1-Math.abs(r+i-1)),l:.5*(r+i)};return r-i!==0&&(o.h=(r===e?(n-t)/(r-i)+(n<t)*6:r===n?(t-e)/(r-i)+2:(e-n)/(r-i)+4)*60),a!==void 0&&(o.alpha=a),o}const F0=(e,n)=>{switch(n){case"deg":return+e;case"rad":return e/Math.PI*180;case"grad":return e/10*9;case"turn":return e*360}},E0=new RegExp(`^hsla?\\(\\s*${e0}${V}${fe}${V}${fe}\\s*(?:,\\s*${xn}\\s*)?\\)$`),I0=e=>{let n=e.match(E0);if(!n)return;let t={mode:"hsl"};return n[3]!==void 0?t.h=+n[3]:n[1]!==void 0&&n[2]!==void 0&&(t.h=F0(n[1],n[2])),n[4]!==void 0&&(t.s=Math.min(Math.max(0,n[4]/100),1)),n[5]!==void 0&&(t.l=Math.min(Math.max(0,n[5]/100),1)),n[6]!==void 0?t.alpha=Math.max(0,Math.min(1,n[6]/100)):n[7]!==void 0&&(t.alpha=Math.max(0,Math.min(1,+n[7]))),t};function H0(e,n){if(!n||n[0]!=="hsl"&&n[0]!=="hsla")return;const t={mode:"hsl"},[,a,r,i,o]=n;if(a.type!==d.None){if(a.type===d.Percentage)return;t.h=a.value}if(r.type!==d.None){if(r.type===d.Hue)return;t.s=r.value/100}if(i.type!==d.None){if(i.type===d.Hue)return;t.l=i.value/100}return o.type!==d.None&&(t.alpha=Math.min(1,Math.max(0,o.type===d.Number?o.value:o.value/100))),t}const Mt={mode:"hsl",toMode:{rgb:C0},fromMode:{rgb:R0},channels:["h","s","l","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[H0,I0],serialize:e=>`hsl(${e.h!==void 0?e.h:"none"} ${e.s!==void 0?e.s*100+"%":"none"} ${e.l!==void 0?e.l*100+"%":"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:l,fixup:C},s:l,l,alpha:{use:l,fixup:k}},difference:{h:ve},average:{h:R}};function yt({h:e,s:n,v:t,alpha:a}){e=w(e!==void 0?e:0),n===void 0&&(n=0),t===void 0&&(t=0);let r=Math.abs(e/60%2-1),i;switch(Math.floor(e/60)){case 0:i={r:t,g:t*(1-n*r),b:t*(1-n)};break;case 1:i={r:t*(1-n*r),g:t,b:t*(1-n)};break;case 2:i={r:t*(1-n),g:t,b:t*(1-n*r)};break;case 3:i={r:t*(1-n),g:t*(1-n*r),b:t};break;case 4:i={r:t*(1-n*r),g:t*(1-n),b:t};break;case 5:i={r:t,g:t*(1-n),b:t*(1-n*r)};break;default:i={r:t*(1-n),g:t*(1-n),b:t*(1-n)}}return i.mode="rgb",a!==void 0&&(i.alpha=a),i}function vt({r:e,g:n,b:t,alpha:a}){e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=Math.max(e,n,t),i=Math.min(e,n,t),o={mode:"hsv",s:r===0?0:1-i/r,v:r};return r-i!==0&&(o.h=(r===e?(n-t)/(r-i)+(n<t)*6:r===n?(t-e)/(r-i)+2:(e-n)/(r-i)+4)*60),a!==void 0&&(o.alpha=a),o}const kt={mode:"hsv",toMode:{rgb:yt},parse:["--hsv"],serialize:"--hsv",fromMode:{rgb:vt},channels:["h","s","v","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:l,fixup:C},s:l,v:l,alpha:{use:l,fixup:k}},difference:{h:ve},average:{h:R}};function X0({h:e,w:n,b:t,alpha:a}){if(n===void 0&&(n=0),t===void 0&&(t=0),n+t>1){let r=n+t;n/=r,t/=r}return yt({h:e,s:t===1?1:1-n/(1-t),v:1-t,alpha:a})}function L0(e){let n=vt(e);if(n===void 0)return;let t=n.s!==void 0?n.s:0,a=n.v!==void 0?n.v:0,r={mode:"hwb",w:(1-t)*a,b:1-a};return n.h!==void 0&&(r.h=n.h),n.alpha!==void 0&&(r.alpha=n.alpha),r}function j0(e,n){if(!n||n[0]!=="hwb")return;const t={mode:"hwb"},[,a,r,i,o]=n;if(a.type!==d.None){if(a.type===d.Percentage)return;t.h=a.value}if(r.type!==d.None){if(r.type===d.Hue)return;t.w=r.value/100}if(i.type!==d.None){if(i.type===d.Hue)return;t.b=i.value/100}return o.type!==d.None&&(t.alpha=Math.min(1,Math.max(0,o.type===d.Number?o.value:o.value/100))),t}const O0={mode:"hwb",toMode:{rgb:X0},fromMode:{rgb:L0},channels:["h","w","b","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[j0],serialize:e=>`hwb(${e.h!==void 0?e.h:"none"} ${e.w!==void 0?e.w*100+"%":"none"} ${e.b!==void 0?e.b*100+"%":"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:l,fixup:C},w:l,b:l,alpha:{use:l,fixup:k}},difference:{h:z0},average:{h:R}},_t=203,ze=.1593017578125,$t=78.84375,we=.8359375,Te=18.8515625,Se=18.6875;function De(e){if(e<0)return 0;const n=Math.pow(e,1/$t);return 1e4*Math.pow(Math.max(0,n-we)/(Te-Se*n),1/ze)}function Ue(e){if(e<0)return 0;const n=Math.pow(e/1e4,ze);return Math.pow((we+Te*n)/(1+Se*n),$t)}const Ze=e=>Math.max(e/_t,0),Dn=({i:e,t:n,p:t,alpha:a})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);const r=De(e+.008609037037932761*n+.11102962500302593*t),i=De(e-.00860903703793275*n-.11102962500302599*t),o=De(e+.5600313357106791*n-.32062717498731885*t),f={mode:"xyz65",x:Ze(2.070152218389422*r-1.3263473389671556*i+.2066510476294051*o),y:Ze(.3647385209748074*r+.680566024947227*i-.0453045459220346*o),z:Ze(-.049747207535812*r-.0492609666966138*i+1.1880659249923042*o)};return a!==void 0&&(f.alpha=a),f},Be=(e=0)=>Math.max(e*_t,0),Un=({x:e,y:n,z:t,alpha:a})=>{const r=Be(e),i=Be(n),o=Be(t),f=Ue(.3592832590121217*r+.6976051147779502*i-.0358915932320289*o),s=Ue(-.1920808463704995*r+1.1004767970374323*i+.0753748658519118*o),u=Ue(.0070797844607477*r+.0748396662186366*i+.8433265453898765*o),h=.5*f+.5*s,p=1.61376953125*f-3.323486328125*s+1.709716796875*u,g=4.378173828125*f-4.24560546875*s-.132568359375*u,M={mode:"itp",i:h,t:p,p:g};return a!==void 0&&(M.alpha=a),M},q0={mode:"itp",channels:["i","t","p","alpha"],parse:["--ictcp"],serialize:"--ictcp",toMode:{xyz65:Dn,rgb:e=>U(Dn(e))},fromMode:{xyz65:Un,rgb:e=>Un(D(e))},ranges:{i:[0,.581],t:[-.369,.272],p:[-.164,.331]},interpolate:{i:l,t:l,p:l,alpha:{use:l,fixup:k}}},Y0=134.03437499999998,D0=16295499532821565e-27,Ve=e=>{if(e<0)return 0;let n=Math.pow(e/1e4,ze);return Math.pow((we+Te*n)/(1+Se*n),Y0)},Ge=(e=0)=>Math.max(e*203,0),zt=({x:e,y:n,z:t,alpha:a})=>{e=Ge(e),n=Ge(n),t=Ge(t);let r=1.15*e-.15*t,i=.66*n+.34*e,o=Ve(.41478972*r+.579999*i+.014648*t),f=Ve(-.20151*r+1.120649*i+.0531008*t),s=Ve(-.0166008*r+.2648*i+.6684799*t),u=(o+f)/2,h={mode:"jab",j:.44*u/(1-.56*u)-D0,a:3.524*o-4.066708*f+.542708*s,b:.199076*o+1.096799*f-1.295875*s};return a!==void 0&&(h.alpha=a),h},U0=134.03437499999998,Zn=16295499532821565e-27,Je=e=>{if(e<0)return 0;let n=Math.pow(e,1/U0);return 1e4*Math.pow((we-n)/(Se*n-Te),1/ze)},We=e=>e/203,wt=({j:e,a:n,b:t,alpha:a})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=(e+Zn)/(.44+.56*(e+Zn)),i=Je(r+.13860504*n+.058047316*t),o=Je(r-.13860504*n-.058047316*t),f=Je(r-.096019242*n-.8118919*t),s={mode:"xyz65",x:We(1.661373024652174*i-.914523081304348*o+.23136208173913045*f),y:We(-.3250758611844533*i+1.571847026732543*o-.21825383453227928*f),z:We(-.090982811*i-.31272829*o+1.5227666*f)};return a!==void 0&&(s.alpha=a),s},Tt=e=>{let n=zt(D(e));return e.r===e.b&&e.b===e.g&&(n.a=n.b=0),n},St=e=>U(wt(e)),Z0={mode:"jab",channels:["j","a","b","alpha"],parse:["--jzazbz"],serialize:"--jzazbz",fromMode:{rgb:Tt,xyz65:zt},toMode:{rgb:St,xyz65:wt},ranges:{j:[0,.222],a:[-.109,.129],b:[-.185,.134]},interpolate:{j:l,a:l,b:l,alpha:{use:l,fixup:k}}},Bn=({j:e,a:n,b:t,alpha:a})=>{n===void 0&&(n=0),t===void 0&&(t=0);let r=Math.sqrt(n*n+t*t),i={mode:"jch",j:e,c:r};return r&&(i.h=w(Math.atan2(t,n)*180/Math.PI)),a!==void 0&&(i.alpha=a),i},Vn=({j:e,c:n,h:t,alpha:a})=>{t===void 0&&(t=0);let r={mode:"jab",j:e,a:n?n*Math.cos(t/180*Math.PI):0,b:n?n*Math.sin(t/180*Math.PI):0};return a!==void 0&&(r.alpha=a),r},B0={mode:"jch",parse:["--jzczhz"],serialize:"--jzczhz",toMode:{jab:Vn,rgb:e=>St(Vn(e))},fromMode:{rgb:e=>Bn(Tt(e)),jab:Bn},channels:["j","c","h","alpha"],ranges:{j:[0,.221],c:[0,.19],h:[0,360]},interpolate:{h:{use:l,fixup:C},c:l,j:l,alpha:{use:l,fixup:k}},difference:{h:ke},average:{h:R}},Pe=Math.pow(29,3)/Math.pow(3,3),yn=Math.pow(6,3)/Math.pow(29,3);let Ke=e=>Math.pow(e,3)>yn?Math.pow(e,3):(116*e-16)/Pe;const vn=({l:e,a:n,b:t,alpha:a})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=(e+16)/116,i=n/500+r,o=r-t/200,f={mode:"xyz50",x:Ke(i)*y.X,y:Ke(r)*y.Y,z:Ke(o)*y.Z};return a!==void 0&&(f.alpha=a),f},le=({x:e,y:n,z:t,alpha:a})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=W({r:e*3.1341359569958707-n*1.6173863321612538-.4906619460083532*t,g:e*-.978795502912089+n*1.916254567259524+.03344273116131949*t,b:e*.07195537988411677-n*.2289768264158322+1.405386058324125*t});return a!==void 0&&(r.alpha=a),r},Pt=e=>le(vn(e)),se=e=>{let{r:n,g:t,b:a,alpha:r}=J(e),i={mode:"xyz50",x:.436065742824811*n+.3851514688337912*t+.14307845442264197*a,y:.22249319175623702*n+.7168870538238823*t+.06061979053616537*a,z:.013923904500943465*n+.09708128566574634*t+.7140993584005155*a};return r!==void 0&&(i.alpha=r),i},Qe=e=>e>yn?Math.cbrt(e):(Pe*e+16)/116,kn=({x:e,y:n,z:t,alpha:a})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=Qe(e/y.X),i=Qe(n/y.Y),o=Qe(t/y.Z),f={mode:"lab",l:116*i-16,a:500*(r-i),b:200*(i-o)};return a!==void 0&&(f.alpha=a),f},At=e=>{let n=kn(se(e));return e.r===e.b&&e.b===e.g&&(n.a=n.b=0),n};function V0(e,n){if(!n||n[0]!=="lab")return;const t={mode:"lab"},[,a,r,i,o]=n;if(!(a.type===d.Hue||r.type===d.Hue||i.type===d.Hue))return a.type!==d.None&&(t.l=Math.min(Math.max(0,a.value),100)),r.type!==d.None&&(t.a=r.type===d.Number?r.value:r.value*125/100),i.type!==d.None&&(t.b=i.type===d.Number?i.value:i.value*125/100),o.type!==d.None&&(t.alpha=Math.min(1,Math.max(0,o.type===d.Number?o.value:o.value/100))),t}const _n={mode:"lab",toMode:{xyz50:vn,rgb:Pt},fromMode:{xyz50:kn,rgb:At},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-125,125],b:[-125,125]},parse:[V0],serialize:e=>`lab(${e.l!==void 0?e.l:"none"} ${e.a!==void 0?e.a:"none"} ${e.b!==void 0?e.b:"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{l,a:l,b:l,alpha:{use:l,fixup:k}}},G0={..._n,mode:"lab65",parse:["--lab-d65"],serialize:"--lab-d65",toMode:{xyz65:bt,rgb:_e},fromMode:{xyz65:gt,rgb:$e},ranges:{l:[0,100],a:[-125,125],b:[-125,125]}};function J0(e,n){if(!n||n[0]!=="lch")return;const t={mode:"lch"},[,a,r,i,o]=n;if(a.type!==d.None){if(a.type===d.Hue)return;t.l=Math.min(Math.max(0,a.value),100)}if(r.type!==d.None&&(t.c=Math.max(0,r.type===d.Number?r.value:r.value*150/100)),i.type!==d.None){if(i.type===d.Percentage)return;t.h=i.value}return o.type!==d.None&&(t.alpha=Math.min(1,Math.max(0,o.type===d.Number?o.value:o.value/100))),t}const $n={mode:"lch",toMode:{lab:X,rgb:e=>Pt(X(e))},fromMode:{rgb:e=>H(At(e)),lab:H},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,150],h:[0,360]},parse:[J0],serialize:e=>`lch(${e.l!==void 0?e.l:"none"} ${e.c!==void 0?e.c:"none"} ${e.h!==void 0?e.h:"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:l,fixup:C},c:l,l,alpha:{use:l,fixup:k}},difference:{h:ke},average:{h:R}},W0={...$n,mode:"lch65",parse:["--lch-d65"],serialize:"--lch-d65",toMode:{lab65:e=>X(e,"lab65"),rgb:e=>_e(X(e,"lab65"))},fromMode:{rgb:e=>H($e(e),"lch65"),lab65:e=>H(e,"lch65")},ranges:{l:[0,100],c:[0,150],h:[0,360]}},Nt=({l:e,u:n,v:t,alpha:a})=>{n===void 0&&(n=0),t===void 0&&(t=0);let r=Math.sqrt(n*n+t*t),i={mode:"lchuv",l:e,c:r};return r&&(i.h=w(Math.atan2(t,n)*180/Math.PI)),a!==void 0&&(i.alpha=a),i},Ct=({l:e,c:n,h:t,alpha:a})=>{t===void 0&&(t=0);let r={mode:"luv",l:e,u:n?n*Math.cos(t/180*Math.PI):0,v:n?n*Math.sin(t/180*Math.PI):0};return a!==void 0&&(r.alpha=a),r},Rt=(e,n,t)=>4*e/(e+15*n+3*t),Ft=(e,n,t)=>9*n/(e+15*n+3*t),K0=Rt(y.X,y.Y,y.Z),Q0=Ft(y.X,y.Y,y.Z),er=e=>e<=yn?Pe*e:116*Math.cbrt(e)-16,hn=({x:e,y:n,z:t,alpha:a})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=er(n/y.Y),i=Rt(e,n,t),o=Ft(e,n,t);!isFinite(i)||!isFinite(o)?r=i=o=0:(i=13*r*(i-K0),o=13*r*(o-Q0));let f={mode:"luv",l:r,u:i,v:o};return a!==void 0&&(f.alpha=a),f},nr=(e,n,t)=>4*e/(e+15*n+3*t),tr=(e,n,t)=>9*n/(e+15*n+3*t),rr=nr(y.X,y.Y,y.Z),ar=tr(y.X,y.Y,y.Z),pn=({l:e,u:n,v:t,alpha:a})=>{if(e===void 0&&(e=0),e===0)return{mode:"xyz50",x:0,y:0,z:0};n===void 0&&(n=0),t===void 0&&(t=0);let r=n/(13*e)+rr,i=t/(13*e)+ar,o=y.Y*(e<=8?e/Pe:Math.pow((e+16)/116,3)),f=o*(9*r)/(4*i),s=o*(12-3*r-20*i)/(4*i),u={mode:"xyz50",x:f,y:o,z:s};return a!==void 0&&(u.alpha=a),u},ir=e=>Nt(hn(se(e))),or=e=>le(pn(Ct(e))),fr={mode:"lchuv",toMode:{luv:Ct,rgb:or},fromMode:{rgb:ir,luv:Nt},channels:["l","c","h","alpha"],parse:["--lchuv"],serialize:"--lchuv",ranges:{l:[0,100],c:[0,176.956],h:[0,360]},interpolate:{h:{use:l,fixup:C},c:l,l,alpha:{use:l,fixup:k}},difference:{h:ke},average:{h:R}},dr={...G,mode:"lrgb",toMode:{rgb:W},fromMode:{rgb:J},parse:["srgb-linear"],serialize:"srgb-linear"},lr={mode:"luv",toMode:{xyz50:pn,rgb:e=>le(pn(e))},fromMode:{xyz50:hn,rgb:e=>hn(se(e))},channels:["l","u","v","alpha"],parse:["--luv"],serialize:"--luv",ranges:{l:[0,100],u:[-84.936,175.042],v:[-125.882,87.243]},interpolate:{l,u:l,v:l,alpha:{use:l,fixup:k}}},Et=({r:e,g:n,b:t,alpha:a})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=Math.cbrt(.412221469470763*e+.5363325372617348*n+.0514459932675022*t),i=Math.cbrt(.2119034958178252*e+.6806995506452344*n+.1073969535369406*t),o=Math.cbrt(.0883024591900564*e+.2817188391361215*n+.6299787016738222*t),f={mode:"oklab",l:.210454268309314*r+.7936177747023054*i-.0040720430116193*o,a:1.9779985324311684*r-2.42859224204858*i+.450593709617411*o,b:.0259040424655478*r+.7827717124575296*i-.8086757549230774*o};return a!==void 0&&(f.alpha=a),f},Ae=e=>{let n=Et(J(e));return e.r===e.b&&e.b===e.g&&(n.a=n.b=0),n},ue=({l:e,a:n,b:t,alpha:a})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=Math.pow(e+.3963377773761749*n+.2158037573099136*t,3),i=Math.pow(e-.1055613458156586*n-.0638541728258133*t,3),o=Math.pow(e-.0894841775298119*n-1.2914855480194092*t,3),f={mode:"lrgb",r:4.076741636075957*r-3.3077115392580616*i+.2309699031821044*o,g:-1.2684379732850317*r+2.6097573492876887*i-.3413193760026573*o,b:-.0041960761386756*r-.7034186179359362*i+1.7076146940746117*o};return a!==void 0&&(f.alpha=a),f},Ne=e=>W(ue(e));function bn(e){const a=1.170873786407767;return .5*(a*e-.206+Math.sqrt((a*e-.206)*(a*e-.206)+4*.03*a*e))}function ye(e){return(e*e+.206*e)/(1.170873786407767*(e+.03))}function sr(e,n){let t,a,r,i,o,f,s,u;-1.88170328*e-.80936493*n>1?(t=1.19086277,a=1.76576728,r=.59662641,i=.75515197,o=.56771245,f=4.0767416621,s=-3.3077115913,u=.2309699292):1.81444104*e-1.19445276*n>1?(t=.73956515,a=-.45954404,r=.08285427,i=.1254107,o=.14503204,f=-1.2684380046,s=2.6097574011,u=-.3413193965):(t=1.35733652,a=-.00915799,r=-1.1513021,i=-.50559606,o=.00692167,f=-.0041960863,s=-.7034186147,u=1.707614701);let h=t+a*e+r*n+i*e*e+o*e*n,p=.3963377774*e+.2158037573*n,g=-.1055613458*e-.0638541728*n,M=-.0894841775*e-1.291485548*n;{let v=1+h*p,z=1+h*g,_=1+h*M,A=v*v*v,T=z*z*z,F=_*_*_,K=3*p*v*v,Q=3*g*z*z,ee=3*M*_*_,ne=6*p*p*v,te=6*g*g*z,re=6*M*M*_,Z=f*A+s*T+u*F,L=f*K+s*Q+u*ee,ae=f*ne+s*te+u*re;h=h-Z*L/(L*L-.5*Z*ae)}return h}function zn(e,n){let t=sr(e,n),a=ue({l:1,a:t*e,b:t*n}),r=Math.cbrt(1/Math.max(a.r,a.g,a.b)),i=r*t;return[r,i]}function ur(e,n,t,a,r,i=null){i||(i=zn(e,n));let o;if((t-r)*i[1]-(i[0]-r)*a<=0)o=i[1]*r/(a*i[0]+i[1]*(r-t));else{o=i[1]*(r-1)/(a*(i[0]-1)+i[1]*(r-t));{let f=t-r,s=a,u=.3963377774*e+.2158037573*n,h=-.1055613458*e-.0638541728*n,p=-.0894841775*e-1.291485548*n,g=f+s*u,M=f+s*h,v=f+s*p;{let z=r*(1-o)+o*t,_=o*a,A=z+_*u,T=z+_*h,F=z+_*p,K=A*A*A,Q=T*T*T,ee=F*F*F,ne=3*g*A*A,te=3*M*T*T,re=3*v*F*F,Z=6*g*g*A,L=6*M*M*T,ae=6*v*v*F,Nn=4.0767416621*K-3.3077115913*Q+.2309699292*ee-1,Ce=4.0767416621*ne-3.3077115913*te+.2309699292*re,Bt=4.0767416621*Z-3.3077115913*L+.2309699292*ae,Cn=Ce/(Ce*Ce-.5*Nn*Bt),Re=-Nn*Cn,Rn=-1.2684380046*K+2.6097574011*Q-.3413193965*ee-1,Fe=-1.2684380046*ne+2.6097574011*te-.3413193965*re,Vt=-1.2684380046*Z+2.6097574011*L-.3413193965*ae,Fn=Fe/(Fe*Fe-.5*Rn*Vt),Ee=-Rn*Fn,En=-.0041960863*K-.7034186147*Q+1.707614701*ee-1,Ie=-.0041960863*ne-.7034186147*te+1.707614701*re,Gt=-.0041960863*Z-.7034186147*L+1.707614701*ae,In=Ie/(Ie*Ie-.5*En*Gt),He=-En*In;Re=Cn>=0?Re:1e6,Ee=Fn>=0?Ee:1e6,He=In>=0?He:1e6,o+=Math.min(Re,Math.min(Ee,He))}}}return o}function wn(e,n,t=null){t||(t=zn(e,n));let a=t[0],r=t[1];return[r/a,r/(1-a)]}function It(e,n,t){let a=zn(n,t),r=ur(n,t,e,1,e,a),i=wn(n,t,a),o=.11516993+1/(7.4477897+4.1590124*t+n*(-2.19557347+1.75198401*t+n*(-2.13704948-10.02301043*t+n*(-4.24894561+5.38770819*t+4.69891013*n)))),f=.11239642+1/(1.6132032-.68124379*t+n*(.40370612+.90148123*t+n*(-.27087943+.6122399*t+n*(.00299215-.45399568*t-.14661872*n)))),s=r/Math.min(e*i[0],(1-e)*i[1]),u=e*o,h=(1-e)*f,p=.9*s*Math.sqrt(Math.sqrt(1/(1/(u*u*u*u)+1/(h*h*h*h))));return u=e*.4,h=(1-e)*.8,[Math.sqrt(1/(1/(u*u)+1/(h*h))),p,r]}function Gn(e){const n=e.l!==void 0?e.l:0,t=e.a!==void 0?e.a:0,a=e.b!==void 0?e.b:0,r={mode:"okhsl",l:bn(n)};e.alpha!==void 0&&(r.alpha=e.alpha);let i=Math.sqrt(t*t+a*a);if(!i)return r.s=0,r;let[o,f,s]=It(n,t/i,a/i),u;if(i<f){let h=0,p=.8*o,g=1-p/f;u=(i-h)/(p+g*(i-h))*.8}else{let h=f,p=.2*f*f*1.25*1.25/o,g=1-p/(s-f);u=.8+.2*((i-h)/(p+g*(i-h)))}return u&&(r.s=u,r.h=w(Math.atan2(a,t)*180/Math.PI)),r}function Jn(e){let n=e.h!==void 0?e.h:0,t=e.s!==void 0?e.s:0,a=e.l!==void 0?e.l:0;const r={mode:"oklab",l:ye(a)};if(e.alpha!==void 0&&(r.alpha=e.alpha),!t||a===1)return r.a=r.b=0,r;let i=Math.cos(n/180*Math.PI),o=Math.sin(n/180*Math.PI),[f,s,u]=It(r.l,i,o),h,p,g,M;t<.8?(h=1.25*t,p=0,g=.8*f,M=1-g/s):(h=5*(t-.8),p=s,g=.2*s*s*1.25*1.25/f,M=1-g/(u-s));let v=p+h*g/(1-M*h);return r.a=v*i,r.b=v*o,r}const cr={...Mt,mode:"okhsl",channels:["h","s","l","alpha"],parse:["--okhsl"],serialize:"--okhsl",fromMode:{oklab:Gn,rgb:e=>Gn(Ae(e))},toMode:{oklab:Jn,rgb:e=>Ne(Jn(e))}};function Wn(e){let n=e.l!==void 0?e.l:0,t=e.a!==void 0?e.a:0,a=e.b!==void 0?e.b:0,r=Math.sqrt(t*t+a*a),i=r?t/r:1,o=r?a/r:1,[f,s]=wn(i,o),u=.5,h=1-u/f,p=s/(r+n*s),g=p*n,M=p*r,v=ye(g),z=M*v/g,_=ue({l:v,a:i*z,b:o*z}),A=Math.cbrt(1/Math.max(_.r,_.g,_.b,0));n=n/A,r=r/A*bn(n)/n,n=bn(n);const T={mode:"okhsv",s:r?(u+s)*M/(s*u+s*h*M):0,v:n?n/g:0};return T.s&&(T.h=w(Math.atan2(a,t)*180/Math.PI)),e.alpha!==void 0&&(T.alpha=e.alpha),T}function Kn(e){const n={mode:"oklab"};e.alpha!==void 0&&(n.alpha=e.alpha);const t=e.h!==void 0?e.h:0,a=e.s!==void 0?e.s:0,r=e.v!==void 0?e.v:0,i=Math.cos(t/180*Math.PI),o=Math.sin(t/180*Math.PI),[f,s]=wn(i,o),u=.5,h=1-u/f,p=1-a*u/(u+s-s*h*a),g=a*s*u/(u+s-s*h*a),M=ye(p),v=g*M/p,z=ue({l:M,a:i*v,b:o*v}),_=Math.cbrt(1/Math.max(z.r,z.g,z.b,0)),A=ye(r*p),T=g*A/p;return n.l=A*_,n.a=T*i*_,n.b=T*o*_,n}const hr={...kt,mode:"okhsv",channels:["h","s","v","alpha"],parse:["--okhsv"],serialize:"--okhsv",fromMode:{oklab:Wn,rgb:e=>Wn(Ae(e))},toMode:{oklab:Kn,rgb:e=>Ne(Kn(e))}};function pr(e,n){if(!n||n[0]!=="oklab")return;const t={mode:"oklab"},[,a,r,i,o]=n;if(!(a.type===d.Hue||r.type===d.Hue||i.type===d.Hue))return a.type!==d.None&&(t.l=Math.min(Math.max(0,a.type===d.Number?a.value:a.value/100),1)),r.type!==d.None&&(t.a=r.type===d.Number?r.value:r.value*.4/100),i.type!==d.None&&(t.b=i.type===d.Number?i.value:i.value*.4/100),o.type!==d.None&&(t.alpha=Math.min(1,Math.max(0,o.type===d.Number?o.value:o.value/100))),t}const br={..._n,mode:"oklab",toMode:{lrgb:ue,rgb:Ne},fromMode:{lrgb:Et,rgb:Ae},ranges:{l:[0,1],a:[-.4,.4],b:[-.4,.4]},parse:[pr],serialize:e=>`oklab(${e.l!==void 0?e.l:"none"} ${e.a!==void 0?e.a:"none"} ${e.b!==void 0?e.b:"none"}${e.alpha<1?` / ${e.alpha}`:""})`};function gr(e,n){if(!n||n[0]!=="oklch")return;const t={mode:"oklch"},[,a,r,i,o]=n;if(a.type!==d.None){if(a.type===d.Hue)return;t.l=Math.min(Math.max(0,a.type===d.Number?a.value:a.value/100),1)}if(r.type!==d.None&&(t.c=Math.max(0,r.type===d.Number?r.value:r.value*.4/100)),i.type!==d.None){if(i.type===d.Percentage)return;t.h=i.value}return o.type!==d.None&&(t.alpha=Math.min(1,Math.max(0,o.type===d.Number?o.value:o.value/100))),t}const mr={...$n,mode:"oklch",toMode:{oklab:e=>X(e,"oklab"),rgb:e=>Ne(X(e,"oklab"))},fromMode:{rgb:e=>H(Ae(e),"oklch"),oklab:e=>H(e,"oklch")},parse:[gr],serialize:e=>`oklch(${e.l!==void 0?e.l:"none"} ${e.c!==void 0?e.c:"none"} ${e.h!==void 0?e.h:"none"}${e.alpha<1?` / ${e.alpha}`:""})`,ranges:{l:[0,1],c:[0,.4],h:[0,360]}},Qn=e=>{let{r:n,g:t,b:a,alpha:r}=J(e),i={mode:"xyz65",x:.486570948648216*n+.265667693169093*t+.1982172852343625*a,y:.2289745640697487*n+.6917385218365062*t+.079286914093745*a,z:0*n+.0451133818589026*t+1.043944368900976*a};return r!==void 0&&(i.alpha=r),i},et=({x:e,y:n,z:t,alpha:a})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=W({r:e*2.4934969119414263-n*.9313836179191242-.402710784450717*t,g:e*-.8294889695615749+n*1.7626640603183465+.0236246858419436*t,b:e*.0358458302437845-n*.0761723892680418+.9568845240076871*t},"p3");return a!==void 0&&(r.alpha=a),r},xr={...G,mode:"p3",parse:["display-p3"],serialize:"display-p3",fromMode:{rgb:e=>et(D(e)),xyz65:et},toMode:{rgb:e=>U(Qn(e)),xyz65:Qn}},en=e=>{let n=Math.abs(e);return n>=1/512?Math.sign(e)*Math.pow(n,1/1.8):16*e},nt=({x:e,y:n,z:t,alpha:a})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r={mode:"prophoto",r:en(e*1.3457868816471585-n*.2555720873797946-.0511018649755453*t),g:en(e*-.5446307051249019+n*1.5082477428451466+.0205274474364214*t),b:en(e*0+n*0+1.2119675456389452*t)};return a!==void 0&&(r.alpha=a),r},nn=(e=0)=>{let n=Math.abs(e);return n>=16/512?Math.sign(e)*Math.pow(n,1.8):e/16},tt=e=>{let n=nn(e.r),t=nn(e.g),a=nn(e.b),r={mode:"xyz50",x:.7977666449006423*n+.1351812974005331*t+.0313477341283922*a,y:.2880748288194013*n+.7118352342418731*t+899369387256e-16*a,z:0*n+0*t+.8251046025104602*a};return e.alpha!==void 0&&(r.alpha=e.alpha),r},Mr={...G,mode:"prophoto",parse:["prophoto-rgb"],serialize:"prophoto-rgb",fromMode:{xyz50:nt,rgb:e=>nt(se(e))},toMode:{xyz50:tt,rgb:e=>le(tt(e))}},rt=1.09929682680944,yr=.018053968510807,tn=e=>{const n=Math.abs(e);return n>yr?(Math.sign(e)||1)*(rt*Math.pow(n,.45)-(rt-1)):4.5*e},at=({x:e,y:n,z:t,alpha:a})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r={mode:"rec2020",r:tn(e*1.7166511879712683-n*.3556707837763925-.2533662813736599*t),g:tn(e*-.6666843518324893+n*1.6164812366349395+.0157685458139111*t),b:tn(e*.0176398574453108-n*.0427706132578085+.9421031212354739*t)};return a!==void 0&&(r.alpha=a),r},it=1.09929682680944,vr=.018053968510807,rn=(e=0)=>{let n=Math.abs(e);return n<vr*4.5?e/4.5:(Math.sign(e)||1)*Math.pow((n+it-1)/it,1/.45)},ot=e=>{let n=rn(e.r),t=rn(e.g),a=rn(e.b),r={mode:"xyz65",x:.6369580483012911*n+.1446169035862083*t+.1688809751641721*a,y:.262700212011267*n+.6779980715188708*t+.059301716469862*a,z:0*n+.0280726930490874*t+1.0609850577107909*a};return e.alpha!==void 0&&(r.alpha=e.alpha),r},kr={...G,mode:"rec2020",fromMode:{xyz65:at,rgb:e=>at(D(e))},toMode:{xyz65:ot,rgb:e=>U(ot(e))},parse:["rec2020"],serialize:"rec2020"},Y=.0037930732552754493,Ht=Math.cbrt(Y),an=e=>Math.cbrt(e)-Ht,_r=e=>{const{r:n,g:t,b:a,alpha:r}=J(e),i=an(.3*n+.622*t+.078*a+Y),o=an(.23*n+.692*t+.078*a+Y),f=an(.2434226892454782*n+.2047674442449682*t+.5518098665095535*a+Y),s={mode:"xyb",x:(i-o)/2,y:(i+o)/2,b:f-(i+o)/2};return r!==void 0&&(s.alpha=r),s},on=e=>Math.pow(e+Ht,3),$r=({x:e,y:n,b:t,alpha:a})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);const r=on(e+n)-Y,i=on(n-e)-Y,o=on(t+n)-Y,f=W({r:11.031566904639861*r-9.866943908131562*i-.16462299650829934*o,g:-3.2541473810744237*r+4.418770377582723*i-.16462299650829934*o,b:-3.6588512867136815*r+2.7129230459360922*i+1.9459282407775895*o});return a!==void 0&&(f.alpha=a),f},zr={mode:"xyb",channels:["x","y","b","alpha"],parse:["--xyb"],serialize:"--xyb",toMode:{rgb:$r},fromMode:{rgb:_r},ranges:{x:[-.0154,.0281],y:[0,.8453],b:[-.2778,.388]},interpolate:{x:l,y:l,b:l,alpha:{use:l,fixup:k}}},wr={mode:"xyz50",parse:["xyz-d50"],serialize:"xyz-d50",toMode:{rgb:le,lab:kn},fromMode:{rgb:se,lab:vn},channels:["x","y","z","alpha"],ranges:{x:[0,.964],y:[0,.999],z:[0,.825]},interpolate:{x:l,y:l,z:l,alpha:{use:l,fixup:k}}},Tr=e=>{let{x:n,y:t,z:a,alpha:r}=e;n===void 0&&(n=0),t===void 0&&(t=0),a===void 0&&(a=0);let i={mode:"xyz50",x:1.0479298208405488*n+.0229467933410191*t-.0501922295431356*a,y:.0296278156881593*n+.990434484573249*t-.0170738250293851*a,z:-.0092430581525912*n+.0150551448965779*t+.7518742899580008*a};return r!==void 0&&(i.alpha=r),i},Sr=e=>{let{x:n,y:t,z:a,alpha:r}=e;n===void 0&&(n=0),t===void 0&&(t=0),a===void 0&&(a=0);let i={mode:"xyz65",x:.9554734527042182*n-.0230985368742614*t+.0632593086610217*a,y:-.0283697069632081*n+1.0099954580058226*t+.021041398966943*a,z:.0123140016883199*n-.0205076964334779*t+1.3303659366080753*a};return r!==void 0&&(i.alpha=r),i},Pr={mode:"xyz65",toMode:{rgb:U,xyz50:Tr},fromMode:{rgb:D,xyz50:Sr},ranges:{x:[0,.95],y:[0,1],z:[0,1.088]},channels:["x","y","z","alpha"],parse:["xyz","xyz-d65"],serialize:"xyz-d65",interpolate:{x:l,y:l,z:l,alpha:{use:l,fixup:k}}},Ar=({r:e,g:n,b:t,alpha:a})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);const r={mode:"yiq",y:.29889531*e+.58662247*n+.11448223*t,i:.59597799*e-.2741761*n-.32180189*t,q:.21147017*e-.52261711*n+.31114694*t};return a!==void 0&&(r.alpha=a),r},Nr=({y:e,i:n,q:t,alpha:a})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);const r={mode:"rgb",r:e+.95608445*n+.6208885*t,g:e-.27137664*n-.6486059*t,b:e-1.10561724*n+1.70250126*t};return a!==void 0&&(r.alpha=a),r},Cr={mode:"yiq",toMode:{rgb:Nr},fromMode:{rgb:Ar},channels:["y","i","q","alpha"],parse:["--yiq"],serialize:"--yiq",ranges:{i:[-.595,.595],q:[-.522,.522]},interpolate:{y:l,i:l,q:l,alpha:{use:l,fixup:k}}};b(M0);b(w0);b(T0);b(S0);b(N0);b(Mt);b(kt);b(O0);b(q0);b(Z0);b(B0);b(_n);b(G0);b($n);b(W0);b(fr);b(dr);b(lr);b(cr);b(hr);b(br);b(mr);b(xr);b(Mr);b(kr);b(G);b(zr);b(wr);b(Pr);b(Cr);const Xt=lt("rgb");function Tn(e){const n=Mn(e);if(!n)return null;const t=Xt(n);return!t||t.alpha!==void 0&&t.alpha!==1||!O(t.r)||!O(t.g)||!O(t.b)?null:{r:q(t.r)*255,g:q(t.g)*255,b:q(t.b)*255}}function Rr(e){const n=Mn(e);if(!n)return null;const t=Xt(n);if(!t||!O(t.r)||!O(t.g)||!O(t.b))return null;const a=t.alpha??1;return O(a)?{r:q(t.r)*255,g:q(t.g)*255,b:q(t.b)*255,alpha:q(a)}:null}function Fr({r:e,g:n,b:t}){const a=e/255,r=n/255,i=t/255,o=Math.max(a,r,i),f=Math.min(a,r,i),s=o-f;let u=0;const h=(o+f)/2,p=s===0?0:s/(1-Math.abs(2*h-1));if(s!==0){switch(o){case a:u=(r-i)/s%6;break;case r:u=(i-a)/s+2;break;case i:u=(a-r)/s+4;break}u*=60,u<0&&(u+=360)}return{h:Math.round(u),s:Number((p*100).toFixed(1)),l:Number((h*100).toFixed(1))}}function Er(e){const{h:n,s:t,l:a}=Fr(e);return`${n} ${t}% ${a}%`}function Ir(e){const n=Tn(e);return n?Er(n):null}function O(e){return typeof e=="number"&&Number.isFinite(e)}function q(e){return Math.min(1,Math.max(0,e))}const gn=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#06b6d4","#84cc16","#f97316"],Hr={version:1,mode:"system",schemes:{light:{tokens:{color:{background:"hsl(0 0% 100%)",foreground:"hsl(240 5.9% 10%)",muted:"hsl(0 0% 98%)",mutedForeground:"hsl(240 3.8% 46.1%)",border:"hsl(240 5.9% 90%)",input:"hsl(240 5.9% 90%)",primary:"hsl(240 5.9% 10%)",primaryForeground:"hsl(0 0% 98%)",accent:"hsl(240 4.8% 95.9%)",accentForeground:"hsl(240 5.9% 10%)",card:"hsl(0 0% 100%)",cardForeground:"hsl(240 5.9% 10%)",positive:"#16a34a",negative:"#dc2626",warning:"#d97706",info:"#0284c7",destructive:"hsl(0 72.2% 50.6%)",destructiveForeground:"hsl(0 0% 98%)"},typography:{fontFamily:'Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',headingFontFamily:'Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',monoFontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace',baseFontSize:14,density:"comfortable"},radius:{control:5,card:5,table:5,badge:999},spacing:{dashboardPadding:16,gridGap:12,cardPadding:16,controlGap:8,tableCellX:12,tableCellY:8},shadow:{card:"0 1px 2px rgba(15, 23, 42, 0.08)",popover:"0 12px 32px rgba(15, 23, 42, 0.14)",focusRing:"0 0 0 2px rgba(37, 99, 235, 0.35)"}},components:{chart:{palette:gn},table:{density:"compact"}}},dark:{tokens:{color:{background:"hsl(240 10% 3.9%)",foreground:"hsl(0 0% 93%)",muted:"hsl(240 5.9% 10%)",mutedForeground:"hsl(240 5% 64.9%)",border:"hsl(240 3.7% 15.9%)",input:"hsl(240 3.7% 15.9%)",primary:"hsl(0 0% 98%)",primaryForeground:"hsl(240 5.9% 10%)",accent:"hsl(240 3.7% 15.9%)",accentForeground:"hsl(0 0% 93%)",card:"hsl(240 10% 3.9%)",cardForeground:"hsl(0 0% 93%)",positive:"#22c55e",negative:"#f87171",warning:"#fbbf24",info:"#38bdf8",destructive:"hsl(0 62.8% 30.6%)",destructiveForeground:"hsl(0 0% 93%)"},typography:{fontFamily:'Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',headingFontFamily:'Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',monoFontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace',baseFontSize:14,density:"comfortable"},radius:{control:5,card:5,table:5,badge:999},spacing:{dashboardPadding:16,gridGap:12,cardPadding:16,controlGap:8,tableCellX:12,tableCellY:8},shadow:{card:"0 1px 2px rgba(0, 0, 0, 0.3)",popover:"0 12px 32px rgba(0, 0, 0, 0.45)",focusRing:"0 0 0 2px rgba(96, 165, 250, 0.35)"}},components:{chart:{palette:gn},table:{density:"compact"}}}}},Sn=Lt(Hr);function Lt(e){if(typeof e!="object"||e===null||Object.isFrozen(e))return e;Object.freeze(e);for(const n of Object.values(e))Lt(n);return e}const Pn=1,Xr=new Set(["light","dark","system"]),Lr=new Set(["compact","comfortable","spacious"]),jr=Object.fromEntries(["background","foreground","muted","mutedForeground","border","input","primary","primaryForeground","accent","accentForeground","card","cardForeground","positive","negative","warning","info","destructive","destructiveForeground"].map(e=>[e,m])),Or={fontFamily:I,headingFontFamily:I,monoFontFamily:I,baseFontSize:oe,density:Ot},qr={control:P,card:P,table:P,badge:P},Yr={dashboardPadding:P,gridGap:P,cardPadding:P,controlGap:P,tableCellX:P,tableCellY:P},Dr={card:I,popover:I,focusRing:I},pe={background:m,foreground:m,borderColor:m,borderRadius:P,shadow:I,padding:P},Ur={...pe,toolbarBackground:m},Zr={palette:ta,background:m,foreground:m,gridColor:m,axisColor:m},Br={background:m,borderColor:m,borderRadius:P,shadow:I},fn={density:Ot,container:x(Br),header:x({background:m,foreground:m,dividerColor:m,fontWeight:oe,uppercase:dn,sticky:dn}),row:x({height:oe,dividerColor:m,zebra:dn,zebraBackground:m,hoverBackground:m,selectedBackground:m}),cell:x({paddingX:P,paddingY:P,verticalAlign:ea,wrap:na}),subtotal:x({background:m,foreground:m,fontWeight:oe}),grandTotal:x({background:m,foreground:m,fontWeight:oe,borderColor:m}),pagination:x({background:m,foreground:m,borderColor:m})},Vr={color:x(jr),typography:x(Or),radius:x(qr),spacing:x(Yr),shadow:x(Dr)},Gr={dashboard:x(pe),card:x(pe),interactive:x(Ur),chart:x(Zr),table:x(fn),pivotTable:x(fn),aggregateTable:x(fn),pagination:x(pe)},ft={tokens:x(Vr),components:x(Gr)},Jr={light:x(ft),dark:x(ft)},Wr={version:Kr,mode:Qr,schemes:x(Jr)};function jt(e){const n=[];return x(Wr)(e,"$",n),qt(e)&&!("version"in e)&&S(n,"$.version","invalid_version","version must be 1"),n.length>0?{success:!1,issues:n}:{success:!0,value:e,issues:[]}}function An(e){const n=jt(e);if(n.success)return;const t=n.issues[0];throw new Error(`Invalid AppearanceSpec at ${t.path}: ${t.message}`)}function x(e){return(n,t,a)=>{if(!qt(n)){S(a,t,"invalid_type","expected an object");return}for(const r of Object.keys(n)){const i=e[r],o=`${t}.${r}`;if(!i){S(a,o,"unsupported_field","field is not supported in AppearanceSpec V1");continue}i(n[r],o,a)}}}function Kr(e,n,t){e!==Pn&&S(t,n,"invalid_version","version must be 1")}function Qr(e,n,t){(typeof e!="string"||!Xr.has(e))&&S(t,n,"invalid_value","mode must be light, dark, or system")}function Ot(e,n,t){(typeof e!="string"||!Lr.has(e))&&S(t,n,"invalid_value","density must be compact, comfortable, or spacious")}function ea(e,n,t){e!=="top"&&e!=="middle"&&e!=="bottom"&&S(t,n,"invalid_value","verticalAlign must be top, middle, or bottom")}function na(e,n,t){e!=="wrap"&&e!=="nowrap"&&S(t,n,"invalid_value","wrap must be wrap or nowrap")}function dn(e,n,t){typeof e!="boolean"&&S(t,n,"invalid_type","expected a boolean")}function m(e,n,t){if(typeof e!="string"||e.trim()===""){S(t,n,"invalid_type","color must be a non-empty string");return}Tn(e)||S(t,n,"invalid_color","color must be a valid opaque CSS color")}function ta(e,n,t){if(!Array.isArray(e)){S(t,n,"invalid_type","expected an array of colors");return}if(e.length===0){S(t,n,"invalid_value","palette must contain at least one color");return}e.forEach((a,r)=>m(a,`${n}[${r}]`,t))}function I(e,n,t){(typeof e!="string"||e.trim()==="")&&S(t,n,"invalid_type","expected a non-empty string")}function oe(e,n,t){(typeof e!="number"||!Number.isFinite(e)||e<=0)&&S(t,n,"invalid_value","expected a positive number")}function P(e,n,t){(typeof e!="number"||!Number.isFinite(e)||e<0)&&S(t,n,"invalid_value","expected a non-negative number")}function S(e,n,t,a){e.push({path:n,code:t,message:a})}function qt(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;const n=Object.getPrototypeOf(e);return n===Object.prototype||n===null}function Yt(e,n=Sn){return An(e),Ut(n,e)}function Dt(e,n){return An(n),Ut(e,n)}function Ut(e,n){return Zt(e,n)}function Zt(e,n){if(n===void 0)return j(e);if(Array.isArray(e)||Array.isArray(n))return j(n);if(mn(e)&&mn(n)){const t=j(e);for(const[a,r]of Object.entries(n)){if(a==="version"){t[a]=r;continue}t[a]=a in t?Zt(t[a],r):j(r)}return t}return j(n)}function j(e){return Array.isArray(e)?e.map(n=>j(n)):mn(e)?Object.fromEntries(Object.entries(e).map(([n,t])=>[n,j(t)])):e}function mn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ra(e={}){const n=e.defaults??Sn;let t=Yt({version:Pn},n);for(const a of[e.organizationAppearance,e.tokenAppearance,e.reactAppearance])a&&(t=Dt(t,a));return t}exports.APPEARANCE_SPEC_VERSION=Pn;exports.SEMAPHOR_DEFAULT_APPEARANCE_SPEC=Sn;exports.SEMAPHOR_DEFAULT_CHART_PALETTE=gn;exports.assertValidAppearanceSpec=An;exports.compileColorToHslTriplet=Ir;exports.mergeAppearanceSpecs=Dt;exports.normalizeAppearanceSpec=Yt;exports.parseAppearanceColor=Tn;exports.parseRuntimeColor=Rr;exports.resolveAppearance=ra;exports.validateAppearanceSpec=jt;
|