@meridianjs/admin-dashboard 1.7.0 → 1.8.0
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/assets/{ProjectTimelinePage-Dj_CbP_5.js → ProjectTimelinePage-BldkS_kf.js} +1 -1
- package/dist/assets/{WorkspaceReportingPage-B3acX8jP.js → WorkspaceReportingPage-YSDy9h9h.js} +1 -1
- package/dist/assets/{index-BcVIc3S6.js → index-B8evgkuA.js} +4 -4
- package/dist/index.html +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProjectTimelinePage-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProjectTimelinePage-BldkS_kf.js","assets/vendor-query-CaIGp3JB.js","assets/vendor-react-Lycsri1F.js","assets/vendor-radix-CeigSZIw.js","assets/vendor-dnd-DuI-3XLF.js","assets/vendor-editor-BoEtjgAn.js","assets/WorkspaceReportingPage-YSDy9h9h.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var gP=Object.defineProperty;var vP=(e,t,r)=>t in e?gP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var hm=(e,t,r)=>vP(e,typeof t!="symbol"?t+"":t,r);import{j as a,u as Be,a as Se,b as be,R as yP,Q as bP,c as wP}from"./vendor-query-CaIGp3JB.js";import{a as Bp,c as W,r as h,b as jP,u as zt,d as Kl,N as wn,e as pt,L as qr,O as Yl,f as Gl,h as Xn,g as Fa,R as NP,i as Ic,j as kP,k as Ye,B as SP}from"./vendor-react-Lycsri1F.js";import{C as Dj,R as CP,T as _P,P as MP,S as Wp,a as Tj,O as gi,b as Vl,c as vi,d as Du,e as uo,D as fo,f as Xl,g as Ij,h as Rj,i as OP,j as $j,I as zj,k as Lj,l as Fj,m as Bj,L as Wj,n as Uj,o as PP,p as EP,q as qj,r as Hj,F as Kj,u as Wi,t as Ns,s as AP,v as Yj,w as Gj,x as DP,y as Vj,z as Xj,A as TP,B as Qj,V as IP,E as Zj,G as Jj,H as RP,J as $P,K as e1,M as zP,N as LP,Q as FP,U as t1,W as BP,X as WP,Y as r1,Z as Tu,_ as UP,$ as Fs,a0 as qP,a1 as HP,a2 as n1,a3 as KP,a4 as YP,a5 as a1,a6 as GP,a7 as VP,a8 as s1,a9 as XP,aa as QP,ab as ZP,ac as JP,ad as eE,ae as tE,af as rE,ag as nE,ah as aE,ai as sE,aj as iE,ak as i1,al as oE,am as lE,an as cE,ao as dE,ap as uE,aq as fE}from"./vendor-radix-CeigSZIw.js";import{u as o1,a as Up,P as l1,D as xl,S as qp,h as c1,b as pd,c as Hp,C as Kp,d as mE,v as hE,r as pE,p as xE,e as gE,f as vE,M as yE,g as d1}from"./vendor-dnd-DuI-3XLF.js";import{P as u1,a as bE,D as wE,b as jE,e as NE,N as kE,c as SE,d as CE,m as Rc,E as _E,u as f1,i as m1,f as h1,g as p1,h as x1,j as ME,k as OE,w as PE}from"./vendor-editor-BoEtjgAn.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(s){if(s.ep)return;s.ep=!0;const i=r(s);fetch(s.href,i)}})();var g1,Fv=Bp;g1=Fv.createRoot,Fv.hydrateRoot;const EE="modulepreload",AE=function(e){return"/"+e},Bv={},v1=function(t,r,n){let s=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(r.map(c=>{if(c=AE(c),c in Bv)return;Bv[c]=!0;const d=c.endsWith(".css"),u=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const f=document.createElement("link");if(f.rel=d?"stylesheet":EE,d||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),d)return new Promise((m,p)=>{f.addEventListener("load",m),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return s.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})};var DE=function(){return null},TE=e=>{switch(e){case"success":return $E;case"info":return LE;case"warning":return zE;case"error":return FE;default:return null}},IE=Array(12).fill(0),RE=({visible:e,className:t})=>W.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},W.createElement("div",{className:"sonner-spinner"},IE.map((r,n)=>W.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),$E=W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},W.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),zE=W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},W.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),LE=W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},W.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),FE=W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},W.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),BE=W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},W.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),W.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),WE=()=>{let[e,t]=W.useState(document.hidden);return W.useEffect(()=>{let r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e},yh=1,UE=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:r,...n}=e,s=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:yh++,i=this.toasts.find(l=>l.id===s),o=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),i?this.toasts=this.toasts.map(l=>l.id===s?(this.publish({...l,...e,id:s,title:r}),{...l,...e,id:s,dismissible:o,title:r}):l):this.addToast({title:r,...n,dismissible:o,id:s}),s},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(r=>r({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let r;t.loading!==void 0&&(r=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let n=e instanceof Promise?e:e(),s=r!==void 0,i,o=n.then(async c=>{if(i=["resolve",c],W.isValidElement(c))s=!1,this.create({id:r,type:"default",message:c});else if(HE(c)&&!c.ok){s=!1;let d=typeof t.error=="function"?await t.error(`HTTP error! status: ${c.status}`):t.error,u=typeof t.description=="function"?await t.description(`HTTP error! status: ${c.status}`):t.description;this.create({id:r,type:"error",message:d,description:u})}else if(t.success!==void 0){s=!1;let d=typeof t.success=="function"?await t.success(c):t.success,u=typeof t.description=="function"?await t.description(c):t.description;this.create({id:r,type:"success",message:d,description:u})}}).catch(async c=>{if(i=["reject",c],t.error!==void 0){s=!1;let d=typeof t.error=="function"?await t.error(c):t.error,u=typeof t.description=="function"?await t.description(c):t.description;this.create({id:r,type:"error",message:d,description:u})}}).finally(()=>{var c;s&&(this.dismiss(r),r=void 0),(c=t.finally)==null||c.call(t)}),l=()=>new Promise((c,d)=>o.then(()=>i[0]==="reject"?d(i[1]):c(i[1])).catch(d));return typeof r!="string"&&typeof r!="number"?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(e,t)=>{let r=(t==null?void 0:t.id)||yh++;return this.create({jsx:e(r),id:r,...t}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Lr=new UE,qE=(e,t)=>{let r=(t==null?void 0:t.id)||yh++;return Lr.addToast({title:e,...t,id:r}),r},HE=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",KE=qE,YE=()=>Lr.toasts,GE=()=>Lr.getActiveToasts(),H=Object.assign(KE,{success:Lr.success,info:Lr.info,warning:Lr.warning,error:Lr.error,custom:Lr.custom,message:Lr.message,promise:Lr.promise,dismiss:Lr.dismiss,loading:Lr.loading},{getHistory:YE,getToasts:GE});function VE(e,{insertAt:t}={}){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t==="top"&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}VE(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
|
|
3
3
|
`);function $c(e){return e.label!==void 0}var XE=3,QE="32px",ZE="16px",Wv=4e3,JE=356,eA=14,tA=20,rA=200;function yn(...e){return e.filter(Boolean).join(" ")}function nA(e){let[t,r]=e.split("-"),n=[];return t&&n.push(t),r&&n.push(r),n}var aA=e=>{var t,r,n,s,i,o,l,c,d,u,f;let{invert:m,toast:p,unstyled:x,interacting:g,setHeights:v,visibleToasts:y,heights:j,index:N,toasts:w,expanded:k,removeToast:b,defaultRichColors:C,closeButton:_,style:S,cancelButtonStyle:I,actionButtonStyle:A,className:O="",descriptionClassName:L="",duration:F,position:X,gap:T,loadingIcon:G,expandByDefault:re,classNames:J,icons:P,closeButtonAriaLabel:M="Close toast",pauseWhenPageIsHidden:R}=e,[q,$]=W.useState(null),[K,D]=W.useState(null),[E,Z]=W.useState(!1),[B,Y]=W.useState(!1),[ae,ee]=W.useState(!1),[se,V]=W.useState(!1),[ie,pe]=W.useState(!1),[ue,ve]=W.useState(0),[Q,ge]=W.useState(0),De=W.useRef(p.duration||F||Wv),Ue=W.useRef(null),Fe=W.useRef(null),Ve=N===0,ut=N+1<=y,Ke=p.type,Ze=p.dismissible!==!1,tr=p.className||"",Ir=p.descriptionClassName||"",rr=W.useMemo(()=>j.findIndex(de=>de.toastId===p.id)||0,[j,p.id]),yr=W.useMemo(()=>{var de;return(de=p.closeButton)!=null?de:_},[p.closeButton,_]),nr=W.useMemo(()=>p.duration||F||Wv,[p.duration,F]),yt=W.useRef(0),Lt=W.useRef(0),Kt=W.useRef(0),ar=W.useRef(null),[$n,fa]=X.split("-"),Oe=W.useMemo(()=>j.reduce((de,_e,Te)=>Te>=rr?de:de+_e.height,0),[j,rr]),xe=WE(),Ne=p.invert||m,he=Ke==="loading";Lt.current=W.useMemo(()=>rr*T+Oe,[rr,Oe]),W.useEffect(()=>{De.current=nr},[nr]),W.useEffect(()=>{Z(!0)},[]),W.useEffect(()=>{let de=Fe.current;if(de){let _e=de.getBoundingClientRect().height;return ge(_e),v(Te=>[{toastId:p.id,height:_e,position:p.position},...Te]),()=>v(Te=>Te.filter(bt=>bt.toastId!==p.id))}},[v,p.id]),W.useLayoutEffect(()=>{if(!E)return;let de=Fe.current,_e=de.style.height;de.style.height="auto";let Te=de.getBoundingClientRect().height;de.style.height=_e,ge(Te),v(bt=>bt.find(rt=>rt.toastId===p.id)?bt.map(rt=>rt.toastId===p.id?{...rt,height:Te}:rt):[{toastId:p.id,height:Te,position:p.position},...bt])},[E,p.title,p.description,v,p.id]);let ye=W.useCallback(()=>{Y(!0),ve(Lt.current),v(de=>de.filter(_e=>_e.toastId!==p.id)),setTimeout(()=>{b(p)},rA)},[p,b,v,Lt]);W.useEffect(()=>{if(p.promise&&Ke==="loading"||p.duration===1/0||p.type==="loading")return;let de;return k||g||R&&xe?(()=>{if(Kt.current<yt.current){let _e=new Date().getTime()-yt.current;De.current=De.current-_e}Kt.current=new Date().getTime()})():De.current!==1/0&&(yt.current=new Date().getTime(),de=setTimeout(()=>{var _e;(_e=p.onAutoClose)==null||_e.call(p,p),ye()},De.current)),()=>clearTimeout(de)},[k,g,p,Ke,R,xe,ye]),W.useEffect(()=>{p.delete&&ye()},[ye,p.delete]);function Xe(){var de,_e,Te;return P!=null&&P.loading?W.createElement("div",{className:yn(J==null?void 0:J.loader,(de=p==null?void 0:p.classNames)==null?void 0:de.loader,"sonner-loader"),"data-visible":Ke==="loading"},P.loading):G?W.createElement("div",{className:yn(J==null?void 0:J.loader,(_e=p==null?void 0:p.classNames)==null?void 0:_e.loader,"sonner-loader"),"data-visible":Ke==="loading"},G):W.createElement(RE,{className:yn(J==null?void 0:J.loader,(Te=p==null?void 0:p.classNames)==null?void 0:Te.loader),visible:Ke==="loading"})}return W.createElement("li",{tabIndex:0,ref:Fe,className:yn(O,tr,J==null?void 0:J.toast,(t=p==null?void 0:p.classNames)==null?void 0:t.toast,J==null?void 0:J.default,J==null?void 0:J[Ke],(r=p==null?void 0:p.classNames)==null?void 0:r[Ke]),"data-sonner-toast":"","data-rich-colors":(n=p.richColors)!=null?n:C,"data-styled":!(p.jsx||p.unstyled||x),"data-mounted":E,"data-promise":!!p.promise,"data-swiped":ie,"data-removed":B,"data-visible":ut,"data-y-position":$n,"data-x-position":fa,"data-index":N,"data-front":Ve,"data-swiping":ae,"data-dismissible":Ze,"data-type":Ke,"data-invert":Ne,"data-swipe-out":se,"data-swipe-direction":K,"data-expanded":!!(k||re&&E),style:{"--index":N,"--toasts-before":N,"--z-index":w.length-N,"--offset":`${B?ue:Lt.current}px`,"--initial-height":re?"auto":`${Q}px`,...S,...p.style},onDragEnd:()=>{ee(!1),$(null),ar.current=null},onPointerDown:de=>{he||!Ze||(Ue.current=new Date,ve(Lt.current),de.target.setPointerCapture(de.pointerId),de.target.tagName!=="BUTTON"&&(ee(!0),ar.current={x:de.clientX,y:de.clientY}))},onPointerUp:()=>{var de,_e,Te,bt;if(se||!Ze)return;ar.current=null;let rt=Number(((de=Fe.current)==null?void 0:de.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),nt=Number(((_e=Fe.current)==null?void 0:_e.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),br=new Date().getTime()-((Te=Ue.current)==null?void 0:Te.getTime()),sr=q==="x"?rt:nt,zn=Math.abs(sr)/br;if(Math.abs(sr)>=tA||zn>.11){ve(Lt.current),(bt=p.onDismiss)==null||bt.call(p,p),D(q==="x"?rt>0?"right":"left":nt>0?"down":"up"),ye(),V(!0),pe(!1);return}ee(!1),$(null)},onPointerMove:de=>{var _e,Te,bt,rt;if(!ar.current||!Ze||((_e=window.getSelection())==null?void 0:_e.toString().length)>0)return;let nt=de.clientY-ar.current.y,br=de.clientX-ar.current.x,sr=(Te=e.swipeDirections)!=null?Te:nA(X);!q&&(Math.abs(br)>1||Math.abs(nt)>1)&&$(Math.abs(br)>Math.abs(nt)?"x":"y");let zn={x:0,y:0};q==="y"?(sr.includes("top")||sr.includes("bottom"))&&(sr.includes("top")&&nt<0||sr.includes("bottom")&&nt>0)&&(zn.y=nt):q==="x"&&(sr.includes("left")||sr.includes("right"))&&(sr.includes("left")&&br<0||sr.includes("right")&&br>0)&&(zn.x=br),(Math.abs(zn.x)>0||Math.abs(zn.y)>0)&&pe(!0),(bt=Fe.current)==null||bt.style.setProperty("--swipe-amount-x",`${zn.x}px`),(rt=Fe.current)==null||rt.style.setProperty("--swipe-amount-y",`${zn.y}px`)}},yr&&!p.jsx?W.createElement("button",{"aria-label":M,"data-disabled":he,"data-close-button":!0,onClick:he||!Ze?()=>{}:()=>{var de;ye(),(de=p.onDismiss)==null||de.call(p,p)},className:yn(J==null?void 0:J.closeButton,(s=p==null?void 0:p.classNames)==null?void 0:s.closeButton)},(i=P==null?void 0:P.close)!=null?i:BE):null,p.jsx||h.isValidElement(p.title)?p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title:W.createElement(W.Fragment,null,Ke||p.icon||p.promise?W.createElement("div",{"data-icon":"",className:yn(J==null?void 0:J.icon,(o=p==null?void 0:p.classNames)==null?void 0:o.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||Xe():null,p.type!=="loading"?p.icon||(P==null?void 0:P[Ke])||TE(Ke):null):null,W.createElement("div",{"data-content":"",className:yn(J==null?void 0:J.content,(l=p==null?void 0:p.classNames)==null?void 0:l.content)},W.createElement("div",{"data-title":"",className:yn(J==null?void 0:J.title,(c=p==null?void 0:p.classNames)==null?void 0:c.title)},typeof p.title=="function"?p.title():p.title),p.description?W.createElement("div",{"data-description":"",className:yn(L,Ir,J==null?void 0:J.description,(d=p==null?void 0:p.classNames)==null?void 0:d.description)},typeof p.description=="function"?p.description():p.description):null),h.isValidElement(p.cancel)?p.cancel:p.cancel&&$c(p.cancel)?W.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||I,onClick:de=>{var _e,Te;$c(p.cancel)&&Ze&&((Te=(_e=p.cancel).onClick)==null||Te.call(_e,de),ye())},className:yn(J==null?void 0:J.cancelButton,(u=p==null?void 0:p.classNames)==null?void 0:u.cancelButton)},p.cancel.label):null,h.isValidElement(p.action)?p.action:p.action&&$c(p.action)?W.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||A,onClick:de=>{var _e,Te;$c(p.action)&&((Te=(_e=p.action).onClick)==null||Te.call(_e,de),!de.defaultPrevented&&ye())},className:yn(J==null?void 0:J.actionButton,(f=p==null?void 0:p.classNames)==null?void 0:f.actionButton)},p.action.label):null))};function Uv(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function sA(e,t){let r={};return[e,t].forEach((n,s)=>{let i=s===1,o=i?"--mobile-offset":"--offset",l=i?ZE:QE;function c(d){["top","right","bottom","left"].forEach(u=>{r[`${o}-${u}`]=typeof d=="number"?`${d}px`:d})}typeof n=="number"||typeof n=="string"?c(n):typeof n=="object"?["top","right","bottom","left"].forEach(d=>{n[d]===void 0?r[`${o}-${d}`]=l:r[`${o}-${d}`]=typeof n[d]=="number"?`${n[d]}px`:n[d]}):c(l)}),r}var iA=h.forwardRef(function(e,t){let{invert:r,position:n="bottom-right",hotkey:s=["altKey","KeyT"],expand:i,closeButton:o,className:l,offset:c,mobileOffset:d,theme:u="light",richColors:f,duration:m,style:p,visibleToasts:x=XE,toastOptions:g,dir:v=Uv(),gap:y=eA,loadingIcon:j,icons:N,containerAriaLabel:w="Notifications",pauseWhenPageIsHidden:k}=e,[b,C]=W.useState([]),_=W.useMemo(()=>Array.from(new Set([n].concat(b.filter(R=>R.position).map(R=>R.position)))),[b,n]),[S,I]=W.useState([]),[A,O]=W.useState(!1),[L,F]=W.useState(!1),[X,T]=W.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),G=W.useRef(null),re=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),J=W.useRef(null),P=W.useRef(!1),M=W.useCallback(R=>{C(q=>{var $;return($=q.find(K=>K.id===R.id))!=null&&$.delete||Lr.dismiss(R.id),q.filter(({id:K})=>K!==R.id)})},[]);return W.useEffect(()=>Lr.subscribe(R=>{if(R.dismiss){C(q=>q.map($=>$.id===R.id?{...$,delete:!0}:$));return}setTimeout(()=>{jP.flushSync(()=>{C(q=>{let $=q.findIndex(K=>K.id===R.id);return $!==-1?[...q.slice(0,$),{...q[$],...R},...q.slice($+1)]:[R,...q]})})})}),[]),W.useEffect(()=>{if(u!=="system"){T(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?T("dark"):T("light")),typeof window>"u")return;let R=window.matchMedia("(prefers-color-scheme: dark)");try{R.addEventListener("change",({matches:q})=>{T(q?"dark":"light")})}catch{R.addListener(({matches:$})=>{try{T($?"dark":"light")}catch(K){console.error(K)}})}},[u]),W.useEffect(()=>{b.length<=1&&O(!1)},[b]),W.useEffect(()=>{let R=q=>{var $,K;s.every(D=>q[D]||q.code===D)&&(O(!0),($=G.current)==null||$.focus()),q.code==="Escape"&&(document.activeElement===G.current||(K=G.current)!=null&&K.contains(document.activeElement))&&O(!1)};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[s]),W.useEffect(()=>{if(G.current)return()=>{J.current&&(J.current.focus({preventScroll:!0}),J.current=null,P.current=!1)}},[G.current]),W.createElement("section",{ref:t,"aria-label":`${w} ${re}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},_.map((R,q)=>{var $;let[K,D]=R.split("-");return b.length?W.createElement("ol",{key:R,dir:v==="auto"?Uv():v,tabIndex:-1,ref:G,className:l,"data-sonner-toaster":!0,"data-theme":X,"data-y-position":K,"data-lifted":A&&b.length>1&&!i,"data-x-position":D,style:{"--front-toast-height":`${(($=S[0])==null?void 0:$.height)||0}px`,"--width":`${JE}px`,"--gap":`${y}px`,...p,...sA(c,d)},onBlur:E=>{P.current&&!E.currentTarget.contains(E.relatedTarget)&&(P.current=!1,J.current&&(J.current.focus({preventScroll:!0}),J.current=null))},onFocus:E=>{E.target instanceof HTMLElement&&E.target.dataset.dismissible==="false"||P.current||(P.current=!0,J.current=E.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{L||O(!1)},onDragEnd:()=>O(!1),onPointerDown:E=>{E.target instanceof HTMLElement&&E.target.dataset.dismissible==="false"||F(!0)},onPointerUp:()=>F(!1)},b.filter(E=>!E.position&&q===0||E.position===R).map((E,Z)=>{var B,Y;return W.createElement(aA,{key:E.id,icons:N,index:Z,toast:E,defaultRichColors:f,duration:(B=g==null?void 0:g.duration)!=null?B:m,className:g==null?void 0:g.className,descriptionClassName:g==null?void 0:g.descriptionClassName,invert:r,visibleToasts:x,closeButton:(Y=g==null?void 0:g.closeButton)!=null?Y:o,interacting:L,position:R,style:g==null?void 0:g.style,unstyled:g==null?void 0:g.unstyled,classNames:g==null?void 0:g.classNames,cancelButtonStyle:g==null?void 0:g.cancelButtonStyle,actionButtonStyle:g==null?void 0:g.actionButtonStyle,removeToast:M,toasts:b.filter(ae=>ae.position==E.position),heights:S.filter(ae=>ae.position==E.position),setHeights:I,expandByDefault:i,gap:y,loadingIcon:j,expanded:A,pauseWhenPageIsHidden:k,swipeDirections:e.swipeDirections})})):null}))}),oA=(e,t,r,n,s,i,o,l)=>{let c=document.documentElement,d=["light","dark"];function u(p){(Array.isArray(e)?e:[e]).forEach(x=>{let g=x==="class",v=g&&i?s.map(y=>i[y]||y):s;g?(c.classList.remove(...v),c.classList.add(i&&i[p]?i[p]:p)):c.setAttribute(x,p)}),f(p)}function f(p){l&&d.includes(p)&&(c.style.colorScheme=p)}function m(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(n)u(n);else try{let p=localStorage.getItem(t)||r,x=o&&p==="system"?m():p;u(x)}catch{}},qv=["light","dark"],y1="(prefers-color-scheme: dark)",lA=typeof window>"u",Yp=h.createContext(void 0),cA={setTheme:e=>{},themes:[]},dA=()=>{var e;return(e=h.useContext(Yp))!=null?e:cA},uA=e=>h.useContext(Yp)?h.createElement(h.Fragment,null,e.children):h.createElement(mA,{...e}),fA=["light","dark"],mA=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:r=!0,enableColorScheme:n=!0,storageKey:s="theme",themes:i=fA,defaultTheme:o=r?"system":"light",attribute:l="data-theme",value:c,children:d,nonce:u,scriptProps:f})=>{let[m,p]=h.useState(()=>pA(s,o)),[x,g]=h.useState(()=>m==="system"?pm():m),v=c?Object.values(c):i,y=h.useCallback(k=>{let b=k;if(!b)return;k==="system"&&r&&(b=pm());let C=c?c[b]:b,_=t?xA(u):null,S=document.documentElement,I=A=>{A==="class"?(S.classList.remove(...v),C&&S.classList.add(C)):A.startsWith("data-")&&(C?S.setAttribute(A,C):S.removeAttribute(A))};if(Array.isArray(l)?l.forEach(I):I(l),n){let A=qv.includes(o)?o:null,O=qv.includes(b)?b:A;S.style.colorScheme=O}_==null||_()},[u]),j=h.useCallback(k=>{let b=typeof k=="function"?k(m):k;p(b);try{localStorage.setItem(s,b)}catch{}},[m]),N=h.useCallback(k=>{let b=pm(k);g(b),m==="system"&&r&&!e&&y("system")},[m,e]);h.useEffect(()=>{let k=window.matchMedia(y1);return k.addListener(N),N(k),()=>k.removeListener(N)},[N]),h.useEffect(()=>{let k=b=>{b.key===s&&(b.newValue?p(b.newValue):j(o))};return window.addEventListener("storage",k),()=>window.removeEventListener("storage",k)},[j]),h.useEffect(()=>{y(e??m)},[e,m]);let w=h.useMemo(()=>({theme:m,setTheme:j,forcedTheme:e,resolvedTheme:m==="system"?x:m,themes:r?[...i,"system"]:i,systemTheme:r?x:void 0}),[m,j,e,x,r,i]);return h.createElement(Yp.Provider,{value:w},h.createElement(hA,{forcedTheme:e,storageKey:s,attribute:l,enableSystem:r,enableColorScheme:n,defaultTheme:o,value:c,themes:i,nonce:u,scriptProps:f}),d)},hA=h.memo(({forcedTheme:e,storageKey:t,attribute:r,enableSystem:n,enableColorScheme:s,defaultTheme:i,value:o,themes:l,nonce:c,scriptProps:d})=>{let u=JSON.stringify([r,t,i,e,l,o,n,s]).slice(1,-1);return h.createElement("script",{...d,suppressHydrationWarning:!0,nonce:typeof window>"u"?c:"",dangerouslySetInnerHTML:{__html:`(${oA.toString()})(${u})`}})}),pA=(e,t)=>{if(lA)return;let r;try{r=localStorage.getItem(e)||void 0}catch{}return r||t},xA=e=>{let t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},pm=e=>(e||(e=window.matchMedia(y1)),e.matches?"dark":"light");function gA({children:e}){return a.jsx(uA,{attribute:"class",defaultTheme:"system",enableSystem:!0,disableTransitionOnChange:!0,children:e})}const b1=h.createContext(null),Os="meridian_token",zo="meridian_user",zc="meridian_workspace";function Hv(e){try{const t=e.split(".")[1],r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(r));return{roles:Array.isArray(n.roles)?n.roles:[],permissions:Array.isArray(n.permissions)?n.permissions:[]}}catch{return{roles:[],permissions:[]}}}function vA({children:e}){const[t,r]=h.useState(()=>{try{const f=localStorage.getItem(zo),m=localStorage.getItem(Os);if(!f)return null;const p=JSON.parse(f),{roles:x,permissions:g}=m?Hv(m):{roles:[],permissions:[]};return p.roles=x,p.permissions=g,p}catch{return null}}),[n,s]=h.useState(()=>{const f=localStorage.getItem(Os),m=localStorage.getItem(zo);return f&&!m?(localStorage.removeItem(Os),null):f}),[i,o]=h.useState(()=>{try{const f=localStorage.getItem(zc);return f?JSON.parse(f):null}catch{return null}}),l=(f,m)=>{const{roles:p,permissions:x}=Hv(m),g={...f,roles:p,permissions:x};r(g),s(m),localStorage.setItem(Os,m),localStorage.setItem(zo,JSON.stringify(g))},c=()=>{const f=localStorage.getItem(Os);f&&fetch("/auth/logout",{method:"POST",headers:{Authorization:`Bearer ${f}`,"Content-Type":"application/json"}}).catch(()=>{}),r(null),s(null),o(null),localStorage.removeItem(Os),localStorage.removeItem(zo),localStorage.removeItem(zc)};h.useEffect(()=>{const f=()=>{localStorage.getItem(Os)&&c()};return window.addEventListener("meridian:unauthorized",f),()=>window.removeEventListener("meridian:unauthorized",f)},[]);const d=f=>{o(f),f?localStorage.setItem(zc,JSON.stringify(f)):localStorage.removeItem(zc)},u=f=>{r(m=>{if(!m)return m;const p={...m,...f};return localStorage.setItem(zo,JSON.stringify(p)),p})};return a.jsx(b1.Provider,{value:{user:t,token:n,workspace:i,isAuthenticated:!!n&&!!t,login:l,logout:c,setWorkspace:d,updateLocalUser:u},children:e})}function Ie(){const e=h.useContext(b1);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const w1=h.createContext(null);function yA({children:e}){const[t,r]=h.useState(!1);return h.useEffect(()=>{const n=s=>{(s.metaKey||s.ctrlKey)&&s.key==="k"&&(s.preventDefault(),r(i=>!i))};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[]),a.jsx(w1.Provider,{value:{open:t,setOpen:r,toggle:()=>r(n=>!n)},children:e})}function Gp(){const e=h.useContext(w1);if(!e)throw new Error("useCommandPalette must be used within CommandPaletteProvider");return e}function j1(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=j1(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function it(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=j1(e))&&(n&&(n+=" "),n+=t);return n}const Vp="-",bA=e=>{const t=jA(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(Vp);return l[0]===""&&l.length!==1&&l.shift(),N1(l,t)||wA(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},N1=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),s=n?N1(e.slice(1),n):void 0;if(s)return s;if(t.validators.length===0)return;const i=e.join(Vp);return(o=t.validators.find(({validator:l})=>l(i)))==null?void 0:o.classGroupId},Kv=/^\[(.+)\]$/,wA=e=>{if(Kv.test(e)){const t=Kv.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},jA=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return kA(Object.entries(e.classGroups),r).forEach(([i,o])=>{bh(o,n,i,t)}),n},bh=(e,t,r,n)=>{e.forEach(s=>{if(typeof s=="string"){const i=s===""?t:Yv(t,s);i.classGroupId=r;return}if(typeof s=="function"){if(NA(s)){bh(s(n),t,r,n);return}t.validators.push({validator:s,classGroupId:r});return}Object.entries(s).forEach(([i,o])=>{bh(o,Yv(t,i),r,n)})})},Yv=(e,t)=>{let r=e;return t.split(Vp).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},NA=e=>e.isThemeGetter,kA=(e,t)=>t?e.map(([r,n])=>{const s=n.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,l])=>[t+o,l])):i);return[r,s]}):e,SA=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const s=(i,o)=>{r.set(i,o),t++,t>e&&(t=0,n=r,r=new Map)};return{get(i){let o=r.get(i);if(o!==void 0)return o;if((o=n.get(i))!==void 0)return s(i,o),o},set(i,o){r.has(i)?r.set(i,o):s(i,o)}}},k1="!",CA=e=>{const{separator:t,experimentalParseClassName:r}=e,n=t.length===1,s=t[0],i=t.length,o=l=>{const c=[];let d=0,u=0,f;for(let v=0;v<l.length;v++){let y=l[v];if(d===0){if(y===s&&(n||l.slice(v,v+i)===t)){c.push(l.slice(u,v)),u=v+i;continue}if(y==="/"){f=v;continue}}y==="["?d++:y==="]"&&d--}const m=c.length===0?l:l.substring(u),p=m.startsWith(k1),x=p?m.substring(1):m,g=f&&f>u?f-u:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:x,maybePostfixModifierPosition:g}};return r?l=>r({className:l,parseClassName:o}):o},_A=e=>{if(e.length<=1)return e;const t=[];let r=[];return e.forEach(n=>{n[0]==="["?(t.push(...r.sort(),n),r=[]):r.push(n)}),t.push(...r.sort()),t},MA=e=>({cache:SA(e.cacheSize),parseClassName:CA(e),...bA(e)}),OA=/\s+/,PA=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s}=t,i=[],o=e.trim().split(OA);let l="";for(let c=o.length-1;c>=0;c-=1){const d=o[c],{modifiers:u,hasImportantModifier:f,baseClassName:m,maybePostfixModifierPosition:p}=r(d);let x=!!p,g=n(x?m.substring(0,p):m);if(!g){if(!x){l=d+(l.length>0?" "+l:l);continue}if(g=n(m),!g){l=d+(l.length>0?" "+l:l);continue}x=!1}const v=_A(u).join(":"),y=f?v+k1:v,j=y+g;if(i.includes(j))continue;i.push(j);const N=s(g,x);for(let w=0;w<N.length;++w){const k=N[w];i.push(y+k)}l=d+(l.length>0?" "+l:l)}return l};function EA(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=S1(t))&&(n&&(n+=" "),n+=r);return n}const S1=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=S1(e[n]))&&(r&&(r+=" "),r+=t);return r};function AA(e,...t){let r,n,s,i=o;function o(c){const d=t.reduce((u,f)=>f(u),e());return r=MA(d),n=r.cache.get,s=r.cache.set,i=l,l(c)}function l(c){const d=n(c);if(d)return d;const u=PA(c,r);return s(c,u),u}return function(){return i(EA.apply(null,arguments))}}const ft=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},C1=/^\[(?:([a-z-]+):)?(.+)\]$/i,DA=/^\d+\/\d+$/,TA=new Set(["px","full","screen"]),IA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,RA=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,$A=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,zA=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,LA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,pa=e=>Ui(e)||TA.has(e)||DA.test(e),rs=e=>mo(e,"length",YA),Ui=e=>!!e&&!Number.isNaN(Number(e)),xm=e=>mo(e,"number",Ui),Lo=e=>!!e&&Number.isInteger(Number(e)),FA=e=>e.endsWith("%")&&Ui(e.slice(0,-1)),Re=e=>C1.test(e),ns=e=>IA.test(e),BA=new Set(["length","size","percentage"]),WA=e=>mo(e,BA,_1),UA=e=>mo(e,"position",_1),qA=new Set(["image","url"]),HA=e=>mo(e,qA,VA),KA=e=>mo(e,"",GA),Fo=()=>!0,mo=(e,t,r)=>{const n=C1.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},YA=e=>RA.test(e)&&!$A.test(e),_1=()=>!1,GA=e=>zA.test(e),VA=e=>LA.test(e),XA=()=>{const e=ft("colors"),t=ft("spacing"),r=ft("blur"),n=ft("brightness"),s=ft("borderColor"),i=ft("borderRadius"),o=ft("borderSpacing"),l=ft("borderWidth"),c=ft("contrast"),d=ft("grayscale"),u=ft("hueRotate"),f=ft("invert"),m=ft("gap"),p=ft("gradientColorStops"),x=ft("gradientColorStopPositions"),g=ft("inset"),v=ft("margin"),y=ft("opacity"),j=ft("padding"),N=ft("saturate"),w=ft("scale"),k=ft("sepia"),b=ft("skew"),C=ft("space"),_=ft("translate"),S=()=>["auto","contain","none"],I=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto",Re,t],O=()=>[Re,t],L=()=>["",pa,rs],F=()=>["auto",Ui,Re],X=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],T=()=>["solid","dashed","dotted","double","none"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],re=()=>["start","end","center","between","around","evenly","stretch"],J=()=>["","0",Re],P=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[Ui,Re];return{cacheSize:500,separator:":",theme:{colors:[Fo],spacing:[pa,rs],blur:["none","",ns,Re],brightness:M(),borderColor:[e],borderRadius:["none","","full",ns,Re],borderSpacing:O(),borderWidth:L(),contrast:M(),grayscale:J(),hueRotate:M(),invert:J(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[FA,rs],inset:A(),margin:A(),opacity:M(),padding:O(),saturate:M(),scale:M(),sepia:J(),skew:M(),space:O(),translate:O()},classGroups:{aspect:[{aspect:["auto","square","video",Re]}],container:["container"],columns:[{columns:[ns]}],"break-after":[{"break-after":P()}],"break-before":[{"break-before":P()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...X(),Re]}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Lo,Re]}],basis:[{basis:A()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Re]}],grow:[{grow:J()}],shrink:[{shrink:J()}],order:[{order:["first","last","none",Lo,Re]}],"grid-cols":[{"grid-cols":[Fo]}],"col-start-end":[{col:["auto",{span:["full",Lo,Re]},Re]}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":[Fo]}],"row-start-end":[{row:["auto",{span:[Lo,Re]},Re]}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Re]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Re]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...re()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...re(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...re(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[j]}],px:[{px:[j]}],py:[{py:[j]}],ps:[{ps:[j]}],pe:[{pe:[j]}],pt:[{pt:[j]}],pr:[{pr:[j]}],pb:[{pb:[j]}],pl:[{pl:[j]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[C]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[C]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Re,t]}],"min-w":[{"min-w":[Re,t,"min","max","fit"]}],"max-w":[{"max-w":[Re,t,"none","full","min","max","fit","prose",{screen:[ns]},ns]}],h:[{h:[Re,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Re,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Re,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Re,t,"auto","min","max","fit"]}],"font-size":[{text:["base",ns,rs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",xm]}],"font-family":[{font:[Fo]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Re]}],"line-clamp":[{"line-clamp":["none",Ui,xm]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",pa,Re]}],"list-image":[{"list-image":["none",Re]}],"list-style-type":[{list:["none","disc","decimal",Re]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...T(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",pa,rs]}],"underline-offset":[{"underline-offset":["auto",pa,Re]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Re]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Re]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...X(),UA]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",WA]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},HA]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[...T(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:T()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...T()]}],"outline-offset":[{"outline-offset":[pa,Re]}],"outline-w":[{outline:[pa,rs]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:L()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[pa,rs]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",ns,KA]}],"shadow-color":[{shadow:[Fo]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...G(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":G()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",ns,Re]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[f]}],saturate:[{saturate:[N]}],sepia:[{sepia:[k]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[N]}],"backdrop-sepia":[{"backdrop-sepia":[k]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Re]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",Re]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",Re]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[Lo,Re]}],"translate-x":[{"translate-x":[_]}],"translate-y":[{"translate-y":[_]}],"skew-x":[{"skew-x":[b]}],"skew-y":[{"skew-y":[b]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Re]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Re]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Re]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[pa,rs,xm]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},QA=AA(XA);function z(...e){return QA(it(e))}const Iu=MP,Qn=CP,Zn=_P,_n=h.forwardRef(({className:e,sideOffset:t=4,...r},n)=>a.jsx(Dj,{ref:n,sideOffset:t,className:z("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r}));_n.displayName=Dj.displayName;const M1=h.createContext([]);function ZA({widgets:e,children:t}){return W.createElement(M1.Provider,{value:e},t)}function JA(e){return h.useContext(M1).filter(r=>r.zone===e).map(r=>r.component)}var Ej;const Gi=((Ej=window.__MERIDIAN_CONFIG__)==null?void 0:Ej.apiUrl)??void 0??"";class Xp extends Error{constructor(t,r,n){super(r),this.status=t,this.data=n,this.name="ApiError"}}function O1(){return localStorage.getItem("meridian_token")}async function Bo(e,t={}){var i;const r=O1(),n={"Content-Type":"application/json",...t.headers};r&&(n.Authorization=`Bearer ${r}`);const s=await fetch(`${Gi}${e}`,{...t,headers:n});if(!s.ok){let o;try{o=await s.json()}catch{o=null}const l=((i=o==null?void 0:o.error)==null?void 0:i.message)??`HTTP ${s.status}`;throw s.status===401&&window.dispatchEvent(new CustomEvent("meridian:unauthorized")),new Xp(s.status,l,o)}if(s.status!==204)return s.json()}const oe={get:e=>Bo(e,{method:"GET"}),post:(e,t)=>Bo(e,{method:"POST",body:JSON.stringify(t)}),put:(e,t)=>Bo(e,{method:"PUT",body:JSON.stringify(t)}),patch:(e,t)=>Bo(e,{method:"PATCH",body:JSON.stringify(t)}),delete:e=>Bo(e,{method:"DELETE"}),upload:async(e,t)=>{var i;const r=O1(),n={};r&&(n.Authorization=`Bearer ${r}`);const s=await fetch(`${Gi}${e}`,{method:"POST",headers:n,body:t});if(!s.ok){let o;try{o=await s.json()}catch{o=null}const l=((i=o==null?void 0:o.error)==null?void 0:i.message)??`HTTP ${s.status}`;throw s.status===401&&window.dispatchEvent(new CustomEvent("meridian:unauthorized")),new Xp(s.status,l,o)}if(s.status!==204)return s.json()}},Tt={all:["issues"],byProject:(e,t)=>[...Tt.all,"project",e,...t?[t]:[]],detail:e=>[...Tt.all,e],comments:e=>[...Tt.all,e,"comments"],activities:e=>[...Tt.all,e,"activities"]};function Ql(e,t){return Be({queryKey:e?Tt.byProject(e,t):Tt.all,queryFn:()=>{var n,s,i;const r=new URLSearchParams;return e&&r.set("project_id",e),(n=t==null?void 0:t.priority)!=null&&n.length&&r.set("priority",t.priority.join(",")),t!=null&&t.assignee_id&&r.set("assignee_id",t.assignee_id),(s=t==null?void 0:t.type)!=null&&s.length&&r.set("type",t.type.join(",")),(i=t==null?void 0:t.status)!=null&&i.length&&r.set("status",t.status.join(",")),oe.get(`/admin/issues?${r}`)},select:r=>r.issues,enabled:e!==void 0?!!e:!0})}function P1(e){return Be({queryKey:Tt.detail(e),queryFn:()=>oe.get(`/admin/issues/${e}`),select:t=>t.issue,enabled:!!e})}function e5(e){return Be({queryKey:Tt.comments(e),queryFn:()=>oe.get(`/admin/issues/${e}/comments`),select:t=>t.comments,enabled:!!e})}function E1(){const e=Se();return be({mutationFn:t=>oe.post("/admin/issues",t),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:Tt.byProject(r.project_id)})}})}function Ru(e,t){const r=Se();return be({mutationFn:n=>oe.put(`/admin/issues/${e}`,n),onMutate:async n=>{await r.cancelQueries({queryKey:Tt.byProject(t)});const s=r.getQueryData(Tt.byProject(t));return r.setQueryData(Tt.byProject(t),i=>i&&{...i,issues:i.issues.map(o=>o.id===e?{...o,...n}:o)}),{previous:s}},onError:(n,s,i)=>{i!=null&&i.previous&&r.setQueryData(Tt.byProject(t),i.previous)},onSettled:()=>{r.invalidateQueries({queryKey:Tt.byProject(t)}),r.invalidateQueries({queryKey:Tt.detail(e)})}})}function t5(e){return Be({queryKey:Tt.activities(e),queryFn:()=>oe.get(`/admin/issues/${e}/activities`),select:t=>t.activities,enabled:!!e})}function r5(e){const t=Se();return be({mutationFn:({body:r,metadata:n})=>oe.post(`/admin/issues/${e}/comments`,{body:r,metadata:n}),onSuccess:()=>{t.invalidateQueries({queryKey:Tt.comments(e)})}})}const Gv=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Vv=it,Zl=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return Vv(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:s,defaultVariants:i}=t,o=Object.keys(s).map(d=>{const u=r==null?void 0:r[d],f=i==null?void 0:i[d];if(u===null)return null;const m=Gv(u)||Gv(f);return s[d][m]}),l=r&&Object.entries(r).reduce((d,u)=>{let[f,m]=u;return m===void 0||(d[f]=m),d},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((d,u)=>{let{class:f,className:m,...p}=u;return Object.entries(p).every(x=>{let[g,v]=x;return Array.isArray(v)?v.includes({...i,...l}[g]):{...i,...l}[g]===v})?[...d,f,m]:d},[]);return Vv(e,o,c,r==null?void 0:r.class,r==null?void 0:r.className)},qi=Zl("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline",indigo:"bg-indigo text-indigo-foreground hover:opacity-90"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9","icon-sm":"h-7 w-7"}},defaultVariants:{variant:"default",size:"default"}}),ne=h.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...s},i)=>{const o=n?Wp:"button";return a.jsx(o,{className:z(qi({variant:t,size:r,className:e})),ref:i,...s})});ne.displayName="Button";const Ee=h.forwardRef(({className:e,type:t,...r},n)=>a.jsx("input",{type:t,className:z("flex h-9 w-full rounded-lg border border-input bg-transparent px-3 py-1 text-sm shadow-none transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-[#9ca3af] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...r}));Ee.displayName="Input";/**
|
|
4
4
|
* @license lucide-react v0.468.0 - ISC
|
|
@@ -550,7 +550,7 @@ var gP=Object.defineProperty;var vP=(e,t,r)=>t in e?gP(e,t,{enumerable:!0,config
|
|
|
550
550
|
*
|
|
551
551
|
* This source code is licensed under the ISC license.
|
|
552
552
|
* See the LICENSE file in the root directory of this source tree.
|
|
553
|
-
*/const oa=ce("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function F5({issue:e}){const t=Ru(e.id,e.project_id),[r,n]=h.useState(""),[s,i]=h.useState(""),[o,l]=h.useState(!1),c=e.metadata??{},d=Object.entries(c),u=()=>{if(!r.trim())return;const m={...c,[r.trim()]:s};t.mutate({metadata:m},{onSuccess:()=>{H.success("Metadata saved"),n(""),i(""),l(!1)},onError:()=>H.error("Failed to save metadata")})},f=m=>{const p={...c};delete p[m],t.mutate({metadata:Object.keys(p).length?p:null},{onSuccess:()=>H.success("Entry removed"),onError:()=>H.error("Failed to update metadata")})};return a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:[a.jsxs("div",{className:"px-5 py-3 border-b border-border/60 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(l5,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Metadata"})]}),!o&&a.jsxs("button",{onClick:()=>l(!0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(dt,{className:"h-3.5 w-3.5"}),"Add field"]})]}),a.jsxs("div",{className:"px-5 py-3 space-y-2",children:[d.length===0&&!o&&a.jsx("p",{className:"text-xs text-muted-foreground/50 italic",children:"No metadata fields yet"}),d.map(([m,p])=>a.jsxs("div",{className:"flex items-center gap-2 group",children:[a.jsx("span",{className:"text-xs font-mono text-muted-foreground w-28 shrink-0 truncate",children:m}),a.jsx("span",{className:"text-xs text-foreground flex-1 truncate",children:String(p)}),a.jsx("button",{onClick:()=>f(m),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",children:a.jsx(Mr,{className:"h-3 w-3"})})]},m)),o&&a.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[a.jsx(Ee,{autoFocus:!0,placeholder:"key",value:r,onChange:m=>n(m.target.value),onKeyDown:m=>{m.key==="Enter"&&u(),m.key==="Escape"&&l(!1)},className:"h-7 text-xs font-mono w-28 shrink-0"}),a.jsx(Ee,{placeholder:"value",value:s,onChange:m=>i(m.target.value),onKeyDown:m=>{m.key==="Enter"&&u(),m.key==="Escape"&&l(!1)},className:"h-7 text-xs flex-1"}),a.jsx(ne,{size:"sm",className:"h-7 px-2 text-xs",onClick:u,disabled:!r.trim()||t.isPending,children:"Save"}),a.jsx(ne,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",onClick:()=>{l(!1),n(""),i("")},children:"Cancel"})]})]})]})}const B5=[{zone:"issue.details.after",component:F5}];function xo(e=!0){return Be({queryKey:["workspaces"],queryFn:()=>oe.get("/admin/workspaces"),select:t=>t.workspaces,enabled:e})}function W5(){const e=Se();return be({mutationFn:t=>oe.post("/admin/workspaces",t),onSuccess:()=>{e.invalidateQueries({queryKey:["workspaces"]})}})}function U5(e){const t=Se();return be({mutationFn:r=>oe.put(`/admin/workspaces/${e}`,r),onSuccess:()=>{t.invalidateQueries({queryKey:["workspaces"]})}})}function q5(e){const t=Se();return be({mutationFn:r=>{const n=new FormData;return n.append("logo",r),oe.upload(`/admin/workspaces/${e}/logo`,n)},onSuccess:()=>t.invalidateQueries({queryKey:["workspaces"]})})}function H5(e){const t=Se();return be({mutationFn:()=>oe.delete(`/admin/workspaces/${e}/logo`),onSuccess:()=>t.invalidateQueries({queryKey:["workspaces"]})})}const lx={list:e=>["workspaces",e,"invitations"]};function K5(e){return Be({queryKey:lx.list(e),queryFn:()=>oe.get(`/admin/workspaces/${e}/invitations`),select:t=>t.invitations,enabled:!!e})}function Y5(e){const t=Se();return be({mutationFn:r=>oe.post(`/admin/workspaces/${e}/invitations`,r),onSuccess:()=>{t.invalidateQueries({queryKey:lx.list(e)})}})}function G5(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/workspaces/${e}/invitations/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:lx.list(e)})}})}function V5(e){return be({mutationFn:t=>oe.post(`/admin/workspaces/${e}/invitations/${t}/resend`)})}const cx={list:e=>["workspaces",e,"members"]};function rc(e){return Be({queryKey:cx.list(e),queryFn:()=>oe.get(`/admin/workspaces/${e}/members`),select:t=>t.members,enabled:!!e})}function X5(e){const t=Se();return be({mutationFn:r=>oe.post(`/admin/workspaces/${e}/members`,r),onSuccess:()=>{t.invalidateQueries({queryKey:cx.list(e)}),t.invalidateQueries({queryKey:["workspaces"]})}})}function Q5(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/workspaces/${e}/members/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:cx.list(e)}),t.invalidateQueries({queryKey:["workspaces"]})}})}const bs={list:e=>["workspaces",e,"teams"],members:(e,t)=>["workspaces",e,"teams",t,"members"]};function Fu(e){return Be({queryKey:bs.list(e),queryFn:()=>oe.get(`/admin/workspaces/${e}/teams`),select:t=>t.teams,enabled:!!e})}function Z5(e){const t=Se();return be({mutationFn:r=>oe.post(`/admin/workspaces/${e}/teams`,r),onSuccess:()=>{t.invalidateQueries({queryKey:bs.list(e)})}})}function J5(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/workspaces/${e}/teams/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:bs.list(e)})}})}function eD(e,t){return Be({queryKey:bs.members(e,t),queryFn:()=>oe.get(`/admin/workspaces/${e}/teams/${t}/members`),select:r=>r.members,enabled:!!(e&&t)})}function tD(e,t){const r=Se();return be({mutationFn:n=>oe.post(`/admin/workspaces/${e}/teams/${t}/members`,{user_id:n}),onSuccess:()=>{r.invalidateQueries({queryKey:bs.members(e,t)}),r.invalidateQueries({queryKey:bs.list(e)})}})}function rD(e,t){const r=Se();return be({mutationFn:n=>oe.delete(`/admin/workspaces/${e}/teams/${t}/members/${n}`),onSuccess:()=>{r.invalidateQueries({queryKey:bs.members(e,t)}),r.invalidateQueries({queryKey:bs.list(e)})}})}function Bu(){return Be({queryKey:["setup-status"],queryFn:()=>oe.get("/auth/setup"),staleTime:6e4,retry:!1})}function nD(){const{login:e}=Ie();return be({mutationFn:t=>oe.post("/auth/login",t),onSuccess:t=>{e(t.user,t.token)}})}function aD(){const{login:e}=Ie();return be({mutationFn:t=>oe.post("/auth/register",t),onSuccess:t=>{e(t.user,t.token)}})}function sD(){return be({mutationFn:e=>oe.post("/auth/forgot-password",e)})}function iD(){return be({mutationFn:e=>oe.post("/auth/reset-password",e)})}function oD(e){const{login:t}=Ie();return be({mutationFn:r=>oe.post(`/auth/invite/${e}`,r),onSuccess:r=>{t(r.user,r.token)}})}var Aj;const lD=((Aj=window.__MERIDIAN_CONFIG__)==null?void 0:Aj.apiUrl)??void 0??"";function cD(e,t){const r=`${lD}/admin/events?token=${encodeURIComponent(e)}&workspaceId=${encodeURIComponent(t)}`;return new EventSource(r)}function dD(){const{token:e,workspace:t}=Ie(),r=Se(),n=h.useRef(null);h.useEffect(()=>{if(!e||!t)return;const s=cD(e,t.id);n.current=s;const i=o=>{o.forEach(l=>r.invalidateQueries({queryKey:l}))};return s.addEventListener("issue.created",()=>{i([["issues"],["notifications"]])}),s.addEventListener("issue.status_changed",()=>{i([["issues"]])}),s.addEventListener("issue.assigned",()=>{i([["issues"],["notifications"]])}),s.addEventListener("comment.created",()=>{i([["issues"],["notifications"]])}),s.addEventListener("project.member_added",()=>{i([["notifications"]])}),s.onerror=()=>{},()=>{s.close(),n.current=null}},[e,t==null?void 0:t.id,r])}const gm=768;function uD(){const[e,t]=h.useState(void 0);return h.useEffect(()=>{const r=window.matchMedia(`(max-width: ${gm-1}px)`),n=()=>{t(window.innerWidth<gm)};return r.addEventListener("change",n),t(window.innerWidth<gm),()=>r.removeEventListener("change",n)},[]),!!e}const go=h.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},s)=>a.jsx(Tj,{ref:s,decorative:r,orientation:t,className:z("shrink-0 bg-border",t==="horizontal"?"h-px w-full":"h-full w-px",e),...n}));go.displayName=Tj.displayName;const fD=Xl,mD=Vl,V1=h.forwardRef(({className:e,...t},r)=>a.jsx(gi,{className:z("fixed inset-0 z-50 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));V1.displayName=gi.displayName;const hD=Zl("fixed z-50 gap-4 bg-background border-border transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-200 data-[state=open]:duration-300",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-xl"}},defaultVariants:{side:"right"}}),X1=h.forwardRef(({side:e="right",className:t,children:r,...n},s)=>a.jsxs(mD,{children:[a.jsx(V1,{}),a.jsxs(vi,{ref:s,className:z(hD({side:e}),t),...n,children:[r,a.jsxs(Du,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[a.jsx(tt,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));X1.displayName=vi.displayName;const Q1=({className:e,...t})=>a.jsx("div",{className:z("flex flex-col space-y-1.5 px-6 pt-6 pb-4 border-b border-border",e),...t});Q1.displayName="SheetHeader";const Z1=h.forwardRef(({className:e,...t},r)=>a.jsx(uo,{ref:r,className:z("text-base font-semibold text-foreground",e),...t}));Z1.displayName=uo.displayName;const J1=h.forwardRef(({className:e,...t},r)=>a.jsx(fo,{ref:r,className:z("text-sm text-muted-foreground",e),...t}));J1.displayName=fo.displayName;function le({className:e,...t}){return a.jsx("div",{className:z("animate-pulse rounded-md bg-muted",e),...t})}const pD="sidebar_state",xD=60*60*24*7,gD="16rem",vD="18rem",yD="3rem",bD="b",eN=h.createContext(null);function dx(){const e=h.useContext(eN);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function Wu({defaultOpen:e=!0,open:t,onOpenChange:r,className:n,style:s,children:i,...o}){const l=uD(),[c,d]=h.useState(!1),[u,f]=h.useState(e),m=t??u,p=h.useCallback(y=>{const j=typeof y=="function"?y(m):y;r?r(j):f(j),document.cookie=`${pD}=${j}; path=/; max-age=${xD}`},[r,m]),x=h.useCallback(()=>l?d(y=>!y):p(y=>!y),[l,p,d]);h.useEffect(()=>{const y=j=>{j.key===bD&&(j.metaKey||j.ctrlKey)&&(j.preventDefault(),x())};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[x]);const g=m?"expanded":"collapsed",v=h.useMemo(()=>({state:g,open:m,setOpen:p,isMobile:l,openMobile:c,setOpenMobile:d,toggleSidebar:x}),[g,m,p,l,c,d,x]);return a.jsx(eN.Provider,{value:v,children:a.jsx(Iu,{delayDuration:0,children:a.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":gD,"--sidebar-width-icon":yD,...s},className:z("group/sidebar-wrapper has-[[data-variant=inset]]:bg-sidebar flex h-svh w-full",n),...o,children:i})})})}function Uu({side:e="left",variant:t="sidebar",collapsible:r="offcanvas",className:n,children:s,...i}){const{isMobile:o,state:l,openMobile:c,setOpenMobile:d}=dx();return r==="none"?a.jsx("div",{"data-slot":"sidebar",className:z("bg-sidebar text-sidebar-foreground flex h-full w-[var(--sidebar-width)] flex-col",n),...i,children:s}):o?a.jsx(fD,{open:c,onOpenChange:d,...i,children:a.jsxs(X1,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-[var(--sidebar-width)] p-0 [&>button]:hidden",style:{"--sidebar-width":vD},side:e,children:[a.jsxs(Q1,{className:"sr-only",children:[a.jsx(Z1,{children:"Sidebar"}),a.jsx(J1,{children:"Displays the mobile sidebar."})]}),a.jsx("div",{className:"flex h-full w-full flex-col",children:s})]})}):a.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":l,"data-collapsible":l==="collapsed"?r:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:[a.jsx("div",{"data-slot":"sidebar-gap",className:z("relative w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem)]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)]")}),a.jsx("div",{"data-slot":"sidebar-container",className:z("fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200 ease-linear md:flex",e==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem+2px)]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)] group-data-[side=left]:border-r group-data-[side=right]:border-l",n),...i,children:a.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:s})})]})}function qu({className:e,onClick:t,...r}){const{toggleSidebar:n}=dx();return a.jsxs(ne,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:z("size-7",e),onClick:s=>{t==null||t(s),n()},...r,children:[a.jsx(j5,{}),a.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function Hu({className:e,...t}){return a.jsx("main",{"data-slot":"sidebar-inset",className:z("bg-background relative flex w-full flex-1 flex-col","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",e),...t})}function Ku({className:e,...t}){return a.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:z("flex flex-col gap-2 p-2",e),...t})}function Yu({className:e,...t}){return a.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:z("flex flex-col gap-2 p-2",e),...t})}function Zv({className:e,...t}){return a.jsx(go,{"data-slot":"sidebar-separator","data-sidebar":"separator",className:z("bg-sidebar-border mx-2 w-auto",e),...t})}function Gu({className:e,...t}){return a.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:z("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function Us({className:e,...t}){return a.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:z("relative flex w-full min-w-0 flex-col p-2",e),...t})}function Jv({className:e,asChild:t=!1,...r}){const n=t?Wp:"div";return a.jsx(n,{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:z("text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-none transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...r})}function qs({className:e,...t}){return a.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:z("w-full text-sm",e),...t})}function Nr({className:e,...t}){return a.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:z("flex w-full min-w-0 flex-col gap-1",e),...t})}function Mt({className:e,...t}){return a.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:z("group/menu-item relative",e),...t})}const wD=Zl("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}}),St=h.forwardRef(function({asChild:t=!1,isActive:r=!1,variant:n="default",size:s="default",tooltip:i,className:o,...l},c){const d=t?Wp:"button",{isMobile:u,state:f}=dx(),m=a.jsx(d,{ref:c,"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":s,"data-active":r,className:z(wD({variant:n,size:s}),o),...l});return i?(typeof i=="string"&&(i={children:i}),a.jsxs(Qn,{children:[a.jsx(Zn,{asChild:!0,children:m}),a.jsx(_n,{side:"right",align:"center",hidden:f!=="collapsed"||u,...i})]})):m});St.displayName="SidebarMenuButton";const jD=250,ND=300,Jr={all:["projects"],list:()=>[...Jr.all,"list"],detail:e=>[...Jr.all,e],byKey:e=>[...Jr.all,"key",e],activities:e=>[...Jr.all,e,"activities"]};function vo(){const{workspace:e}=Ie();return Be({queryKey:[...Jr.list(),e==null?void 0:e.id],queryFn:()=>{const t=e!=null&&e.id?`?workspace_id=${e.id}`:"";return oe.get(`/admin/projects${t}`)},select:t=>t.projects,enabled:!!(e!=null&&e.id)})}function Wa(e){return Be({queryKey:Jr.byKey(e),queryFn:()=>oe.get(`/admin/projects/by-identifier/${encodeURIComponent(e)}`),select:t=>t.project,enabled:!!e})}function kD(e,t={}){const[r,n]=h.useState(e),s=t.enabled!==!1;return h.useEffect(()=>{if(!s)return;const l=setTimeout(()=>n(e),jD);return()=>clearTimeout(l)},[e,s]),{...Be({queryKey:["projects","suggest-identifier",r],queryFn:()=>oe.get(`/admin/projects/suggest-identifier?name=${encodeURIComponent(r)}`),select:l=>l.identifier,enabled:s&&r.trim().length>0}),flush:()=>n(e)}}function SD(e,t={}){const r=e.toUpperCase().replace(/[^A-Z0-9]/g,""),[n,s]=h.useState(r),i=t.enabled!==!1&&r.length>=3;h.useEffect(()=>{if(!r){s("");return}const l=setTimeout(()=>s(r),ND);return()=>clearTimeout(l)},[r]);const o=Be({queryKey:["projects","check-identifier",n],queryFn:()=>oe.get(`/admin/projects/check-identifier/${encodeURIComponent(n)}`),select:l=>l.available,enabled:i&&n.length>=3});return{available:o.data,isLoading:o.isLoading,isFetching:o.isFetching}}function CD(){const e=Se();return be({mutationFn:t=>oe.post("/admin/projects",t),onSuccess:()=>{e.invalidateQueries({queryKey:Jr.list()})}})}function _D(){const e=Se();return be({mutationFn:t=>oe.delete(`/admin/projects/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:Jr.list()})}})}function MD(e){const t=Se();return be({mutationFn:()=>oe.post(`/admin/projects/${e}/share`,{}),onSuccess:()=>{t.invalidateQueries({queryKey:Jr.detail(e)}),t.invalidateQueries({queryKey:Jr.list()})}})}function OD(e){const t=Se();return be({mutationFn:()=>oe.delete(`/admin/projects/${e}/share`),onSuccess:()=>{t.invalidateQueries({queryKey:Jr.detail(e)}),t.invalidateQueries({queryKey:Jr.list()})}})}function PD(e){return Be({queryKey:Jr.activities(e),queryFn:()=>oe.get(`/admin/projects/${e}/activities`),select:t=>t.activities,enabled:!!e})}const Kr=PP,Yr=EP,ED=h.forwardRef(({className:e,inset:t,children:r,...n},s)=>a.jsxs(Ij,{ref:s,className:z("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...n,children:[r,a.jsx(vr,{className:"ml-auto"})]}));ED.displayName=Ij.displayName;const AD=h.forwardRef(({className:e,...t},r)=>a.jsx(Rj,{ref:r,className:z("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));AD.displayName=Rj.displayName;const Or=h.forwardRef(({className:e,sideOffset:t=4,...r},n)=>a.jsx(OP,{children:a.jsx($j,{ref:n,sideOffset:t,className:z("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));Or.displayName=$j.displayName;const at=h.forwardRef(({className:e,inset:t,...r},n)=>a.jsx(zj,{ref:n,className:z("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...r}));at.displayName=zj.displayName;const DD=h.forwardRef(({className:e,children:t,checked:r,...n},s)=>a.jsxs(Lj,{ref:s,className:z("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Fj,{children:a.jsx(dr,{className:"h-4 w-4"})})}),t]}));DD.displayName=Lj.displayName;const TD=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(Bj,{ref:n,className:z("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Fj,{children:a.jsx(_r,{className:"h-2 w-2 fill-current"})})}),t]}));TD.displayName=Bj.displayName;const ux=h.forwardRef(({className:e,inset:t,...r},n)=>a.jsx(Wj,{ref:n,className:z("px-2 py-1.5 text-xs font-medium text-muted-foreground",t&&"pl-8",e),...r}));ux.displayName=Wj.displayName;const Pn=h.forwardRef(({className:e,...t},r)=>a.jsx(Uj,{ref:r,className:z("-mx-1 my-1 h-px bg-border",e),...t}));Pn.displayName=Uj.displayName;const Rt=h.forwardRef(({className:e,...t},r)=>a.jsx(qj,{ref:r,className:z("relative flex h-8 w-8 shrink-0 overflow-hidden rounded-full",e),...t}));Rt.displayName=qj.displayName;const wl=h.forwardRef(({className:e,...t},r)=>a.jsx(Hj,{ref:r,className:z("aspect-square h-full w-full",e),...t}));wl.displayName=Hj.displayName;const $t=h.forwardRef(({className:e,...t},r)=>a.jsx(Kj,{ref:r,className:z("flex h-full w-full items-center justify-center rounded-full bg-muted text-xs font-medium text-muted-foreground",e),...t}));$t.displayName=Kj.displayName;function ID(){var s;const{workspace:e,setWorkspace:t}=Ie(),{data:r}=xo(),n=pt();return a.jsx(Nr,{children:a.jsx(Mt,{children:a.jsxs(Kr,{children:[a.jsx(Yr,{asChild:!0,children:a.jsxs(St,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[e!=null&&e.logo_url?a.jsx("img",{src:e.logo_url,alt:e.name,className:"size-8 rounded-lg object-cover shrink-0"}):a.jsx("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg bg-foreground text-background shrink-0",children:a.jsx("span",{className:"text-[13px] font-bold",children:(((s=e==null?void 0:e.name)==null?void 0:s[0])??"M").toUpperCase()})}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:(e==null?void 0:e.name)??"Meridian"}),a.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(e==null?void 0:e.slug)??""})]}),a.jsx(ho,{className:"ml-auto size-4 shrink-0"})]})}),a.jsxs(Or,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"bottom",align:"start",sideOffset:4,children:[a.jsx(ux,{className:"text-xs text-muted-foreground font-normal",children:"Workspaces"}),r==null?void 0:r.map(i=>a.jsxs(at,{className:"cursor-pointer gap-2 p-2",onClick:()=>{t({id:i.id,name:i.name,slug:i.slug,logo_url:i.logo_url}),n(`/${i.slug}/projects`)},children:[i.logo_url?a.jsx("img",{src:i.logo_url,alt:i.name,className:"size-6 rounded-sm object-cover shrink-0"}):a.jsx("div",{className:"flex size-6 items-center justify-center rounded-sm bg-foreground text-background shrink-0",children:a.jsx("span",{className:"text-[10px] font-bold",children:i.name[0].toUpperCase()})}),a.jsx("span",{className:"flex-1 truncate",children:i.name}),i.id===(e==null?void 0:e.id)&&a.jsx(dr,{className:"size-3.5 text-muted-foreground shrink-0"})]},i.id)),a.jsx(Pn,{}),a.jsxs(at,{className:"cursor-pointer gap-2 p-2 text-muted-foreground",onClick:()=>n("/setup"),children:[a.jsx("div",{className:"flex size-6 items-center justify-center rounded-md border bg-background",children:a.jsx("span",{className:"text-xs font-semibold",children:"+"})}),a.jsx("span",{children:"Create workspace"})]})]})]})})})}function RD(){var i,o,l,c;const{user:e,logout:t}=Ie(),r=pt(),n=e&&(`${((i=e.first_name)==null?void 0:i[0])??""}${((o=e.last_name)==null?void 0:o[0])??""}`.toUpperCase()||((c=(l=e.email)==null?void 0:l[0])==null?void 0:c.toUpperCase()))||"?",s=e?[e.first_name,e.last_name].filter(Boolean).join(" ")||e.email:"User";return a.jsx(Nr,{children:a.jsx(Mt,{children:a.jsxs(Kr,{children:[a.jsx(Yr,{asChild:!0,children:a.jsxs(St,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[a.jsxs(Rt,{className:"h-8 w-8 rounded-lg shrink-0",children:[(e==null?void 0:e.avatar_url)&&a.jsx(wl,{src:e.avatar_url,alt:s??"",className:"object-cover"}),a.jsx($t,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:n})]}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:s}),a.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(e==null?void 0:e.email)??""})]}),a.jsx(ho,{className:"ml-auto size-4 shrink-0"})]})}),a.jsxs(Or,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[a.jsx(ux,{className:"p-0 font-normal",children:a.jsxs("div",{className:"flex items-center gap-2 px-1 py-1.5 text-left text-sm",children:[a.jsxs(Rt,{className:"h-8 w-8 rounded-lg",children:[(e==null?void 0:e.avatar_url)&&a.jsx(wl,{src:e.avatar_url,alt:s??"",className:"object-cover"}),a.jsx($t,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:n})]}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:s}),a.jsx("span",{className:"truncate text-xs text-muted-foreground",children:(e==null?void 0:e.email)??""})]})]})}),a.jsx(Pn,{}),a.jsxs(at,{className:"cursor-pointer gap-2",onClick:()=>r("/profile"),children:[a.jsx(tc,{className:"size-4"}),"Profile"]}),a.jsx(Pn,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:t,children:[a.jsx(zu,{className:"size-4"}),"Sign out"]})]})]})})})}function $D({...e}){var w,k,b;const{workspace:t,projectKey:r}=zt(),{data:n}=vo(),{toggle:s}=Gp(),{user:i}=Ie(),o=Kl(),l=t??"",c=o.pathname===`/${l}/projects`,d=o.pathname===`/${l}/my-tasks`,u=o.pathname.includes("/notifications"),f=o.pathname.includes("/settings"),m=o.pathname.includes("/roles"),p=o.pathname===`/${l}/reporting`,x=o.pathname.startsWith("/reporting"),g=o.pathname.startsWith("/org/settings"),v=((w=i==null?void 0:i.roles)==null?void 0:w.includes("super-admin"))??!1,y=v||(((k=i==null?void 0:i.roles)==null?void 0:k.includes("admin"))??!1),j=((b=i==null?void 0:i.permissions)==null?void 0:b.includes("workspace:admin"))??!1,N=y||j;return a.jsxs(Uu,{collapsible:"offcanvas",...e,children:[a.jsx(Ku,{children:a.jsx(ID,{})}),a.jsxs(Gu,{children:[a.jsx(Us,{children:a.jsx(qs,{children:a.jsxs(Nr,{children:[a.jsx(Mt,{children:a.jsxs(St,{onClick:s,tooltip:"Search",children:[a.jsx(ji,{}),a.jsx("span",{children:"Search"}),a.jsx("kbd",{className:"ml-auto hidden text-[10px] text-sidebar-foreground/40 font-mono sm:inline-flex",children:"⌘K"})]})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:d,tooltip:"My Tasks",children:a.jsxs(wn,{to:`/${l}/my-tasks`,children:[a.jsx(Lu,{}),a.jsx("span",{children:"My Tasks"})]})})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:c,tooltip:"Projects",children:a.jsxs(wn,{to:`/${l}/projects`,end:!0,children:[a.jsx(Hr,{}),a.jsx("span",{children:"Projects"})]})})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:u,tooltip:"Notifications",children:a.jsxs(wn,{to:`/${l}/notifications`,children:[a.jsx(ri,{}),a.jsx("span",{children:"Notifications"})]})})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:p,tooltip:"Reports",children:a.jsxs(wn,{to:`/${l}/reporting`,children:[a.jsx(ys,{}),a.jsx("span",{children:"Reports"})]})})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:f,tooltip:"Settings",children:a.jsxs(wn,{to:`/${l}/settings`,children:[a.jsx(ox,{}),a.jsx("span",{children:"Workspace settings"})]})})})]})})}),n&&n.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(Zv,{}),a.jsxs(Us,{children:[a.jsx(Jv,{children:"Recent"}),a.jsx(qs,{children:a.jsx(Nr,{children:n.slice(0,5).map(C=>a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:C.identifier===r,tooltip:C.name,className:"data-[active=true]:bg-indigo-50 dark:data-[active=true]:bg-indigo-950/50 data-[active=true]:text-indigo-700 dark:data-[active=true]:text-indigo-300",children:a.jsxs(wn,{to:`/${l}/projects/${C.identifier}/board`,children:[a.jsx("span",{className:"font-mono text-[10px] text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/50 px-1 py-0.5 rounded shrink-0",children:C.identifier}),a.jsx("span",{className:"truncate",children:C.name})]})})},C.id))})})]})]}),N&&a.jsxs(a.Fragment,{children:[a.jsx(Zv,{}),a.jsxs(Us,{children:[a.jsx(Jv,{children:"Global"}),a.jsx(qs,{children:a.jsxs(Nr,{children:[a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:x,tooltip:"Global Reports",children:a.jsxs(wn,{to:"/reporting",children:[a.jsx(ys,{}),a.jsx("span",{children:"Global Reports"})]})})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:g,tooltip:"Org Settings",children:a.jsxs(wn,{to:"/org/settings",children:[a.jsx(ix,{}),a.jsx("span",{children:"Org Settings"})]})})})]})})]})]}),a.jsx(Us,{className:"mt-auto",children:a.jsx(qs,{children:a.jsx(Nr,{children:v&&a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:m,tooltip:"Roles & Permissions",children:a.jsxs(wn,{to:`/${l}/roles`,children:[a.jsx(jh,{}),a.jsx("span",{children:"Custom Roles"})]})})})})})})]}),a.jsx(Yu,{children:a.jsx(RD,{})})]})}function Vu(){const{theme:e,setTheme:t}=dA();return a.jsxs(Qn,{children:[a.jsx(Zn,{asChild:!0,children:a.jsxs(ne,{variant:"ghost",size:"icon-sm",onClick:()=>t(e==="dark"?"light":"dark"),className:"text-muted-foreground hover:text-foreground",children:[a.jsx(P5,{className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),a.jsx(w5,{className:"absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),a.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),a.jsx(_n,{children:"Toggle theme"})]})}const nc={all:["notifications"],list:()=>[...nc.all,"list"]};function zD(){return Be({queryKey:nc.list(),queryFn:()=>oe.get("/admin/notifications"),select:e=>e.notifications})}function tN(){return Be({queryKey:[...nc.list(),"unread"],queryFn:()=>oe.get("/admin/notifications?unread=true"),select:e=>e.count,refetchInterval:3e4})}function LD(){const e=Se();return be({mutationFn:t=>oe.post(`/admin/notifications/${t}/read`),onSuccess:()=>{e.invalidateQueries({queryKey:nc.all})}})}function FD(){const e=Se();return be({mutationFn:()=>oe.post("/admin/notifications/read-all"),onSuccess:()=>{e.invalidateQueries({queryKey:nc.all})}})}function BD(){const e=Kl(),{projectKey:t}=zt(),{data:r}=vo(),n=r==null?void 0:r.find(i=>i.identifier===t),s=e.pathname;return s.includes("/board")?{icon:Hr,label:n?`${n.name} / Board`:"Board"}:s.includes("/issues")?{icon:Jn,label:n?`${n.name} / Issues`:"Issues"}:s.includes("/sprints")?{icon:oa,label:n?`${n.name} / Sprints`:"Sprints"}:s.includes("/timeline")?{icon:ni,label:n?`${n.name} / Timeline`:"Timeline"}:s.includes("/access")?{icon:Oa,label:n?`${n.name} / Access`:"Access"}:s.includes("/reports")?{icon:ys,label:n?`${n.name} / Reports`:"Reports"}:s.includes("/activity")?{icon:$u,label:n?`${n.name} / Activity`:"Activity"}:s.endsWith("/projects")?{icon:Sd,label:"Projects"}:s.includes("/notifications")?{icon:ri,label:"Notifications"}:s.includes("/settings")?{icon:ox,label:"Settings"}:{icon:Sd,label:"Meridian"}}function WD(){const{data:e=0}=tN(),{icon:t,label:r}=BD(),{workspace:n}=Ie(),s=(n==null?void 0:n.slug)??"";return a.jsx("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b transition-[width,height] ease-linear w-full",children:a.jsxs("div",{className:"flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6",children:[a.jsx(qu,{className:"-ml-1"}),a.jsx(go,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(t,{className:"h-4 w-4 text-indigo-600 dark:text-indigo-400",strokeWidth:1.5}),a.jsx("span",{className:"font-medium",children:r})]}),a.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[a.jsx("span",{className:"hidden md:flex",children:a.jsx(Vu,{})}),a.jsx(ne,{variant:"ghost",size:"icon",asChild:!0,className:"relative size-8 text-muted-foreground hover:text-foreground",children:a.jsxs(qr,{to:`/${s}/notifications`,children:[a.jsx(ri,{className:"h-4 w-4",strokeWidth:1.5}),e>0&&a.jsx("span",{className:"absolute -top-0.5 -right-0.5 h-3.5 w-3.5 rounded-full bg-indigo text-[9px] font-bold text-white flex items-center justify-center leading-none",children:e>9?"9+":e})]})})]})]})})}function UD(){const e=Kl(),{workspace:t}=zt(),r=t??"",{data:n=0}=tN(),{toggle:s}=Gp(),i=[{key:"projects",label:"Projects",icon:W1,to:`/${r}/projects`,match:/\/projects($|\/)/},{key:"notifications",label:"Notifications",icon:ri,to:`/${r}/notifications`,match:/\/notifications/,badge:n>0?n>9?"9+":String(n):null},{key:"my-tasks",label:"My Tasks",icon:Lu,to:`/${r}/my-tasks`,match:/\/my-tasks/},{key:"profile",label:"Profile",icon:tc,to:"/profile",match:/^\/profile/}];return a.jsx("nav",{className:"fixed bottom-0 left-0 right-0 z-50 bg-background border-t border-border md:hidden",children:a.jsxs("div",{className:"flex items-stretch h-16 pb-safe",children:[i.map(({key:o,label:l,icon:c,to:d,match:u,badge:f})=>{const m=u.test(e.pathname);return a.jsxs(qr,{to:d,className:z("flex flex-col items-center justify-center flex-1 gap-1 text-[10px] font-medium transition-colors relative",m?"text-indigo-600 dark:text-indigo-400":"text-muted-foreground hover:text-foreground"),children:[a.jsxs("div",{className:"relative",children:[a.jsx(c,{className:"h-5 w-5",strokeWidth:m?2:1.5}),f&&a.jsx("span",{className:"absolute -top-1 -right-1.5 h-3.5 w-3.5 rounded-full bg-indigo-600 text-[9px] font-bold text-white flex items-center justify-center leading-none",children:f})]}),a.jsx("span",{children:l})]},o)}),a.jsxs("button",{onClick:s,className:"flex flex-col items-center justify-center flex-1 gap-1 text-[10px] font-medium text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(ji,{className:"h-5 w-5",strokeWidth:1.5}),a.jsx("span",{children:"Search"})]})]})})}function qD(){const{user:e,token:t,login:r}=Ie();h.useEffect(()=>{!e||!t||!e.email||fetch("/admin/users/me",{headers:{Authorization:`Bearer ${t}`}}).then(n=>n.ok?n.json():null).then(n=>{n&&r({id:n.id,email:n.email,first_name:n.first_name??"",last_name:n.last_name??"",avatar_url:n.avatar_url??null},t)}).catch(()=>{})},[e==null?void 0:e.id])}function HD(){return qD(),a.jsxs(Wu,{children:[a.jsx($D,{variant:"inset"}),a.jsxs(Hu,{className:"flex flex-col min-w-0",children:[a.jsx(WD,{}),a.jsx("div",{className:"flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden pb-16 md:pb-0",children:a.jsx(Yl,{})})]}),a.jsx(UD,{})]})}const ac={project:e=>["projects",e,"access"]};function la(e){return Be({queryKey:ac.project(e),queryFn:()=>oe.get(`/admin/projects/${e}/access`),enabled:!!e})}function rN(e){const t=Se();return be({mutationFn:({userId:r,role:n})=>oe.post(`/admin/projects/${e}/members`,{user_id:r,role:n}),onSuccess:()=>{t.invalidateQueries({queryKey:ac.project(e)})}})}function nN(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/projects/${e}/members/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:ac.project(e)})}})}function aN(e){const t=Se();return be({mutationFn:r=>oe.post(`/admin/projects/${e}/teams`,{team_id:r}),onSuccess:()=>{t.invalidateQueries({queryKey:ac.project(e)})}})}function sN(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/projects/${e}/teams/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:ac.project(e)})}})}const Ua=Xl,KD=Vl,iN=h.forwardRef(({className:e,...t},r)=>a.jsx(gi,{ref:r,className:z("fixed inset-0 z-50 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));iN.displayName=gi.displayName;const ca=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(KD,{children:[a.jsx(iN,{}),a.jsxs(vi,{ref:n,className:z("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 bg-background border border-border p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",e),...r,children:[t,a.jsxs(Du,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[a.jsx(tt,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ca.displayName=vi.displayName;const qa=({className:e,...t})=>a.jsx("div",{className:z("flex flex-col space-y-1.5",e),...t});qa.displayName="DialogHeader";const fx=({className:e,...t})=>a.jsx("div",{className:z("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});fx.displayName="DialogFooter";const Ha=h.forwardRef(({className:e,...t},r)=>a.jsx(uo,{ref:r,className:z("text-base font-semibold leading-none tracking-tight",e),...t}));Ha.displayName=uo.displayName;const yo=h.forwardRef(({className:e,...t},r)=>a.jsx(fo,{ref:r,className:z("text-sm text-muted-foreground",e),...t}));yo.displayName=fo.displayName;function YD({open:e,onClose:t,project:r}){const[n,s]=h.useState(null),i=MD(r.id),o=OD(r.id),l=r.share_token,c=n??(l?`${window.location.origin}/share/${l}`:null),d=()=>{i.mutate(void 0,{onSuccess:p=>{const x=`${window.location.origin}/share/${p.project.share_token}`;s(x),H.success("Public link enabled")},onError:()=>H.error("Failed to enable public link")})},u=()=>{o.mutate(void 0,{onSuccess:()=>{s(null),H.success("Public link revoked")},onError:()=>H.error("Failed to revoke link")})},f=()=>{c&&navigator.clipboard.writeText(c).then(()=>{H.success("Link copied to clipboard")})},m=!!c;return a.jsx(Ua,{open:e,onOpenChange:p=>!p&&t(),children:a.jsxs(ca,{className:"sm:max-w-md overflow-hidden",children:[a.jsxs(qa,{children:[a.jsxs(Ha,{className:"flex items-center gap-2",children:[a.jsx(ai,{className:"h-4 w-4"}),"Share project"]}),a.jsx(yo,{children:"Allow anyone with the link to view this project without logging in."})]}),a.jsx("div",{className:"space-y-4 pt-2",children:m?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border bg-muted/50 px-3 py-2 overflow-hidden",children:[a.jsx(wh,{className:"h-3.5 w-3.5 text-green-600 shrink-0"}),a.jsx("span",{className:"text-xs text-muted-foreground min-w-0 flex-1 break-all",children:c})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ne,{variant:"outline",size:"sm",className:"flex-1",onClick:f,children:[a.jsx(ex,{className:"h-3.5 w-3.5 mr-1.5"}),"Copy link"]}),a.jsxs(ne,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:u,disabled:o.isPending,children:[a.jsx(Mr,{className:"h-3.5 w-3.5 mr-1.5"}),"Revoke"]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Anyone with this link can view the board, issues, and timeline. No account required."})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-dashed border-border px-3 py-4 text-center justify-center",children:[a.jsx(Oa,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"This project is private"})]}),a.jsxs(ne,{className:"w-full",onClick:d,disabled:i.isPending,children:[a.jsx(wh,{className:"h-4 w-4 mr-2"}),"Enable public link"]}),a.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Generates a secret link for read-only access. No write permissions granted."})]})})]})})}function oN(e=768){const[t,r]=h.useState(()=>typeof window<"u"?window.innerWidth<e:!1);return h.useEffect(()=>{const n=window.matchMedia(`(max-width: ${e-1}px)`),s=i=>r(i.matches);return r(n.matches),n.addEventListener("change",s),()=>n.removeEventListener("change",s)},[e]),t}const ey=["board","issues","sprints","timeline","access","reports","activity"];function GD(){const{projectKey:e,workspace:t}=zt(),{data:r,error:n}=Wa(e??""),{user:s}=Ie(),{data:i}=la((r==null?void 0:r.id)??""),[o,l]=h.useState(!1),c=pt(),d=Kl(),[u]=Gl(),f=oN(),m=(s==null?void 0:s.roles)??[],p=m.includes("super-admin")||m.includes("admin"),x=i==null?void 0:i.members.some(k=>k.user_id===(s==null?void 0:s.id)&&k.role==="manager"),g=p||x;h.useEffect(()=>{n&&n instanceof Xp&&(n.status===403||n.status===404)&&c(`/${t}/projects`,{replace:!0})},[n,t,c]),h.useEffect(()=>{const k=u.get("tab");if(!k||!ey.includes(k))return;ey.every(C=>!d.pathname.endsWith(`/${C}`))&&c(`/${t}/projects/${e}/${k}`,{replace:!0})},[]);const v=`/${t}/projects/${e}`,y=[{to:`${v}/board`,label:"Board",icon:Sd,end:!0,desktopOnly:!0},{to:`${v}/issues`,label:"Issues",icon:Jn,end:!1},{to:`${v}/sprints`,label:"Sprints",icon:oa,end:!0},{to:`${v}/timeline`,label:"Timeline",icon:ni,end:!0,desktopOnly:!0},{to:`${v}/access`,label:"Access",icon:Oa,end:!0},{to:`${v}/reports`,label:"Reports",icon:ys,end:!0},{to:`${v}/activity`,label:"Activity",icon:$u,end:!0}],j=y,N=y.filter(k=>!k.desktopOnly),w=d.pathname.endsWith("/board")||d.pathname.endsWith("/timeline");return f&&w?a.jsx(Xn,{to:`${v}/issues`,replace:!0}):a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"border-b border-border bg-white dark:bg-card shrink-0 px-4 pt-4 md:px-6 md:pt-5",children:[a.jsxs("div",{className:"flex items-center gap-2.5 mb-3 md:mb-4",children:[r&&a.jsx("span",{className:"text-xs font-mono text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/50 border border-indigo-200 dark:border-indigo-800 px-2 py-0.5 rounded",children:r.identifier}),a.jsx("h1",{className:"text-sm font-semibold",children:(r==null?void 0:r.name)??""})]}),a.jsxs("div",{className:"hidden md:flex items-center -mb-px",children:[a.jsx("div",{className:"flex flex-1",children:j.map(({to:k,label:b,icon:C,end:_})=>a.jsxs(wn,{to:k,end:_,className:({isActive:S})=>`flex items-center gap-1.5 px-3 py-2 text-sm border-b-2 transition-colors ${S?"border-foreground text-foreground font-medium":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[a.jsx(C,{className:"h-3.5 w-3.5",strokeWidth:1.5}),b]},k))}),g&&r&&a.jsx("div",{className:"pb-px pr-1",children:a.jsxs(ne,{variant:"ghost",size:"sm",onClick:()=>l(!0),className:"h-7 px-2 text-xs text-muted-foreground",children:[a.jsx(_5,{className:"h-3.5 w-3.5 mr-1"}),"Share"]})})]}),a.jsx("div",{className:"flex md:hidden overflow-x-auto -mb-px scrollbar-none",children:N.map(({to:k,label:b,icon:C,end:_})=>a.jsxs(wn,{to:k,end:_,className:({isActive:S})=>`flex items-center gap-1.5 px-3 py-2 text-sm border-b-2 whitespace-nowrap transition-colors shrink-0 ${S?"border-indigo-600 text-indigo-600 dark:border-indigo-400 dark:text-indigo-400 font-medium":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[a.jsx(C,{className:"h-3.5 w-3.5",strokeWidth:1.5}),b]},k))})]}),a.jsx("div",{className:"flex flex-col flex-1 min-h-0",children:a.jsx(Yl,{})}),r&&a.jsx(YD,{open:o,onClose:()=>l(!1),project:r})]})}function VD(){var s,i;const{user:e,logout:t}=Ie(),r=e?`${((s=e.first_name)==null?void 0:s[0])??""}${((i=e.last_name)==null?void 0:i[0])??""}`.toUpperCase()||e.email[0].toUpperCase():"?",n=e?[e.first_name,e.last_name].filter(Boolean).join(" ")||e.email:"User";return a.jsx(Nr,{children:a.jsx(Mt,{children:a.jsxs(Kr,{children:[a.jsx(Yr,{asChild:!0,children:a.jsxs(St,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[a.jsx(Rt,{className:"h-8 w-8 rounded-lg shrink-0",children:a.jsx($t,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:r})}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:n}),a.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(e==null?void 0:e.email)??""})]}),a.jsx(ho,{className:"ml-auto size-4 shrink-0"})]})}),a.jsxs(Or,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[a.jsx(Pn,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:t,children:[a.jsx(zu,{className:"size-4"}),"Sign out"]})]})]})})})}function XD(){const{workspace:e}=Ie(),t=pt(),r=(e==null?void 0:e.slug)??"";return a.jsxs(Uu,{collapsible:"offcanvas",variant:"inset",children:[a.jsx(Ku,{children:a.jsx(Nr,{children:a.jsx(Mt,{children:a.jsxs(St,{size:"lg",className:"data-[state=open]:bg-sidebar-accent",children:[a.jsx("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg bg-foreground text-background shrink-0",children:a.jsx(ys,{className:"size-4"})}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:"Reporting"}),a.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:"Time analytics"})]})]})})})}),a.jsx(Gu,{children:a.jsx(Us,{children:a.jsx(qs,{children:a.jsx(Nr,{children:a.jsx(Mt,{children:a.jsxs(St,{onClick:()=>t(r?`/${r}/projects`:"/"),tooltip:"Back to workspace",children:[a.jsx(Jl,{}),a.jsx("span",{children:"Back to workspace"})]})})})})})}),a.jsx(Yu,{children:a.jsx(VD,{})})]})}function QD(){return a.jsxs(Wu,{children:[a.jsx(XD,{}),a.jsxs(Hu,{className:"flex flex-col min-w-0",children:[a.jsx("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b w-full",children:a.jsxs("div",{className:"flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6",children:[a.jsx(qu,{className:"-ml-1"}),a.jsx(go,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(ys,{className:"h-4 w-4 text-indigo-600 dark:text-indigo-400",strokeWidth:1.5}),a.jsx("span",{className:"font-medium",children:"Reporting"})]}),a.jsx("div",{className:"ml-auto",children:a.jsx(Vu,{})})]})}),a.jsx("div",{className:"flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden",children:a.jsx(Yl,{})})]})]})}function ZD(){var s,i;const{user:e,logout:t}=Ie(),r=e?`${((s=e.first_name)==null?void 0:s[0])??""}${((i=e.last_name)==null?void 0:i[0])??""}`.toUpperCase()||e.email[0].toUpperCase():"?",n=e?[e.first_name,e.last_name].filter(Boolean).join(" ")||e.email:"User";return a.jsx(Nr,{children:a.jsx(Mt,{children:a.jsxs(Kr,{children:[a.jsx(Yr,{asChild:!0,children:a.jsxs(St,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[a.jsx(Rt,{className:"h-8 w-8 rounded-lg shrink-0",children:a.jsx($t,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:r})}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:n}),a.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(e==null?void 0:e.email)??""})]}),a.jsx(ho,{className:"ml-auto size-4 shrink-0"})]})}),a.jsxs(Or,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[a.jsx(Pn,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:t,children:[a.jsx(zu,{className:"size-4"}),"Sign out"]})]})]})})})}function JD(){const{workspace:e}=Ie(),t=pt(),r=(e==null?void 0:e.slug)??"";return a.jsxs(Uu,{collapsible:"offcanvas",variant:"inset",children:[a.jsx(Ku,{children:a.jsx(Nr,{children:a.jsx(Mt,{children:a.jsxs(St,{size:"lg",className:"data-[state=open]:bg-sidebar-accent",children:[a.jsx("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg bg-foreground text-background shrink-0",children:a.jsx(ix,{className:"size-4"})}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:"Org Settings"}),a.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:"Global configuration"})]})]})})})}),a.jsx(Gu,{children:a.jsx(Us,{children:a.jsx(qs,{children:a.jsx(Nr,{children:a.jsx(Mt,{children:a.jsxs(St,{onClick:()=>t(r?`/${r}/projects`:"/"),tooltip:"Back to workspace",children:[a.jsx(Jl,{}),a.jsx("span",{children:"Back to workspace"})]})})})})})}),a.jsx(Yu,{children:a.jsx(ZD,{})})]})}function eT(){return a.jsxs(Wu,{children:[a.jsx(JD,{}),a.jsxs(Hu,{className:"flex flex-col min-w-0",children:[a.jsx("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b w-full",children:a.jsxs("div",{className:"flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6",children:[a.jsx(qu,{className:"-ml-1"}),a.jsx(go,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(ix,{className:"h-4 w-4 text-indigo-600 dark:text-indigo-400",strokeWidth:1.5}),a.jsx("span",{className:"font-medium",children:"Org Settings"})]}),a.jsx("div",{className:"ml-auto",children:a.jsx(Vu,{})})]})}),a.jsx("div",{className:"flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden",children:a.jsx(Yl,{})})]})]})}function tT(){var s,i;const{user:e,logout:t}=Ie(),r=e?`${((s=e.first_name)==null?void 0:s[0])??""}${((i=e.last_name)==null?void 0:i[0])??""}`.toUpperCase()||e.email[0].toUpperCase():"?",n=e?[e.first_name,e.last_name].filter(Boolean).join(" ")||e.email:"User";return a.jsx(Nr,{children:a.jsx(Mt,{children:a.jsxs(Kr,{children:[a.jsx(Yr,{asChild:!0,children:a.jsxs(St,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[a.jsxs(Rt,{className:"h-8 w-8 rounded-lg shrink-0",children:[(e==null?void 0:e.avatar_url)&&a.jsx(wl,{src:e.avatar_url,alt:n??"",className:"object-cover"}),a.jsx($t,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:r})]}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:n}),a.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(e==null?void 0:e.email)??""})]}),a.jsx(ho,{className:"ml-auto size-4 shrink-0"})]})}),a.jsxs(Or,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[a.jsx(Pn,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:t,children:[a.jsx(zu,{className:"size-4"}),"Sign out"]})]})]})})})}function rT(){const{workspace:e}=Ie(),t=pt(),r=(e==null?void 0:e.slug)??"";return a.jsxs(Uu,{collapsible:"offcanvas",variant:"inset",children:[a.jsx(Ku,{children:a.jsx(Nr,{children:a.jsx(Mt,{children:a.jsxs(St,{size:"lg",className:"data-[state=open]:bg-sidebar-accent",children:[a.jsx("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg bg-foreground text-background shrink-0",children:a.jsx(tc,{className:"size-4"})}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:"Profile"}),a.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:"Personal settings"})]})]})})})}),a.jsx(Gu,{children:a.jsx(Us,{children:a.jsx(qs,{children:a.jsx(Nr,{children:a.jsx(Mt,{children:a.jsxs(St,{onClick:()=>t(r?`/${r}/projects`:"/"),tooltip:"Back to workspace",children:[a.jsx(Jl,{}),a.jsx("span",{children:"Back to workspace"})]})})})})})}),a.jsx(Yu,{children:a.jsx(tT,{})})]})}function nT(){return a.jsxs(Wu,{children:[a.jsx(rT,{}),a.jsxs(Hu,{className:"flex flex-col min-w-0",children:[a.jsx("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b w-full",children:a.jsxs("div",{className:"flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6",children:[a.jsx(qu,{className:"-ml-1"}),a.jsx(go,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(tc,{className:"h-4 w-4 text-indigo-600 dark:text-indigo-400",strokeWidth:1.5}),a.jsx("span",{className:"font-medium",children:"Profile"})]}),a.jsx("div",{className:"ml-auto",children:a.jsx(Vu,{})})]})}),a.jsx("div",{className:"flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden",children:a.jsx(Yl,{})})]})]})}var ty=1,aT=.9,sT=.8,iT=.17,vm=.1,ym=.999,oT=.9999,lT=.99,cT=/[\\\/_+.#"@\[\(\{&]/,dT=/[\\\/_+.#"@\[\(\{&]/g,uT=/[\s-]/,lN=/[\s-]/g;function Nh(e,t,r,n,s,i,o){if(i===t.length)return s===e.length?ty:lT;var l=`${s},${i}`;if(o[l]!==void 0)return o[l];for(var c=n.charAt(i),d=r.indexOf(c,s),u=0,f,m,p,x;d>=0;)f=Nh(e,t,r,n,d+1,i+1,o),f>u&&(d===s?f*=ty:cT.test(e.charAt(d-1))?(f*=sT,p=e.slice(s,d-1).match(dT),p&&s>0&&(f*=Math.pow(ym,p.length))):uT.test(e.charAt(d-1))?(f*=aT,x=e.slice(s,d-1).match(lN),x&&s>0&&(f*=Math.pow(ym,x.length))):(f*=iT,s>0&&(f*=Math.pow(ym,d-s))),e.charAt(d)!==t.charAt(i)&&(f*=oT)),(f<vm&&r.charAt(d-1)===n.charAt(i+1)||n.charAt(i+1)===n.charAt(i)&&r.charAt(d-1)!==n.charAt(i))&&(m=Nh(e,t,r,n,d+1,i+2,o),m*vm>f&&(f=m*vm)),f>u&&(u=f),d=r.indexOf(c,d+1);return o[l]=u,u}function ry(e){return e.toLowerCase().replace(lN," ")}function fT(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,Nh(e,t,ry(e),ry(t),0,0,{})}var Wo='[cmdk-group=""]',bm='[cmdk-group-items=""]',mT='[cmdk-group-heading=""]',mx='[cmdk-item=""]',ny=`${mx}:not([aria-disabled="true"])`,kh="cmdk-item-select",Bs="data-value",hT=(e,t,r)=>fT(e,t,r),cN=h.createContext(void 0),sc=()=>h.useContext(cN),dN=h.createContext(void 0),hx=()=>h.useContext(dN),uN=h.createContext(void 0),fN=h.forwardRef((e,t)=>{let r=$i(()=>{var R,q;return{search:"",value:(q=(R=e.value)!=null?R:e.defaultValue)!=null?q:"",filtered:{count:0,items:new Map,groups:new Set}}}),n=$i(()=>new Set),s=$i(()=>new Map),i=$i(()=>new Map),o=$i(()=>new Set),l=mN(e),{label:c,children:d,value:u,onValueChange:f,filter:m,shouldFilter:p,loop:x,disablePointerSelection:g=!1,vimBindings:v=!0,...y}=e,j=Wi(),N=Wi(),w=Wi(),k=h.useRef(null),b=ST();oi(()=>{if(u!==void 0){let R=u.trim();r.current.value=R,C.emit()}},[u]),oi(()=>{b(6,L)},[]);let C=h.useMemo(()=>({subscribe:R=>(o.current.add(R),()=>o.current.delete(R)),snapshot:()=>r.current,setState:(R,q,$)=>{var K,D,E;if(!Object.is(r.current[R],q)){if(r.current[R]=q,R==="search")O(),I(),b(1,A);else if(R==="value"&&($||b(5,L),((K=l.current)==null?void 0:K.value)!==void 0)){let Z=q??"";(E=(D=l.current).onValueChange)==null||E.call(D,Z);return}C.emit()}},emit:()=>{o.current.forEach(R=>R())}}),[]),_=h.useMemo(()=>({value:(R,q,$)=>{var K;q!==((K=i.current.get(R))==null?void 0:K.value)&&(i.current.set(R,{value:q,keywords:$}),r.current.filtered.items.set(R,S(q,$)),b(2,()=>{I(),C.emit()}))},item:(R,q)=>(n.current.add(R),q&&(s.current.has(q)?s.current.get(q).add(R):s.current.set(q,new Set([R]))),b(3,()=>{O(),I(),r.current.value||A(),C.emit()}),()=>{i.current.delete(R),n.current.delete(R),r.current.filtered.items.delete(R);let $=F();b(4,()=>{O(),($==null?void 0:$.getAttribute("id"))===R&&A(),C.emit()})}),group:R=>(s.current.has(R)||s.current.set(R,new Set),()=>{i.current.delete(R),s.current.delete(R)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:j,inputId:w,labelId:N,listInnerRef:k}),[]);function S(R,q){var $,K;let D=(K=($=l.current)==null?void 0:$.filter)!=null?K:hT;return R?D(R,r.current.search,q):0}function I(){if(!r.current.search||l.current.shouldFilter===!1)return;let R=r.current.filtered.items,q=[];r.current.filtered.groups.forEach(K=>{let D=s.current.get(K),E=0;D.forEach(Z=>{let B=R.get(Z);E=Math.max(B,E)}),q.push([K,E])});let $=k.current;X().sort((K,D)=>{var E,Z;let B=K.getAttribute("id"),Y=D.getAttribute("id");return((E=R.get(Y))!=null?E:0)-((Z=R.get(B))!=null?Z:0)}).forEach(K=>{let D=K.closest(bm);D?D.appendChild(K.parentElement===D?K:K.closest(`${bm} > *`)):$.appendChild(K.parentElement===$?K:K.closest(`${bm} > *`))}),q.sort((K,D)=>D[1]-K[1]).forEach(K=>{var D;let E=(D=k.current)==null?void 0:D.querySelector(`${Wo}[${Bs}="${encodeURIComponent(K[0])}"]`);E==null||E.parentElement.appendChild(E)})}function A(){let R=X().find($=>$.getAttribute("aria-disabled")!=="true"),q=R==null?void 0:R.getAttribute(Bs);C.setState("value",q||void 0)}function O(){var R,q,$,K;if(!r.current.search||l.current.shouldFilter===!1){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let D=0;for(let E of n.current){let Z=(q=(R=i.current.get(E))==null?void 0:R.value)!=null?q:"",B=(K=($=i.current.get(E))==null?void 0:$.keywords)!=null?K:[],Y=S(Z,B);r.current.filtered.items.set(E,Y),Y>0&&D++}for(let[E,Z]of s.current)for(let B of Z)if(r.current.filtered.items.get(B)>0){r.current.filtered.groups.add(E);break}r.current.filtered.count=D}function L(){var R,q,$;let K=F();K&&(((R=K.parentElement)==null?void 0:R.firstChild)===K&&(($=(q=K.closest(Wo))==null?void 0:q.querySelector(mT))==null||$.scrollIntoView({block:"nearest"})),K.scrollIntoView({block:"nearest"}))}function F(){var R;return(R=k.current)==null?void 0:R.querySelector(`${mx}[aria-selected="true"]`)}function X(){var R;return Array.from(((R=k.current)==null?void 0:R.querySelectorAll(ny))||[])}function T(R){let q=X()[R];q&&C.setState("value",q.getAttribute(Bs))}function G(R){var q;let $=F(),K=X(),D=K.findIndex(Z=>Z===$),E=K[D+R];(q=l.current)!=null&&q.loop&&(E=D+R<0?K[K.length-1]:D+R===K.length?K[0]:K[D+R]),E&&C.setState("value",E.getAttribute(Bs))}function re(R){let q=F(),$=q==null?void 0:q.closest(Wo),K;for(;$&&!K;)$=R>0?NT($,Wo):kT($,Wo),K=$==null?void 0:$.querySelector(ny);K?C.setState("value",K.getAttribute(Bs)):G(R)}let J=()=>T(X().length-1),P=R=>{R.preventDefault(),R.metaKey?J():R.altKey?re(1):G(1)},M=R=>{R.preventDefault(),R.metaKey?T(0):R.altKey?re(-1):G(-1)};return h.createElement(Ns.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:R=>{var q;if((q=y.onKeyDown)==null||q.call(y,R),!R.defaultPrevented)switch(R.key){case"n":case"j":{v&&R.ctrlKey&&P(R);break}case"ArrowDown":{P(R);break}case"p":case"k":{v&&R.ctrlKey&&M(R);break}case"ArrowUp":{M(R);break}case"Home":{R.preventDefault(),T(0);break}case"End":{R.preventDefault(),J();break}case"Enter":if(!R.nativeEvent.isComposing&&R.keyCode!==229){R.preventDefault();let $=F();if($){let K=new Event(kh);$.dispatchEvent(K)}}}}},h.createElement("label",{"cmdk-label":"",htmlFor:_.inputId,id:_.labelId,style:_T},c),Xu(e,R=>h.createElement(dN.Provider,{value:C},h.createElement(cN.Provider,{value:_},R))))}),pT=h.forwardRef((e,t)=>{var r,n;let s=Wi(),i=h.useRef(null),o=h.useContext(uN),l=sc(),c=mN(e),d=(n=(r=c.current)==null?void 0:r.forceMount)!=null?n:o==null?void 0:o.forceMount;oi(()=>{if(!d)return l.item(s,o==null?void 0:o.id)},[d]);let u=hN(s,i,[e.value,e.children,i],e.keywords),f=hx(),m=li(b=>b.value&&b.value===u.current),p=li(b=>d||l.filter()===!1?!0:b.search?b.filtered.items.get(s)>0:!0);h.useEffect(()=>{let b=i.current;if(!(!b||e.disabled))return b.addEventListener(kh,x),()=>b.removeEventListener(kh,x)},[p,e.onSelect,e.disabled]);function x(){var b,C;g(),(C=(b=c.current).onSelect)==null||C.call(b,u.current)}function g(){f.setState("value",u.current,!0)}if(!p)return null;let{disabled:v,value:y,onSelect:j,forceMount:N,keywords:w,...k}=e;return h.createElement(Ns.div,{ref:jl([i,t]),...k,id:s,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!m,"data-disabled":!!v,"data-selected":!!m,onPointerMove:v||l.getDisablePointerSelection()?void 0:g,onClick:v?void 0:x},e.children)}),xT=h.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:s,...i}=e,o=Wi(),l=h.useRef(null),c=h.useRef(null),d=Wi(),u=sc(),f=li(p=>s||u.filter()===!1?!0:p.search?p.filtered.groups.has(o):!0);oi(()=>u.group(o),[]),hN(o,l,[e.value,e.heading,c]);let m=h.useMemo(()=>({id:o,forceMount:s}),[s]);return h.createElement(Ns.div,{ref:jl([l,t]),...i,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},r&&h.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:d},r),Xu(e,p=>h.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},h.createElement(uN.Provider,{value:m},p))))}),gT=h.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,s=h.useRef(null),i=li(o=>!o.search);return!r&&!i?null:h.createElement(Ns.div,{ref:jl([s,t]),...n,"cmdk-separator":"",role:"separator"})}),vT=h.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,s=e.value!=null,i=hx(),o=li(u=>u.search),l=li(u=>u.value),c=sc(),d=h.useMemo(()=>{var u;let f=(u=c.listInnerRef.current)==null?void 0:u.querySelector(`${mx}[${Bs}="${encodeURIComponent(l)}"]`);return f==null?void 0:f.getAttribute("id")},[]);return h.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),h.createElement(Ns.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":d,id:c.inputId,type:"text",value:s?e.value:o,onChange:u=>{s||i.setState("search",u.target.value),r==null||r(u.target.value)}})}),yT=h.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...s}=e,i=h.useRef(null),o=h.useRef(null),l=sc();return h.useEffect(()=>{if(o.current&&i.current){let c=o.current,d=i.current,u,f=new ResizeObserver(()=>{u=requestAnimationFrame(()=>{let m=c.offsetHeight;d.style.setProperty("--cmdk-list-height",m.toFixed(1)+"px")})});return f.observe(c),()=>{cancelAnimationFrame(u),f.unobserve(c)}}},[]),h.createElement(Ns.div,{ref:jl([i,t]),...s,"cmdk-list":"",role:"listbox","aria-label":n,id:l.listId},Xu(e,c=>h.createElement("div",{ref:jl([o,l.listInnerRef]),"cmdk-list-sizer":""},c)))}),bT=h.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:s,contentClassName:i,container:o,...l}=e;return h.createElement(Xl,{open:r,onOpenChange:n},h.createElement(Vl,{container:o},h.createElement(gi,{"cmdk-overlay":"",className:s}),h.createElement(vi,{"aria-label":e.label,"cmdk-dialog":"",className:i},h.createElement(fN,{ref:t,...l}))))}),wT=h.forwardRef((e,t)=>li(r=>r.filtered.count===0)?h.createElement(Ns.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),jT=h.forwardRef((e,t)=>{let{progress:r,children:n,label:s="Loading...",...i}=e;return h.createElement(Ns.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Xu(e,o=>h.createElement("div",{"aria-hidden":!0},o)))}),Gr=Object.assign(fN,{List:yT,Item:pT,Input:vT,Group:xT,Separator:gT,Dialog:bT,Empty:wT,Loading:jT});function NT(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function kT(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function mN(e){let t=h.useRef(e);return oi(()=>{t.current=e}),t}var oi=typeof window>"u"?h.useEffect:h.useLayoutEffect;function $i(e){let t=h.useRef();return t.current===void 0&&(t.current=e()),t}function jl(e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}function li(e){let t=hx(),r=()=>e(t.snapshot());return AP.useSyncExternalStore(t.subscribe,r,r)}function hN(e,t,r,n=[]){let s=h.useRef(),i=sc();return oi(()=>{var o;let l=(()=>{var d;for(let u of r){if(typeof u=="string")return u.trim();if(typeof u=="object"&&"current"in u)return u.current?(d=u.current.textContent)==null?void 0:d.trim():s.current}})(),c=n.map(d=>d.trim());i.value(e,l,c),(o=t.current)==null||o.setAttribute(Bs,l),s.current=l}),s}var ST=()=>{let[e,t]=h.useState(),r=$i(()=>new Map);return oi(()=>{r.current.forEach(n=>n()),r.current=new Map},[e]),(n,s)=>{r.current.set(n,s),t({})}};function CT(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Xu({asChild:e,children:t},r){return e&&h.isValidElement(t)?h.cloneElement(CT(t),{ref:t.ref},r(t.props.children)):r(t)}var _T={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Xs=h.forwardRef(({className:e,...t},r)=>a.jsx(Gr,{ref:r,className:z("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));Xs.displayName=Gr.displayName;const MT=({children:e,open:t,onOpenChange:r})=>a.jsx(Ua,{open:t,onOpenChange:r,children:a.jsx(ca,{className:"overflow-hidden p-0 shadow-lg max-w-[560px]",children:a.jsx(Xs,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})})}),Qu=h.forwardRef(({className:e,...t},r)=>a.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[a.jsx(ji,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),a.jsx(Gr.Input,{ref:r,className:z("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));Qu.displayName=Gr.Input.displayName;const Qs=h.forwardRef(({className:e,...t},r)=>a.jsx(Gr.List,{ref:r,className:z("max-h-[320px] overflow-y-auto overflow-x-hidden",e),...t}));Qs.displayName=Gr.List.displayName;const Zu=h.forwardRef((e,t)=>a.jsx(Gr.Empty,{ref:t,className:"py-6 text-center text-sm text-muted-foreground",...e}));Zu.displayName=Gr.Empty.displayName;const cs=h.forwardRef(({className:e,...t},r)=>a.jsx(Gr.Group,{ref:r,className:z("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));cs.displayName=Gr.Group.displayName;const pN=h.forwardRef(({className:e,...t},r)=>a.jsx(Gr.Separator,{ref:r,className:z("-mx-1 h-px bg-border",e),...t}));pN.displayName=Gr.Separator.displayName;const un=h.forwardRef(({className:e,...t},r)=>a.jsx(Gr.Item,{ref:r,className:z("relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none","data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground","data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50","[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));un.displayName=Gr.Item.displayName;function OT(){const{open:e,setOpen:t}=Gp(),r=pt(),{data:n}=vo(),{workspace:s}=Ie(),i=(s==null?void 0:s.slug)??"",o=l=>{t(!1),l()};return a.jsxs(MT,{open:e,onOpenChange:t,children:[a.jsx(Qu,{placeholder:"Search or jump to..."}),a.jsxs(Qs,{children:[a.jsx(Zu,{children:"No results found."}),a.jsxs(cs,{heading:"Navigation",children:[a.jsxs(un,{onSelect:()=>o(()=>r(`/${i}/projects`)),children:[a.jsx(Sd,{className:"text-muted-foreground"}),a.jsx("span",{children:"Projects"})]}),a.jsxs(un,{onSelect:()=>o(()=>r(`/${i}/notifications`)),children:[a.jsx(ri,{className:"text-muted-foreground"}),a.jsx("span",{children:"Notifications"})]}),a.jsxs(un,{onSelect:()=>o(()=>r(`/${i}/settings`)),children:[a.jsx(ox,{className:"text-muted-foreground"}),a.jsx("span",{children:"Settings"})]})]}),n&&n.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(pN,{}),a.jsxs(cs,{heading:"Projects",children:[n.map(l=>a.jsxs(un,{value:`${l.name} board`,onSelect:()=>o(()=>r(`/${i}/projects/${l.identifier}/board`)),children:[a.jsx(Hr,{className:"text-muted-foreground"}),a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx("span",{className:"font-mono text-[11px] text-muted-foreground shrink-0",children:l.identifier}),a.jsx("span",{className:"truncate",children:l.name}),a.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Board"})]})]},`${l.id}-board`)),n.map(l=>a.jsxs(un,{value:`${l.name} issues`,onSelect:()=>o(()=>r(`/${i}/projects/${l.identifier}/issues`)),children:[a.jsx(Jn,{className:"text-muted-foreground"}),a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx("span",{className:"font-mono text-[11px] text-muted-foreground shrink-0",children:l.identifier}),a.jsx("span",{className:"truncate",children:l.name}),a.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Issues"})]})]},`${l.id}-issues`))]})]})]})]})}function Cr({zone:e,props:t}){const r=JA(e);return r.length?a.jsx(a.Fragment,{children:r.map((n,s)=>a.jsx(n,{...t},n.displayName??n.name??s))}):null}function px({flow:e,inviteToken:t,label:r,disabled:n}){const s=()=>{const i=`${Gi}/auth/google?flow=${e}${t?`&invite_token=${encodeURIComponent(t)}`:""}`;window.location.href=i};return a.jsxs(ne,{type:"button",variant:"outline",className:"w-full gap-2 bg-white dark:bg-black text-black dark:text-white",onClick:s,disabled:n,children:[a.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18","aria-hidden":"true",children:[a.jsx("path",{d:"M17.64 9.205c0-.639-.057-1.252-.164-1.841H9v3.481h4.844a4.14 4.14 0 0 1-1.796 2.716v2.259h2.908c1.702-1.567 2.684-3.875 2.684-6.615z",fill:"#4285F4"}),a.jsx("path",{d:"M9 18c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H.957v2.332A8.997 8.997 0 0 0 9 18z",fill:"#34A853"}),a.jsx("path",{d:"M3.964 10.71A5.41 5.41 0 0 1 3.682 9c0-.593.102-1.17.282-1.71V4.958H.957A8.996 8.996 0 0 0 0 9c0 1.452.348 2.827.957 4.042l3.007-2.332z",fill:"#FBBC05"}),a.jsx("path",{d:"M9 3.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C13.463.891 11.426 0 9 0A8.997 8.997 0 0 0 .957 4.958L3.964 7.29C4.672 5.163 6.656 3.58 9 3.58z",fill:"#EA4335"})]}),r??"Continue with Google"]})}function ic(){var e;return((e=window.__MERIDIAN_CONFIG__)==null?void 0:e.appName)??"Meridian"}function PT(){var e;return(e=window.__MERIDIAN_CONFIG__)==null?void 0:e.logoUrl}function oc({className:e}){const t=PT();return t?a.jsx("img",{src:t,alt:ic(),className:e??"h-12 w-12"}):a.jsx("div",{className:e??"relative h-16 w-16 rounded-2xl bg-white dark:bg-card border border-border shadow-sm flex items-center justify-center",children:a.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:a.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:a.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})})}function ET(){const[e,t]=h.useState(""),[r,n]=h.useState(""),[s,i]=h.useState(!1),o=pt(),l=nD(),{data:c}=Bu(),d=u=>{u.preventDefault(),l.mutate({email:e,password:r},{onSuccess:()=>o("/"),onError:f=>H.error(f.message??"Invalid email or password")})};return a.jsx("div",{className:"min-h-screen bg-white dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[360px]",children:[a.jsx(Cr,{zone:"login.before",props:{}}),a.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[a.jsx(oc,{}),a.jsxs("div",{className:"text-center",children:[a.jsxs("h1",{className:"text-lg font-semibold text-foreground",children:["Welcome to ",ic()]}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Sign in to access the admin area"})]})]}),a.jsxs("form",{onSubmit:d,className:"space-y-2",children:[a.jsx(Ee,{type:"email",placeholder:"Email",value:e,onChange:u=>t(u.target.value),autoComplete:"email",required:!0,className:"bg-white dark:bg-card h-10"}),a.jsxs("div",{className:"relative",children:[a.jsx(Ee,{type:s?"text":"password",placeholder:"Password",value:r,onChange:u=>n(u.target.value),autoComplete:"current-password",required:!0,className:"bg-white dark:bg-card h-10 pr-10"}),a.jsx("button",{type:"button",onClick:()=>i(!s),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:s?a.jsx(ec,{className:"h-4 w-4"}):a.jsx(wi,{className:"h-4 w-4"})})]}),a.jsx("div",{className:"flex justify-end",children:a.jsx(qr,{to:"/forgot-password",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Forgot password?"})}),a.jsx("div",{className:"pt-1",children:a.jsx(ne,{type:"submit",className:"w-full h-10 font-medium",disabled:l.isPending,children:l.isPending?"Signing in...":"Continue with Email"})})]}),(c==null?void 0:c.googleOAuthEnabled)&&a.jsxs("div",{className:"mt-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"h-px flex-1 bg-border"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),a.jsx("div",{className:"h-px flex-1 bg-border"})]}),a.jsx(px,{flow:"login"})]}),a.jsxs("p",{className:"text-sm text-center text-muted-foreground mt-6",children:["Don't have an account?"," ",a.jsx(qr,{to:"/register",className:"text-indigo hover:opacity-80 transition-opacity",children:"Create one"})]}),a.jsx(Cr,{zone:"login.after",props:{}})]})})}function AT(){const[e,t]=h.useState(""),[r,n]=h.useState(""),[s,i]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState(!1),u=pt(),f=aD(),{data:m}=Bu(),p=(m==null?void 0:m.needsSetup)===!0,x=g=>{g.preventDefault(),f.mutate({email:s,password:o,first_name:e,last_name:r},{onSuccess:()=>u("/"),onError:v=>H.error(v.message??"Registration failed")})};return a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[360px]",children:[a.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[a.jsx(oc,{}),a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"text-lg font-semibold text-foreground",children:p?"Set up your account":"Create your account"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:p?"You're the first user — you'll be the super admin.":`Get started with ${ic()}`})]})]}),a.jsxs("form",{onSubmit:x,className:"space-y-2",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx(Ee,{placeholder:"First name",value:e,onChange:g=>t(g.target.value),required:!0,className:"bg-white dark:bg-card h-10"}),a.jsx(Ee,{placeholder:"Last name",value:r,onChange:g=>n(g.target.value),required:!0,className:"bg-white dark:bg-card h-10"})]}),a.jsx(Ee,{type:"email",placeholder:"Email",value:s,onChange:g=>i(g.target.value),autoComplete:"email",required:!0,className:"bg-white dark:bg-card h-10"}),a.jsxs("div",{className:"relative",children:[a.jsx(Ee,{type:c?"text":"password",placeholder:"Password",value:o,onChange:g=>l(g.target.value),autoComplete:"new-password",required:!0,className:"bg-white dark:bg-card h-10 pr-10"}),a.jsx("button",{type:"button",onClick:()=>d(!c),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:c?a.jsx(ec,{className:"h-4 w-4"}):a.jsx(wi,{className:"h-4 w-4"})})]}),a.jsx("div",{className:"pt-1",children:a.jsx(ne,{type:"submit",className:"w-full h-10 font-medium",disabled:f.isPending,children:f.isPending?"Creating account...":"Create Account"})})]}),(m==null?void 0:m.googleOAuthEnabled)&&a.jsxs("div",{className:"mt-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"h-px flex-1 bg-border"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),a.jsx("div",{className:"h-px flex-1 bg-border"})]}),a.jsx(px,{flow:"register",label:p?"Set up with Google":"Continue with Google"})]}),a.jsxs("p",{className:"text-sm text-center text-muted-foreground mt-6",children:["Already have an account?"," ",a.jsx(qr,{to:"/login",className:"text-indigo hover:opacity-80 transition-opacity",children:"Sign in"})]})]})})}function DT(){const[e,t]=h.useState(""),[r,n]=h.useState(!1),s=pt(),{setWorkspace:i}=Ie(),o=W5(),l=c=>{c.preventDefault(),e.trim()&&o.mutate({name:e.trim(),is_private:r},{onSuccess:d=>{const u={id:d.workspace.id,name:d.workspace.name,slug:d.workspace.slug};i(u),s(`/${u.slug}/projects`,{replace:!0})},onError:d=>H.error(d.message??"Failed to create workspace")})};return a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[380px]",children:[a.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[a.jsx(oc,{}),a.jsxs("div",{className:"text-center",children:[a.jsxs("h1",{className:"text-lg font-semibold text-foreground",children:["Create your ",ic()," workspace"]}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"A workspace is where your team's projects and issues live."})]})]}),a.jsxs("form",{onSubmit:l,className:"space-y-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(Ee,{placeholder:"Workspace name (e.g. Acme Corp)",value:e,onChange:c=>t(c.target.value),autoFocus:!0,required:!0,className:"bg-white dark:bg-card h-10"}),a.jsx("p",{className:"text-xs text-muted-foreground px-0.5",children:"You can rename it later from settings."})]}),a.jsxs("label",{className:"flex items-center gap-2.5 px-0.5 cursor-pointer select-none",children:[a.jsx("input",{type:"checkbox",checked:r,onChange:c=>n(c.target.checked),className:"size-4 rounded border-border accent-indigo-600"}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(Oa,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("span",{className:"text-sm text-foreground",children:"Private workspace"})]}),a.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:"Only visible to members"})]}),a.jsx(ne,{type:"submit",className:"w-full h-10 font-medium",disabled:!e.trim()||o.isPending,children:o.isPending?"Creating workspace...":"Create workspace"})]})]})})}function TT(){const{logout:e}=Ie();return a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[380px]",children:[a.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[a.jsx(oc,{}),a.jsxs("div",{className:"text-center",children:[a.jsxs("h1",{className:"text-lg font-semibold text-foreground",children:["Waiting for ",ic()," access"]}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"You've been added to the system, but haven't been assigned to a workspace yet. An admin will add you shortly."})]})]}),a.jsx(ne,{variant:"outline",className:"w-full",onClick:e,children:"Sign out"})]})})}function IT(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const xN=W.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),lc=()=>{const e=W.useContext(xN);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};IT(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
|
|
553
|
+
*/const oa=ce("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function F5({issue:e}){const t=Ru(e.id,e.project_id),[r,n]=h.useState(""),[s,i]=h.useState(""),[o,l]=h.useState(!1),c=e.metadata??{},d=Object.entries(c),u=()=>{if(!r.trim())return;const m={...c,[r.trim()]:s};t.mutate({metadata:m},{onSuccess:()=>{H.success("Metadata saved"),n(""),i(""),l(!1)},onError:()=>H.error("Failed to save metadata")})},f=m=>{const p={...c};delete p[m],t.mutate({metadata:Object.keys(p).length?p:null},{onSuccess:()=>H.success("Entry removed"),onError:()=>H.error("Failed to update metadata")})};return a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:[a.jsxs("div",{className:"px-5 py-3 border-b border-border/60 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(l5,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Metadata"})]}),!o&&a.jsxs("button",{onClick:()=>l(!0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(dt,{className:"h-3.5 w-3.5"}),"Add field"]})]}),a.jsxs("div",{className:"px-5 py-3 space-y-2",children:[d.length===0&&!o&&a.jsx("p",{className:"text-xs text-muted-foreground/50 italic",children:"No metadata fields yet"}),d.map(([m,p])=>a.jsxs("div",{className:"flex items-center gap-2 group",children:[a.jsx("span",{className:"text-xs font-mono text-muted-foreground w-28 shrink-0 truncate",children:m}),a.jsx("span",{className:"text-xs text-foreground flex-1 truncate",children:String(p)}),a.jsx("button",{onClick:()=>f(m),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",children:a.jsx(Mr,{className:"h-3 w-3"})})]},m)),o&&a.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[a.jsx(Ee,{autoFocus:!0,placeholder:"key",value:r,onChange:m=>n(m.target.value),onKeyDown:m=>{m.key==="Enter"&&u(),m.key==="Escape"&&l(!1)},className:"h-7 text-xs font-mono w-28 shrink-0"}),a.jsx(Ee,{placeholder:"value",value:s,onChange:m=>i(m.target.value),onKeyDown:m=>{m.key==="Enter"&&u(),m.key==="Escape"&&l(!1)},className:"h-7 text-xs flex-1"}),a.jsx(ne,{size:"sm",className:"h-7 px-2 text-xs",onClick:u,disabled:!r.trim()||t.isPending,children:"Save"}),a.jsx(ne,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",onClick:()=>{l(!1),n(""),i("")},children:"Cancel"})]})]})]})}const B5=[{zone:"issue.details.after",component:F5}];function xo(e=!0){return Be({queryKey:["workspaces"],queryFn:()=>oe.get("/admin/workspaces"),select:t=>t.workspaces,enabled:e})}function W5(){const e=Se();return be({mutationFn:t=>oe.post("/admin/workspaces",t),onSuccess:()=>{e.invalidateQueries({queryKey:["workspaces"]})}})}function U5(e){const t=Se();return be({mutationFn:r=>oe.put(`/admin/workspaces/${e}`,r),onSuccess:()=>{t.invalidateQueries({queryKey:["workspaces"]})}})}function q5(e){const t=Se();return be({mutationFn:r=>{const n=new FormData;return n.append("logo",r),oe.upload(`/admin/workspaces/${e}/logo`,n)},onSuccess:()=>t.invalidateQueries({queryKey:["workspaces"]})})}function H5(e){const t=Se();return be({mutationFn:()=>oe.delete(`/admin/workspaces/${e}/logo`),onSuccess:()=>t.invalidateQueries({queryKey:["workspaces"]})})}const lx={list:e=>["workspaces",e,"invitations"]};function K5(e){return Be({queryKey:lx.list(e),queryFn:()=>oe.get(`/admin/workspaces/${e}/invitations`),select:t=>t.invitations,enabled:!!e})}function Y5(e){const t=Se();return be({mutationFn:r=>oe.post(`/admin/workspaces/${e}/invitations`,r),onSuccess:()=>{t.invalidateQueries({queryKey:lx.list(e)})}})}function G5(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/workspaces/${e}/invitations/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:lx.list(e)})}})}function V5(e){return be({mutationFn:t=>oe.post(`/admin/workspaces/${e}/invitations/${t}/resend`)})}const cx={list:e=>["workspaces",e,"members"]};function rc(e){return Be({queryKey:cx.list(e),queryFn:()=>oe.get(`/admin/workspaces/${e}/members`),select:t=>t.members,enabled:!!e})}function X5(e){const t=Se();return be({mutationFn:r=>oe.post(`/admin/workspaces/${e}/members`,r),onSuccess:()=>{t.invalidateQueries({queryKey:cx.list(e)}),t.invalidateQueries({queryKey:["workspaces"]})}})}function Q5(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/workspaces/${e}/members/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:cx.list(e)}),t.invalidateQueries({queryKey:["workspaces"]})}})}const bs={list:e=>["workspaces",e,"teams"],members:(e,t)=>["workspaces",e,"teams",t,"members"]};function Fu(e){return Be({queryKey:bs.list(e),queryFn:()=>oe.get(`/admin/workspaces/${e}/teams`),select:t=>t.teams,enabled:!!e})}function Z5(e){const t=Se();return be({mutationFn:r=>oe.post(`/admin/workspaces/${e}/teams`,r),onSuccess:()=>{t.invalidateQueries({queryKey:bs.list(e)})}})}function J5(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/workspaces/${e}/teams/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:bs.list(e)})}})}function eD(e,t){return Be({queryKey:bs.members(e,t),queryFn:()=>oe.get(`/admin/workspaces/${e}/teams/${t}/members`),select:r=>r.members,enabled:!!(e&&t)})}function tD(e,t){const r=Se();return be({mutationFn:n=>oe.post(`/admin/workspaces/${e}/teams/${t}/members`,{user_id:n}),onSuccess:()=>{r.invalidateQueries({queryKey:bs.members(e,t)}),r.invalidateQueries({queryKey:bs.list(e)})}})}function rD(e,t){const r=Se();return be({mutationFn:n=>oe.delete(`/admin/workspaces/${e}/teams/${t}/members/${n}`),onSuccess:()=>{r.invalidateQueries({queryKey:bs.members(e,t)}),r.invalidateQueries({queryKey:bs.list(e)})}})}function Bu(){return Be({queryKey:["setup-status"],queryFn:()=>oe.get("/auth/setup"),staleTime:6e4,retry:!1})}function nD(){const{login:e}=Ie();return be({mutationFn:t=>oe.post("/auth/login",t),onSuccess:t=>{e(t.user,t.token)}})}function aD(){const{login:e}=Ie();return be({mutationFn:t=>oe.post("/auth/register",t),onSuccess:t=>{e(t.user,t.token)}})}function sD(){return be({mutationFn:e=>oe.post("/auth/forgot-password",e)})}function iD(){return be({mutationFn:e=>oe.post("/auth/reset-password",e)})}function oD(e){const{login:t}=Ie();return be({mutationFn:r=>oe.post(`/auth/invite/${e}`,r),onSuccess:r=>{t(r.user,r.token)}})}var Aj;const lD=((Aj=window.__MERIDIAN_CONFIG__)==null?void 0:Aj.apiUrl)??void 0??"";function cD(e,t){const r=`${lD}/admin/events?token=${encodeURIComponent(e)}&workspaceId=${encodeURIComponent(t)}`;return new EventSource(r)}function dD(){const{token:e,workspace:t}=Ie(),r=Se(),n=h.useRef(null);h.useEffect(()=>{if(!e||!t)return;const s=cD(e,t.id);n.current=s;const i=o=>{o.forEach(l=>r.invalidateQueries({queryKey:l}))};return s.addEventListener("issue.created",()=>{i([["issues"],["notifications"]])}),s.addEventListener("issue.status_changed",()=>{i([["issues"]])}),s.addEventListener("issue.assigned",()=>{i([["issues"],["notifications"]])}),s.addEventListener("comment.created",()=>{i([["issues"],["notifications"]])}),s.addEventListener("project.member_added",()=>{i([["notifications"]])}),s.onerror=()=>{},()=>{s.close(),n.current=null}},[e,t==null?void 0:t.id,r])}const gm=768;function uD(){const[e,t]=h.useState(void 0);return h.useEffect(()=>{const r=window.matchMedia(`(max-width: ${gm-1}px)`),n=()=>{t(window.innerWidth<gm)};return r.addEventListener("change",n),t(window.innerWidth<gm),()=>r.removeEventListener("change",n)},[]),!!e}const go=h.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},s)=>a.jsx(Tj,{ref:s,decorative:r,orientation:t,className:z("shrink-0 bg-border",t==="horizontal"?"h-px w-full":"h-full w-px",e),...n}));go.displayName=Tj.displayName;const fD=Xl,mD=Vl,V1=h.forwardRef(({className:e,...t},r)=>a.jsx(gi,{className:z("fixed inset-0 z-50 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));V1.displayName=gi.displayName;const hD=Zl("fixed z-50 gap-4 bg-background border-border transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-200 data-[state=open]:duration-300",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-xl"}},defaultVariants:{side:"right"}}),X1=h.forwardRef(({side:e="right",className:t,children:r,...n},s)=>a.jsxs(mD,{children:[a.jsx(V1,{}),a.jsxs(vi,{ref:s,className:z(hD({side:e}),t),...n,children:[r,a.jsxs(Du,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[a.jsx(tt,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));X1.displayName=vi.displayName;const Q1=({className:e,...t})=>a.jsx("div",{className:z("flex flex-col space-y-1.5 px-6 pt-6 pb-4 border-b border-border",e),...t});Q1.displayName="SheetHeader";const Z1=h.forwardRef(({className:e,...t},r)=>a.jsx(uo,{ref:r,className:z("text-base font-semibold text-foreground",e),...t}));Z1.displayName=uo.displayName;const J1=h.forwardRef(({className:e,...t},r)=>a.jsx(fo,{ref:r,className:z("text-sm text-muted-foreground",e),...t}));J1.displayName=fo.displayName;function le({className:e,...t}){return a.jsx("div",{className:z("animate-pulse rounded-md bg-muted",e),...t})}const pD="sidebar_state",xD=60*60*24*7,gD="16rem",vD="18rem",yD="3rem",bD="b",eN=h.createContext(null);function dx(){const e=h.useContext(eN);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function Wu({defaultOpen:e=!0,open:t,onOpenChange:r,className:n,style:s,children:i,...o}){const l=uD(),[c,d]=h.useState(!1),[u,f]=h.useState(e),m=t??u,p=h.useCallback(y=>{const j=typeof y=="function"?y(m):y;r?r(j):f(j),document.cookie=`${pD}=${j}; path=/; max-age=${xD}`},[r,m]),x=h.useCallback(()=>l?d(y=>!y):p(y=>!y),[l,p,d]);h.useEffect(()=>{const y=j=>{j.key===bD&&(j.metaKey||j.ctrlKey)&&(j.preventDefault(),x())};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[x]);const g=m?"expanded":"collapsed",v=h.useMemo(()=>({state:g,open:m,setOpen:p,isMobile:l,openMobile:c,setOpenMobile:d,toggleSidebar:x}),[g,m,p,l,c,d,x]);return a.jsx(eN.Provider,{value:v,children:a.jsx(Iu,{delayDuration:0,children:a.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":gD,"--sidebar-width-icon":yD,...s},className:z("group/sidebar-wrapper has-[[data-variant=inset]]:bg-sidebar flex h-svh w-full",n),...o,children:i})})})}function Uu({side:e="left",variant:t="sidebar",collapsible:r="offcanvas",className:n,children:s,...i}){const{isMobile:o,state:l,openMobile:c,setOpenMobile:d}=dx();return r==="none"?a.jsx("div",{"data-slot":"sidebar",className:z("bg-sidebar text-sidebar-foreground flex h-full w-[var(--sidebar-width)] flex-col",n),...i,children:s}):o?a.jsx(fD,{open:c,onOpenChange:d,...i,children:a.jsxs(X1,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-[var(--sidebar-width)] p-0 [&>button]:hidden",style:{"--sidebar-width":vD},side:e,children:[a.jsxs(Q1,{className:"sr-only",children:[a.jsx(Z1,{children:"Sidebar"}),a.jsx(J1,{children:"Displays the mobile sidebar."})]}),a.jsx("div",{className:"flex h-full w-full flex-col",children:s})]})}):a.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":l,"data-collapsible":l==="collapsed"?r:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:[a.jsx("div",{"data-slot":"sidebar-gap",className:z("relative w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem)]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)]")}),a.jsx("div",{"data-slot":"sidebar-container",className:z("fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200 ease-linear md:flex",e==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem+2px)]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)] group-data-[side=left]:border-r group-data-[side=right]:border-l",n),...i,children:a.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:s})})]})}function qu({className:e,onClick:t,...r}){const{toggleSidebar:n}=dx();return a.jsxs(ne,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:z("size-7",e),onClick:s=>{t==null||t(s),n()},...r,children:[a.jsx(j5,{}),a.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function Hu({className:e,...t}){return a.jsx("main",{"data-slot":"sidebar-inset",className:z("bg-background relative flex w-full flex-1 flex-col","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",e),...t})}function Ku({className:e,...t}){return a.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:z("flex flex-col gap-2 p-2",e),...t})}function Yu({className:e,...t}){return a.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:z("flex flex-col gap-2 p-2",e),...t})}function Zv({className:e,...t}){return a.jsx(go,{"data-slot":"sidebar-separator","data-sidebar":"separator",className:z("bg-sidebar-border mx-2 w-auto",e),...t})}function Gu({className:e,...t}){return a.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:z("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function Us({className:e,...t}){return a.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:z("relative flex w-full min-w-0 flex-col p-2",e),...t})}function Jv({className:e,asChild:t=!1,...r}){const n=t?Wp:"div";return a.jsx(n,{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:z("text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-none transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...r})}function qs({className:e,...t}){return a.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:z("w-full text-sm",e),...t})}function Nr({className:e,...t}){return a.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:z("flex w-full min-w-0 flex-col gap-1",e),...t})}function Mt({className:e,...t}){return a.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:z("group/menu-item relative",e),...t})}const wD=Zl("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}}),St=h.forwardRef(function({asChild:t=!1,isActive:r=!1,variant:n="default",size:s="default",tooltip:i,className:o,...l},c){const d=t?Wp:"button",{isMobile:u,state:f}=dx(),m=a.jsx(d,{ref:c,"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":s,"data-active":r,className:z(wD({variant:n,size:s}),o),...l});return i?(typeof i=="string"&&(i={children:i}),a.jsxs(Qn,{children:[a.jsx(Zn,{asChild:!0,children:m}),a.jsx(_n,{side:"right",align:"center",hidden:f!=="collapsed"||u,...i})]})):m});St.displayName="SidebarMenuButton";const jD=250,ND=300,Jr={all:["projects"],list:()=>[...Jr.all,"list"],detail:e=>[...Jr.all,e],byKey:e=>[...Jr.all,"key",e],activities:e=>[...Jr.all,e,"activities"]};function vo(e){const{workspace:t}=Ie(),r=!(e!=null&&e.allWorkspaces),n=r?t==null?void 0:t.id:void 0;return Be({queryKey:[...Jr.list(),n??"all"],queryFn:()=>{const s=n?`?workspace_id=${n}`:"";return oe.get(`/admin/projects${s}`)},select:s=>s.projects,enabled:r?!!(t!=null&&t.id):!0})}function Wa(e){return Be({queryKey:Jr.byKey(e),queryFn:()=>oe.get(`/admin/projects/by-identifier/${encodeURIComponent(e)}`),select:t=>t.project,enabled:!!e})}function kD(e,t={}){const[r,n]=h.useState(e),s=t.enabled!==!1;return h.useEffect(()=>{if(!s)return;const l=setTimeout(()=>n(e),jD);return()=>clearTimeout(l)},[e,s]),{...Be({queryKey:["projects","suggest-identifier",r],queryFn:()=>oe.get(`/admin/projects/suggest-identifier?name=${encodeURIComponent(r)}`),select:l=>l.identifier,enabled:s&&r.trim().length>0}),flush:()=>n(e)}}function SD(e,t={}){const r=e.toUpperCase().replace(/[^A-Z0-9]/g,""),[n,s]=h.useState(r),i=t.enabled!==!1&&r.length>=3;h.useEffect(()=>{if(!r){s("");return}const l=setTimeout(()=>s(r),ND);return()=>clearTimeout(l)},[r]);const o=Be({queryKey:["projects","check-identifier",n],queryFn:()=>oe.get(`/admin/projects/check-identifier/${encodeURIComponent(n)}`),select:l=>l.available,enabled:i&&n.length>=3});return{available:o.data,isLoading:o.isLoading,isFetching:o.isFetching}}function CD(){const e=Se();return be({mutationFn:t=>oe.post("/admin/projects",t),onSuccess:()=>{e.invalidateQueries({queryKey:Jr.list()})}})}function _D(){const e=Se();return be({mutationFn:t=>oe.delete(`/admin/projects/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:Jr.list()})}})}function MD(e){const t=Se();return be({mutationFn:()=>oe.post(`/admin/projects/${e}/share`,{}),onSuccess:()=>{t.invalidateQueries({queryKey:Jr.detail(e)}),t.invalidateQueries({queryKey:Jr.list()})}})}function OD(e){const t=Se();return be({mutationFn:()=>oe.delete(`/admin/projects/${e}/share`),onSuccess:()=>{t.invalidateQueries({queryKey:Jr.detail(e)}),t.invalidateQueries({queryKey:Jr.list()})}})}function PD(e){return Be({queryKey:Jr.activities(e),queryFn:()=>oe.get(`/admin/projects/${e}/activities`),select:t=>t.activities,enabled:!!e})}const Kr=PP,Yr=EP,ED=h.forwardRef(({className:e,inset:t,children:r,...n},s)=>a.jsxs(Ij,{ref:s,className:z("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...n,children:[r,a.jsx(vr,{className:"ml-auto"})]}));ED.displayName=Ij.displayName;const AD=h.forwardRef(({className:e,...t},r)=>a.jsx(Rj,{ref:r,className:z("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));AD.displayName=Rj.displayName;const Or=h.forwardRef(({className:e,sideOffset:t=4,...r},n)=>a.jsx(OP,{children:a.jsx($j,{ref:n,sideOffset:t,className:z("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));Or.displayName=$j.displayName;const at=h.forwardRef(({className:e,inset:t,...r},n)=>a.jsx(zj,{ref:n,className:z("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...r}));at.displayName=zj.displayName;const DD=h.forwardRef(({className:e,children:t,checked:r,...n},s)=>a.jsxs(Lj,{ref:s,className:z("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Fj,{children:a.jsx(dr,{className:"h-4 w-4"})})}),t]}));DD.displayName=Lj.displayName;const TD=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(Bj,{ref:n,className:z("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Fj,{children:a.jsx(_r,{className:"h-2 w-2 fill-current"})})}),t]}));TD.displayName=Bj.displayName;const ux=h.forwardRef(({className:e,inset:t,...r},n)=>a.jsx(Wj,{ref:n,className:z("px-2 py-1.5 text-xs font-medium text-muted-foreground",t&&"pl-8",e),...r}));ux.displayName=Wj.displayName;const Pn=h.forwardRef(({className:e,...t},r)=>a.jsx(Uj,{ref:r,className:z("-mx-1 my-1 h-px bg-border",e),...t}));Pn.displayName=Uj.displayName;const Rt=h.forwardRef(({className:e,...t},r)=>a.jsx(qj,{ref:r,className:z("relative flex h-8 w-8 shrink-0 overflow-hidden rounded-full",e),...t}));Rt.displayName=qj.displayName;const wl=h.forwardRef(({className:e,...t},r)=>a.jsx(Hj,{ref:r,className:z("aspect-square h-full w-full",e),...t}));wl.displayName=Hj.displayName;const $t=h.forwardRef(({className:e,...t},r)=>a.jsx(Kj,{ref:r,className:z("flex h-full w-full items-center justify-center rounded-full bg-muted text-xs font-medium text-muted-foreground",e),...t}));$t.displayName=Kj.displayName;function ID(){var s;const{workspace:e,setWorkspace:t}=Ie(),{data:r}=xo(),n=pt();return a.jsx(Nr,{children:a.jsx(Mt,{children:a.jsxs(Kr,{children:[a.jsx(Yr,{asChild:!0,children:a.jsxs(St,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[e!=null&&e.logo_url?a.jsx("img",{src:e.logo_url,alt:e.name,className:"size-8 rounded-lg object-cover shrink-0"}):a.jsx("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg bg-foreground text-background shrink-0",children:a.jsx("span",{className:"text-[13px] font-bold",children:(((s=e==null?void 0:e.name)==null?void 0:s[0])??"M").toUpperCase()})}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:(e==null?void 0:e.name)??"Meridian"}),a.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(e==null?void 0:e.slug)??""})]}),a.jsx(ho,{className:"ml-auto size-4 shrink-0"})]})}),a.jsxs(Or,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"bottom",align:"start",sideOffset:4,children:[a.jsx(ux,{className:"text-xs text-muted-foreground font-normal",children:"Workspaces"}),r==null?void 0:r.map(i=>a.jsxs(at,{className:"cursor-pointer gap-2 p-2",onClick:()=>{t({id:i.id,name:i.name,slug:i.slug,logo_url:i.logo_url}),n(`/${i.slug}/projects`)},children:[i.logo_url?a.jsx("img",{src:i.logo_url,alt:i.name,className:"size-6 rounded-sm object-cover shrink-0"}):a.jsx("div",{className:"flex size-6 items-center justify-center rounded-sm bg-foreground text-background shrink-0",children:a.jsx("span",{className:"text-[10px] font-bold",children:i.name[0].toUpperCase()})}),a.jsx("span",{className:"flex-1 truncate",children:i.name}),i.id===(e==null?void 0:e.id)&&a.jsx(dr,{className:"size-3.5 text-muted-foreground shrink-0"})]},i.id)),a.jsx(Pn,{}),a.jsxs(at,{className:"cursor-pointer gap-2 p-2 text-muted-foreground",onClick:()=>n("/setup"),children:[a.jsx("div",{className:"flex size-6 items-center justify-center rounded-md border bg-background",children:a.jsx("span",{className:"text-xs font-semibold",children:"+"})}),a.jsx("span",{children:"Create workspace"})]})]})]})})})}function RD(){var i,o,l,c;const{user:e,logout:t}=Ie(),r=pt(),n=e&&(`${((i=e.first_name)==null?void 0:i[0])??""}${((o=e.last_name)==null?void 0:o[0])??""}`.toUpperCase()||((c=(l=e.email)==null?void 0:l[0])==null?void 0:c.toUpperCase()))||"?",s=e?[e.first_name,e.last_name].filter(Boolean).join(" ")||e.email:"User";return a.jsx(Nr,{children:a.jsx(Mt,{children:a.jsxs(Kr,{children:[a.jsx(Yr,{asChild:!0,children:a.jsxs(St,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[a.jsxs(Rt,{className:"h-8 w-8 rounded-lg shrink-0",children:[(e==null?void 0:e.avatar_url)&&a.jsx(wl,{src:e.avatar_url,alt:s??"",className:"object-cover"}),a.jsx($t,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:n})]}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:s}),a.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(e==null?void 0:e.email)??""})]}),a.jsx(ho,{className:"ml-auto size-4 shrink-0"})]})}),a.jsxs(Or,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[a.jsx(ux,{className:"p-0 font-normal",children:a.jsxs("div",{className:"flex items-center gap-2 px-1 py-1.5 text-left text-sm",children:[a.jsxs(Rt,{className:"h-8 w-8 rounded-lg",children:[(e==null?void 0:e.avatar_url)&&a.jsx(wl,{src:e.avatar_url,alt:s??"",className:"object-cover"}),a.jsx($t,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:n})]}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:s}),a.jsx("span",{className:"truncate text-xs text-muted-foreground",children:(e==null?void 0:e.email)??""})]})]})}),a.jsx(Pn,{}),a.jsxs(at,{className:"cursor-pointer gap-2",onClick:()=>r("/profile"),children:[a.jsx(tc,{className:"size-4"}),"Profile"]}),a.jsx(Pn,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:t,children:[a.jsx(zu,{className:"size-4"}),"Sign out"]})]})]})})})}function $D({...e}){var w,k,b;const{workspace:t,projectKey:r}=zt(),{data:n}=vo(),{toggle:s}=Gp(),{user:i}=Ie(),o=Kl(),l=t??"",c=o.pathname===`/${l}/projects`,d=o.pathname===`/${l}/my-tasks`,u=o.pathname.includes("/notifications"),f=o.pathname.includes("/settings"),m=o.pathname.includes("/roles"),p=o.pathname===`/${l}/reporting`,x=o.pathname.startsWith("/reporting"),g=o.pathname.startsWith("/org/settings"),v=((w=i==null?void 0:i.roles)==null?void 0:w.includes("super-admin"))??!1,y=v||(((k=i==null?void 0:i.roles)==null?void 0:k.includes("admin"))??!1),j=((b=i==null?void 0:i.permissions)==null?void 0:b.includes("workspace:admin"))??!1,N=y||j;return a.jsxs(Uu,{collapsible:"offcanvas",...e,children:[a.jsx(Ku,{children:a.jsx(ID,{})}),a.jsxs(Gu,{children:[a.jsx(Us,{children:a.jsx(qs,{children:a.jsxs(Nr,{children:[a.jsx(Mt,{children:a.jsxs(St,{onClick:s,tooltip:"Search",children:[a.jsx(ji,{}),a.jsx("span",{children:"Search"}),a.jsx("kbd",{className:"ml-auto hidden text-[10px] text-sidebar-foreground/40 font-mono sm:inline-flex",children:"⌘K"})]})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:d,tooltip:"My Tasks",children:a.jsxs(wn,{to:`/${l}/my-tasks`,children:[a.jsx(Lu,{}),a.jsx("span",{children:"My Tasks"})]})})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:c,tooltip:"Projects",children:a.jsxs(wn,{to:`/${l}/projects`,end:!0,children:[a.jsx(Hr,{}),a.jsx("span",{children:"Projects"})]})})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:u,tooltip:"Notifications",children:a.jsxs(wn,{to:`/${l}/notifications`,children:[a.jsx(ri,{}),a.jsx("span",{children:"Notifications"})]})})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:p,tooltip:"Reports",children:a.jsxs(wn,{to:`/${l}/reporting`,children:[a.jsx(ys,{}),a.jsx("span",{children:"Reports"})]})})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:f,tooltip:"Settings",children:a.jsxs(wn,{to:`/${l}/settings`,children:[a.jsx(ox,{}),a.jsx("span",{children:"Workspace settings"})]})})})]})})}),n&&n.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(Zv,{}),a.jsxs(Us,{children:[a.jsx(Jv,{children:"Recent"}),a.jsx(qs,{children:a.jsx(Nr,{children:n.slice(0,5).map(C=>a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:C.identifier===r,tooltip:C.name,className:"data-[active=true]:bg-indigo-50 dark:data-[active=true]:bg-indigo-950/50 data-[active=true]:text-indigo-700 dark:data-[active=true]:text-indigo-300",children:a.jsxs(wn,{to:`/${l}/projects/${C.identifier}/board`,children:[a.jsx("span",{className:"font-mono text-[10px] text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/50 px-1 py-0.5 rounded shrink-0",children:C.identifier}),a.jsx("span",{className:"truncate",children:C.name})]})})},C.id))})})]})]}),N&&a.jsxs(a.Fragment,{children:[a.jsx(Zv,{}),a.jsxs(Us,{children:[a.jsx(Jv,{children:"Global"}),a.jsx(qs,{children:a.jsxs(Nr,{children:[a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:x,tooltip:"Global Reports",children:a.jsxs(wn,{to:"/reporting",children:[a.jsx(ys,{}),a.jsx("span",{children:"Global Reports"})]})})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:g,tooltip:"Org Settings",children:a.jsxs(wn,{to:"/org/settings",children:[a.jsx(ix,{}),a.jsx("span",{children:"Org Settings"})]})})})]})})]})]}),a.jsx(Us,{className:"mt-auto",children:a.jsx(qs,{children:a.jsx(Nr,{children:v&&a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:m,tooltip:"Roles & Permissions",children:a.jsxs(wn,{to:`/${l}/roles`,children:[a.jsx(jh,{}),a.jsx("span",{children:"Custom Roles"})]})})})})})})]}),a.jsx(Yu,{children:a.jsx(RD,{})})]})}function Vu(){const{theme:e,setTheme:t}=dA();return a.jsxs(Qn,{children:[a.jsx(Zn,{asChild:!0,children:a.jsxs(ne,{variant:"ghost",size:"icon-sm",onClick:()=>t(e==="dark"?"light":"dark"),className:"text-muted-foreground hover:text-foreground",children:[a.jsx(P5,{className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),a.jsx(w5,{className:"absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),a.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),a.jsx(_n,{children:"Toggle theme"})]})}const nc={all:["notifications"],list:()=>[...nc.all,"list"]};function zD(){return Be({queryKey:nc.list(),queryFn:()=>oe.get("/admin/notifications"),select:e=>e.notifications})}function tN(){return Be({queryKey:[...nc.list(),"unread"],queryFn:()=>oe.get("/admin/notifications?unread=true"),select:e=>e.count,refetchInterval:3e4})}function LD(){const e=Se();return be({mutationFn:t=>oe.post(`/admin/notifications/${t}/read`),onSuccess:()=>{e.invalidateQueries({queryKey:nc.all})}})}function FD(){const e=Se();return be({mutationFn:()=>oe.post("/admin/notifications/read-all"),onSuccess:()=>{e.invalidateQueries({queryKey:nc.all})}})}function BD(){const e=Kl(),{projectKey:t}=zt(),{data:r}=vo(),n=r==null?void 0:r.find(i=>i.identifier===t),s=e.pathname;return s.includes("/board")?{icon:Hr,label:n?`${n.name} / Board`:"Board"}:s.includes("/issues")?{icon:Jn,label:n?`${n.name} / Issues`:"Issues"}:s.includes("/sprints")?{icon:oa,label:n?`${n.name} / Sprints`:"Sprints"}:s.includes("/timeline")?{icon:ni,label:n?`${n.name} / Timeline`:"Timeline"}:s.includes("/access")?{icon:Oa,label:n?`${n.name} / Access`:"Access"}:s.includes("/reports")?{icon:ys,label:n?`${n.name} / Reports`:"Reports"}:s.includes("/activity")?{icon:$u,label:n?`${n.name} / Activity`:"Activity"}:s.endsWith("/projects")?{icon:Sd,label:"Projects"}:s.includes("/notifications")?{icon:ri,label:"Notifications"}:s.includes("/settings")?{icon:ox,label:"Settings"}:{icon:Sd,label:"Meridian"}}function WD(){const{data:e=0}=tN(),{icon:t,label:r}=BD(),{workspace:n}=Ie(),s=(n==null?void 0:n.slug)??"";return a.jsx("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b transition-[width,height] ease-linear w-full",children:a.jsxs("div",{className:"flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6",children:[a.jsx(qu,{className:"-ml-1"}),a.jsx(go,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(t,{className:"h-4 w-4 text-indigo-600 dark:text-indigo-400",strokeWidth:1.5}),a.jsx("span",{className:"font-medium",children:r})]}),a.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[a.jsx("span",{className:"hidden md:flex",children:a.jsx(Vu,{})}),a.jsx(ne,{variant:"ghost",size:"icon",asChild:!0,className:"relative size-8 text-muted-foreground hover:text-foreground",children:a.jsxs(qr,{to:`/${s}/notifications`,children:[a.jsx(ri,{className:"h-4 w-4",strokeWidth:1.5}),e>0&&a.jsx("span",{className:"absolute -top-0.5 -right-0.5 h-3.5 w-3.5 rounded-full bg-indigo text-[9px] font-bold text-white flex items-center justify-center leading-none",children:e>9?"9+":e})]})})]})]})})}function UD(){const e=Kl(),{workspace:t}=zt(),r=t??"",{data:n=0}=tN(),{toggle:s}=Gp(),i=[{key:"projects",label:"Projects",icon:W1,to:`/${r}/projects`,match:/\/projects($|\/)/},{key:"notifications",label:"Notifications",icon:ri,to:`/${r}/notifications`,match:/\/notifications/,badge:n>0?n>9?"9+":String(n):null},{key:"my-tasks",label:"My Tasks",icon:Lu,to:`/${r}/my-tasks`,match:/\/my-tasks/},{key:"profile",label:"Profile",icon:tc,to:"/profile",match:/^\/profile/}];return a.jsx("nav",{className:"fixed bottom-0 left-0 right-0 z-50 bg-background border-t border-border md:hidden",children:a.jsxs("div",{className:"flex items-stretch h-16 pb-safe",children:[i.map(({key:o,label:l,icon:c,to:d,match:u,badge:f})=>{const m=u.test(e.pathname);return a.jsxs(qr,{to:d,className:z("flex flex-col items-center justify-center flex-1 gap-1 text-[10px] font-medium transition-colors relative",m?"text-indigo-600 dark:text-indigo-400":"text-muted-foreground hover:text-foreground"),children:[a.jsxs("div",{className:"relative",children:[a.jsx(c,{className:"h-5 w-5",strokeWidth:m?2:1.5}),f&&a.jsx("span",{className:"absolute -top-1 -right-1.5 h-3.5 w-3.5 rounded-full bg-indigo-600 text-[9px] font-bold text-white flex items-center justify-center leading-none",children:f})]}),a.jsx("span",{children:l})]},o)}),a.jsxs("button",{onClick:s,className:"flex flex-col items-center justify-center flex-1 gap-1 text-[10px] font-medium text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(ji,{className:"h-5 w-5",strokeWidth:1.5}),a.jsx("span",{children:"Search"})]})]})})}function qD(){const{user:e,token:t,login:r}=Ie();h.useEffect(()=>{!e||!t||!e.email||fetch("/admin/users/me",{headers:{Authorization:`Bearer ${t}`}}).then(n=>n.ok?n.json():null).then(n=>{n&&r({id:n.id,email:n.email,first_name:n.first_name??"",last_name:n.last_name??"",avatar_url:n.avatar_url??null},t)}).catch(()=>{})},[e==null?void 0:e.id])}function HD(){return qD(),a.jsxs(Wu,{children:[a.jsx($D,{variant:"inset"}),a.jsxs(Hu,{className:"flex flex-col min-w-0",children:[a.jsx(WD,{}),a.jsx("div",{className:"flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden pb-16 md:pb-0",children:a.jsx(Yl,{})})]}),a.jsx(UD,{})]})}const ac={project:e=>["projects",e,"access"]};function la(e){return Be({queryKey:ac.project(e),queryFn:()=>oe.get(`/admin/projects/${e}/access`),enabled:!!e})}function rN(e){const t=Se();return be({mutationFn:({userId:r,role:n})=>oe.post(`/admin/projects/${e}/members`,{user_id:r,role:n}),onSuccess:()=>{t.invalidateQueries({queryKey:ac.project(e)})}})}function nN(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/projects/${e}/members/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:ac.project(e)})}})}function aN(e){const t=Se();return be({mutationFn:r=>oe.post(`/admin/projects/${e}/teams`,{team_id:r}),onSuccess:()=>{t.invalidateQueries({queryKey:ac.project(e)})}})}function sN(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/projects/${e}/teams/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:ac.project(e)})}})}const Ua=Xl,KD=Vl,iN=h.forwardRef(({className:e,...t},r)=>a.jsx(gi,{ref:r,className:z("fixed inset-0 z-50 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));iN.displayName=gi.displayName;const ca=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(KD,{children:[a.jsx(iN,{}),a.jsxs(vi,{ref:n,className:z("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 bg-background border border-border p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",e),...r,children:[t,a.jsxs(Du,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[a.jsx(tt,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ca.displayName=vi.displayName;const qa=({className:e,...t})=>a.jsx("div",{className:z("flex flex-col space-y-1.5",e),...t});qa.displayName="DialogHeader";const fx=({className:e,...t})=>a.jsx("div",{className:z("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});fx.displayName="DialogFooter";const Ha=h.forwardRef(({className:e,...t},r)=>a.jsx(uo,{ref:r,className:z("text-base font-semibold leading-none tracking-tight",e),...t}));Ha.displayName=uo.displayName;const yo=h.forwardRef(({className:e,...t},r)=>a.jsx(fo,{ref:r,className:z("text-sm text-muted-foreground",e),...t}));yo.displayName=fo.displayName;function YD({open:e,onClose:t,project:r}){const[n,s]=h.useState(null),i=MD(r.id),o=OD(r.id),l=r.share_token,c=n??(l?`${window.location.origin}/share/${l}`:null),d=()=>{i.mutate(void 0,{onSuccess:p=>{const x=`${window.location.origin}/share/${p.project.share_token}`;s(x),H.success("Public link enabled")},onError:()=>H.error("Failed to enable public link")})},u=()=>{o.mutate(void 0,{onSuccess:()=>{s(null),H.success("Public link revoked")},onError:()=>H.error("Failed to revoke link")})},f=()=>{c&&navigator.clipboard.writeText(c).then(()=>{H.success("Link copied to clipboard")})},m=!!c;return a.jsx(Ua,{open:e,onOpenChange:p=>!p&&t(),children:a.jsxs(ca,{className:"sm:max-w-md overflow-hidden",children:[a.jsxs(qa,{children:[a.jsxs(Ha,{className:"flex items-center gap-2",children:[a.jsx(ai,{className:"h-4 w-4"}),"Share project"]}),a.jsx(yo,{children:"Allow anyone with the link to view this project without logging in."})]}),a.jsx("div",{className:"space-y-4 pt-2",children:m?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border bg-muted/50 px-3 py-2 overflow-hidden",children:[a.jsx(wh,{className:"h-3.5 w-3.5 text-green-600 shrink-0"}),a.jsx("span",{className:"text-xs text-muted-foreground min-w-0 flex-1 break-all",children:c})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ne,{variant:"outline",size:"sm",className:"flex-1",onClick:f,children:[a.jsx(ex,{className:"h-3.5 w-3.5 mr-1.5"}),"Copy link"]}),a.jsxs(ne,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:u,disabled:o.isPending,children:[a.jsx(Mr,{className:"h-3.5 w-3.5 mr-1.5"}),"Revoke"]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Anyone with this link can view the board, issues, and timeline. No account required."})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-dashed border-border px-3 py-4 text-center justify-center",children:[a.jsx(Oa,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"This project is private"})]}),a.jsxs(ne,{className:"w-full",onClick:d,disabled:i.isPending,children:[a.jsx(wh,{className:"h-4 w-4 mr-2"}),"Enable public link"]}),a.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Generates a secret link for read-only access. No write permissions granted."})]})})]})})}function oN(e=768){const[t,r]=h.useState(()=>typeof window<"u"?window.innerWidth<e:!1);return h.useEffect(()=>{const n=window.matchMedia(`(max-width: ${e-1}px)`),s=i=>r(i.matches);return r(n.matches),n.addEventListener("change",s),()=>n.removeEventListener("change",s)},[e]),t}const ey=["board","issues","sprints","timeline","access","reports","activity"];function GD(){const{projectKey:e,workspace:t}=zt(),{data:r,error:n}=Wa(e??""),{user:s}=Ie(),{data:i}=la((r==null?void 0:r.id)??""),[o,l]=h.useState(!1),c=pt(),d=Kl(),[u]=Gl(),f=oN(),m=(s==null?void 0:s.roles)??[],p=m.includes("super-admin")||m.includes("admin"),x=i==null?void 0:i.members.some(k=>k.user_id===(s==null?void 0:s.id)&&k.role==="manager"),g=p||x;h.useEffect(()=>{n&&n instanceof Xp&&(n.status===403||n.status===404)&&c(`/${t}/projects`,{replace:!0})},[n,t,c]),h.useEffect(()=>{const k=u.get("tab");if(!k||!ey.includes(k))return;ey.every(C=>!d.pathname.endsWith(`/${C}`))&&c(`/${t}/projects/${e}/${k}`,{replace:!0})},[]);const v=`/${t}/projects/${e}`,y=[{to:`${v}/board`,label:"Board",icon:Sd,end:!0,desktopOnly:!0},{to:`${v}/issues`,label:"Issues",icon:Jn,end:!1},{to:`${v}/sprints`,label:"Sprints",icon:oa,end:!0},{to:`${v}/timeline`,label:"Timeline",icon:ni,end:!0,desktopOnly:!0},{to:`${v}/access`,label:"Access",icon:Oa,end:!0},{to:`${v}/reports`,label:"Reports",icon:ys,end:!0},{to:`${v}/activity`,label:"Activity",icon:$u,end:!0}],j=y,N=y.filter(k=>!k.desktopOnly),w=d.pathname.endsWith("/board")||d.pathname.endsWith("/timeline");return f&&w?a.jsx(Xn,{to:`${v}/issues`,replace:!0}):a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"border-b border-border bg-white dark:bg-card shrink-0 px-4 pt-4 md:px-6 md:pt-5",children:[a.jsxs("div",{className:"flex items-center gap-2.5 mb-3 md:mb-4",children:[r&&a.jsx("span",{className:"text-xs font-mono text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/50 border border-indigo-200 dark:border-indigo-800 px-2 py-0.5 rounded",children:r.identifier}),a.jsx("h1",{className:"text-sm font-semibold",children:(r==null?void 0:r.name)??""})]}),a.jsxs("div",{className:"hidden md:flex items-center -mb-px",children:[a.jsx("div",{className:"flex flex-1",children:j.map(({to:k,label:b,icon:C,end:_})=>a.jsxs(wn,{to:k,end:_,className:({isActive:S})=>`flex items-center gap-1.5 px-3 py-2 text-sm border-b-2 transition-colors ${S?"border-foreground text-foreground font-medium":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[a.jsx(C,{className:"h-3.5 w-3.5",strokeWidth:1.5}),b]},k))}),g&&r&&a.jsx("div",{className:"pb-px pr-1",children:a.jsxs(ne,{variant:"ghost",size:"sm",onClick:()=>l(!0),className:"h-7 px-2 text-xs text-muted-foreground",children:[a.jsx(_5,{className:"h-3.5 w-3.5 mr-1"}),"Share"]})})]}),a.jsx("div",{className:"flex md:hidden overflow-x-auto -mb-px scrollbar-none",children:N.map(({to:k,label:b,icon:C,end:_})=>a.jsxs(wn,{to:k,end:_,className:({isActive:S})=>`flex items-center gap-1.5 px-3 py-2 text-sm border-b-2 whitespace-nowrap transition-colors shrink-0 ${S?"border-indigo-600 text-indigo-600 dark:border-indigo-400 dark:text-indigo-400 font-medium":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[a.jsx(C,{className:"h-3.5 w-3.5",strokeWidth:1.5}),b]},k))})]}),a.jsx("div",{className:"flex flex-col flex-1 min-h-0",children:a.jsx(Yl,{})}),r&&a.jsx(YD,{open:o,onClose:()=>l(!1),project:r})]})}function VD(){var s,i;const{user:e,logout:t}=Ie(),r=e?`${((s=e.first_name)==null?void 0:s[0])??""}${((i=e.last_name)==null?void 0:i[0])??""}`.toUpperCase()||e.email[0].toUpperCase():"?",n=e?[e.first_name,e.last_name].filter(Boolean).join(" ")||e.email:"User";return a.jsx(Nr,{children:a.jsx(Mt,{children:a.jsxs(Kr,{children:[a.jsx(Yr,{asChild:!0,children:a.jsxs(St,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[a.jsx(Rt,{className:"h-8 w-8 rounded-lg shrink-0",children:a.jsx($t,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:r})}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:n}),a.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(e==null?void 0:e.email)??""})]}),a.jsx(ho,{className:"ml-auto size-4 shrink-0"})]})}),a.jsxs(Or,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[a.jsx(Pn,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:t,children:[a.jsx(zu,{className:"size-4"}),"Sign out"]})]})]})})})}function XD(){const{workspace:e}=Ie(),t=pt(),r=(e==null?void 0:e.slug)??"";return a.jsxs(Uu,{collapsible:"offcanvas",variant:"inset",children:[a.jsx(Ku,{children:a.jsx(Nr,{children:a.jsx(Mt,{children:a.jsxs(St,{size:"lg",className:"data-[state=open]:bg-sidebar-accent",children:[a.jsx("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg bg-foreground text-background shrink-0",children:a.jsx(ys,{className:"size-4"})}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:"Reporting"}),a.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:"Time analytics"})]})]})})})}),a.jsx(Gu,{children:a.jsx(Us,{children:a.jsx(qs,{children:a.jsx(Nr,{children:a.jsx(Mt,{children:a.jsxs(St,{onClick:()=>t(r?`/${r}/projects`:"/"),tooltip:"Back to workspace",children:[a.jsx(Jl,{}),a.jsx("span",{children:"Back to workspace"})]})})})})})}),a.jsx(Yu,{children:a.jsx(VD,{})})]})}function QD(){return a.jsxs(Wu,{children:[a.jsx(XD,{}),a.jsxs(Hu,{className:"flex flex-col min-w-0",children:[a.jsx("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b w-full",children:a.jsxs("div",{className:"flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6",children:[a.jsx(qu,{className:"-ml-1"}),a.jsx(go,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(ys,{className:"h-4 w-4 text-indigo-600 dark:text-indigo-400",strokeWidth:1.5}),a.jsx("span",{className:"font-medium",children:"Reporting"})]}),a.jsx("div",{className:"ml-auto",children:a.jsx(Vu,{})})]})}),a.jsx("div",{className:"flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden",children:a.jsx(Yl,{})})]})]})}function ZD(){var s,i;const{user:e,logout:t}=Ie(),r=e?`${((s=e.first_name)==null?void 0:s[0])??""}${((i=e.last_name)==null?void 0:i[0])??""}`.toUpperCase()||e.email[0].toUpperCase():"?",n=e?[e.first_name,e.last_name].filter(Boolean).join(" ")||e.email:"User";return a.jsx(Nr,{children:a.jsx(Mt,{children:a.jsxs(Kr,{children:[a.jsx(Yr,{asChild:!0,children:a.jsxs(St,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[a.jsx(Rt,{className:"h-8 w-8 rounded-lg shrink-0",children:a.jsx($t,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:r})}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:n}),a.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(e==null?void 0:e.email)??""})]}),a.jsx(ho,{className:"ml-auto size-4 shrink-0"})]})}),a.jsxs(Or,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[a.jsx(Pn,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:t,children:[a.jsx(zu,{className:"size-4"}),"Sign out"]})]})]})})})}function JD(){const{workspace:e}=Ie(),t=pt(),r=(e==null?void 0:e.slug)??"";return a.jsxs(Uu,{collapsible:"offcanvas",variant:"inset",children:[a.jsx(Ku,{children:a.jsx(Nr,{children:a.jsx(Mt,{children:a.jsxs(St,{size:"lg",className:"data-[state=open]:bg-sidebar-accent",children:[a.jsx("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg bg-foreground text-background shrink-0",children:a.jsx(ix,{className:"size-4"})}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:"Org Settings"}),a.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:"Global configuration"})]})]})})})}),a.jsx(Gu,{children:a.jsx(Us,{children:a.jsx(qs,{children:a.jsx(Nr,{children:a.jsx(Mt,{children:a.jsxs(St,{onClick:()=>t(r?`/${r}/projects`:"/"),tooltip:"Back to workspace",children:[a.jsx(Jl,{}),a.jsx("span",{children:"Back to workspace"})]})})})})})}),a.jsx(Yu,{children:a.jsx(ZD,{})})]})}function eT(){return a.jsxs(Wu,{children:[a.jsx(JD,{}),a.jsxs(Hu,{className:"flex flex-col min-w-0",children:[a.jsx("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b w-full",children:a.jsxs("div",{className:"flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6",children:[a.jsx(qu,{className:"-ml-1"}),a.jsx(go,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(ix,{className:"h-4 w-4 text-indigo-600 dark:text-indigo-400",strokeWidth:1.5}),a.jsx("span",{className:"font-medium",children:"Org Settings"})]}),a.jsx("div",{className:"ml-auto",children:a.jsx(Vu,{})})]})}),a.jsx("div",{className:"flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden",children:a.jsx(Yl,{})})]})]})}function tT(){var s,i;const{user:e,logout:t}=Ie(),r=e?`${((s=e.first_name)==null?void 0:s[0])??""}${((i=e.last_name)==null?void 0:i[0])??""}`.toUpperCase()||e.email[0].toUpperCase():"?",n=e?[e.first_name,e.last_name].filter(Boolean).join(" ")||e.email:"User";return a.jsx(Nr,{children:a.jsx(Mt,{children:a.jsxs(Kr,{children:[a.jsx(Yr,{asChild:!0,children:a.jsxs(St,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[a.jsxs(Rt,{className:"h-8 w-8 rounded-lg shrink-0",children:[(e==null?void 0:e.avatar_url)&&a.jsx(wl,{src:e.avatar_url,alt:n??"",className:"object-cover"}),a.jsx($t,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:r})]}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:n}),a.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(e==null?void 0:e.email)??""})]}),a.jsx(ho,{className:"ml-auto size-4 shrink-0"})]})}),a.jsxs(Or,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[a.jsx(Pn,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:t,children:[a.jsx(zu,{className:"size-4"}),"Sign out"]})]})]})})})}function rT(){const{workspace:e}=Ie(),t=pt(),r=(e==null?void 0:e.slug)??"";return a.jsxs(Uu,{collapsible:"offcanvas",variant:"inset",children:[a.jsx(Ku,{children:a.jsx(Nr,{children:a.jsx(Mt,{children:a.jsxs(St,{size:"lg",className:"data-[state=open]:bg-sidebar-accent",children:[a.jsx("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg bg-foreground text-background shrink-0",children:a.jsx(tc,{className:"size-4"})}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:"Profile"}),a.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:"Personal settings"})]})]})})})}),a.jsx(Gu,{children:a.jsx(Us,{children:a.jsx(qs,{children:a.jsx(Nr,{children:a.jsx(Mt,{children:a.jsxs(St,{onClick:()=>t(r?`/${r}/projects`:"/"),tooltip:"Back to workspace",children:[a.jsx(Jl,{}),a.jsx("span",{children:"Back to workspace"})]})})})})})}),a.jsx(Yu,{children:a.jsx(tT,{})})]})}function nT(){return a.jsxs(Wu,{children:[a.jsx(rT,{}),a.jsxs(Hu,{className:"flex flex-col min-w-0",children:[a.jsx("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b w-full",children:a.jsxs("div",{className:"flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6",children:[a.jsx(qu,{className:"-ml-1"}),a.jsx(go,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(tc,{className:"h-4 w-4 text-indigo-600 dark:text-indigo-400",strokeWidth:1.5}),a.jsx("span",{className:"font-medium",children:"Profile"})]}),a.jsx("div",{className:"ml-auto",children:a.jsx(Vu,{})})]})}),a.jsx("div",{className:"flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden",children:a.jsx(Yl,{})})]})]})}var ty=1,aT=.9,sT=.8,iT=.17,vm=.1,ym=.999,oT=.9999,lT=.99,cT=/[\\\/_+.#"@\[\(\{&]/,dT=/[\\\/_+.#"@\[\(\{&]/g,uT=/[\s-]/,lN=/[\s-]/g;function Nh(e,t,r,n,s,i,o){if(i===t.length)return s===e.length?ty:lT;var l=`${s},${i}`;if(o[l]!==void 0)return o[l];for(var c=n.charAt(i),d=r.indexOf(c,s),u=0,f,m,p,x;d>=0;)f=Nh(e,t,r,n,d+1,i+1,o),f>u&&(d===s?f*=ty:cT.test(e.charAt(d-1))?(f*=sT,p=e.slice(s,d-1).match(dT),p&&s>0&&(f*=Math.pow(ym,p.length))):uT.test(e.charAt(d-1))?(f*=aT,x=e.slice(s,d-1).match(lN),x&&s>0&&(f*=Math.pow(ym,x.length))):(f*=iT,s>0&&(f*=Math.pow(ym,d-s))),e.charAt(d)!==t.charAt(i)&&(f*=oT)),(f<vm&&r.charAt(d-1)===n.charAt(i+1)||n.charAt(i+1)===n.charAt(i)&&r.charAt(d-1)!==n.charAt(i))&&(m=Nh(e,t,r,n,d+1,i+2,o),m*vm>f&&(f=m*vm)),f>u&&(u=f),d=r.indexOf(c,d+1);return o[l]=u,u}function ry(e){return e.toLowerCase().replace(lN," ")}function fT(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,Nh(e,t,ry(e),ry(t),0,0,{})}var Wo='[cmdk-group=""]',bm='[cmdk-group-items=""]',mT='[cmdk-group-heading=""]',mx='[cmdk-item=""]',ny=`${mx}:not([aria-disabled="true"])`,kh="cmdk-item-select",Bs="data-value",hT=(e,t,r)=>fT(e,t,r),cN=h.createContext(void 0),sc=()=>h.useContext(cN),dN=h.createContext(void 0),hx=()=>h.useContext(dN),uN=h.createContext(void 0),fN=h.forwardRef((e,t)=>{let r=$i(()=>{var R,q;return{search:"",value:(q=(R=e.value)!=null?R:e.defaultValue)!=null?q:"",filtered:{count:0,items:new Map,groups:new Set}}}),n=$i(()=>new Set),s=$i(()=>new Map),i=$i(()=>new Map),o=$i(()=>new Set),l=mN(e),{label:c,children:d,value:u,onValueChange:f,filter:m,shouldFilter:p,loop:x,disablePointerSelection:g=!1,vimBindings:v=!0,...y}=e,j=Wi(),N=Wi(),w=Wi(),k=h.useRef(null),b=ST();oi(()=>{if(u!==void 0){let R=u.trim();r.current.value=R,C.emit()}},[u]),oi(()=>{b(6,L)},[]);let C=h.useMemo(()=>({subscribe:R=>(o.current.add(R),()=>o.current.delete(R)),snapshot:()=>r.current,setState:(R,q,$)=>{var K,D,E;if(!Object.is(r.current[R],q)){if(r.current[R]=q,R==="search")O(),I(),b(1,A);else if(R==="value"&&($||b(5,L),((K=l.current)==null?void 0:K.value)!==void 0)){let Z=q??"";(E=(D=l.current).onValueChange)==null||E.call(D,Z);return}C.emit()}},emit:()=>{o.current.forEach(R=>R())}}),[]),_=h.useMemo(()=>({value:(R,q,$)=>{var K;q!==((K=i.current.get(R))==null?void 0:K.value)&&(i.current.set(R,{value:q,keywords:$}),r.current.filtered.items.set(R,S(q,$)),b(2,()=>{I(),C.emit()}))},item:(R,q)=>(n.current.add(R),q&&(s.current.has(q)?s.current.get(q).add(R):s.current.set(q,new Set([R]))),b(3,()=>{O(),I(),r.current.value||A(),C.emit()}),()=>{i.current.delete(R),n.current.delete(R),r.current.filtered.items.delete(R);let $=F();b(4,()=>{O(),($==null?void 0:$.getAttribute("id"))===R&&A(),C.emit()})}),group:R=>(s.current.has(R)||s.current.set(R,new Set),()=>{i.current.delete(R),s.current.delete(R)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:j,inputId:w,labelId:N,listInnerRef:k}),[]);function S(R,q){var $,K;let D=(K=($=l.current)==null?void 0:$.filter)!=null?K:hT;return R?D(R,r.current.search,q):0}function I(){if(!r.current.search||l.current.shouldFilter===!1)return;let R=r.current.filtered.items,q=[];r.current.filtered.groups.forEach(K=>{let D=s.current.get(K),E=0;D.forEach(Z=>{let B=R.get(Z);E=Math.max(B,E)}),q.push([K,E])});let $=k.current;X().sort((K,D)=>{var E,Z;let B=K.getAttribute("id"),Y=D.getAttribute("id");return((E=R.get(Y))!=null?E:0)-((Z=R.get(B))!=null?Z:0)}).forEach(K=>{let D=K.closest(bm);D?D.appendChild(K.parentElement===D?K:K.closest(`${bm} > *`)):$.appendChild(K.parentElement===$?K:K.closest(`${bm} > *`))}),q.sort((K,D)=>D[1]-K[1]).forEach(K=>{var D;let E=(D=k.current)==null?void 0:D.querySelector(`${Wo}[${Bs}="${encodeURIComponent(K[0])}"]`);E==null||E.parentElement.appendChild(E)})}function A(){let R=X().find($=>$.getAttribute("aria-disabled")!=="true"),q=R==null?void 0:R.getAttribute(Bs);C.setState("value",q||void 0)}function O(){var R,q,$,K;if(!r.current.search||l.current.shouldFilter===!1){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let D=0;for(let E of n.current){let Z=(q=(R=i.current.get(E))==null?void 0:R.value)!=null?q:"",B=(K=($=i.current.get(E))==null?void 0:$.keywords)!=null?K:[],Y=S(Z,B);r.current.filtered.items.set(E,Y),Y>0&&D++}for(let[E,Z]of s.current)for(let B of Z)if(r.current.filtered.items.get(B)>0){r.current.filtered.groups.add(E);break}r.current.filtered.count=D}function L(){var R,q,$;let K=F();K&&(((R=K.parentElement)==null?void 0:R.firstChild)===K&&(($=(q=K.closest(Wo))==null?void 0:q.querySelector(mT))==null||$.scrollIntoView({block:"nearest"})),K.scrollIntoView({block:"nearest"}))}function F(){var R;return(R=k.current)==null?void 0:R.querySelector(`${mx}[aria-selected="true"]`)}function X(){var R;return Array.from(((R=k.current)==null?void 0:R.querySelectorAll(ny))||[])}function T(R){let q=X()[R];q&&C.setState("value",q.getAttribute(Bs))}function G(R){var q;let $=F(),K=X(),D=K.findIndex(Z=>Z===$),E=K[D+R];(q=l.current)!=null&&q.loop&&(E=D+R<0?K[K.length-1]:D+R===K.length?K[0]:K[D+R]),E&&C.setState("value",E.getAttribute(Bs))}function re(R){let q=F(),$=q==null?void 0:q.closest(Wo),K;for(;$&&!K;)$=R>0?NT($,Wo):kT($,Wo),K=$==null?void 0:$.querySelector(ny);K?C.setState("value",K.getAttribute(Bs)):G(R)}let J=()=>T(X().length-1),P=R=>{R.preventDefault(),R.metaKey?J():R.altKey?re(1):G(1)},M=R=>{R.preventDefault(),R.metaKey?T(0):R.altKey?re(-1):G(-1)};return h.createElement(Ns.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:R=>{var q;if((q=y.onKeyDown)==null||q.call(y,R),!R.defaultPrevented)switch(R.key){case"n":case"j":{v&&R.ctrlKey&&P(R);break}case"ArrowDown":{P(R);break}case"p":case"k":{v&&R.ctrlKey&&M(R);break}case"ArrowUp":{M(R);break}case"Home":{R.preventDefault(),T(0);break}case"End":{R.preventDefault(),J();break}case"Enter":if(!R.nativeEvent.isComposing&&R.keyCode!==229){R.preventDefault();let $=F();if($){let K=new Event(kh);$.dispatchEvent(K)}}}}},h.createElement("label",{"cmdk-label":"",htmlFor:_.inputId,id:_.labelId,style:_T},c),Xu(e,R=>h.createElement(dN.Provider,{value:C},h.createElement(cN.Provider,{value:_},R))))}),pT=h.forwardRef((e,t)=>{var r,n;let s=Wi(),i=h.useRef(null),o=h.useContext(uN),l=sc(),c=mN(e),d=(n=(r=c.current)==null?void 0:r.forceMount)!=null?n:o==null?void 0:o.forceMount;oi(()=>{if(!d)return l.item(s,o==null?void 0:o.id)},[d]);let u=hN(s,i,[e.value,e.children,i],e.keywords),f=hx(),m=li(b=>b.value&&b.value===u.current),p=li(b=>d||l.filter()===!1?!0:b.search?b.filtered.items.get(s)>0:!0);h.useEffect(()=>{let b=i.current;if(!(!b||e.disabled))return b.addEventListener(kh,x),()=>b.removeEventListener(kh,x)},[p,e.onSelect,e.disabled]);function x(){var b,C;g(),(C=(b=c.current).onSelect)==null||C.call(b,u.current)}function g(){f.setState("value",u.current,!0)}if(!p)return null;let{disabled:v,value:y,onSelect:j,forceMount:N,keywords:w,...k}=e;return h.createElement(Ns.div,{ref:jl([i,t]),...k,id:s,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!m,"data-disabled":!!v,"data-selected":!!m,onPointerMove:v||l.getDisablePointerSelection()?void 0:g,onClick:v?void 0:x},e.children)}),xT=h.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:s,...i}=e,o=Wi(),l=h.useRef(null),c=h.useRef(null),d=Wi(),u=sc(),f=li(p=>s||u.filter()===!1?!0:p.search?p.filtered.groups.has(o):!0);oi(()=>u.group(o),[]),hN(o,l,[e.value,e.heading,c]);let m=h.useMemo(()=>({id:o,forceMount:s}),[s]);return h.createElement(Ns.div,{ref:jl([l,t]),...i,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},r&&h.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:d},r),Xu(e,p=>h.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},h.createElement(uN.Provider,{value:m},p))))}),gT=h.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,s=h.useRef(null),i=li(o=>!o.search);return!r&&!i?null:h.createElement(Ns.div,{ref:jl([s,t]),...n,"cmdk-separator":"",role:"separator"})}),vT=h.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,s=e.value!=null,i=hx(),o=li(u=>u.search),l=li(u=>u.value),c=sc(),d=h.useMemo(()=>{var u;let f=(u=c.listInnerRef.current)==null?void 0:u.querySelector(`${mx}[${Bs}="${encodeURIComponent(l)}"]`);return f==null?void 0:f.getAttribute("id")},[]);return h.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),h.createElement(Ns.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":d,id:c.inputId,type:"text",value:s?e.value:o,onChange:u=>{s||i.setState("search",u.target.value),r==null||r(u.target.value)}})}),yT=h.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...s}=e,i=h.useRef(null),o=h.useRef(null),l=sc();return h.useEffect(()=>{if(o.current&&i.current){let c=o.current,d=i.current,u,f=new ResizeObserver(()=>{u=requestAnimationFrame(()=>{let m=c.offsetHeight;d.style.setProperty("--cmdk-list-height",m.toFixed(1)+"px")})});return f.observe(c),()=>{cancelAnimationFrame(u),f.unobserve(c)}}},[]),h.createElement(Ns.div,{ref:jl([i,t]),...s,"cmdk-list":"",role:"listbox","aria-label":n,id:l.listId},Xu(e,c=>h.createElement("div",{ref:jl([o,l.listInnerRef]),"cmdk-list-sizer":""},c)))}),bT=h.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:s,contentClassName:i,container:o,...l}=e;return h.createElement(Xl,{open:r,onOpenChange:n},h.createElement(Vl,{container:o},h.createElement(gi,{"cmdk-overlay":"",className:s}),h.createElement(vi,{"aria-label":e.label,"cmdk-dialog":"",className:i},h.createElement(fN,{ref:t,...l}))))}),wT=h.forwardRef((e,t)=>li(r=>r.filtered.count===0)?h.createElement(Ns.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),jT=h.forwardRef((e,t)=>{let{progress:r,children:n,label:s="Loading...",...i}=e;return h.createElement(Ns.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Xu(e,o=>h.createElement("div",{"aria-hidden":!0},o)))}),Gr=Object.assign(fN,{List:yT,Item:pT,Input:vT,Group:xT,Separator:gT,Dialog:bT,Empty:wT,Loading:jT});function NT(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function kT(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function mN(e){let t=h.useRef(e);return oi(()=>{t.current=e}),t}var oi=typeof window>"u"?h.useEffect:h.useLayoutEffect;function $i(e){let t=h.useRef();return t.current===void 0&&(t.current=e()),t}function jl(e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}function li(e){let t=hx(),r=()=>e(t.snapshot());return AP.useSyncExternalStore(t.subscribe,r,r)}function hN(e,t,r,n=[]){let s=h.useRef(),i=sc();return oi(()=>{var o;let l=(()=>{var d;for(let u of r){if(typeof u=="string")return u.trim();if(typeof u=="object"&&"current"in u)return u.current?(d=u.current.textContent)==null?void 0:d.trim():s.current}})(),c=n.map(d=>d.trim());i.value(e,l,c),(o=t.current)==null||o.setAttribute(Bs,l),s.current=l}),s}var ST=()=>{let[e,t]=h.useState(),r=$i(()=>new Map);return oi(()=>{r.current.forEach(n=>n()),r.current=new Map},[e]),(n,s)=>{r.current.set(n,s),t({})}};function CT(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Xu({asChild:e,children:t},r){return e&&h.isValidElement(t)?h.cloneElement(CT(t),{ref:t.ref},r(t.props.children)):r(t)}var _T={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Xs=h.forwardRef(({className:e,...t},r)=>a.jsx(Gr,{ref:r,className:z("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));Xs.displayName=Gr.displayName;const MT=({children:e,open:t,onOpenChange:r})=>a.jsx(Ua,{open:t,onOpenChange:r,children:a.jsx(ca,{className:"overflow-hidden p-0 shadow-lg max-w-[560px]",children:a.jsx(Xs,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})})}),Qu=h.forwardRef(({className:e,...t},r)=>a.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[a.jsx(ji,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),a.jsx(Gr.Input,{ref:r,className:z("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));Qu.displayName=Gr.Input.displayName;const Qs=h.forwardRef(({className:e,...t},r)=>a.jsx(Gr.List,{ref:r,className:z("max-h-[320px] overflow-y-auto overflow-x-hidden",e),...t}));Qs.displayName=Gr.List.displayName;const Zu=h.forwardRef((e,t)=>a.jsx(Gr.Empty,{ref:t,className:"py-6 text-center text-sm text-muted-foreground",...e}));Zu.displayName=Gr.Empty.displayName;const cs=h.forwardRef(({className:e,...t},r)=>a.jsx(Gr.Group,{ref:r,className:z("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));cs.displayName=Gr.Group.displayName;const pN=h.forwardRef(({className:e,...t},r)=>a.jsx(Gr.Separator,{ref:r,className:z("-mx-1 h-px bg-border",e),...t}));pN.displayName=Gr.Separator.displayName;const un=h.forwardRef(({className:e,...t},r)=>a.jsx(Gr.Item,{ref:r,className:z("relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none","data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground","data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50","[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));un.displayName=Gr.Item.displayName;function OT(){const{open:e,setOpen:t}=Gp(),r=pt(),{data:n}=vo(),{workspace:s}=Ie(),i=(s==null?void 0:s.slug)??"",o=l=>{t(!1),l()};return a.jsxs(MT,{open:e,onOpenChange:t,children:[a.jsx(Qu,{placeholder:"Search or jump to..."}),a.jsxs(Qs,{children:[a.jsx(Zu,{children:"No results found."}),a.jsxs(cs,{heading:"Navigation",children:[a.jsxs(un,{onSelect:()=>o(()=>r(`/${i}/projects`)),children:[a.jsx(Sd,{className:"text-muted-foreground"}),a.jsx("span",{children:"Projects"})]}),a.jsxs(un,{onSelect:()=>o(()=>r(`/${i}/notifications`)),children:[a.jsx(ri,{className:"text-muted-foreground"}),a.jsx("span",{children:"Notifications"})]}),a.jsxs(un,{onSelect:()=>o(()=>r(`/${i}/settings`)),children:[a.jsx(ox,{className:"text-muted-foreground"}),a.jsx("span",{children:"Settings"})]})]}),n&&n.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(pN,{}),a.jsxs(cs,{heading:"Projects",children:[n.map(l=>a.jsxs(un,{value:`${l.name} board`,onSelect:()=>o(()=>r(`/${i}/projects/${l.identifier}/board`)),children:[a.jsx(Hr,{className:"text-muted-foreground"}),a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx("span",{className:"font-mono text-[11px] text-muted-foreground shrink-0",children:l.identifier}),a.jsx("span",{className:"truncate",children:l.name}),a.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Board"})]})]},`${l.id}-board`)),n.map(l=>a.jsxs(un,{value:`${l.name} issues`,onSelect:()=>o(()=>r(`/${i}/projects/${l.identifier}/issues`)),children:[a.jsx(Jn,{className:"text-muted-foreground"}),a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx("span",{className:"font-mono text-[11px] text-muted-foreground shrink-0",children:l.identifier}),a.jsx("span",{className:"truncate",children:l.name}),a.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Issues"})]})]},`${l.id}-issues`))]})]})]})]})}function Cr({zone:e,props:t}){const r=JA(e);return r.length?a.jsx(a.Fragment,{children:r.map((n,s)=>a.jsx(n,{...t},n.displayName??n.name??s))}):null}function px({flow:e,inviteToken:t,label:r,disabled:n}){const s=()=>{const i=`${Gi}/auth/google?flow=${e}${t?`&invite_token=${encodeURIComponent(t)}`:""}`;window.location.href=i};return a.jsxs(ne,{type:"button",variant:"outline",className:"w-full gap-2 bg-white dark:bg-black text-black dark:text-white",onClick:s,disabled:n,children:[a.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18","aria-hidden":"true",children:[a.jsx("path",{d:"M17.64 9.205c0-.639-.057-1.252-.164-1.841H9v3.481h4.844a4.14 4.14 0 0 1-1.796 2.716v2.259h2.908c1.702-1.567 2.684-3.875 2.684-6.615z",fill:"#4285F4"}),a.jsx("path",{d:"M9 18c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H.957v2.332A8.997 8.997 0 0 0 9 18z",fill:"#34A853"}),a.jsx("path",{d:"M3.964 10.71A5.41 5.41 0 0 1 3.682 9c0-.593.102-1.17.282-1.71V4.958H.957A8.996 8.996 0 0 0 0 9c0 1.452.348 2.827.957 4.042l3.007-2.332z",fill:"#FBBC05"}),a.jsx("path",{d:"M9 3.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C13.463.891 11.426 0 9 0A8.997 8.997 0 0 0 .957 4.958L3.964 7.29C4.672 5.163 6.656 3.58 9 3.58z",fill:"#EA4335"})]}),r??"Continue with Google"]})}function ic(){var e;return((e=window.__MERIDIAN_CONFIG__)==null?void 0:e.appName)??"Meridian"}function PT(){var e;return(e=window.__MERIDIAN_CONFIG__)==null?void 0:e.logoUrl}function oc({className:e}){const t=PT();return t?a.jsx("img",{src:t,alt:ic(),className:e??"h-12 w-12"}):a.jsx("div",{className:e??"relative h-16 w-16 rounded-2xl bg-white dark:bg-card border border-border shadow-sm flex items-center justify-center",children:a.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:a.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:a.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})})}function ET(){const[e,t]=h.useState(""),[r,n]=h.useState(""),[s,i]=h.useState(!1),o=pt(),l=nD(),{data:c}=Bu(),d=u=>{u.preventDefault(),l.mutate({email:e,password:r},{onSuccess:()=>o("/"),onError:f=>H.error(f.message??"Invalid email or password")})};return a.jsx("div",{className:"min-h-screen bg-white dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[360px]",children:[a.jsx(Cr,{zone:"login.before",props:{}}),a.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[a.jsx(oc,{}),a.jsxs("div",{className:"text-center",children:[a.jsxs("h1",{className:"text-lg font-semibold text-foreground",children:["Welcome to ",ic()]}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Sign in to access the admin area"})]})]}),a.jsxs("form",{onSubmit:d,className:"space-y-2",children:[a.jsx(Ee,{type:"email",placeholder:"Email",value:e,onChange:u=>t(u.target.value),autoComplete:"email",required:!0,className:"bg-white dark:bg-card h-10"}),a.jsxs("div",{className:"relative",children:[a.jsx(Ee,{type:s?"text":"password",placeholder:"Password",value:r,onChange:u=>n(u.target.value),autoComplete:"current-password",required:!0,className:"bg-white dark:bg-card h-10 pr-10"}),a.jsx("button",{type:"button",onClick:()=>i(!s),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:s?a.jsx(ec,{className:"h-4 w-4"}):a.jsx(wi,{className:"h-4 w-4"})})]}),a.jsx("div",{className:"flex justify-end",children:a.jsx(qr,{to:"/forgot-password",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Forgot password?"})}),a.jsx("div",{className:"pt-1",children:a.jsx(ne,{type:"submit",className:"w-full h-10 font-medium",disabled:l.isPending,children:l.isPending?"Signing in...":"Continue with Email"})})]}),(c==null?void 0:c.googleOAuthEnabled)&&a.jsxs("div",{className:"mt-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"h-px flex-1 bg-border"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),a.jsx("div",{className:"h-px flex-1 bg-border"})]}),a.jsx(px,{flow:"login"})]}),a.jsxs("p",{className:"text-sm text-center text-muted-foreground mt-6",children:["Don't have an account?"," ",a.jsx(qr,{to:"/register",className:"text-indigo hover:opacity-80 transition-opacity",children:"Create one"})]}),a.jsx(Cr,{zone:"login.after",props:{}})]})})}function AT(){const[e,t]=h.useState(""),[r,n]=h.useState(""),[s,i]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState(!1),u=pt(),f=aD(),{data:m}=Bu(),p=(m==null?void 0:m.needsSetup)===!0,x=g=>{g.preventDefault(),f.mutate({email:s,password:o,first_name:e,last_name:r},{onSuccess:()=>u("/"),onError:v=>H.error(v.message??"Registration failed")})};return a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[360px]",children:[a.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[a.jsx(oc,{}),a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"text-lg font-semibold text-foreground",children:p?"Set up your account":"Create your account"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:p?"You're the first user — you'll be the super admin.":`Get started with ${ic()}`})]})]}),a.jsxs("form",{onSubmit:x,className:"space-y-2",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx(Ee,{placeholder:"First name",value:e,onChange:g=>t(g.target.value),required:!0,className:"bg-white dark:bg-card h-10"}),a.jsx(Ee,{placeholder:"Last name",value:r,onChange:g=>n(g.target.value),required:!0,className:"bg-white dark:bg-card h-10"})]}),a.jsx(Ee,{type:"email",placeholder:"Email",value:s,onChange:g=>i(g.target.value),autoComplete:"email",required:!0,className:"bg-white dark:bg-card h-10"}),a.jsxs("div",{className:"relative",children:[a.jsx(Ee,{type:c?"text":"password",placeholder:"Password",value:o,onChange:g=>l(g.target.value),autoComplete:"new-password",required:!0,className:"bg-white dark:bg-card h-10 pr-10"}),a.jsx("button",{type:"button",onClick:()=>d(!c),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:c?a.jsx(ec,{className:"h-4 w-4"}):a.jsx(wi,{className:"h-4 w-4"})})]}),a.jsx("div",{className:"pt-1",children:a.jsx(ne,{type:"submit",className:"w-full h-10 font-medium",disabled:f.isPending,children:f.isPending?"Creating account...":"Create Account"})})]}),(m==null?void 0:m.googleOAuthEnabled)&&a.jsxs("div",{className:"mt-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"h-px flex-1 bg-border"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),a.jsx("div",{className:"h-px flex-1 bg-border"})]}),a.jsx(px,{flow:"register",label:p?"Set up with Google":"Continue with Google"})]}),a.jsxs("p",{className:"text-sm text-center text-muted-foreground mt-6",children:["Already have an account?"," ",a.jsx(qr,{to:"/login",className:"text-indigo hover:opacity-80 transition-opacity",children:"Sign in"})]})]})})}function DT(){const[e,t]=h.useState(""),[r,n]=h.useState(!1),s=pt(),{setWorkspace:i}=Ie(),o=W5(),l=c=>{c.preventDefault(),e.trim()&&o.mutate({name:e.trim(),is_private:r},{onSuccess:d=>{const u={id:d.workspace.id,name:d.workspace.name,slug:d.workspace.slug};i(u),s(`/${u.slug}/projects`,{replace:!0})},onError:d=>H.error(d.message??"Failed to create workspace")})};return a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[380px]",children:[a.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[a.jsx(oc,{}),a.jsxs("div",{className:"text-center",children:[a.jsxs("h1",{className:"text-lg font-semibold text-foreground",children:["Create your ",ic()," workspace"]}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"A workspace is where your team's projects and issues live."})]})]}),a.jsxs("form",{onSubmit:l,className:"space-y-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(Ee,{placeholder:"Workspace name (e.g. Acme Corp)",value:e,onChange:c=>t(c.target.value),autoFocus:!0,required:!0,className:"bg-white dark:bg-card h-10"}),a.jsx("p",{className:"text-xs text-muted-foreground px-0.5",children:"You can rename it later from settings."})]}),a.jsxs("label",{className:"flex items-center gap-2.5 px-0.5 cursor-pointer select-none",children:[a.jsx("input",{type:"checkbox",checked:r,onChange:c=>n(c.target.checked),className:"size-4 rounded border-border accent-indigo-600"}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(Oa,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("span",{className:"text-sm text-foreground",children:"Private workspace"})]}),a.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:"Only visible to members"})]}),a.jsx(ne,{type:"submit",className:"w-full h-10 font-medium",disabled:!e.trim()||o.isPending,children:o.isPending?"Creating workspace...":"Create workspace"})]})]})})}function TT(){const{logout:e}=Ie();return a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[380px]",children:[a.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[a.jsx(oc,{}),a.jsxs("div",{className:"text-center",children:[a.jsxs("h1",{className:"text-lg font-semibold text-foreground",children:["Waiting for ",ic()," access"]}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"You've been added to the system, but haven't been assigned to a workspace yet. An admin will add you shortly."})]})]}),a.jsx(ne,{variant:"outline",className:"w-full",onClick:e,children:"Sign out"})]})})}function IT(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const xN=W.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),lc=()=>{const e=W.useContext(xN);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};IT(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
|
|
554
554
|
[data-state=closed]
|
|
555
555
|
){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function RT(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function $T(){return xx(/^Mac/)}function zT(){return xx(/^iPhone/)}function ay(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function LT(){return xx(/^iPad/)||$T()&&navigator.maxTouchPoints>1}function gN(){return zT()||LT()}function xx(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const FT=24,BT=typeof window<"u"?h.useLayoutEffect:h.useEffect;function sy(...e){return(...t)=>{for(let r of e)typeof r=="function"&&r(...t)}}const wm=typeof document<"u"&&window.visualViewport;function iy(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function vN(e){for(iy(e)&&(e=e.parentElement);e&&!iy(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const WT=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let Lc=0,jm;function UT(e={}){let{isDisabled:t}=e;BT(()=>{if(!t)return Lc++,Lc===1&&gN()&&(jm=qT()),()=>{Lc--,Lc===0&&(jm==null||jm())}},[t])}function qT(){let e,t=0,r=f=>{e=vN(f.target),!(e===document.documentElement&&e===document.body)&&(t=f.changedTouches[0].pageY)},n=f=>{if(!e||e===document.documentElement||e===document.body){f.preventDefault();return}let m=f.changedTouches[0].pageY,p=e.scrollTop,x=e.scrollHeight-e.clientHeight;x!==0&&((p<=0&&m>t||p>=x&&m<t)&&f.preventDefault(),t=m)},s=f=>{let m=f.target;Sh(m)&&m!==document.activeElement&&(f.preventDefault(),m.style.transform="translateY(-2000px)",m.focus(),requestAnimationFrame(()=>{m.style.transform=""}))},i=f=>{let m=f.target;Sh(m)&&(m.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{m.style.transform="",wm&&(wm.height<window.innerHeight?requestAnimationFrame(()=>{oy(m)}):wm.addEventListener("resize",()=>oy(m),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},l=window.pageXOffset,c=window.pageYOffset,d=sy(HT(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let u=sy(Uo(document,"touchstart",r,{passive:!1,capture:!0}),Uo(document,"touchmove",n,{passive:!1,capture:!0}),Uo(document,"touchend",s,{passive:!1,capture:!0}),Uo(document,"focus",i,!0),Uo(window,"scroll",o));return()=>{d(),u(),window.scrollTo(l,c)}}function HT(e,t,r){let n=e.style[t];return e.style[t]=r,()=>{e.style[t]=n}}function Uo(e,t,r,n){return e.addEventListener(t,r,n),()=>{e.removeEventListener(t,r,n)}}function oy(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let r=vN(e);if(r!==document.documentElement&&r!==document.body&&r!==e){let n=r.getBoundingClientRect().top,s=e.getBoundingClientRect().top,i=e.getBoundingClientRect().bottom;const o=r.getBoundingClientRect().bottom+FT;i>o&&(r.scrollTop+=s-n)}e=r.parentElement}}function Sh(e){return e instanceof HTMLInputElement&&!WT.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function KT(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function YT(...e){return t=>e.forEach(r=>KT(r,t))}function yN(...e){return h.useCallback(YT(...e),e)}const bN=new WeakMap;function Ft(e,t,r=!1){if(!e||!(e instanceof HTMLElement))return;let n={};Object.entries(t).forEach(([s,i])=>{if(s.startsWith("--")){e.style.setProperty(s,i);return}n[s]=e.style[s],e.style[s]=i}),!r&&bN.set(e,n)}function GT(e,t){if(!e||!(e instanceof HTMLElement))return;let r=bN.get(e);r&&(e.style[t]=r[t])}const Dt=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function Fc(e,t){if(!e)return null;const r=window.getComputedStyle(e),n=r.transform||r.webkitTransform||r.mozTransform;let s=n.match(/^matrix3d\((.+)\)$/);return s?parseFloat(s[1].split(", ")[Dt(t)?13:12]):(s=n.match(/^matrix\((.+)\)$/),s?parseFloat(s[1].split(", ")[Dt(t)?5:4]):null)}function VT(e){return 8*(Math.log(e+1)-2)}function Nm(e,t){if(!e)return()=>{};const r=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=r}}function XT(...e){return(...t)=>{for(const r of e)typeof r=="function"&&r(...t)}}const wt={DURATION:.5,EASE:[.32,.72,0,1]},wN=.4,QT=.25,ZT=100,jN=8,Ps=16,Ch=26,km="vaul-dragging";function NN(e){const t=W.useRef(e);return W.useEffect(()=>{t.current=e}),W.useMemo(()=>(...r)=>t.current==null?void 0:t.current.call(t,...r),[])}function JT({defaultProp:e,onChange:t}){const r=W.useState(e),[n]=r,s=W.useRef(n),i=NN(t);return W.useEffect(()=>{s.current!==n&&(i(n),s.current=n)},[n,s,i]),r}function kN({prop:e,defaultProp:t,onChange:r=()=>{}}){const[n,s]=JT({defaultProp:t,onChange:r}),i=e!==void 0,o=i?e:n,l=NN(r),c=W.useCallback(d=>{if(i){const f=typeof d=="function"?d(e):d;f!==e&&l(f)}else s(d)},[i,e,s,l]);return[o,c]}function e3({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:r,drawerRef:n,overlayRef:s,fadeFromIndex:i,onSnapPointChange:o,direction:l="bottom",container:c,snapToSequentialPoint:d}){const[u,f]=kN({prop:e,defaultProp:r==null?void 0:r[0],onChange:t}),[m,p]=W.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);W.useEffect(()=>{function C(){p({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[]);const x=W.useMemo(()=>u===(r==null?void 0:r[r.length-1])||null,[r,u]),g=W.useMemo(()=>{var C;return(C=r==null?void 0:r.findIndex(_=>_===u))!=null?C:null},[r,u]),v=r&&r.length>0&&(i||i===0)&&!Number.isNaN(i)&&r[i]===u||!r,y=W.useMemo(()=>{const C=c?{width:c.getBoundingClientRect().width,height:c.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var _;return(_=r==null?void 0:r.map(S=>{const I=typeof S=="string";let A=0;if(I&&(A=parseInt(S,10)),Dt(l)){const L=I?A:m?S*C.height:0;return m?l==="bottom"?C.height-L:-C.height+L:L}const O=I?A:m?S*C.width:0;return m?l==="right"?C.width-O:-C.width+O:O}))!=null?_:[]},[r,m,c]),j=W.useMemo(()=>g!==null?y==null?void 0:y[g]:null,[y,g]),N=W.useCallback(C=>{var _;const S=(_=y==null?void 0:y.findIndex(I=>I===C))!=null?_:null;o(S),Ft(n.current,{transition:`transform ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,transform:Dt(l)?`translate3d(0, ${C}px, 0)`:`translate3d(${C}px, 0, 0)`}),y&&S!==y.length-1&&i!==void 0&&S!==i&&S<i?Ft(s.current,{transition:`opacity ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,opacity:"0"}):Ft(s.current,{transition:`opacity ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,opacity:"1"}),f(r==null?void 0:r[Math.max(S,0)])},[n.current,r,y,i,s,f]);W.useEffect(()=>{if(u||e){var C;const _=(C=r==null?void 0:r.findIndex(S=>S===e||S===u))!=null?C:-1;y&&_!==-1&&typeof y[_]=="number"&&N(y[_])}},[u,e,r,y,N]);function w({draggedDistance:C,closeDrawer:_,velocity:S,dismissible:I}){if(i===void 0)return;const A=l==="bottom"||l==="right"?(j??0)-C:(j??0)+C,O=g===i-1,L=g===0,F=C>0;if(O&&Ft(s.current,{transition:`opacity ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`}),!d&&S>2&&!F){I?_():N(y[0]);return}if(!d&&S>2&&F&&y&&r){N(y[r.length-1]);return}const X=y==null?void 0:y.reduce((G,re)=>typeof G!="number"||typeof re!="number"?G:Math.abs(re-A)<Math.abs(G-A)?re:G),T=Dt(l)?window.innerHeight:window.innerWidth;if(S>wN&&Math.abs(C)<T*.4){const G=F?1:-1;if(G>0&&x&&r){N(y[r.length-1]);return}if(L&&G<0&&I&&_(),g===null)return;N(y[g+G]);return}N(X)}function k({draggedDistance:C}){if(j===null)return;const _=l==="bottom"||l==="right"?j-C:j+C;(l==="bottom"||l==="right")&&_<y[y.length-1]||(l==="top"||l==="left")&&_>y[y.length-1]||Ft(n.current,{transform:Dt(l)?`translate3d(0, ${_}px, 0)`:`translate3d(${_}px, 0, 0)`})}function b(C,_){if(!r||typeof g!="number"||!y||i===void 0)return null;const S=g===i-1;if(g>=i&&_)return 0;if(S&&!_)return 1;if(!v&&!S)return null;const A=S?g+1:g-1,O=S?y[A]-y[A-1]:y[A+1]-y[A],L=C/Math.abs(O);return S?1-L:L}return{isLastSnapPoint:x,activeSnapPoint:u,shouldFade:v,getPercentageDragged:b,setActiveSnapPoint:f,activeSnapPointIndex:g,onRelease:w,onDrag:k,snapPointsOffset:y}}const t3=()=>()=>{};function r3(){const{direction:e,isOpen:t,shouldScaleBackground:r,setBackgroundColorOnScale:n,noBodyStyles:s}=lc(),i=W.useRef(null),o=h.useMemo(()=>document.body.style.backgroundColor,[]);function l(){return(window.innerWidth-Ch)/window.innerWidth}W.useEffect(()=>{if(t&&r){i.current&&clearTimeout(i.current);const c=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!c)return;XT(n&&!s?Nm(document.body,{background:"black"}):t3,Nm(c,{transformOrigin:Dt(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${wt.DURATION}s`,transitionTimingFunction:`cubic-bezier(${wt.EASE.join(",")})`}));const d=Nm(c,{borderRadius:`${jN}px`,overflow:"hidden",...Dt(e)?{transform:`scale(${l()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${l()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{d(),i.current=window.setTimeout(()=>{o?document.body.style.background=o:document.body.style.removeProperty("background")},wt.DURATION*1e3)}}},[t,r,o])}let qo=null;function n3({isOpen:e,modal:t,nested:r,hasBeenOpened:n,preventScrollRestoration:s,noBodyStyles:i}){const[o,l]=W.useState(()=>typeof window<"u"?window.location.href:""),c=W.useRef(0),d=W.useCallback(()=>{if(ay()&&qo===null&&e&&!i){qo={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:f,innerHeight:m}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-c.current}px`,left:`${-f}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const p=m-window.innerHeight;p&&c.current>=m&&(document.body.style.top=`${-(c.current+p)}px`)}),300)}},[e]),u=W.useCallback(()=>{if(ay()&&qo!==null&&!i){const f=-parseInt(document.body.style.top,10),m=-parseInt(document.body.style.left,10);Object.assign(document.body.style,qo),window.requestAnimationFrame(()=>{if(s&&o!==window.location.href){l(window.location.href);return}window.scrollTo(m,f)}),qo=null}},[o]);return W.useEffect(()=>{function f(){c.current=window.scrollY}return f(),window.addEventListener("scroll",f),()=>{window.removeEventListener("scroll",f)}},[]),W.useEffect(()=>{if(t)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||u()}},[t,u]),W.useEffect(()=>{r||!n||(e?(!window.matchMedia("(display-mode: standalone)").matches&&d(),t||window.setTimeout(()=>{u()},500)):u())},[e,n,o,t,r,d,u]),{restorePositionSetting:u}}function a3({open:e,onOpenChange:t,children:r,onDrag:n,onRelease:s,snapPoints:i,shouldScaleBackground:o=!1,setBackgroundColorOnScale:l=!0,closeThreshold:c=QT,scrollLockTimeout:d=ZT,dismissible:u=!0,handleOnly:f=!1,fadeFromIndex:m=i&&i.length-1,activeSnapPoint:p,setActiveSnapPoint:x,fixed:g,modal:v=!0,onClose:y,nested:j,noBodyStyles:N=!1,direction:w="bottom",defaultOpen:k=!1,disablePreventScroll:b=!0,snapToSequentialPoint:C=!1,preventScrollRestoration:_=!1,repositionInputs:S=!0,onAnimationEnd:I,container:A,autoFocus:O=!1}){var L,F;const[X=!1,T]=kN({defaultProp:k,prop:e,onChange:Oe=>{t==null||t(Oe),!Oe&&!j&&Ze(),setTimeout(()=>{I==null||I(Oe)},wt.DURATION*1e3),Oe&&!v&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),Oe||(document.body.style.pointerEvents="auto")}}),[G,re]=W.useState(!1),[J,P]=W.useState(!1),[M,R]=W.useState(!1),q=W.useRef(null),$=W.useRef(null),K=W.useRef(null),D=W.useRef(null),E=W.useRef(null),Z=W.useRef(!1),B=W.useRef(null),Y=W.useRef(0),ae=W.useRef(!1),ee=W.useRef(!k),se=W.useRef(0),V=W.useRef(null),ie=W.useRef(((L=V.current)==null?void 0:L.getBoundingClientRect().height)||0),pe=W.useRef(((F=V.current)==null?void 0:F.getBoundingClientRect().width)||0),ue=W.useRef(0),ve=W.useCallback(Oe=>{i&&Oe===Fe.length-1&&($.current=new Date)},[]),{activeSnapPoint:Q,activeSnapPointIndex:ge,setActiveSnapPoint:De,onRelease:Ue,snapPointsOffset:Fe,onDrag:Ve,shouldFade:ut,getPercentageDragged:Ke}=e3({snapPoints:i,activeSnapPointProp:p,setActiveSnapPointProp:x,drawerRef:V,fadeFromIndex:m,overlayRef:q,onSnapPointChange:ve,direction:w,container:A,snapToSequentialPoint:C});UT({isDisabled:!X||J||!v||M||!G||!S||!b});const{restorePositionSetting:Ze}=n3({isOpen:X,modal:v,nested:j??!1,hasBeenOpened:G,preventScrollRestoration:_,noBodyStyles:N});function tr(){return(window.innerWidth-Ch)/window.innerWidth}function Ir(Oe){var xe,Ne;!u&&!i||V.current&&!V.current.contains(Oe.target)||(ie.current=((xe=V.current)==null?void 0:xe.getBoundingClientRect().height)||0,pe.current=((Ne=V.current)==null?void 0:Ne.getBoundingClientRect().width)||0,P(!0),K.current=new Date,gN()&&window.addEventListener("touchend",()=>Z.current=!1,{once:!0}),Oe.target.setPointerCapture(Oe.pointerId),Y.current=Dt(w)?Oe.pageY:Oe.pageX)}function rr(Oe,xe){var Ne;let he=Oe;const ye=(Ne=window.getSelection())==null?void 0:Ne.toString(),Xe=V.current?Fc(V.current,w):null,de=new Date;if(he.tagName==="SELECT"||he.hasAttribute("data-vaul-no-drag")||he.closest("[data-vaul-no-drag]"))return!1;if(w==="right"||w==="left")return!0;if($.current&&de.getTime()-$.current.getTime()<500)return!1;if(Xe!==null&&(w==="bottom"?Xe>0:Xe<0))return!0;if(ye&&ye.length>0)return!1;if(E.current&&de.getTime()-E.current.getTime()<d&&Xe===0||xe)return E.current=de,!1;for(;he;){if(he.scrollHeight>he.clientHeight){if(he.scrollTop!==0)return E.current=new Date,!1;if(he.getAttribute("role")==="dialog")return!0}he=he.parentNode}return!0}function yr(Oe){if(V.current&&J){const xe=w==="bottom"||w==="right"?1:-1,Ne=(Y.current-(Dt(w)?Oe.pageY:Oe.pageX))*xe,he=Ne>0,ye=i&&!u&&!he;if(ye&&ge===0)return;const Xe=Math.abs(Ne),de=document.querySelector("[data-vaul-drawer-wrapper]"),_e=w==="bottom"||w==="top"?ie.current:pe.current;let Te=Xe/_e;const bt=Ke(Xe,he);if(bt!==null&&(Te=bt),ye&&Te>=1||!Z.current&&!rr(Oe.target,he))return;if(V.current.classList.add(km),Z.current=!0,Ft(V.current,{transition:"none"}),Ft(q.current,{transition:"none"}),i&&Ve({draggedDistance:Ne}),he&&!i){const nt=VT(Ne),br=Math.min(nt*-1,0)*xe;Ft(V.current,{transform:Dt(w)?`translate3d(0, ${br}px, 0)`:`translate3d(${br}px, 0, 0)`});return}const rt=1-Te;if((ut||m&&ge===m-1)&&(n==null||n(Oe,Te),Ft(q.current,{opacity:`${rt}`,transition:"none"},!0)),de&&q.current&&o){const nt=Math.min(tr()+Te*(1-tr()),1),br=8-Te*8,sr=Math.max(0,14-Te*14);Ft(de,{borderRadius:`${br}px`,transform:Dt(w)?`scale(${nt}) translate3d(0, ${sr}px, 0)`:`scale(${nt}) translate3d(${sr}px, 0, 0)`,transition:"none"},!0)}if(!i){const nt=Xe*xe;Ft(V.current,{transform:Dt(w)?`translate3d(0, ${nt}px, 0)`:`translate3d(${nt}px, 0, 0)`})}}}W.useEffect(()=>{window.requestAnimationFrame(()=>{ee.current=!0})},[]),W.useEffect(()=>{var Oe;function xe(){if(!V.current||!S)return;const Ne=document.activeElement;if(Sh(Ne)||ae.current){var he;const ye=((he=window.visualViewport)==null?void 0:he.height)||0,Xe=window.innerHeight;let de=Xe-ye;const _e=V.current.getBoundingClientRect().height||0,Te=_e>Xe*.8;ue.current||(ue.current=_e);const bt=V.current.getBoundingClientRect().top;if(Math.abs(se.current-de)>60&&(ae.current=!ae.current),i&&i.length>0&&Fe&&ge){const rt=Fe[ge]||0;de+=rt}if(se.current=de,_e>ye||ae.current){const rt=V.current.getBoundingClientRect().height;let nt=rt;rt>ye&&(nt=ye-(Te?bt:Ch)),g?V.current.style.height=`${rt-Math.max(de,0)}px`:V.current.style.height=`${Math.max(nt,ye-bt)}px`}else RT()||(V.current.style.height=`${ue.current}px`);i&&i.length>0&&!ae.current?V.current.style.bottom="0px":V.current.style.bottom=`${Math.max(de,0)}px`}}return(Oe=window.visualViewport)==null||Oe.addEventListener("resize",xe),()=>{var Ne;return(Ne=window.visualViewport)==null?void 0:Ne.removeEventListener("resize",xe)}},[ge,i,Fe]);function nr(Oe){Lt(),y==null||y(),Oe||T(!1),setTimeout(()=>{i&&De(i[0])},wt.DURATION*1e3)}function yt(){if(!V.current)return;const Oe=document.querySelector("[data-vaul-drawer-wrapper]"),xe=Fc(V.current,w);Ft(V.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`}),Ft(q.current,{transition:`opacity ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,opacity:"1"}),o&&xe&&xe>0&&X&&Ft(Oe,{borderRadius:`${jN}px`,overflow:"hidden",...Dt(w)?{transform:`scale(${tr()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${tr()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${wt.DURATION}s`,transitionTimingFunction:`cubic-bezier(${wt.EASE.join(",")})`},!0)}function Lt(){!J||!V.current||(V.current.classList.remove(km),Z.current=!1,P(!1),D.current=new Date)}function Kt(Oe){if(!J||!V.current)return;V.current.classList.remove(km),Z.current=!1,P(!1),D.current=new Date;const xe=Fc(V.current,w);if(!Oe||!rr(Oe.target,!1)||!xe||Number.isNaN(xe)||K.current===null)return;const Ne=D.current.getTime()-K.current.getTime(),he=Y.current-(Dt(w)?Oe.pageY:Oe.pageX),ye=Math.abs(he)/Ne;if(ye>.05&&(R(!0),setTimeout(()=>{R(!1)},200)),i){Ue({draggedDistance:he*(w==="bottom"||w==="right"?1:-1),closeDrawer:nr,velocity:ye,dismissible:u}),s==null||s(Oe,!0);return}if(w==="bottom"||w==="right"?he>0:he<0){yt(),s==null||s(Oe,!0);return}if(ye>wN){nr(),s==null||s(Oe,!1);return}var Xe;const de=Math.min((Xe=V.current.getBoundingClientRect().height)!=null?Xe:0,window.innerHeight);var _e;const Te=Math.min((_e=V.current.getBoundingClientRect().width)!=null?_e:0,window.innerWidth),bt=w==="left"||w==="right";if(Math.abs(xe)>=(bt?Te:de)*c){nr(),s==null||s(Oe,!1);return}s==null||s(Oe,!0),yt()}W.useEffect(()=>(X&&(Ft(document.documentElement,{scrollBehavior:"auto"}),$.current=new Date),()=>{GT(document.documentElement,"scrollBehavior")}),[X]);function ar(Oe){const xe=Oe?(window.innerWidth-Ps)/window.innerWidth:1,Ne=Oe?-Ps:0;B.current&&window.clearTimeout(B.current),Ft(V.current,{transition:`transform ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,transform:Dt(w)?`scale(${xe}) translate3d(0, ${Ne}px, 0)`:`scale(${xe}) translate3d(${Ne}px, 0, 0)`}),!Oe&&V.current&&(B.current=setTimeout(()=>{const he=Fc(V.current,w);Ft(V.current,{transition:"none",transform:Dt(w)?`translate3d(0, ${he}px, 0)`:`translate3d(${he}px, 0, 0)`})},500))}function $n(Oe,xe){if(xe<0)return;const Ne=(window.innerWidth-Ps)/window.innerWidth,he=Ne+xe*(1-Ne),ye=-Ps+xe*Ps;Ft(V.current,{transform:Dt(w)?`scale(${he}) translate3d(0, ${ye}px, 0)`:`scale(${he}) translate3d(${ye}px, 0, 0)`,transition:"none"})}function fa(Oe,xe){const Ne=Dt(w)?window.innerHeight:window.innerWidth,he=xe?(Ne-Ps)/Ne:1,ye=xe?-Ps:0;xe&&Ft(V.current,{transition:`transform ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,transform:Dt(w)?`scale(${he}) translate3d(0, ${ye}px, 0)`:`scale(${he}) translate3d(${ye}px, 0, 0)`})}return W.useEffect(()=>{v||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[v]),W.createElement(Xl,{defaultOpen:k,onOpenChange:Oe=>{!u&&!Oe||(Oe?re(!0):nr(!0),T(Oe))},open:X},W.createElement(xN.Provider,{value:{activeSnapPoint:Q,snapPoints:i,setActiveSnapPoint:De,drawerRef:V,overlayRef:q,onOpenChange:t,onPress:Ir,onRelease:Kt,onDrag:yr,dismissible:u,shouldAnimate:ee,handleOnly:f,isOpen:X,isDragging:J,shouldFade:ut,closeDrawer:nr,onNestedDrag:$n,onNestedOpenChange:ar,onNestedRelease:fa,keyboardIsOpen:ae,modal:v,snapPointsOffset:Fe,activeSnapPointIndex:ge,direction:w,shouldScaleBackground:o,setBackgroundColorOnScale:l,noBodyStyles:N,container:A,autoFocus:O}},r))}const SN=W.forwardRef(function({...e},t){const{overlayRef:r,snapPoints:n,onRelease:s,shouldFade:i,isOpen:o,modal:l,shouldAnimate:c}=lc(),d=yN(t,r),u=n&&n.length>0;if(!l)return null;const f=W.useCallback(m=>s(m),[s]);return W.createElement(gi,{onMouseUp:f,ref:d,"data-vaul-overlay":"","data-vaul-snap-points":o&&u?"true":"false","data-vaul-snap-points-overlay":o&&i?"true":"false","data-vaul-animate":c!=null&&c.current?"true":"false",...e})});SN.displayName="Drawer.Overlay";const CN=W.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:r,...n},s){const{drawerRef:i,onPress:o,onRelease:l,onDrag:c,keyboardIsOpen:d,snapPointsOffset:u,activeSnapPointIndex:f,modal:m,isOpen:p,direction:x,snapPoints:g,container:v,handleOnly:y,shouldAnimate:j,autoFocus:N}=lc(),[w,k]=W.useState(!1),b=yN(s,i),C=W.useRef(null),_=W.useRef(null),S=W.useRef(!1),I=g&&g.length>0;r3();const A=(L,F,X=0)=>{if(S.current)return!0;const T=Math.abs(L.y),G=Math.abs(L.x),re=G>T,J=["bottom","right"].includes(F)?1:-1;if(F==="left"||F==="right"){if(!(L.x*J<0)&&G>=0&&G<=X)return re}else if(!(L.y*J<0)&&T>=0&&T<=X)return!re;return S.current=!0,!0};W.useEffect(()=>{I&&window.requestAnimationFrame(()=>{k(!0)})},[]);function O(L){C.current=null,S.current=!1,l(L)}return W.createElement(vi,{"data-vaul-drawer-direction":x,"data-vaul-drawer":"","data-vaul-delayed-snap-points":w?"true":"false","data-vaul-snap-points":p&&I?"true":"false","data-vaul-custom-container":v?"true":"false","data-vaul-animate":j!=null&&j.current?"true":"false",...n,ref:b,style:u&&u.length>0?{"--snap-point-height":`${u[f??0]}px`,...t}:t,onPointerDown:L=>{y||(n.onPointerDown==null||n.onPointerDown.call(n,L),C.current={x:L.pageX,y:L.pageY},o(L))},onOpenAutoFocus:L=>{r==null||r(L),N||L.preventDefault()},onPointerDownOutside:L=>{if(e==null||e(L),!m||L.defaultPrevented){L.preventDefault();return}d.current&&(d.current=!1)},onFocusOutside:L=>{if(!m){L.preventDefault();return}},onPointerMove:L=>{if(_.current=L,y||(n.onPointerMove==null||n.onPointerMove.call(n,L),!C.current))return;const F=L.pageY-C.current.y,X=L.pageX-C.current.x,T=L.pointerType==="touch"?10:2;A({x:X,y:F},x,T)?c(L):(Math.abs(X)>T||Math.abs(F)>T)&&(C.current=null)},onPointerUp:L=>{n.onPointerUp==null||n.onPointerUp.call(n,L),C.current=null,S.current=!1,l(L)},onPointerOut:L=>{n.onPointerOut==null||n.onPointerOut.call(n,L),O(_.current)},onContextMenu:L=>{n.onContextMenu==null||n.onContextMenu.call(n,L),_.current&&O(_.current)}})});CN.displayName="Drawer.Content";const s3=250,i3=120,o3=W.forwardRef(function({preventCycle:e=!1,children:t,...r},n){const{closeDrawer:s,isDragging:i,snapPoints:o,activeSnapPoint:l,setActiveSnapPoint:c,dismissible:d,handleOnly:u,isOpen:f,onPress:m,onDrag:p}=lc(),x=W.useRef(null),g=W.useRef(!1);function v(){if(g.current){N();return}window.setTimeout(()=>{y()},i3)}function y(){if(i||e||g.current){N();return}if(N(),!o||o.length===0){d||s();return}if(l===o[o.length-1]&&d){s();return}const k=o.findIndex(C=>C===l);if(k===-1)return;const b=o[k+1];c(b)}function j(){x.current=window.setTimeout(()=>{g.current=!0},s3)}function N(){x.current&&window.clearTimeout(x.current),g.current=!1}return W.createElement("div",{onClick:v,onPointerCancel:N,onPointerDown:w=>{u&&m(w),j()},onPointerMove:w=>{u&&p(w)},ref:n,"data-vaul-drawer-visible":f?"true":"false","data-vaul-handle":"","aria-hidden":"true",...r},W.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});o3.displayName="Drawer.Handle";function l3(e){const t=lc(),{container:r=t.container,...n}=e;return W.createElement(Vl,{container:r,...n})}const Ka={Root:a3,Content:CN,Overlay:SN,Portal:l3,Title:uo,Description:fo},Ni=({shouldScaleBackground:e=!1,direction:t="right",...r})=>a.jsx(Ka.Root,{shouldScaleBackground:e,direction:t,...r});Ni.displayName="Drawer";const c3=Ka.Portal,_N=h.forwardRef(({className:e,...t},r)=>a.jsx(Ka.Overlay,{ref:r,className:z("fixed inset-0 z-50 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));_N.displayName=Ka.Overlay.displayName;const ki=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(c3,{children:[a.jsx(_N,{}),a.jsx(Ka.Content,{ref:n,className:z("fixed inset-y-0 right-0 z-50 flex h-full flex-col border-l border-border bg-background shadow-xl","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right","w-full max-w-lg",e),...r,children:t})]}));ki.displayName="DrawerContent";const bo=({className:e,...t})=>a.jsx("div",{className:z("flex flex-col space-y-1.5 px-6 pt-6 pb-4 border-b border-border shrink-0",e),...t});bo.displayName="DrawerHeader";const wo=({className:e,...t})=>a.jsx("div",{className:z("flex-1 overflow-y-auto px-6 py-4",e),...t});wo.displayName="DrawerBody";const cc=({className:e,...t})=>a.jsx("div",{className:z("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 px-6 py-4 border-t border-border shrink-0",e),...t});cc.displayName="DrawerFooter";const jo=h.forwardRef(({className:e,...t},r)=>a.jsx(Ka.Title,{ref:r,className:z("text-base font-semibold text-foreground",e),...t}));jo.displayName=Ka.Title.displayName;const d3=h.forwardRef(({className:e,...t},r)=>a.jsx(Ka.Description,{ref:r,className:z("text-sm text-muted-foreground",e),...t}));d3.displayName=Ka.Description.displayName;const u3=Zl("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),mt=h.forwardRef(({className:e,...t},r)=>a.jsx(Yj,{ref:r,className:z(u3(),e),...t}));mt.displayName=Yj.displayName;const Ju=h.forwardRef(({className:e,...t},r)=>a.jsx("textarea",{className:z("flex min-h-[80px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-none placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 resize-none",e),ref:r,...t}));Ju.displayName="Textarea";const ly=[{name:"Backlog",key:"backlog",color:"#94a3b8",category:"backlog",position:0},{name:"Todo",key:"todo",color:"#64748b",category:"unstarted",position:1},{name:"In Progress",key:"in_progress",color:"#6366f1",category:"started",position:2},{name:"In Review",key:"in_review",color:"#f59e0b",category:"started",position:3},{name:"Done",key:"done",color:"#10b981",category:"completed",position:4},{name:"Cancelled",key:"cancelled",color:"#9ca3af",category:"cancelled",position:5}],Sm=["#94a3b8","#64748b","#6366f1","#f59e0b","#10b981","#ef4444","#3b82f6","#8b5cf6"];function f3(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function m3({chip:e,onRemove:t}){const{attributes:r,listeners:n,setNodeRef:s,transform:i,transition:o,isDragging:l}=Hp({id:e.key});return a.jsxs("div",{ref:s,style:{transform:Kp.Transform.toString(i),transition:o},className:z("flex items-center gap-1 pl-1 pr-1.5 py-0.5 rounded-full border text-xs font-medium transition-opacity",l?"opacity-50":"opacity-100"),children:[a.jsx("span",{...r,...n,className:"text-muted-foreground/50 hover:text-muted-foreground cursor-grab touch-none",children:a.jsx(F1,{className:"h-3 w-3"})}),a.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:e.color}}),a.jsx("span",{className:"text-[11px]",children:e.name}),a.jsx("button",{type:"button",onClick:t,className:"ml-0.5 text-muted-foreground/50 hover:text-muted-foreground transition-colors",children:a.jsx(tt,{className:"h-3 w-3"})})]})}const h3=3;function p3({open:e,onClose:t}){var X;const[r,n]=h.useState(""),[s,i]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState(!1),[u,f]=h.useState(!1),[m,p]=h.useState(ly),[x,g]=h.useState(""),[v,y]=h.useState(Sm[2]),{workspace:j}=Ie(),N=CD(),w=kD(r,{enabled:e}),k=SD(s,{enabled:e});h.useEffect(()=>{e&&w.data&&!c&&i(w.data)},[e,w.data,c]);const b=k.available===!1||N.isError&&((X=N.error)==null?void 0:X.status)===409,C=s.trim().length>=h3&&/^[A-Z0-9]+$/i.test(s.trim()),_=o1(Up(l1,{activationConstraint:{distance:5}})),S=T=>{n(T)},I=()=>{r.trim()&&!c&&w.flush()},A=()=>{n(""),i(""),l(""),d(!1),f(!1),p(ly),g(""),y(Sm[2]),N.reset(),t()},O=()=>{if(!x.trim())return;const T=f3(x.trim());if(m.some(G=>G.key===T)){H.error("A status with this name already exists");return}p(G=>[...G,{name:x.trim(),key:T,color:v,category:"started",position:G.length}]),g("")},L=T=>{const{active:G,over:re}=T;!re||G.id===re.id||p(J=>{const P=J.findIndex(R=>R.key===G.id),M=J.findIndex(R=>R.key===re.id);return pd(J,P,M).map((R,q)=>({...R,position:q}))})},F=T=>{T.preventDefault(),!(!r.trim()||!s.trim()||!C||b)&&N.mutate({name:r.trim(),identifier:s.trim().toUpperCase(),description:o.trim()||void 0,workspace_id:j.id,initial_statuses:m},{onSuccess:()=>{H.success("Project created"),A()},onError:G=>{(G==null?void 0:G.status)===409?H.error("This project key is already in use."):H.error(G.message??"Failed to create project")}})};return a.jsx(Ni,{open:e,onOpenChange:T=>!T&&A(),dismissible:!1,children:a.jsxs(ki,{className:"max-w-md",children:[a.jsx(bo,{children:a.jsx(jo,{children:"New project"})}),a.jsxs("form",{onSubmit:F,className:"flex flex-col flex-1 overflow-hidden",children:[a.jsxs(wo,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{htmlFor:"project-name",children:"Name"}),a.jsx(Ee,{id:"project-name",placeholder:"My Project",value:r,onChange:T=>S(T.target.value),onBlur:I,autoFocus:!0}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Project key below will auto-fill when you finish typing; you can change it."})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{htmlFor:"project-id",children:["Identifier",a.jsx("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:"Used as issue prefix (e.g. PROJ-1)"})]}),a.jsx(Ee,{id:"project-id",placeholder:"PROJ",value:s,onChange:T=>{i(T.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"")),d(!0)},maxLength:5,className:z("font-mono",b&&"border-destructive"),"aria-invalid":b}),b&&a.jsx("p",{className:"text-xs text-destructive",children:"This project key is already in use."})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{htmlFor:"project-desc",children:["Description",a.jsx("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsx(Ju,{id:"project-desc",placeholder:"What is this project about?",value:o,onChange:T=>l(T.target.value),className:"min-h-[80px]"})]}),a.jsxs("div",{className:"border border-border rounded-lg overflow-hidden",children:[a.jsx("button",{type:"button",onClick:()=>f(!u),className:"w-full flex items-center justify-between px-3 py-2.5 text-xs font-medium hover:bg-muted/40 transition-colors",children:a.jsxs("span",{className:"flex items-center gap-1.5",children:[u?a.jsx(ia,{className:"h-3.5 w-3.5"}):a.jsx(vr,{className:"h-3.5 w-3.5"}),"Statuses",a.jsxs("span",{className:"text-muted-foreground font-normal",children:["(",m.length,")"]})]})}),u&&a.jsxs("div",{className:"px-3 pb-3 border-t border-border space-y-3 pt-3",children:[a.jsx(xl,{sensors:_,onDragEnd:L,children:a.jsx(qp,{items:m.map(T=>T.key),strategy:c1,children:a.jsx("div",{className:"flex flex-wrap gap-1.5",children:m.map(T=>a.jsx(m3,{chip:T,onRemove:()=>p(G=>G.filter(re=>re.key!==T.key).map((re,J)=>({...re,position:J})))},T.key))})})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:Sm.map(T=>a.jsx("button",{type:"button",onClick:()=>y(T),className:z("h-4 w-4 rounded-full border-2 transition-transform hover:scale-110",v===T?"border-foreground scale-110":"border-transparent"),style:{backgroundColor:T}},T))}),a.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[a.jsx(Ee,{placeholder:"Status name…",value:x,onChange:T=>g(T.target.value),onKeyDown:T=>{T.key==="Enter"&&(T.preventDefault(),O())},className:"h-7 text-xs flex-1"}),a.jsx(ne,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7 shrink-0",onClick:O,disabled:!x.trim(),children:a.jsx(dt,{className:"h-3.5 w-3.5"})})]})]})]})]})]}),a.jsxs(cc,{children:[a.jsx(ne,{type:"button",variant:"ghost",onClick:A,children:"Cancel"}),a.jsx(ne,{type:"submit",disabled:!r.trim()||!s.trim()||!C||b||N.isPending,children:N.isPending?"Creating...":"Create project"})]})]})]})})}const Le=zP,qe=LP,$e=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(Gj,{ref:n,className:z("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-none ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,a.jsx(DP,{asChild:!0,children:a.jsx(ia,{className:"h-4 w-4 opacity-50"})})]}));$e.displayName=Gj.displayName;const MN=h.forwardRef(({className:e,...t},r)=>a.jsx(Vj,{ref:r,className:z("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Zp,{className:"h-4 w-4"})}));MN.displayName=Vj.displayName;const ON=h.forwardRef(({className:e,...t},r)=>a.jsx(Xj,{ref:r,className:z("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(ia,{className:"h-4 w-4"})}));ON.displayName=Xj.displayName;const ze=h.forwardRef(({className:e,children:t,position:r="popper",...n},s)=>a.jsx(TP,{children:a.jsxs(Qj,{ref:s,className:z("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:[a.jsx(MN,{}),a.jsx(IP,{className:z("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),a.jsx(ON,{})]})}));ze.displayName=Qj.displayName;const x3=h.forwardRef(({className:e,...t},r)=>a.jsx(Zj,{ref:r,className:z("px-2 py-1.5 text-xs font-medium text-muted-foreground",e),...t}));x3.displayName=Zj.displayName;const we=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(Jj,{ref:n,className:z("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[a.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(RP,{children:a.jsx(dr,{className:"h-4 w-4"})})}),a.jsx($P,{children:t})]}));we.displayName=Jj.displayName;const g3=h.forwardRef(({className:e,...t},r)=>a.jsx(e1,{ref:r,className:z("-mx-1 my-1 h-px bg-border",e),...t}));g3.displayName=e1.displayName;function v3({open:e,onClose:t,projectId:r,projectName:n}){const{workspace:s}=Ie(),i=(s==null?void 0:s.id)??"",{data:o,isLoading:l}=la(r),{data:c}=rc(i),{data:d}=Fu(i),u=rN(r),f=nN(r),m=aN(r),p=sN(r),[x,g]=h.useState(""),[v,y]=h.useState(""),j=new Set((o==null?void 0:o.members.map(b=>b.user_id))??[]),N=new Set((o==null?void 0:o.teams.map(b=>b.team_id))??[]),w=(c??[]).filter(b=>!j.has(b.user_id)),k=(d??[]).filter(b=>!N.has(b.id));return a.jsx(Ua,{open:e,onOpenChange:b=>!b&&t(),children:a.jsxs(ca,{className:"sm:max-w-[480px]",children:[a.jsx(qa,{children:a.jsxs(Ha,{children:["Access — ",n]})}),a.jsxs("div",{className:"space-y-5 pt-1",children:[a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"People"})}),l?a.jsx("div",{className:"space-y-2",children:[1,2].map(b=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(le,{className:"h-7 w-7 rounded-full"}),a.jsx(le,{className:"h-3.5 w-32"})]},b))}):(o==null?void 0:o.members.length)===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No individual members."}):a.jsx("div",{className:"space-y-1",children:o==null?void 0:o.members.map(b=>{var O;const C=b.user,_=(C==null?void 0:C.first_name)??"",S=(C==null?void 0:C.last_name)??"",I=`${_} ${S}`.trim()||(C==null?void 0:C.email)||"Unknown",A=(_[0]??S[0]??((O=C==null?void 0:C.email)==null?void 0:O[0])??"U").toUpperCase();return a.jsxs("div",{className:"flex items-center gap-2.5 py-1 group",children:[a.jsx(Rt,{className:"h-7 w-7 shrink-0",children:a.jsx($t,{className:"text-[11px] font-medium",children:A})}),a.jsx("span",{className:"flex-1 text-sm truncate",children:I}),a.jsx("span",{className:z("text-[11px] px-1.5 py-0.5 rounded font-medium shrink-0",b.role==="manager"?"bg-indigo/10 text-indigo":"bg-muted text-muted-foreground"),children:b.role}),a.jsx("button",{onClick:()=>f.mutate(b.user_id,{onSuccess:()=>H.success("Access removed"),onError:()=>H.error("Failed to remove")}),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",children:a.jsx(tt,{className:"h-3.5 w-3.5"})})]},b.id)})}),w.length>0&&a.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[a.jsx(po,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),a.jsxs(Le,{value:x,onValueChange:g,children:[a.jsx($e,{className:"h-8 text-xs flex-1",children:a.jsx(qe,{placeholder:"Add person…"})}),a.jsx(ze,{children:w.map(b=>{const C=b.user,_=(C==null?void 0:C.first_name)??"",S=(C==null?void 0:C.last_name)??"",I=`${_} ${S}`.trim()||(C==null?void 0:C.email)||"Unknown";return a.jsx(we,{value:b.user_id,children:I},b.user_id)})})]}),x&&a.jsx(ne,{size:"sm",className:"h-8 px-3 text-xs shrink-0",disabled:u.isPending,onClick:()=>u.mutate({userId:x},{onSuccess:()=>{H.success("Access granted"),g("")},onError:()=>H.error("Failed to grant access")}),children:"Add"})]})]}),a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Teams"})}),l?a.jsx("div",{className:"space-y-2",children:[1].map(b=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(le,{className:"h-7 w-7 rounded-lg"}),a.jsx(le,{className:"h-3.5 w-28"})]},b))}):(o==null?void 0:o.teams.length)===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No teams have access."}):a.jsx("div",{className:"space-y-1",children:o==null?void 0:o.teams.map(b=>{const C=b.team;return a.jsxs("div",{className:"flex items-center gap-2.5 py-1 group",children:[a.jsx("div",{className:"h-7 w-7 rounded-lg bg-muted flex items-center justify-center shrink-0",children:a.jsx(ii,{className:"h-3.5 w-3.5 text-muted-foreground"})}),a.jsx("span",{className:"flex-1 text-sm truncate",children:(C==null?void 0:C.name)??"Unknown team"}),C&&a.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[C.member_count," ",C.member_count===1?"member":"members"]}),a.jsx("button",{onClick:()=>p.mutate(b.team_id,{onSuccess:()=>H.success("Team access removed"),onError:()=>H.error("Failed to remove team")}),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",children:a.jsx(tt,{className:"h-3.5 w-3.5"})})]},b.id)})}),k.length>0&&a.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[a.jsx(ii,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),a.jsxs(Le,{value:v,onValueChange:y,children:[a.jsx($e,{className:"h-8 text-xs flex-1",children:a.jsx(qe,{placeholder:"Add team…"})}),a.jsx(ze,{children:k.map(b=>a.jsx(we,{value:b.id,children:b.name},b.id))})]}),v&&a.jsx(ne,{size:"sm",className:"h-8 px-3 text-xs shrink-0",disabled:m.isPending,onClick:()=>m.mutate(v,{onSuccess:()=>{H.success("Team access granted"),y("")},onError:()=>H.error("Failed to add team")}),children:"Add"})]})]}),a.jsx("div",{className:"flex justify-end pt-1",children:a.jsx(ne,{variant:"outline",size:"sm",onClick:t,children:"Close"})})]})]})})}const PN=6048e5,y3=864e5,b3=36e5,Bc=43200,cy=1440,dy=Symbol.for("constructDateFrom");function Nt(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&dy in e?e[dy](t):e instanceof Date?new e.constructor(t):new Date(t)}function He(e,t){return Nt(t||e,e)}function Ur(e,t,r){const n=He(e,r==null?void 0:r.in);return isNaN(t)?Nt((r==null?void 0:r.in)||e,NaN):(t&&n.setDate(n.getDate()+t),n)}function gx(e,t,r){const n=He(e,r==null?void 0:r.in);if(isNaN(t))return Nt((r==null?void 0:r.in)||e,NaN);if(!t)return n;const s=n.getDate(),i=Nt((r==null?void 0:r.in)||e,n.getTime());i.setMonth(n.getMonth()+t+1,0);const o=i.getDate();return s>=o?i:(n.setFullYear(i.getFullYear(),i.getMonth(),s),n)}let w3={};function No(){return w3}function Xi(e,t){var l,c,d,u;const r=No(),n=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??r.weekStartsOn??((u=(d=r.locale)==null?void 0:d.options)==null?void 0:u.weekStartsOn)??0,s=He(e,t==null?void 0:t.in),i=s.getDay(),o=(i<n?7:0)+i-n;return s.setDate(s.getDate()-o),s.setHours(0,0,0,0),s}function Nl(e,t){return Xi(e,{...t,weekStartsOn:1})}function EN(e,t){const r=He(e,t==null?void 0:t.in),n=r.getFullYear(),s=Nt(r,0);s.setFullYear(n+1,0,4),s.setHours(0,0,0,0);const i=Nl(s),o=Nt(r,0);o.setFullYear(n,0,4),o.setHours(0,0,0,0);const l=Nl(o);return r.getTime()>=i.getTime()?n+1:r.getTime()>=l.getTime()?n:n-1}function _d(e){const t=He(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r}function da(e,...t){const r=Nt.bind(null,e||t.find(n=>typeof n=="object"));return t.map(r)}function Qi(e,t){const r=He(e,t==null?void 0:t.in);return r.setHours(0,0,0,0),r}function ef(e,t,r){const[n,s]=da(r==null?void 0:r.in,e,t),i=Qi(n),o=Qi(s),l=+i-_d(i),c=+o-_d(o);return Math.round((l-c)/y3)}function j3(e,t){const r=EN(e,t),n=Nt(e,0);return n.setFullYear(r,0,4),n.setHours(0,0,0,0),Nl(n)}function N3(e,t,r){return Ur(e,t*7,r)}function k3(e,t,r){return gx(e,t*12,r)}function S3(e,t){let r,n=t==null?void 0:t.in;return e.forEach(s=>{!n&&typeof s=="object"&&(n=Nt.bind(null,s));const i=He(s,n);(!r||r<i||isNaN(+i))&&(r=i)}),Nt(n,r||NaN)}function C3(e,t){let r,n=t==null?void 0:t.in;return e.forEach(s=>{!n&&typeof s=="object"&&(n=Nt.bind(null,s));const i=He(s,n);(!r||r>i||isNaN(+i))&&(r=i)}),Nt(n,r||NaN)}function xd(e,t){const r=+He(e)-+He(t);return r<0?-1:r>0?1:r}function vx(e){return Nt(e,Date.now())}function Zi(e,t,r){const[n,s]=da(r==null?void 0:r.in,e,t);return+Qi(n)==+Qi(s)}function AN(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function _3(e){return!(!AN(e)&&typeof e!="number"||isNaN(+He(e)))}function yx(e,t,r){const[n,s]=da(r==null?void 0:r.in,e,t),i=n.getFullYear()-s.getFullYear(),o=n.getMonth()-s.getMonth();return i*12+o}function DN(e,t,r){const[n,s]=da(r==null?void 0:r.in,e,t),i=uy(n,s),o=Math.abs(ef(n,s));n.setDate(n.getDate()-i*o);const l=+(uy(n,s)===-i),c=i*(o-l);return c===0?0:c}function uy(e,t){const r=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return r<0?-1:r>0?1:r}function TN(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function M3(e,t,r){const[n,s]=da(r==null?void 0:r.in,e,t),i=(+n-+s)/b3;return TN(r==null?void 0:r.roundingMethod)(i)}function O3(e,t){return+He(e)-+He(t)}function IN(e,t){const r=He(e,t==null?void 0:t.in);return r.setHours(23,59,59,999),r}function bx(e,t){const r=He(e,t==null?void 0:t.in),n=r.getMonth();return r.setFullYear(r.getFullYear(),n+1,0),r.setHours(23,59,59,999),r}function P3(e,t){const r=He(e,t==null?void 0:t.in);return+IN(r,t)==+bx(r,t)}function RN(e,t,r){const[n,s,i]=da(r==null?void 0:r.in,e,e,t),o=xd(s,i),l=Math.abs(yx(s,i));if(l<1)return 0;s.getMonth()===1&&s.getDate()>27&&s.setDate(30),s.setMonth(s.getMonth()-o*l);let c=xd(s,i)===-o;P3(n)&&l===1&&xd(n,i)===1&&(c=!1);const d=o*(l-+c);return d===0?0:d}function E3(e,t,r){const n=O3(e,t)/1e3;return TN(r==null?void 0:r.roundingMethod)(n)}function $N(e,t){const[r,n]=da(e,t.start,t.end);return{start:r,end:n}}function A3(e,t){const{start:r,end:n}=$N(t==null?void 0:t.in,e);let s=+r>+n;const i=s?+r:+n,o=s?n:r;o.setHours(0,0,0,0),o.setDate(1);let l=1;const c=[];for(;+o<=i;)c.push(Nt(r,o)),o.setMonth(o.getMonth()+l);return s?c.reverse():c}function zN(e,t){const r=He(e,t==null?void 0:t.in);return r.setDate(1),r.setHours(0,0,0,0),r}function D3(e,t){const r=He(e,t==null?void 0:t.in),n=r.getFullYear();return r.setFullYear(n+1,0,0),r.setHours(23,59,59,999),r}function LN(e,t){const r=He(e,t==null?void 0:t.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}function T3(e,t){const{start:r,end:n}=$N(t==null?void 0:t.in,e);let s=+r>+n;const i=s?+r:+n,o=s?n:r;o.setHours(0,0,0,0),o.setMonth(0,1);let l=1;const c=[];for(;+o<=i;)c.push(Nt(r,o)),o.setFullYear(o.getFullYear()+l);return s?c.reverse():c}function FN(e,t){var l,c,d,u;const r=No(),n=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??r.weekStartsOn??((u=(d=r.locale)==null?void 0:d.options)==null?void 0:u.weekStartsOn)??0,s=He(e,t==null?void 0:t.in),i=s.getDay(),o=(i<n?-7:0)+6-(i-n);return s.setDate(s.getDate()+o),s.setHours(23,59,59,999),s}function I3(e,t){return FN(e,{...t,weekStartsOn:1})}const R3={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},$3=(e,t,r)=>{let n;const s=R3[e];return typeof s=="string"?n=s:t===1?n=s.one:n=s.other.replace("{{count}}",t.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function Cm(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}const z3={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},L3={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},F3={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},B3={date:Cm({formats:z3,defaultWidth:"full"}),time:Cm({formats:L3,defaultWidth:"full"}),dateTime:Cm({formats:F3,defaultWidth:"full"})},W3={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},U3=(e,t,r,n)=>W3[e];function Ho(e){return(t,r)=>{const n=r!=null&&r.context?String(r.context):"standalone";let s;if(n==="formatting"&&e.formattingValues){const o=e.defaultFormattingWidth||e.defaultWidth,l=r!=null&&r.width?String(r.width):o;s=e.formattingValues[l]||e.formattingValues[o]}else{const o=e.defaultWidth,l=r!=null&&r.width?String(r.width):e.defaultWidth;s=e.values[l]||e.values[o]}const i=e.argumentCallback?e.argumentCallback(t):t;return s[i]}}const q3={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},H3={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},K3={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Y3={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},G3={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},V3={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},X3=(e,t)=>{const r=Number(e),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},Q3={ordinalNumber:X3,era:Ho({values:q3,defaultWidth:"wide"}),quarter:Ho({values:H3,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Ho({values:K3,defaultWidth:"wide"}),day:Ho({values:Y3,defaultWidth:"wide"}),dayPeriod:Ho({values:G3,defaultWidth:"wide",formattingValues:V3,defaultFormattingWidth:"wide"})};function Ko(e){return(t,r={})=>{const n=r.width,s=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],i=t.match(s);if(!i)return null;const o=i[0],l=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?J3(l,f=>f.test(o)):Z3(l,f=>f.test(o));let d;d=e.valueCallback?e.valueCallback(c):c,d=r.valueCallback?r.valueCallback(d):d;const u=t.slice(o.length);return{value:d,rest:u}}}function Z3(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function J3(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}function eI(e){return(t,r={})=>{const n=t.match(e.matchPattern);if(!n)return null;const s=n[0],i=t.match(e.parsePattern);if(!i)return null;let o=e.valueCallback?e.valueCallback(i[0]):i[0];o=r.valueCallback?r.valueCallback(o):o;const l=t.slice(s.length);return{value:o,rest:l}}}const tI=/^(\d+)(th|st|nd|rd)?/i,rI=/\d+/i,nI={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},aI={any:[/^b/i,/^(a|c)/i]},sI={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},iI={any:[/1/i,/2/i,/3/i,/4/i]},oI={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},lI={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},cI={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},dI={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},uI={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},fI={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},mI={ordinalNumber:eI({matchPattern:tI,parsePattern:rI,valueCallback:e=>parseInt(e,10)}),era:Ko({matchPatterns:nI,defaultMatchWidth:"wide",parsePatterns:aI,defaultParseWidth:"any"}),quarter:Ko({matchPatterns:sI,defaultMatchWidth:"wide",parsePatterns:iI,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Ko({matchPatterns:oI,defaultMatchWidth:"wide",parsePatterns:lI,defaultParseWidth:"any"}),day:Ko({matchPatterns:cI,defaultMatchWidth:"wide",parsePatterns:dI,defaultParseWidth:"any"}),dayPeriod:Ko({matchPatterns:uI,defaultMatchWidth:"any",parsePatterns:fI,defaultParseWidth:"any"})},Ws={code:"en-US",formatDistance:$3,formatLong:B3,formatRelative:U3,localize:Q3,match:mI,options:{weekStartsOn:0,firstWeekContainsDate:1}};function hI(e,t){const r=He(e,t==null?void 0:t.in);return ef(r,LN(r))+1}function wx(e,t){const r=He(e,t==null?void 0:t.in),n=+Nl(r)-+j3(r);return Math.round(n/PN)+1}function BN(e,t){var u,f,m,p;const r=He(e,t==null?void 0:t.in),n=r.getFullYear(),s=No(),i=(t==null?void 0:t.firstWeekContainsDate)??((f=(u=t==null?void 0:t.locale)==null?void 0:u.options)==null?void 0:f.firstWeekContainsDate)??s.firstWeekContainsDate??((p=(m=s.locale)==null?void 0:m.options)==null?void 0:p.firstWeekContainsDate)??1,o=Nt((t==null?void 0:t.in)||e,0);o.setFullYear(n+1,0,i),o.setHours(0,0,0,0);const l=Xi(o,t),c=Nt((t==null?void 0:t.in)||e,0);c.setFullYear(n,0,i),c.setHours(0,0,0,0);const d=Xi(c,t);return+r>=+l?n+1:+r>=+d?n:n-1}function pI(e,t){var l,c,d,u;const r=No(),n=(t==null?void 0:t.firstWeekContainsDate)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??r.firstWeekContainsDate??((u=(d=r.locale)==null?void 0:d.options)==null?void 0:u.firstWeekContainsDate)??1,s=BN(e,t),i=Nt((t==null?void 0:t.in)||e,0);return i.setFullYear(s,0,n),i.setHours(0,0,0,0),Xi(i,t)}function jx(e,t){const r=He(e,t==null?void 0:t.in),n=+Xi(r,t)-+pI(r,t);return Math.round(n/PN)+1}function Je(e,t){const r=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return r+n}const as={y(e,t){const r=e.getFullYear(),n=r>0?r:1-r;return Je(t==="yy"?n%100:n,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):Je(r+1,2)},d(e,t){return Je(e.getDate(),t.length)},a(e,t){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(e,t){return Je(e.getHours()%12||12,t.length)},H(e,t){return Je(e.getHours(),t.length)},m(e,t){return Je(e.getMinutes(),t.length)},s(e,t){return Je(e.getSeconds(),t.length)},S(e,t){const r=t.length,n=e.getMilliseconds(),s=Math.trunc(n*Math.pow(10,r-3));return Je(s,t.length)}},Ei={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},fy={G:function(e,t,r){const n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if(t==="yo"){const n=e.getFullYear(),s=n>0?n:1-n;return r.ordinalNumber(s,{unit:"year"})}return as.y(e,t)},Y:function(e,t,r,n){const s=BN(e,n),i=s>0?s:1-s;if(t==="YY"){const o=i%100;return Je(o,2)}return t==="Yo"?r.ordinalNumber(i,{unit:"year"}):Je(i,t.length)},R:function(e,t){const r=EN(e);return Je(r,t.length)},u:function(e,t){const r=e.getFullYear();return Je(r,t.length)},Q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return Je(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return Je(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){const n=e.getMonth();switch(t){case"M":case"MM":return as.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){const n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return Je(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){const s=jx(e,n);return t==="wo"?r.ordinalNumber(s,{unit:"week"}):Je(s,t.length)},I:function(e,t,r){const n=wx(e);return t==="Io"?r.ordinalNumber(n,{unit:"week"}):Je(n,t.length)},d:function(e,t,r){return t==="do"?r.ordinalNumber(e.getDate(),{unit:"date"}):as.d(e,t)},D:function(e,t,r){const n=hI(e);return t==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):Je(n,t.length)},E:function(e,t,r){const n=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){const s=e.getDay(),i=(s-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return Je(i,2);case"eo":return r.ordinalNumber(i,{unit:"day"});case"eee":return r.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(s,{width:"short",context:"formatting"});case"eeee":default:return r.day(s,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){const s=e.getDay(),i=(s-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return Je(i,t.length);case"co":return r.ordinalNumber(i,{unit:"day"});case"ccc":return r.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(s,{width:"narrow",context:"standalone"});case"cccccc":return r.day(s,{width:"short",context:"standalone"});case"cccc":default:return r.day(s,{width:"wide",context:"standalone"})}},i:function(e,t,r){const n=e.getDay(),s=n===0?7:n;switch(t){case"i":return String(s);case"ii":return Je(s,t.length);case"io":return r.ordinalNumber(s,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){const s=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(e,t,r){const n=e.getHours();let s;switch(n===12?s=Ei.noon:n===0?s=Ei.midnight:s=n/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,r){const n=e.getHours();let s;switch(n>=17?s=Ei.evening:n>=12?s=Ei.afternoon:n>=4?s=Ei.morning:s=Ei.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,r){if(t==="ho"){let n=e.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return as.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):as.H(e,t)},K:function(e,t,r){const n=e.getHours()%12;return t==="Ko"?r.ordinalNumber(n,{unit:"hour"}):Je(n,t.length)},k:function(e,t,r){let n=e.getHours();return n===0&&(n=24),t==="ko"?r.ordinalNumber(n,{unit:"hour"}):Je(n,t.length)},m:function(e,t,r){return t==="mo"?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):as.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):as.s(e,t)},S:function(e,t){return as.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return hy(n);case"XXXX":case"XX":return Is(n);case"XXXXX":case"XXX":default:return Is(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return hy(n);case"xxxx":case"xx":return Is(n);case"xxxxx":case"xxx":default:return Is(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+my(n,":");case"OOOO":default:return"GMT"+Is(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+my(n,":");case"zzzz":default:return"GMT"+Is(n,":")}},t:function(e,t,r){const n=Math.trunc(+e/1e3);return Je(n,t.length)},T:function(e,t,r){return Je(+e,t.length)}};function my(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),s=Math.trunc(n/60),i=n%60;return i===0?r+String(s):r+String(s)+t+Je(i,2)}function hy(e,t){return e%60===0?(e>0?"-":"+")+Je(Math.abs(e)/60,2):Is(e,t)}function Is(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),s=Je(Math.trunc(n/60),2),i=Je(n%60,2);return r+s+t+i}const py=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},WN=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},xI=(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],s=r[2];if(!s)return py(e,t);let i;switch(n){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;case"PPPP":default:i=t.dateTime({width:"full"});break}return i.replace("{{date}}",py(n,t)).replace("{{time}}",WN(s,t))},gI={p:WN,P:xI},vI=/^D+$/,yI=/^Y+$/,bI=["D","DD","YY","YYYY"];function wI(e){return vI.test(e)}function jI(e){return yI.test(e)}function NI(e,t,r){const n=kI(e,t,r);if(console.warn(n),bI.includes(e))throw new RangeError(n)}function kI(e,t,r){const n=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const SI=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,CI=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,_I=/^'([^]*?)'?$/,MI=/''/g,OI=/[a-zA-Z]/;function fe(e,t,r){var u,f,m,p,x,g,v,y;const n=No(),s=(r==null?void 0:r.locale)??n.locale??Ws,i=(r==null?void 0:r.firstWeekContainsDate)??((f=(u=r==null?void 0:r.locale)==null?void 0:u.options)==null?void 0:f.firstWeekContainsDate)??n.firstWeekContainsDate??((p=(m=n.locale)==null?void 0:m.options)==null?void 0:p.firstWeekContainsDate)??1,o=(r==null?void 0:r.weekStartsOn)??((g=(x=r==null?void 0:r.locale)==null?void 0:x.options)==null?void 0:g.weekStartsOn)??n.weekStartsOn??((y=(v=n.locale)==null?void 0:v.options)==null?void 0:y.weekStartsOn)??0,l=He(e,r==null?void 0:r.in);if(!_3(l))throw new RangeError("Invalid time value");let c=t.match(CI).map(j=>{const N=j[0];if(N==="p"||N==="P"){const w=gI[N];return w(j,s.formatLong)}return j}).join("").match(SI).map(j=>{if(j==="''")return{isToken:!1,value:"'"};const N=j[0];if(N==="'")return{isToken:!1,value:PI(j)};if(fy[N])return{isToken:!0,value:j};if(N.match(OI))throw new RangeError("Format string contains an unescaped latin alphabet character `"+N+"`");return{isToken:!1,value:j}});s.localize.preprocessor&&(c=s.localize.preprocessor(l,c));const d={firstWeekContainsDate:i,weekStartsOn:o,locale:s};return c.map(j=>{if(!j.isToken)return j.value;const N=j.value;(!(r!=null&&r.useAdditionalWeekYearTokens)&&jI(N)||!(r!=null&&r.useAdditionalDayOfYearTokens)&&wI(N))&&NI(N,t,String(e));const w=fy[N[0]];return w(l,N,s.localize,d)}).join("")}function PI(e){const t=e.match(_I);return t?t[1].replace(MI,"'"):e}function _h(e,t,r){const n=No(),s=(r==null?void 0:r.locale)??n.locale??Ws,i=2520,o=xd(e,t);if(isNaN(o))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:o}),[c,d]=da(r==null?void 0:r.in,...o>0?[t,e]:[e,t]),u=E3(d,c),f=(_d(d)-_d(c))/1e3,m=Math.round((u-f)/60);let p;if(m<2)return r!=null&&r.includeSeconds?u<5?s.formatDistance("lessThanXSeconds",5,l):u<10?s.formatDistance("lessThanXSeconds",10,l):u<20?s.formatDistance("lessThanXSeconds",20,l):u<40?s.formatDistance("halfAMinute",0,l):u<60?s.formatDistance("lessThanXMinutes",1,l):s.formatDistance("xMinutes",1,l):m===0?s.formatDistance("lessThanXMinutes",1,l):s.formatDistance("xMinutes",m,l);if(m<45)return s.formatDistance("xMinutes",m,l);if(m<90)return s.formatDistance("aboutXHours",1,l);if(m<cy){const x=Math.round(m/60);return s.formatDistance("aboutXHours",x,l)}else{if(m<i)return s.formatDistance("xDays",1,l);if(m<Bc){const x=Math.round(m/cy);return s.formatDistance("xDays",x,l)}else if(m<Bc*2)return p=Math.round(m/Bc),s.formatDistance("aboutXMonths",p,l)}if(p=RN(d,c),p<12){const x=Math.round(m/Bc);return s.formatDistance("xMonths",x,l)}else{const x=p%12,g=Math.trunc(p/12);return x<3?s.formatDistance("aboutXYears",g,l):x<9?s.formatDistance("overXYears",g,l):s.formatDistance("almostXYears",g+1,l)}}function EI(e,t){return _h(e,vx(e),t)}function gl(e,t){return He(e,t==null?void 0:t.in).getDate()}function AI(e,t){return He(e,t==null?void 0:t.in).getDay()}function ws(e,t){const r=He(e,t==null?void 0:t.in),n=r.getFullYear(),s=r.getMonth(),i=Nt(r,0);return i.setFullYear(n,s+1,0),i.setHours(0,0,0,0),i.getDate()}function gd(e,t){return He(e,t==null?void 0:t.in).getMonth()}function DI(e,t){return He(e,t==null?void 0:t.in).getFullYear()}function TI(e,t){return+He(e)>+He(t)}function II(e,t){return+He(e)<+He(t)}function RI(e,t,r){const[n,s]=da(r==null?void 0:r.in,e,t);return n.getFullYear()===s.getFullYear()&&n.getMonth()===s.getMonth()}function $I(e,t,r){const[n,s]=da(r==null?void 0:r.in,e,t);return n.getFullYear()===s.getFullYear()}function zI(e,t){return Zi(Nt(e,e),vx(e))}function UN(e,t,r){return Ur(e,-t,r)}function LI(e,t){return Zi(Nt(e,e),UN(vx(e),1))}function FI(e,t,r){const n=He(e,r==null?void 0:r.in),s=n.getFullYear(),i=n.getDate(),o=Nt(e,0);o.setFullYear(s,t,15),o.setHours(0,0,0,0);const l=ws(o);return n.setMonth(t,Math.min(i,l)),n}function BI(e,t,r){const n=He(e,r==null?void 0:r.in);return isNaN(+n)?Nt(e,NaN):(n.setFullYear(t),n)}function WI(){const[e,t]=h.useState(!1),[r,n]=h.useState(null),[s,i]=h.useState(""),[o,l]=h.useState("all"),{workspace:c}=zt(),{data:d,isLoading:u}=vo(),f=_D(),m=pt(),p=(d??[]).filter(x=>(o==="all"||x.status===o)&&(!s||x.name.toLowerCase().includes(s.toLowerCase())||x.identifier.toLowerCase().includes(s.toLowerCase())));return a.jsxs("div",{className:"p-2 pb-24 md:pb-2",children:[a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[a.jsx("h1",{className:"text-base font-semibold",children:"Projects"}),a.jsxs(ne,{size:"sm",onClick:()=>t(!0),children:[a.jsx(dt,{className:"h-4 w-4"}),"Create"]})]}),a.jsxs("div",{className:"flex flex-col gap-2 px-4 md:px-6 py-3 md:py-4 border-b border-border md:flex-row md:items-center md:justify-between",children:[a.jsx("div",{className:"flex items-center gap-1 overflow-x-auto scrollbar-none",children:["all","active","paused","archived"].map(x=>a.jsx("button",{onClick:()=>l(x),className:z("px-3 h-7 rounded-md text-xs font-medium transition-colors whitespace-nowrap shrink-0",o===x?"bg-foreground text-background":"text-muted-foreground hover:text-foreground hover:bg-muted"),children:x==="all"?"All":x.charAt(0).toUpperCase()+x.slice(1)},x))}),a.jsxs("div",{className:"relative",children:[a.jsx(ji,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),a.jsx(Ee,{placeholder:"Search...",value:s,onChange:x=>i(x.target.value),className:"pl-8 h-8 w-full md:w-[200px] text-xs bg-transparent"})]})]}),a.jsxs("div",{className:"hidden md:grid grid-cols-[2fr_1fr_1fr_1fr_40px] items-center px-6 py-2.5 border-b border-border",children:[a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Project"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Identifier"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Status"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Created"}),a.jsx("span",{})]}),u?a.jsx("div",{className:"divide-y divide-border",children:[1,2,3].map(x=>a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"hidden md:grid grid-cols-[2fr_1fr_1fr_1fr_40px] items-center px-6 py-3",children:[a.jsx(le,{className:"h-4 w-48"}),a.jsx(le,{className:"h-4 w-12"}),a.jsx(le,{className:"h-5 w-16 rounded-full"}),a.jsx(le,{className:"h-4 w-24"}),a.jsx("div",{})]},`d-${x}`),a.jsxs("div",{className:"md:hidden flex items-center gap-3 px-4 py-3",children:[a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsx(le,{className:"h-4 w-40"}),a.jsx(le,{className:"h-3 w-24"})]}),a.jsx(le,{className:"h-6 w-6 rounded-full"})]},`m-${x}`)]}))}):p.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[a.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:a.jsx(Hr,{className:"h-5 w-5 text-muted-foreground"})}),a.jsx("p",{className:"text-sm font-medium mb-1",children:s||o!=="all"?"No projects match":"No projects yet"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:s||o!=="all"?"Try adjusting your filters.":"Create your first project to get started."}),!s&&o==="all"&&a.jsxs(ne,{size:"sm",onClick:()=>t(!0),children:[a.jsx(dt,{className:"h-4 w-4"}),"Create project"]})]}):a.jsx("div",{className:"divide-y divide-border",children:p.map(x=>a.jsxs("div",{children:[a.jsxs("div",{className:"hidden md:grid grid-cols-[2fr_1fr_1fr_1fr_40px] items-center px-6 py-3 hover:bg-[#f9fafb] dark:hover:bg-muted/30 cursor-pointer transition-colors group",onClick:()=>m(`/${c}/projects/${x.identifier}/board`),children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[a.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:x.name}),x.description&&a.jsx("span",{className:"text-xs text-muted-foreground truncate hidden xl:block",children:x.description})]}),a.jsx("span",{className:"text-sm text-muted-foreground font-mono",children:x.identifier}),a.jsx("div",{children:a.jsxs("span",{className:z("inline-flex items-center gap-1.5 text-xs",x.status==="active"&&"text-emerald-600",x.status==="paused"&&"text-amber-600",x.status==="archived"&&"text-muted-foreground"),children:[a.jsx("span",{className:z("h-1.5 w-1.5 rounded-full shrink-0",x.status==="active"&&"bg-emerald-500",x.status==="paused"&&"bg-amber-500",x.status==="archived"&&"bg-zinc-400")}),x.status.charAt(0).toUpperCase()+x.status.slice(1)]})}),a.jsx("span",{className:"text-sm text-muted-foreground",children:fe(new Date(x.created_at),"MMM d, yyyy")}),a.jsx("div",{className:"flex justify-end",onClick:g=>g.stopPropagation(),children:a.jsxs(Kr,{children:[a.jsx(Yr,{asChild:!0,children:a.jsx(ne,{variant:"ghost",size:"icon-sm",className:"h-7 w-7 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",children:a.jsx(Ma,{className:"h-4 w-4"})})}),a.jsxs(Or,{align:"end",children:[a.jsxs(at,{onClick:()=>m(`/${c}/projects/${x.identifier}/board`),children:[a.jsx(Hr,{className:"h-4 w-4"}),"Open board"]}),a.jsxs(at,{onClick:()=>m(`/${c}/projects/${x.identifier}/issues`),children:[a.jsx(Jn,{className:"h-4 w-4"}),"View issues"]}),a.jsxs(at,{onClick:()=>n({id:x.id,name:x.name}),children:[a.jsx(Oa,{className:"h-4 w-4"}),"Manage access"]}),a.jsx(Pn,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive",onClick:()=>{confirm(`Delete "${x.name}"? This cannot be undone.`)&&f.mutate(x.id,{onSuccess:()=>H.success("Project deleted"),onError:()=>H.error("Failed to delete project")})},children:[a.jsx(Mr,{className:"h-4 w-4"}),"Delete"]})]})]})})]}),a.jsxs("div",{className:"md:hidden flex items-center gap-3 px-4 py-3 hover:bg-[#f9fafb] dark:hover:bg-muted/30 cursor-pointer transition-colors",onClick:()=>m(`/${c}/projects/${x.identifier}/issues`),children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:x.name}),a.jsx("span",{className:"text-[10px] font-mono text-muted-foreground shrink-0",children:x.identifier})]}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:z("h-1.5 w-1.5 rounded-full shrink-0",x.status==="active"&&"bg-emerald-500",x.status==="paused"&&"bg-amber-500",x.status==="archived"&&"bg-zinc-400")}),a.jsx("span",{className:z("text-xs",x.status==="active"&&"text-emerald-600",x.status==="paused"&&"text-amber-600",x.status==="archived"&&"text-muted-foreground"),children:x.status.charAt(0).toUpperCase()+x.status.slice(1)}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"·"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:fe(new Date(x.created_at),"MMM d, yyyy")})]})]}),a.jsx("div",{onClick:g=>g.stopPropagation(),children:a.jsxs(Kr,{children:[a.jsx(Yr,{asChild:!0,children:a.jsx(ne,{variant:"ghost",size:"icon-sm",className:"h-8 w-8 text-muted-foreground",children:a.jsx(Ma,{className:"h-4 w-4"})})}),a.jsxs(Or,{align:"end",children:[a.jsxs(at,{onClick:()=>m(`/${c}/projects/${x.identifier}/issues`),children:[a.jsx(Jn,{className:"h-4 w-4"}),"View issues"]}),a.jsxs(at,{onClick:()=>n({id:x.id,name:x.name}),children:[a.jsx(Oa,{className:"h-4 w-4"}),"Manage access"]}),a.jsx(Pn,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive",onClick:()=>{confirm(`Delete "${x.name}"? This cannot be undone.`)&&f.mutate(x.id,{onSuccess:()=>H.success("Project deleted"),onError:()=>H.error("Failed to delete project")})},children:[a.jsx(Mr,{className:"h-4 w-4"}),"Delete"]})]})]})})]})]},x.id))}),!u&&p.length>0&&a.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-t border-border",children:[a.jsxs("span",{className:"text-xs text-muted-foreground",children:["1 — ",p.length," of ",p.length," result",p.length!==1?"s":""]}),a.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[a.jsx("span",{children:"1 of 1 pages"}),a.jsx(ne,{variant:"ghost",size:"sm",className:"h-7 text-xs",disabled:!0,children:"Prev"}),a.jsx(ne,{variant:"ghost",size:"sm",className:"h-7 text-xs",disabled:!0,children:"Next"})]})]})]}),a.jsx(p3,{open:e,onClose:()=>t(!1)}),r&&a.jsx(v3,{open:!!r,onClose:()=>n(null),projectId:r.id,projectName:r.name})]})}const dc={byProject:e=>["projects",e,"statuses"]};function ko(e){return Be({queryKey:dc.byProject(e??""),queryFn:()=>oe.get(`/admin/projects/${e}/statuses`),select:t=>t.statuses,enabled:!!e})}function UI(e){const t=Se();return be({mutationFn:r=>oe.post(`/admin/projects/${e}/statuses`,r),onSuccess:()=>{t.invalidateQueries({queryKey:dc.byProject(e)})}})}function qI(e,t){const r=Se();return be({mutationFn:n=>oe.put(`/admin/projects/${e}/statuses/${t}`,n),onSuccess:()=>{r.invalidateQueries({queryKey:dc.byProject(e)})}})}function HI(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/projects/${e}/statuses/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:dc.byProject(e)})}})}function KI(e){const t=Se();return be({mutationFn:r=>oe.post(`/admin/projects/${e}/statuses/reorder`,{orderedIds:r}),onSuccess:()=>{t.invalidateQueries({queryKey:dc.byProject(e)})}})}const Si={all:["users"],list:e=>[...Si.all,"list",e??{}]};function qN(e){const{limit:t=20,offset:r=0,q:n=""}=e??{},s=new URLSearchParams;return s.set("limit",String(t)),s.set("offset",String(r)),n&&s.set("q",n),Be({queryKey:Si.list({limit:t,offset:r,q:n}),queryFn:()=>oe.get(`/admin/users?${s}`),staleTime:1e3*60*5,placeholderData:i=>i})}const tf={all:["org-invitations"],list:e=>[...tf.all,"list",e??{}]};function YI(e){const{limit:t=20,offset:r=0,q:n=""}=e??{},s=new URLSearchParams;return s.set("limit",String(t)),s.set("offset",String(r)),n&&s.set("q",n),Be({queryKey:tf.list({limit:t,offset:r,q:n}),queryFn:()=>oe.get(`/admin/users/invitations?${s}`),staleTime:1e3*30,placeholderData:i=>i})}function GI(){const e=Se();return be({mutationFn:t=>oe.delete(`/admin/users/invitations/${t}`),onSuccess:()=>e.invalidateQueries({queryKey:tf.all})})}function VI(){return be({mutationFn:e=>oe.post(`/admin/users/invitations/${e}/resend`)})}function XI(){const e=Se();return be({mutationFn:({email:t,role:r})=>oe.post("/admin/users/invite",{email:t,role:r}),onSuccess:()=>e.invalidateQueries({queryKey:tf.all})})}function QI(){const e=Se();return be({mutationFn:({userId:t,role:r})=>oe.patch(`/admin/users/${t}`,{role:r}),onSuccess:()=>e.invalidateQueries({queryKey:Si.all})})}function ZI(){const e=Se();return be({mutationFn:t=>oe.delete(`/admin/users/${t}`),onSuccess:()=>e.invalidateQueries({queryKey:Si.all})})}function JI(){const e=Se();return be({mutationFn:t=>oe.post(`/admin/users/${t}/reactivate`),onSuccess:()=>e.invalidateQueries({queryKey:Si.all})})}function Nx(){return Be({queryKey:[...Si.all,"map"],queryFn:()=>oe.get("/admin/users/map"),select:e=>e.users.map(t=>({...t,role:"",app_role_id:null,is_active:!0})),staleTime:1e3*60*5})}function ks(){return Be({queryKey:[...Si.all,"map"],queryFn:()=>oe.get("/admin/users/map"),select:e=>new Map(e.users.map(t=>{var o;const r=t.first_name??"",n=t.last_name??"",s=`${r} ${n}`.trim()||t.email,i=(r[0]??n[0]??((o=t.email)==null?void 0:o[0])??"U").toUpperCase();return[t.id,{name:s,initials:i}]})),staleTime:1e3*60*5})}const ci={backlog:"Backlog",todo:"Todo",in_progress:"In Progress",in_review:"In Review",done:"Done",cancelled:"Cancelled"},rn={urgent:"Urgent",high:"High",medium:"Medium",low:"Low",none:"None"},uc={urgent:"text-red-500",high:"text-orange-500",medium:"text-yellow-500",low:"text-blue-400",none:"text-zinc-400"},Pa={task:"Task",bug:"Bug",feature:"Feature",improvement:"Improvement",epic:"Epic"},e4=({priority:e})=>{const t=z("h-3 w-3 shrink-0",uc[e]);switch(e){case"urgent":return a.jsx(oa,{className:t});case"high":return a.jsx(bi,{className:t});case"medium":return a.jsx(Ba,{className:t});case"low":return a.jsx(yi,{className:t});default:return a.jsx(_r,{className:"h-3 w-3 shrink-0 text-zinc-300"})}};function HN({issue:e,childCount:t=0,onClick:r}){var f,m;const{data:n}=ks(),{attributes:s,listeners:i,setNodeRef:o,transform:l,transition:c,isDragging:d}=Hp({id:e.id}),u={transform:Kp.Transform.toString(l),transition:c};return a.jsxs("div",{ref:o,style:u,...s,...i,onClick:r,className:z("bg-white dark:bg-card border border-border rounded-lg px-3 py-2.5 cursor-pointer select-none","hover:border-zinc-300 dark:hover:border-zinc-600 transition-colors",d&&"opacity-40 shadow-lg ring-2 ring-indigo/30"),children:[a.jsx("p",{className:"text-[13px] text-foreground leading-snug line-clamp-2 mb-2",children:e.title}),a.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-muted-foreground mb-2",children:[a.jsx(Wt,{className:"h-2.5 w-2.5 shrink-0"}),a.jsx("span",{children:e.start_date?fe(new Date(e.start_date),"MMM d"):"?"}),a.jsx("span",{children:"→"}),a.jsx("span",{children:e.due_date?fe(new Date(e.due_date),"MMM d"):"?"})]}),a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[a.jsx("span",{className:"text-[11px] font-mono text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/50 px-1 py-0.5 rounded shrink-0",children:e.identifier}),e.parent_id&&a.jsx("span",{className:"flex items-center text-zinc-400 dark:text-zinc-500 shrink-0",title:"Child issue",children:a.jsx(Mn,{className:"h-3 w-3"})}),t>0&&a.jsxs("span",{className:"flex items-center gap-0.5 text-[10px] font-medium text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/50 px-1 py-0.5 rounded shrink-0",children:[a.jsx(Mn,{className:"h-2.5 w-2.5"}),t]})]}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[(e.assignee_ids??[]).length>0&&a.jsxs("div",{className:"flex -space-x-1",children:[(e.assignee_ids??[]).slice(0,2).map(p=>{const x=n==null?void 0:n.get(p);return a.jsx(Rt,{className:"h-4 w-4 border border-background",children:a.jsx($t,{className:"text-[8px] bg-indigo-100 text-indigo-700 dark:bg-indigo-900/50 dark:text-indigo-300",children:(x==null?void 0:x.initials)??"?"})},p)}),(((f=e.assignee_ids)==null?void 0:f.length)??0)>2&&a.jsxs("span",{className:"text-[9px] text-muted-foreground ml-1.5 self-center",children:["+",(((m=e.assignee_ids)==null?void 0:m.length)??0)-2]})]}),a.jsx(e4,{priority:e.priority})]})]})]})}function Wc(e,t){const r=e.replace("#",""),n=parseInt(r.substring(0,2),16),s=parseInt(r.substring(2,4),16),i=parseInt(r.substring(4,6),16);return isNaN(n)||isNaN(s)||isNaN(i)?`rgba(148,163,184,${t})`:`rgba(${n},${s},${i},${t})`}const t4=({category:e,color:t})=>{const r="h-3.5 w-3.5 shrink-0",n={color:t};switch(e){case"completed":return a.jsx(ta,{className:r,style:n});case"started":return a.jsx(Tn,{className:r,style:n});default:return a.jsx(_r,{className:r,style:n})}};function r4({id:e,label:t,color:r,category:n,issues:s,childCounts:i,sortable:o,onIssueClick:l,onRename:c,onDelete:d,isRenaming:u,renameValue:f,onRenameChange:m,onRenameSubmit:p,onRenameCancel:x}){const{setNodeRef:g,isOver:v}=mE({id:e}),{attributes:y,listeners:j,setNodeRef:N,transform:w,transition:k,isDragging:b}=Hp({id:e,disabled:!o}),C=h.useRef(null),_=h.useRef(!1);h.useEffect(()=>{u&&(_.current=!1,setTimeout(()=>{var F;return(F=C.current)==null?void 0:F.focus()},0))},[u]);const S=o?{transform:Kp.Transform.toString(w),transition:k}:void 0,I=Wc(r,.08),A=Wc(r,.16),O=Wc(r,.35),L=!!(c||d);return a.jsxs("div",{ref:N,style:S,className:z("flex flex-col min-w-[260px] max-w-[280px] w-full group/col",b&&"opacity-50"),children:[a.jsxs("div",{className:z("flex items-center gap-2 mb-2 px-1",o&&"cursor-grab"),children:[o&&a.jsx("span",{...y,...j,className:"text-muted-foreground/40 hover:text-muted-foreground touch-none",children:a.jsx(F1,{className:"h-3.5 w-3.5"})}),a.jsx(t4,{category:n,color:r}),u?a.jsx("input",{ref:C,value:f??"",onChange:F=>m==null?void 0:m(F.target.value),onKeyDown:F=>{F.key==="Enter"&&(F.preventDefault(),p==null||p()),F.key==="Escape"&&(F.preventDefault(),_.current=!0,x==null||x())},onBlur:()=>{_.current||p==null||p()},className:"flex-1 text-xs font-medium bg-transparent border-b border-foreground/30 outline-none py-0.5 min-w-0"}):a.jsx("span",{className:"text-xs font-medium text-foreground",children:t}),a.jsx("span",{className:"ml-1 text-[11px] font-medium rounded-full px-1.5 py-0.5 tabular-nums min-w-[18px] text-center",style:{backgroundColor:Wc(r,.12),color:r},children:s.length}),L&&!u&&a.jsxs(Kr,{children:[a.jsx(Yr,{asChild:!0,children:a.jsx("button",{className:"ml-auto h-5 w-5 flex items-center justify-center rounded opacity-0 group-hover/col:opacity-100 hover:bg-muted transition-opacity text-muted-foreground hover:text-foreground",onClick:F=>F.stopPropagation(),children:a.jsx(Ma,{className:"h-3.5 w-3.5"})})}),a.jsxs(Or,{align:"end",className:"w-40",children:[c&&a.jsx(at,{onClick:c,children:"Rename"}),c&&d&&a.jsx(Pn,{}),d&&a.jsx(at,{className:"text-destructive focus:text-destructive",onClick:d,children:"Delete status"})]})]})]}),a.jsxs("div",{ref:g,className:z("flex-1 flex flex-col gap-2 min-h-[200px] p-2 rounded-xl transition-colors"),style:{backgroundColor:v?A:I,boxShadow:v?`inset 0 0 0 1px ${O}`:void 0},children:[a.jsx(qp,{items:s.map(F=>F.id),strategy:hE,children:s.map(F=>a.jsx(HN,{issue:F,childCount:(i==null?void 0:i.get(F.id))??0,onClick:()=>l==null?void 0:l(F)},F.id))}),s.length===0&&a.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[120px]",children:a.jsx("p",{className:"text-xs text-muted-foreground/40",children:"Drop here"})})]})]})}const _m=["#94a3b8","#64748b","#6366f1","#f59e0b","#10b981","#ef4444","#3b82f6","#8b5cf6"],n4=[{value:"backlog",label:"Backlog"},{value:"unstarted",label:"Not Started"},{value:"started",label:"In Progress"},{value:"completed",label:"Done"},{value:"cancelled",label:"Cancelled"}];function a4({open:e,onClose:t,projectId:r}){const[n,s]=h.useState(""),[i,o]=h.useState(_m[0]),[l,c]=h.useState(""),[d,u]=h.useState("started"),f=UI(r),m=l||i,p=()=>{n.trim()&&f.mutate({name:n.trim(),color:m,category:d},{onSuccess:()=>{H.success("Status created"),s(""),o(_m[0]),c(""),u("started"),t()},onError:()=>H.error("Failed to create status")})};return a.jsx(Ni,{open:e,onOpenChange:x=>!x&&t(),children:a.jsxs(ki,{className:"sm:max-w-sm",children:[a.jsx(bo,{children:a.jsx(jo,{className:"text-sm font-medium",children:"New Status"})}),a.jsx(wo,{children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Name"}),a.jsx(Ee,{placeholder:"e.g. In Review",value:n,onChange:x=>s(x.target.value),onKeyDown:x=>x.key==="Enter"&&p(),autoFocus:!0,className:"h-8 text-sm"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Color"}),a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[_m.map(x=>a.jsx("button",{onClick:()=>{o(x),c("")},className:z("h-6 w-6 rounded-full border-2 transition-transform hover:scale-110",i===x&&!l?"border-foreground scale-110":"border-transparent"),style:{backgroundColor:x}},x)),a.jsxs("div",{className:"flex items-center gap-1.5 ml-1",children:[a.jsx("div",{className:"h-6 w-6 rounded-full border border-border shrink-0",style:{backgroundColor:l||"#e5e7eb"}}),a.jsx(Ee,{placeholder:"#hex",value:l,onChange:x=>c(x.target.value),className:"h-6 w-20 text-xs px-1.5"})]})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Category"}),a.jsxs(Le,{value:d,onValueChange:x=>u(x),children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{})}),a.jsx(ze,{children:n4.map(x=>a.jsx(we,{value:x.value,className:"text-xs",children:x.label},x.value))})]})]})]})}),a.jsxs(cc,{className:"mt-2",children:[a.jsx(ne,{variant:"ghost",size:"sm",onClick:t,className:"text-xs",children:"Cancel"}),a.jsx(ne,{size:"sm",onClick:p,disabled:!n.trim()||f.isPending,className:"text-xs",children:"Create"})]})]})})}function s4({projectId:e}){const[t,r]=h.useState(!1);return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex flex-col min-w-[260px] max-w-[280px] w-full",children:a.jsxs("button",{onClick:()=>r(!0),className:"flex items-center gap-2 px-3 py-2 rounded-xl border border-dashed border-border text-muted-foreground hover:text-foreground hover:border-foreground/30 hover:bg-muted/30 transition-colors text-xs font-medium h-9",children:[a.jsx(dt,{className:"h-3.5 w-3.5"}),"Add status"]})}),a.jsx(a4,{open:t,onClose:()=>r(!1),projectId:e})]})}function i4({open:e,statusName:t,issueCount:r,otherStatuses:n,onConfirm:s,onCancel:i,isLoading:o}){const[l,c]=h.useState(""),d=()=>{r>0&&!l||s(r>0?l:null)};return a.jsx(Ua,{open:e,onOpenChange:u=>{u||i()},children:a.jsxs(ca,{className:"sm:max-w-md",children:[a.jsxs(qa,{children:[a.jsx(Ha,{children:"Delete status"}),a.jsx(yo,{children:r>0?`${r} issue${r!==1?"s":""} in "${t}" will be moved to another status.`:`Delete the "${t}" status. This cannot be undone.`})]}),r>0&&a.jsxs("div",{className:"py-2",children:[a.jsx("label",{className:"text-sm font-medium mb-1.5 block",children:"Move issues to"}),a.jsxs(Le,{value:l,onValueChange:c,children:[a.jsx($e,{children:a.jsx(qe,{placeholder:"Select a status..."})}),a.jsx(ze,{children:n.map(u=>a.jsx(we,{value:u.id,children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:u.color}}),u.name]})},u.id))})]})]}),a.jsxs(fx,{children:[a.jsx(ne,{variant:"outline",onClick:i,disabled:o,children:"Cancel"}),a.jsx(ne,{variant:"destructive",onClick:d,disabled:r>0&&!l||o,children:o?"Deleting…":"Delete status"})]})]})})}var kx={};(function e(t,r,n,s){var i=!!(t.Worker&&t.Blob&&t.Promise&&t.OffscreenCanvas&&t.OffscreenCanvasRenderingContext2D&&t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype.transferControlToOffscreen&&t.URL&&t.URL.createObjectURL),o=typeof Path2D=="function"&&typeof DOMMatrix=="function",l=function(){if(!t.OffscreenCanvas)return!1;try{var P=new OffscreenCanvas(1,1),M=P.getContext("2d");M.fillRect(0,0,1,1);var R=P.transferToImageBitmap();M.createPattern(R,"no-repeat")}catch{return!1}return!0}();function c(){}function d(P){var M=r.exports.Promise,R=M!==void 0?M:t.Promise;return typeof R=="function"?new R(P):(P(c,c),null)}var u=function(P,M){return{transform:function(R){if(P)return R;if(M.has(R))return M.get(R);var q=new OffscreenCanvas(R.width,R.height),$=q.getContext("2d");return $.drawImage(R,0,0),M.set(R,q),q},clear:function(){M.clear()}}}(l,new Map),f=function(){var P=Math.floor(16.666666666666668),M,R,q={},$=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(M=function(K){var D=Math.random();return q[D]=requestAnimationFrame(function E(Z){$===Z||$+P-1<Z?($=Z,delete q[D],K()):q[D]=requestAnimationFrame(E)}),D},R=function(K){q[K]&&cancelAnimationFrame(q[K])}):(M=function(K){return setTimeout(K,P)},R=function(K){return clearTimeout(K)}),{frame:M,cancel:R}}(),m=function(){var P,M,R={};function q($){function K(D,E){$.postMessage({options:D||{},callback:E})}$.init=function(E){var Z=E.transferControlToOffscreen();$.postMessage({canvas:Z},[Z])},$.fire=function(E,Z,B){if(M)return K(E,null),M;var Y=Math.random().toString(36).slice(2);return M=d(function(ae){function ee(se){se.data.callback===Y&&(delete R[Y],$.removeEventListener("message",ee),M=null,u.clear(),B(),ae())}$.addEventListener("message",ee),K(E,Y),R[Y]=ee.bind(null,{data:{callback:Y}})}),M},$.reset=function(){$.postMessage({reset:!0});for(var E in R)R[E](),delete R[E]}}return function(){if(P)return P;if(!n&&i){var $=["var CONFETTI, SIZE = {}, module = {};","("+e.toString()+")(this, module, true, SIZE);","onmessage = function(msg) {"," if (msg.data.options) {"," CONFETTI(msg.data.options).then(function () {"," if (msg.data.callback) {"," postMessage({ callback: msg.data.callback });"," }"," });"," } else if (msg.data.reset) {"," CONFETTI && CONFETTI.reset();"," } else if (msg.data.resize) {"," SIZE.width = msg.data.resize.width;"," SIZE.height = msg.data.resize.height;"," } else if (msg.data.canvas) {"," SIZE.width = msg.data.canvas.width;"," SIZE.height = msg.data.canvas.height;"," CONFETTI = module.exports.create(msg.data.canvas);"," }","}"].join(`
|
|
556
556
|
`);try{P=new Worker(URL.createObjectURL(new Blob([$])))}catch(K){return typeof console<"u"&&typeof console.warn=="function"&&console.warn("🎊 Could not load worker",K),null}q(P)}return P}}(),p={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function x(P,M){return M?M(P):P}function g(P){return P!=null}function v(P,M,R){return x(P&&g(P[M])?P[M]:p[M],R)}function y(P){return P<0?0:Math.floor(P)}function j(P,M){return Math.floor(Math.random()*(M-P))+P}function N(P){return parseInt(P,16)}function w(P){return P.map(k)}function k(P){var M=String(P).replace(/[^0-9a-f]/gi,"");return M.length<6&&(M=M[0]+M[0]+M[1]+M[1]+M[2]+M[2]),{r:N(M.substring(0,2)),g:N(M.substring(2,4)),b:N(M.substring(4,6))}}function b(P){var M=v(P,"origin",Object);return M.x=v(M,"x",Number),M.y=v(M,"y",Number),M}function C(P){P.width=document.documentElement.clientWidth,P.height=document.documentElement.clientHeight}function _(P){var M=P.getBoundingClientRect();P.width=M.width,P.height=M.height}function S(P){var M=document.createElement("canvas");return M.style.position="fixed",M.style.top="0px",M.style.left="0px",M.style.pointerEvents="none",M.style.zIndex=P,M}function I(P,M,R,q,$,K,D,E,Z){P.save(),P.translate(M,R),P.rotate(K),P.scale(q,$),P.arc(0,0,1,D,E,Z),P.restore()}function A(P){var M=P.angle*(Math.PI/180),R=P.spread*(Math.PI/180);return{x:P.x,y:P.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:P.startVelocity*.5+Math.random()*P.startVelocity,angle2D:-M+(.5*R-Math.random()*R),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:P.color,shape:P.shape,tick:0,totalTicks:P.ticks,decay:P.decay,drift:P.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:P.gravity*3,ovalScalar:.6,scalar:P.scalar,flat:P.flat}}function O(P,M){M.x+=Math.cos(M.angle2D)*M.velocity+M.drift,M.y+=Math.sin(M.angle2D)*M.velocity+M.gravity,M.velocity*=M.decay,M.flat?(M.wobble=0,M.wobbleX=M.x+10*M.scalar,M.wobbleY=M.y+10*M.scalar,M.tiltSin=0,M.tiltCos=0,M.random=1):(M.wobble+=M.wobbleSpeed,M.wobbleX=M.x+10*M.scalar*Math.cos(M.wobble),M.wobbleY=M.y+10*M.scalar*Math.sin(M.wobble),M.tiltAngle+=.1,M.tiltSin=Math.sin(M.tiltAngle),M.tiltCos=Math.cos(M.tiltAngle),M.random=Math.random()+2);var R=M.tick++/M.totalTicks,q=M.x+M.random*M.tiltCos,$=M.y+M.random*M.tiltSin,K=M.wobbleX+M.random*M.tiltCos,D=M.wobbleY+M.random*M.tiltSin;if(P.fillStyle="rgba("+M.color.r+", "+M.color.g+", "+M.color.b+", "+(1-R)+")",P.beginPath(),o&&M.shape.type==="path"&&typeof M.shape.path=="string"&&Array.isArray(M.shape.matrix))P.fill(G(M.shape.path,M.shape.matrix,M.x,M.y,Math.abs(K-q)*.1,Math.abs(D-$)*.1,Math.PI/10*M.wobble));else if(M.shape.type==="bitmap"){var E=Math.PI/10*M.wobble,Z=Math.abs(K-q)*.1,B=Math.abs(D-$)*.1,Y=M.shape.bitmap.width*M.scalar,ae=M.shape.bitmap.height*M.scalar,ee=new DOMMatrix([Math.cos(E)*Z,Math.sin(E)*Z,-Math.sin(E)*B,Math.cos(E)*B,M.x,M.y]);ee.multiplySelf(new DOMMatrix(M.shape.matrix));var se=P.createPattern(u.transform(M.shape.bitmap),"no-repeat");se.setTransform(ee),P.globalAlpha=1-R,P.fillStyle=se,P.fillRect(M.x-Y/2,M.y-ae/2,Y,ae),P.globalAlpha=1}else if(M.shape==="circle")P.ellipse?P.ellipse(M.x,M.y,Math.abs(K-q)*M.ovalScalar,Math.abs(D-$)*M.ovalScalar,Math.PI/10*M.wobble,0,2*Math.PI):I(P,M.x,M.y,Math.abs(K-q)*M.ovalScalar,Math.abs(D-$)*M.ovalScalar,Math.PI/10*M.wobble,0,2*Math.PI);else if(M.shape==="star")for(var V=Math.PI/2*3,ie=4*M.scalar,pe=8*M.scalar,ue=M.x,ve=M.y,Q=5,ge=Math.PI/Q;Q--;)ue=M.x+Math.cos(V)*pe,ve=M.y+Math.sin(V)*pe,P.lineTo(ue,ve),V+=ge,ue=M.x+Math.cos(V)*ie,ve=M.y+Math.sin(V)*ie,P.lineTo(ue,ve),V+=ge;else P.moveTo(Math.floor(M.x),Math.floor(M.y)),P.lineTo(Math.floor(M.wobbleX),Math.floor($)),P.lineTo(Math.floor(K),Math.floor(D)),P.lineTo(Math.floor(q),Math.floor(M.wobbleY));return P.closePath(),P.fill(),M.tick<M.totalTicks}function L(P,M,R,q,$){var K=M.slice(),D=P.getContext("2d"),E,Z,B=d(function(Y){function ae(){E=Z=null,D.clearRect(0,0,q.width,q.height),u.clear(),$(),Y()}function ee(){n&&!(q.width===s.width&&q.height===s.height)&&(q.width=P.width=s.width,q.height=P.height=s.height),!q.width&&!q.height&&(R(P),q.width=P.width,q.height=P.height),D.clearRect(0,0,q.width,q.height),K=K.filter(function(se){return O(D,se)}),K.length?E=f.frame(ee):ae()}E=f.frame(ee),Z=ae});return{addFettis:function(Y){return K=K.concat(Y),B},canvas:P,promise:B,reset:function(){E&&f.cancel(E),Z&&Z()}}}function F(P,M){var R=!P,q=!!v(M||{},"resize"),$=!1,K=v(M,"disableForReducedMotion",Boolean),D=i&&!!v(M||{},"useWorker"),E=D?m():null,Z=R?C:_,B=P&&E?!!P.__confetti_initialized:!1,Y=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion)").matches,ae;function ee(V,ie,pe){for(var ue=v(V,"particleCount",y),ve=v(V,"angle",Number),Q=v(V,"spread",Number),ge=v(V,"startVelocity",Number),De=v(V,"decay",Number),Ue=v(V,"gravity",Number),Fe=v(V,"drift",Number),Ve=v(V,"colors",w),ut=v(V,"ticks",Number),Ke=v(V,"shapes"),Ze=v(V,"scalar"),tr=!!v(V,"flat"),Ir=b(V),rr=ue,yr=[],nr=P.width*Ir.x,yt=P.height*Ir.y;rr--;)yr.push(A({x:nr,y:yt,angle:ve,spread:Q,startVelocity:ge,color:Ve[rr%Ve.length],shape:Ke[j(0,Ke.length)],ticks:ut,decay:De,gravity:Ue,drift:Fe,scalar:Ze,flat:tr}));return ae?ae.addFettis(yr):(ae=L(P,yr,Z,ie,pe),ae.promise)}function se(V){var ie=K||v(V,"disableForReducedMotion",Boolean),pe=v(V,"zIndex",Number);if(ie&&Y)return d(function(ge){ge()});R&&ae?P=ae.canvas:R&&!P&&(P=S(pe),document.body.appendChild(P)),q&&!B&&Z(P);var ue={width:P.width,height:P.height};E&&!B&&E.init(P),B=!0,E&&(P.__confetti_initialized=!0);function ve(){if(E){var ge={getBoundingClientRect:function(){if(!R)return P.getBoundingClientRect()}};Z(ge),E.postMessage({resize:{width:ge.width,height:ge.height}});return}ue.width=ue.height=null}function Q(){ae=null,q&&($=!1,t.removeEventListener("resize",ve)),R&&P&&(document.body.contains(P)&&document.body.removeChild(P),P=null,B=!1)}return q&&!$&&($=!0,t.addEventListener("resize",ve,!1)),E?E.fire(V,ue,Q):ee(V,ue,Q)}return se.reset=function(){E&&E.reset(),ae&&ae.reset()},se}var X;function T(){return X||(X=F(null,{useWorker:!0,resize:!0})),X}function G(P,M,R,q,$,K,D){var E=new Path2D(P),Z=new Path2D;Z.addPath(E,new DOMMatrix(M));var B=new Path2D;return B.addPath(Z,new DOMMatrix([Math.cos(D)*$,Math.sin(D)*$,-Math.sin(D)*K,Math.cos(D)*K,R,q])),B}function re(P){if(!o)throw new Error("path confetti are not supported in this browser");var M,R;typeof P=="string"?M=P:(M=P.path,R=P.matrix);var q=new Path2D(M),$=document.createElement("canvas"),K=$.getContext("2d");if(!R){for(var D=1e3,E=D,Z=D,B=0,Y=0,ae,ee,se=0;se<D;se+=2)for(var V=0;V<D;V+=2)K.isPointInPath(q,se,V,"nonzero")&&(E=Math.min(E,se),Z=Math.min(Z,V),B=Math.max(B,se),Y=Math.max(Y,V));ae=B-E,ee=Y-Z;var ie=10,pe=Math.min(ie/ae,ie/ee);R=[pe,0,0,pe,-Math.round(ae/2+E)*pe,-Math.round(ee/2+Z)*pe]}return{type:"path",path:M,matrix:R}}function J(P){var M,R=1,q="#000000",$='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';typeof P=="string"?M=P:(M=P.text,R="scalar"in P?P.scalar:R,$="fontFamily"in P?P.fontFamily:$,q="color"in P?P.color:q);var K=10*R,D=""+K+"px "+$,E=new OffscreenCanvas(K,K),Z=E.getContext("2d");Z.font=D;var B=Z.measureText(M),Y=Math.ceil(B.actualBoundingBoxRight+B.actualBoundingBoxLeft),ae=Math.ceil(B.actualBoundingBoxAscent+B.actualBoundingBoxDescent),ee=2,se=B.actualBoundingBoxLeft+ee,V=B.actualBoundingBoxAscent+ee;Y+=ee+ee,ae+=ee+ee,E=new OffscreenCanvas(Y,ae),Z=E.getContext("2d"),Z.font=D,Z.fillStyle=q,Z.fillText(M,se,V);var ie=1/R;return{type:"bitmap",bitmap:E.transferToImageBitmap(),matrix:[ie,0,0,ie,-Y*ie/2,-ae*ie/2]}}r.exports=function(){return T().apply(this,arguments)},r.exports.reset=function(){T().reset()},r.exports.create=F,r.exports.shapeFromPath=re,r.exports.shapeFromText=J})(function(){return typeof window<"u"?window:typeof self<"u"?self:this||{}}(),kx,!1);const o4=kx.exports;kx.exports.create;function Mm(e,t){var n;const r={};for(const s of t)r[s.key]=[];for(const s of e)if(r[s.status]!==void 0)r[s.status].push(s);else{const i=((n=t[0])==null?void 0:n.key)??"backlog";r[i]=[...r[i]??[],s]}return r}function l4(e,t,r){var i;const n=new Map(t.map(o=>[o.id,o])),s={};for(const o of r)s[o.key]=[];for(const o of r)for(const l of e[o.key]??[]){const c=n.get(l.id);c&&c.status===o.key&&(s[o.key].push(c),n.delete(l.id))}for(const o of n.values()){const l=s[o.status];if(l)l.push(o);else{const c=(i=r[0])==null?void 0:i.key;c&&s[c].push(o)}}return s}function KN({issues:e,projectId:t,statuses:r,onIssueClick:n,onColumnsReorder:s,readOnly:i=!1,filters:o}){var K;const[l,c]=h.useState(()=>r.map(D=>D.id)),[d,u]=h.useState(()=>Mm(e,r)),[f,m]=h.useState(null),[p,x]=h.useState(null),[g,v]=h.useState(null),[y,j]=h.useState(null),[N,w]=h.useState(""),k=h.useRef(null),b=h.useRef(!1),C=Se(),_=Tt.byProject(t,o),S=HI(t),I=qI(t,y??""),A=h.useMemo(()=>{const D=new Map;for(const E of e)E.parent_id&&D.set(E.parent_id,(D.get(E.parent_id)??0)+1);return D},[e]);h.useEffect(()=>{c(D=>{const E=new Set(r.map(Y=>Y.id)),Z=D.filter(Y=>E.has(Y)),B=r.map(Y=>Y.id).filter(Y=>!D.includes(Y));return Z.length===D.length&&B.length===0?D:[...Z,...B]})},[r]),h.useEffect(()=>{b.current||u(D=>l4(D,e,r))},[e,r]);const O=[...r].sort((D,E)=>{const Z=l.indexOf(D.id),B=l.indexOf(E.id);return Z===-1&&B===-1?D.position-E.position:Z===-1?1:B===-1?-1:Z-B}),L=o1(Up(l1,i?{activationConstraint:{distance:1/0}}:{activationConstraint:{distance:5}})),F=h.useCallback(D=>{if(p){const Z=D.droppableContainers.filter(B=>l.includes(B.id));return pE({...D,droppableContainers:Z})}const E=xE(D);return E.length>0?E:gE(D)},[p,l]),X=h.useCallback(D=>{for(const[E,Z]of Object.entries(d))if(Z.some(B=>B.id===D))return E;return null},[d]),T=h.useCallback(D=>r.some(E=>E.id===D),[r]),G=D=>{const E=D.active.id;if(b.current=!0,T(E)){x(E);return}for(const[Z,B]of Object.entries(d)){const Y=B.find(ae=>ae.id===E);if(Y){m(Y),k.current=Z;return}}},re=D=>{const{active:E,over:Z}=D;if(!Z||p)return;const B=E.id,Y=Z.id;if(T(B))return;const ae=X(B),ee=r.find(V=>V.key===Y||V.id===Y),se=(ee==null?void 0:ee.key)??X(Y);!ae||!se||ae===se||u(V=>{const ie=[...V[ae]??[]],pe=[...V[se]??[]],ue=ie.findIndex(ge=>ge.id===B);if(ue===-1)return V;const[ve]=ie.splice(ue,1),Q={...ve,status:se};if(ee)pe.push(Q);else{const ge=pe.findIndex(De=>De.id===Y);if(ge===-1)pe.push(Q);else{const De=E.rect.current.translated!=null&&E.rect.current.translated.top>Z.rect.top+Z.rect.height/2;pe.splice(De?ge+1:ge,0,Q)}}return{...V,[ae]:ie,[se]:pe}})},J=D=>{var V;const{active:E,over:Z}=D;if(m(null),p){if(x(null),b.current=!1,!Z||E.id===Z.id)return;const ie=l.indexOf(E.id),pe=l.indexOf(Z.id);if(ie===-1||pe===-1||ie===pe)return;const ue=pd(l,ie,pe);c(ue),s==null||s(ue);return}if(!Z){b.current=!1;const ie=k.current;k.current=null,ie&&u(Mm(e,r));return}const B=E.id,Y=Z.id,ae=k.current;k.current=null;const ee=r.find(ie=>ie.key===Y||ie.id===Y),se=(ee==null?void 0:ee.key)??X(Y);if(!ae||!se){b.current=!1;return}if(ae===se)b.current=!1,u(ie=>{const pe=ie[ae]??[],ue=pe.findIndex(Q=>Q.id===B),ve=pe.findIndex(Q=>Q.id===Y);return ue===-1||ve===-1||ue===ve?ie:{...ie,[ae]:pd(pe,ue,ve)}});else{if(!r.find(ue=>ue.key===Y||ue.id===Y))u(ue=>{const ve=[...ue[se]??[]],Q=ve.findIndex(Ve=>Ve.id===B);if(Q===-1)return ue;const ge=D.active.rect.current.translated!=null&&D.active.rect.current.translated.top>D.over.rect.top+D.over.rect.height/2,[De]=ve.splice(Q,1),Ue=ve.findIndex(Ve=>Ve.id===Y);if(Ue===-1)return ve.splice(Q,0,De),ue;const Fe=ge?Ue+1:Ue;return ve.splice(Fe,0,De),{...ue,[se]:ve}});else{const ue=((V=D.active.rect.current.translated)==null?void 0:V.top)??1/0,ve=D.over.rect.top+D.over.rect.height/2;ue<ve&&u(Q=>{const ge=Q[se]??[],De=ge.findIndex(Ue=>Ue.id===B);return De<=0?Q:{...Q,[se]:pd(ge,De,0)}})}const pe=C.getQueryData(_);C.cancelQueries({queryKey:_}),C.setQueryData(_,ue=>ue&&{...ue,issues:ue.issues.map(ve=>ve.id===B?{...ve,status:se}:ve)}),oe.put(`/admin/issues/${B}`,{status:se}).then(()=>{b.current=!1,C.invalidateQueries({queryKey:_});const ue=r.find(ve=>ve.key===se);(ue==null?void 0:ue.category)==="completed"&&o4({particleCount:80,spread:60,origin:{y:.6}})}).catch(()=>{b.current=!1,pe&&C.setQueryData(_,pe),u(Mm((pe==null?void 0:pe.issues)??e,r)),H.error("Failed to update issue status")})}},P=D=>{v(D)},M=async D=>{if(!g)return;const E=d[g.key]??[];if(E.length>0){const Z=r.find(B=>B.id===D);if(!Z)return;try{await Promise.all(E.map(B=>oe.put(`/admin/issues/${B.id}`,{status:Z.key}))),C.invalidateQueries({queryKey:Tt.byProject(t)})}catch{H.error("Failed to move issues");return}}S.mutate(g.id,{onSuccess:()=>{H.success(`Status "${g.name}" deleted`),v(null)},onError:()=>H.error("Failed to delete status")})},R=()=>{const D=N.trim();!D||!y||I.mutate({name:D},{onSuccess:()=>{H.success("Status renamed"),j(null)},onError:()=>H.error("Failed to rename status")})},q=()=>{j(null)},$=p?r.find(D=>D.id===p):null;return a.jsxs(xl,{sensors:L,collisionDetection:F,onDragStart:G,onDragOver:re,onDragEnd:J,children:[a.jsxs("div",{className:"flex gap-4 min-h-full overflow-x-auto px-6 py-4 pb-6",children:[a.jsx(qp,{items:l,strategy:c1,children:O.map(D=>a.jsx(r4,{id:D.id,label:D.name,color:D.color,category:D.category,issues:d[D.key]??[],childCounts:A,sortable:!0,onIssueClick:n,onRename:i?void 0:()=>{j(D.id),w(D.name)},onDelete:i?void 0:()=>P(D),isRenaming:y===D.id,renameValue:y===D.id?N:"",onRenameChange:w,onRenameSubmit:R,onRenameCancel:q},D.id))}),!i&&a.jsx(s4,{projectId:t})]}),a.jsxs(vE,{children:[f&&a.jsx(HN,{issue:f}),$&&a.jsx("div",{className:"opacity-80 min-w-[260px] max-w-[280px]",children:a.jsxs("div",{className:"h-9 flex items-center gap-2 px-3 rounded-xl border border-border bg-background text-xs font-medium text-foreground",children:[a.jsx("div",{className:"h-3 w-3 rounded-full shrink-0",style:{backgroundColor:$.color}}),$.name]})})]}),g&&a.jsx(i4,{open:!!g,statusName:g.name,issueCount:((K=d[g.key])==null?void 0:K.length)??0,otherStatuses:r.filter(D=>D.id!==g.id),onConfirm:M,onCancel:()=>v(null),isLoading:S.isPending})]})}const Ot=BP,Pt=WP,_t=h.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},s)=>a.jsx(FP,{children:a.jsx(t1,{ref:s,align:t,sideOffset:r,className:z("z-50 w-72 rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md outline-none","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2","data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));_t.displayName=t1.displayName;const c4=[{value:"urgent",label:"Urgent"},{value:"high",label:"High"},{value:"medium",label:"Medium"},{value:"low",label:"Low"},{value:"none",label:"None"}],d4=[{value:"bug",label:"Bug"},{value:"feature",label:"Feature"},{value:"task",label:"Task"},{value:"epic",label:"Epic"},{value:"story",label:"Story"}];function Uc({label:e,activeCount:t,children:r}){const[n,s]=h.useState(!1);return a.jsxs(Ot,{open:n,onOpenChange:s,children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{className:z("inline-flex items-center gap-1.5 h-7 px-2.5 rounded-md border text-xs font-medium transition-colors",t>0?"border-foreground/30 bg-foreground/5 text-foreground":"border-border text-muted-foreground hover:text-foreground hover:bg-muted"),children:[e,t>0&&a.jsx("span",{className:"flex items-center justify-center h-4 w-4 rounded-full bg-foreground text-background text-[10px] font-semibold",children:t}),a.jsx(ia,{className:"h-3 w-3 opacity-60"})]})}),a.jsx(_t,{className:"w-48 p-1",align:"start",children:r})]})}function Om({options:e,selected:t,onToggle:r}){return a.jsx("div",{className:"flex flex-col gap-0.5",children:e.map(n=>{const s=t.includes(n.value);return a.jsxs("button",{onClick:()=>r(n.value),className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs hover:bg-muted w-full text-left",children:[a.jsx("div",{className:z("h-3.5 w-3.5 rounded border flex items-center justify-center shrink-0",s?"bg-foreground border-foreground":"border-border"),children:s&&a.jsx(dr,{className:"h-2.5 w-2.5 text-background"})}),n.color&&a.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:n.color}}),a.jsx("span",{className:"truncate",children:n.label})]},n.value)})})}function u4({statuses:e,members:t,filters:r,onChange:n}){var c,d,u,f,m,p,x;const s=(((c=r.priority)==null?void 0:c.length)??0)>0||!!r.assignee_id||(((d=r.type)==null?void 0:d.length)??0)>0||(((u=r.status)==null?void 0:u.length)??0)>0,i=(g,v)=>{const y=r[g]??[],j=y.includes(v)?y.filter(N=>N!==v):[...y,v];n({...r,[g]:j.length?j:void 0})},o=g=>{n({...r,assignee_id:r.assignee_id===g?void 0:g})},l=r.assignee_id?((f=t.find(g=>g.userId===r.assignee_id))==null?void 0:f.name)??"Assignee":"Assignee";return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Uc,{label:r.assignee_id?l:"Assignee",activeCount:r.assignee_id?1:0,children:a.jsxs("div",{className:"flex flex-col gap-0.5",children:[t.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground px-2 py-1.5",children:"No members"}),t.map(g=>{const v=r.assignee_id===g.userId;return a.jsxs("button",{onClick:()=>o(g.userId),className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs hover:bg-muted w-full text-left",children:[a.jsx("div",{className:z("h-3.5 w-3.5 rounded border flex items-center justify-center shrink-0",v?"bg-foreground border-foreground":"border-border"),children:v&&a.jsx(dr,{className:"h-2.5 w-2.5 text-background"})}),a.jsx("span",{className:"h-5 w-5 rounded-full bg-muted flex items-center justify-center text-[10px] font-medium shrink-0",children:g.initials}),a.jsx("span",{className:"truncate",children:g.name})]},g.userId)})]})}),a.jsx(Uc,{label:"Priority",activeCount:((m=r.priority)==null?void 0:m.length)??0,children:a.jsx(Om,{options:c4,selected:r.priority??[],onToggle:g=>i("priority",g)})}),a.jsx(Uc,{label:"Type",activeCount:((p=r.type)==null?void 0:p.length)??0,children:a.jsx(Om,{options:d4,selected:r.type??[],onToggle:g=>i("type",g)})}),a.jsx(Uc,{label:"Status",activeCount:((x=r.status)==null?void 0:x.length)??0,children:a.jsx(Om,{options:e.map(g=>({value:g.key,label:g.name,color:g.color})),selected:r.status??[],onToggle:g=>i("status",g)})}),s&&a.jsxs("button",{onClick:()=>n({}),className:"inline-flex items-center gap-1 h-7 px-2 rounded text-xs text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[a.jsx(tt,{className:"h-3 w-3"}),"Clear"]})]})}const f4={mon:!0,tue:!0,wed:!0,thu:!0,fri:!0,sat:!1,sun:!1};function Sx(){return Be({queryKey:["org","calendar"],queryFn:()=>oe.get("/admin/org/calendar"),select:e=>({working_days:e.working_days??f4,timezone:e.timezone})})}function m4(){const e=Se();return be({mutationFn:t=>oe.put("/admin/org/calendar",t),onSuccess:()=>{e.invalidateQueries({queryKey:["org","calendar"]})}})}function Cx(e){const t=e??new Date().getFullYear();return Be({queryKey:["org","holidays",t],queryFn:()=>oe.get(`/admin/org/holidays?year=${t}`),select:r=>r.holidays})}function h4(){const e=Se();return be({mutationFn:t=>oe.post("/admin/org/holidays",t),onSuccess:()=>{e.invalidateQueries({queryKey:["org","holidays"]})}})}function p4(){const e=Se();return be({mutationFn:({id:t,...r})=>oe.put(`/admin/org/holidays/${t}`,r),onSuccess:()=>{e.invalidateQueries({queryKey:["org","holidays"]})}})}function x4(){const e=Se();return be({mutationFn:t=>oe.delete(`/admin/org/holidays/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:["org","holidays"]})}})}function g4(){return Be({queryKey:["app-config"],queryFn:()=>oe.get("/admin/config"),staleTime:1/0})}const v4=["sun","mon","tue","wed","thu","fri","sat"];function y4(e,t,r){const n=v4[AI(e)];if(!t[n])return!1;const s=gd(e),i=gl(e);for(const o of r){const l=new Date(o.date);if(o.recurring){if(gd(l)===s&&gl(l)===i)return!1}else if(l.getFullYear()===e.getFullYear()&&gd(l)===s&&gl(l)===i)return!1}return!0}function Mh(e,t,r,n){let s=0,i=new Date(e);i.setHours(0,0,0,0);const o=new Date(t);for(o.setHours(0,0,0,0);i<=o;)y4(i,r,n)&&s++,i=Ur(i,1);return s}const Ji={all:["sprints"],byProject:e=>["sprints","project",e],detail:e=>["sprints",e]};function So(e){return Be({queryKey:e?Ji.byProject(e):Ji.all,queryFn:()=>{const t=e?`/admin/sprints?project_id=${e}`:"/admin/sprints";return oe.get(t)},select:t=>t.sprints,enabled:!!e})}function b4(e){const t=Se();return be({mutationFn:r=>oe.post("/admin/sprints",{...r,project_id:e}),onSuccess:()=>{t.invalidateQueries({queryKey:Ji.byProject(e)})}})}function w4(e,t){const r=Se();return be({mutationFn:n=>oe.put(`/admin/sprints/${e}`,n),onSuccess:()=>{r.invalidateQueries({queryKey:Ji.byProject(t)}),r.invalidateQueries({queryKey:Ji.detail(e)})}})}function j4(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/sprints/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:Ji.byProject(e)})}})}const rf={byProject:e=>["task-lists","project",e]};function fc(e){return Be({queryKey:e?rf.byProject(e):["task-lists"],queryFn:()=>oe.get(`/admin/projects/${e}/task-lists`),select:t=>t.task_lists,enabled:!!e})}function N4(e){const t=Se();return be({mutationFn:r=>oe.post(`/admin/projects/${e}/task-lists`,r),onSuccess:()=>{t.invalidateQueries({queryKey:rf.byProject(e)})}})}function k4(e){const t=Se();return be({mutationFn:({id:r,...n})=>oe.put(`/admin/task-lists/${r}`,n),onSuccess:()=>{t.invalidateQueries({queryKey:rf.byProject(e)})}})}function S4(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/task-lists/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:rf.byProject(e)}),t.invalidateQueries({queryKey:Tt.byProject(e)})}})}function xy(e,t,r){const n=(e==null?void 0:e[0])??"",s=(t==null?void 0:t[0])??"";return(n+s).toUpperCase()||((r==null?void 0:r[0])??"U").toUpperCase()}function gy(e,t,r){return`${e??""} ${t??""}`.trim()||r}function mc({value:e,onChange:t,disabled:r,users:n}){const[s,i]=h.useState(!1),[o,l]=h.useState(e),{data:c}=Nx(),d=n??c??[],u=e.slice().sort().join(",");h.useEffect(()=>{l(e)},[u]);const f=p=>{const x=o.includes(p)?o.filter(g=>g!==p):[...o,p];l(x),t(x)},m=d.filter(p=>o.includes(p.id));return a.jsxs(Ot,{open:s,onOpenChange:i,children:[a.jsx(Pt,{asChild:!0,disabled:r,children:a.jsx("button",{type:"button",className:z("flex items-center gap-1 min-h-[28px] rounded-md px-1.5 py-1","hover:bg-accent transition-colors text-left","focus:outline-none focus-visible:ring-1 focus-visible:ring-ring",r&&"pointer-events-none opacity-50"),children:m.length===0?a.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[a.jsx(po,{className:"h-3.5 w-3.5"}),"Assign"]}):a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("div",{className:"flex -space-x-1.5",children:m.slice(0,3).map(p=>a.jsx(Rt,{className:"h-5 w-5 border border-background ring-0",children:a.jsx($t,{className:"text-[9px] bg-indigo-100 text-indigo-700 dark:bg-indigo-900/50 dark:text-indigo-300",children:xy(p.first_name,p.last_name,p.email)})},p.id))}),m.length>3&&a.jsxs("span",{className:"text-[10px] text-muted-foreground ml-1",children:["+",m.length-3]}),a.jsx("span",{className:"text-xs text-foreground ml-1 hidden sm:inline",children:m.length===1?gy(m[0].first_name,m[0].last_name,m[0].email):`${m.length} assignees`})]})})}),a.jsx(_t,{className:"w-60 p-0",align:"start",children:a.jsxs(Xs,{children:[a.jsx(Qu,{placeholder:"Search users...",className:"h-8 text-xs"}),a.jsxs(Qs,{children:[a.jsx(Zu,{className:"text-xs py-4",children:"No users found."}),a.jsx(cs,{children:d.map(p=>{const x=o.includes(p.id),g=gy(p.first_name,p.last_name,p.email),v=xy(p.first_name,p.last_name,p.email);return a.jsxs(un,{value:g,onSelect:()=>f(p.id),className:"gap-2 py-1.5",children:[a.jsx(Rt,{className:"h-5 w-5 shrink-0",children:a.jsx($t,{className:"text-[9px] bg-muted text-muted-foreground",children:v})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-xs font-medium truncate",children:g}),a.jsx("p",{className:"text-[10px] text-muted-foreground truncate",children:p.email})]}),a.jsx(dr,{className:z("h-3.5 w-3.5 shrink-0",x?"opacity-100 text-indigo-500":"opacity-0")})]},p.id)})})]})]})})]})}function C4(e,t,r="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:r}).format(t).split(/\s/g).slice(2).join(" ")}const Pm={},dl={};function Hs(e,t){try{const n=(Pm[e]||(Pm[e]=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format))(t).split("GMT")[1];return n in dl?dl[n]:vy(n,n.split(":"))}catch{if(e in dl)return dl[e];const r=e==null?void 0:e.match(_4);return r?vy(e,r.slice(1)):NaN}}const _4=/([+-]\d\d):?(\d\d)?/;function vy(e,t){const r=+(t[0]||0),n=+(t[1]||0),s=+(t[2]||0)/60;return dl[e]=r*60+n>0?r*60+n+s:r*60-n-s}class Yn extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(Hs(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),YN(this),Oh(this)):this.setTime(Date.now())}static tz(t,...r){return r.length?new Yn(...r,t):new Yn(Date.now(),t)}withTimeZone(t){return new Yn(+this,t)}getTimezoneOffset(){const t=-Hs(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),Oh(this),+this}[Symbol.for("constructDateFrom")](t){return new Yn(+new Date(t),this.timeZone)}}const yy=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!yy.test(e))return;const t=e.replace(yy,"$1UTC");Yn.prototype[t]&&(e.startsWith("get")?Yn.prototype[e]=function(){return this.internal[t]()}:(Yn.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),M4(this),+this},Yn.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),Oh(this),+this}))});function Oh(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-Hs(e.timeZone,e)*60))}function M4(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),YN(e)}function YN(e){const t=Hs(e.timeZone,e),r=t>0?Math.floor(t):Math.ceil(t),n=new Date(+e);n.setUTCHours(n.getUTCHours()-1);const s=-new Date(+e).getTimezoneOffset(),i=-new Date(+n).getTimezoneOffset(),o=s-i,l=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();o&&l&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+o);const c=s-r;c&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+c);const d=new Date(+e);d.setUTCSeconds(0);const u=s>0?d.getSeconds():(d.getSeconds()-60)%60,f=Math.round(-(Hs(e.timeZone,e)*60))%60;(f||u)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+f),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+f+u));const m=Hs(e.timeZone,e),p=m>0?Math.floor(m):Math.ceil(m),g=-new Date(+e).getTimezoneOffset()-p,v=p!==r,y=g-c;if(v&&y){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+y);const j=Hs(e.timeZone,e),N=j>0?Math.floor(j):Math.ceil(j),w=p-N;w&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+w),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+w))}}class pr extends Yn{static tz(t,...r){return r.length?new pr(...r,t):new pr(Date.now(),t)}toISOString(){const[t,r,n]=this.tzComponents(),s=`${t}${r}:${n}`;return this.internal.toISOString().slice(0,-1)+s}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,r,n,s]=this.internal.toUTCString().split(" ");return`${t==null?void 0:t.slice(0,-1)} ${n} ${r} ${s}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[r,n,s]=this.tzComponents();return`${t} GMT${r}${n}${s} (${C4(this.timeZone,this)})`}toLocaleString(t,r){return Date.prototype.toLocaleString.call(this,t,{...r,timeZone:(r==null?void 0:r.timeZone)||this.timeZone})}toLocaleDateString(t,r){return Date.prototype.toLocaleDateString.call(this,t,{...r,timeZone:(r==null?void 0:r.timeZone)||this.timeZone})}toLocaleTimeString(t,r){return Date.prototype.toLocaleTimeString.call(this,t,{...r,timeZone:(r==null?void 0:r.timeZone)||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),r=t>0?"-":"+",n=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),s=String(Math.abs(t)%60).padStart(2,"0");return[r,n,s]}withTimeZone(t){return new pr(+this,t)}[Symbol.for("constructDateFrom")](t){return new pr(+new Date(t),this.timeZone)}}const by=5,O4=4;function P4(e,t){const r=t.startOfMonth(e),n=r.getDay()>0?r.getDay():7,s=t.addDays(e,-n+1),i=t.addDays(s,by*7-1);return t.getMonth(e)===t.getMonth(i)?by:O4}function GN(e,t){const r=t.startOfMonth(e),n=r.getDay();return n===1?r:n===0?t.addDays(r,-1*6):t.addDays(r,-1*(n-1))}function E4(e,t){const r=GN(e,t),n=P4(e,t);return t.addDays(r,n*7-1)}const VN={...Ws,labels:{labelDayButton:(e,t,r,n)=>{let s;n&&typeof n.format=="function"?s=n.format.bind(n):s=(o,l)=>fe(o,l,{locale:Ws,...r});let i=s(e,"PPPP");return t.today&&(i=`Today, ${i}`),t.selected&&(i=`${i}, selected`),i},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:e=>`Week ${e}`,labelYearDropdown:"Choose the Year",labelGrid:(e,t,r)=>{let n;return r&&typeof r.format=="function"?n=r.format.bind(r):n=(s,i)=>fe(s,i,{locale:Ws,...t}),n(e,"LLLL yyyy")},labelGridcell:(e,t,r,n)=>{let s;n&&typeof n.format=="function"?s=n.format.bind(n):s=(o,l)=>fe(o,l,{locale:Ws,...r});let i=s(e,"PPPP");return t!=null&&t.today&&(i=`Today, ${i}`),i},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(e,t,r)=>{let n;return r&&typeof r.format=="function"?n=r.format.bind(r):n=(s,i)=>fe(s,i,{locale:Ws,...t}),n(e,"cccc")}}};class nn{constructor(t,r){this.Date=Date,this.today=()=>{var n;return(n=this.overrides)!=null&&n.today?this.overrides.today():this.options.timeZone?pr.tz(this.options.timeZone):new this.Date},this.newDate=(n,s,i)=>{var o;return(o=this.overrides)!=null&&o.newDate?this.overrides.newDate(n,s,i):this.options.timeZone?new pr(n,s,i,this.options.timeZone):new Date(n,s,i)},this.addDays=(n,s)=>{var i;return(i=this.overrides)!=null&&i.addDays?this.overrides.addDays(n,s):Ur(n,s)},this.addMonths=(n,s)=>{var i;return(i=this.overrides)!=null&&i.addMonths?this.overrides.addMonths(n,s):gx(n,s)},this.addWeeks=(n,s)=>{var i;return(i=this.overrides)!=null&&i.addWeeks?this.overrides.addWeeks(n,s):N3(n,s)},this.addYears=(n,s)=>{var i;return(i=this.overrides)!=null&&i.addYears?this.overrides.addYears(n,s):k3(n,s)},this.differenceInCalendarDays=(n,s)=>{var i;return(i=this.overrides)!=null&&i.differenceInCalendarDays?this.overrides.differenceInCalendarDays(n,s):ef(n,s)},this.differenceInCalendarMonths=(n,s)=>{var i;return(i=this.overrides)!=null&&i.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(n,s):yx(n,s)},this.eachMonthOfInterval=n=>{var s;return(s=this.overrides)!=null&&s.eachMonthOfInterval?this.overrides.eachMonthOfInterval(n):A3(n)},this.eachYearOfInterval=n=>{var l;const s=(l=this.overrides)!=null&&l.eachYearOfInterval?this.overrides.eachYearOfInterval(n):T3(n),i=new Set(s.map(c=>this.getYear(c)));if(i.size===s.length)return s;const o=[];return i.forEach(c=>{o.push(new Date(c,0,1))}),o},this.endOfBroadcastWeek=n=>{var s;return(s=this.overrides)!=null&&s.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(n):E4(n,this)},this.endOfISOWeek=n=>{var s;return(s=this.overrides)!=null&&s.endOfISOWeek?this.overrides.endOfISOWeek(n):I3(n)},this.endOfMonth=n=>{var s;return(s=this.overrides)!=null&&s.endOfMonth?this.overrides.endOfMonth(n):bx(n)},this.endOfWeek=(n,s)=>{var i;return(i=this.overrides)!=null&&i.endOfWeek?this.overrides.endOfWeek(n,s):FN(n,this.options)},this.endOfYear=n=>{var s;return(s=this.overrides)!=null&&s.endOfYear?this.overrides.endOfYear(n):D3(n)},this.format=(n,s,i)=>{var l;const o=(l=this.overrides)!=null&&l.format?this.overrides.format(n,s,this.options):fe(n,s,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(o):o},this.getISOWeek=n=>{var s;return(s=this.overrides)!=null&&s.getISOWeek?this.overrides.getISOWeek(n):wx(n)},this.getMonth=(n,s)=>{var i;return(i=this.overrides)!=null&&i.getMonth?this.overrides.getMonth(n,this.options):gd(n,this.options)},this.getYear=(n,s)=>{var i;return(i=this.overrides)!=null&&i.getYear?this.overrides.getYear(n,this.options):DI(n,this.options)},this.getWeek=(n,s)=>{var i;return(i=this.overrides)!=null&&i.getWeek?this.overrides.getWeek(n,this.options):jx(n,this.options)},this.isAfter=(n,s)=>{var i;return(i=this.overrides)!=null&&i.isAfter?this.overrides.isAfter(n,s):TI(n,s)},this.isBefore=(n,s)=>{var i;return(i=this.overrides)!=null&&i.isBefore?this.overrides.isBefore(n,s):II(n,s)},this.isDate=n=>{var s;return(s=this.overrides)!=null&&s.isDate?this.overrides.isDate(n):AN(n)},this.isSameDay=(n,s)=>{var i;return(i=this.overrides)!=null&&i.isSameDay?this.overrides.isSameDay(n,s):Zi(n,s)},this.isSameMonth=(n,s)=>{var i;return(i=this.overrides)!=null&&i.isSameMonth?this.overrides.isSameMonth(n,s):RI(n,s)},this.isSameYear=(n,s)=>{var i;return(i=this.overrides)!=null&&i.isSameYear?this.overrides.isSameYear(n,s):$I(n,s)},this.max=n=>{var s;return(s=this.overrides)!=null&&s.max?this.overrides.max(n):S3(n)},this.min=n=>{var s;return(s=this.overrides)!=null&&s.min?this.overrides.min(n):C3(n)},this.setMonth=(n,s)=>{var i;return(i=this.overrides)!=null&&i.setMonth?this.overrides.setMonth(n,s):FI(n,s)},this.setYear=(n,s)=>{var i;return(i=this.overrides)!=null&&i.setYear?this.overrides.setYear(n,s):BI(n,s)},this.startOfBroadcastWeek=(n,s)=>{var i;return(i=this.overrides)!=null&&i.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(n,this):GN(n,this)},this.startOfDay=n=>{var s;return(s=this.overrides)!=null&&s.startOfDay?this.overrides.startOfDay(n):Qi(n)},this.startOfISOWeek=n=>{var s;return(s=this.overrides)!=null&&s.startOfISOWeek?this.overrides.startOfISOWeek(n):Nl(n)},this.startOfMonth=n=>{var s;return(s=this.overrides)!=null&&s.startOfMonth?this.overrides.startOfMonth(n):zN(n)},this.startOfWeek=(n,s)=>{var i;return(i=this.overrides)!=null&&i.startOfWeek?this.overrides.startOfWeek(n,this.options):Xi(n,this.options)},this.startOfYear=n=>{var s;return(s=this.overrides)!=null&&s.startOfYear?this.overrides.startOfYear(n):LN(n)},this.options={locale:VN,...t},this.overrides=r}getDigitMap(){const{numerals:t="latn"}=this.options,r=new Intl.NumberFormat("en-US",{numberingSystem:t}),n={};for(let s=0;s<10;s++)n[s.toString()]=r.format(s);return n}replaceDigits(t){const r=this.getDigitMap();return t.replace(/\d/g,n=>r[n]||n)}formatNumber(t){return this.replaceDigits(t.toString())}getMonthYearOrder(){var r;const t=(r=this.options.locale)==null?void 0:r.code;return t&&nn.yearFirstLocales.has(t)?"year-first":"month-first"}formatMonthYear(t){const{locale:r,timeZone:n,numerals:s}=this.options,i=r==null?void 0:r.code;if(i&&nn.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:n,numberingSystem:s}).format(t)}catch{}const o=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(t,o)}}nn.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const ua=new nn;class XN{constructor(t,r,n=ua){this.date=t,this.displayMonth=r,this.outside=!!(r&&!n.isSameMonth(t,r)),this.dateLib=n,this.isoDate=n.format(t,"yyyy-MM-dd"),this.displayMonthId=n.format(r,"yyyy-MM"),this.dateMonthId=n.format(t,"yyyy-MM")}isEqualTo(t){return this.dateLib.isSameDay(t.date,this.date)&&this.dateLib.isSameMonth(t.displayMonth,this.displayMonth)}}class A4{constructor(t,r){this.date=t,this.weeks=r}}class D4{constructor(t,r){this.days=r,this.weekNumber=t}}function T4(e){return W.createElement("button",{...e})}function I4(e){return W.createElement("span",{...e})}function R4(e){const{size:t=24,orientation:r="left",className:n}=e;return W.createElement("svg",{className:n,width:t,height:t,viewBox:"0 0 24 24"},r==="up"&&W.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),r==="down"&&W.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),r==="left"&&W.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),r==="right"&&W.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function $4(e){const{day:t,modifiers:r,...n}=e;return W.createElement("td",{...n})}function z4(e){const{day:t,modifiers:r,...n}=e,s=W.useRef(null);return W.useEffect(()=>{var i;r.focused&&((i=s.current)==null||i.focus())},[r.focused]),W.createElement("button",{ref:s,...n})}var Me;(function(e){e.Root="root",e.Chevron="chevron",e.Day="day",e.DayButton="day_button",e.CaptionLabel="caption_label",e.Dropdowns="dropdowns",e.Dropdown="dropdown",e.DropdownRoot="dropdown_root",e.Footer="footer",e.MonthGrid="month_grid",e.MonthCaption="month_caption",e.MonthsDropdown="months_dropdown",e.Month="month",e.Months="months",e.Nav="nav",e.NextMonthButton="button_next",e.PreviousMonthButton="button_previous",e.Week="week",e.Weeks="weeks",e.Weekday="weekday",e.Weekdays="weekdays",e.WeekNumber="week_number",e.WeekNumberHeader="week_number_header",e.YearsDropdown="years_dropdown"})(Me||(Me={}));var jt;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(jt||(jt={}));var Cn;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(Cn||(Cn={}));var Qr;(function(e){e.weeks_before_enter="weeks_before_enter",e.weeks_before_exit="weeks_before_exit",e.weeks_after_enter="weeks_after_enter",e.weeks_after_exit="weeks_after_exit",e.caption_after_enter="caption_after_enter",e.caption_after_exit="caption_after_exit",e.caption_before_enter="caption_before_enter",e.caption_before_exit="caption_before_exit"})(Qr||(Qr={}));function L4(e){const{options:t,className:r,components:n,classNames:s,...i}=e,o=[s[Me.Dropdown],r].join(" "),l=t==null?void 0:t.find(({value:c})=>c===i.value);return W.createElement("span",{"data-disabled":i.disabled,className:s[Me.DropdownRoot]},W.createElement(n.Select,{className:o,...i},t==null?void 0:t.map(({value:c,label:d,disabled:u})=>W.createElement(n.Option,{key:c,value:c,disabled:u},d))),W.createElement("span",{className:s[Me.CaptionLabel],"aria-hidden":!0},l==null?void 0:l.label,W.createElement(n.Chevron,{orientation:"down",size:18,className:s[Me.Chevron]})))}function F4(e){return W.createElement("div",{...e})}function B4(e){return W.createElement("div",{...e})}function W4(e){const{calendarMonth:t,displayIndex:r,...n}=e;return W.createElement("div",{...n},e.children)}function U4(e){const{calendarMonth:t,displayIndex:r,...n}=e;return W.createElement("div",{...n})}function q4(e){return W.createElement("table",{...e})}function H4(e){return W.createElement("div",{...e})}const QN=h.createContext(void 0);function hc(){const e=h.useContext(QN);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function K4(e){const{components:t}=hc();return W.createElement(t.Dropdown,{...e})}function Y4(e){const{onPreviousClick:t,onNextClick:r,previousMonth:n,nextMonth:s,...i}=e,{components:o,classNames:l,labels:{labelPrevious:c,labelNext:d}}=hc(),u=h.useCallback(m=>{s&&(r==null||r(m))},[s,r]),f=h.useCallback(m=>{n&&(t==null||t(m))},[n,t]);return W.createElement("nav",{...i},W.createElement(o.PreviousMonthButton,{type:"button",className:l[Me.PreviousMonthButton],tabIndex:n?void 0:-1,"aria-disabled":n?void 0:!0,"aria-label":c(n),onClick:f},W.createElement(o.Chevron,{disabled:n?void 0:!0,className:l[Me.Chevron],orientation:"left"})),W.createElement(o.NextMonthButton,{type:"button",className:l[Me.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":d(s),onClick:u},W.createElement(o.Chevron,{disabled:s?void 0:!0,orientation:"right",className:l[Me.Chevron]})))}function G4(e){const{components:t}=hc();return W.createElement(t.Button,{...e})}function V4(e){return W.createElement("option",{...e})}function X4(e){const{components:t}=hc();return W.createElement(t.Button,{...e})}function Q4(e){const{rootRef:t,...r}=e;return W.createElement("div",{...r,ref:t})}function Z4(e){return W.createElement("select",{...e})}function J4(e){const{week:t,...r}=e;return W.createElement("tr",{...r})}function eR(e){return W.createElement("th",{...e})}function tR(e){return W.createElement("thead",{"aria-hidden":!0},W.createElement("tr",{...e}))}function rR(e){const{week:t,...r}=e;return W.createElement("th",{...r})}function nR(e){return W.createElement("th",{...e})}function aR(e){return W.createElement("tbody",{...e})}function sR(e){const{components:t}=hc();return W.createElement(t.Dropdown,{...e})}const iR=Object.freeze(Object.defineProperty({__proto__:null,Button:T4,CaptionLabel:I4,Chevron:R4,Day:$4,DayButton:z4,Dropdown:L4,DropdownNav:F4,Footer:B4,Month:W4,MonthCaption:U4,MonthGrid:q4,Months:H4,MonthsDropdown:K4,Nav:Y4,NextMonthButton:G4,Option:V4,PreviousMonthButton:X4,Root:Q4,Select:Z4,Week:J4,WeekNumber:rR,WeekNumberHeader:nR,Weekday:eR,Weekdays:tR,Weeks:aR,YearsDropdown:sR},Symbol.toStringTag,{value:"Module"}));function wa(e,t,r=!1,n=ua){let{from:s,to:i}=e;const{differenceInCalendarDays:o,isSameDay:l}=n;return s&&i?(o(i,s)<0&&([s,i]=[i,s]),o(t,s)>=(r?1:0)&&o(i,t)>=(r?1:0)):!r&&i?l(i,t):!r&&s?l(s,t):!1}function _x(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function nf(e){return!!(e&&typeof e=="object"&&"from"in e)}function Mx(e){return!!(e&&typeof e=="object"&&"after"in e)}function Ox(e){return!!(e&&typeof e=="object"&&"before"in e)}function ZN(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function JN(e,t){return Array.isArray(e)&&e.every(t.isDate)}function ja(e,t,r=ua){const n=Array.isArray(t)?t:[t],{isSameDay:s,differenceInCalendarDays:i,isAfter:o}=r;return n.some(l=>{if(typeof l=="boolean")return l;if(r.isDate(l))return s(e,l);if(JN(l,r))return l.some(c=>s(e,c));if(nf(l))return wa(l,e,!1,r);if(ZN(l))return Array.isArray(l.dayOfWeek)?l.dayOfWeek.includes(e.getDay()):l.dayOfWeek===e.getDay();if(_x(l)){const c=i(l.before,e),d=i(l.after,e),u=c>0,f=d<0;return o(l.before,l.after)?f&&u:u||f}return Mx(l)?i(e,l.after)>0:Ox(l)?i(l.before,e)>0:typeof l=="function"?l(e):!1})}function oR(e,t,r,n,s){const{disabled:i,hidden:o,modifiers:l,showOutsideDays:c,broadcastCalendar:d,today:u=s.today()}=t,{isSameDay:f,isSameMonth:m,startOfMonth:p,isBefore:x,endOfMonth:g,isAfter:v}=s,y=r&&p(r),j=n&&g(n),N={[jt.focused]:[],[jt.outside]:[],[jt.disabled]:[],[jt.hidden]:[],[jt.today]:[]},w={};for(const k of e){const{date:b,displayMonth:C}=k,_=!!(C&&!m(b,C)),S=!!(y&&x(b,y)),I=!!(j&&v(b,j)),A=!!(i&&ja(b,i,s)),O=!!(o&&ja(b,o,s))||S||I||!d&&!c&&_||d&&c===!1&&_,L=f(b,u);_&&N.outside.push(k),A&&N.disabled.push(k),O&&N.hidden.push(k),L&&N.today.push(k),l&&Object.keys(l).forEach(F=>{const X=l==null?void 0:l[F];X&&ja(b,X,s)&&(w[F]?w[F].push(k):w[F]=[k])})}return k=>{const b={[jt.focused]:!1,[jt.disabled]:!1,[jt.hidden]:!1,[jt.outside]:!1,[jt.today]:!1},C={};for(const _ in N){const S=N[_];b[_]=S.some(I=>I===k)}for(const _ in w)C[_]=w[_].some(S=>S===k);return{...b,...C}}}function lR(e,t,r={}){return Object.entries(e).filter(([,s])=>s===!0).reduce((s,[i])=>(r[i]?s.push(r[i]):t[jt[i]]?s.push(t[jt[i]]):t[Cn[i]]&&s.push(t[Cn[i]]),s),[t[Me.Day]])}function cR(e){return{...iR,...e}}function dR(e){const t={"data-mode":e.mode??void 0,"data-required":"required"in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([r,n])=>{r.startsWith("data-")&&(t[r]=n)}),t}function uR(){const e={};for(const t in Me)e[Me[t]]=`rdp-${Me[t]}`;for(const t in jt)e[jt[t]]=`rdp-${jt[t]}`;for(const t in Cn)e[Cn[t]]=`rdp-${Cn[t]}`;for(const t in Qr)e[Qr[t]]=`rdp-${Qr[t]}`;return e}function ek(e,t,r){return(r??new nn(t)).formatMonthYear(e)}const fR=ek;function mR(e,t,r){return(r??new nn(t)).format(e,"d")}function hR(e,t=ua){return t.format(e,"LLLL")}function pR(e,t,r){return(r??new nn(t)).format(e,"cccccc")}function xR(e,t=ua){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function gR(){return""}function tk(e,t=ua){return t.format(e,"yyyy")}const vR=tk,yR=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:ek,formatDay:mR,formatMonthCaption:fR,formatMonthDropdown:hR,formatWeekNumber:xR,formatWeekNumberHeader:gR,formatWeekdayName:pR,formatYearCaption:vR,formatYearDropdown:tk},Symbol.toStringTag,{value:"Module"}));function bR(e){return e!=null&&e.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e!=null&&e.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...yR,...e}}function Px(e,t,r,n){let s=(n??new nn(r)).format(e,"PPPP");return t.today&&(s=`Today, ${s}`),t.selected&&(s=`${s}, selected`),s}const wR=Px;function Ex(e,t,r){return(r??new nn(t)).formatMonthYear(e)}const jR=Ex;function rk(e,t,r,n){let s=(n??new nn(r)).format(e,"PPPP");return t!=null&&t.today&&(s=`Today, ${s}`),s}function nk(e){return"Choose the Month"}function ak(){return""}const NR="Go to the Next Month";function sk(e,t){return NR}function ik(e){return"Go to the Previous Month"}function ok(e,t,r){return(r??new nn(t)).format(e,"cccc")}function lk(e,t){return`Week ${e}`}function ck(e){return"Week Number"}function dk(e){return"Choose the Year"}const kR=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:jR,labelDay:wR,labelDayButton:Px,labelGrid:Ex,labelGridcell:rk,labelMonthDropdown:nk,labelNav:ak,labelNext:sk,labelPrevious:ik,labelWeekNumber:lk,labelWeekNumberHeader:ck,labelWeekday:ok,labelYearDropdown:dk},Symbol.toStringTag,{value:"Module"})),bn=(e,t,r)=>t||(r?typeof r=="function"?r:(...n)=>r:e);function SR(e,t){var n;const r=((n=t.locale)==null?void 0:n.labels)??{};return{...kR,...e??{},labelDayButton:bn(Px,e==null?void 0:e.labelDayButton,r.labelDayButton),labelMonthDropdown:bn(nk,e==null?void 0:e.labelMonthDropdown,r.labelMonthDropdown),labelNext:bn(sk,e==null?void 0:e.labelNext,r.labelNext),labelPrevious:bn(ik,e==null?void 0:e.labelPrevious,r.labelPrevious),labelWeekNumber:bn(lk,e==null?void 0:e.labelWeekNumber,r.labelWeekNumber),labelYearDropdown:bn(dk,e==null?void 0:e.labelYearDropdown,r.labelYearDropdown),labelGrid:bn(Ex,e==null?void 0:e.labelGrid,r.labelGrid),labelGridcell:bn(rk,e==null?void 0:e.labelGridcell,r.labelGridcell),labelNav:bn(ak,e==null?void 0:e.labelNav,r.labelNav),labelWeekNumberHeader:bn(ck,e==null?void 0:e.labelWeekNumberHeader,r.labelWeekNumberHeader),labelWeekday:bn(ok,e==null?void 0:e.labelWeekday,r.labelWeekday)}}function CR(e,t,r,n,s){const{startOfMonth:i,startOfYear:o,endOfYear:l,eachMonthOfInterval:c,getMonth:d}=s;return c({start:o(e),end:l(e)}).map(m=>{const p=n.formatMonthDropdown(m,s),x=d(m),g=t&&m<i(t)||r&&m>i(r)||!1;return{value:x,label:p,disabled:g}})}function _R(e,t={},r={}){let n={...t==null?void 0:t[Me.Day]};return Object.entries(e).filter(([,s])=>s===!0).forEach(([s])=>{n={...n,...r==null?void 0:r[s]}}),n}function MR(e,t,r,n){const s=n??e.today(),i=r?e.startOfBroadcastWeek(s,e):t?e.startOfISOWeek(s):e.startOfWeek(s),o=[];for(let l=0;l<7;l++){const c=e.addDays(i,l);o.push(c)}return o}function OR(e,t,r,n,s=!1){if(!e||!t)return;const{startOfYear:i,endOfYear:o,eachYearOfInterval:l,getYear:c}=n,d=i(e),u=o(t),f=l({start:d,end:u});return s&&f.reverse(),f.map(m=>{const p=r.formatYearDropdown(m,n);return{value:c(m),label:p,disabled:!1}})}function PR(e,t={}){var l;const{weekStartsOn:r,locale:n}=t,s=r??((l=n==null?void 0:n.options)==null?void 0:l.weekStartsOn)??0,i=c=>{const d=typeof c=="number"||typeof c=="string"?new Date(c):c;return new pr(d.getFullYear(),d.getMonth(),d.getDate(),12,0,0,e)},o=c=>{const d=i(c);return new Date(d.getFullYear(),d.getMonth(),d.getDate(),0,0,0,0)};return{today:()=>i(pr.tz(e)),newDate:(c,d,u)=>new pr(c,d,u,12,0,0,e),startOfDay:c=>i(c),startOfWeek:(c,d)=>{const u=i(c),f=(d==null?void 0:d.weekStartsOn)??s,m=(u.getDay()-f+7)%7;return u.setDate(u.getDate()-m),u},startOfISOWeek:c=>{const d=i(c),u=(d.getDay()-1+7)%7;return d.setDate(d.getDate()-u),d},startOfMonth:c=>{const d=i(c);return d.setDate(1),d},startOfYear:c=>{const d=i(c);return d.setMonth(0,1),d},endOfWeek:(c,d)=>{const u=i(c),p=((((d==null?void 0:d.weekStartsOn)??s)+6)%7-u.getDay()+7)%7;return u.setDate(u.getDate()+p),u},endOfISOWeek:c=>{const d=i(c),u=(7-d.getDay())%7;return d.setDate(d.getDate()+u),d},endOfMonth:c=>{const d=i(c);return d.setMonth(d.getMonth()+1,0),d},endOfYear:c=>{const d=i(c);return d.setMonth(11,31),d},eachMonthOfInterval:c=>{const d=i(c.start),u=i(c.end),f=[],m=new pr(d.getFullYear(),d.getMonth(),1,12,0,0,e),p=u.getFullYear()*12+u.getMonth();for(;m.getFullYear()*12+m.getMonth()<=p;)f.push(new pr(m,e)),m.setMonth(m.getMonth()+1,1);return f},addDays:(c,d)=>{const u=i(c);return u.setDate(u.getDate()+d),u},addWeeks:(c,d)=>{const u=i(c);return u.setDate(u.getDate()+d*7),u},addMonths:(c,d)=>{const u=i(c);return u.setMonth(u.getMonth()+d),u},addYears:(c,d)=>{const u=i(c);return u.setFullYear(u.getFullYear()+d),u},eachYearOfInterval:c=>{const d=i(c.start),u=i(c.end),f=[],m=new pr(d.getFullYear(),0,1,12,0,0,e);for(;m.getFullYear()<=u.getFullYear();)f.push(new pr(m,e)),m.setFullYear(m.getFullYear()+1,0,1);return f},getWeek:(c,d)=>{var f;const u=o(c);return jx(u,{weekStartsOn:(d==null?void 0:d.weekStartsOn)??s,firstWeekContainsDate:(d==null?void 0:d.firstWeekContainsDate)??((f=n==null?void 0:n.options)==null?void 0:f.firstWeekContainsDate)??1})},getISOWeek:c=>{const d=o(c);return wx(d)},differenceInCalendarDays:(c,d)=>{const u=o(c),f=o(d);return ef(u,f)},differenceInCalendarMonths:(c,d)=>{const u=o(c),f=o(d);return yx(u,f)}}}const pc=e=>e instanceof HTMLElement?e:null,Em=e=>[...e.querySelectorAll("[data-animated-month]")??[]],ER=e=>pc(e.querySelector("[data-animated-month]")),Am=e=>pc(e.querySelector("[data-animated-caption]")),Dm=e=>pc(e.querySelector("[data-animated-weeks]")),AR=e=>pc(e.querySelector("[data-animated-nav]")),DR=e=>pc(e.querySelector("[data-animated-weekdays]"));function TR(e,t,{classNames:r,months:n,focused:s,dateLib:i}){const o=h.useRef(null),l=h.useRef(n),c=h.useRef(!1);h.useLayoutEffect(()=>{const d=l.current;if(l.current=n,!t||!e.current||!(e.current instanceof HTMLElement)||n.length===0||d.length===0||n.length!==d.length)return;const u=i.isSameMonth(n[0].date,d[0].date),f=i.isAfter(n[0].date,d[0].date),m=f?r[Qr.caption_after_enter]:r[Qr.caption_before_enter],p=f?r[Qr.weeks_after_enter]:r[Qr.weeks_before_enter],x=o.current,g=e.current.cloneNode(!0);if(g instanceof HTMLElement?(Em(g).forEach(N=>{if(!(N instanceof HTMLElement))return;const w=ER(N);w&&N.contains(w)&&N.removeChild(w);const k=Am(N);k&&k.classList.remove(m);const b=Dm(N);b&&b.classList.remove(p)}),o.current=g):o.current=null,c.current||u||s)return;const v=x instanceof HTMLElement?Em(x):[],y=Em(e.current);if(y!=null&&y.every(j=>j instanceof HTMLElement)&&v&&v.every(j=>j instanceof HTMLElement)){c.current=!0,e.current.style.isolation="isolate";const j=AR(e.current);j&&(j.style.zIndex="1"),y.forEach((N,w)=>{const k=v[w];if(!k)return;N.style.position="relative",N.style.overflow="hidden";const b=Am(N);b&&b.classList.add(m);const C=Dm(N);C&&C.classList.add(p);const _=()=>{c.current=!1,e.current&&(e.current.style.isolation=""),j&&(j.style.zIndex=""),b&&b.classList.remove(m),C&&C.classList.remove(p),N.style.position="",N.style.overflow="",N.contains(k)&&N.removeChild(k)};k.style.pointerEvents="none",k.style.position="absolute",k.style.overflow="hidden",k.setAttribute("aria-hidden","true");const S=DR(k);S&&(S.style.opacity="0");const I=Am(k);I&&(I.classList.add(f?r[Qr.caption_before_exit]:r[Qr.caption_after_exit]),I.addEventListener("animationend",_));const A=Dm(k);A&&A.classList.add(f?r[Qr.weeks_before_exit]:r[Qr.weeks_after_exit]),N.insertBefore(k,N.firstChild)})}})}function IR(e,t,r,n){const s=e[0],i=e[e.length-1],{ISOWeek:o,fixedWeeks:l,broadcastCalendar:c}=r??{},{addDays:d,differenceInCalendarDays:u,differenceInCalendarMonths:f,endOfBroadcastWeek:m,endOfISOWeek:p,endOfMonth:x,endOfWeek:g,isAfter:v,startOfBroadcastWeek:y,startOfISOWeek:j,startOfWeek:N}=n,w=c?y(s,n):o?j(s):N(s),k=c?m(i):o?p(x(i)):g(x(i)),b=t&&(c?m(t):o?p(t):g(t)),C=b&&v(k,b)?b:k,_=u(C,w),S=f(i,s)+1,I=[];for(let L=0;L<=_;L++){const F=d(w,L);I.push(F)}const O=(c?35:42)*S;if(l&&I.length<O){const L=O-I.length;for(let F=0;F<L;F++){const X=d(I[I.length-1],1);I.push(X)}}return I}function RR(e){const t=[];return e.reduce((r,n)=>{const s=n.weeks.reduce((i,o)=>i.concat(o.days.slice()),t.slice());return r.concat(s.slice())},t.slice())}function $R(e,t,r,n){const{numberOfMonths:s=1}=r,i=[];for(let o=0;o<s;o++){const l=n.addMonths(e,o);if(t&&l>t)break;i.push(l)}return i}function wy(e,t,r,n){const{month:s,defaultMonth:i,today:o=n.today(),numberOfMonths:l=1}=e;let c=s||i||o;const{differenceInCalendarMonths:d,addMonths:u,startOfMonth:f}=n;if(r&&d(r,c)<l-1){const m=-1*(l-1);c=u(r,m)}return t&&d(c,t)<0&&(c=t),f(c)}function zR(e,t,r,n){const{addDays:s,endOfBroadcastWeek:i,endOfISOWeek:o,endOfMonth:l,endOfWeek:c,getISOWeek:d,getWeek:u,startOfBroadcastWeek:f,startOfISOWeek:m,startOfWeek:p}=n,x=e.reduce((g,v)=>{const y=r.broadcastCalendar?f(v,n):r.ISOWeek?m(v):p(v),j=r.broadcastCalendar?i(v):r.ISOWeek?o(l(v)):c(l(v)),N=t.filter(C=>C>=y&&C<=j),w=r.broadcastCalendar?35:42;if(r.fixedWeeks&&N.length<w){const C=t.filter(_=>{const S=w-N.length;return _>j&&_<=s(j,S)});N.push(...C)}const k=N.reduce((C,_)=>{const S=r.ISOWeek?d(_):u(_),I=C.find(O=>O.weekNumber===S),A=new XN(_,v,n);return I?I.days.push(A):C.push(new D4(S,[A])),C},[]),b=new A4(v,k);return g.push(b),g},[]);return r.reverseMonths?x.reverse():x}function LR(e,t){let{startMonth:r,endMonth:n}=e;const{startOfYear:s,startOfDay:i,startOfMonth:o,endOfMonth:l,addYears:c,endOfYear:d,newDate:u,today:f}=t,{fromYear:m,toYear:p,fromMonth:x,toMonth:g}=e;!r&&x&&(r=x),!r&&m&&(r=t.newDate(m,0,1)),!n&&g&&(n=g),!n&&p&&(n=u(p,11,31));const v=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return r?r=o(r):m?r=u(m,0,1):!r&&v&&(r=s(c(e.today??f(),-100))),n?n=l(n):p?n=u(p,11,31):!n&&v&&(n=d(e.today??f())),[r&&i(r),n&&i(n)]}function FR(e,t,r,n){if(r.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i=1}=r,{startOfMonth:o,addMonths:l,differenceInCalendarMonths:c}=n,d=s?i:1,u=o(e);if(!t)return l(u,d);if(!(c(t,e)<i))return l(u,d)}function BR(e,t,r,n){if(r.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i}=r,{startOfMonth:o,addMonths:l,differenceInCalendarMonths:c}=n,d=s?i??1:1,u=o(e);if(!t)return l(u,-d);if(!(c(u,t)<=0))return l(u,-d)}function WR(e){const t=[];return e.reduce((r,n)=>r.concat(n.weeks.slice()),t.slice())}function af(e,t){const[r,n]=h.useState(e);return[t===void 0?r:t,n]}function UR(e,t){var w;const[r,n]=LR(e,t),{startOfMonth:s,endOfMonth:i}=t,o=wy(e,r,n,t),[l,c]=af(o,e.month?o:void 0);h.useEffect(()=>{const k=wy(e,r,n,t);c(k)},[e.timeZone]);const{months:d,weeks:u,days:f,previousMonth:m,nextMonth:p}=h.useMemo(()=>{const k=$R(l,n,{numberOfMonths:e.numberOfMonths},t),b=IR(k,e.endMonth?i(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),C=zR(k,b,{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t),_=WR(C),S=RR(C),I=BR(l,r,e,t),A=FR(l,n,e,t);return{months:C,weeks:_,days:S,previousMonth:I,nextMonth:A}},[t,l.getTime(),n==null?void 0:n.getTime(),r==null?void 0:r.getTime(),e.disableNavigation,e.broadcastCalendar,(w=e.endMonth)==null?void 0:w.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:x,onMonthChange:g}=e,v=k=>u.some(b=>b.days.some(C=>C.isEqualTo(k))),y=k=>{if(x)return;let b=s(k);r&&b<s(r)&&(b=s(r)),n&&b>s(n)&&(b=s(n)),c(b),g==null||g(b)};return{months:d,weeks:u,days:f,navStart:r,navEnd:n,previousMonth:m,nextMonth:p,goToMonth:y,goToDay:k=>{v(k)||y(k.date)}}}var Hn;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(Hn||(Hn={}));function jy(e){return!e[jt.disabled]&&!e[jt.hidden]&&!e[jt.outside]}function qR(e,t,r,n){let s,i=-1;for(const o of e){const l=t(o);jy(l)&&(l[jt.focused]&&i<Hn.FocusedModifier?(s=o,i=Hn.FocusedModifier):n!=null&&n.isEqualTo(o)&&i<Hn.LastFocused?(s=o,i=Hn.LastFocused):r(o.date)&&i<Hn.Selected?(s=o,i=Hn.Selected):l[jt.today]&&i<Hn.Today&&(s=o,i=Hn.Today))}return s||(s=e.find(o=>jy(t(o)))),s}function HR(e,t,r,n,s,i,o){const{ISOWeek:l,broadcastCalendar:c}=i,{addDays:d,addMonths:u,addWeeks:f,addYears:m,endOfBroadcastWeek:p,endOfISOWeek:x,endOfWeek:g,max:v,min:y,startOfBroadcastWeek:j,startOfISOWeek:N,startOfWeek:w}=o;let b={day:d,week:f,month:u,year:m,startOfWeek:C=>c?j(C,o):l?N(C):w(C),endOfWeek:C=>c?p(C):l?x(C):g(C)}[e](r,t==="after"?1:-1);return t==="before"&&n?b=v([n,b]):t==="after"&&s&&(b=y([s,b])),b}function uk(e,t,r,n,s,i,o,l=0){if(l>365)return;const c=HR(e,t,r.date,n,s,i,o),d=!!(i.disabled&&ja(c,i.disabled,o)),u=!!(i.hidden&&ja(c,i.hidden,o)),f=c,m=new XN(c,f,o);return!d&&!u?m:uk(e,t,m,n,s,i,o,l+1)}function KR(e,t,r,n,s){const{autoFocus:i}=e,[o,l]=h.useState(),c=qR(t.days,r,n||(()=>!1),o),[d,u]=h.useState(i?c:void 0);return{isFocusTarget:g=>!!(c!=null&&c.isEqualTo(g)),setFocused:u,focused:d,blur:()=>{l(d),u(void 0)},moveFocus:(g,v)=>{if(!d)return;const y=uk(g,v,d,t.navStart,t.navEnd,e,s);y&&(e.disableNavigation&&!t.days.some(N=>N.isEqualTo(y))||(t.goToDay(y),u(y)))}}}function YR(e,t){const{selected:r,required:n,onSelect:s}=e,[i,o]=af(r,s?r:void 0),l=s?r:i,{isSameDay:c}=t,d=p=>(l==null?void 0:l.some(x=>c(x,p)))??!1,{min:u,max:f}=e;return{selected:l,select:(p,x,g)=>{let v=[...l??[]];if(d(p)){if((l==null?void 0:l.length)===u||n&&(l==null?void 0:l.length)===1)return;v=l==null?void 0:l.filter(y=>!c(y,p))}else(l==null?void 0:l.length)===f?v=[p]:v=[...v,p];return s||o(v),s==null||s(v,p,x,g),v},isSelected:d}}function GR(e,t,r=0,n=0,s=!1,i=ua){const{from:o,to:l}=t||{},{isSameDay:c,isAfter:d,isBefore:u}=i;let f;if(!o&&!l)f={from:e,to:r>0?void 0:e};else if(o&&!l)c(o,e)?r===0?f={from:o,to:e}:s?f={from:o,to:void 0}:f=void 0:u(e,o)?f={from:e,to:o}:f={from:o,to:e};else if(o&&l)if(c(o,e)&&c(l,e))s?f={from:o,to:l}:f=void 0;else if(c(o,e))f={from:o,to:r>0?void 0:e};else if(c(l,e))f={from:e,to:r>0?void 0:e};else if(u(e,o))f={from:e,to:l};else if(d(e,o))f={from:o,to:e};else if(d(e,l))f={from:o,to:e};else throw new Error("Invalid range");if(f!=null&&f.from&&(f!=null&&f.to)){const m=i.differenceInCalendarDays(f.to,f.from);n>0&&m>n?f={from:e,to:void 0}:r>1&&m<r&&(f={from:e,to:void 0})}return f}function VR(e,t,r=ua){const n=Array.isArray(t)?t:[t];let s=e.from;const i=r.differenceInCalendarDays(e.to,e.from),o=Math.min(i,6);for(let l=0;l<=o;l++){if(n.includes(s.getDay()))return!0;s=r.addDays(s,1)}return!1}function Ny(e,t,r=ua){return wa(e,t.from,!1,r)||wa(e,t.to,!1,r)||wa(t,e.from,!1,r)||wa(t,e.to,!1,r)}function XR(e,t,r=ua){const n=Array.isArray(t)?t:[t];if(n.filter(l=>typeof l!="function").some(l=>typeof l=="boolean"?l:r.isDate(l)?wa(e,l,!1,r):JN(l,r)?l.some(c=>wa(e,c,!1,r)):nf(l)?l.from&&l.to?Ny(e,{from:l.from,to:l.to},r):!1:ZN(l)?VR(e,l.dayOfWeek,r):_x(l)?r.isAfter(l.before,l.after)?Ny(e,{from:r.addDays(l.after,1),to:r.addDays(l.before,-1)},r):ja(e.from,l,r)||ja(e.to,l,r):Mx(l)||Ox(l)?ja(e.from,l,r)||ja(e.to,l,r):!1))return!0;const o=n.filter(l=>typeof l=="function");if(o.length){let l=e.from;const c=r.differenceInCalendarDays(e.to,e.from);for(let d=0;d<=c;d++){if(o.some(u=>u(l)))return!0;l=r.addDays(l,1)}}return!1}function QR(e,t){const{disabled:r,excludeDisabled:n,selected:s,required:i,onSelect:o}=e,[l,c]=af(s,o?s:void 0),d=o?s:l;return{selected:d,select:(m,p,x)=>{const{min:g,max:v}=e,y=m?GR(m,d,g,v,i,t):void 0;return n&&r&&(y!=null&&y.from)&&y.to&&XR({from:y.from,to:y.to},r,t)&&(y.from=m,y.to=void 0),o||c(y),o==null||o(y,m,p,x),y},isSelected:m=>d&&wa(d,m,!1,t)}}function ZR(e,t){const{selected:r,required:n,onSelect:s}=e,[i,o]=af(r,s?r:void 0),l=s?r:i,{isSameDay:c}=t;return{selected:l,select:(f,m,p)=>{let x=f;return!n&&l&&l&&c(f,l)&&(x=void 0),s||o(x),s==null||s(x,f,m,p),x},isSelected:f=>l?c(l,f):!1}}function JR(e,t){const r=ZR(e,t),n=YR(e,t),s=QR(e,t);switch(e.mode){case"single":return r;case"multiple":return n;case"range":return s;default:return}}function dn(e,t){return e instanceof pr&&e.timeZone===t?e:new pr(e,t)}function Ai(e,t,r){return dn(e,t)}function ky(e,t,r){return typeof e=="boolean"||typeof e=="function"?e:e instanceof Date?Ai(e,t):Array.isArray(e)?e.map(n=>n instanceof Date?Ai(n,t):n):nf(e)?{...e,from:e.from?dn(e.from,t):e.from,to:e.to?dn(e.to,t):e.to}:_x(e)?{before:Ai(e.before,t),after:Ai(e.after,t)}:Mx(e)?{after:Ai(e.after,t)}:Ox(e)?{before:Ai(e.before,t)}:e}function Tm(e,t,r){return e&&(Array.isArray(e)?e.map(n=>ky(n,t)):ky(e,t))}function e$(e){var Oe;let t=e;const r=t.timeZone;if(r&&(t={...e,timeZone:r},t.today&&(t.today=dn(t.today,r)),t.month&&(t.month=dn(t.month,r)),t.defaultMonth&&(t.defaultMonth=dn(t.defaultMonth,r)),t.startMonth&&(t.startMonth=dn(t.startMonth,r)),t.endMonth&&(t.endMonth=dn(t.endMonth,r)),t.mode==="single"&&t.selected?t.selected=dn(t.selected,r):t.mode==="multiple"&&t.selected?t.selected=(Oe=t.selected)==null?void 0:Oe.map(xe=>dn(xe,r)):t.mode==="range"&&t.selected&&(t.selected={from:t.selected.from?dn(t.selected.from,r):t.selected.from,to:t.selected.to?dn(t.selected.to,r):t.selected.to}),t.disabled!==void 0&&(t.disabled=Tm(t.disabled,r)),t.hidden!==void 0&&(t.hidden=Tm(t.hidden,r)),t.modifiers)){const xe={};Object.keys(t.modifiers).forEach(Ne=>{var he;xe[Ne]=Tm((he=t.modifiers)==null?void 0:he[Ne],r)}),t.modifiers=xe}const{components:n,formatters:s,labels:i,dateLib:o,locale:l,classNames:c}=h.useMemo(()=>{const xe={...VN,...t.locale},Ne=t.broadcastCalendar?1:t.weekStartsOn,he=t.noonSafe&&t.timeZone?PR(t.timeZone,{weekStartsOn:Ne,locale:xe}):void 0,ye=t.dateLib&&he?{...he,...t.dateLib}:t.dateLib??he,Xe=new nn({locale:xe,weekStartsOn:Ne,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},ye);return{dateLib:Xe,components:cR(t.components),formatters:bR(t.formatters),labels:SR(t.labels,Xe.options),locale:xe,classNames:{...uR(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.noonSafe,t.components,t.formatters,t.labels,t.classNames]);t.today||(t={...t,today:o.today()});const{captionLayout:d,mode:u,navLayout:f,numberOfMonths:m=1,onDayBlur:p,onDayClick:x,onDayFocus:g,onDayKeyDown:v,onDayMouseEnter:y,onDayMouseLeave:j,onNextClick:N,onPrevClick:w,showWeekNumber:k,styles:b}=t,{formatCaption:C,formatDay:_,formatMonthDropdown:S,formatWeekNumber:I,formatWeekNumberHeader:A,formatWeekdayName:O,formatYearDropdown:L}=s,F=UR(t,o),{days:X,months:T,navStart:G,navEnd:re,previousMonth:J,nextMonth:P,goToMonth:M}=F,R=oR(X,t,G,re,o),{isSelected:q,select:$,selected:K}=JR(t,o)??{},{blur:D,focused:E,isFocusTarget:Z,moveFocus:B,setFocused:Y}=KR(t,F,R,q??(()=>!1),o),{labelDayButton:ae,labelGridcell:ee,labelGrid:se,labelMonthDropdown:V,labelNav:ie,labelPrevious:pe,labelNext:ue,labelWeekday:ve,labelWeekNumber:Q,labelWeekNumberHeader:ge,labelYearDropdown:De}=i,Ue=h.useMemo(()=>MR(o,t.ISOWeek,t.broadcastCalendar,t.today),[o,t.ISOWeek,t.broadcastCalendar,t.today]),Fe=u!==void 0||x!==void 0,Ve=h.useCallback(()=>{J&&(M(J),w==null||w(J))},[J,M,w]),ut=h.useCallback(()=>{P&&(M(P),N==null||N(P))},[M,P,N]),Ke=h.useCallback((xe,Ne)=>he=>{he.preventDefault(),he.stopPropagation(),Y(xe),!Ne.disabled&&($==null||$(xe.date,Ne,he),x==null||x(xe.date,Ne,he))},[$,x,Y]),Ze=h.useCallback((xe,Ne)=>he=>{Y(xe),g==null||g(xe.date,Ne,he)},[g,Y]),tr=h.useCallback((xe,Ne)=>he=>{D(),p==null||p(xe.date,Ne,he)},[D,p]),Ir=h.useCallback((xe,Ne)=>he=>{const ye={ArrowLeft:[he.shiftKey?"month":"day",t.dir==="rtl"?"after":"before"],ArrowRight:[he.shiftKey?"month":"day",t.dir==="rtl"?"before":"after"],ArrowDown:[he.shiftKey?"year":"week","after"],ArrowUp:[he.shiftKey?"year":"week","before"],PageUp:[he.shiftKey?"year":"month","before"],PageDown:[he.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(ye[he.key]){he.preventDefault(),he.stopPropagation();const[Xe,de]=ye[he.key];B(Xe,de)}v==null||v(xe.date,Ne,he)},[B,v,t.dir]),rr=h.useCallback((xe,Ne)=>he=>{y==null||y(xe.date,Ne,he)},[y]),yr=h.useCallback((xe,Ne)=>he=>{j==null||j(xe.date,Ne,he)},[j]),nr=h.useCallback(xe=>Ne=>{const he=Number(Ne.target.value),ye=o.setMonth(o.startOfMonth(xe),he);M(ye)},[o,M]),yt=h.useCallback(xe=>Ne=>{const he=Number(Ne.target.value),ye=o.setYear(o.startOfMonth(xe),he);M(ye)},[o,M]),{className:Lt,style:Kt}=h.useMemo(()=>({className:[c[Me.Root],t.className].filter(Boolean).join(" "),style:{...b==null?void 0:b[Me.Root],...t.style}}),[c,t.className,t.style,b]),ar=dR(t),$n=h.useRef(null);TR($n,!!t.animate,{classNames:c,months:T,focused:E,dateLib:o});const fa={dayPickerProps:t,selected:K,select:$,isSelected:q,months:T,nextMonth:P,previousMonth:J,goToMonth:M,getModifiers:R,components:n,classNames:c,styles:b,labels:i,formatters:s};return W.createElement(QN.Provider,{value:fa},W.createElement(n.Root,{rootRef:t.animate?$n:void 0,className:Lt,style:Kt,dir:t.dir,id:t.id,lang:t.lang,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t["aria-label"],"aria-labelledby":t["aria-labelledby"],...ar},W.createElement(n.Months,{className:c[Me.Months],style:b==null?void 0:b[Me.Months]},!t.hideNavigation&&!f&&W.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:c[Me.Nav],style:b==null?void 0:b[Me.Nav],"aria-label":ie(),onPreviousClick:Ve,onNextClick:ut,previousMonth:J,nextMonth:P}),T.map((xe,Ne)=>W.createElement(n.Month,{"data-animated-month":t.animate?"true":void 0,className:c[Me.Month],style:b==null?void 0:b[Me.Month],key:Ne,displayIndex:Ne,calendarMonth:xe},f==="around"&&!t.hideNavigation&&Ne===0&&W.createElement(n.PreviousMonthButton,{type:"button",className:c[Me.PreviousMonthButton],tabIndex:J?void 0:-1,"aria-disabled":J?void 0:!0,"aria-label":pe(J),onClick:Ve,"data-animated-button":t.animate?"true":void 0},W.createElement(n.Chevron,{disabled:J?void 0:!0,className:c[Me.Chevron],orientation:t.dir==="rtl"?"right":"left"})),W.createElement(n.MonthCaption,{"data-animated-caption":t.animate?"true":void 0,className:c[Me.MonthCaption],style:b==null?void 0:b[Me.MonthCaption],calendarMonth:xe,displayIndex:Ne},d!=null&&d.startsWith("dropdown")?W.createElement(n.DropdownNav,{className:c[Me.Dropdowns],style:b==null?void 0:b[Me.Dropdowns]},(()=>{const he=d==="dropdown"||d==="dropdown-months"?W.createElement(n.MonthsDropdown,{key:"month",className:c[Me.MonthsDropdown],"aria-label":V(),classNames:c,components:n,disabled:!!t.disableNavigation,onChange:nr(xe.date),options:CR(xe.date,G,re,s,o),style:b==null?void 0:b[Me.Dropdown],value:o.getMonth(xe.date)}):W.createElement("span",{key:"month"},S(xe.date,o)),ye=d==="dropdown"||d==="dropdown-years"?W.createElement(n.YearsDropdown,{key:"year",className:c[Me.YearsDropdown],"aria-label":De(o.options),classNames:c,components:n,disabled:!!t.disableNavigation,onChange:yt(xe.date),options:OR(G,re,s,o,!!t.reverseYears),style:b==null?void 0:b[Me.Dropdown],value:o.getYear(xe.date)}):W.createElement("span",{key:"year"},L(xe.date,o));return o.getMonthYearOrder()==="year-first"?[ye,he]:[he,ye]})(),W.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},C(xe.date,o.options,o))):W.createElement(n.CaptionLabel,{className:c[Me.CaptionLabel],role:"status","aria-live":"polite"},C(xe.date,o.options,o))),f==="around"&&!t.hideNavigation&&Ne===m-1&&W.createElement(n.NextMonthButton,{type:"button",className:c[Me.NextMonthButton],tabIndex:P?void 0:-1,"aria-disabled":P?void 0:!0,"aria-label":ue(P),onClick:ut,"data-animated-button":t.animate?"true":void 0},W.createElement(n.Chevron,{disabled:P?void 0:!0,className:c[Me.Chevron],orientation:t.dir==="rtl"?"left":"right"})),Ne===m-1&&f==="after"&&!t.hideNavigation&&W.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:c[Me.Nav],style:b==null?void 0:b[Me.Nav],"aria-label":ie(),onPreviousClick:Ve,onNextClick:ut,previousMonth:J,nextMonth:P}),W.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":u==="multiple"||u==="range","aria-label":se(xe.date,o.options,o)||void 0,className:c[Me.MonthGrid],style:b==null?void 0:b[Me.MonthGrid]},!t.hideWeekdays&&W.createElement(n.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:c[Me.Weekdays],style:b==null?void 0:b[Me.Weekdays]},k&&W.createElement(n.WeekNumberHeader,{"aria-label":ge(o.options),className:c[Me.WeekNumberHeader],style:b==null?void 0:b[Me.WeekNumberHeader],scope:"col"},A()),Ue.map(he=>W.createElement(n.Weekday,{"aria-label":ve(he,o.options,o),className:c[Me.Weekday],key:String(he),style:b==null?void 0:b[Me.Weekday],scope:"col"},O(he,o.options,o)))),W.createElement(n.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:c[Me.Weeks],style:b==null?void 0:b[Me.Weeks]},xe.weeks.map(he=>W.createElement(n.Week,{className:c[Me.Week],key:he.weekNumber,style:b==null?void 0:b[Me.Week],week:he},k&&W.createElement(n.WeekNumber,{week:he,style:b==null?void 0:b[Me.WeekNumber],"aria-label":Q(he.weekNumber,{locale:l}),className:c[Me.WeekNumber],scope:"row",role:"rowheader"},I(he.weekNumber,o)),he.days.map(ye=>{const{date:Xe}=ye,de=R(ye);if(de[jt.focused]=!de.hidden&&!!(E!=null&&E.isEqualTo(ye)),de[Cn.selected]=(q==null?void 0:q(Xe))||de.selected,nf(K)){const{from:rt,to:nt}=K;de[Cn.range_start]=!!(rt&&nt&&o.isSameDay(Xe,rt)),de[Cn.range_end]=!!(rt&&nt&&o.isSameDay(Xe,nt)),de[Cn.range_middle]=wa(K,Xe,!0,o)}const _e=_R(de,b,t.modifiersStyles),Te=lR(de,c,t.modifiersClassNames),bt=!Fe&&!de.hidden?ee(Xe,de,o.options,o):void 0;return W.createElement(n.Day,{key:`${ye.isoDate}_${ye.displayMonthId}`,day:ye,modifiers:de,className:Te.join(" "),style:_e,role:"gridcell","aria-selected":de.selected||void 0,"aria-label":bt,"data-day":ye.isoDate,"data-month":ye.outside?ye.dateMonthId:void 0,"data-selected":de.selected||void 0,"data-disabled":de.disabled||void 0,"data-hidden":de.hidden||void 0,"data-outside":ye.outside||void 0,"data-focused":de.focused||void 0,"data-today":de.today||void 0},!de.hidden&&Fe?W.createElement(n.DayButton,{className:c[Me.DayButton],style:b==null?void 0:b[Me.DayButton],type:"button",day:ye,modifiers:de,disabled:!de.focused&&de.disabled||void 0,"aria-disabled":de.focused&&de.disabled||void 0,tabIndex:Z(ye)?0:-1,"aria-label":ae(Xe,de,o.options,o),onClick:Ke(ye,de),onBlur:tr(ye,de),onFocus:Ze(ye,de),onKeyDown:Ir(ye,de),onMouseEnter:rr(ye,de),onMouseLeave:yr(ye,de)},_(Xe,o.options,o)):!de.hidden&&_(ye.date,o.options,o))})))))))),t.footer&&W.createElement(n.Footer,{className:c[Me.Footer],style:b==null?void 0:b[Me.Footer],role:"status","aria-live":"polite"},t.footer)))}function gr({className:e,classNames:t,showOutsideDays:r=!0,...n}){return a.jsx(e$,{showOutsideDays:r,className:z("p-3",e),classNames:{months:"flex flex-col sm:flex-row gap-2",month:"flex flex-col gap-4",month_caption:"flex justify-center pt-1 relative items-center w-full",caption_label:"text-sm font-medium pointer-events-none",nav:"flex items-center gap-1",button_previous:z(qi({variant:"outline"}),"absolute left-1 top-0 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100 z-10"),button_next:z(qi({variant:"outline"}),"absolute right-1 top-0 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100 z-10"),month_grid:"w-full border-collapse",weekdays:"flex",weekday:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem] text-center",week:"flex w-full mt-2",day:"relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 rounded-md",day_button:z(qi({variant:"ghost"}),"size-8 p-0 font-normal aria-selected:opacity-100"),selected:"[&>button]:bg-primary [&>button]:text-primary-foreground [&>button]:hover:bg-primary [&>button]:hover:text-primary-foreground [&>button]:focus:bg-primary [&>button]:focus:text-primary-foreground",today:"[&>button]:bg-accent [&>button]:text-accent-foreground",outside:"day-outside text-muted-foreground [&>button]:text-muted-foreground aria-selected:text-muted-foreground",disabled:"text-muted-foreground opacity-50",hidden:"invisible",...t},components:{Chevron:({orientation:s})=>s==="left"?a.jsx(_a,{className:"h-4 w-4"}):a.jsx(vr,{className:"h-4 w-4"})},...n})}gr.displayName="Calendar";function t$(e,t=[]){let r=[];function n(i,o){const l=h.createContext(o),c=r.length;r=[...r,o];const d=f=>{var y;const{scope:m,children:p,...x}=f,g=((y=m==null?void 0:m[e])==null?void 0:y[c])||l,v=h.useMemo(()=>x,Object.values(x));return a.jsx(g.Provider,{value:v,children:p})};d.displayName=i+"Provider";function u(f,m){var g;const p=((g=m==null?void 0:m[e])==null?void 0:g[c])||l,x=h.useContext(p);if(x)return x;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[d,u]}const s=()=>{const i=r.map(o=>h.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return h.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[n,r$(s,...t)]}function r$(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=n.reduce((l,{useScope:c,scopeName:d})=>{const f=c(i)[`__scope${d}`];return{...l,...f}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}function n$(e){const t=a$(e),r=h.forwardRef((n,s)=>{const{children:i,...o}=n,l=h.Children.toArray(i),c=l.find(i$);if(c){const d=c.props.children,u=l.map(f=>f===c?h.Children.count(d)>1?h.Children.only(null):h.isValidElement(d)?d.props.children:null:f);return a.jsx(t,{...o,ref:s,children:h.isValidElement(d)?h.cloneElement(d,void 0,u):null})}return a.jsx(t,{...o,ref:s,children:i})});return r.displayName=`${e}.Slot`,r}function a$(e){const t=h.forwardRef((r,n)=>{const{children:s,...i}=r;if(h.isValidElement(s)){const o=l$(s),l=o$(i,s.props);return s.type!==h.Fragment&&(l.ref=n?r1(n,o):o),h.cloneElement(s,l)}return h.Children.count(s)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var s$=Symbol("radix.slottable");function i$(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===s$}function o$(e,t){const r={...t};for(const n in t){const s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...i}:n==="className"&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}function l$(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var c$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],fk=c$.reduce((e,t)=>{const r=n$(`Primitive.${t}`),n=h.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),sf="Switch",[d$]=t$(sf),[u$,f$]=d$(sf),mk=h.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:s,defaultChecked:i,required:o,disabled:l,value:c="on",onCheckedChange:d,form:u,...f}=e,[m,p]=h.useState(null),x=Tu(t,N=>p(N)),g=h.useRef(!1),v=m?u||!!m.closest("form"):!0,[y,j]=UP({prop:s,defaultProp:i??!1,onChange:d,caller:sf});return a.jsxs(u$,{scope:r,checked:y,disabled:l,children:[a.jsx(fk.button,{type:"button",role:"switch","aria-checked":y,"aria-required":o,"data-state":gk(y),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:x,onClick:Fs(e.onClick,N=>{j(w=>!w),v&&(g.current=N.isPropagationStopped(),g.current||N.stopPropagation())})}),v&&a.jsx(xk,{control:m,bubbles:!g.current,name:n,value:c,checked:y,required:o,disabled:l,form:u,style:{transform:"translateX(-100%)"}})]})});mk.displayName=sf;var hk="SwitchThumb",pk=h.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,s=f$(hk,r);return a.jsx(fk.span,{"data-state":gk(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:t})});pk.displayName=hk;var m$="SwitchBubbleInput",xk=h.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...s},i)=>{const o=h.useRef(null),l=Tu(o,i),c=qP(r),d=HP(t);return h.useEffect(()=>{const u=o.current;if(!u)return;const f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(c!==r&&p){const x=new Event("click",{bubbles:n});p.call(u,r),u.dispatchEvent(x)}},[c,r,n]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:l,style:{...s.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});xk.displayName=m$;function gk(e){return e?"checked":"unchecked"}var vk=mk,h$=pk;const Co=h.forwardRef(({className:e,...t},r)=>a.jsx(vk,{className:z("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:r,children:a.jsx(h$,{className:z("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Co.displayName=vk.displayName;function p$(e){if(!e.start_date&&!e.end_date)return null;const t=e.start_date?fe(new Date(e.start_date),"MMM d"):"—",r=e.end_date?fe(new Date(e.end_date),"MMM d"):"—";return`${t} – ${r}`}function of({open:e,onClose:t,projectId:r,defaultStatus:n="backlog",defaultTaskListId:s,defaultParentId:i}){const o=pt(),{workspace:l,projectKey:c}=zt(),{workspace:d}=Ie(),[u,f]=h.useState(""),[m,p]=h.useState(""),[x,g]=h.useState(n),[v,y]=h.useState("medium"),[j,N]=h.useState("task"),[w,k]=h.useState([]),[b,C]=h.useState(""),[_,S]=h.useState(s??""),[I,A]=h.useState(void 0),[O,L]=h.useState(void 0),[F,X]=h.useState(!1),[T,G]=h.useState("weekly"),[re,J]=h.useState(void 0),P=E1(),{data:M}=la(r),R=h.useMemo(()=>M?M.members.filter(Y=>Y.user).map(Y=>Y.user):void 0,[M]),{data:q}=ko(r),{data:$}=So(r||void 0),{data:K}=fc(r||void 0),D=($??[]).filter(Y=>Y.status!=="completed"),E=q&&q.length>0?Object.fromEntries(q.map(Y=>[Y.key,Y.name])):ci,Z=()=>{f(""),p(""),g(n),y("medium"),N("task"),k([]),C(""),S(s??""),A(void 0),L(void 0),X(!1),G("weekly"),J(void 0),t()},B=Y=>{Y.preventDefault(),u.trim()&&P.mutate({title:u.trim(),description:m.trim()||void 0,status:x,priority:v,type:j,project_id:r,workspace_id:d.id,assignee_ids:w.length>0?w:void 0,sprint_id:b||null,task_list_id:_||null,parent_id:i||null,start_date:I?fe(I,"yyyy-MM-dd"):null,due_date:O?fe(O,"yyyy-MM-dd"):null,recurrence_frequency:F?T:void 0,recurrence_end_date:F&&re?fe(re,"yyyy-MM-dd"):void 0},{onSuccess:()=>{H.success("Issue created"),Z()},onError:ae=>H.error(ae.message??"Failed to create issue")})};return a.jsx(Ni,{open:e,onOpenChange:Y=>!Y&&Z(),children:a.jsxs(ki,{className:"max-w-md",children:[a.jsx(bo,{children:a.jsx(jo,{children:"New issue"})}),a.jsxs("form",{onSubmit:B,className:"flex flex-col flex-1 overflow-hidden",children:[a.jsxs(wo,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{htmlFor:"issue-title",children:"Title"}),a.jsx(Ee,{id:"issue-title",placeholder:"Issue title",value:u,onChange:Y=>f(Y.target.value),autoFocus:!0})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{htmlFor:"issue-desc",children:["Description ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsx(Ju,{id:"issue-desc",placeholder:"Add more context...",value:m,onChange:Y=>p(Y.target.value)})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{children:"Status"}),a.jsxs(Le,{value:x,onValueChange:g,children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{})}),a.jsx(ze,{children:Object.entries(E).map(([Y,ae])=>a.jsx(we,{value:Y,className:"text-xs",children:ae},Y))})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{children:"Priority"}),a.jsxs(Le,{value:v,onValueChange:y,children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{})}),a.jsx(ze,{children:Object.entries(rn).map(([Y,ae])=>a.jsx(we,{value:Y,className:"text-xs",children:ae},Y))})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{children:"Type"}),a.jsxs(Le,{value:j,onValueChange:N,children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{})}),a.jsx(ze,{children:Object.entries(Pa).map(([Y,ae])=>a.jsx(we,{value:Y,className:"text-xs",children:ae},Y))})]})]})]}),i&&a.jsx("div",{className:"rounded-md bg-muted/50 border border-border px-3 py-2 text-xs text-muted-foreground",children:"Will be created as a child issue"}),(K??[]).length>0&&!i&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{children:["List ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsxs(Le,{value:_||"none",onValueChange:Y=>S(Y==="none"?"":Y),children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{placeholder:"No list"})}),a.jsxs(ze,{children:[a.jsx(we,{value:"none",className:"text-xs",children:a.jsx("span",{className:"text-muted-foreground",children:"No list"})}),(K??[]).map(Y=>a.jsx(we,{value:Y.id,className:"text-xs",children:Y.name},Y.id))]})]})]}),D.length>0&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{children:["Sprint ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsxs(Le,{value:b||"none",onValueChange:Y=>C(Y==="none"?"":Y),children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{placeholder:"No sprint"})}),a.jsxs(ze,{children:[a.jsx(we,{value:"none",className:"text-xs",children:a.jsx("span",{className:"text-muted-foreground",children:"No sprint"})}),D.map(Y=>{const ae=p$(Y);return a.jsx(we,{value:Y.id,className:"text-xs",children:a.jsxs("div",{children:[a.jsx("span",{children:Y.name}),ae&&a.jsx("span",{className:"block text-[10px] text-muted-foreground leading-tight",children:ae})]})},Y.id)})]})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{children:["Assignees ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsx(mc,{value:w,onChange:k,users:R})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{children:["Start Date ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsxs(Ot,{children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex items-center gap-2 h-9 w-full rounded-md border border-input px-3 text-sm bg-transparent hover:bg-accent transition-colors text-left",children:[a.jsx(Wt,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:I?"text-foreground":"text-muted-foreground",children:I?fe(I,"MMM d, yyyy"):"No start date"}),I&&a.jsx("button",{type:"button",onClick:Y=>{Y.stopPropagation(),A(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:a.jsx(tt,{className:"h-3.5 w-3.5"})})]})}),a.jsx(_t,{className:"w-auto p-0",align:"start",children:a.jsx(gr,{mode:"single",selected:I,onSelect:A,initialFocus:!0})})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{children:["Due Date ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsxs(Ot,{children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex items-center gap-2 h-9 w-full rounded-md border border-input px-3 text-sm bg-transparent hover:bg-accent transition-colors text-left",children:[a.jsx(Wt,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:O?"text-foreground":"text-muted-foreground",children:O?fe(O,"MMM d, yyyy"):"No due date"}),O&&a.jsx("button",{type:"button",onClick:Y=>{Y.stopPropagation(),L(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:a.jsx(tt,{className:"h-3.5 w-3.5"})})]})}),a.jsx(_t,{className:"w-auto p-0",align:"start",children:a.jsx(gr,{mode:"single",selected:O,onSelect:L,initialFocus:!0})})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Co,{id:"recurring",checked:F,onCheckedChange:X}),a.jsxs(mt,{htmlFor:"recurring",className:"cursor-pointer font-normal flex items-center gap-1.5",children:[a.jsx(Vi,{className:"h-3.5 w-3.5 text-muted-foreground"}),"Recurring"]})]}),F&&a.jsx("div",{className:"space-y-3 pl-4 border-l-2 border-indigo-200 dark:border-indigo-800",children:a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{children:"Frequency"}),a.jsxs(Le,{value:T,onValueChange:Y=>G(Y),children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{})}),a.jsxs(ze,{children:[a.jsx(we,{value:"weekly",className:"text-xs",children:"Weekly"}),a.jsx(we,{value:"monthly",className:"text-xs",children:"Monthly"})]})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{children:["Until ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsxs(Ot,{children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex items-center gap-2 h-8 w-full rounded-md border border-input px-3 text-xs bg-transparent hover:bg-accent transition-colors text-left",children:[a.jsx(Wt,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:re?"text-foreground":"text-muted-foreground",children:re?fe(re,"MMM d, yyyy"):"No end date"}),re&&a.jsx("button",{type:"button",onClick:Y=>{Y.stopPropagation(),J(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:a.jsx(tt,{className:"h-3.5 w-3.5"})})]})}),a.jsx(_t,{className:"w-auto p-0",align:"start",children:a.jsx(gr,{mode:"single",selected:re,onSelect:J,initialFocus:!0})})]})]})]})})]})]}),a.jsxs(cc,{className:"flex-col-reverse sm:flex-row sm:items-center sm:justify-between gap-2",children:[a.jsxs(ne,{type:"button",variant:"ghost",size:"sm",className:"text-muted-foreground gap-1.5 justify-start sm:justify-center",onClick:()=>{Z(),o(`/${l}/projects/${c}/issues/new`)},children:[a.jsx(rx,{className:"h-3.5 w-3.5"}),"Open full form"]}),a.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[a.jsx(ne,{type:"button",variant:"ghost",onClick:Z,children:"Cancel"}),a.jsx(ne,{type:"submit",disabled:!u.trim()||P.isPending,children:P.isPending?"Creating...":"Create issue"})]})]})]})]})})}const Ax={byIssue:e=>["attachments",e]};function yk(e){return Be({queryKey:Ax.byIssue(e),queryFn:()=>oe.get(`/admin/issues/${e}/attachments`),select:t=>t.attachments,enabled:!!e})}function bk(e){const t=Se();return be({mutationFn:({file:r,commentId:n})=>{const s=new FormData;return s.append("file",r),n&&s.append("comment_id",n),oe.upload(`/admin/issues/${e}/attachments`,s)},onSuccess:()=>{t.invalidateQueries({queryKey:Ax.byIssue(e)})}})}function x$(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/issues/${e}/attachments/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:Ax.byIssue(e)})}})}function kl(e){return e.startsWith("image/")}function lf(e){return e.startsWith("video/")}function cf(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Md(e){if(e.startsWith("/"))return!0;try{const{protocol:t}=new URL(e);return t==="http:"||t==="https:"}catch{return!1}}function Dx(e,t){if(!Md(e)){console.error("downloadFile: blocked unsafe URL",e);return}const r=document.createElement("a");r.href=e,r.download=t,r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r)}function Tx({mimeType:e,className:t}){return kl(e)?a.jsx(u5,{className:t}):lf(e)?a.jsx(bl,{className:t}):e.startsWith("text/")||e.includes("json")?a.jsx(d5,{className:t}):e.includes("zip")||e.includes("tar")||e.includes("gz")?a.jsx(c5,{className:t}):e.includes("pdf")||e.includes("word")||e.includes("document")?a.jsx(f5,{className:t}):a.jsx(m5,{className:t})}function wk({attachment:e,onClose:t}){return e?a.jsx(Ni,{open:!0,onOpenChange:r=>!r&&t(),children:a.jsxs(ki,{className:"max-w-2xl w-full p-0 overflow-hidden",children:[a.jsxs(bo,{className:"flex-row items-center justify-between px-4 py-3 border-b border-border shrink-0 pr-10",children:[a.jsx(jo,{className:"text-sm font-medium truncate",children:e.original_name}),a.jsxs(ne,{variant:"ghost",size:"sm",className:"h-7 text-xs gap-1.5 shrink-0",onClick:()=>Dx(e.url,e.original_name),children:[a.jsx(tx,{className:"h-3.5 w-3.5"}),"Download"]})]}),a.jsxs(wo,{className:"flex items-center justify-center bg-black/5 dark:bg-black/30 min-h-[320px] max-h-[75vh] overflow-auto p-0",children:[kl(e.mime_type)&&Md(e.url)&&a.jsx("img",{src:e.url,alt:e.original_name,className:"max-w-full max-h-[75vh] object-contain"}),lf(e.mime_type)&&Md(e.url)&&a.jsx("video",{src:e.url,controls:!0,className:"max-w-full max-h-[75vh]"})]}),a.jsxs("div",{className:"px-4 py-2 border-t border-border text-[11px] text-muted-foreground flex items-center gap-3 shrink-0",children:[a.jsx("span",{children:cf(e.size)}),a.jsx("span",{children:"·"}),a.jsx("span",{children:e.mime_type}),a.jsx("span",{children:"·"}),a.jsxs("span",{children:["Uploaded ",fe(new Date(e.created_at),"MMM d, yyyy")]})]})]})}):null}function g$({attachment:e}){const[t,r]=h.useState(null),n=kl(e.mime_type)||lf(e.mime_type),s=()=>{n?r(e):Dx(e.url,e.original_name)};return a.jsxs(a.Fragment,{children:[kl(e.mime_type)?a.jsx("button",{type:"button",onClick:s,className:"block rounded-md overflow-hidden border border-border hover:opacity-90 transition-opacity",title:e.original_name,children:a.jsx("img",{src:Md(e.url)?e.url:"",alt:e.original_name,className:"max-h-48 max-w-xs object-cover"})}):a.jsxs("button",{type:"button",onClick:s,className:"flex items-center gap-2 px-2.5 py-1.5 rounded-lg border border-border bg-muted/40 hover:bg-muted transition-colors text-left max-w-xs",title:n?"View":"Download",children:[a.jsx(Tx,{mimeType:e.mime_type,className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"text-xs text-foreground truncate",children:e.original_name}),a.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:cf(e.size)}),!n&&a.jsx(tx,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]}),t&&a.jsx(wk,{attachment:t,onClose:()=>r(null)})]})}function v$({attachment:e,onOpen:t,onDelete:r,isDeleting:n}){const s=kl(e.mime_type)||lf(e.mime_type),i=()=>{s?t(e):Dx(e.url,e.original_name)};return a.jsxs("div",{className:"flex items-center gap-3 py-2.5 px-3 rounded-lg hover:bg-muted/50 group transition-colors",children:[a.jsx("button",{type:"button",onClick:i,className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground hover:bg-primary/10 hover:text-primary transition-colors",title:s?"View":"Download",children:a.jsx(Tx,{mimeType:e.mime_type,className:"h-4 w-4"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("button",{type:"button",onClick:i,className:"text-xs font-medium text-foreground truncate block text-left w-full hover:underline",children:e.original_name}),a.jsxs("p",{className:"text-[11px] text-muted-foreground mt-0.5 flex items-center gap-1.5",children:[a.jsx("span",{children:cf(e.size)}),a.jsx("span",{children:"·"}),a.jsx("span",{children:fe(new Date(e.created_at),"MMM d, yyyy")}),e.comment_id&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"·"}),a.jsx("span",{className:"italic",children:"from comment"})]}),!s&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"·"}),a.jsxs("span",{className:"flex items-center gap-0.5",children:[a.jsx(tx,{className:"h-2.5 w-2.5"}),"Click to download"]})]})]})]}),a.jsx(ne,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100 text-muted-foreground hover:text-destructive transition-all",onClick:()=>r(e.id),disabled:n,children:a.jsx(Mr,{className:"h-3.5 w-3.5"})})]})}function y$({onFiles:e,isUploading:t}){const[r,n]=h.useState(!1),s=h.useRef(null),i=h.useCallback(o=>{o.preventDefault(),n(!1);const l=Array.from(o.dataTransfer.files);l.length>0&&e(l)},[e]);return a.jsxs("div",{onDragOver:o=>{o.preventDefault(),n(!0)},onDragLeave:()=>n(!1),onDrop:i,onClick:()=>{var o;return!t&&((o=s.current)==null?void 0:o.click())},className:z("flex flex-col items-center justify-center gap-1.5 rounded-xl border-2 border-dashed px-4 py-6","cursor-pointer transition-colors",r?"border-primary/60 bg-primary/5":"border-border hover:border-muted-foreground/40 hover:bg-muted/30",t&&"opacity-60 cursor-wait"),children:[a.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-muted",children:a.jsx($5,{className:"h-4 w-4 text-muted-foreground"})}),a.jsx("p",{className:"text-xs font-medium text-foreground",children:t?"Uploading…":"Drop files or click to browse"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Up to 50 MB per file"}),a.jsx("input",{ref:s,type:"file",multiple:!0,className:"hidden",onChange:o=>{const l=Array.from(o.target.files??[]);l.length>0&&e(l),o.target.value=""}})]})}function b$({issueId:e,className:t}){const[r,n]=h.useState(null),{data:s,isLoading:i}=yk(e),o=bk(e),l=x$(e),c=u=>{u.forEach(f=>{o.mutate({file:f},{onSuccess:()=>H.success(`${f.name} uploaded`),onError:()=>H.error(`Failed to upload ${f.name}`)})})},d=u=>{l.mutate(u,{onSuccess:()=>H.success("Attachment removed"),onError:()=>H.error("Failed to remove attachment")})};return a.jsxs("div",{className:z("px-6 py-4 space-y-4",t),children:[a.jsx(y$,{onFiles:c,isUploading:o.isPending}),i?a.jsx("div",{className:"space-y-2",children:[1,2].map(u=>a.jsxs("div",{className:"flex items-center gap-3 px-3",children:[a.jsx(le,{className:"h-8 w-8 rounded-md shrink-0"}),a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsx(le,{className:"h-3 w-2/3"}),a.jsx(le,{className:"h-2.5 w-1/3"})]})]},u))}):s&&s.length>0?a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[a.jsx(sx,{className:"h-3 w-3 text-muted-foreground"}),a.jsxs("span",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:[s.length," ",s.length===1?"file":"files"]})]}),a.jsx("div",{children:s.map(u=>a.jsx(v$,{attachment:u,onOpen:n,onDelete:d,isDeleting:l.isPending},u.id))})]}):a.jsx("p",{className:"text-sm text-muted-foreground/50 text-center py-1",children:"No attachments yet."}),a.jsx(wk,{attachment:r,onClose:()=>n(null)})]})}const js={byIssue:e=>["time-logs",e],activeTimer:e=>["time-logs",e,"active-timer"]};function w$(e){return Be({queryKey:js.byIssue(e),queryFn:()=>oe.get(`/admin/issues/${e}/time-logs`),enabled:!!e})}function j$(e){return Be({queryKey:js.activeTimer(e),queryFn:()=>oe.get(`/admin/issues/${e}/time-logs/timer`),select:t=>t.active_timer,enabled:!!e,refetchInterval:1e4})}function N$(e){const t=Se();return be({mutationFn:r=>oe.post(`/admin/issues/${e}/time-logs`,r),onSuccess:()=>{t.invalidateQueries({queryKey:js.byIssue(e)})}})}function k$(e){const t=Se();return be({mutationFn:()=>oe.post(`/admin/issues/${e}/time-logs/timer`,{action:"start"}),onSuccess:()=>{t.invalidateQueries({queryKey:js.activeTimer(e)}),t.invalidateQueries({queryKey:js.byIssue(e)})}})}function S$(e){const t=Se();return be({mutationFn:()=>oe.post(`/admin/issues/${e}/time-logs/timer`,{action:"stop"}),onSuccess:()=>{t.invalidateQueries({queryKey:js.activeTimer(e)}),t.invalidateQueries({queryKey:js.byIssue(e)})}})}function C$(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/issues/${e}/time-logs/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:js.byIssue(e)})}})}const _$=Zl("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-destructive-foreground",outline:"text-foreground",muted:"border-transparent bg-muted text-muted-foreground"}},defaultVariants:{variant:"default"}});function En({className:e,variant:t,...r}){return a.jsx("div",{className:z(_$({variant:t}),e),...r})}function Ph(e){const t=Math.floor(e/60),r=e%60;return t===0?`${r}m`:r===0?`${t}h`:`${t}h ${r}m`}function Sy(e){const t=Date.now()-new Date(e).getTime(),r=Math.floor(t/1e3),n=Math.floor(r/3600),s=Math.floor(r%3600/60),i=r%60,o=String(s).padStart(2,"0"),l=String(i).padStart(2,"0");return n>0?`${n}:${o}:${l}`:`${o}:${l}`}function M$({startedAt:e}){const[t,r]=h.useState(()=>Sy(e));return h.useEffect(()=>{const n=setInterval(()=>r(Sy(e)),1e3);return()=>clearInterval(n)},[e]),a.jsx("span",{className:"font-mono tabular-nums text-sm font-semibold text-foreground",children:t})}function O$({onSubmit:e,isPending:t,onCancel:r}){const[n,s]=h.useState(""),[i,o]=h.useState(""),[l,c]=h.useState(""),[d,u]=h.useState(new Date().toISOString().split("T")[0]),f=m=>{m.preventDefault();const p=parseInt(n||"0",10),x=parseInt(i||"0",10),g=p*60+x;if(g<=0){H.error("Please enter a duration greater than 0.");return}e({duration_minutes:g,description:l.trim()||void 0,logged_date:d||void 0})};return a.jsxs("form",{onSubmit:f,className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[a.jsx("p",{className:"text-xs font-medium text-foreground",children:"Log time manually"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Hours"}),a.jsx(Ee,{type:"number",min:"0",max:"999",placeholder:"0",value:n,onChange:m=>s(m.target.value),className:"h-8 text-sm"})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Minutes"}),a.jsx(Ee,{type:"number",min:"0",max:"59",placeholder:"0",value:i,onChange:m=>o(m.target.value),className:"h-8 text-sm"})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Date"}),a.jsx(Ee,{type:"date",value:d,onChange:m=>u(m.target.value),className:"h-8 text-sm"})]})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:["Description ",a.jsx("span",{className:"text-muted-foreground/60",children:"(optional)"})]}),a.jsx(Ee,{placeholder:"What did you work on?",value:l,onChange:m=>c(m.target.value),className:"h-8 text-sm"})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[a.jsx(ne,{type:"button",variant:"ghost",size:"sm",onClick:r,className:"h-7 text-xs",children:"Cancel"}),a.jsx(ne,{type:"submit",size:"sm",disabled:t,className:"h-7 text-xs",children:t?"Saving…":"Log time"})]})]})}function P$({entry:e,userName:t,onDelete:r,isDeleting:n}){const s=e.started_at!=null&&e.stopped_at==null;return a.jsxs("div",{className:"flex items-start gap-3 py-2.5 px-3 rounded-lg hover:bg-muted/50 group transition-colors",children:[a.jsx("div",{className:z("flex h-7 w-7 shrink-0 items-center justify-center rounded-full mt-0.5",s?"bg-emerald-50 dark:bg-emerald-950/40":"bg-muted"),children:s?a.jsx(D5,{className:"h-3.5 w-3.5 text-emerald-600"}):e.source==="timer"?a.jsx(Tn,{className:"h-3.5 w-3.5 text-muted-foreground"}):a.jsx(o5,{className:"h-3.5 w-3.5 text-muted-foreground"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s?a.jsx(M$,{startedAt:e.started_at}):a.jsx("span",{className:"text-sm font-semibold text-foreground tabular-nums",children:Ph(e.duration_minutes??0)}),a.jsx(En,{variant:"muted",className:z("text-[10px] px-1.5 py-0",s?"bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-400":""),children:s?"Running":e.source==="timer"?"Timer":"Manual"}),t&&a.jsx("span",{className:"text-[11px] text-muted-foreground",children:t})]}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:e.description}),e.logged_date&&!s&&a.jsx("p",{className:"text-[11px] text-muted-foreground/60 mt-0.5",children:fe(new Date(e.logged_date),"MMM d, yyyy")})]}),!s&&a.jsx(ne,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100 text-muted-foreground hover:text-destructive transition-all mt-0.5",onClick:()=>r(e.id),disabled:n,children:a.jsx(Mr,{className:"h-3.5 w-3.5"})})]})}function E$({issueId:e,className:t}){const[r,n]=h.useState(!1),{data:s,isLoading:i}=w$(e),{data:o}=j$(e),{data:l}=ks(),c=N$(e),d=k$(e),u=S$(e),f=C$(e),m=(s==null?void 0:s.time_logs)??[],p=(s==null?void 0:s.total_minutes)??0,x=o!=null,g=N=>{c.mutate(N,{onSuccess:()=>{n(!1),H.success("Time logged")},onError:()=>H.error("Failed to log time")})},v=()=>{d.mutate(void 0,{onSuccess:()=>H.success("Timer started"),onError:N=>H.error(N.message??"Failed to start timer")})},y=()=>{u.mutate(void 0,{onSuccess:N=>{const w=N.time_log.duration_minutes??0;H.success(`Timer stopped — ${Ph(w)} logged`)},onError:()=>H.error("Failed to stop timer")})},j=N=>{f.mutate(N,{onSuccess:()=>H.success("Time entry removed"),onError:()=>H.error("Failed to remove entry")})};return a.jsxs("div",{className:z("px-6 py-4 space-y-4",t),children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-[11px] text-muted-foreground uppercase tracking-wider font-medium mb-0.5",children:"Total logged"}),a.jsx("p",{className:"text-xl font-bold text-foreground tabular-nums",children:p>0?Ph(p):"—"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[!r&&a.jsxs(ne,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5",onClick:()=>n(!0),children:[a.jsx(dt,{className:"h-3.5 w-3.5"}),"Log time"]}),x?a.jsxs(ne,{size:"sm",variant:"destructive",className:"h-8 text-xs gap-1.5",onClick:y,disabled:u.isPending,children:[a.jsx(O5,{className:"h-3.5 w-3.5 fill-current"}),"Stop"]}):a.jsxs(ne,{size:"sm",className:"h-8 text-xs gap-1.5 bg-emerald-600 hover:bg-emerald-700 text-white",onClick:v,disabled:d.isPending,children:[a.jsx(bl,{className:"h-3.5 w-3.5 fill-current"}),"Start"]})]})]}),r&&a.jsx(O$,{onSubmit:g,isPending:c.isPending,onCancel:()=>n(!1)}),i?a.jsx("div",{className:"space-y-2",children:[1,2].map(N=>a.jsxs("div",{className:"flex items-center gap-3 px-3",children:[a.jsx(le,{className:"h-7 w-7 rounded-full shrink-0"}),a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsx(le,{className:"h-3 w-1/3"}),a.jsx(le,{className:"h-2.5 w-1/4"})]})]},N))}):m.length>0?a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[a.jsx(Tn,{className:"h-3 w-3 text-muted-foreground"}),a.jsxs("span",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:[m.length," ",m.length===1?"entry":"entries"]})]}),a.jsx("div",{children:m.map(N=>{var w;return a.jsx(P$,{entry:N,userName:(w=l==null?void 0:l.get(N.user_id))==null?void 0:w.name,onDelete:j,isDeleting:f.isPending},N.id)})})]}):a.jsx("p",{className:"text-sm text-muted-foreground/50 text-center py-1",children:"No time logged yet."})]})}function A$(e){var t;const{char:r,allowSpaces:n,allowToIncludeChar:s,allowedPrefixes:i,startOfLine:o,$position:l}=e,c=n&&!s,d=NE(r),u=new RegExp(`\\s${d}$`),f=o?"^":"",m=s?"":d,p=c?new RegExp(`${f}${d}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${f}(?:^)?${d}[^\\s${m}]*`,"gm"),x=((t=l.nodeBefore)==null?void 0:t.isText)&&l.nodeBefore.text;if(!x)return null;const g=l.pos-x.length,v=Array.from(x.matchAll(p)).pop();if(!v||v.input===void 0||v.index===void 0)return null;const y=v.input.slice(Math.max(0,v.index-1),v.index),j=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(y);if(i!==null&&!j)return null;const N=g+v.index;let w=N+v[0].length;return c&&u.test(x.slice(w-1,w+1))&&(v[0]+=" ",w+=1),N<l.pos&&w>=l.pos?{range:{from:N,to:w},query:v[0].slice(r.length),text:v[0]}:null}var D$=new u1("suggestion");function T$({pluginKey:e=D$,editor:t,char:r="@",allowSpaces:n=!1,allowToIncludeChar:s=!1,allowedPrefixes:i=[" "],startOfLine:o=!1,decorationTag:l="span",decorationClass:c="suggestion",decorationContent:d="",decorationEmptyClass:u="is-empty",command:f=()=>null,items:m=()=>[],render:p=()=>({}),allow:x=()=>!0,findSuggestionMatch:g=A$,shouldShow:v}){let y;const j=p==null?void 0:p(),N=()=>{const C=t.state.selection.$anchor.pos,_=t.view.coordsAtPos(C),{top:S,right:I,bottom:A,left:O}=_;try{return new DOMRect(O,S,I-O,A-S)}catch{return null}},w=(C,_)=>_?()=>{const S=e.getState(t.state),I=S==null?void 0:S.decorationId,A=C.dom.querySelector(`[data-decoration-id="${I}"]`);return(A==null?void 0:A.getBoundingClientRect())||null}:N;function k(C,_){var S;try{const A=e.getState(C.state),O=A!=null&&A.decorationId?C.dom.querySelector(`[data-decoration-id="${A.decorationId}"]`):null,L={editor:t,range:(A==null?void 0:A.range)||{from:0,to:0},query:(A==null?void 0:A.query)||null,text:(A==null?void 0:A.text)||null,items:[],command:F=>f({editor:t,range:(A==null?void 0:A.range)||{from:0,to:0},props:F}),decorationNode:O,clientRect:w(C,O)};(S=j==null?void 0:j.onExit)==null||S.call(j,L)}catch{}const I=C.state.tr.setMeta(_,{exit:!0});C.dispatch(I)}const b=new bE({key:e,view(){return{update:async(C,_)=>{var S,I,A,O,L,F,X;const T=(S=this.key)==null?void 0:S.getState(_),G=(I=this.key)==null?void 0:I.getState(C.state),re=T.active&&G.active&&T.range.from!==G.range.from,J=!T.active&&G.active,P=T.active&&!G.active,M=!J&&!P&&T.query!==G.query,R=J||re&&M,q=M||re,$=P||re&&M;if(!R&&!q&&!$)return;const K=$&&!R?T:G,D=C.dom.querySelector(`[data-decoration-id="${K.decorationId}"]`);y={editor:t,range:K.range,query:K.query,text:K.text,items:[],command:E=>f({editor:t,range:K.range,props:E}),decorationNode:D,clientRect:w(C,D)},R&&((A=j==null?void 0:j.onBeforeStart)==null||A.call(j,y)),q&&((O=j==null?void 0:j.onBeforeUpdate)==null||O.call(j,y)),(q||R)&&(y.items=await m({editor:t,query:K.query})),$&&((L=j==null?void 0:j.onExit)==null||L.call(j,y)),q&&((F=j==null?void 0:j.onUpdate)==null||F.call(j,y)),R&&((X=j==null?void 0:j.onStart)==null||X.call(j,y))},destroy:()=>{var C;y&&((C=j==null?void 0:j.onExit)==null||C.call(j,y))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(C,_,S,I){const{isEditable:A}=t,{composing:O}=t.view,{selection:L}=C,{empty:F,from:X}=L,T={..._},G=C.getMeta(e);if(G&&G.exit)return T.active=!1,T.decorationId=null,T.range={from:0,to:0},T.query=null,T.text=null,T;if(T.composing=O,A&&(F||t.view.composing)){(X<_.range.from||X>_.range.to)&&!O&&!_.composing&&(T.active=!1);const re=g({char:r,allowSpaces:n,allowToIncludeChar:s,allowedPrefixes:i,startOfLine:o,$position:L.$from}),J=`id_${Math.floor(Math.random()*4294967295)}`;re&&x({editor:t,state:I,range:re.range,isActive:_.active})&&(!v||v({editor:t,range:re.range,query:re.query,text:re.text,transaction:C}))?(T.active=!0,T.decorationId=_.decorationId?_.decorationId:J,T.range=re.range,T.query=re.query,T.text=re.text):T.active=!1}else T.active=!1;return T.active||(T.decorationId=null,T.range={from:0,to:0},T.query=null,T.text=null),T}},props:{handleKeyDown(C,_){var S,I,A,O;const{active:L,range:F}=b.getState(C.state);if(!L)return!1;if(_.key==="Escape"||_.key==="Esc"){const T=b.getState(C.state),G=(S=y==null?void 0:y.decorationNode)!=null?S:null,re=G??(T!=null&&T.decorationId?C.dom.querySelector(`[data-decoration-id="${T.decorationId}"]`):null);if(((I=j==null?void 0:j.onKeyDown)==null?void 0:I.call(j,{view:C,event:_,range:T.range}))||!1)return!0;const P={editor:t,range:T.range,query:T.query,text:T.text,items:[],command:M=>f({editor:t,range:T.range,props:M}),decorationNode:re,clientRect:re?()=>re.getBoundingClientRect()||null:null};return(A=j==null?void 0:j.onExit)==null||A.call(j,P),k(C,e),!0}return((O=j==null?void 0:j.onKeyDown)==null?void 0:O.call(j,{view:C,event:_,range:F}))||!1},decorations(C){const{active:_,range:S,decorationId:I,query:A}=b.getState(C);if(!_)return null;const O=!(A!=null&&A.length),L=[c];return O&&L.push(u),wE.create(C.doc,[jE.inline(S.from,S.to,{nodeName:l,class:L.join(" "),"data-decoration-id":I,"data-decoration-content":d})])}}});return b}function I$({editor:e,overrideSuggestionOptions:t,extensionName:r,char:n="@"}){const s=new u1;return{editor:e,char:n,pluginKey:s,command:({editor:i,range:o,props:l})=>{var c,d,u;const f=i.view.state.selection.$to.nodeAfter;((c=f==null?void 0:f.text)==null?void 0:c.startsWith(" "))&&(o.to+=1),i.chain().focus().insertContentAt(o,[{type:r,attrs:{...l,mentionSuggestionChar:n}},{type:"text",text:" "}]).run(),(u=(d=i.view.dom.ownerDocument.defaultView)==null?void 0:d.getSelection())==null||u.collapseToEnd()},allow:({state:i,range:o})=>{const l=i.doc.resolve(o.from),c=i.schema.nodes[r];return!!l.parent.type.contentMatch.matchType(c)},...t}}function jk(e){return(e.options.suggestions.length?e.options.suggestions:[e.options.suggestion]).map(t=>I$({editor:e.editor,overrideSuggestionOptions:t,extensionName:e.name,char:t.char}))}function Cy(e,t){const r=jk(e),n=r.find(s=>s.char===t);return n||(r.length?r[0]:null)}var R$=kE.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:e,suggestion:t}){var r,n;return`${(r=t==null?void 0:t.char)!=null?r:"@"}${(n=e.attrs.label)!=null?n:e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:e,node:t,suggestion:r}){var n,s;return["span",Rc(this.HTMLAttributes,e.HTMLAttributes),`${(n=r==null?void 0:r.char)!=null?n:"@"}${(s=t.attrs.label)!=null?s:t.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:e=>e.getAttribute("data-id"),renderHTML:e=>e.id?{"data-id":e.id}:{}},label:{default:null,parseHTML:e=>e.getAttribute("data-label"),renderHTML:e=>e.label?{"data-label":e.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:e=>e.getAttribute("data-mention-suggestion-char"),renderHTML:e=>({"data-mention-suggestion-char":e.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:e,HTMLAttributes:t}){const r=Cy(this,e.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Rc({"data-type":this.name},this.options.HTMLAttributes,t),this.options.renderLabel({options:this.options,node:e,suggestion:r})];const n={...this.options};n.HTMLAttributes=Rc({"data-type":this.name},this.options.HTMLAttributes,t);const s=this.options.renderHTML({options:n,node:e,suggestion:r});return typeof s=="string"?["span",Rc({"data-type":this.name},this.options.HTMLAttributes,t),s]:s},...CE({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:e=>{const t={},r=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let n=r.exec(e);for(;n!==null;){const[,s,i,o]=n,l=i??o;t[s==="char"?"mentionSuggestionChar":s]=l,n=r.exec(e)}return t},serializeAttributes:e=>Object.entries(e).filter(([,t])=>t!=null).map(([t,r])=>`${t==="mentionSuggestionChar"?"char":t}="${r}"`).join(" ")}),renderText({node:e}){const t={options:this.options,node:e,suggestion:Cy(this,e.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(t)):this.options.renderText(t)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let r=!1;const{selection:n}=t,{empty:s,anchor:i}=n;if(!s)return!1;let o=new SE,l=0;return t.doc.nodesBetween(i-1,i,(c,d)=>{if(c.type.name===this.name)return r=!0,o=c,l=d,!1}),r&&e.insertText(this.options.deleteTriggerWithBackspace?"":o.attrs.mentionSuggestionChar,l,l+o.nodeSize),r})}},addProseMirrorPlugins(){return jk(this).map(T$)}}),$$=R$;function z$({items:e,selectedIndex:t,onSelect:r}){const n=h.useRef(null);return h.useEffect(()=>{var i;const s=(i=n.current)==null?void 0:i.querySelector(`[data-index="${t}"]`);s==null||s.scrollIntoView({block:"nearest"})},[t]),e.length===0?null:a.jsx("div",{className:z("z-50 min-w-[220px] max-w-[280px] rounded-md border border-border","bg-popover shadow-md overflow-hidden","animate-in fade-in-0 zoom-in-95"),children:a.jsx("div",{ref:n,className:"max-h-[200px] overflow-y-auto p-1",role:"listbox",children:e.map((s,i)=>{const o=s.label.split(" ").map(c=>c[0]).join("").toUpperCase().slice(0,2)||"?",l=$x(s.label);return a.jsxs("button",{"data-index":i,role:"option","aria-selected":i===t,onMouseDown:c=>{c.preventDefault(),r(s)},className:z("flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs cursor-pointer","transition-colors",i===t?"bg-accent text-accent-foreground":"hover:bg-accent/60"),children:[a.jsx(Rt,{className:"h-5 w-5 shrink-0",children:a.jsx($t,{className:z("text-[9px] font-semibold",l.bg,l.text),children:o})}),a.jsxs("div",{className:"flex flex-col items-start min-w-0",children:[a.jsx("span",{className:"font-medium text-foreground truncate leading-tight",children:s.label}),a.jsx("span",{className:"text-[10px] text-muted-foreground truncate leading-tight",children:s.email})]})]},s.id)})})})}function Es({onClick:e,active:t,title:r,children:n}){return a.jsx("button",{type:"button",title:r,onMouseDown:s=>{s.preventDefault(),e()},className:z("flex h-6 w-6 items-center justify-center rounded transition-colors shrink-0","text-muted-foreground hover:text-foreground hover:bg-muted",t&&"bg-muted text-foreground"),children:n})}function _y(){return a.jsx("span",{className:"mx-0.5 h-3.5 w-px shrink-0 bg-border"})}const qc={active:!1,items:[],selectedIndex:0,rect:null,command:null};function Nk({issueId:e,projectId:t,compact:r,className:n,onSuccess:s}){const[i,o]=h.useState(!0),[l,c]=h.useState([]),[d,u]=h.useState(!1),[f,m]=h.useState(qc),p=h.useRef(null),x=h.useRef(async()=>{}),g=h.useRef(null),{user:v}=Ie(),y=r5(e),j=bk(e),{data:N}=la(t??""),w=h.useMemo(()=>N!=null&&N.members?N.members.filter(D=>D.user).map(D=>{const E=D.user,Z=`${E.first_name??""} ${E.last_name??""}`.trim()||E.email;return{id:E.id,label:Z,email:E.email}}):[],[N]),k=h.useRef([]);k.current=w;const b=h.useRef(m);b.current=m;const C=h.useRef([]),_=h.useRef(null),S=h.useRef(0),I=(v==null?void 0:v.first_name)??"",A=(v==null?void 0:v.last_name)??"",O=`${I} ${A}`.trim()||(v==null?void 0:v.email)||"?",L=v&&`${I[0]??""}${A[0]??""}`.toUpperCase()||"?",F=$x(O),X=h.useMemo(()=>_E.create({name:"submitShortcut",addKeyboardShortcuts(){return{"Mod-Enter":()=>(x.current(),!0)}}}),[]),T=h.useMemo(()=>$$.configure({HTMLAttributes:{class:"mention"},suggestion:{items:({query:D})=>{const E=k.current;if(!E.length)return[];const Z=D.toLowerCase();return E.filter(B=>!Z||B.label.toLowerCase().includes(Z)||B.email.toLowerCase().includes(Z)).slice(0,8)},render:()=>({onStart:D=>{var E;C.current=D.items,_.current=D.command,S.current=0,b.current({active:!0,items:D.items,selectedIndex:0,rect:((E=D.clientRect)==null?void 0:E.call(D))??null,command:D.command})},onUpdate:D=>{var E;C.current=D.items,_.current=D.command,S.current=0,b.current({active:!0,items:D.items,selectedIndex:0,rect:((E=D.clientRect)==null?void 0:E.call(D))??null,command:D.command})},onKeyDown:({event:D})=>{var Z;const E=C.current;if(!E.length)return!1;if(D.key==="Escape")return b.current(qc),!0;if(D.key==="ArrowDown"){const B=(S.current+1)%E.length;return S.current=B,b.current(Y=>({...Y,selectedIndex:B})),!0}if(D.key==="ArrowUp"){const B=(S.current-1+E.length)%E.length;return S.current=B,b.current(Y=>({...Y,selectedIndex:B})),!0}if(D.key==="Enter"){const B=E[S.current];return B&&((Z=_.current)==null||Z.call(_,B)),!0}return!1},onExit:()=>{b.current(qc),_.current=null}})}}),[]),G=f1({extensions:[m1,h1,p1.configure({placeholder:"Leave a comment… (type @ to mention)"}),X,T],editorProps:{attributes:{class:"meridian-editor"}},onUpdate({editor:D}){o(D.isEmpty)}}),re=!i||l.length>0,J=25*1024*1024,P=D=>{const E=D.filter(B=>B.size>J);E.length>0&&H.error(`Files must be under 25 MB: ${E.map(B=>B.name).join(", ")}`);const Z=D.filter(B=>B.size<=J);c(B=>{const Y=new Set(B.map(ae=>`${ae.name}-${ae.size}`));return[...B,...Z.filter(ae=>!Y.has(`${ae.name}-${ae.size}`))]})},M=D=>{c(E=>E.filter((Z,B)=>B!==D))},R=h.useCallback(D=>{var E;(E=_.current)==null||E.call(_,D),m(qc)},[]),q=async()=>{if(!(!re||d)){u(!0);try{const D=G!=null&&G.isEmpty?"":(G==null?void 0:G.getHTML())??"",E=[];D&&new DOMParser().parseFromString(D,"text/html").querySelectorAll("[data-type='mention']").forEach(se=>{const V=se.getAttribute("data-id");V&&!E.includes(V)&&E.push(V)});const Z=E.length>0?{mentioned_user_ids:E}:void 0,Y=(await y.mutateAsync({body:D||" ",metadata:Z})).comment.id;for(const ae of l)await j.mutateAsync({file:ae,commentId:Y});G==null||G.commands.clearContent(),o(!0),c([]),H.success("Comment added"),s==null||s()}catch{H.error("Failed to add comment")}finally{u(!1)}}};x.current=q;const $="h-3 w-3",K=h.useMemo(()=>{if(!f.rect||!g.current)return{bottom:"105%",left:0};const D=g.current.getBoundingClientRect(),E=Math.max(0,f.rect.left-D.left);return{top:f.rect.bottom-D.top+4,left:E}},[f.rect]);return a.jsxs("div",{className:z("flex gap-3 items-start",n),children:[a.jsx(Rt,{className:"h-7 w-7 shrink-0 mt-1",children:a.jsx($t,{className:z("text-[11px] font-semibold",F.bg,F.text),children:L})}),a.jsxs("div",{className:"flex-1 min-w-0 relative",ref:g,children:[a.jsxs("div",{className:z("rounded-md border border-input overflow-hidden transition-shadow","focus-within:ring-1 focus-within:ring-ring",d&&"opacity-60 pointer-events-none"),children:[G&&a.jsxs("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-border/70 bg-muted/30",children:[a.jsx(Es,{title:"Bold (⌘B)",active:G.isActive("bold"),onClick:()=>G.chain().focus().toggleBold().run(),children:a.jsx(D1,{className:$})}),a.jsx(Es,{title:"Italic (⌘I)",active:G.isActive("italic"),onClick:()=>G.chain().focus().toggleItalic().run(),children:a.jsx(B1,{className:$})}),a.jsx(Es,{title:"Strikethrough",active:G.isActive("strike"),onClick:()=>G.chain().focus().toggleStrike().run(),children:a.jsx(K1,{className:$})}),a.jsx(Es,{title:"Inline code",active:G.isActive("code"),onClick:()=>G.chain().focus().toggleCode().run(),children:a.jsx(L1,{className:$})}),a.jsx(_y,{}),a.jsx(Es,{title:"Bullet list",active:G.isActive("bulletList"),onClick:()=>G.chain().focus().toggleBulletList().run(),children:a.jsx(ax,{className:$})}),a.jsx(Es,{title:"Ordered list",active:G.isActive("orderedList"),onClick:()=>G.chain().focus().toggleOrderedList().run(),children:a.jsx(U1,{className:$})}),a.jsx(_y,{}),a.jsx(Es,{title:"Code block",active:G.isActive("codeBlock"),onClick:()=>G.chain().focus().toggleCodeBlock().run(),children:a.jsx(z1,{className:$})})]}),a.jsx(x1,{editor:G,className:z("px-3 py-2.5 text-sm",r?"min-h-[68px]":"min-h-[80px]")})]}),l.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:l.map((D,E)=>a.jsxs("span",{className:"inline-flex items-center gap-1 pl-1.5 pr-1 py-0.5 rounded-md bg-muted border border-border text-[11px] text-foreground max-w-[180px]",children:[a.jsx(Tx,{mimeType:D.type,className:"h-3 w-3 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"truncate",children:D.name}),a.jsxs("span",{className:"text-muted-foreground shrink-0",children:["(",cf(D.size),")"]}),a.jsx("button",{type:"button",onClick:()=>M(E),className:"ml-0.5 rounded hover:text-destructive transition-colors shrink-0",children:a.jsx(tt,{className:"h-3 w-3"})})]},E))}),a.jsxs("div",{className:"flex items-center justify-between mt-2",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(ne,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>{var D;return(D=p.current)==null?void 0:D.click()},disabled:d,title:"Attach files",children:a.jsx(sx,{className:"h-3.5 w-3.5"})}),a.jsxs("span",{className:"text-[11px] text-muted-foreground/50 hidden sm:block",children:[a.jsx("kbd",{className:"px-1 py-0.5 rounded border border-border bg-muted font-mono text-[10px]",children:"⌘ Enter"})," to submit"]})]}),a.jsx(ne,{size:"icon",className:"h-8 w-8",onClick:q,disabled:!re||d,children:a.jsx(C5,{className:"h-3.5 w-3.5"})})]}),a.jsx("input",{ref:p,type:"file",multiple:!0,className:"hidden",onChange:D=>{const E=Array.from(D.target.files??[]);E.length>0&&P(E),D.target.value=""}}),f.active&&f.items.length>0&&a.jsx("div",{className:"absolute z-[9999]",style:K,children:a.jsx(z$,{items:f.items,selectedIndex:f.selectedIndex,onSelect:R})})]})]})}/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:kk,setPrototypeOf:My,isFrozen:L$,getPrototypeOf:F$,getOwnPropertyDescriptor:B$}=Object;let{freeze:Pr,seal:mn,create:Eh}=Object,{apply:Ah,construct:Dh}=typeof Reflect<"u"&&Reflect;Pr||(Pr=function(t){return t});mn||(mn=function(t){return t});Ah||(Ah=function(t,r){for(var n=arguments.length,s=new Array(n>2?n-2:0),i=2;i<n;i++)s[i-2]=arguments[i];return t.apply(r,s)});Dh||(Dh=function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return new t(...n)});const Hc=Er(Array.prototype.forEach),W$=Er(Array.prototype.lastIndexOf),Oy=Er(Array.prototype.pop),Yo=Er(Array.prototype.push),U$=Er(Array.prototype.splice),vd=Er(String.prototype.toLowerCase),Im=Er(String.prototype.toString),Rm=Er(String.prototype.match),Go=Er(String.prototype.replace),q$=Er(String.prototype.indexOf),H$=Er(String.prototype.trim),jn=Er(Object.prototype.hasOwnProperty),wr=Er(RegExp.prototype.test),Vo=K$(TypeError);function Er(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return Ah(e,t,n)}}function K$(e){return function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return Dh(e,r)}}function We(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:vd;My&&My(e,null);let n=t.length;for(;n--;){let s=t[n];if(typeof s=="string"){const i=r(s);i!==s&&(L$(t)||(t[n]=i),s=i)}e[s]=!0}return e}function Y$(e){for(let t=0;t<e.length;t++)jn(e,t)||(e[t]=null);return e}function qn(e){const t=Eh(null);for(const[r,n]of kk(e))jn(e,r)&&(Array.isArray(n)?t[r]=Y$(n):n&&typeof n=="object"&&n.constructor===Object?t[r]=qn(n):t[r]=n);return t}function Xo(e,t){for(;e!==null;){const n=B$(e,t);if(n){if(n.get)return Er(n.get);if(typeof n.value=="function")return Er(n.value)}e=F$(e)}function r(){return null}return r}const Py=Pr(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),$m=Pr(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),zm=Pr(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),G$=Pr(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Lm=Pr(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),V$=Pr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ey=Pr(["#text"]),Ay=Pr(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Fm=Pr(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Dy=Pr(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Kc=Pr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),X$=mn(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Q$=mn(/<%[\w\W]*|[\w\W]*%>/gm),Z$=mn(/\$\{[\w\W]*/gm),J$=mn(/^data-[\-\w.\u00B7-\uFFFF]+$/),e6=mn(/^aria-[\-\w]+$/),Sk=mn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),t6=mn(/^(?:\w+script|data):/i),r6=mn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ck=mn(/^html$/i),n6=mn(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ty=Object.freeze({__proto__:null,ARIA_ATTR:e6,ATTR_WHITESPACE:r6,CUSTOM_ELEMENT:n6,DATA_ATTR:J$,DOCTYPE_NAME:Ck,ERB_EXPR:Q$,IS_ALLOWED_URI:Sk,IS_SCRIPT_OR_DATA:t6,MUSTACHE_EXPR:X$,TMPLIT_EXPR:Z$});const Qo={element:1,text:3,progressingInstruction:7,comment:8,document:9},a6=function(){return typeof window>"u"?null:window},s6=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let n=null;const s="data-tt-policy-suffix";r&&r.hasAttribute(s)&&(n=r.getAttribute(s));const i="dompurify"+(n?"#"+n:"");try{return t.createPolicy(i,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Iy=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function _k(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:a6();const t=Pe=>_k(Pe);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Qo.document||!e.Element)return t.isSupported=!1,t;let{document:r}=e;const n=r,s=n.currentScript,{DocumentFragment:i,HTMLTemplateElement:o,Node:l,Element:c,NodeFilter:d,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:m,trustedTypes:p}=e,x=c.prototype,g=Xo(x,"cloneNode"),v=Xo(x,"remove"),y=Xo(x,"nextSibling"),j=Xo(x,"childNodes"),N=Xo(x,"parentNode");if(typeof o=="function"){const Pe=r.createElement("template");Pe.content&&Pe.content.ownerDocument&&(r=Pe.content.ownerDocument)}let w,k="";const{implementation:b,createNodeIterator:C,createDocumentFragment:_,getElementsByTagName:S}=r,{importNode:I}=n;let A=Iy();t.isSupported=typeof kk=="function"&&typeof N=="function"&&b&&b.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:O,ERB_EXPR:L,TMPLIT_EXPR:F,DATA_ATTR:X,ARIA_ATTR:T,IS_SCRIPT_OR_DATA:G,ATTR_WHITESPACE:re,CUSTOM_ELEMENT:J}=Ty;let{IS_ALLOWED_URI:P}=Ty,M=null;const R=We({},[...Py,...$m,...zm,...Lm,...Ey]);let q=null;const $=We({},[...Ay,...Fm,...Dy,...Kc]);let K=Object.seal(Eh(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),D=null,E=null;const Z=Object.seal(Eh(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let B=!0,Y=!0,ae=!1,ee=!0,se=!1,V=!0,ie=!1,pe=!1,ue=!1,ve=!1,Q=!1,ge=!1,De=!0,Ue=!1;const Fe="user-content-";let Ve=!0,ut=!1,Ke={},Ze=null;const tr=We({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ir=null;const rr=We({},["audio","video","img","source","image","track"]);let yr=null;const nr=We({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),yt="http://www.w3.org/1998/Math/MathML",Lt="http://www.w3.org/2000/svg",Kt="http://www.w3.org/1999/xhtml";let ar=Kt,$n=!1,fa=null;const Oe=We({},[yt,Lt,Kt],Im);let xe=We({},["mi","mo","mn","ms","mtext"]),Ne=We({},["annotation-xml"]);const he=We({},["title","style","font","a","script"]);let ye=null;const Xe=["application/xhtml+xml","text/html"],de="text/html";let _e=null,Te=null;const bt=r.createElement("form"),rt=function(U){return U instanceof RegExp||U instanceof Function},nt=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Te&&Te===U)){if((!U||typeof U!="object")&&(U={}),U=qn(U),ye=Xe.indexOf(U.PARSER_MEDIA_TYPE)===-1?de:U.PARSER_MEDIA_TYPE,_e=ye==="application/xhtml+xml"?Im:vd,M=jn(U,"ALLOWED_TAGS")?We({},U.ALLOWED_TAGS,_e):R,q=jn(U,"ALLOWED_ATTR")?We({},U.ALLOWED_ATTR,_e):$,fa=jn(U,"ALLOWED_NAMESPACES")?We({},U.ALLOWED_NAMESPACES,Im):Oe,yr=jn(U,"ADD_URI_SAFE_ATTR")?We(qn(nr),U.ADD_URI_SAFE_ATTR,_e):nr,Ir=jn(U,"ADD_DATA_URI_TAGS")?We(qn(rr),U.ADD_DATA_URI_TAGS,_e):rr,Ze=jn(U,"FORBID_CONTENTS")?We({},U.FORBID_CONTENTS,_e):tr,D=jn(U,"FORBID_TAGS")?We({},U.FORBID_TAGS,_e):qn({}),E=jn(U,"FORBID_ATTR")?We({},U.FORBID_ATTR,_e):qn({}),Ke=jn(U,"USE_PROFILES")?U.USE_PROFILES:!1,B=U.ALLOW_ARIA_ATTR!==!1,Y=U.ALLOW_DATA_ATTR!==!1,ae=U.ALLOW_UNKNOWN_PROTOCOLS||!1,ee=U.ALLOW_SELF_CLOSE_IN_ATTR!==!1,se=U.SAFE_FOR_TEMPLATES||!1,V=U.SAFE_FOR_XML!==!1,ie=U.WHOLE_DOCUMENT||!1,ve=U.RETURN_DOM||!1,Q=U.RETURN_DOM_FRAGMENT||!1,ge=U.RETURN_TRUSTED_TYPE||!1,ue=U.FORCE_BODY||!1,De=U.SANITIZE_DOM!==!1,Ue=U.SANITIZE_NAMED_PROPS||!1,Ve=U.KEEP_CONTENT!==!1,ut=U.IN_PLACE||!1,P=U.ALLOWED_URI_REGEXP||Sk,ar=U.NAMESPACE||Kt,xe=U.MATHML_TEXT_INTEGRATION_POINTS||xe,Ne=U.HTML_INTEGRATION_POINTS||Ne,K=U.CUSTOM_ELEMENT_HANDLING||{},U.CUSTOM_ELEMENT_HANDLING&&rt(U.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(K.tagNameCheck=U.CUSTOM_ELEMENT_HANDLING.tagNameCheck),U.CUSTOM_ELEMENT_HANDLING&&rt(U.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(K.attributeNameCheck=U.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),U.CUSTOM_ELEMENT_HANDLING&&typeof U.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(K.allowCustomizedBuiltInElements=U.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),se&&(Y=!1),Q&&(ve=!0),Ke&&(M=We({},Ey),q=[],Ke.html===!0&&(We(M,Py),We(q,Ay)),Ke.svg===!0&&(We(M,$m),We(q,Fm),We(q,Kc)),Ke.svgFilters===!0&&(We(M,zm),We(q,Fm),We(q,Kc)),Ke.mathMl===!0&&(We(M,Lm),We(q,Dy),We(q,Kc))),U.ADD_TAGS&&(typeof U.ADD_TAGS=="function"?Z.tagCheck=U.ADD_TAGS:(M===R&&(M=qn(M)),We(M,U.ADD_TAGS,_e))),U.ADD_ATTR&&(typeof U.ADD_ATTR=="function"?Z.attributeCheck=U.ADD_ATTR:(q===$&&(q=qn(q)),We(q,U.ADD_ATTR,_e))),U.ADD_URI_SAFE_ATTR&&We(yr,U.ADD_URI_SAFE_ATTR,_e),U.FORBID_CONTENTS&&(Ze===tr&&(Ze=qn(Ze)),We(Ze,U.FORBID_CONTENTS,_e)),U.ADD_FORBID_CONTENTS&&(Ze===tr&&(Ze=qn(Ze)),We(Ze,U.ADD_FORBID_CONTENTS,_e)),Ve&&(M["#text"]=!0),ie&&We(M,["html","head","body"]),M.table&&(We(M,["tbody"]),delete D.tbody),U.TRUSTED_TYPES_POLICY){if(typeof U.TRUSTED_TYPES_POLICY.createHTML!="function")throw Vo('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof U.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Vo('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=U.TRUSTED_TYPES_POLICY,k=w.createHTML("")}else w===void 0&&(w=s6(p,s)),w!==null&&typeof k=="string"&&(k=w.createHTML(""));Pr&&Pr(U),Te=U}},br=We({},[...$m,...zm,...G$]),sr=We({},[...Lm,...V$]),zn=function(U){let me=N(U);(!me||!me.tagName)&&(me={namespaceURI:ar,tagName:"template"});const ke=vd(U.tagName),xt=vd(me.tagName);return fa[U.namespaceURI]?U.namespaceURI===Lt?me.namespaceURI===Kt?ke==="svg":me.namespaceURI===yt?ke==="svg"&&(xt==="annotation-xml"||xe[xt]):!!br[ke]:U.namespaceURI===yt?me.namespaceURI===Kt?ke==="math":me.namespaceURI===Lt?ke==="math"&&Ne[xt]:!!sr[ke]:U.namespaceURI===Kt?me.namespaceURI===Lt&&!Ne[xt]||me.namespaceURI===yt&&!xe[xt]?!1:!sr[ke]&&(he[ke]||!br[ke]):!!(ye==="application/xhtml+xml"&&fa[U.namespaceURI]):!1},Ln=function(U){Yo(t.removed,{element:U});try{N(U).removeChild(U)}catch{v(U)}},Ms=function(U,me){try{Yo(t.removed,{attribute:me.getAttributeNode(U),from:me})}catch{Yo(t.removed,{attribute:null,from:me})}if(me.removeAttribute(U),U==="is")if(ve||Q)try{Ln(me)}catch{}else try{me.setAttribute(U,"")}catch{}},Ev=function(U){let me=null,ke=null;if(ue)U="<remove></remove>"+U;else{const At=Rm(U,/^[\r\n\t ]+/);ke=At&&At[0]}ye==="application/xhtml+xml"&&ar===Kt&&(U='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+U+"</body></html>");const xt=w?w.createHTML(U):U;if(ar===Kt)try{me=new m().parseFromString(xt,ye)}catch{}if(!me||!me.documentElement){me=b.createDocument(ar,"template",null);try{me.documentElement.innerHTML=$n?k:xt}catch{}}const mr=me.body||me.documentElement;return U&&ke&&mr.insertBefore(r.createTextNode(ke),mr.childNodes[0]||null),ar===Kt?S.call(me,ie?"html":"body")[0]:ie?me.documentElement:mr},Av=function(U){return C.call(U.ownerDocument||U,U,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},fm=function(U){return U instanceof f&&(typeof U.nodeName!="string"||typeof U.textContent!="string"||typeof U.removeChild!="function"||!(U.attributes instanceof u)||typeof U.removeAttribute!="function"||typeof U.setAttribute!="function"||typeof U.namespaceURI!="string"||typeof U.insertBefore!="function"||typeof U.hasChildNodes!="function")},Dv=function(U){return typeof l=="function"&&U instanceof l};function ma(Pe,U,me){Hc(Pe,ke=>{ke.call(t,U,me,Te)})}const Tv=function(U){let me=null;if(ma(A.beforeSanitizeElements,U,null),fm(U))return Ln(U),!0;const ke=_e(U.nodeName);if(ma(A.uponSanitizeElement,U,{tagName:ke,allowedTags:M}),V&&U.hasChildNodes()&&!Dv(U.firstElementChild)&&wr(/<[/\w!]/g,U.innerHTML)&&wr(/<[/\w!]/g,U.textContent)||U.nodeType===Qo.progressingInstruction||V&&U.nodeType===Qo.comment&&wr(/<[/\w]/g,U.data))return Ln(U),!0;if(!(Z.tagCheck instanceof Function&&Z.tagCheck(ke))&&(!M[ke]||D[ke])){if(!D[ke]&&Rv(ke)&&(K.tagNameCheck instanceof RegExp&&wr(K.tagNameCheck,ke)||K.tagNameCheck instanceof Function&&K.tagNameCheck(ke)))return!1;if(Ve&&!Ze[ke]){const xt=N(U)||U.parentNode,mr=j(U)||U.childNodes;if(mr&&xt){const At=mr.length;for(let Rr=At-1;Rr>=0;--Rr){const ha=g(mr[Rr],!0);ha.__removalCount=(U.__removalCount||0)+1,xt.insertBefore(ha,y(U))}}}return Ln(U),!0}return U instanceof c&&!zn(U)||(ke==="noscript"||ke==="noembed"||ke==="noframes")&&wr(/<\/no(script|embed|frames)/i,U.innerHTML)?(Ln(U),!0):(se&&U.nodeType===Qo.text&&(me=U.textContent,Hc([O,L,F],xt=>{me=Go(me,xt," ")}),U.textContent!==me&&(Yo(t.removed,{element:U.cloneNode()}),U.textContent=me)),ma(A.afterSanitizeElements,U,null),!1)},Iv=function(U,me,ke){if(De&&(me==="id"||me==="name")&&(ke in r||ke in bt))return!1;if(!(Y&&!E[me]&&wr(X,me))){if(!(B&&wr(T,me))){if(!(Z.attributeCheck instanceof Function&&Z.attributeCheck(me,U))){if(!q[me]||E[me]){if(!(Rv(U)&&(K.tagNameCheck instanceof RegExp&&wr(K.tagNameCheck,U)||K.tagNameCheck instanceof Function&&K.tagNameCheck(U))&&(K.attributeNameCheck instanceof RegExp&&wr(K.attributeNameCheck,me)||K.attributeNameCheck instanceof Function&&K.attributeNameCheck(me,U))||me==="is"&&K.allowCustomizedBuiltInElements&&(K.tagNameCheck instanceof RegExp&&wr(K.tagNameCheck,ke)||K.tagNameCheck instanceof Function&&K.tagNameCheck(ke))))return!1}else if(!yr[me]){if(!wr(P,Go(ke,re,""))){if(!((me==="src"||me==="xlink:href"||me==="href")&&U!=="script"&&q$(ke,"data:")===0&&Ir[U])){if(!(ae&&!wr(G,Go(ke,re,"")))){if(ke)return!1}}}}}}}return!0},Rv=function(U){return U!=="annotation-xml"&&Rm(U,J)},$v=function(U){ma(A.beforeSanitizeAttributes,U,null);const{attributes:me}=U;if(!me||fm(U))return;const ke={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:q,forceKeepAttr:void 0};let xt=me.length;for(;xt--;){const mr=me[xt],{name:At,namespaceURI:Rr,value:ha}=mr,Pi=_e(At),mm=ha;let ir=At==="value"?mm:H$(mm);if(ke.attrName=Pi,ke.attrValue=ir,ke.keepAttr=!0,ke.forceKeepAttr=void 0,ma(A.uponSanitizeAttribute,U,ke),ir=ke.attrValue,Ue&&(Pi==="id"||Pi==="name")&&(Ms(At,U),ir=Fe+ir),V&&wr(/((--!?|])>)|<\/(style|title|textarea)/i,ir)){Ms(At,U);continue}if(Pi==="attributename"&&Rm(ir,"href")){Ms(At,U);continue}if(ke.forceKeepAttr)continue;if(!ke.keepAttr){Ms(At,U);continue}if(!ee&&wr(/\/>/i,ir)){Ms(At,U);continue}se&&Hc([O,L,F],Lv=>{ir=Go(ir,Lv," ")});const zv=_e(U.nodeName);if(!Iv(zv,Pi,ir)){Ms(At,U);continue}if(w&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!Rr)switch(p.getAttributeType(zv,Pi)){case"TrustedHTML":{ir=w.createHTML(ir);break}case"TrustedScriptURL":{ir=w.createScriptURL(ir);break}}if(ir!==mm)try{Rr?U.setAttributeNS(Rr,At,ir):U.setAttribute(At,ir),fm(U)?Ln(U):Oy(t.removed)}catch{Ms(At,U)}}ma(A.afterSanitizeAttributes,U,null)},xP=function Pe(U){let me=null;const ke=Av(U);for(ma(A.beforeSanitizeShadowDOM,U,null);me=ke.nextNode();)ma(A.uponSanitizeShadowNode,me,null),Tv(me),$v(me),me.content instanceof i&&Pe(me.content);ma(A.afterSanitizeShadowDOM,U,null)};return t.sanitize=function(Pe){let U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},me=null,ke=null,xt=null,mr=null;if($n=!Pe,$n&&(Pe="<!-->"),typeof Pe!="string"&&!Dv(Pe))if(typeof Pe.toString=="function"){if(Pe=Pe.toString(),typeof Pe!="string")throw Vo("dirty is not a string, aborting")}else throw Vo("toString is not a function");if(!t.isSupported)return Pe;if(pe||nt(U),t.removed=[],typeof Pe=="string"&&(ut=!1),ut){if(Pe.nodeName){const ha=_e(Pe.nodeName);if(!M[ha]||D[ha])throw Vo("root node is forbidden and cannot be sanitized in-place")}}else if(Pe instanceof l)me=Ev("<!---->"),ke=me.ownerDocument.importNode(Pe,!0),ke.nodeType===Qo.element&&ke.nodeName==="BODY"||ke.nodeName==="HTML"?me=ke:me.appendChild(ke);else{if(!ve&&!se&&!ie&&Pe.indexOf("<")===-1)return w&&ge?w.createHTML(Pe):Pe;if(me=Ev(Pe),!me)return ve?null:ge?k:""}me&&ue&&Ln(me.firstChild);const At=Av(ut?Pe:me);for(;xt=At.nextNode();)Tv(xt),$v(xt),xt.content instanceof i&&xP(xt.content);if(ut)return Pe;if(ve){if(Q)for(mr=_.call(me.ownerDocument);me.firstChild;)mr.appendChild(me.firstChild);else mr=me;return(q.shadowroot||q.shadowrootmode)&&(mr=I.call(n,mr,!0)),mr}let Rr=ie?me.outerHTML:me.innerHTML;return ie&&M["!doctype"]&&me.ownerDocument&&me.ownerDocument.doctype&&me.ownerDocument.doctype.name&&wr(Ck,me.ownerDocument.doctype.name)&&(Rr="<!DOCTYPE "+me.ownerDocument.doctype.name+`>
|
|
@@ -608,7 +608,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
|
|
|
608
608
|
*
|
|
609
609
|
* This source code is licensed under the MIT license found in the
|
|
610
610
|
* LICENSE file in the root directory of this source tree.
|
|
611
|
-
*/var Ac=h;function LV(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var FV=typeof Object.is=="function"?Object.is:LV,BV=Ac.useSyncExternalStore,WV=Ac.useRef,UV=Ac.useEffect,qV=Ac.useMemo,HV=Ac.useDebugValue;zV.useSyncExternalStoreWithSelector=function(e,t,r,n,s){var i=WV(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=qV(function(){function c(p){if(!d){if(d=!0,u=p,p=n(p),s!==void 0&&o.hasValue){var x=o.value;if(s(x,p))return f=x}return f=p}if(x=f,FV(u,p))return x;var g=n(p);return s!==void 0&&s(x,g)?(u=p,x):(u=p,f=g)}var d=!1,u,f,m=r===void 0?null:r;return[function(){return c(t())},m===null?void 0:function(){return c(m())}]},[t,r,n,s]);var l=BV(e,i[0],i[1]);return UV(function(){o.hasValue=!0,o.value=l},[l]),HV(l),l};function KV(e){e()}function YV(){let e=null,t=null;return{clear(){e=null,t=null},notify(){KV(()=>{let r=e;for(;r;)r.callback(),r=r.next})},get(){const r=[];let n=e;for(;n;)r.push(n),n=n.next;return r},subscribe(r){let n=!0;const s=t={callback:r,next:null,prev:t};return s.prev?s.prev.next=s:e=s,function(){!n||e===null||(n=!1,s.next?s.next.prev=s.prev:t=s.prev,s.prev?s.prev.next=s.next:e=s.next)}}}}var aj={notify(){},get:()=>[]};function GV(e,t){let r,n=aj,s=0,i=!1;function o(g){u();const v=n.subscribe(g);let y=!1;return()=>{y||(y=!0,v(),f())}}function l(){n.notify()}function c(){x.onStateChange&&x.onStateChange()}function d(){return i}function u(){s++,r||(r=e.subscribe(c),n=YV())}function f(){s--,r&&s===0&&(r(),r=void 0,n.clear(),n=aj)}function m(){i||(i=!0,u())}function p(){i&&(i=!1,f())}const x={addNestedSub:o,notifyNestedSubs:l,handleChangeWrapper:c,isSubscribed:d,trySubscribe:m,tryUnsubscribe:p,getListeners:()=>n};return x}var VV=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",XV=VV(),QV=()=>typeof navigator<"u"&&navigator.product==="ReactNative",ZV=QV(),JV=()=>XV||ZV?h.useLayoutEffect:h.useEffect,eX=JV();function sj(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function tX(e,t){if(sj(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let s=0;s<r.length;s++)if(!Object.prototype.hasOwnProperty.call(t,r[s])||!sj(e[r[s]],t[r[s]]))return!1;return!0}var lh=Symbol.for("react-redux-context"),ch=typeof globalThis<"u"?globalThis:{};function rX(){if(!h.createContext)return{};const e=ch[lh]??(ch[lh]=new Map);let t=e.get(h.createContext);return t||(t=h.createContext(null),e.set(h.createContext,t)),t}var nX=rX();function aX(e){const{children:t,context:r,serverState:n,store:s}=e,i=h.useMemo(()=>{const c=GV(s);return{store:s,subscription:c,getServerState:n?()=>n:void 0}},[s,n]),o=h.useMemo(()=>s.getState(),[s]);eX(()=>{const{subscription:c}=i;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),o!==s.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[i,o]);const l=r||nX;return h.createElement(l.Provider,{value:i},t)}var sX=aX,iX=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function oX(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function yv(e,t){var r=new Set([...Object.keys(e),...Object.keys(t)]);for(var n of r)if(iX.has(n)){if(e[n]==null&&t[n]==null)continue;if(!tX(e[n],t[n]))return!1}else if(!oX(e[n],t[n]))return!1;return!0}function Mi(e,t){var r,n;return(r=(n=e.graphicalItems.cartesianItems.find(s=>s.id===t))===null||n===void 0?void 0:n.xAxisId)!==null&&r!==void 0?r:GM}function Oi(e,t){var r,n;return(r=(n=e.graphicalItems.cartesianItems.find(s=>s.id===t))===null||n===void 0?void 0:n.yAxisId)!==null&&r!==void 0?r:GM}var lX="Invariant failed";function cX(e,t){throw new Error(lX)}function _p(){return _p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_p.apply(null,arguments)}function Nu(e){return h.createElement(QY,_p({shapeType:"rectangle",activeClassName:"recharts-active-bar"},e))}var dX=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return(n,s)=>{if(Ce(t))return t;var i=Ce(n)||Xt(n);return i?t(n,s):(i||cX(),r)}},uX=(e,t,r)=>r,fX=(e,t)=>t,Dc=te([Gg,fX],(e,t)=>e.filter(r=>r.type==="bar").find(r=>r.id===t)),mX=te([Dc],e=>e==null?void 0:e.maxBarSize),hX=(e,t,r,n)=>n,pX=te([ot,Gg,Mi,Oi,uX],(e,t,r,n,s)=>t.filter(i=>e==="horizontal"?i.xAxisId===r:i.yAxisId===n).filter(i=>i.isPanorama===s).filter(i=>i.hide===!1).filter(i=>i.type==="bar")),xX=(e,t,r)=>{var n=ot(e),s=Mi(e,t),i=Oi(e,t);if(!(s==null||i==null))return n==="horizontal"?wp(e,"yAxis",i,r):wp(e,"xAxis",s,r)},gX=(e,t)=>{var r=ot(e),n=Mi(e,t),s=Oi(e,t);if(!(n==null||s==null))return r==="horizontal"?ow(e,"xAxis",n):ow(e,"yAxis",s)},vX=te([pX,rU,gX],CG),yX=(e,t,r)=>{var n,s,i=Dc(e,t);if(i==null)return 0;var o=Mi(e,t),l=Oi(e,t);if(o==null||l==null)return 0;var c=ot(e),d=t_(e),{maxBarSize:u}=i,f=Xt(u)?d:u,m,p;return c==="horizontal"?(m=lo(e,"xAxis",o,r),p=oo(e,"xAxis",o,r)):(m=lo(e,"yAxis",l,r),p=oo(e,"yAxis",l,r)),(n=(s=Kd(m,p,!0))!==null&&s!==void 0?s:f)!==null&&n!==void 0?n:0},nO=(e,t,r)=>{var n=ot(e),s=Mi(e,t),i=Oi(e,t);if(!(s==null||i==null)){var o,l;return n==="horizontal"?(o=lo(e,"xAxis",s,r),l=oo(e,"xAxis",s,r)):(o=lo(e,"yAxis",i,r),l=oo(e,"yAxis",i,r)),Kd(o,l)}},bX=te([vX,t_,tU,r_,yX,nO,mX],EG),wX=(e,t,r)=>{var n=Mi(e,t);if(n!=null)return lo(e,"xAxis",n,r)},jX=(e,t,r)=>{var n=Oi(e,t);if(n!=null)return lo(e,"yAxis",n,r)},NX=(e,t,r)=>{var n=Mi(e,t);if(n!=null)return oo(e,"xAxis",n,r)},kX=(e,t,r)=>{var n=Oi(e,t);if(n!=null)return oo(e,"yAxis",n,r)},SX=te([bX,Dc],DG),CX=te([xX,Dc],AG),_X=te([Qt,lg,wX,jX,NX,kX,SX,ot,Y9,nO,CX,Dc,hX],(e,t,r,n,s,i,o,l,c,d,u,f,m)=>{var{chartData:p,dataStartIndex:x,dataEndIndex:g}=c;if(!(f==null||o==null||t==null||l!=="horizontal"&&l!=="vertical"||r==null||n==null||s==null||i==null||d==null)){var{data:v}=f,y;if(v!=null&&v.length>0?y=v:y=p==null?void 0:p.slice(x,g+1),y!=null)return tQ({layout:l,barSettings:f,pos:o,parentViewBox:t,bandSize:d,xAxis:r,yAxis:n,xAxisTicks:s,yAxisTicks:i,stackedData:u,displayedData:y,offset:e,cells:m,dataStartIndex:x})}}),MX=["index"];function Mp(){return Mp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Mp.apply(null,arguments)}function OX(e,t){if(e==null)return{};var r,n,s=PX(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function PX(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var aO=h.createContext(void 0),EX=e=>{var t=h.useContext(aO);if(t!=null)return t.stackId;if(e!=null)return a8(e)},AX=(e,t)=>"recharts-bar-stack-clip-path-".concat(e,"-").concat(t),DX=e=>{var t=h.useContext(aO);if(t!=null){var{stackId:r}=t;return"url(#".concat(AX(r,e),")")}},sO=e=>{var{index:t}=e,r=OX(e,MX),n=DX(t);return h.createElement(Aa,Mp({className:"recharts-bar-stack-layer",clipPath:n},r))},TX=["onMouseEnter","onMouseLeave","onClick"],IX=["value","background","tooltipPosition"],RX=["id"],$X=["onMouseEnter","onClick","onMouseLeave"];function La(){return La=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},La.apply(null,arguments)}function ij(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function jr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ij(Object(r),!0).forEach(function(n){zX(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ij(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function zX(e,t,r){return(t=LX(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function LX(e){var t=FX(e,"string");return typeof t=="symbol"?t:t+""}function FX(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ku(e,t){if(e==null)return{};var r,n,s=BX(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function BX(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var WX=e=>{var{dataKey:t,name:r,fill:n,legendType:s,hide:i}=e;return[{inactive:i,dataKey:t,type:s,color:n,value:O2(r,t),payload:e}]},UX=h.memo(e=>{var{dataKey:t,stroke:r,strokeWidth:n,fill:s,name:i,hide:o,unit:l,tooltipType:c,id:d}=e,u={dataDefinedOnItem:void 0,getPosition:_o,settings:{stroke:r,strokeWidth:n,fill:s,dataKey:t,nameKey:void 0,name:O2(i,t),hide:o,type:c,color:s,unit:l,graphicalItemId:d}};return h.createElement(ZY,{tooltipEntrySettings:u})});function qX(e){var t=Ae(co),{data:r,dataKey:n,background:s,allOtherBarProps:i}=e,{onMouseEnter:o,onMouseLeave:l,onClick:c}=i,d=ku(i,TX),u=qM(o,n,i.id),f=HM(l),m=KM(c,n,i.id);if(!s||r==null)return null;var p=Lx(s);return h.createElement(ts,{zIndex:TG(s,Sr.barBackground)},r.map((x,g)=>{var{value:v,background:y,tooltipPosition:j}=x,N=ku(x,IX);if(!y)return null;var w=u(x,g),k=f(x,g),b=m(x,g),C=jr(jr(jr(jr(jr({option:s,isActive:String(g)===t},N),{},{fill:"#eee"},y),p),qx(d,x,g)),{},{onMouseEnter:w,onMouseLeave:k,onClick:b,dataKey:n,index:g,className:"recharts-bar-background-rectangle"});return h.createElement(Nu,La({key:"background-bar-".concat(g)},C))}))}function HX(e){var{showLabels:t,children:r,rects:n}=e,s=n==null?void 0:n.map(i=>{var o={x:i.x,y:i.y,width:i.width,lowerWidth:i.width,upperWidth:i.width,height:i.height};return jr(jr({},o),{},{value:i.value,payload:i.payload,parentViewBox:i.parentViewBox,viewBox:o,fill:i.fill})});return h.createElement(kY,{value:t?s:void 0},r)}function KX(e){var{shape:t,activeBar:r,baseProps:n,entry:s,index:i,dataKey:o}=e,l=Ae(co),c=Ae(mM),d=r&&String(i)===l&&(c==null||o===c),u=d?r:t;return d?h.createElement(ts,{zIndex:Sr.activeBar},h.createElement(sO,{index:i},h.createElement(Nu,La({},n,{name:String(n.name)},s,{isActive:d,option:u,index:i,dataKey:o})))):h.createElement(Nu,La({},n,{name:String(n.name)},s,{isActive:d,option:u,index:i,dataKey:o}))}function YX(e){var{shape:t,baseProps:r,entry:n,index:s,dataKey:i}=e;return h.createElement(Nu,La({},r,{name:String(r.name)},n,{isActive:!1,option:t,index:s,dataKey:i}))}function GX(e){var t,{data:r,props:n}=e,s=(t=Ea(n))!==null&&t!==void 0?t:{},{id:i}=s,o=ku(s,RX),{shape:l,dataKey:c,activeBar:d}=n,{onMouseEnter:u,onClick:f,onMouseLeave:m}=n,p=ku(n,$X),x=qM(u,c,i),g=HM(m),v=KM(f,c,i);return r?h.createElement(h.Fragment,null,r.map((y,j)=>h.createElement(sO,La({index:j,key:"rectangle-".concat(y==null?void 0:y.x,"-").concat(y==null?void 0:y.y,"-").concat(y==null?void 0:y.value,"-").concat(j),className:"recharts-bar-rectangle"},qx(p,y,j),{onMouseEnter:x(y,j),onMouseLeave:g(y,j),onClick:v(y,j)}),d?h.createElement(KX,{shape:l,activeBar:d,baseProps:o,entry:y,index:j,dataKey:c}):h.createElement(YX,{shape:l,baseProps:o,entry:y,index:j,dataKey:c})))):null}function VX(e){var{props:t,previousRectanglesRef:r}=e,{data:n,layout:s,isAnimationActive:i,animationBegin:o,animationDuration:l,animationEasing:c,onAnimationEnd:d,onAnimationStart:u}=t,f=r.current,m=hg(t,"recharts-bar-"),[p,x]=h.useState(!1),g=!p,v=h.useCallback(()=>{typeof d=="function"&&d(),x(!1)},[d]),y=h.useCallback(()=>{typeof u=="function"&&u(),x(!0)},[u]);return h.createElement(HX,{showLabels:g,rects:n},h.createElement(mg,{animationId:m,begin:o,duration:l,isActive:i,easing:c,onAnimationEnd:v,onAnimationStart:y,key:m},j=>{var N=j===1?n:n==null?void 0:n.map((w,k)=>{var b=f&&f[k];if(b)return jr(jr({},w),{},{x:cr(b.x,w.x,j),y:cr(b.y,w.y,j),width:cr(b.width,w.width,j),height:cr(b.height,w.height,j)});if(s==="horizontal"){var C=cr(0,w.height,j),_=cr(w.stackedBarStart,w.y,j);return jr(jr({},w),{},{y:_,height:C})}var S=cr(0,w.width,j),I=cr(w.stackedBarStart,w.x,j);return jr(jr({},w),{},{width:S,x:I})});return j>0&&(r.current=N??null),N==null?null:h.createElement(Aa,null,h.createElement(GX,{props:t,data:N}))}),h.createElement(_Y,{label:t.label}),t.children)}function XX(e){var t=h.useRef(null);return h.createElement(VX,{previousRectanglesRef:t,props:e})}var iO=0,QX=(e,t)=>{var r=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:r,errorVal:fr(e,t)}};class ZX extends h.PureComponent{render(){var{hide:t,data:r,dataKey:n,className:s,xAxisId:i,yAxisId:o,needClip:l,background:c,id:d}=this.props;if(t||r==null)return null;var u=it("recharts-bar",s),f=d;return h.createElement(Aa,{className:u,id:d},l&&h.createElement("defs",null,h.createElement($V,{clipPathId:f,xAxisId:i,yAxisId:o})),h.createElement(Aa,{className:"recharts-bar-rectangles",clipPath:l?"url(#clipPath-".concat(f,")"):void 0},h.createElement(qX,{data:r,dataKey:n,background:c,allOtherBarProps:this.props}),h.createElement(XX,this.props)))}}var JX={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:iO,xAxisId:0,yAxisId:0,zIndex:Sr.bar};function eQ(e){var{xAxisId:t,yAxisId:r,hide:n,legendType:s,minPointSize:i,activeBar:o,animationBegin:l,animationDuration:c,animationEasing:d,isAnimationActive:u}=e,{needClip:f}=rO(t,r),m=Mo(),p=Xr(),x=TY(e.children,kM),g=Ae(j=>_X(j,e.id,p,x));if(m!=="vertical"&&m!=="horizontal")return null;var v,y=g==null?void 0:g[0];return y==null||y.height==null||y.width==null?v=0:v=m==="vertical"?y.height/2:y.width/2,h.createElement(RV,{xAxisId:t,yAxisId:r,data:g,dataPointFormatter:QX,errorBarOffset:v},h.createElement(ZX,La({},e,{layout:m,needClip:f,data:g,xAxisId:t,yAxisId:r,hide:n,legendType:s,minPointSize:i,activeBar:o,animationBegin:l,animationDuration:c,animationEasing:d,isAnimationActive:u})))}function tQ(e){var{layout:t,barSettings:{dataKey:r,minPointSize:n},pos:s,bandSize:i,xAxis:o,yAxis:l,xAxisTicks:c,yAxisTicks:d,stackedData:u,displayedData:f,offset:m,cells:p,parentViewBox:x,dataStartIndex:g}=e,v=t==="horizontal"?l:o,y=u?v.scale.domain():null,j=s8({numericAxis:v}),N=v.scale.map(j);return f.map((w,k)=>{var b,C,_,S,I,A;if(u){var O=u[k+g];if(O==null)return null;b=JF(O,y)}else b=fr(w,r),Array.isArray(b)||(b=[j,b]);var L=dX(n,iO)(b[1],k);if(t==="horizontal"){var F,X=l.scale.map(b[0]),T=l.scale.map(b[1]);if(X==null||T==null)return null;C=x0({axis:o,ticks:c,bandSize:i,offset:s.offset,entry:w,index:k}),_=(F=T??X)!==null&&F!==void 0?F:void 0,S=s.size;var G=X-T;if(I=ra(G)?0:G,A={x:C,y:m.top,width:S,height:m.height},Math.abs(L)>0&&Math.abs(I)<Math.abs(L)){var re=Fr(I||L)*(Math.abs(L)-Math.abs(I));_-=re,I+=re}}else{var J=o.scale.map(b[0]),P=o.scale.map(b[1]);if(J==null||P==null)return null;if(C=J,_=x0({axis:l,ticks:d,bandSize:i,offset:s.offset,entry:w,index:k}),S=P-J,I=s.size,A={x:m.left,y:_,width:m.width,height:I},Math.abs(L)>0&&Math.abs(S)<Math.abs(L)){var M=Fr(S||L)*(Math.abs(L)-Math.abs(S));S+=M}}if(C==null||_==null||S==null||I==null)return null;var R=jr(jr({},w),{},{stackedBarStart:N,x:C,y:_,width:S,height:I,value:u?b:b[1],payload:w,background:A,tooltipPosition:{x:C+S/2,y:_+I/2},parentViewBox:x},p&&p[k]&&p[k].props);return R}).filter(Boolean)}function rQ(e){var t=sn(e,JX),r=EX(t.stackId),n=Xr();return h.createElement(aG,{id:t.id,type:"bar"},s=>h.createElement(h.Fragment,null,h.createElement(JY,{legendPayload:WX(t)}),h.createElement(UX,{dataKey:t.dataKey,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:s}),h.createElement(uG,{type:"bar",id:s,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:r,hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:n}),h.createElement(ts,{zIndex:t.zIndex},h.createElement(eQ,La({},t,{id:s})))))}var Wl=h.memo(rQ,yv);Wl.displayName="Bar";var nQ=["domain","range"],aQ=["domain","range"];function oj(e,t){if(e==null)return{};var r,n,s=sQ(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function sQ(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function lj(e,t){return e===t?!0:Array.isArray(e)&&e.length===2&&Array.isArray(t)&&t.length===2?e[0]===t[0]&&e[1]===t[1]:!1}function oO(e,t){if(e===t)return!0;var{domain:r,range:n}=e,s=oj(e,nQ),{domain:i,range:o}=t,l=oj(t,aQ);return!lj(r,i)||!lj(n,o)?!1:yv(s,l)}var iQ=["type"],oQ=["dangerouslySetInnerHTML","ticks","scale"],lQ=["id","scale"];function Op(){return Op=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Op.apply(null,arguments)}function cj(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function dj(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?cj(Object(r),!0).forEach(function(n){cQ(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):cj(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function cQ(e,t,r){return(t=dQ(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dQ(e){var t=uQ(e,"string");return typeof t=="symbol"?t:t+""}function uQ(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Pp(e,t){if(e==null)return{};var r,n,s=fQ(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function fQ(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function mQ(e){var t=Et(),r=h.useRef(null),n=F2(),{type:s}=e,i=Pp(e,iQ),o=Kf(n,"xAxis",s),l=h.useMemo(()=>{if(o!=null)return dj(dj({},i),{},{type:o})},[i,o]);return h.useLayoutEffect(()=>{l!=null&&(r.current===null?t(xG(l)):r.current!==l&&t(gG({prev:r.current,next:l})),r.current=l)},[l,t]),h.useLayoutEffect(()=>()=>{r.current&&(t(vG(r.current)),r.current=null)},[t]),null}var hQ=e=>{var{xAxisId:t,className:r}=e,n=Ae(lg),s=Xr(),i="xAxis",o=Ae(y=>K_(y,i,t,s)),l=Ae(y=>W_(y,t)),c=Ae(y=>nq(y,t)),d=Ae(y=>u_(y,t));if(l==null||c==null||d==null)return null;var{dangerouslySetInnerHTML:u,ticks:f,scale:m}=e,p=Pp(e,oQ),{id:x,scale:g}=d,v=Pp(d,lQ);return h.createElement(vv,Op({},p,v,{x:c.x,y:c.y,width:l.width,height:l.height,className:it("recharts-".concat(i," ").concat(i),r),viewBox:n,ticks:o,axisType:i}))},pQ={allowDataOverflow:Yt.allowDataOverflow,allowDecimals:Yt.allowDecimals,allowDuplicatedCategory:Yt.allowDuplicatedCategory,angle:Yt.angle,axisLine:Ca.axisLine,height:Yt.height,hide:!1,includeHidden:Yt.includeHidden,interval:Yt.interval,label:!1,minTickGap:Yt.minTickGap,mirror:Yt.mirror,orientation:Yt.orientation,padding:Yt.padding,reversed:Yt.reversed,scale:Yt.scale,tick:Yt.tick,tickCount:Yt.tickCount,tickLine:Ca.tickLine,tickSize:Ca.tickSize,type:Yt.type,xAxisId:0},xQ=e=>{var t=sn(e,pQ);return h.createElement(h.Fragment,null,h.createElement(mQ,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit}),h.createElement(hQ,t))},Ul=h.memo(xQ,oO);Ul.displayName="XAxis";var gQ=["type"],vQ=["dangerouslySetInnerHTML","ticks","scale"],yQ=["id","scale"];function Ep(){return Ep=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ep.apply(null,arguments)}function uj(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function fj(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?uj(Object(r),!0).forEach(function(n){bQ(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):uj(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function bQ(e,t,r){return(t=wQ(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wQ(e){var t=jQ(e,"string");return typeof t=="symbol"?t:t+""}function jQ(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ap(e,t){if(e==null)return{};var r,n,s=NQ(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function NQ(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function kQ(e){var t=Et(),r=h.useRef(null),n=F2(),{type:s}=e,i=Ap(e,gQ),o=Kf(n,"yAxis",s),l=h.useMemo(()=>{if(o!=null)return fj(fj({},i),{},{type:o})},[o,i]);return h.useLayoutEffect(()=>{l!=null&&(r.current===null?t(yG(l)):r.current!==l&&t(bG({prev:r.current,next:l})),r.current=l)},[l,t]),h.useLayoutEffect(()=>()=>{r.current&&(t(wG(r.current)),r.current=null)},[t]),null}function SQ(e){var{yAxisId:t,className:r,width:n,label:s}=e,i=h.useRef(null),o=h.useRef(null),l=Ae(lg),c=Xr(),d=Et(),u="yAxis",f=Ae(b=>U_(b,t)),m=Ae(b=>sq(b,t)),p=Ae(b=>K_(b,u,t,c)),x=Ae(b=>f_(b,t));if(h.useLayoutEffect(()=>{if(!(n!=="auto"||!f||hv(s)||h.isValidElement(s)||x==null)){var b=i.current;if(b){var C=b.getCalculatedWidth();Math.round(f.width)!==Math.round(C)&&d(jG({id:t,width:C}))}}},[p,f,d,s,t,n,x]),f==null||m==null||x==null)return null;var{dangerouslySetInnerHTML:g,ticks:v,scale:y}=e,j=Ap(e,vQ),{id:N,scale:w}=x,k=Ap(x,yQ);return h.createElement(vv,Ep({},j,k,{ref:i,labelRef:o,x:m.x,y:m.y,tickTextProps:n==="auto"?{width:void 0}:{width:n},width:f.width,height:f.height,className:it("recharts-".concat(u," ").concat(u),r),viewBox:l,ticks:p,axisType:u}))}var CQ={allowDataOverflow:Gt.allowDataOverflow,allowDecimals:Gt.allowDecimals,allowDuplicatedCategory:Gt.allowDuplicatedCategory,angle:Gt.angle,axisLine:Ca.axisLine,hide:!1,includeHidden:Gt.includeHidden,interval:Gt.interval,label:!1,minTickGap:Gt.minTickGap,mirror:Gt.mirror,orientation:Gt.orientation,padding:Gt.padding,reversed:Gt.reversed,scale:Gt.scale,tick:Gt.tick,tickCount:Gt.tickCount,tickLine:Ca.tickLine,tickSize:Ca.tickSize,type:Gt.type,width:Gt.width,yAxisId:0},_Q=e=>{var t=sn(e,CQ);return h.createElement(h.Fragment,null,h.createElement(kQ,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter}),h.createElement(SQ,t))},ql=h.memo(_Q,oO);ql.displayName="YAxis";var MQ=(e,t)=>t,bv=te([MQ,ot,c_,er,cM,es,yH,Qt],CH),wv=e=>{var t=e.currentTarget.getBoundingClientRect(),r=t.width/e.currentTarget.offsetWidth,n=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/r),chartY:Math.round((e.clientY-t.top)/n)}},lO=pn("mouseClick"),cO=vc();cO.startListening({actionCreator:lO,effect:(e,t)=>{var r=e.payload,n=bv(t.getState(),wv(r));(n==null?void 0:n.activeIndex)!=null&&t.dispatch(yq({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate}))}});var Dp=pn("mouseMove"),dO=vc(),dd=null;dO.startListening({actionCreator:Dp,effect:(e,t)=>{var r=e.payload;dd!==null&&cancelAnimationFrame(dd);var n=wv(r);dd=requestAnimationFrame(()=>{var s=t.getState(),i=nv(s,s.tooltip.settings.shared);if(i==="axis"){var o=bv(s,n);(o==null?void 0:o.activeIndex)!=null?t.dispatch(eM({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate})):t.dispatch(J_())}dd=null})}});function OQ(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<<CHILDREN>>":t}var mj={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},uO=Vr({name:"rootProps",initialState:mj,reducers:{updateOptions:(e,t)=>{var r;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(r=t.payload.barGap)!==null&&r!==void 0?r:mj.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),PQ=uO.reducer,{updateOptions:EQ}=uO.actions,AQ=null,DQ={updatePolarOptions:(e,t)=>t.payload},fO=Vr({name:"polarOptions",initialState:AQ,reducers:DQ}),{updatePolarOptions:Gte}=fO.actions,TQ=fO.reducer,mO=pn("keyDown"),hO=pn("focus"),jv=vc();jv.startListening({actionCreator:mO,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:s}=r.tooltip,i=e.payload;if(!(i!=="ArrowRight"&&i!=="ArrowLeft"&&i!=="Enter")){var o=av(s,$o(r),Mc(r),Pc(r)),l=o==null?-1:Number(o);if(!(!Number.isFinite(l)||l<0)){var c=es(r);if(i==="Enter"){var d=gu(r,"axis","hover",String(s.index));t.dispatch(Np({active:!s.active,activeIndex:s.index,activeCoordinate:d}));return}var u=cq(r),f=u==="left-to-right"?1:-1,m=i==="ArrowRight"?1:-1,p=l+m*f;if(!(c==null||p>=c.length||p<0)){var x=gu(r,"axis","hover",String(p));t.dispatch(Np({active:!0,activeIndex:p.toString(),activeCoordinate:x}))}}}}}});jv.startListening({actionCreator:hO,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:s}=r.tooltip;if(!s.active&&s.index==null){var i="0",o=gu(r,"axis","hover",String(i));t.dispatch(Np({active:!0,activeIndex:i,activeCoordinate:o}))}}}});var cn=pn("externalEvent"),pO=vc(),dh=new Map;pO.startListening({actionCreator:cn,effect:(e,t)=>{var{handler:r,reactEvent:n}=e.payload;if(r!=null){n.persist();var s=n.type,i=dh.get(s);i!==void 0&&cancelAnimationFrame(i);var o=requestAnimationFrame(()=>{try{var l=t.getState(),c={activeCoordinate:aH(l),activeDataKey:mM(l),activeIndex:co(l),activeLabel:fM(l),activeTooltipIndex:co(l),isTooltipActive:sH(l)};r(c,n)}finally{dh.delete(s)}});dh.set(s,o)}}});var IQ=te([Io],e=>e.tooltipItemPayloads),RQ=te([IQ,(e,t)=>t,(e,t,r)=>r],(e,t,r)=>{if(t!=null){var n=e.find(i=>i.settings.graphicalItemId===r);if(n!=null){var{getPosition:s}=n;if(s!=null)return s(t)}}}),xO=pn("touchMove"),gO=vc();gO.startListening({actionCreator:xO,effect:(e,t)=>{var r=e.payload;if(!(r.touches==null||r.touches.length===0)){var n=t.getState(),s=nv(n,n.tooltip.settings.shared);if(s==="axis"){var i=r.touches[0];if(i==null)return;var o=bv(n,wv({clientX:i.clientX,clientY:i.clientY,currentTarget:r.currentTarget}));(o==null?void 0:o.activeIndex)!=null&&t.dispatch(eM({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if(s==="item"){var l,c=r.touches[0];if(document.elementFromPoint==null||c==null)return;var d=document.elementFromPoint(c.clientX,c.clientY);if(!d||!d.getAttribute)return;var u=d.getAttribute(f8),f=(l=d.getAttribute(m8))!==null&&l!==void 0?l:void 0,m=Ro(n).find(g=>g.id===f);if(u==null||m==null||f==null)return;var{dataKey:p}=m,x=RQ(n,u,f);t.dispatch(Z_({activeDataKey:p,activeIndex:u,activeCoordinate:x,activeGraphicalItemId:f}))}}}});var $Q=ZS({brush:RG,cartesianAxis:NG,chartData:nK,errorBars:PV,graphicalItems:cG,layout:GF,legend:eB,options:ZH,polarAxis:OY,polarOptions:TQ,referenceElements:FG,rootProps:PQ,tooltip:bq,zIndex:FH}),zQ=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return yF({reducer:$Q,preloadedState:t,middleware:n=>{var s;return n({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((s="es6")!==null&&s!==void 0?s:"")}).concat([cO.middleware,dO.middleware,jv.middleware,pO.middleware,gO.middleware])},enhancers:n=>{var s=n;return typeof n=="function"&&(s=n()),s.concat(m2({type:"raf"}))},devTools:{serialize:{replacer:OQ},name:"recharts-".concat(r)}})};function LQ(e){var{preloadedState:t,children:r,reduxStoreName:n}=e,s=Xr(),i=h.useRef(null);if(s)return r;i.current==null&&(i.current=zQ(t,n));var o=Jx;return h.createElement(sX,{context:o,store:i.current},r)}function FQ(e){var{layout:t,margin:r}=e,n=Et(),s=Xr();return h.useEffect(()=>{s||(n(HF(t)),n(qF(r)))},[n,s,t,r]),null}var BQ=h.memo(FQ,yv);function WQ(e){var t=Et();return h.useEffect(()=>{t(EQ(e))},[t,e]),null}function hj(e){var{zIndex:t,isPanorama:r}=e,n=h.useRef(null),s=Et();return h.useLayoutEffect(()=>(n.current&&s(zH({zIndex:t,element:n.current,isPanorama:r})),()=>{s(LH({zIndex:t,isPanorama:r}))}),[s,t,r]),h.createElement("g",{tabIndex:-1,ref:n})}function pj(e){var{children:t,isPanorama:r}=e,n=Ae(MH);if(!n||n.length===0)return t;var s=n.filter(o=>o<0),i=n.filter(o=>o>0);return h.createElement(h.Fragment,null,s.map(o=>h.createElement(hj,{key:o,zIndex:o,isPanorama:r})),t,i.map(o=>h.createElement(hj,{key:o,zIndex:o,isPanorama:r})))}var UQ=["children"];function qQ(e,t){if(e==null)return{};var r,n,s=HQ(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function HQ(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function Su(){return Su=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Su.apply(null,arguments)}var KQ={width:"100%",height:"100%",display:"block"},YQ=h.forwardRef((e,t)=>{var r=z2(),n=L2(),s=V2();if(!aa(r)||!aa(n))return null;var{children:i,otherAttributes:o,title:l,desc:c}=e,d,u;return o!=null&&(typeof o.tabIndex=="number"?d=o.tabIndex:d=s?0:void 0,typeof o.role=="string"?u=o.role:u=s?"application":void 0),h.createElement(nS,Su({},o,{title:l,desc:c,role:u,tabIndex:d,width:r,height:n,style:KQ,ref:t}),i)}),GQ=e=>{var{children:t}=e,r=Ae(Af);if(!r)return null;var{width:n,height:s,y:i,x:o}=r;return h.createElement(nS,{width:n,height:s,x:o,y:i},t)},xj=h.forwardRef((e,t)=>{var{children:r}=e,n=qQ(e,UQ),s=Xr();return s?h.createElement(GQ,null,h.createElement(pj,{isPanorama:!0},r)):h.createElement(YQ,Su({ref:t},n),h.createElement(pj,{isPanorama:!1},r))});function VQ(){var e=Et(),[t,r]=h.useState(null),n=Ae(u8);return h.useEffect(()=>{if(t!=null){var s=t.getBoundingClientRect(),i=s.width/t.offsetWidth;Ge(i)&&i!==n&&e(YF(i))}},[t,e,n]),r}function gj(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function XQ(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?gj(Object(r),!0).forEach(function(n){QQ(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gj(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function QQ(e,t,r){return(t=ZQ(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ZQ(e){var t=JQ(e,"string");return typeof t=="symbol"?t:t+""}function JQ(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vs(){return vs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},vs.apply(null,arguments)}var eZ=()=>(fK(),null);function Cu(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var tZ=h.forwardRef((e,t)=>{var r,n,s=h.useRef(null),[i,o]=h.useState({containerWidth:Cu((r=e.style)===null||r===void 0?void 0:r.width),containerHeight:Cu((n=e.style)===null||n===void 0?void 0:n.height)}),l=h.useCallback((d,u)=>{o(f=>{var m=Math.round(d),p=Math.round(u);return f.containerWidth===m&&f.containerHeight===p?f:{containerWidth:m,containerHeight:p}})},[]),c=h.useCallback(d=>{if(typeof t=="function"&&t(d),d!=null&&typeof ResizeObserver<"u"){var{width:u,height:f}=d.getBoundingClientRect();l(u,f);var m=x=>{var g=x[0];if(g!=null){var{width:v,height:y}=g.contentRect;l(v,y)}},p=new ResizeObserver(m);p.observe(d),s.current=p}},[t,l]);return h.useEffect(()=>()=>{var d=s.current;d!=null&&d.disconnect()},[l]),h.createElement(h.Fragment,null,h.createElement(bc,{width:i.containerWidth,height:i.containerHeight}),h.createElement("div",vs({ref:c},e)))}),rZ=h.forwardRef((e,t)=>{var{width:r,height:n}=e,[s,i]=h.useState({containerWidth:Cu(r),containerHeight:Cu(n)}),o=h.useCallback((c,d)=>{i(u=>{var f=Math.round(c),m=Math.round(d);return u.containerWidth===f&&u.containerHeight===m?u:{containerWidth:f,containerHeight:m}})},[]),l=h.useCallback(c=>{if(typeof t=="function"&&t(c),c!=null){var{width:d,height:u}=c.getBoundingClientRect();o(d,u)}},[t,o]);return h.createElement(h.Fragment,null,h.createElement(bc,{width:s.containerWidth,height:s.containerHeight}),h.createElement("div",vs({ref:l},e)))}),nZ=h.forwardRef((e,t)=>{var{width:r,height:n}=e;return h.createElement(h.Fragment,null,h.createElement(bc,{width:r,height:n}),h.createElement("div",vs({ref:t},e)))}),aZ=h.forwardRef((e,t)=>{var{width:r,height:n}=e;return typeof r=="string"||typeof n=="string"?h.createElement(rZ,vs({},e,{ref:t})):typeof r=="number"&&typeof n=="number"?h.createElement(nZ,vs({},e,{width:r,height:n,ref:t})):h.createElement(h.Fragment,null,h.createElement(bc,{width:r,height:n}),h.createElement("div",vs({ref:t},e)))});function sZ(e){return e?tZ:aZ}var iZ=h.forwardRef((e,t)=>{var{children:r,className:n,height:s,onClick:i,onContextMenu:o,onDoubleClick:l,onMouseDown:c,onMouseEnter:d,onMouseLeave:u,onMouseMove:f,onMouseUp:m,onTouchEnd:p,onTouchMove:x,onTouchStart:g,style:v,width:y,responsive:j,dispatchTouchEvents:N=!0}=e,w=h.useRef(null),k=Et(),[b,C]=h.useState(null),[_,S]=h.useState(null),I=VQ(),A=cg(),O=(A==null?void 0:A.width)>0?A.width:y,L=(A==null?void 0:A.height)>0?A.height:s,F=h.useCallback(B=>{I(B),typeof t=="function"&&t(B),C(B),S(B),B!=null&&(w.current=B)},[I,t,C,S]),X=h.useCallback(B=>{k(lO(B)),k(cn({handler:i,reactEvent:B}))},[k,i]),T=h.useCallback(B=>{k(Dp(B)),k(cn({handler:d,reactEvent:B}))},[k,d]),G=h.useCallback(B=>{k(J_()),k(cn({handler:u,reactEvent:B}))},[k,u]),re=h.useCallback(B=>{k(Dp(B)),k(cn({handler:f,reactEvent:B}))},[k,f]),J=h.useCallback(()=>{k(hO())},[k]),P=h.useCallback(B=>{k(mO(B.key))},[k]),M=h.useCallback(B=>{k(cn({handler:o,reactEvent:B}))},[k,o]),R=h.useCallback(B=>{k(cn({handler:l,reactEvent:B}))},[k,l]),q=h.useCallback(B=>{k(cn({handler:c,reactEvent:B}))},[k,c]),$=h.useCallback(B=>{k(cn({handler:m,reactEvent:B}))},[k,m]),K=h.useCallback(B=>{k(cn({handler:g,reactEvent:B}))},[k,g]),D=h.useCallback(B=>{N&&k(xO(B)),k(cn({handler:x,reactEvent:B}))},[k,N,x]),E=h.useCallback(B=>{k(cn({handler:p,reactEvent:B}))},[k,p]),Z=sZ(j);return h.createElement(bM.Provider,{value:b},h.createElement(Pz.Provider,{value:_},h.createElement(Z,{width:O??(v==null?void 0:v.width),height:L??(v==null?void 0:v.height),className:it("recharts-wrapper",n),style:XQ({position:"relative",cursor:"default",width:O,height:L},v),onClick:X,onContextMenu:M,onDoubleClick:R,onFocus:J,onKeyDown:P,onMouseDown:q,onMouseEnter:T,onMouseLeave:G,onMouseMove:re,onMouseUp:$,onTouchEnd:E,onTouchMove:D,onTouchStart:K,ref:F},h.createElement(eZ,null),r)))}),oZ=["width","height","responsive","children","className","style","compact","title","desc"];function lZ(e,t){if(e==null)return{};var r,n,s=cZ(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function cZ(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var dZ=h.forwardRef((e,t)=>{var{width:r,height:n,responsive:s,children:i,className:o,style:l,compact:c,title:d,desc:u}=e,f=lZ(e,oZ),m=Ea(f);return c?h.createElement(h.Fragment,null,h.createElement(bc,{width:r,height:n}),h.createElement(xj,{otherAttributes:m,title:d,desc:u},i)):h.createElement(iZ,{className:o,style:l,width:r,height:n,responsive:s??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},h.createElement(xj,{otherAttributes:m,title:d,desc:u,ref:t},h.createElement(WG,null,i)))});function Tp(){return Tp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Tp.apply(null,arguments)}var uZ={top:5,right:5,bottom:5,left:5},fZ={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:uZ,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},mZ=h.forwardRef(function(t,r){var n,s=sn(t.categoricalChartProps,fZ),{chartName:i,defaultTooltipEventType:o,validateTooltipEventTypes:l,tooltipPayloadSearcher:c,categoricalChartProps:d}=t,u={chartName:i,defaultTooltipEventType:o,validateTooltipEventTypes:l,tooltipPayloadSearcher:c,eventEmitter:void 0};return h.createElement(LQ,{preloadedState:{options:u},reduxStoreName:(n=d.id)!==null&&n!==void 0?n:i},h.createElement(IG,{chartData:d.data}),h.createElement(BQ,{layout:s.layout,margin:s.margin}),h.createElement(WQ,{baseValue:s.baseValue,accessibilityLayer:s.accessibilityLayer,barCategoryGap:s.barCategoryGap,maxBarSize:s.maxBarSize,stackOffset:s.stackOffset,barGap:s.barGap,barSize:s.barSize,syncId:s.syncId,syncMethod:s.syncMethod,className:s.className,reverseStackOrder:s.reverseStackOrder}),h.createElement(dZ,Tp({},s,{ref:r})))}),hZ=["axis","item"],_u=h.forwardRef((e,t)=>h.createElement(mZ,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:hZ,tooltipPayloadSearcher:XH,categoricalChartProps:e,ref:t}));const vO={all:["reporting"],timeLogs:e=>[...vO.all,"time-logs",e]};function yO(e,t){return Be({queryKey:vO.timeLogs(e),queryFn:()=>{const r=new URLSearchParams;return Object.entries(e).forEach(([n,s])=>{s&&(n==="workspace_ids"&&Array.isArray(s)?s.length>0&&r.set("workspace_ids",s.join(",")):typeof s=="string"&&r.set(n,s))}),oe.get(`/admin/reporting/time-logs?${r}`)},enabled:(t==null?void 0:t.enabled)??(Object.values(e).some(Boolean)||!!e.workspace_id)})}function Mu({value:e,onChange:t,placeholder:r="Pick a date",className:n}){return a.jsxs(Ot,{children:[a.jsx(Pt,{asChild:!0,children:a.jsxs(ne,{variant:"outline",className:z("h-8 w-36 justify-start text-left font-normal text-xs gap-1.5",!e&&"text-muted-foreground",n),children:[a.jsx(Wt,{className:"h-3.5 w-3.5 shrink-0"}),e?fe(e,"MMM d, yyyy"):a.jsx("span",{children:r}),e&&a.jsx("span",{role:"button",className:"ml-auto hover:text-foreground",onClick:s=>{s.stopPropagation(),t(void 0)},children:a.jsx(tt,{className:"h-3 w-3"})})]})}),a.jsx(_t,{className:"w-auto p-0",align:"start",children:a.jsx(gr,{mode:"single",selected:e,onSelect:t,initialFocus:!0})})]})}function hl(e){const t=Math.floor(e/60),r=e%60;return t===0?`${r}m`:r===0?`${t}h`:`${t}h ${r}m`}function vj({active:e,payload:t,label:r}){var n;return!e||!(t!=null&&t.length)?null:a.jsxs("div",{className:"bg-popover border border-border rounded-lg px-3 py-2 text-xs shadow-lg",children:[a.jsx("p",{className:"font-medium mb-0.5",children:r}),a.jsx("p",{className:"text-muted-foreground",children:hl(((n=t[0])==null?void 0:n.value)??0)})]})}function pZ({workspaceId:e}){const[t,r]=h.useState(void 0),[n,s]=h.useState(void 0),[i,o]=h.useState([]),[l,c]=h.useState([]),[d,u]=h.useState([]),{workspace:f}=Ie(),m=(f==null?void 0:f.slug)??"",{data:p=[],isLoading:x}=Nx(),{data:g=[],isLoading:v}=vo(),{data:y=[],isLoading:j}=xo(),{data:N}=ks(),w=t?fe(t,"yyyy-MM-dd"):void 0,k=n?fe(n,"yyyy-MM-dd"):void 0,b=h.useMemo(()=>new Map(g.map(P=>[P.id,P])),[g]),C=e?[e]:d.length>0?d:void 0,{data:_,isLoading:S}=yO({from:w,to:k,workspace_id:e,workspace_ids:C},{enabled:!0}),I=(_==null?void 0:_.time_logs)??[],A=h.useMemo(()=>{let P=I;return v||(P=P.filter(M=>!M.project_id||b.has(M.project_id))),i.length>0&&(P=P.filter(M=>i.includes(M.user_id))),l.length>0&&(P=P.filter(M=>M.project_id&&l.includes(M.project_id))),P},[I,i,l,b,v]),O=A.reduce((P,M)=>P+(M.duration_minutes??0),0),L=h.useMemo(()=>new Set(A.map(P=>P.user_id)).size,[A]),F=h.useMemo(()=>new Set(A.map(P=>P.project_id).filter(Boolean)).size,[A]),X=h.useMemo(()=>{const P=new Map;for(const M of A)P.set(M.user_id,(P.get(M.user_id)??0)+(M.duration_minutes??0));return Array.from(P.entries()).map(([M,R])=>{var q;return{name:((q=N==null?void 0:N.get(M))==null?void 0:q.name)??"Unknown",minutes:R}}).sort((M,R)=>R.minutes-M.minutes).slice(0,8)},[A,N]),T=h.useMemo(()=>{const P=new Map;for(const M of A){const R=M.project_id??"__none__";P.set(R,(P.get(R)??0)+(M.duration_minutes??0))}return Array.from(P.entries()).map(([M,R])=>{var q;return{name:M==="__none__"?"No project":((q=b.get(M))==null?void 0:q.name)??"Unknown",minutes:R}}).sort((M,R)=>R.minutes-M.minutes).slice(0,8)},[A,b]),G=h.useMemo(()=>p.map(P=>({value:P.id,label:[P.first_name,P.last_name].filter(Boolean).join(" ")||P.email})),[p]),re=h.useMemo(()=>y.map(P=>({value:P.id,label:P.name})),[y]),J=h.useMemo(()=>g.map(P=>({value:P.id,label:P.name})),[g]);return a.jsxs("div",{className:"p-2 space-y-2",children:[a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl px-6 py-4 flex items-center gap-3",children:[a.jsx("div",{className:"h-9 w-9 rounded-lg bg-muted flex items-center justify-center shrink-0",children:a.jsx(ys,{className:"h-4 w-4 text-muted-foreground"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-semibold",children:"Time Logs"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Filter by date range, employees, and projects to analyze time across the organization."})]})]}),a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl px-4 py-3 flex flex-col gap-3 md:flex-row md:items-center md:flex-wrap",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0",children:[a.jsx(ni,{className:"h-3.5 w-3.5"}),a.jsx("span",{className:"font-medium",children:"Date range"})]}),a.jsx(Mu,{value:t,onChange:r,placeholder:"From"}),a.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"→"}),a.jsx(Mu,{value:n,onChange:s,placeholder:"To"})]}),!e&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"hidden md:block w-px h-5 bg-border mx-1 shrink-0"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0",children:[a.jsx(I1,{className:"h-3.5 w-3.5"}),a.jsx("span",{className:"font-medium",children:"Workspaces"})]}),j?a.jsx(le,{className:"h-8 w-40"}):a.jsx(vl,{options:re,selected:d,onSelectionChange:u,placeholder:"All workspaces",className:"w-44"})]})]}),a.jsx("div",{className:"hidden md:block w-px h-5 bg-border mx-1 shrink-0"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0",children:[a.jsx(ba,{className:"h-3.5 w-3.5"}),a.jsx("span",{className:"font-medium",children:"Employees"})]}),x?a.jsx(le,{className:"h-8 w-40"}):a.jsx(vl,{options:G,selected:i,onSelectionChange:o,placeholder:"All employees",className:"w-44"})]}),a.jsx("div",{className:"hidden md:block w-px h-5 bg-border mx-1 shrink-0"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0",children:[a.jsx(Hr,{className:"h-3.5 w-3.5"}),a.jsx("span",{className:"font-medium",children:"Projects"})]}),v?a.jsx(le,{className:"h-8 w-40"}):a.jsx(vl,{options:J,selected:l,onSelectionChange:c,placeholder:"All projects",className:"w-44"})]})]}),S?a.jsx("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden divide-y divide-border",children:[1,2,3,4].map(P=>a.jsxs("div",{className:"px-6 py-4 flex items-center gap-4",children:[a.jsx(le,{className:"h-4 w-24"}),a.jsx(le,{className:"h-4 w-32"}),a.jsx(le,{className:"h-4 w-48"})]},P))}):A.length===0?a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl flex flex-col items-center justify-center py-16 text-center",children:[a.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:a.jsx(Tn,{className:"h-5 w-5 text-muted-foreground"})}),a.jsx("p",{className:"text-sm font-medium mb-1",children:"No time logs found"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:w||k||i.length>0||l.length>0||d.length>0?"Try adjusting your filters.":"No time has been logged yet."})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl px-5 py-4",children:[a.jsx("p",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Total time"}),a.jsx("p",{className:"text-2xl font-bold tabular-nums",children:hl(O)})]}),a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl px-5 py-4",children:[a.jsx("p",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Employees"}),a.jsx("p",{className:"text-2xl font-bold tabular-nums",children:L})]}),a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl px-5 py-4",children:[a.jsx("p",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Projects"}),a.jsx("p",{className:"text-2xl font-bold tabular-nums",children:F})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[X.length>0&&a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(ba,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Time by employee"})]}),a.jsx(Gd,{width:"100%",height:Math.max(80,X.length*36),children:a.jsxs(_u,{data:X,layout:"vertical",margin:{left:0,right:40,top:0,bottom:0},children:[a.jsx(Bl,{strokeDasharray:"3 3",horizontal:!1,stroke:"hsl(var(--border))"}),a.jsx(Ul,{type:"number",tickFormatter:P=>hl(P),tick:{fontSize:9,fill:"hsl(var(--muted-foreground))"},axisLine:!1,tickLine:!1}),a.jsx(ql,{type:"category",dataKey:"name",width:100,tick:{fontSize:11,fill:"hsl(var(--foreground))"},axisLine:!1,tickLine:!1}),a.jsx(vu,{content:a.jsx(vj,{}),cursor:{fill:"hsl(var(--muted))"}}),a.jsx(Wl,{dataKey:"minutes",fill:"#6366f1",radius:[0,4,4,0]})]})})]}),T.length>0&&a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(Hr,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Time by project"})]}),a.jsx(Gd,{width:"100%",height:Math.max(80,T.length*36),children:a.jsxs(_u,{data:T,layout:"vertical",margin:{left:0,right:40,top:0,bottom:0},children:[a.jsx(Bl,{strokeDasharray:"3 3",horizontal:!1,stroke:"hsl(var(--border))"}),a.jsx(Ul,{type:"number",tickFormatter:P=>hl(P),tick:{fontSize:9,fill:"hsl(var(--muted-foreground))"},axisLine:!1,tickLine:!1}),a.jsx(ql,{type:"category",dataKey:"name",width:100,tick:{fontSize:11,fill:"hsl(var(--foreground))"},axisLine:!1,tickLine:!1}),a.jsx(vu,{content:a.jsx(vj,{}),cursor:{fill:"hsl(var(--muted))"}}),a.jsx(Wl,{dataKey:"minutes",fill:"#6366f1",radius:[0,4,4,0]})]})})]})]}),a.jsx("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border bg-muted/20",children:[a.jsx("th",{className:"text-left px-6 py-2.5 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Employee"}),a.jsx("th",{className:"text-left px-6 py-2.5 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Project"}),a.jsx("th",{className:"text-left px-6 py-2.5 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Issue"}),a.jsx("th",{className:"text-left px-6 py-2.5 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Date"}),a.jsx("th",{className:"text-left px-6 py-2.5 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Description"}),a.jsx("th",{className:"text-right px-6 py-2.5 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Duration"})]})}),a.jsx("tbody",{className:"divide-y divide-border",children:A.map(P=>{var q;const M=P.project_id?b.get(P.project_id):void 0,R=((q=N==null?void 0:N.get(P.user_id))==null?void 0:q.name)??P.user_id.slice(0,8)+"…";return a.jsxs("tr",{className:"hover:bg-muted/30 transition-colors",children:[a.jsx("td",{className:"px-6 py-3 text-xs font-medium",children:R}),a.jsx("td",{className:"px-6 py-3 text-xs text-muted-foreground",children:(M==null?void 0:M.name)??(P.project_id?"Unknown":"—")}),a.jsx("td",{className:"px-6 py-3",children:P.issue_identifier?a.jsx(qr,{to:`/${m}/projects/${M==null?void 0:M.identifier}/issues/${P.issue_id}`,className:"font-mono text-xs text-indigo-600 dark:text-indigo-400 hover:underline",children:P.issue_identifier}):a.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[P.issue_id.slice(0,8),"…"]})}),a.jsx("td",{className:"px-6 py-3 text-xs text-muted-foreground tabular-nums whitespace-nowrap",children:P.logged_date?fe(new Date(P.logged_date),"MMM d, yyyy"):"—"}),a.jsx("td",{className:"px-6 py-3 text-xs text-muted-foreground truncate max-w-xs",children:P.description??a.jsx("span",{className:"italic",children:"—"})}),a.jsx("td",{className:"px-6 py-3 text-xs text-right tabular-nums font-semibold",children:P.duration_minutes!=null?hl(P.duration_minutes):"Running…"})]},P.id)})})]})})]})]})}function Li(e){const t=Math.floor(e/60),r=e%60;return t===0?`${r}m`:r===0?`${t}h`:`${t}h ${r}m`}function yj({active:e,payload:t,label:r}){var n;return!e||!(t!=null&&t.length)?null:a.jsxs("div",{className:"bg-popover border border-border rounded-lg px-3 py-2 text-xs shadow-lg",children:[a.jsx("p",{className:"font-medium mb-0.5",children:r}),a.jsx("p",{className:"text-muted-foreground",children:Li(((n=t[0])==null?void 0:n.value)??0)})]})}function xZ(){const{projectKey:e,workspace:t}=zt(),[r,n]=h.useState(void 0),[s,i]=h.useState(void 0),[o,l]=h.useState([]),{data:c}=Wa(e??""),{data:d}=ks(),{data:u=[]}=Nx(),f=r?fe(r,"yyyy-MM-dd"):void 0,m=s?fe(s,"yyyy-MM-dd"):void 0,{data:p,isLoading:x}=yO({project_id:c==null?void 0:c.id,from:f,to:m}),g=(p==null?void 0:p.time_logs)??[],v=h.useMemo(()=>o.length>0?g.filter(_=>o.includes(_.user_id)):g,[g,o]),y=h.useMemo(()=>v.reduce((_,S)=>_+(S.duration_minutes??0),0),[v]),j=h.useMemo(()=>{const _=new Map;for(const S of v){_.has(S.user_id)||_.set(S.user_id,{logs:[],totalMinutes:0});const I=_.get(S.user_id);I.logs.push(S),I.totalMinutes+=S.duration_minutes??0}return _},[v]),N=h.useMemo(()=>{const _=new Map;for(const S of v){_.has(S.issue_id)||_.set(S.issue_id,{logs:[],totalMinutes:0});const I=_.get(S.issue_id);I.logs.push(S),I.totalMinutes+=S.duration_minutes??0}return _},[v]),w=Array.from(j.entries()).sort((_,S)=>S[1].totalMinutes-_[1].totalMinutes).slice(0,8).map(([_,{totalMinutes:S}])=>{var I;return{name:((I=d==null?void 0:d.get(_))==null?void 0:I.name)??"Unknown",minutes:S}}),k=Array.from(N.entries()).sort((_,S)=>S[1].totalMinutes-_[1].totalMinutes).slice(0,8).map(([_,{totalMinutes:S,logs:I}])=>{var A;return{name:((A=I[0])==null?void 0:A.issue_identifier)??_.slice(0,8),minutes:S}}),b=h.useMemo(()=>u.map(_=>({value:_.id,label:[_.first_name,_.last_name].filter(Boolean).join(" ")||_.email})),[u]),C=v.length>0;return a.jsxs("div",{className:"p-2 pb-24 md:pb-2 space-y-2",children:[a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl px-4 py-3 flex flex-col gap-3 md:flex-row md:items-center md:flex-wrap",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0",children:[a.jsx(ni,{className:"h-3.5 w-3.5"}),a.jsx("span",{className:"font-medium",children:"Date range"})]}),a.jsx(Mu,{value:r,onChange:n,placeholder:"From"}),a.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"→"}),a.jsx(Mu,{value:s,onChange:i,placeholder:"To"})]}),a.jsx("div",{className:"hidden md:block w-px h-4 bg-border"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0",children:[a.jsx(ba,{className:"h-3.5 w-3.5"}),a.jsx("span",{className:"font-medium",children:"Employee"})]}),a.jsx(vl,{options:b,selected:o,onSelectionChange:l,placeholder:"All employees",className:"w-44"})]})]}),a.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{label:"Total logged",value:y>0?Li(y):"—",icon:Tn},{label:"Contributors",value:j.size>0?String(j.size):"—",icon:ba},{label:"Issues tracked",value:N.size>0?String(N.size):"—",icon:Jn}].map(({label:_,value:S,icon:I})=>a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl px-3 md:px-5 py-3 md:py-4 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[a.jsx(I,{className:"h-3.5 w-3.5 text-muted-foreground hidden md:block shrink-0"}),a.jsx("p",{className:"text-[11px] text-muted-foreground uppercase tracking-wider font-medium break-all",children:_})]}),a.jsx("p",{className:"text-xl md:text-2xl font-bold tabular-nums",children:S})]},_))}),x?a.jsx("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:a.jsx("div",{className:"divide-y divide-border",children:[1,2,3].map(_=>a.jsxs("div",{className:"flex items-center gap-4 px-6 py-4",children:[a.jsx(le,{className:"h-7 w-7 rounded-full"}),a.jsx(le,{className:"h-4 w-40"}),a.jsx("div",{className:"flex-1"}),a.jsx(le,{className:"h-4 w-20"})]},_))})}):c!=null&&c.id?C?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:[j.size>0&&a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(ba,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Time by user"})]}),a.jsx(Gd,{width:"100%",height:Math.max(100,w.length*36),children:a.jsxs(_u,{data:w,layout:"vertical",margin:{left:0,right:32,top:0,bottom:0},children:[a.jsx(Bl,{strokeDasharray:"3 3",horizontal:!1,stroke:"hsl(var(--border))"}),a.jsx(Ul,{type:"number",tickFormatter:_=>Li(_),tick:{fontSize:9,fill:"hsl(var(--muted-foreground))"},axisLine:!1,tickLine:!1}),a.jsx(ql,{type:"category",dataKey:"name",width:88,tick:{fontSize:11,fill:"hsl(var(--foreground))"},axisLine:!1,tickLine:!1}),a.jsx(vu,{content:a.jsx(yj,{}),cursor:{fill:"hsl(var(--muted))"}}),a.jsx(Wl,{dataKey:"minutes",fill:"#6366f1",radius:[0,4,4,0]})]})})]}),N.size>0&&a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(Jn,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Time by issue"})]}),a.jsx(Gd,{width:"100%",height:Math.max(100,k.length*36),children:a.jsxs(_u,{data:k,layout:"vertical",margin:{left:0,right:32,top:0,bottom:0},children:[a.jsx(Bl,{strokeDasharray:"3 3",horizontal:!1,stroke:"hsl(var(--border))"}),a.jsx(Ul,{type:"number",tickFormatter:_=>Li(_),tick:{fontSize:9,fill:"hsl(var(--muted-foreground))"},axisLine:!1,tickLine:!1}),a.jsx(ql,{type:"category",dataKey:"name",width:64,tick:{fontSize:11,fill:"hsl(var(--foreground))",fontFamily:"monospace"},axisLine:!1,tickLine:!1}),a.jsx(vu,{content:a.jsx(yj,{}),cursor:{fill:"hsl(var(--muted))"}}),a.jsx(Wl,{dataKey:"minutes",fill:"#818cf8",radius:[0,4,4,0]})]})})]})]}),a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-2 px-6 py-3 border-b border-border",children:[a.jsx(ba,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Time by user"})]}),a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border bg-muted/20",children:[a.jsx("th",{className:"text-left px-6 py-2 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"User"}),a.jsx("th",{className:"text-right px-6 py-2 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Issues"}),a.jsx("th",{className:"text-right px-6 py-2 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Total"})]})}),a.jsx("tbody",{className:"divide-y divide-border",children:Array.from(j.entries()).sort((_,S)=>S[1].totalMinutes-_[1].totalMinutes).map(([_,{logs:S,totalMinutes:I}])=>{const A=d==null?void 0:d.get(_),O=new Set(S.map(L=>L.issue_id)).size;return a.jsxs("tr",{className:"hover:bg-muted/30 transition-colors",children:[a.jsx("td",{className:"px-6 py-3 text-sm font-medium",children:(A==null?void 0:A.name)??_.slice(0,8)+"…"}),a.jsx("td",{className:"px-6 py-3 text-xs text-right text-muted-foreground tabular-nums",children:O}),a.jsx("td",{className:"px-6 py-3 text-sm text-right tabular-nums font-semibold",children:Li(I)})]},_)})})]})]}),a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-2 px-6 py-3 border-b border-border",children:[a.jsx(Jn,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Time by issue"})]}),a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border bg-muted/20",children:[a.jsx("th",{className:"text-left px-6 py-2 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Issue"}),a.jsx("th",{className:"text-left px-6 py-2 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Last logged"}),a.jsx("th",{className:"text-right px-6 py-2 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Contributors"}),a.jsx("th",{className:"text-right px-6 py-2 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Total"})]})}),a.jsx("tbody",{className:"divide-y divide-border",children:Array.from(N.entries()).sort((_,S)=>S[1].totalMinutes-_[1].totalMinutes).map(([_,{logs:S,totalMinutes:I}])=>{var X,T;const A=new Set(S.map(G=>G.user_id)).size,O=S.reduce((G,re)=>re.logged_date&&(!G||new Date(re.logged_date)>new Date(G))?re.logged_date:G,null),L=(X=S[0])==null?void 0:X.issue_identifier,F=(T=S[0])==null?void 0:T.issue_title;return a.jsxs("tr",{className:"hover:bg-muted/30 transition-colors",children:[a.jsx("td",{className:"px-6 py-3",children:a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[L?a.jsx(qr,{to:`/${t}/projects/${e}/issues/${_}`,className:"font-mono text-xs text-indigo-600 dark:text-indigo-400 hover:underline shrink-0",children:L}):a.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[_.slice(0,8),"…"]}),F&&a.jsx("span",{className:"text-xs text-muted-foreground truncate",children:F})]})}),a.jsx("td",{className:"px-6 py-3 text-xs text-muted-foreground",children:O?fe(new Date(O),"MMM d, yyyy"):"—"}),a.jsx("td",{className:"px-6 py-3 text-xs text-right text-muted-foreground tabular-nums",children:A}),a.jsx("td",{className:"px-6 py-3 text-sm text-right tabular-nums font-semibold",children:Li(I)})]},_)})})]})]})]}):a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl flex flex-col items-center justify-center py-16 text-center",children:[a.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:a.jsx(ys,{className:"h-5 w-5 text-muted-foreground"})}),a.jsx("p",{className:"text-sm font-medium mb-1",children:"No time logged"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:f||m||o.length>0?"No entries match the current filters.":"Start logging time on issues to see reports here."})]}):a.jsx("div",{className:"bg-white dark:bg-card border border-border rounded-xl flex items-center justify-center py-12",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading project…"})})]})}const gZ={share_enabled:{icon:wh,color:"text-green-600",bg:"bg-green-50 dark:bg-green-950/40",label:()=>"Enabled public link"},share_revoked:{icon:v5,color:"text-red-500",bg:"bg-red-50 dark:bg-red-950/40",label:()=>"Revoked public link"},member_added:{icon:po,color:"text-blue-500",bg:"bg-blue-50 dark:bg-blue-950/40",label:(e,t)=>{var i,o,l;const r=(i=e==null?void 0:e.user_id)==null?void 0:i.to,n=(o=e==null?void 0:e.role)==null?void 0:o.to,s=r?((l=t.get(r))==null?void 0:l.name)??r:"a user";return n?`Added ${s} as ${n}`:`Added ${s}`}},member_removed:{icon:Y1,color:"text-red-500",bg:"bg-red-50 dark:bg-red-950/40",label:(e,t)=>{var s,i;const r=(s=e==null?void 0:e.user_id)==null?void 0:s.from;return`Removed ${r?((i=t.get(r))==null?void 0:i.name)??r:"a user"}`}},team_added:{icon:ba,color:"text-indigo-500",bg:"bg-indigo-50 dark:bg-indigo-950/40",label:(e,t,r)=>{var i;const n=(i=e==null?void 0:e.team_id)==null?void 0:i.to;return`Added team ${n?r.get(n)??n:"a team"}`}},team_removed:{icon:G1,color:"text-orange-500",bg:"bg-orange-50 dark:bg-orange-950/40",label:(e,t,r)=>{var i;const n=(i=e==null?void 0:e.team_id)==null?void 0:i.from;return`Removed team ${n?r.get(n)??n:"a team"}`}},status_updated:{icon:E5,color:"text-violet-500",bg:"bg-violet-50 dark:bg-violet-950/40",label:e=>{var n,s;const t=(n=e==null?void 0:e.name)==null?void 0:n.from,r=(s=e==null?void 0:e.name)==null?void 0:s.to;return t&&r?`Renamed status "${t}" to "${r}"`:"Updated status"}},status_deleted:{icon:Mr,color:"text-red-500",bg:"bg-red-50 dark:bg-red-950/40",label:e=>{var r;const t=(r=e==null?void 0:e.name)==null?void 0:r.from;return t?`Deleted status "${t}"`:"Deleted status"}},updated:{icon:si,color:"text-amber-500",bg:"bg-amber-50 dark:bg-amber-950/40",label:()=>"Updated project"},created:{icon:dt,color:"text-emerald-600",bg:"bg-emerald-50 dark:bg-emerald-950/40",label:()=>"Created project"}},vZ={icon:$u,color:"text-zinc-500",bg:"bg-zinc-100 dark:bg-zinc-800",label:()=>"Activity"};function yZ({activity:e,userMap:t,teamMap:r}){const n=gZ[e.action]??vZ,s=n.icon,i=t.get(e.actor_id),o=(i==null?void 0:i.name)??"System",l=(i==null?void 0:i.initials)??"S",c=n.label(e.changes,t,r),d=(()=>{var u,f;if(e.action==="share_enabled"){const m=(f=(u=e.changes)==null?void 0:u.share_url)==null?void 0:f.to;return m?a.jsx("span",{className:"text-xs text-muted-foreground/60 font-mono break-all",children:m}):null}return null})();return a.jsxs("div",{className:"flex items-start md:items-center gap-3 md:gap-4 px-4 md:px-6 py-4 hover:bg-muted/30 transition-colors",children:[a.jsx("div",{className:z("h-8 w-8 rounded-full flex items-center justify-center shrink-0",n.bg),children:a.jsx(s,{className:z("h-4 w-4",n.color)})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex flex-wrap md:flex-nowrap items-center gap-x-2 gap-y-0.5",children:[a.jsx(Rt,{className:"h-5 w-5 shrink-0",children:a.jsx($t,{className:"text-[10px] font-medium",children:l})}),a.jsx("span",{className:"text-sm font-medium truncate",children:o}),a.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:c})]}),a.jsx("time",{className:"md:hidden text-[11px] text-muted-foreground/70 mt-1 block",children:fe(new Date(e.created_at),"MMM d, yyyy · h:mm a")}),d&&a.jsx("div",{className:"mt-0.5 pl-7",children:d})]}),a.jsx("time",{className:"hidden md:block text-xs text-muted-foreground shrink-0",children:fe(new Date(e.created_at),"MMM d, yyyy · h:mm a")})]})}function bZ(){const{projectKey:e}=zt(),{workspace:t}=Ie(),{data:r}=Wa(e??""),{data:n,isLoading:s}=PD((r==null?void 0:r.id)??""),{data:i=new Map}=ks(),{data:o=[]}=Fu((t==null?void 0:t.id)??""),l=new Map(o.map(d=>[d.id,d.name])),c=(n==null?void 0:n.length)??0;return a.jsx("div",{className:"p-2 pb-24 md:pb-2",children:a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-border",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold",children:"Activity"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"A log of share access changes, member updates, and project edits."})]}),!s&&c>0&&a.jsxs("p",{className:"text-xs text-muted-foreground shrink-0",children:[c," event",c!==1?"s":""]})]}),a.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/20",children:a.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Log"})}),s?a.jsx("div",{className:"divide-y divide-border",children:[1,2,3].map(d=>a.jsxs("div",{className:"flex items-center gap-4 px-6 py-4",children:[a.jsx(le,{className:"h-8 w-8 rounded-full shrink-0"}),a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsx(le,{className:"h-4 w-48"}),a.jsx(le,{className:"h-3 w-64"})]}),a.jsx(le,{className:"h-3 w-32 shrink-0"})]},d))}):!n||n.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[a.jsx($u,{className:"h-8 w-8 text-muted-foreground/20 mb-3"}),a.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"No activity yet"}),a.jsx("p",{className:"text-xs text-muted-foreground/60 mt-1",children:"Actions like sharing the project or adding members will appear here."})]}):a.jsx("div",{className:"divide-y divide-border",children:n.map(d=>a.jsx(yZ,{activity:d,userMap:i,teamMap:l},d.id))})]})})}function bO(){return Be({queryKey:["me"],queryFn:()=>oe.get("/admin/users/me")})}function wZ(){const e=Se(),{updateLocalUser:t}=Ie();return be({mutationFn:r=>oe.patch("/admin/users/me",r),onSuccess:({user:r})=>{t({first_name:r.first_name??"",last_name:r.last_name??"",designation:r.designation,phone_number:r.phone_number}),e.invalidateQueries({queryKey:["me"]})}})}function jZ(){const e=Se(),{updateLocalUser:t}=Ie();return be({mutationFn:r=>{const n=new FormData;return n.append("avatar",r),oe.upload("/admin/users/me/avatar",n)},onSuccess:({user:r})=>{t({avatar_url:r.avatar_url}),e.invalidateQueries({queryKey:["me"]})}})}function NZ(){const e=Se(),{updateLocalUser:t}=Ie();return be({mutationFn:()=>oe.delete("/admin/users/me/avatar"),onSuccess:()=>{t({avatar_url:null}),e.invalidateQueries({queryKey:["me"]})}})}function kZ(){return be({mutationFn:()=>oe.post("/admin/users/me/password/send-otp",{})})}function SZ(){const e=Se();return be({mutationFn:t=>oe.post("/admin/users/me/password",t),onSuccess:()=>{e.invalidateQueries({queryKey:["me"]})}})}function CZ(){const e=Se();return be({mutationFn:()=>oe.delete("/admin/users/me/google"),onSuccess:()=>{e.invalidateQueries({queryKey:["me"]})}})}const _Z=[{key:"mon",label:"Monday",short:"Mon"},{key:"tue",label:"Tuesday",short:"Tue"},{key:"wed",label:"Wednesday",short:"Wed"},{key:"thu",label:"Thursday",short:"Thu"},{key:"fri",label:"Friday",short:"Fri"},{key:"sat",label:"Saturday",short:"Sat"},{key:"sun",label:"Sunday",short:"Sun"}],MZ={mon:!0,tue:!0,wed:!0,thu:!0,fri:!0,sat:!1,sun:!1};function OZ({open:e,onClose:t,holiday:r}){const[n,s]=h.useState((r==null?void 0:r.name)??""),[i,o]=h.useState(r!=null&&r.date?r.date.split("T")[0]:""),[l,c]=h.useState((r==null?void 0:r.recurring)??!1);h.useEffect(()=>{e&&(s((r==null?void 0:r.name)??""),o(r!=null&&r.date?r.date.split("T")[0]:""),c((r==null?void 0:r.recurring)??!1))},[e,r==null?void 0:r.id]);const d=h4(),u=p4(),f=d.isPending||u.isPending,m=p=>{if(p.preventDefault(),!n.trim()){H.error("Holiday name is required");return}if(!i){H.error("Date is required");return}r?u.mutate({id:r.id,name:n.trim(),date:i,recurring:l},{onSuccess:()=>{H.success("Holiday updated"),t()},onError:()=>H.error("Failed to update holiday")}):d.mutate({name:n.trim(),date:i,recurring:l},{onSuccess:()=>{H.success("Holiday added"),t()},onError:()=>H.error("Failed to add holiday")})};return a.jsx(Ua,{open:e,onOpenChange:p=>!p&&t(),children:a.jsxs(ca,{className:"sm:max-w-md",children:[a.jsxs(qa,{children:[a.jsx(Ha,{children:r?"Edit holiday":"Add holiday"}),a.jsx(yo,{children:"Holidays are excluded from business day calculations across the app."})]}),a.jsxs("form",{onSubmit:m,className:"space-y-4 pt-1",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Name"}),a.jsx(Ee,{value:n,onChange:p=>s(p.target.value),placeholder:"e.g. New Year's Day",className:"h-9",autoFocus:!0,required:!0})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Date"}),a.jsx(Ee,{type:"date",value:i,onChange:p=>o(p.target.value),className:"h-9",required:!0})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Co,{checked:l,onCheckedChange:p=>c(p)}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"Recurring annually (applies every year on the same date)"})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[a.jsx(ne,{type:"button",variant:"outline",size:"sm",onClick:t,children:"Cancel"}),a.jsx(ne,{type:"submit",size:"sm",disabled:f,children:f?r?"Saving…":"Adding…":r?"Save changes":"Add holiday"})]})]})]})})}function PZ(){const{data:e,isLoading:t}=Sx(),r=m4(),n=(e==null?void 0:e.working_days)??MZ,s=(i,o)=>{const l={...n,[i]:o};r.mutate({working_days:l},{onSuccess:()=>H.success("Working days updated"),onError:()=>H.error("Failed to update working days")})};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/20 min-h-[45px] flex items-center",children:a.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Working days"})}),a.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/10",children:a.jsx("p",{className:"text-xs text-muted-foreground",children:"Configure which days count as business days. This affects duration calculations across the app."})}),t?a.jsx("div",{className:"px-6 py-4 space-y-3",children:[1,2,3,4,5,6,7].map(i=>a.jsx(le,{className:"h-8 w-full"},i))}):_Z.map(({key:i,label:o})=>{const l=n[i];return a.jsxs("div",{className:"grid grid-cols-[180px_1fr_auto] items-center gap-4 px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:o}),a.jsx("span",{className:z("text-xs font-medium",l?"text-foreground":"text-muted-foreground/60"),children:l?"Working day":"Not a working day"}),a.jsx(Co,{checked:l,onCheckedChange:c=>s(i,c),disabled:r.isPending})]},i)})]})}function EZ(){const[e,t]=h.useState(new Date().getFullYear()),[r,n]=h.useState(!1),[s,i]=h.useState(null),[o,l]=h.useState(null),{data:c=[],isLoading:d}=Cx(e),u=x4(),f=()=>{o&&u.mutate(o.id,{onSuccess:()=>{H.success("Holiday removed"),l(null)},onError:()=>H.error("Failed to remove holiday")})},m=[...c].sort((p,x)=>{const g=new Date(p.date).getMonth()*100+new Date(p.date).getDate(),v=new Date(x.date).getMonth()*100+new Date(x.date).getDate();return g-v});return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-2 border-b border-border bg-muted/20",children:[a.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Holidays"}),a.jsxs(ne,{size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>{i(null),n(!0)},children:[a.jsx(dt,{className:"h-3.5 w-3.5"}),"Add holiday"]})]}),a.jsxs("div",{className:"flex items-center gap-1 px-6 py-3 border-b border-border bg-muted/10",children:[a.jsxs("p",{className:"text-xs text-muted-foreground flex-1",children:["Showing holidays for"," ",a.jsx("span",{className:"font-medium text-foreground",children:e}),". Recurring holidays appear every year."]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>t(p=>p-1),className:"h-6 w-6 flex items-center justify-center rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",children:a.jsx(_a,{className:"h-3.5 w-3.5"})}),a.jsx("span",{className:"text-xs font-medium tabular-nums w-10 text-center",children:e}),a.jsx("button",{onClick:()=>t(p=>p+1),className:"h-6 w-6 flex items-center justify-center rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",children:a.jsx(vr,{className:"h-3.5 w-3.5"})})]})]}),a.jsxs("div",{className:"hidden md:grid grid-cols-[160px_1fr_120px_40px] gap-4 px-6 py-2 border-b border-border bg-muted/20",children:[a.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide",children:"Date"}),a.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide",children:"Name"}),a.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide",children:"Recurrence"}),a.jsx("span",{})]}),d?a.jsx("div",{className:"px-6 py-4 space-y-3",children:[1,2,3].map(p=>a.jsx(le,{className:"h-8 w-full"},p))}):m.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-6 text-center",children:[a.jsx(R1,{className:"h-8 w-8 text-muted-foreground/40 mb-3"}),a.jsxs("p",{className:"text-sm font-medium mb-1",children:["No holidays for ",e]}),a.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Add a holiday or use the year navigation to view other years."}),a.jsxs(ne,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1.5",onClick:()=>{i(null),n(!0)},children:[a.jsx(dt,{className:"h-3.5 w-3.5"}),"Add holiday"]})]}):m.map(p=>{const x=new Date(p.date),g=a.jsxs(Kr,{children:[a.jsx(Yr,{asChild:!0,children:a.jsx("button",{className:"h-6 w-6 flex items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:a.jsx(Ma,{className:"h-3.5 w-3.5"})})}),a.jsxs(Or,{align:"end",className:"w-36",children:[a.jsxs(at,{className:"gap-2 cursor-pointer",onClick:()=>{i(p),n(!0)},children:[a.jsx(si,{className:"h-3.5 w-3.5"}),"Edit"]}),a.jsxs(at,{className:"gap-2 cursor-pointer text-destructive focus:text-destructive",onClick:()=>l(p),children:[a.jsx(Mr,{className:"h-3.5 w-3.5"}),"Remove"]})]})]});return a.jsxs("div",{children:[a.jsxs("div",{className:"hidden md:grid grid-cols-[160px_1fr_120px_40px] gap-4 items-center px-6 py-3.5 border-b border-border hover:bg-muted/20 transition-colors",children:[a.jsx("span",{className:"text-sm tabular-nums text-muted-foreground",children:fe(x,"MMM d, yyyy")}),a.jsx("span",{className:"text-sm font-medium truncate",children:p.name}),a.jsx("span",{className:"text-sm",children:p.recurring?a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[a.jsx(Vi,{className:"h-3 w-3"}),"Every year"]}):a.jsx("span",{className:"text-xs text-muted-foreground/60",children:"One-time"})}),a.jsx("div",{className:"flex justify-end",children:g})]}),a.jsxs("div",{className:"md:hidden flex items-center gap-3 px-4 py-3 border-b border-border hover:bg-muted/20 transition-colors",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium truncate",children:p.name}),a.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[a.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:fe(x,"MMM d, yyyy")}),p.recurring&&a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[a.jsx(Vi,{className:"h-3 w-3"}),"Recurring"]})]})]}),g]})]},p.id)}),a.jsx(OZ,{open:r,onClose:()=>{n(!1),i(null)},holiday:s}),a.jsx(Zs,{open:!!o,onOpenChange:p=>!p&&l(null),children:a.jsxs(ds,{children:[a.jsxs(us,{children:[a.jsxs(ms,{children:['Remove "',o==null?void 0:o.name,'"?']}),a.jsx(hs,{children:"This holiday will no longer be excluded from business day calculations."})]}),a.jsxs(fs,{children:[a.jsx(xs,{children:"Cancel"}),a.jsx(ps,{onClick:f,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]})})]})}const bj=["super-admin","admin","member"],uh={"super-admin":"bg-purple-100 text-purple-700 dark:bg-purple-900/40 dark:text-purple-300",admin:"bg-indigo-100 text-indigo-700 dark:bg-indigo-900/40 dark:text-indigo-300",member:"bg-zinc-100 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-300"},ud={pending:"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",accepted:"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-300",revoked:"bg-zinc-100 text-zinc-500 dark:bg-zinc-800 dark:text-zinc-400"};function wj({value:e}){const[t,r]=h.useState(!1),n=()=>{navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1500)};return a.jsx("button",{onClick:n,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0",title:"Copy",children:t?a.jsx(dr,{className:"h-3.5 w-3.5 text-emerald-500"}):a.jsx(ex,{className:"h-3.5 w-3.5"})})}const fh={"super-admin":3,admin:2,moderator:1,member:0},zr=20;function AZ(){const{data:e}=bO(),t=fh[(e==null?void 0:e.role)??"member"]??0,[r,n]=h.useState(""),[s,i]=h.useState(""),[o,l]=h.useState(0),[c,d]=h.useState(0);h.useEffect(()=>{const $=setTimeout(()=>{i(r.trim()),l(0),d(0)},400);return()=>clearTimeout($)},[r]);const{data:u,isLoading:f}=qN({limit:zr,offset:o*zr,q:s}),m=(u==null?void 0:u.users)??[],p=(u==null?void 0:u.count)??0,{data:x,isLoading:g}=YI({limit:zr,offset:c*zr,q:s}),v=(x==null?void 0:x.invitations)??[],y=(x==null?void 0:x.count)??0,{data:j=[]}=df(),N=eS(),w=QI(),k=ZI(),b=JI(),C=GI(),_=VI(),S=XI(),[I,A]=h.useState(null),[O,L]=h.useState(null),[F,X]=h.useState(null),[T,G]=h.useState(!1),[re,J]=h.useState(""),[P,M]=h.useState("member"),R=$=>{$.preventDefault(),re.trim()&&S.mutate({email:re.trim().toLowerCase(),role:P},{onSuccess:()=>{H.success(`Invitation sent to ${re.trim()}`),G(!1),J(""),M("member")},onError:K=>H.error((K==null?void 0:K.message)??"Failed to send invitation")})},q=()=>{I&&k.mutate(I,{onSuccess:()=>{H.success("User deactivated"),A(null)},onError:()=>H.error("Failed to deactivate user")})};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-2 border-b border-border bg-muted/20",children:[a.jsxs("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide flex items-center gap-2",children:["All users",!f&&a.jsx(En,{variant:"secondary",className:"h-5 min-w-[20px] px-1.5 text-[11px] font-medium rounded-full",children:p})]}),a.jsxs(ne,{size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>G(!0),children:[a.jsx(dt,{className:"h-3.5 w-3.5"}),"Invite member"]})]}),a.jsxs("div",{className:"px-6 py-2 border-b border-border bg-muted/10 flex items-center gap-3",children:[a.jsx("p",{className:"text-xs text-muted-foreground flex-1",children:"View and manage all platform users. Change a user's custom role or remove them from the system."}),a.jsx(Ee,{value:r,onChange:$=>n($.target.value),placeholder:"Search by email or name…",className:"h-8 text-xs w-56 shrink-0"})]}),a.jsx(Ua,{open:T,onOpenChange:$=>{$||(G(!1),J(""),M("member"))},children:a.jsxs(ca,{className:"sm:max-w-md",children:[a.jsx(qa,{children:a.jsx(Ha,{children:"Invite member"})}),a.jsxs("form",{onSubmit:R,className:"space-y-4 pt-1",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Email"}),a.jsx(Ee,{type:"email",value:re,onChange:$=>J($.target.value),placeholder:"name@example.com",className:"h-9",autoFocus:!0,required:!0})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Role"}),a.jsxs(Le,{value:P,onValueChange:M,children:[a.jsx($e,{className:"h-9 text-sm",children:a.jsx(qe,{})}),a.jsx(ze,{children:bj.map($=>a.jsx(we,{value:$,className:"text-sm capitalize",children:$},$))})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"The user will receive an invite link to create their account. They won't be added to any workspace automatically — you can add them from workspace settings after they join."}),a.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[a.jsx(ne,{type:"button",variant:"outline",size:"sm",onClick:()=>G(!1),children:"Cancel"}),a.jsx(ne,{type:"submit",size:"sm",disabled:S.isPending,children:S.isPending?"Sending…":"Send invite"})]})]})]})}),a.jsxs("div",{className:"hidden md:grid grid-cols-[1fr_160px_200px_40px] gap-4 px-6 py-2 border-b border-border bg-muted/20",children:[a.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide",children:"User"}),a.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide",children:"Global role"}),a.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide",children:"Custom role"}),a.jsx("span",{})]}),f?a.jsx("div",{className:"px-6 py-4 space-y-3",children:[1,2,3].map($=>a.jsx(le,{className:"h-10 w-full"},$))}):m.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[a.jsx(ba,{className:"h-8 w-8 text-muted-foreground/40 mb-3"}),a.jsx("p",{className:"text-sm font-medium",children:s?"No users match your search":"No users found"}),s&&a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Try a different search term."})]}):a.jsxs(a.Fragment,{children:[m.map($=>{var pe;const K=$.first_name??"",D=$.last_name??"",E=`${K} ${D}`.trim()||$.email,Z=(K[0]??D[0]??((pe=$.email)==null?void 0:pe[0])??"U").toUpperCase(),B=fh[$.role??"member"]??0,Y=$.id===(e==null?void 0:e.id),ae=!Y&&B<t,ee=ae?a.jsxs(Le,{value:$.role??"member",onValueChange:ue=>w.mutate({userId:$.id,role:ue},{onSuccess:()=>H.success("Global role updated"),onError:ve=>H.error((ve==null?void 0:ve.message)??"Failed to update global role")}),children:[a.jsx($e,{className:"h-7 text-xs w-full",children:a.jsx(qe,{})}),a.jsx(ze,{children:bj.filter(ue=>(fh[ue]??0)<=t).map(ue=>a.jsx(we,{value:ue,className:"text-xs",children:a.jsx("span",{className:z("inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium",uh[ue]),children:ue})},ue))})]}):a.jsx("span",{className:z("inline-flex items-center px-2 py-0.5 rounded text-xs font-medium",uh[$.role??"member"]??uh.member),children:$.role??"member"}),se=a.jsxs(Le,{value:$.app_role_id??"none",disabled:!ae,onValueChange:ue=>N.mutate({userId:$.id,appRoleId:ue==="none"?null:ue},{onSuccess:()=>H.success("Custom role updated"),onError:()=>H.error("Failed to update custom role")}),children:[a.jsx($e,{className:z("h-7 text-xs w-full",!ae&&"opacity-60 cursor-not-allowed"),children:a.jsx(qe,{placeholder:"No role"})}),a.jsxs(ze,{children:[a.jsx(we,{value:"none",className:"text-xs",children:"No role"}),j.map(ue=>a.jsx(we,{value:ue.id,className:"text-xs",children:ue.name},ue.id))]})]}),V=$.is_active!==!1,ie=ae?a.jsxs(Kr,{children:[a.jsx(Yr,{asChild:!0,children:a.jsx("button",{className:"h-6 w-6 flex items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:a.jsx(Ma,{className:"h-3.5 w-3.5"})})}),a.jsx(Or,{align:"end",className:"w-40",children:V?a.jsxs(at,{className:"gap-2 cursor-pointer text-destructive focus:text-destructive",onClick:()=>A($.id),children:[a.jsx(G1,{className:"h-3.5 w-3.5"}),"Deactivate user"]}):a.jsxs(at,{className:"gap-2 cursor-pointer",onClick:()=>{b.mutate($.id,{onSuccess:()=>H.success("User reactivated"),onError:()=>H.error("Failed to reactivate user")})},children:[a.jsx(z5,{className:"h-3.5 w-3.5"}),"Reactivate user"]})})]}):null;return a.jsxs("div",{className:"border-b border-border hover:bg-muted/20 transition-colors group",children:[a.jsxs("div",{className:"hidden md:grid grid-cols-[1fr_160px_200px_40px] gap-4 items-center px-6 py-3",children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[a.jsx("div",{className:"h-7 w-7 rounded-full bg-zinc-200 dark:bg-zinc-700 flex items-center justify-center text-xs font-semibold text-zinc-600 dark:text-zinc-300 shrink-0",children:Z}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("p",{className:"text-sm font-medium truncate",children:[E,Y&&a.jsx("span",{className:"text-xs text-muted-foreground ml-1.5",children:"(you)"}),!V&&a.jsx("span",{className:"ml-1.5 inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",children:"Deactivated"})]}),a.jsx("p",{className:"text-xs text-muted-foreground truncate",children:$.email})]})]}),ee,se,a.jsx("div",{className:"flex justify-end opacity-0 group-hover:opacity-100 transition-opacity",children:ie})]}),a.jsxs("div",{className:"md:hidden px-4 py-3",children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0 mb-2",children:[a.jsx("div",{className:"h-7 w-7 rounded-full bg-zinc-200 dark:bg-zinc-700 flex items-center justify-center text-xs font-semibold text-zinc-600 dark:text-zinc-300 shrink-0",children:Z}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("p",{className:"text-sm font-medium truncate",children:[E,Y&&a.jsx("span",{className:"text-xs text-muted-foreground ml-1.5",children:"(you)"}),!V&&a.jsx("span",{className:"ml-1.5 inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",children:"Deactivated"})]}),a.jsx("p",{className:"text-xs text-muted-foreground truncate",children:$.email})]}),ie]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"flex-1",children:ee}),a.jsx("div",{className:"flex-1",children:se})]})]})]},$.id)}),p>zr&&a.jsxs("div",{className:"flex items-center justify-between px-4 md:px-6 py-3 border-t border-border",children:[a.jsxs("span",{className:"text-xs text-muted-foreground",children:[o*zr+1,"–",Math.min((o+1)*zr,p)," of ",p]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(ne,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>l($=>$-1),disabled:o===0,children:a.jsx(_a,{className:"h-3.5 w-3.5"})}),a.jsxs("span",{className:"text-xs text-muted-foreground tabular-nums w-12 text-center",children:[o+1," / ",Math.ceil(p/zr)]}),a.jsx(ne,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>l($=>$+1),disabled:(o+1)*zr>=p,children:a.jsx(vr,{className:"h-3.5 w-3.5"})})]})]})]}),a.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/20 mt-2",children:a.jsxs("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide flex items-center gap-2",children:["Invitations",!g&&y>0&&a.jsx(En,{variant:"secondary",className:"h-5 min-w-[20px] px-1.5 text-[11px] font-medium rounded-full bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400",children:y})]})}),g?a.jsx("div",{className:"px-6 py-4 space-y-3",children:[1,2,3].map($=>a.jsx(le,{className:"h-8 w-full"},$))}):v.length===0?a.jsx("div",{className:"px-6 py-6 text-center",children:a.jsx("p",{className:"text-xs text-muted-foreground",children:s?"No invitations match your search.":"No pending invitations."})}):v.map($=>{const K=`${window.location.origin}/invite/${$.token}`;return a.jsxs("div",{className:"px-6 py-3.5 border-b border-border hover:bg-muted/20 transition-colors group",children:[a.jsxs("div",{className:"hidden md:flex items-center gap-3",children:[a.jsx("div",{className:"h-7 w-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:a.jsx(ai,{className:"h-3.5 w-3.5 text-muted-foreground"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("p",{className:"text-sm font-medium truncate",children:$.email??"Shareable link"}),a.jsx("span",{className:z("inline-flex items-center text-[11px] px-1.5 py-0.5 rounded font-medium",$.role==="super-admin"?"bg-purple-50 text-purple-700 dark:bg-purple-950/30 dark:text-purple-300":$.role==="admin"?"bg-indigo-100 text-indigo-700 dark:bg-indigo-900/30 dark:text-indigo-300":"bg-muted text-muted-foreground"),children:$.role==="super-admin"?"Super Admin":$.role==="admin"?"Admin":"Member"}),$.workspace_name&&a.jsxs("span",{className:"text-[11px] text-muted-foreground truncate",children:["· ",$.workspace_name]})]}),a.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[a.jsx("span",{className:"text-xs font-mono text-muted-foreground truncate max-w-[320px]",children:K}),a.jsx(wj,{value:K})]})]}),a.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[a.jsx("span",{className:z("inline-flex items-center px-2 py-0.5 rounded text-[11px] font-medium",ud[$.status]??ud.revoked),children:$.status}),a.jsx("span",{className:"text-xs text-muted-foreground",children:fe(new Date($.created_at),"MMM d")}),$.status==="pending"&&$.email&&a.jsxs(Qn,{children:[a.jsx(Zn,{asChild:!0,children:a.jsx("button",{onClick:()=>X($),disabled:_.isPending,className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-foreground disabled:opacity-50",children:a.jsx(Cd,{className:z("h-3.5 w-3.5",_.isPending&&"animate-spin")})})}),a.jsx(_n,{children:"Resend invite"})]}),$.status==="pending"&&a.jsx("button",{onClick:()=>L($),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",title:"Revoke invitation",children:a.jsx(tt,{className:"h-3.5 w-3.5"})})]})]}),a.jsxs("div",{className:"md:hidden space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"h-7 w-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:a.jsx(ai,{className:"h-3.5 w-3.5 text-muted-foreground"})}),a.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[a.jsx("p",{className:"text-sm font-medium truncate",children:$.email??"Shareable link"}),a.jsx("span",{className:z("inline-flex items-center text-[11px] px-1.5 py-0.5 rounded font-medium shrink-0",$.role==="super-admin"?"bg-purple-50 text-purple-700 dark:bg-purple-950/30 dark:text-purple-300":$.role==="admin"?"bg-indigo-100 text-indigo-700 dark:bg-indigo-900/30 dark:text-indigo-300":"bg-muted text-muted-foreground"),children:$.role==="super-admin"?"Super Admin":$.role==="admin"?"Admin":"Member"})]}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[a.jsx("span",{className:z("inline-flex items-center px-2 py-0.5 rounded text-[11px] font-medium",ud[$.status]??ud.revoked),children:$.status}),$.status==="pending"&&$.email&&a.jsx("button",{onClick:()=>X($),disabled:_.isPending,className:"text-muted-foreground hover:text-foreground disabled:opacity-50",children:a.jsx(Cd,{className:z("h-3.5 w-3.5",_.isPending&&"animate-spin")})}),$.status==="pending"&&a.jsx("button",{onClick:()=>L($),className:"text-muted-foreground hover:text-destructive",title:"Revoke invitation",children:a.jsx(tt,{className:"h-3.5 w-3.5"})})]})]}),a.jsxs("div",{className:"flex items-center gap-2 pl-10",children:[a.jsx("span",{className:"text-xs font-mono text-muted-foreground truncate flex-1 min-w-0",children:K}),a.jsx(wj,{value:K}),$.workspace_name&&a.jsx("span",{className:"text-[11px] text-muted-foreground truncate shrink-0 max-w-[80px]",children:$.workspace_name}),a.jsx("span",{className:"text-[11px] text-muted-foreground shrink-0",children:fe(new Date($.created_at),"MMM d")})]})]})]},$.id)}),y>zr&&a.jsxs("div",{className:"flex items-center justify-between px-4 md:px-6 py-3 border-t border-border",children:[a.jsxs("span",{className:"text-xs text-muted-foreground",children:[c*zr+1,"–",Math.min((c+1)*zr,y)," of ",y]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(ne,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>d($=>$-1),disabled:c===0,children:a.jsx(_a,{className:"h-3.5 w-3.5"})}),a.jsxs("span",{className:"text-xs text-muted-foreground tabular-nums w-12 text-center",children:[c+1," / ",Math.ceil(y/zr)]}),a.jsx(ne,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>d($=>$+1),disabled:(c+1)*zr>=y,children:a.jsx(vr,{className:"h-3.5 w-3.5"})})]})]}),a.jsx(Zs,{open:!!I,onOpenChange:$=>!$&&A(null),children:a.jsxs(ds,{children:[a.jsxs(us,{children:[a.jsx(ms,{children:"Deactivate this user?"}),a.jsx(hs,{children:"The user will lose access immediately and be hidden from member lists. You can reactivate them later."})]}),a.jsxs(fs,{children:[a.jsx(xs,{children:"Cancel"}),a.jsx(ps,{onClick:q,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Deactivate"})]})]})}),a.jsx(Zs,{open:!!O,onOpenChange:$=>!$&&L(null),children:a.jsxs(ds,{children:[a.jsxs(us,{children:[a.jsx(ms,{children:"Revoke this invitation?"}),a.jsxs(hs,{children:["The invite link sent to ",a.jsx("span",{className:"font-medium",children:O==null?void 0:O.email})," will no longer work."]})]}),a.jsxs(fs,{children:[a.jsx(xs,{children:"Cancel"}),a.jsx(ps,{onClick:()=>{O&&C.mutate(O.id,{onSuccess:()=>{H.success("Invitation revoked"),L(null)},onError:()=>H.error("Failed to revoke invitation")})},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Revoke"})]})]})}),a.jsx(Zs,{open:!!F,onOpenChange:$=>!$&&X(null),children:a.jsxs(ds,{children:[a.jsxs(us,{children:[a.jsx(ms,{children:"Resend invitation?"}),a.jsxs(hs,{children:["A new invitation email will be sent to ",a.jsx("span",{className:"font-medium",children:F==null?void 0:F.email}),"."]})]}),a.jsxs(fs,{children:[a.jsx(xs,{children:"Cancel"}),a.jsx(ps,{onClick:()=>{F&&_.mutate(F.id,{onSuccess:()=>{H.success("Invitation resent"),X(null)},onError:()=>H.error("Failed to resend invitation")})},children:"Resend"})]})]})})]})}const DZ=["working-days","holidays","members"];function TZ(){const[e,t]=Gl(),r=e.get("tab"),n=r&&DZ.includes(r)?r:"working-days",s=o=>t({tab:o},{replace:!0}),i=[{id:"working-days",label:"Working Days"},{id:"holidays",label:"Holidays"},{id:"members",label:"Members"}];return a.jsx("div",{className:"p-2 md:pb-2 h-full",children:a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden flex flex-col h-full",children:[a.jsx("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border shrink-0",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(R1,{className:"h-5 w-5 text-muted-foreground"}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-base font-semibold",children:"Organization Settings"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Global configuration that applies across the entire Meridian deployment."})]})]})}),a.jsx("div",{className:"flex border-b border-border shrink-0 px-6",children:i.map(o=>a.jsx("button",{onClick:()=>s(o.id),className:z("px-1 py-3 mr-6 text-sm font-medium border-b-2 transition-colors",n===o.id?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:o.label},o.id))}),a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[n==="working-days"&&a.jsx(PZ,{}),n==="holidays"&&a.jsx(EZ,{}),n==="members"&&a.jsx(AZ,{})]})]})})}const mh=e=>{let{transform:t}=e;return{...t,y:0}};function Nv(){const[e,t]=h.useState({x:0,y:0,elementX:0,elementY:0,elementPositionX:0,elementPositionY:0}),r=h.useRef(null);return h.useLayoutEffect(()=>{const n=s=>{var o;let i={x:s.pageX,y:s.pageY};if(((o=r.current)==null?void 0:o.nodeType)===Node.ELEMENT_NODE){const{left:l,top:c}=r.current.getBoundingClientRect(),d=l+window.scrollX,u=c+window.scrollY,f=s.pageX-d,m=s.pageY-u;i.elementX=f,i.elementY=m,i.elementPositionX=d,i.elementPositionY=u}t(l=>({...l,...i}))};return document.addEventListener("mousemove",n),()=>{document.removeEventListener("mousemove",n)}},[]),[e,r]}function IZ(e,t=500){const[r,n]=h.useState(e),s=h.useRef(null);return h.useEffect(()=>{const i=Date.now();if(s.current&&i>=s.current+t)s.current=i,n(e);else{const o=window.setTimeout(()=>{s.current=i,n(e)},t);return()=>window.clearTimeout(o)}},[e,t]),r}function RZ(){const[e,t]=h.useState({x:null,y:null}),r=h.useCallback((...n)=>{if(typeof n[0]=="object")window.scrollTo(n[0]);else if(typeof n[0]=="number"&&typeof n[1]=="number")window.scrollTo(n[0],n[1]);else throw new Error("Invalid arguments passed to scrollTo. See here for more info. https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo")},[]);return h.useLayoutEffect(()=>{const n=()=>{t({x:window.scrollX,y:window.scrollY})};return n(),window.addEventListener("scroll",n),()=>{window.removeEventListener("scroll",n)}},[]),[e,r]}const Kn={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};function wO(e){return"init"in e}function Ip(e){return!!e.write}function jj(e){return"v"in e||"e"in e}function Ou(e){if("e"in e)throw e.e;if((Kn?"production":void 0)!=="production"&&!("v"in e))throw new Error("[Bug] atom state is not initialized");return e.v}function Pu(e){return typeof(e==null?void 0:e.then)=="function"}function jO(e,t,r){if(!r.p.has(e)){r.p.add(e);const n=()=>r.p.delete(e);t.then(n,n)}}function NO(e,t,r){var n;const s=new Set;for(const i of((n=r.get(e))==null?void 0:n.t)||[])s.add(i);for(const i of t.p)s.add(i);return s}const $Z=(e,t,...r)=>t.read(...r),zZ=(e,t,...r)=>t.write(...r),LZ=(e,t)=>{var r;return(r=t.INTERNAL_onInit)==null?void 0:r.call(t,e)},FZ=(e,t,r)=>{var n;return(n=t.onMount)==null?void 0:n.call(t,r)},BZ=(e,t)=>{var r;const n=Ut(e),s=n[0],i=n[6],o=n[9];if((Kn?"production":void 0)!=="production"&&!t)throw new Error("Atom is undefined or null");let l=s.get(t);return l||(l={d:new Map,p:new Set,n:0},s.set(t,l),(r=i.i)==null||r.call(i,t),o==null||o(e,t)),l},WZ=e=>{const t=Ut(e),r=t[1],n=t[3],s=t[4],i=t[5],o=t[6],l=t[13],c=[],d=u=>{try{u()}catch(f){c.push(f)}};do{o.f&&d(o.f);const u=new Set,f=u.add.bind(u);n.forEach(m=>{var p;return(p=r.get(m))==null?void 0:p.l.forEach(f)}),n.clear(),i.forEach(f),i.clear(),s.forEach(f),s.clear(),u.forEach(d),n.size&&l(e)}while(n.size||i.size||s.size);if(c.length)throw new AggregateError(c)},UZ=e=>{const t=Ut(e),r=t[1],n=t[2],s=t[3],i=t[11],o=t[14],l=t[17],c=[],d=new WeakSet,u=new WeakSet,f=Array.from(s);for(;f.length;){const m=f[f.length-1],p=i(e,m);if(u.has(m)){f.pop();continue}if(d.has(m)){if(n.get(m)===p.n)c.push([m,p]);else if((Kn?"production":void 0)!=="production"&&n.has(m))throw new Error("[Bug] invalidated atom exists");u.add(m),f.pop();continue}d.add(m);for(const x of NO(m,p,r))d.has(x)||f.push(x)}for(let m=c.length-1;m>=0;--m){const[p,x]=c[m];let g=!1;for(const v of x.d.keys())if(v!==p&&s.has(v)){g=!0;break}g&&(o(e,p),l(e,p)),n.delete(p)}},Rp=new WeakSet,qZ=(e,t)=>{var r,n;const s=Ut(e),i=s[1],o=s[2],l=s[3],c=s[6],d=s[7],u=s[11],f=s[12],m=s[13],p=s[14],x=s[16],g=s[17],v=s[20],y=s[26],j=u(e,t);if(jj(j)){if(i.has(t)&&o.get(t)!==j.n)return j;let L=!1;for(const[F,X]of j.d)if(p(e,F).n!==X){L=!0;break}if(!L)return j}let N=!0;const w=new Set(j.d.keys()),k=new Map,b=()=>{for(const L of w)k.has(L)||j.d.delete(L)},C=()=>{if(i.has(t)){const L=!l.size;g(e,t),L&&(m(e),f(e))}},_=L=>{var F;if(L===t){const T=u(e,L);if(!jj(T))if(wO(L))v(e,L,L.init);else throw new Error("no atom init");return Ou(T)}const X=p(e,L);try{return Ou(X)}finally{k.set(L,X.n),j.d.set(L,X.n),Pu(j.v)&&jO(t,j.v,X),i.has(t)&&((F=i.get(L))==null||F.t.add(t)),N||C()}};let S,I;const A={get signal(){return S||(S=new AbortController),S.signal},get setSelf(){return(Kn?"production":void 0)!=="production"&&console.warn("[DEPRECATED] setSelf is deprecated and will be removed in v3."),(Kn?"production":void 0)!=="production"&&!Ip(t)&&console.warn("setSelf function cannot be used with read-only atom"),!I&&Ip(t)&&(I=(...L)=>{if((Kn?"production":void 0)!=="production"&&N&&console.warn("setSelf function cannot be called in sync"),!N)try{return x(e,t,...L)}finally{m(e),f(e)}}),I}},O=j.n;try{(Kn?"production":void 0)!=="production"&&Rp.delete(e);const L=d(e,t,_,A);if((Kn?"production":void 0)!=="production"&&Rp.has(e)&&console.warn("Detected store mutation during atom read. This is not supported."),v(e,t,L),Pu(L)){y(e,L,()=>S==null?void 0:S.abort());const F=()=>{b(),C()};L.then(F,F)}else b();return(r=c.r)==null||r.call(c,t),j}catch(L){return delete j.v,j.e=L,++j.n,j}finally{N=!1,O!==j.n&&o.get(t)===O&&(o.set(t,j.n),l.add(t),(n=c.c)==null||n.call(c,t))}},HZ=(e,t)=>{const r=Ut(e),n=r[1],s=r[2],i=r[11],o=[t];for(;o.length;){const l=o.pop(),c=i(e,l);for(const d of NO(l,c,n)){const u=i(e,d);s.get(d)!==u.n&&(s.set(d,u.n),o.push(d))}}},KZ=(e,t,...r)=>{const n=Ut(e),s=n[3],i=n[6],o=n[8],l=n[11],c=n[12],d=n[13],u=n[14],f=n[15],m=n[16],p=n[17],x=n[20];let g=!0;const v=j=>Ou(u(e,j)),y=(j,...N)=>{var w;const k=l(e,j);try{if(j===t){if(!wO(j))throw new Error("atom not writable");(Kn?"production":void 0)!=="production"&&Rp.add(e);const b=k.n,C=N[0];x(e,j,C),p(e,j),b!==k.n&&(s.add(j),f(e,j),(w=i.c)==null||w.call(i,j));return}else return m(e,j,...N)}finally{g||(d(e),c(e))}};try{return o(e,t,v,y,...r)}finally{g=!1}},YZ=(e,t)=>{var r;const n=Ut(e),s=n[1],i=n[3],o=n[6],l=n[11],c=n[15],d=n[18],u=n[19],f=l(e,t),m=s.get(t);if(m){for(const[p,x]of f.d)if(!m.d.has(p)){const g=l(e,p);d(e,p).t.add(t),m.d.add(p),x!==g.n&&(i.add(p),c(e,p),(r=o.c)==null||r.call(o,p))}for(const p of m.d)if(!f.d.has(p)){m.d.delete(p);const x=u(e,p);x==null||x.t.delete(t)}}},GZ=(e,t)=>{var r;const n=Ut(e),s=n[1],i=n[4],o=n[6],l=n[10],c=n[11],d=n[12],u=n[13],f=n[14],m=n[16],p=n[18],x=c(e,t);let g=s.get(t);if(!g){f(e,t);for(const v of x.d.keys())p(e,v).t.add(t);if(g={l:new Set,d:new Set(x.d.keys()),t:new Set},s.set(t,g),Ip(t)){const v=()=>{let y=!0;const j=(...N)=>{try{return m(e,t,...N)}finally{y||(u(e),d(e))}};try{const N=l(e,t,j);N&&(g.u=()=>{y=!0;try{N()}finally{y=!1}})}finally{y=!1}};i.add(v)}(r=o.m)==null||r.call(o,t)}return g},VZ=(e,t)=>{var r,n;const s=Ut(e),i=s[1],o=s[5],l=s[6],c=s[11],d=s[19],u=c(e,t);let f=i.get(t);if(!f||f.l.size)return f;let m=!1;for(const p of f.t)if((r=i.get(p))!=null&&r.d.has(t)){m=!0;break}if(!m){f.u&&o.add(f.u),f=void 0,i.delete(t);for(const p of u.d.keys()){const x=d(e,p);x==null||x.t.delete(t)}(n=l.u)==null||n.call(l,t);return}return f},XZ=(e,t,r)=>{const n=Ut(e),s=n[11],i=n[27],o=s(e,t),l="v"in o,c=o.v;if(Pu(r))for(const d of o.d.keys())jO(t,r,s(e,d));o.v=r,delete o.e,(!l||!Object.is(c,o.v))&&(++o.n,Pu(c)&&i(e,c))},QZ=(e,t)=>{const r=Ut(e)[14];return Ou(r(e,t))},ZZ=(e,t,...r)=>{const n=Ut(e),s=n[12],i=n[13],o=n[16];try{return o(e,t,...r)}finally{i(e),s(e)}},JZ=(e,t,r)=>{const n=Ut(e),s=n[12],i=n[18],o=n[19],c=i(e,t).l;return c.add(r),s(e),()=>{c.delete(r),o(e,t),s(e)}},eJ=(e,t,r)=>{const s=Ut(e)[25];let i=s.get(t);if(!i){i=new Set,s.set(t,i);const o=()=>s.delete(t);t.then(o,o)}i.add(r)},tJ=(e,t)=>{const s=Ut(e)[25].get(t);s==null||s.forEach(i=>i())},kO=new WeakMap,Ut=e=>{const t=kO.get(e);if((Kn?"production":void 0)!=="production"&&!t)throw new Error("Store must be created by buildStore to read its building blocks");return t};function rJ(e){const t=Ut(e),r=t[24];return r?r(t):t}function nJ(...e){const t={get(n){const s=Ut(t)[21];return s(t,n)},set(n,...s){const i=Ut(t)[22];return i(t,n,...s)},sub(n,s){const i=Ut(t)[23];return i(t,n,s)}},r=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},$Z,zZ,LZ,FZ,BZ,WZ,UZ,qZ,HZ,KZ,YZ,GZ,VZ,XZ,QZ,ZZ,JZ,void 0,new WeakMap,eJ,tJ].map((n,s)=>e[s]||n);return kO.set(t,Object.freeze(r)),t}const SO={};let aJ=0;function CO(e,t){const r=`atom${++aJ}`,n={toString(){return(SO?"production":void 0)!=="production"&&this.debugLabel?r+":"+this.debugLabel:r}};return typeof e=="function"?n.read=e:(n.init=e,n.read=sJ,n.write=iJ),n}function sJ(e){return e(this)}function iJ(e,t,r){return t(this,typeof r=="function"?r(e(this)):r)}function oJ(){return nJ()}let ll;function lJ(){return ll||(ll=oJ(),(SO?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=ll),globalThis.__JOTAI_DEFAULT_STORE__!==ll&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),ll}const cJ={},dJ=h.createContext(void 0);function _O(e){return h.useContext(dJ)||lJ()}const $p=e=>typeof(e==null?void 0:e.then)=="function",zp=e=>{e.status||(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}))},uJ=W.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(zp(e),e)}),hh=new WeakMap,Nj=(e,t,r)=>{const s=rJ(e)[26];let i=hh.get(t);return i||(i=new Promise((o,l)=>{let c=t;const d=m=>p=>{c===m&&o(p)},u=m=>p=>{c===m&&l(p)},f=()=>{try{const m=r();$p(m)?(hh.set(m,i),c=m,m.then(d(m),u(m)),s(e,m,f)):o(m)}catch(m){l(m)}};t.then(d(t),u(t)),s(e,t,f)}),hh.set(t,i)),i};function fJ(e,t){const{delay:r,unstable_promiseStatus:n=!W.use}={},s=_O(),[[i,o,l],c]=h.useReducer(u=>{const f=s.get(e);return Object.is(u[0],f)&&u[1]===s&&u[2]===e?u:[f,s,e]},void 0,()=>[s.get(e),s,e]);let d=i;if((o!==s||l!==e)&&(c(),d=s.get(e)),h.useEffect(()=>{const u=s.sub(e,()=>{if(n)try{const f=s.get(e);$p(f)&&zp(Nj(s,f,()=>s.get(e)))}catch{}if(typeof r=="number"){setTimeout(c,r);return}c()});return c(),u},[s,e,r,n]),h.useDebugValue(d),$p(d)){const u=Nj(s,d,()=>s.get(e));return n&&zp(u),uJ(u)}return d}function mJ(e,t){const r=_O();return h.useCallback((...s)=>{if((cJ?"production":void 0)!=="production"&&!("write"in e))throw new Error("not writable atom");return r.set(e,...s)},[r,e])}function MO(e,t){return[fJ(e),mJ(e)]}var OO="Expected a function",kj=NaN,hJ="[object Symbol]",pJ=/^\s+|\s+$/g,xJ=/^[-+]0x[0-9a-f]+$/i,gJ=/^0b[01]+$/i,vJ=/^0o[0-7]+$/i,yJ=parseInt,bJ=typeof Ic=="object"&&Ic&&Ic.Object===Object&&Ic,wJ=typeof self=="object"&&self&&self.Object===Object&&self,jJ=bJ||wJ||Function("return this")(),NJ=Object.prototype,kJ=NJ.toString,SJ=Math.max,CJ=Math.min,ph=function(){return jJ.Date.now()};function _J(e,t,r){var n,s,i,o,l,c,d=0,u=!1,f=!1,m=!0;if(typeof e!="function")throw new TypeError(OO);t=Sj(t)||0,Eu(r)&&(u=!!r.leading,f="maxWait"in r,i=f?SJ(Sj(r.maxWait)||0,t):i,m="trailing"in r?!!r.trailing:m);function p(b){var C=n,_=s;return n=s=void 0,d=b,o=e.apply(_,C),o}function x(b){return d=b,l=setTimeout(y,t),u?p(b):o}function g(b){var C=b-c,_=b-d,S=t-C;return f?CJ(S,i-_):S}function v(b){var C=b-c,_=b-d;return c===void 0||C>=t||C<0||f&&_>=i}function y(){var b=ph();if(v(b))return j(b);l=setTimeout(y,g(b))}function j(b){return l=void 0,m&&n?p(b):(n=s=void 0,o)}function N(){l!==void 0&&clearTimeout(l),d=0,n=c=s=l=void 0}function w(){return l===void 0?o:j(ph())}function k(){var b=ph(),C=v(b);if(n=arguments,s=this,c=b,C){if(l===void 0)return x(c);if(f)return l=setTimeout(y,t),p(c)}return l===void 0&&(l=setTimeout(y,t)),o}return k.cancel=N,k.flush=w,k}function MJ(e,t,r){var n=!0,s=!0;if(typeof e!="function")throw new TypeError(OO);return Eu(r)&&(n="leading"in r?!!r.leading:n,s="trailing"in r?!!r.trailing:s),_J(e,t,{leading:n,maxWait:t,trailing:s})}function Eu(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function OJ(e){return!!e&&typeof e=="object"}function PJ(e){return typeof e=="symbol"||OJ(e)&&kJ.call(e)==hJ}function Sj(e){if(typeof e=="number")return e;if(PJ(e))return kj;if(Eu(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Eu(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(pJ,"");var r=gJ.test(e);return r||vJ.test(e)?yJ(e.slice(2),r?2:8):xJ.test(e)?kj:+e}var EJ=MJ;const AJ=Fa(EJ),PO=h.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:z("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));PO.displayName="Card";const DJ=h.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:z("flex flex-col space-y-1.5 p-6",e),...t}));DJ.displayName="CardHeader";const TJ=h.forwardRef(({className:e,...t},r)=>a.jsx("h3",{ref:r,className:z("text-2xl font-semibold leading-none tracking-tight",e),...t}));TJ.displayName="CardTitle";const IJ=h.forwardRef(({className:e,...t},r)=>a.jsx("p",{ref:r,className:z("text-sm text-muted-foreground",e),...t}));IJ.displayName="CardDescription";const RJ=h.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:z("p-6 pt-0",e),...t}));RJ.displayName="CardContent";const $J=h.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:z("flex items-center p-6 pt-0",e),...t}));$J.displayName="CardFooter";function zJ(e,t=[]){let r=[];function n(i,o){const l=h.createContext(o),c=r.length;r=[...r,o];const d=f=>{var y;const{scope:m,children:p,...x}=f,g=((y=m==null?void 0:m[e])==null?void 0:y[c])||l,v=h.useMemo(()=>x,Object.values(x));return a.jsx(g.Provider,{value:v,children:p})};d.displayName=i+"Provider";function u(f,m){var g;const p=((g=m==null?void 0:m[e])==null?void 0:g[c])||l,x=h.useContext(p);if(x)return x;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[d,u]}const s=()=>{const i=r.map(o=>h.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return h.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[n,LJ(s,...t)]}function LJ(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=n.reduce((l,{useScope:c,scopeName:d})=>{const f=c(i)[`__scope${d}`];return{...l,...f}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}function FJ(e){const t=BJ(e),r=h.forwardRef((n,s)=>{const{children:i,...o}=n,l=h.Children.toArray(i),c=l.find(UJ);if(c){const d=c.props.children,u=l.map(f=>f===c?h.Children.count(d)>1?h.Children.only(null):h.isValidElement(d)?d.props.children:null:f);return a.jsx(t,{...o,ref:s,children:h.isValidElement(d)?h.cloneElement(d,void 0,u):null})}return a.jsx(t,{...o,ref:s,children:i})});return r.displayName=`${e}.Slot`,r}function BJ(e){const t=h.forwardRef((r,n)=>{const{children:s,...i}=r;if(h.isValidElement(s)){const o=HJ(s),l=qJ(i,s.props);return s.type!==h.Fragment&&(l.ref=n?r1(n,o):o),h.cloneElement(s,l)}return h.Children.count(s)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var WJ=Symbol("radix.slottable");function UJ(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===WJ}function qJ(e,t){const r={...t};for(const n in t){const s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...i}:n==="className"&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}function HJ(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var KJ=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],YJ=KJ.reduce((e,t)=>{const r=FJ(`Primitive.${t}`),n=h.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),kv="ContextMenu",[GJ]=zJ(kv,[i1]),Tr=i1(),[VJ,EO]=GJ(kv),AO=e=>{const{__scopeContextMenu:t,children:r,onOpenChange:n,dir:s,modal:i=!0}=e,[o,l]=h.useState(!1),c=Tr(t),d=oE(n),u=h.useCallback(f=>{l(f),d(f)},[d]);return a.jsx(VJ,{scope:t,open:o,onOpenChange:u,modal:i,children:a.jsx(lE,{...c,dir:s,open:o,onOpenChange:u,modal:i,children:r})})};AO.displayName=kv;var DO="ContextMenuTrigger",TO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,disabled:n=!1,...s}=e,i=EO(DO,r),o=Tr(r),l=h.useRef({x:0,y:0}),c=h.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...l.current})}),d=h.useRef(0),u=h.useCallback(()=>window.clearTimeout(d.current),[]),f=m=>{l.current={x:m.clientX,y:m.clientY},i.onOpenChange(!0)};return h.useEffect(()=>u,[u]),h.useEffect(()=>void(n&&u()),[n,u]),a.jsxs(a.Fragment,{children:[a.jsx(cE,{...o,virtualRef:c}),a.jsx(YJ.span,{"data-state":i.open?"open":"closed","data-disabled":n?"":void 0,...s,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:n?e.onContextMenu:Fs(e.onContextMenu,m=>{u(),f(m),m.preventDefault()}),onPointerDown:n?e.onPointerDown:Fs(e.onPointerDown,fd(m=>{u(),d.current=window.setTimeout(()=>f(m),700)})),onPointerMove:n?e.onPointerMove:Fs(e.onPointerMove,fd(u)),onPointerCancel:n?e.onPointerCancel:Fs(e.onPointerCancel,fd(u)),onPointerUp:n?e.onPointerUp:Fs(e.onPointerUp,fd(u))})]})});TO.displayName=DO;var XJ="ContextMenuPortal",IO=e=>{const{__scopeContextMenu:t,...r}=e,n=Tr(t);return a.jsx(JP,{...n,...r})};IO.displayName=XJ;var RO="ContextMenuContent",$O=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,s=EO(RO,r),i=Tr(r),o=h.useRef(!1);return a.jsx(eE,{...i,...n,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:l=>{var c;(c=e.onCloseAutoFocus)==null||c.call(e,l),!l.defaultPrevented&&o.current&&l.preventDefault(),o.current=!1},onInteractOutside:l=>{var c;(c=e.onInteractOutside)==null||c.call(e,l),!l.defaultPrevented&&!s.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});$O.displayName=RO;var QJ="ContextMenuGroup",ZJ=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,s=Tr(r);return a.jsx(dE,{...s,...n,ref:t})});ZJ.displayName=QJ;var JJ="ContextMenuLabel",zO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,s=Tr(r);return a.jsx(sE,{...s,...n,ref:t})});zO.displayName=JJ;var eee="ContextMenuItem",LO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,s=Tr(r);return a.jsx(tE,{...s,...n,ref:t})});LO.displayName=eee;var tee="ContextMenuCheckboxItem",FO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,s=Tr(r);return a.jsx(rE,{...s,...n,ref:t})});FO.displayName=tee;var ree="ContextMenuRadioGroup",nee=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,s=Tr(r);return a.jsx(uE,{...s,...n,ref:t})});nee.displayName=ree;var aee="ContextMenuRadioItem",BO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,s=Tr(r);return a.jsx(aE,{...s,...n,ref:t})});BO.displayName=aee;var see="ContextMenuItemIndicator",WO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,s=Tr(r);return a.jsx(nE,{...s,...n,ref:t})});WO.displayName=see;var iee="ContextMenuSeparator",UO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,s=Tr(r);return a.jsx(iE,{...s,...n,ref:t})});UO.displayName=iee;var oee="ContextMenuArrow",lee=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,s=Tr(r);return a.jsx(fE,{...s,...n,ref:t})});lee.displayName=oee;var cee="ContextMenuSubTrigger",qO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,s=Tr(r);return a.jsx(QP,{...s,...n,ref:t})});qO.displayName=cee;var dee="ContextMenuSubContent",HO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,s=Tr(r);return a.jsx(ZP,{...s,...n,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});HO.displayName=dee;function fd(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var uee=AO,fee=TO,mee=IO,KO=$O,YO=zO,GO=LO,VO=FO,XO=BO,QO=WO,ZO=UO,JO=qO,eP=HO;const hee=uee,pee=fee,xee=h.forwardRef(({className:e,inset:t,children:r,...n},s)=>a.jsxs(JO,{ref:s,className:z("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t&&"pl-8",e),...n,children:[r,a.jsx(vr,{className:"ml-auto h-4 w-4"})]}));xee.displayName=JO.displayName;const gee=h.forwardRef(({className:e,...t},r)=>a.jsx(eP,{ref:r,className:z("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));gee.displayName=eP.displayName;const tP=h.forwardRef(({className:e,...t},r)=>a.jsx(mee,{children:a.jsx(KO,{ref:r,className:z("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t})}));tP.displayName=KO.displayName;const rP=h.forwardRef(({className:e,inset:t,...r},n)=>a.jsx(GO,{ref:n,className:z("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...r}));rP.displayName=GO.displayName;const vee=h.forwardRef(({className:e,children:t,checked:r,...n},s)=>a.jsxs(VO,{ref:s,className:z("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(QO,{children:a.jsx(dr,{className:"h-4 w-4"})})}),t]}));vee.displayName=VO.displayName;const yee=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(XO,{ref:n,className:z("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(QO,{children:a.jsx(_r,{className:"h-2 w-2 fill-current"})})}),t]}));yee.displayName=XO.displayName;const bee=h.forwardRef(({className:e,inset:t,...r},n)=>a.jsx(YO,{ref:n,className:z("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...r}));bee.displayName=YO.displayName;const wee=h.forwardRef(({className:e,...t},r)=>a.jsx(ZO,{ref:r,className:z("-mx-1 my-1 h-px bg-border",e),...t}));wee.displayName=ZO.displayName;const jee=CO(!1),Nee=CO(0),Sv=()=>MO(jee),Cv=()=>MO(Nee),kee=e=>{let t=r=>1;return(e==="monthly"||e==="quarterly")&&(t=ws),t},Tc=e=>{let t=DN;return(e==="monthly"||e==="quarterly")&&(t=RN),t},_v=e=>{let t=M3;return(e==="monthly"||e==="quarterly")&&(t=DN),t},Hl=e=>{let t=Qi;return(e==="monthly"||e==="quarterly")&&(t=zN),t},See=e=>{let t=IN;return(e==="monthly"||e==="quarterly")&&(t=bx),t},nP=e=>{let t=Ur;return(e==="monthly"||e==="quarterly")&&(t=gx),t},pl=(e,t)=>{const r=new Date(e.timelineData[0].year,0,1),n=e.columnWidth*e.zoom/100,s=Math.floor(t/n),i=kee(e.range),l=nP(e.range)(r,s),c=i(l),d=Math.round(n/c),u=Math.floor(t%n/d);return Ur(l,u)},Cee=e=>{const t=[];t.push({year:e.getFullYear()-1,quarters:new Array(4).fill(null)},{year:e.getFullYear(),quarters:new Array(4).fill(null)},{year:e.getFullYear()+1,quarters:new Array(4).fill(null)});for(const r of t)r.quarters=new Array(4).fill(null).map((n,s)=>({months:new Array(3).fill(null).map((i,o)=>{const l=s*3+o;return{days:ws(new Date(r.year,l,1))}})}));return t},aP=(e,t,r)=>{const n=r.columnWidth*r.zoom/100,s=Tc(r.range),i=Hl(r.range),o=s(i(e),t);if(r.range==="daily")return n*o;const l=e.getDate(),c=ws(e),d=n/c;return o*n+l*d},_ee=(e,t,r)=>{const n=r.columnWidth*r.zoom/100;if(!t)return n*2;const s=Tc(r.range);if(r.range==="daily"){const x=s(t,e);return n*(x||1)}const i=ws(e),o=n/i;if(Zi(e,t))return o;const l=_v(r.range),c=Hl(r.range);if(Zi(c(e),c(t)))return l(t,e)*o;const d=i-gl(e),u=gl(t),f=s(c(t),c(e)),m=ws(t),p=n/m;return(f-1)*n+d*o+u*p},sP=(e,t,r)=>{const n=Hl(t),s=See(t),i=_v(t),o=n(e),l=s(e),c=i(l,o);return e.getDate()/c*r},Rn=h.createContext({zoom:100,range:"monthly",columnWidth:50,headerHeight:60,sidebarWidth:300,rowHeight:36,onAddItem:void 0,placeholderLength:2,timelineData:[],ref:null,scrollToFeature:void 0}),Mv=({title:e,columns:t,renderHeaderItem:r})=>{const n=h.useId();return a.jsxs("div",{className:"sticky top-0 z-20 grid w-full shrink-0 bg-backdrop/90 backdrop-blur-sm",style:{height:"var(--gantt-header-height)"},children:[a.jsx("div",{children:a.jsx("div",{className:"sticky inline-flex whitespace-nowrap px-3 py-2 text-muted-foreground text-xs",style:{left:"var(--gantt-sidebar-width)"},children:a.jsx("p",{children:e})})}),a.jsx("div",{className:"grid w-full",style:{gridTemplateColumns:`repeat(${t}, var(--gantt-column-width))`},children:Array.from({length:t}).map((s,i)=>a.jsx("div",{className:"shrink-0 border-border/50 border-b py-1 text-center text-xs",children:r(i)},`${n}-${i}`))})]})},Mee=()=>h.useContext(Rn).timelineData.map(t=>t.quarters.flatMap(r=>r.months).map((r,n)=>a.jsxs("div",{className:"relative flex flex-col",children:[a.jsx(Mv,{columns:r.days,renderHeaderItem:s=>a.jsxs("div",{className:"flex items-center justify-center gap-1",children:[a.jsx("p",{children:fe(Ur(new Date(t.year,n,1),s),"d")}),a.jsx("p",{className:"text-muted-foreground",children:fe(Ur(new Date(t.year,n,1),s),"EEEEE")})]}),title:fe(new Date(t.year,n,1),"MMMM yyyy")}),a.jsx(Ov,{columns:r.days,isColumnSecondary:s=>[0,6].includes(Ur(new Date(t.year,n,1),s).getDay())})]},`${t.year}-${n}`))),Oee=()=>h.useContext(Rn).timelineData.map(t=>a.jsxs("div",{className:"relative flex flex-col",children:[a.jsx(Mv,{columns:t.quarters.flatMap(r=>r.months).length,renderHeaderItem:r=>a.jsx("p",{children:fe(new Date(t.year,r,1),"MMM")}),title:`${t.year}`}),a.jsx(Ov,{columns:t.quarters.flatMap(r=>r.months).length})]},t.year)),Pee=()=>h.useContext(Rn).timelineData.map(t=>t.quarters.map((r,n)=>a.jsxs("div",{className:"relative flex flex-col",children:[a.jsx(Mv,{columns:r.months.length,renderHeaderItem:s=>a.jsx("p",{children:fe(new Date(t.year,n*3+s,1),"MMM")}),title:`Q${n+1} ${t.year}`}),a.jsx(Ov,{columns:r.months.length})]},`${t.year}-${n}`))),Eee={daily:Mee,monthly:Oee,quarterly:Pee},Aee=({className:e})=>{const t=h.useContext(Rn),r=Eee[t.range];return a.jsx("div",{className:z("-space-x-px flex h-full w-max divide-x divide-border/50",e),children:a.jsx(r,{})})},xh=({feature:e,onSelectItem:t,className:r,duration:n})=>{const s=h.useContext(Rn),i=e.endAt&&Zi(e.startAt,e.endAt)?Ur(e.endAt,1):e.endAt,o=n??(i?_h(e.startAt,i):`${_h(e.startAt,new Date)} so far`),l=d=>{var u;d.target===d.currentTarget&&((u=s.scrollToFeature)==null||u.call(s,e),t==null||t(e.id))},c=d=>{var u;d.key==="Enter"&&((u=s.scrollToFeature)==null||u.call(s,e),t==null||t(e.id))};return a.jsxs("div",{className:z("relative flex items-center gap-2.5 p-2.5 text-xs hover:bg-secondary",r),onClick:l,onKeyDown:c,role:"button",style:{height:"var(--gantt-row-height)"},tabIndex:0,children:[a.jsx("div",{className:"pointer-events-none h-2 w-2 shrink-0 rounded-full",style:{backgroundColor:e.status.color}}),a.jsx("p",{className:"pointer-events-none flex-1 truncate text-left font-medium",children:e.name}),a.jsx("p",{className:"pointer-events-none text-muted-foreground",children:o})]},e.id)},Dee=()=>a.jsxs("div",{className:"sticky top-0 z-10 flex shrink-0 items-end justify-between gap-2.5 border-border/50 border-b bg-backdrop/90 p-2.5 font-medium text-muted-foreground text-xs backdrop-blur-sm",style:{height:"var(--gantt-header-height)"},children:[a.jsx("p",{className:"flex-1 truncate text-left",children:"Issues"}),a.jsx("p",{className:"shrink-0",children:"Duration"})]}),gh=({children:e,name:t,className:r})=>a.jsxs("div",{className:r,children:[a.jsx("p",{className:"w-full truncate p-2.5 text-left font-medium text-muted-foreground text-xs",style:{height:"var(--gantt-row-height)"},children:t}),a.jsx("div",{className:"divide-y divide-border/50",children:e})]}),Tee=({children:e,className:t})=>a.jsxs("div",{className:z("sticky left-0 z-30 h-max min-h-full overflow-clip border-border/50 border-r bg-white dark:bg-zinc-950 backdrop-blur-md",t),"data-roadmap-ui":"gantt-sidebar",children:[a.jsx(Dee,{}),a.jsx("div",{className:"space-y-4",children:e})]}),Iee=({top:e,className:t})=>{const[r]=Cv(),n=h.useContext(Rn),[s,i]=Nv(),o=()=>{var u,f,m;const l=(f=(u=n.ref)==null?void 0:u.current)==null?void 0:f.getBoundingClientRect(),c=s.x-((l==null?void 0:l.left)??0)+r-n.sidebarWidth,d=pl(n,c);(m=n.onAddItem)==null||m.call(n,d)};return a.jsx("div",{className:z("absolute top-0 w-full px-0.5",t),ref:i,style:{marginTop:-n.rowHeight/2,transform:`translateY(${e}px)`},children:a.jsx("button",{className:"flex h-full w-full items-center justify-center rounded-md border border-dashed p-2",onClick:o,type:"button",children:a.jsx(dt,{className:"pointer-events-none select-none text-muted-foreground",size:16})})})},Ree=({index:e,isColumnSecondary:t})=>{var m;const r=h.useContext(Rn),[n]=Sv(),[s,i]=Nv(),[o,l]=h.useState(!1),[c]=RZ(),d=()=>l(!0),u=()=>l(!1),f=IZ(s.y-(((m=i.current)==null?void 0:m.getBoundingClientRect().y)??0)-(c.y??0),10);return a.jsx("div",{className:z("group relative h-full overflow-hidden",t!=null&&t(e)?"bg-[#f59e0b]/5 dark:bg-[#f59e0b]/5":""),onMouseEnter:d,onMouseLeave:u,ref:i,children:!n&&o&&r.onAddItem?a.jsx(Iee,{top:f}):null})},Ov=({columns:e,isColumnSecondary:t})=>{const r=h.useId();return a.jsx("div",{className:"divide grid h-full w-full divide-x divide-border/50",style:{gridTemplateColumns:`repeat(${e}, var(--gantt-column-width))`},children:Array.from({length:e}).map((n,s)=>a.jsx(Ree,{index:s,isColumnSecondary:t},`${r}-${s}`))})},Cj=({direction:e,featureId:t,date:r})=>{const[,n]=Sv(),{attributes:s,listeners:i,setNodeRef:o}=d1({id:`feature-drag-helper-${t}`}),l=!!s["aria-pressed"];return h.useEffect(()=>n(l),[l,n]),a.jsxs("div",{className:z("group -translate-y-1/2 !cursor-col-resize absolute top-1/2 z-[3] h-full w-6 rounded-md outline-none",e==="left"?"-left-2.5":"-right-2.5"),ref:o,...s,...i,children:[a.jsx("div",{className:z("-translate-y-1/2 absolute top-1/2 h-[80%] w-1 rounded-sm bg-muted-foreground opacity-0 transition-all",e==="left"?"left-2.5":"right-2.5",e==="left"?"group-hover:left-0":"group-hover:right-0",l&&(e==="left"?"left-0":"right-0"),"group-hover:opacity-100",l&&"opacity-100")}),r&&a.jsx("div",{className:z("-translate-x-1/2 absolute top-10 hidden whitespace-nowrap rounded-lg border border-border/50 bg-background/90 px-2 py-1 text-foreground text-xs backdrop-blur-lg group-hover:block",l&&"block"),children:fe(r,"MMM dd, yyyy")})]})},$ee=({id:e,children:t})=>{const[,r]=Sv(),{attributes:n,listeners:s,setNodeRef:i}=d1({id:e}),o=!!n["aria-pressed"];return h.useEffect(()=>r(o),[o,r]),a.jsx(PO,{className:"h-full w-full rounded-md bg-background p-2 text-xs shadow-sm",children:a.jsx("div",{className:z("flex h-full w-full items-center justify-between gap-2 text-left",o&&"cursor-grabbing"),...n,...s,ref:i,children:t})})},_j=({onMove:e,children:t,className:r,...n})=>{const[s]=Cv(),i=h.useContext(Rn),o=h.useMemo(()=>{var A;return new Date(((A=i.timelineData.at(0))==null?void 0:A.year)??0,0,1)},[i.timelineData]),[l,c]=h.useState(n.startAt),[d,u]=h.useState(n.endAt),f=h.useMemo(()=>_ee(l,d,i),[l,d,i]),m=h.useMemo(()=>aP(l,o,i),[l,o,i]),p=h.useMemo(()=>nP(i.range),[i.range]),[x]=Nv(),[g,v]=h.useState(0),[y,j]=h.useState(l),[N,w]=h.useState(d),k=Up(yE,{activationConstraint:{distance:10}}),b=h.useCallback(()=>{v(x.x),j(l),w(d)},[x.x,l,d]),C=h.useCallback(()=>{const A=pl(i,x.x),O=pl(i,g),L=i.range==="daily"?Tc(i.range)(A,O):_v(i.range)(A,O),F=Ur(y,L),X=N?Ur(N,L):null;c(F),u(X)},[i,x.x,g,y,N]),_=h.useCallback(()=>e==null?void 0:e(n.id,l,d),[e,n.id,l,d]),S=h.useCallback(()=>{var X,T;const A=(T=(X=i.ref)==null?void 0:X.current)==null?void 0:T.getBoundingClientRect(),O=x.x-((A==null?void 0:A.left)??0)+s-i.sidebarWidth,F=Hl(i.range)(pl(i,O));c(F)},[i,x.x,s]),I=h.useCallback(()=>{var X,T;const A=(T=(X=i.ref)==null?void 0:X.current)==null?void 0:T.getBoundingClientRect(),O=x.x-((A==null?void 0:A.left)??0)+s-i.sidebarWidth,F=Hl(i.range)(pl(i,O));u(F)},[i,x.x,s]);return a.jsx("div",{className:z("relative flex w-max min-w-full py-0.5",r),style:{height:"var(--gantt-row-height)"},children:a.jsxs("div",{className:"pointer-events-auto absolute top-0.5",style:{height:"calc(var(--gantt-row-height) - 4px)",width:Math.round(f),left:Math.round(m)},children:[e&&a.jsx(xl,{modifiers:[mh],onDragEnd:_,onDragMove:S,sensors:[k],children:a.jsx(Cj,{date:l,direction:"left",featureId:n.id})}),a.jsx(xl,{modifiers:[mh],onDragEnd:_,onDragMove:C,onDragStart:b,sensors:[k],children:a.jsx($ee,{id:n.id,children:t??a.jsx("p",{className:"flex-1 truncate text-xs",children:n.name})})}),e&&a.jsx(xl,{modifiers:[mh],onDragEnd:_,onDragMove:I,sensors:[k],children:a.jsx(Cj,{date:d?UN(d,1):p(l,1),direction:"right",featureId:n.id})})]})})},vh=({children:e,className:t})=>a.jsx("div",{className:t,style:{paddingTop:"var(--gantt-row-height)"},children:e}),zee=({className:e,children:t})=>a.jsx("div",{className:z("absolute top-0 left-0 h-full w-max space-y-4",e),style:{marginTop:"var(--gantt-header-height)"},children:t}),iP=h.memo(({label:e,date:t,id:r,onRemove:n,className:s})=>{const i=h.useContext(Rn),o=h.useMemo(()=>Tc(i.range),[i.range]),l=h.useMemo(()=>{var f;return new Date(((f=i.timelineData.at(0))==null?void 0:f.year)??0,0,1)},[i.timelineData]),c=h.useMemo(()=>o(t,l),[o,t,l]),d=h.useMemo(()=>sP(t,i.range,i.columnWidth*i.zoom/100),[t,i.range,i.columnWidth,i.zoom]),u=h.useCallback(()=>n==null?void 0:n(r),[n,r]);return a.jsxs("div",{className:"pointer-events-none absolute top-0 left-0 z-20 flex h-full select-none flex-col items-center justify-center overflow-visible",style:{width:0,transform:`translateX(calc(var(--gantt-column-width) * ${c} + ${d}px))`},children:[a.jsxs(hee,{children:[a.jsx(pee,{asChild:!0,children:a.jsxs("div",{className:z("group pointer-events-auto sticky top-0 flex select-auto flex-col flex-nowrap items-center justify-center whitespace-nowrap rounded-b-md bg-card px-2 py-1 text-foreground text-xs",s),children:[e,a.jsx("span",{className:"max-h-[0] overflow-hidden opacity-80 transition-all group-hover:max-h-[2rem]",children:fe(t,"MMM dd, yyyy")})]})}),a.jsx(tP,{children:n?a.jsxs(rP,{className:"flex items-center gap-2 text-destructive",onClick:u,children:[a.jsx(T5,{size:16}),"Remove marker"]}):null})]}),a.jsx("div",{className:z("h-full w-px bg-card",s)})]})});iP.displayName="GanttMarker";const Lee=({zoom:e=100,range:t="monthly",onAddItem:r,children:n,className:s})=>{const i=h.useRef(null),[o,l]=h.useState(Cee(new Date)),[,c]=Cv(),[d,u]=h.useState(0),f=60,m=36;let p=50;t==="monthly"?p=150:t==="quarterly"&&(p=100);const x=h.useMemo(()=>({"--gantt-zoom":`${e}`,"--gantt-column-width":`${e/100*p}px`,"--gantt-header-height":`${f}px`,"--gantt-row-height":`${m}px`,"--gantt-sidebar-width":`${d}px`}),[e,p,d]);h.useEffect(()=>{i.current&&(i.current.scrollLeft=i.current.scrollWidth/2-i.current.clientWidth/2,c(i.current.scrollLeft))},[c]),h.useEffect(()=>{const y=()=>{var k;const w=((k=i.current)==null?void 0:k.querySelector('[data-roadmap-ui="gantt-sidebar"]'))?300:0;u(w)};y();const j=new MutationObserver(y);return i.current&&j.observe(i.current,{childList:!0,subtree:!0}),()=>{j.disconnect()}},[]);const g=h.useCallback(AJ(()=>{var k,b;const y=i.current;if(!y)return;const{scrollLeft:j,scrollWidth:N,clientWidth:w}=y;if(c(j),j===0){const C=(k=o[0])==null?void 0:k.year;if(!C)return;const _=[...o];_.unshift({year:C-1,quarters:new Array(4).fill(null).map((S,I)=>({months:new Array(3).fill(null).map((A,O)=>{const L=I*3+O;return{days:ws(new Date(C,L,1))}})}))}),l(_),y.scrollLeft=y.clientWidth,c(y.scrollLeft)}else if(j+w>=N){const C=(b=o.at(-1))==null?void 0:b.year;if(!C)return;const _=[...o];_.push({year:C+1,quarters:new Array(4).fill(null).map((S,I)=>({months:new Array(3).fill(null).map((A,O)=>{const L=I*3+O;return{days:ws(new Date(C,L,1))}})}))}),l(_),y.scrollLeft=y.scrollWidth-y.clientWidth,c(y.scrollLeft)}},100),[]);h.useEffect(()=>{const y=i.current;return y&&y.addEventListener("scroll",g),()=>{y&&y.removeEventListener("scroll",g)}},[g]);const v=h.useCallback(y=>{const j=i.current;if(!j)return;const N=new Date(o[0].year,0,1),w=aP(y.startAt,N,{zoom:e,range:t,columnWidth:p}),k=Math.max(0,w);j.scrollTo({left:k,behavior:"smooth"})},[o,e,t,p,d,r]);return a.jsx(Rn.Provider,{value:{zoom:e,range:t,headerHeight:f,columnWidth:p,sidebarWidth:d,rowHeight:m,onAddItem:r,timelineData:o,placeholderLength:2,ref:i,scrollToFeature:v},children:a.jsx("div",{className:z("gantt relative isolate grid h-full w-full flex-none select-none overflow-auto rounded-sm bg-secondary",t,s),ref:i,style:{...x,gridTemplateColumns:"var(--gantt-sidebar-width) 1fr"},children:n})})},Fee=({children:e,className:t})=>a.jsx("div",{className:z("relative flex h-full w-max flex-none overflow-clip",t),children:e}),Bee=({className:e})=>{const t="Today",r=h.useMemo(()=>new Date,[]),n=h.useContext(Rn),s=h.useMemo(()=>Tc(n.range),[n.range]),i=h.useMemo(()=>{var c;return new Date(((c=n.timelineData.at(0))==null?void 0:c.year)??0,0,1)},[n.timelineData]),o=h.useMemo(()=>s(r,i),[s,r,i]),l=h.useMemo(()=>sP(r,n.range,n.columnWidth*n.zoom/100),[r,n.range,n.columnWidth,n.zoom]);return a.jsxs("div",{className:"pointer-events-none absolute top-0 left-0 z-20 flex h-full select-none flex-col items-center justify-center overflow-visible",style:{width:0,transform:`translateX(calc(var(--gantt-column-width) * ${o} + ${l}px))`},children:[a.jsxs("div",{className:z("group pointer-events-auto sticky top-0 flex select-auto flex-col flex-nowrap items-center justify-center whitespace-nowrap rounded-b-md bg-card px-2 py-1 text-foreground text-xs",e),children:[t,a.jsx("span",{className:"max-h-[0] overflow-hidden opacity-80 transition-all group-hover:max-h-[2rem]",children:fe(r,"MMM dd, yyyy")})]}),a.jsx("div",{className:z("h-full w-px bg-card",e)})]})};function Wee(e){return Be({queryKey:["public","share",e],queryFn:()=>oe.get(`/public/share/${e}`),select:t=>t.project,enabled:!!e,retry:!1})}function Pv(e,t={}){const r=new URLSearchParams;t.status&&r.set("status",t.status),t.priority&&r.set("priority",t.priority),t.search&&r.set("search",t.search);const n=r.toString()?`?${r.toString()}`:"";return Be({queryKey:["public","share",e,"issues",t],queryFn:()=>oe.get(`/public/share/${e}/issues${n}`),select:s=>s.issues,enabled:!!e,retry:!1})}function oP(e){return Be({queryKey:["public","share",e,"sprints"],queryFn:()=>oe.get(`/public/share/${e}/sprints`),select:t=>t.sprints,enabled:!!e,retry:!1})}function Uee({priority:e,className:t}){const r=z("h-3.5 w-3.5 shrink-0",uc[e],t);switch(e){case"urgent":return a.jsx(oa,{className:r});case"high":return a.jsx(bi,{className:r});case"medium":return a.jsx(Ba,{className:r});case"low":return a.jsx(yi,{className:r});default:return a.jsx(_r,{className:z("h-3.5 w-3.5 shrink-0 text-zinc-300",t)})}}const Lp="grid-cols-[70px_250px_150px_120px_130px_140px_130px]";function lP({issue:e,statuses:t,statusLabels:r,statusColorMap:n,sprints:s,isChild:i=!1,children:o=[],childrenMap:l}){const[c,d]=h.useState(!1),u=o.length>0,f=n[e.status]??"#94a3b8",m=s.find(p=>p.id===e.sprint_id);return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:z(`group grid ${Lp} items-center py-3`,"hover:bg-[#f9fafb] dark:hover:bg-muted/30 transition-colors",i&&"bg-muted/10"),children:[a.jsx("span",{className:z("text-xs font-mono text-muted-foreground truncate","sticky left-0 z-10 pl-6 transition-colors","bg-white dark:bg-card group-hover:bg-[#f9fafb] dark:group-hover:bg-muted/30",i&&"text-muted-foreground/60"),children:e.identifier}),a.jsxs("div",{className:z("flex items-center gap-1 min-w-0 pr-3","sticky left-[70px] z-10 transition-colors","bg-white dark:bg-card group-hover:bg-[#f9fafb] dark:group-hover:bg-muted/30",i&&"bg-[#f8f9fa] dark:bg-muted/20"),children:[u?a.jsxs(Qn,{children:[a.jsx(Zn,{asChild:!0,children:a.jsx("button",{onClick:()=>d(!c),className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors p-0.5 rounded",children:c?a.jsx(ia,{className:"h-3.5 w-3.5"}):a.jsx(vr,{className:"h-3.5 w-3.5"})})}),a.jsx(_n,{side:"top",children:c?"Collapse":"Expand"})]}):i?a.jsx(Mn,{className:"h-3 w-3 text-muted-foreground/40 shrink-0"}):a.jsx("span",{className:"w-4 shrink-0"}),a.jsx("span",{className:z("text-sm text-foreground truncate",i&&"text-muted-foreground"),children:e.title}),u&&a.jsxs("span",{className:"shrink-0 flex items-center gap-0.5 ml-1 text-[10px] font-medium text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/50 px-1 py-0.5 rounded",children:[a.jsx(Mn,{className:"h-2.5 w-2.5"}),o.length]})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-1.5 py-1 max-w-full",children:[a.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:f}}),a.jsx("span",{className:"text-xs text-muted-foreground truncate",children:r[e.status]??e.status})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-1.5 py-1",children:[a.jsx(Uee,{priority:e.priority}),a.jsx("span",{className:"text-xs text-muted-foreground",children:rn[e.priority]??e.priority})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-1.5 py-1 max-w-full",children:[a.jsx(Hr,{className:"h-3.5 w-3.5 text-muted-foreground/50 shrink-0"}),a.jsx("span",{className:z("text-xs truncate",m?"text-foreground":"text-muted-foreground/50"),children:(m==null?void 0:m.name)??"—"})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-1.5 py-1",children:[a.jsx(Wt,{className:"h-3.5 w-3.5 text-muted-foreground/50 shrink-0"}),a.jsx("span",{className:z("text-xs",e.due_date?"text-foreground":"text-muted-foreground/50"),children:e.due_date?fe(new Date(e.due_date),"MMM d, yyyy"):"—"})]}),a.jsx("div",{className:"flex items-center px-1.5",children:a.jsx("div",{className:"flex -space-x-1.5",children:(e.assignees??[]).slice(0,3).map(p=>a.jsx("div",{title:p.name,className:"h-5 w-5 rounded-full bg-indigo-100 dark:bg-indigo-900 border border-white dark:border-card flex items-center justify-center text-[10px] font-medium text-indigo-700 dark:text-indigo-300",children:p.initials},p.id))})})]}),c&&o.map(p=>a.jsx(lP,{issue:p,statuses:t,statusLabels:r,statusColorMap:n,sprints:s,isChild:!0,children:(l==null?void 0:l[p.id])??[],childrenMap:l},p.id))]})}function qee({issues:e,childrenMap:t,statuses:r,statusLabels:n,statusColorMap:s,sprints:i,totalCount:o}){const[l,c]=h.useState(!1);return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 px-6 py-2 bg-muted/20 border-b border-border",children:[a.jsx("button",{onClick:()=>c(!l),className:"text-muted-foreground hover:text-foreground transition-colors",children:l?a.jsx(vr,{className:"h-3.5 w-3.5"}):a.jsx(ia,{className:"h-3.5 w-3.5"})}),a.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"Issues"}),a.jsx("span",{className:"text-[11px] text-muted-foreground/60 font-mono",children:o})]}),!l&&a.jsx("div",{className:"divide-y divide-border/60",children:e.length===0?a.jsx("div",{className:"px-14 py-5 text-xs text-muted-foreground/50 italic",children:"No issues match your filters"}):e.map(d=>a.jsx(lP,{issue:d,statuses:r,statusLabels:n,statusColorMap:s,sprints:i,children:t[d.id]??[],childrenMap:t},d.id))})]})}function Hee({token:e,statuses:t}){const[r,n]=h.useState("all"),[s,i]=h.useState("all"),[o,l]=h.useState("all"),[c,d]=h.useState(""),{data:u=[],isLoading:f}=Pv(e),{data:m=[]}=oP(e),p=Object.fromEntries(t.map(N=>[N.key,N.name])),x=Object.fromEntries(t.map(N=>[N.key,N.color])),g={};for(const N of u)N.parent_id&&(g[N.parent_id]||(g[N.parent_id]=[]),g[N.parent_id].push(N));const v=u.filter(N=>!N.parent_id).filter(N=>{const w=c.toLowerCase(),k=!c||N.title.toLowerCase().includes(w)||N.identifier.toLowerCase().includes(w),b=r==="all"||N.status===r,C=s==="all"||N.priority===s,_=o==="all"?!0:o==="none"?!N.sprint_id:N.sprint_id===o;return k&&b&&C&&_}).sort((N,w)=>{const k=parseInt(N.identifier.split("-")[1]??"0",10),b=parseInt(w.identifier.split("-")[1]??"0",10);return k-b}),y=v.reduce((N,w)=>{var k;return N+(((k=g[w.id])==null?void 0:k.length)??0)},0),j=v.length+y;return a.jsx("div",{className:"p-2",children:a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-border gap-3 flex-wrap",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(Le,{value:o,onValueChange:l,children:[a.jsx($e,{className:"h-8 text-xs w-[140px] bg-transparent",children:a.jsx(qe,{placeholder:"Sprint"})}),a.jsxs(ze,{children:[a.jsx(we,{value:"all",className:"text-xs",children:"All sprints"}),a.jsx(we,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),m.map(N=>a.jsx(we,{value:N.id,className:"text-xs",children:N.name},N.id))]})]}),a.jsxs(Le,{value:r,onValueChange:n,children:[a.jsx($e,{className:"h-8 text-xs w-[130px] bg-transparent",children:a.jsx(qe,{placeholder:"Status"})}),a.jsxs(ze,{children:[a.jsx(we,{value:"all",className:"text-xs",children:"All statuses"}),t.map(({key:N,name:w})=>a.jsx(we,{value:N,className:"text-xs",children:w},N))]})]}),a.jsxs(Le,{value:s,onValueChange:i,children:[a.jsx($e,{className:"h-8 text-xs w-[130px] bg-transparent",children:a.jsx(qe,{placeholder:"Priority"})}),a.jsxs(ze,{children:[a.jsx(we,{value:"all",className:"text-xs",children:"All priorities"}),Object.entries(rn).map(([N,w])=>a.jsx(we,{value:N,className:"text-xs",children:w},N))]})]})]}),a.jsxs("div",{className:"relative",children:[a.jsx(ji,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground pointer-events-none"}),a.jsx(Ee,{placeholder:"Search...",value:c,onChange:N=>d(N.target.value),className:"pl-8 h-8 w-[200px] text-xs bg-transparent"})]})]}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("div",{className:"min-w-[900px]",children:[a.jsxs("div",{className:z("grid items-center py-2.5 border-b border-border",Lp),children:[a.jsx("span",{className:"text-xs font-medium text-[#6b7280] sticky left-0 z-10 bg-white dark:bg-card pl-6",children:"ID"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280] sticky left-[70px] z-10 bg-white dark:bg-card",children:"Title"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Status"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Priority"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Sprint"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Due Date"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Assignees"})]}),f?a.jsx("div",{className:"divide-y divide-border",children:[1,2,3,4].map(N=>a.jsxs("div",{className:z("grid items-center px-6 py-3 gap-4",Lp),children:[a.jsx(le,{className:"h-4 w-14"}),a.jsx(le,{className:"h-4 w-56"}),a.jsx(le,{className:"h-5 w-20"}),a.jsx(le,{className:"h-4 w-16"}),a.jsx(le,{className:"h-4 w-20"}),a.jsx(le,{className:"h-4 w-24"}),a.jsx(le,{className:"h-6 w-16"})]},N))}):u.length===0?a.jsx("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:a.jsx("p",{className:"text-sm font-medium mb-1",children:"No issues yet"})}):a.jsx(Iu,{delayDuration:200,children:a.jsx(qee,{issues:v,childrenMap:g,statuses:t,statusLabels:p,statusColorMap:x,sprints:m,totalCount:j})})]})}),!f&&j>0&&a.jsx("div",{className:"flex items-center px-6 py-3 border-t border-border",children:a.jsxs("span",{className:"text-xs text-muted-foreground",children:[j," issue",j!==1?"s":""]})})]})})}function md(e,t){const r=e.start_date?new Date(e.start_date):new Date(e.due_date),n=e.due_date?Ur(new Date(e.due_date),1):Ur(r,1);return{id:e.id,name:`${e.identifier} ${e.title}`,startAt:r,endAt:n,status:{id:e.status,name:e.status,color:t}}}function Kee({token:e,statuses:t}){const[r,n]=h.useState("monthly"),s=h.useRef(null),{data:i=[]}=Pv(e),{data:o=[]}=oP(e);h.useEffect(()=>{const m=requestAnimationFrame(()=>{var j;const p=(j=s.current)==null?void 0:j.querySelector(".gantt");if(!p)return;const x=new Date,g=x.getFullYear()-1,v=300;let y;if(r==="daily")y=Math.floor((x.getTime()-new Date(g,0,1).getTime())/864e5)*50;else{const N=r==="monthly"?150:100,w=(x.getFullYear()-g)*12+x.getMonth(),k=new Date(x.getFullYear(),x.getMonth()+1,0).getDate();y=w*N+(x.getDate()-1)/k*N}p.scrollLeft=Math.max(0,y-(p.clientWidth-v)/2)});return()=>cancelAnimationFrame(m)},[r]);const l=Object.fromEntries(t.map(m=>[m.key,m.color])),c=i.filter(m=>m.due_date),d=i.filter(m=>!m.due_date),u={},f=[];for(const m of c)m.sprint_id?(u[m.sprint_id]||(u[m.sprint_id]=[]),u[m.sprint_id].push(m)):f.push(m);return a.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[a.jsx("div",{className:"flex items-center px-6 py-3 border-b border-border shrink-0 bg-white dark:bg-zinc-950",children:a.jsx("div",{className:"flex items-center gap-1 bg-muted rounded-md p-0.5",children:["daily","monthly","quarterly"].map(m=>a.jsx("button",{onClick:()=>n(m),className:`px-3 py-1 rounded text-xs font-medium transition-colors capitalize ${r===m?"bg-white dark:bg-zinc-900 text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:m},m))})}),a.jsx("div",{ref:s,className:"flex-1 min-h-0 overflow-hidden",children:a.jsxs(Lee,{range:r,zoom:100,className:"h-full bg-white dark:bg-zinc-950",children:[a.jsxs(Tee,{children:[o.map(m=>{const p=u[m.id]??[];return a.jsx(gh,{name:m.name,children:p.map(x=>a.jsx(xh,{feature:md(x,l[x.status]??"#94a3b8")},x.id))},m.id)}),f.length>0&&a.jsx(gh,{name:"No Sprint",children:f.map(m=>a.jsx(xh,{feature:md(m,l[m.status]??"#94a3b8")},m.id))}),d.length>0&&a.jsx(gh,{name:"Unscheduled",children:d.map(m=>a.jsx(xh,{feature:{id:m.id,name:`${m.identifier} ${m.title}`,startAt:new Date,endAt:new Date,status:{id:m.status,name:m.status,color:l[m.status]??"#94a3b8"}}},m.id))})]}),a.jsxs(Fee,{children:[a.jsx(Aee,{}),a.jsxs(zee,{children:[o.map(m=>a.jsx(vh,{children:(u[m.id]??[]).map(p=>a.jsx("div",{className:"flex",children:a.jsx(_j,{...md(p,l[p.status]??"#94a3b8")})},p.id))},m.id)),f.length>0&&a.jsx(vh,{children:f.map(m=>a.jsx("div",{className:"flex",children:a.jsx(_j,{...md(m,l[m.status]??"#94a3b8")})},m.id))}),d.length>0&&a.jsx(vh,{children:d.map(m=>a.jsx("div",{style:{height:"var(--gantt-row-height)"}},m.id))})]}),o.filter(m=>m.end_date).map(m=>a.jsx(iP,{id:m.id,date:new Date(m.end_date),label:`${m.name} end`},m.id)),a.jsx(Bee,{})]})]})})]})}function Yee(){const{token:e}=zt(),[t,r]=h.useState("board"),{data:n,isLoading:s,isError:i}=Wee(e??""),{data:o}=Pv(e??"");if(!e)return null;if(s)return a.jsx("div",{className:"min-h-screen flex items-center justify-center",children:a.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading…"})});if(i||!n)return a.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center gap-3",children:[a.jsx("p",{className:"text-lg font-semibold",children:"Link not found"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"This share link is invalid or has been revoked."})]});const l=[{key:"board",label:"Board"},{key:"issues",label:"Issues"},{key:"timeline",label:"Timeline"}];return a.jsxs("div",{className:"h-screen flex flex-col bg-background overflow-hidden",children:[a.jsx("header",{className:"border-b border-border px-6 py-3 bg-white dark:bg-card shrink-0",children:a.jsxs("div",{className:"flex items-center gap-3",children:[n.icon&&a.jsx("span",{className:"text-xl",children:n.icon}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs font-mono text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/50 border border-indigo-200 dark:border-indigo-800 px-2 py-0.5 rounded",children:n.identifier}),a.jsx("h1",{className:"text-sm font-semibold",children:n.name})]}),a.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"Read-only view"})]})}),a.jsx("div",{className:"border-b border-border bg-white dark:bg-card px-6 shrink-0",children:a.jsx("div",{className:"flex -mb-px",children:l.map(({key:c,label:d})=>a.jsx("button",{onClick:()=>r(c),className:`px-3 py-2 text-sm border-b-2 transition-colors ${t===c?"border-foreground text-foreground font-medium":"border-transparent text-muted-foreground hover:text-foreground"}`,children:d},c))})}),a.jsxs("div",{className:`flex-1 min-h-0 ${t==="timeline"?"overflow-hidden":"overflow-auto"}`,children:[t==="board"&&a.jsx(KN,{issues:o??[],projectId:n.id,statuses:n.statuses,readOnly:!0}),t==="issues"&&a.jsx(Hee,{token:e,statuses:n.statuses}),t==="timeline"&&a.jsx(Kee,{token:e,statuses:n.statuses})]})]})}const Gee=new URLSearchParams(window.location.search);function Vee(){const[e,t]=h.useState(null),r=pt(),n=Ie(),s=h.useRef(!1);if(h.useEffect(()=>{if(s.current)return;s.current=!0;const i=Gee;if(history.replaceState(null,"",window.location.pathname),i.get("linked")==="true"){r("/profile?linked=true",{replace:!0});return}const l=i.get("error");if(l){t(decodeURIComponent(l));return}const c=i.get("code");if(!c){t("No authorization code received from Google sign-in");return}(async()=>{const u=await fetch(`${Gi}/auth/google/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:c})});if(!u.ok)throw new Error(`Code exchange failed (${u.status}). Please try signing in again.`);const{token:f}=await u.json(),m=await fetch(`${Gi}/admin/users/me`,{headers:{Authorization:`Bearer ${f}`}});if(!m.ok)throw new Error(`Failed to load user profile (${m.status})`);const p=await m.json();n.login({id:p.id,email:p.email,first_name:p.first_name??"",last_name:p.last_name??"",avatar_url:p.avatar_url},f),r("/",{replace:!0})})().catch(u=>t(u.message??"Failed to complete sign-in"))},[]),e){const i=e.startsWith("GOOGLE_NOT_LINKED:"),o=i?e.replace("GOOGLE_NOT_LINKED: ",""):e;return a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[400px] bg-white dark:bg-card border border-border rounded-xl p-6 text-center space-y-4",children:[a.jsx("p",{className:"text-sm font-medium",children:i?"Google account not connected":"Sign-in failed"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:o}),i?a.jsxs("div",{className:"flex flex-col gap-2 pt-1",children:[a.jsx(qr,{to:"/login",children:a.jsx(ne,{className:"w-full",size:"sm",children:"Sign in with email & password"})}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["After signing in, go to ",a.jsx("strong",{children:"Profile"})," → ",a.jsx("strong",{children:"Connections"})," to link your Google account."]})]}):a.jsx(qr,{to:"/login",children:a.jsx(ne,{variant:"outline",size:"sm",children:"Back to login"})})]})})}return a.jsx("div",{className:"min-h-screen flex items-center justify-center",children:a.jsx("span",{className:"text-sm text-muted-foreground",children:"Completing sign-in..."})})}var Xee=Object.defineProperty,Qee=Object.defineProperties,Zee=Object.getOwnPropertyDescriptors,Au=Object.getOwnPropertySymbols,cP=Object.prototype.hasOwnProperty,dP=Object.prototype.propertyIsEnumerable,Mj=(e,t,r)=>t in e?Xee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Jee=(e,t)=>{for(var r in t||(t={}))cP.call(t,r)&&Mj(e,r,t[r]);if(Au)for(var r of Au(t))dP.call(t,r)&&Mj(e,r,t[r]);return e},ete=(e,t)=>Qee(e,Zee(t)),tte=(e,t)=>{var r={};for(var n in e)cP.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Au)for(var n of Au(e))t.indexOf(n)<0&&dP.call(e,n)&&(r[n]=e[n]);return r};function rte(e){let t=setTimeout(e,0),r=setTimeout(e,10),n=setTimeout(e,50);return[t,r,n]}function nte(e){let t=h.useRef();return h.useEffect(()=>{t.current=e}),t.current}var ate=18,uP=40,ste=`${uP}px`,ite=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function ote({containerRef:e,inputRef:t,pushPasswordManagerStrategy:r,isFocused:n}){let[s,i]=h.useState(!1),[o,l]=h.useState(!1),[c,d]=h.useState(!1),u=h.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&s&&o,[s,o,r]),f=h.useCallback(()=>{let m=e.current,p=t.current;if(!m||!p||c||r==="none")return;let x=m,g=x.getBoundingClientRect().left+x.offsetWidth,v=x.getBoundingClientRect().top+x.offsetHeight/2,y=g-ate,j=v;document.querySelectorAll(ite).length===0&&document.elementFromPoint(y,j)===m||(i(!0),d(!0))},[e,t,c,r]);return h.useEffect(()=>{let m=e.current;if(!m||r==="none")return;function p(){let g=window.innerWidth-m.getBoundingClientRect().right;l(g>=uP)}p();let x=setInterval(p,1e3);return()=>{clearInterval(x)}},[e,r]),h.useEffect(()=>{let m=n||document.activeElement===t.current;if(r==="none"||!m)return;let p=setTimeout(f,0),x=setTimeout(f,2e3),g=setTimeout(f,5e3),v=setTimeout(()=>{d(!0)},6e3);return()=>{clearTimeout(p),clearTimeout(x),clearTimeout(g),clearTimeout(v)}},[t,n,r,f]),{hasPWMBadge:s,willPushPWMBadge:u,PWM_BADGE_SPACE_WIDTH:ste}}var fP=h.createContext({}),mP=h.forwardRef((e,t)=>{var r=e,{value:n,onChange:s,maxLength:i,textAlign:o="left",pattern:l,placeholder:c,inputMode:d="numeric",onComplete:u,pushPasswordManagerStrategy:f="increase-width",pasteTransformer:m,containerClassName:p,noScriptCSSFallback:x=lte,render:g,children:v}=r,y=tte(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),j,N,w,k,b;let[C,_]=h.useState(typeof y.defaultValue=="string"?y.defaultValue:""),S=n??C,I=nte(S),A=h.useCallback(V=>{s==null||s(V),_(V)},[s]),O=h.useMemo(()=>l?typeof l=="string"?new RegExp(l):l:null,[l]),L=h.useRef(null),F=h.useRef(null),X=h.useRef({value:S,onChange:A,isIOS:typeof window<"u"&&((N=(j=window==null?void 0:window.CSS)==null?void 0:j.supports)==null?void 0:N.call(j,"-webkit-touch-callout","none"))}),T=h.useRef({prev:[(w=L.current)==null?void 0:w.selectionStart,(k=L.current)==null?void 0:k.selectionEnd,(b=L.current)==null?void 0:b.selectionDirection]});h.useImperativeHandle(t,()=>L.current,[]),h.useEffect(()=>{let V=L.current,ie=F.current;if(!V||!ie)return;X.current.value!==V.value&&X.current.onChange(V.value),T.current.prev=[V.selectionStart,V.selectionEnd,V.selectionDirection];function pe(){if(document.activeElement!==V){R(null),$(null);return}let Q=V.selectionStart,ge=V.selectionEnd,De=V.selectionDirection,Ue=V.maxLength,Fe=V.value,Ve=T.current.prev,ut=-1,Ke=-1,Ze;if(Fe.length!==0&&Q!==null&&ge!==null){let yr=Q===ge,nr=Q===Fe.length&&Fe.length<Ue;if(yr&&!nr){let yt=Q;if(yt===0)ut=0,Ke=1,Ze="forward";else if(yt===Ue)ut=yt-1,Ke=yt,Ze="backward";else if(Ue>1&&Fe.length>1){let Lt=0;if(Ve[0]!==null&&Ve[1]!==null){Ze=yt<Ve[1]?"backward":"forward";let Kt=Ve[0]===Ve[1]&&Ve[0]<Ue;Ze==="backward"&&!Kt&&(Lt=-1)}ut=Lt+yt,Ke=Lt+yt+1}}ut!==-1&&Ke!==-1&&ut!==Ke&&L.current.setSelectionRange(ut,Ke,Ze)}let tr=ut!==-1?ut:Q,Ir=Ke!==-1?Ke:ge,rr=Ze??De;R(tr),$(Ir),T.current.prev=[tr,Ir,rr]}if(document.addEventListener("selectionchange",pe,{capture:!0}),pe(),document.activeElement===V&&P(!0),!document.getElementById("input-otp-style")){let Q=document.createElement("style");if(Q.id="input-otp-style",document.head.appendChild(Q),Q.sheet){let ge="background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;";cl(Q.sheet,"[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"),cl(Q.sheet,`[data-input-otp]:autofill { ${ge} }`),cl(Q.sheet,`[data-input-otp]:-webkit-autofill { ${ge} }`),cl(Q.sheet,"@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"),cl(Q.sheet,"[data-input-otp] + * { pointer-events: all !important; }")}}let ue=()=>{ie&&ie.style.setProperty("--root-height",`${V.clientHeight}px`)};ue();let ve=new ResizeObserver(ue);return ve.observe(V),()=>{document.removeEventListener("selectionchange",pe,{capture:!0}),ve.disconnect()}},[]);let[G,re]=h.useState(!1),[J,P]=h.useState(!1),[M,R]=h.useState(null),[q,$]=h.useState(null);h.useEffect(()=>{rte(()=>{var V,ie,pe,ue;(V=L.current)==null||V.dispatchEvent(new Event("input"));let ve=(ie=L.current)==null?void 0:ie.selectionStart,Q=(pe=L.current)==null?void 0:pe.selectionEnd,ge=(ue=L.current)==null?void 0:ue.selectionDirection;ve!==null&&Q!==null&&(R(ve),$(Q),T.current.prev=[ve,Q,ge])})},[S,J]),h.useEffect(()=>{I!==void 0&&S!==I&&I.length<i&&S.length===i&&(u==null||u(S))},[i,u,I,S]);let K=ote({containerRef:F,inputRef:L,pushPasswordManagerStrategy:f,isFocused:J}),D=h.useCallback(V=>{let ie=V.currentTarget.value.slice(0,i);if(ie.length>0&&O&&!O.test(ie)){V.preventDefault();return}typeof I=="string"&&ie.length<I.length&&document.dispatchEvent(new Event("selectionchange")),A(ie)},[i,A,I,O]),E=h.useCallback(()=>{var V;if(L.current){let ie=Math.min(L.current.value.length,i-1),pe=L.current.value.length;(V=L.current)==null||V.setSelectionRange(ie,pe),R(ie),$(pe)}P(!0)},[i]),Z=h.useCallback(V=>{var ie,pe;let ue=L.current;if(!m&&(!X.current.isIOS||!V.clipboardData||!ue))return;let ve=V.clipboardData.getData("text/plain"),Q=m?m(ve):ve;V.preventDefault();let ge=(ie=L.current)==null?void 0:ie.selectionStart,De=(pe=L.current)==null?void 0:pe.selectionEnd,Ue=(ge!==De?S.slice(0,ge)+Q+S.slice(De):S.slice(0,ge)+Q+S.slice(ge)).slice(0,i);if(Ue.length>0&&O&&!O.test(Ue))return;ue.value=Ue,A(Ue);let Fe=Math.min(Ue.length,i-1),Ve=Ue.length;ue.setSelectionRange(Fe,Ve),R(Fe),$(Ve)},[i,A,O,S]),B=h.useMemo(()=>({position:"relative",cursor:y.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[y.disabled]),Y=h.useMemo(()=>({position:"absolute",inset:0,width:K.willPushPWMBadge?`calc(100% + ${K.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:K.willPushPWMBadge?`inset(0 ${K.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[K.PWM_BADGE_SPACE_WIDTH,K.willPushPWMBadge,o]),ae=h.useMemo(()=>h.createElement("input",ete(Jee({autoComplete:y.autoComplete||"one-time-code"},y),{"data-input-otp":!0,"data-input-otp-placeholder-shown":S.length===0||void 0,"data-input-otp-mss":M,"data-input-otp-mse":q,inputMode:d,pattern:O==null?void 0:O.source,"aria-placeholder":c,style:Y,maxLength:i,value:S,ref:L,onPaste:V=>{var ie;Z(V),(ie=y.onPaste)==null||ie.call(y,V)},onChange:D,onMouseOver:V=>{var ie;re(!0),(ie=y.onMouseOver)==null||ie.call(y,V)},onMouseLeave:V=>{var ie;re(!1),(ie=y.onMouseLeave)==null||ie.call(y,V)},onFocus:V=>{var ie;E(),(ie=y.onFocus)==null||ie.call(y,V)},onBlur:V=>{var ie;P(!1),(ie=y.onBlur)==null||ie.call(y,V)}})),[D,E,Z,d,Y,i,q,M,y,O==null?void 0:O.source,S]),ee=h.useMemo(()=>({slots:Array.from({length:i}).map((V,ie)=>{var pe;let ue=J&&M!==null&&q!==null&&(M===q&&ie===M||ie>=M&&ie<q),ve=S[ie]!==void 0?S[ie]:null,Q=S[0]!==void 0?null:(pe=c==null?void 0:c[ie])!=null?pe:null;return{char:ve,placeholderChar:Q,isActive:ue,hasFakeCaret:ue&&ve===null}}),isFocused:J,isHovering:!y.disabled&&G}),[J,G,i,q,M,y.disabled,S]),se=h.useMemo(()=>g?g(ee):h.createElement(fP.Provider,{value:ee},v),[v,ee,g]);return h.createElement(h.Fragment,null,x!==null&&h.createElement("noscript",null,h.createElement("style",null,x)),h.createElement("div",{ref:F,"data-input-otp-container":!0,style:B,className:p},se,h.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},ae)))});mP.displayName="Input";function cl(e,t){try{e.insertRule(t)}catch{console.error("input-otp could not insert CSS rule:",t)}}var lte=`
|
|
611
|
+
*/var Ac=h;function LV(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var FV=typeof Object.is=="function"?Object.is:LV,BV=Ac.useSyncExternalStore,WV=Ac.useRef,UV=Ac.useEffect,qV=Ac.useMemo,HV=Ac.useDebugValue;zV.useSyncExternalStoreWithSelector=function(e,t,r,n,s){var i=WV(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=qV(function(){function c(p){if(!d){if(d=!0,u=p,p=n(p),s!==void 0&&o.hasValue){var x=o.value;if(s(x,p))return f=x}return f=p}if(x=f,FV(u,p))return x;var g=n(p);return s!==void 0&&s(x,g)?(u=p,x):(u=p,f=g)}var d=!1,u,f,m=r===void 0?null:r;return[function(){return c(t())},m===null?void 0:function(){return c(m())}]},[t,r,n,s]);var l=BV(e,i[0],i[1]);return UV(function(){o.hasValue=!0,o.value=l},[l]),HV(l),l};function KV(e){e()}function YV(){let e=null,t=null;return{clear(){e=null,t=null},notify(){KV(()=>{let r=e;for(;r;)r.callback(),r=r.next})},get(){const r=[];let n=e;for(;n;)r.push(n),n=n.next;return r},subscribe(r){let n=!0;const s=t={callback:r,next:null,prev:t};return s.prev?s.prev.next=s:e=s,function(){!n||e===null||(n=!1,s.next?s.next.prev=s.prev:t=s.prev,s.prev?s.prev.next=s.next:e=s.next)}}}}var aj={notify(){},get:()=>[]};function GV(e,t){let r,n=aj,s=0,i=!1;function o(g){u();const v=n.subscribe(g);let y=!1;return()=>{y||(y=!0,v(),f())}}function l(){n.notify()}function c(){x.onStateChange&&x.onStateChange()}function d(){return i}function u(){s++,r||(r=e.subscribe(c),n=YV())}function f(){s--,r&&s===0&&(r(),r=void 0,n.clear(),n=aj)}function m(){i||(i=!0,u())}function p(){i&&(i=!1,f())}const x={addNestedSub:o,notifyNestedSubs:l,handleChangeWrapper:c,isSubscribed:d,trySubscribe:m,tryUnsubscribe:p,getListeners:()=>n};return x}var VV=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",XV=VV(),QV=()=>typeof navigator<"u"&&navigator.product==="ReactNative",ZV=QV(),JV=()=>XV||ZV?h.useLayoutEffect:h.useEffect,eX=JV();function sj(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function tX(e,t){if(sj(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let s=0;s<r.length;s++)if(!Object.prototype.hasOwnProperty.call(t,r[s])||!sj(e[r[s]],t[r[s]]))return!1;return!0}var lh=Symbol.for("react-redux-context"),ch=typeof globalThis<"u"?globalThis:{};function rX(){if(!h.createContext)return{};const e=ch[lh]??(ch[lh]=new Map);let t=e.get(h.createContext);return t||(t=h.createContext(null),e.set(h.createContext,t)),t}var nX=rX();function aX(e){const{children:t,context:r,serverState:n,store:s}=e,i=h.useMemo(()=>{const c=GV(s);return{store:s,subscription:c,getServerState:n?()=>n:void 0}},[s,n]),o=h.useMemo(()=>s.getState(),[s]);eX(()=>{const{subscription:c}=i;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),o!==s.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[i,o]);const l=r||nX;return h.createElement(l.Provider,{value:i},t)}var sX=aX,iX=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function oX(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function yv(e,t){var r=new Set([...Object.keys(e),...Object.keys(t)]);for(var n of r)if(iX.has(n)){if(e[n]==null&&t[n]==null)continue;if(!tX(e[n],t[n]))return!1}else if(!oX(e[n],t[n]))return!1;return!0}function Mi(e,t){var r,n;return(r=(n=e.graphicalItems.cartesianItems.find(s=>s.id===t))===null||n===void 0?void 0:n.xAxisId)!==null&&r!==void 0?r:GM}function Oi(e,t){var r,n;return(r=(n=e.graphicalItems.cartesianItems.find(s=>s.id===t))===null||n===void 0?void 0:n.yAxisId)!==null&&r!==void 0?r:GM}var lX="Invariant failed";function cX(e,t){throw new Error(lX)}function _p(){return _p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_p.apply(null,arguments)}function Nu(e){return h.createElement(QY,_p({shapeType:"rectangle",activeClassName:"recharts-active-bar"},e))}var dX=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return(n,s)=>{if(Ce(t))return t;var i=Ce(n)||Xt(n);return i?t(n,s):(i||cX(),r)}},uX=(e,t,r)=>r,fX=(e,t)=>t,Dc=te([Gg,fX],(e,t)=>e.filter(r=>r.type==="bar").find(r=>r.id===t)),mX=te([Dc],e=>e==null?void 0:e.maxBarSize),hX=(e,t,r,n)=>n,pX=te([ot,Gg,Mi,Oi,uX],(e,t,r,n,s)=>t.filter(i=>e==="horizontal"?i.xAxisId===r:i.yAxisId===n).filter(i=>i.isPanorama===s).filter(i=>i.hide===!1).filter(i=>i.type==="bar")),xX=(e,t,r)=>{var n=ot(e),s=Mi(e,t),i=Oi(e,t);if(!(s==null||i==null))return n==="horizontal"?wp(e,"yAxis",i,r):wp(e,"xAxis",s,r)},gX=(e,t)=>{var r=ot(e),n=Mi(e,t),s=Oi(e,t);if(!(n==null||s==null))return r==="horizontal"?ow(e,"xAxis",n):ow(e,"yAxis",s)},vX=te([pX,rU,gX],CG),yX=(e,t,r)=>{var n,s,i=Dc(e,t);if(i==null)return 0;var o=Mi(e,t),l=Oi(e,t);if(o==null||l==null)return 0;var c=ot(e),d=t_(e),{maxBarSize:u}=i,f=Xt(u)?d:u,m,p;return c==="horizontal"?(m=lo(e,"xAxis",o,r),p=oo(e,"xAxis",o,r)):(m=lo(e,"yAxis",l,r),p=oo(e,"yAxis",l,r)),(n=(s=Kd(m,p,!0))!==null&&s!==void 0?s:f)!==null&&n!==void 0?n:0},nO=(e,t,r)=>{var n=ot(e),s=Mi(e,t),i=Oi(e,t);if(!(s==null||i==null)){var o,l;return n==="horizontal"?(o=lo(e,"xAxis",s,r),l=oo(e,"xAxis",s,r)):(o=lo(e,"yAxis",i,r),l=oo(e,"yAxis",i,r)),Kd(o,l)}},bX=te([vX,t_,tU,r_,yX,nO,mX],EG),wX=(e,t,r)=>{var n=Mi(e,t);if(n!=null)return lo(e,"xAxis",n,r)},jX=(e,t,r)=>{var n=Oi(e,t);if(n!=null)return lo(e,"yAxis",n,r)},NX=(e,t,r)=>{var n=Mi(e,t);if(n!=null)return oo(e,"xAxis",n,r)},kX=(e,t,r)=>{var n=Oi(e,t);if(n!=null)return oo(e,"yAxis",n,r)},SX=te([bX,Dc],DG),CX=te([xX,Dc],AG),_X=te([Qt,lg,wX,jX,NX,kX,SX,ot,Y9,nO,CX,Dc,hX],(e,t,r,n,s,i,o,l,c,d,u,f,m)=>{var{chartData:p,dataStartIndex:x,dataEndIndex:g}=c;if(!(f==null||o==null||t==null||l!=="horizontal"&&l!=="vertical"||r==null||n==null||s==null||i==null||d==null)){var{data:v}=f,y;if(v!=null&&v.length>0?y=v:y=p==null?void 0:p.slice(x,g+1),y!=null)return tQ({layout:l,barSettings:f,pos:o,parentViewBox:t,bandSize:d,xAxis:r,yAxis:n,xAxisTicks:s,yAxisTicks:i,stackedData:u,displayedData:y,offset:e,cells:m,dataStartIndex:x})}}),MX=["index"];function Mp(){return Mp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Mp.apply(null,arguments)}function OX(e,t){if(e==null)return{};var r,n,s=PX(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function PX(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var aO=h.createContext(void 0),EX=e=>{var t=h.useContext(aO);if(t!=null)return t.stackId;if(e!=null)return a8(e)},AX=(e,t)=>"recharts-bar-stack-clip-path-".concat(e,"-").concat(t),DX=e=>{var t=h.useContext(aO);if(t!=null){var{stackId:r}=t;return"url(#".concat(AX(r,e),")")}},sO=e=>{var{index:t}=e,r=OX(e,MX),n=DX(t);return h.createElement(Aa,Mp({className:"recharts-bar-stack-layer",clipPath:n},r))},TX=["onMouseEnter","onMouseLeave","onClick"],IX=["value","background","tooltipPosition"],RX=["id"],$X=["onMouseEnter","onClick","onMouseLeave"];function La(){return La=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},La.apply(null,arguments)}function ij(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function jr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ij(Object(r),!0).forEach(function(n){zX(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ij(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function zX(e,t,r){return(t=LX(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function LX(e){var t=FX(e,"string");return typeof t=="symbol"?t:t+""}function FX(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ku(e,t){if(e==null)return{};var r,n,s=BX(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function BX(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var WX=e=>{var{dataKey:t,name:r,fill:n,legendType:s,hide:i}=e;return[{inactive:i,dataKey:t,type:s,color:n,value:O2(r,t),payload:e}]},UX=h.memo(e=>{var{dataKey:t,stroke:r,strokeWidth:n,fill:s,name:i,hide:o,unit:l,tooltipType:c,id:d}=e,u={dataDefinedOnItem:void 0,getPosition:_o,settings:{stroke:r,strokeWidth:n,fill:s,dataKey:t,nameKey:void 0,name:O2(i,t),hide:o,type:c,color:s,unit:l,graphicalItemId:d}};return h.createElement(ZY,{tooltipEntrySettings:u})});function qX(e){var t=Ae(co),{data:r,dataKey:n,background:s,allOtherBarProps:i}=e,{onMouseEnter:o,onMouseLeave:l,onClick:c}=i,d=ku(i,TX),u=qM(o,n,i.id),f=HM(l),m=KM(c,n,i.id);if(!s||r==null)return null;var p=Lx(s);return h.createElement(ts,{zIndex:TG(s,Sr.barBackground)},r.map((x,g)=>{var{value:v,background:y,tooltipPosition:j}=x,N=ku(x,IX);if(!y)return null;var w=u(x,g),k=f(x,g),b=m(x,g),C=jr(jr(jr(jr(jr({option:s,isActive:String(g)===t},N),{},{fill:"#eee"},y),p),qx(d,x,g)),{},{onMouseEnter:w,onMouseLeave:k,onClick:b,dataKey:n,index:g,className:"recharts-bar-background-rectangle"});return h.createElement(Nu,La({key:"background-bar-".concat(g)},C))}))}function HX(e){var{showLabels:t,children:r,rects:n}=e,s=n==null?void 0:n.map(i=>{var o={x:i.x,y:i.y,width:i.width,lowerWidth:i.width,upperWidth:i.width,height:i.height};return jr(jr({},o),{},{value:i.value,payload:i.payload,parentViewBox:i.parentViewBox,viewBox:o,fill:i.fill})});return h.createElement(kY,{value:t?s:void 0},r)}function KX(e){var{shape:t,activeBar:r,baseProps:n,entry:s,index:i,dataKey:o}=e,l=Ae(co),c=Ae(mM),d=r&&String(i)===l&&(c==null||o===c),u=d?r:t;return d?h.createElement(ts,{zIndex:Sr.activeBar},h.createElement(sO,{index:i},h.createElement(Nu,La({},n,{name:String(n.name)},s,{isActive:d,option:u,index:i,dataKey:o})))):h.createElement(Nu,La({},n,{name:String(n.name)},s,{isActive:d,option:u,index:i,dataKey:o}))}function YX(e){var{shape:t,baseProps:r,entry:n,index:s,dataKey:i}=e;return h.createElement(Nu,La({},r,{name:String(r.name)},n,{isActive:!1,option:t,index:s,dataKey:i}))}function GX(e){var t,{data:r,props:n}=e,s=(t=Ea(n))!==null&&t!==void 0?t:{},{id:i}=s,o=ku(s,RX),{shape:l,dataKey:c,activeBar:d}=n,{onMouseEnter:u,onClick:f,onMouseLeave:m}=n,p=ku(n,$X),x=qM(u,c,i),g=HM(m),v=KM(f,c,i);return r?h.createElement(h.Fragment,null,r.map((y,j)=>h.createElement(sO,La({index:j,key:"rectangle-".concat(y==null?void 0:y.x,"-").concat(y==null?void 0:y.y,"-").concat(y==null?void 0:y.value,"-").concat(j),className:"recharts-bar-rectangle"},qx(p,y,j),{onMouseEnter:x(y,j),onMouseLeave:g(y,j),onClick:v(y,j)}),d?h.createElement(KX,{shape:l,activeBar:d,baseProps:o,entry:y,index:j,dataKey:c}):h.createElement(YX,{shape:l,baseProps:o,entry:y,index:j,dataKey:c})))):null}function VX(e){var{props:t,previousRectanglesRef:r}=e,{data:n,layout:s,isAnimationActive:i,animationBegin:o,animationDuration:l,animationEasing:c,onAnimationEnd:d,onAnimationStart:u}=t,f=r.current,m=hg(t,"recharts-bar-"),[p,x]=h.useState(!1),g=!p,v=h.useCallback(()=>{typeof d=="function"&&d(),x(!1)},[d]),y=h.useCallback(()=>{typeof u=="function"&&u(),x(!0)},[u]);return h.createElement(HX,{showLabels:g,rects:n},h.createElement(mg,{animationId:m,begin:o,duration:l,isActive:i,easing:c,onAnimationEnd:v,onAnimationStart:y,key:m},j=>{var N=j===1?n:n==null?void 0:n.map((w,k)=>{var b=f&&f[k];if(b)return jr(jr({},w),{},{x:cr(b.x,w.x,j),y:cr(b.y,w.y,j),width:cr(b.width,w.width,j),height:cr(b.height,w.height,j)});if(s==="horizontal"){var C=cr(0,w.height,j),_=cr(w.stackedBarStart,w.y,j);return jr(jr({},w),{},{y:_,height:C})}var S=cr(0,w.width,j),I=cr(w.stackedBarStart,w.x,j);return jr(jr({},w),{},{width:S,x:I})});return j>0&&(r.current=N??null),N==null?null:h.createElement(Aa,null,h.createElement(GX,{props:t,data:N}))}),h.createElement(_Y,{label:t.label}),t.children)}function XX(e){var t=h.useRef(null);return h.createElement(VX,{previousRectanglesRef:t,props:e})}var iO=0,QX=(e,t)=>{var r=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:r,errorVal:fr(e,t)}};class ZX extends h.PureComponent{render(){var{hide:t,data:r,dataKey:n,className:s,xAxisId:i,yAxisId:o,needClip:l,background:c,id:d}=this.props;if(t||r==null)return null;var u=it("recharts-bar",s),f=d;return h.createElement(Aa,{className:u,id:d},l&&h.createElement("defs",null,h.createElement($V,{clipPathId:f,xAxisId:i,yAxisId:o})),h.createElement(Aa,{className:"recharts-bar-rectangles",clipPath:l?"url(#clipPath-".concat(f,")"):void 0},h.createElement(qX,{data:r,dataKey:n,background:c,allOtherBarProps:this.props}),h.createElement(XX,this.props)))}}var JX={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:iO,xAxisId:0,yAxisId:0,zIndex:Sr.bar};function eQ(e){var{xAxisId:t,yAxisId:r,hide:n,legendType:s,minPointSize:i,activeBar:o,animationBegin:l,animationDuration:c,animationEasing:d,isAnimationActive:u}=e,{needClip:f}=rO(t,r),m=Mo(),p=Xr(),x=TY(e.children,kM),g=Ae(j=>_X(j,e.id,p,x));if(m!=="vertical"&&m!=="horizontal")return null;var v,y=g==null?void 0:g[0];return y==null||y.height==null||y.width==null?v=0:v=m==="vertical"?y.height/2:y.width/2,h.createElement(RV,{xAxisId:t,yAxisId:r,data:g,dataPointFormatter:QX,errorBarOffset:v},h.createElement(ZX,La({},e,{layout:m,needClip:f,data:g,xAxisId:t,yAxisId:r,hide:n,legendType:s,minPointSize:i,activeBar:o,animationBegin:l,animationDuration:c,animationEasing:d,isAnimationActive:u})))}function tQ(e){var{layout:t,barSettings:{dataKey:r,minPointSize:n},pos:s,bandSize:i,xAxis:o,yAxis:l,xAxisTicks:c,yAxisTicks:d,stackedData:u,displayedData:f,offset:m,cells:p,parentViewBox:x,dataStartIndex:g}=e,v=t==="horizontal"?l:o,y=u?v.scale.domain():null,j=s8({numericAxis:v}),N=v.scale.map(j);return f.map((w,k)=>{var b,C,_,S,I,A;if(u){var O=u[k+g];if(O==null)return null;b=JF(O,y)}else b=fr(w,r),Array.isArray(b)||(b=[j,b]);var L=dX(n,iO)(b[1],k);if(t==="horizontal"){var F,X=l.scale.map(b[0]),T=l.scale.map(b[1]);if(X==null||T==null)return null;C=x0({axis:o,ticks:c,bandSize:i,offset:s.offset,entry:w,index:k}),_=(F=T??X)!==null&&F!==void 0?F:void 0,S=s.size;var G=X-T;if(I=ra(G)?0:G,A={x:C,y:m.top,width:S,height:m.height},Math.abs(L)>0&&Math.abs(I)<Math.abs(L)){var re=Fr(I||L)*(Math.abs(L)-Math.abs(I));_-=re,I+=re}}else{var J=o.scale.map(b[0]),P=o.scale.map(b[1]);if(J==null||P==null)return null;if(C=J,_=x0({axis:l,ticks:d,bandSize:i,offset:s.offset,entry:w,index:k}),S=P-J,I=s.size,A={x:m.left,y:_,width:m.width,height:I},Math.abs(L)>0&&Math.abs(S)<Math.abs(L)){var M=Fr(S||L)*(Math.abs(L)-Math.abs(S));S+=M}}if(C==null||_==null||S==null||I==null)return null;var R=jr(jr({},w),{},{stackedBarStart:N,x:C,y:_,width:S,height:I,value:u?b:b[1],payload:w,background:A,tooltipPosition:{x:C+S/2,y:_+I/2},parentViewBox:x},p&&p[k]&&p[k].props);return R}).filter(Boolean)}function rQ(e){var t=sn(e,JX),r=EX(t.stackId),n=Xr();return h.createElement(aG,{id:t.id,type:"bar"},s=>h.createElement(h.Fragment,null,h.createElement(JY,{legendPayload:WX(t)}),h.createElement(UX,{dataKey:t.dataKey,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:s}),h.createElement(uG,{type:"bar",id:s,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:r,hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:n}),h.createElement(ts,{zIndex:t.zIndex},h.createElement(eQ,La({},t,{id:s})))))}var Wl=h.memo(rQ,yv);Wl.displayName="Bar";var nQ=["domain","range"],aQ=["domain","range"];function oj(e,t){if(e==null)return{};var r,n,s=sQ(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function sQ(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function lj(e,t){return e===t?!0:Array.isArray(e)&&e.length===2&&Array.isArray(t)&&t.length===2?e[0]===t[0]&&e[1]===t[1]:!1}function oO(e,t){if(e===t)return!0;var{domain:r,range:n}=e,s=oj(e,nQ),{domain:i,range:o}=t,l=oj(t,aQ);return!lj(r,i)||!lj(n,o)?!1:yv(s,l)}var iQ=["type"],oQ=["dangerouslySetInnerHTML","ticks","scale"],lQ=["id","scale"];function Op(){return Op=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Op.apply(null,arguments)}function cj(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function dj(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?cj(Object(r),!0).forEach(function(n){cQ(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):cj(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function cQ(e,t,r){return(t=dQ(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dQ(e){var t=uQ(e,"string");return typeof t=="symbol"?t:t+""}function uQ(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Pp(e,t){if(e==null)return{};var r,n,s=fQ(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function fQ(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function mQ(e){var t=Et(),r=h.useRef(null),n=F2(),{type:s}=e,i=Pp(e,iQ),o=Kf(n,"xAxis",s),l=h.useMemo(()=>{if(o!=null)return dj(dj({},i),{},{type:o})},[i,o]);return h.useLayoutEffect(()=>{l!=null&&(r.current===null?t(xG(l)):r.current!==l&&t(gG({prev:r.current,next:l})),r.current=l)},[l,t]),h.useLayoutEffect(()=>()=>{r.current&&(t(vG(r.current)),r.current=null)},[t]),null}var hQ=e=>{var{xAxisId:t,className:r}=e,n=Ae(lg),s=Xr(),i="xAxis",o=Ae(y=>K_(y,i,t,s)),l=Ae(y=>W_(y,t)),c=Ae(y=>nq(y,t)),d=Ae(y=>u_(y,t));if(l==null||c==null||d==null)return null;var{dangerouslySetInnerHTML:u,ticks:f,scale:m}=e,p=Pp(e,oQ),{id:x,scale:g}=d,v=Pp(d,lQ);return h.createElement(vv,Op({},p,v,{x:c.x,y:c.y,width:l.width,height:l.height,className:it("recharts-".concat(i," ").concat(i),r),viewBox:n,ticks:o,axisType:i}))},pQ={allowDataOverflow:Yt.allowDataOverflow,allowDecimals:Yt.allowDecimals,allowDuplicatedCategory:Yt.allowDuplicatedCategory,angle:Yt.angle,axisLine:Ca.axisLine,height:Yt.height,hide:!1,includeHidden:Yt.includeHidden,interval:Yt.interval,label:!1,minTickGap:Yt.minTickGap,mirror:Yt.mirror,orientation:Yt.orientation,padding:Yt.padding,reversed:Yt.reversed,scale:Yt.scale,tick:Yt.tick,tickCount:Yt.tickCount,tickLine:Ca.tickLine,tickSize:Ca.tickSize,type:Yt.type,xAxisId:0},xQ=e=>{var t=sn(e,pQ);return h.createElement(h.Fragment,null,h.createElement(mQ,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit}),h.createElement(hQ,t))},Ul=h.memo(xQ,oO);Ul.displayName="XAxis";var gQ=["type"],vQ=["dangerouslySetInnerHTML","ticks","scale"],yQ=["id","scale"];function Ep(){return Ep=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ep.apply(null,arguments)}function uj(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function fj(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?uj(Object(r),!0).forEach(function(n){bQ(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):uj(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function bQ(e,t,r){return(t=wQ(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wQ(e){var t=jQ(e,"string");return typeof t=="symbol"?t:t+""}function jQ(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ap(e,t){if(e==null)return{};var r,n,s=NQ(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function NQ(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function kQ(e){var t=Et(),r=h.useRef(null),n=F2(),{type:s}=e,i=Ap(e,gQ),o=Kf(n,"yAxis",s),l=h.useMemo(()=>{if(o!=null)return fj(fj({},i),{},{type:o})},[o,i]);return h.useLayoutEffect(()=>{l!=null&&(r.current===null?t(yG(l)):r.current!==l&&t(bG({prev:r.current,next:l})),r.current=l)},[l,t]),h.useLayoutEffect(()=>()=>{r.current&&(t(wG(r.current)),r.current=null)},[t]),null}function SQ(e){var{yAxisId:t,className:r,width:n,label:s}=e,i=h.useRef(null),o=h.useRef(null),l=Ae(lg),c=Xr(),d=Et(),u="yAxis",f=Ae(b=>U_(b,t)),m=Ae(b=>sq(b,t)),p=Ae(b=>K_(b,u,t,c)),x=Ae(b=>f_(b,t));if(h.useLayoutEffect(()=>{if(!(n!=="auto"||!f||hv(s)||h.isValidElement(s)||x==null)){var b=i.current;if(b){var C=b.getCalculatedWidth();Math.round(f.width)!==Math.round(C)&&d(jG({id:t,width:C}))}}},[p,f,d,s,t,n,x]),f==null||m==null||x==null)return null;var{dangerouslySetInnerHTML:g,ticks:v,scale:y}=e,j=Ap(e,vQ),{id:N,scale:w}=x,k=Ap(x,yQ);return h.createElement(vv,Ep({},j,k,{ref:i,labelRef:o,x:m.x,y:m.y,tickTextProps:n==="auto"?{width:void 0}:{width:n},width:f.width,height:f.height,className:it("recharts-".concat(u," ").concat(u),r),viewBox:l,ticks:p,axisType:u}))}var CQ={allowDataOverflow:Gt.allowDataOverflow,allowDecimals:Gt.allowDecimals,allowDuplicatedCategory:Gt.allowDuplicatedCategory,angle:Gt.angle,axisLine:Ca.axisLine,hide:!1,includeHidden:Gt.includeHidden,interval:Gt.interval,label:!1,minTickGap:Gt.minTickGap,mirror:Gt.mirror,orientation:Gt.orientation,padding:Gt.padding,reversed:Gt.reversed,scale:Gt.scale,tick:Gt.tick,tickCount:Gt.tickCount,tickLine:Ca.tickLine,tickSize:Ca.tickSize,type:Gt.type,width:Gt.width,yAxisId:0},_Q=e=>{var t=sn(e,CQ);return h.createElement(h.Fragment,null,h.createElement(kQ,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter}),h.createElement(SQ,t))},ql=h.memo(_Q,oO);ql.displayName="YAxis";var MQ=(e,t)=>t,bv=te([MQ,ot,c_,er,cM,es,yH,Qt],CH),wv=e=>{var t=e.currentTarget.getBoundingClientRect(),r=t.width/e.currentTarget.offsetWidth,n=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/r),chartY:Math.round((e.clientY-t.top)/n)}},lO=pn("mouseClick"),cO=vc();cO.startListening({actionCreator:lO,effect:(e,t)=>{var r=e.payload,n=bv(t.getState(),wv(r));(n==null?void 0:n.activeIndex)!=null&&t.dispatch(yq({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate}))}});var Dp=pn("mouseMove"),dO=vc(),dd=null;dO.startListening({actionCreator:Dp,effect:(e,t)=>{var r=e.payload;dd!==null&&cancelAnimationFrame(dd);var n=wv(r);dd=requestAnimationFrame(()=>{var s=t.getState(),i=nv(s,s.tooltip.settings.shared);if(i==="axis"){var o=bv(s,n);(o==null?void 0:o.activeIndex)!=null?t.dispatch(eM({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate})):t.dispatch(J_())}dd=null})}});function OQ(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<<CHILDREN>>":t}var mj={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},uO=Vr({name:"rootProps",initialState:mj,reducers:{updateOptions:(e,t)=>{var r;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(r=t.payload.barGap)!==null&&r!==void 0?r:mj.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),PQ=uO.reducer,{updateOptions:EQ}=uO.actions,AQ=null,DQ={updatePolarOptions:(e,t)=>t.payload},fO=Vr({name:"polarOptions",initialState:AQ,reducers:DQ}),{updatePolarOptions:Gte}=fO.actions,TQ=fO.reducer,mO=pn("keyDown"),hO=pn("focus"),jv=vc();jv.startListening({actionCreator:mO,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:s}=r.tooltip,i=e.payload;if(!(i!=="ArrowRight"&&i!=="ArrowLeft"&&i!=="Enter")){var o=av(s,$o(r),Mc(r),Pc(r)),l=o==null?-1:Number(o);if(!(!Number.isFinite(l)||l<0)){var c=es(r);if(i==="Enter"){var d=gu(r,"axis","hover",String(s.index));t.dispatch(Np({active:!s.active,activeIndex:s.index,activeCoordinate:d}));return}var u=cq(r),f=u==="left-to-right"?1:-1,m=i==="ArrowRight"?1:-1,p=l+m*f;if(!(c==null||p>=c.length||p<0)){var x=gu(r,"axis","hover",String(p));t.dispatch(Np({active:!0,activeIndex:p.toString(),activeCoordinate:x}))}}}}}});jv.startListening({actionCreator:hO,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:s}=r.tooltip;if(!s.active&&s.index==null){var i="0",o=gu(r,"axis","hover",String(i));t.dispatch(Np({active:!0,activeIndex:i,activeCoordinate:o}))}}}});var cn=pn("externalEvent"),pO=vc(),dh=new Map;pO.startListening({actionCreator:cn,effect:(e,t)=>{var{handler:r,reactEvent:n}=e.payload;if(r!=null){n.persist();var s=n.type,i=dh.get(s);i!==void 0&&cancelAnimationFrame(i);var o=requestAnimationFrame(()=>{try{var l=t.getState(),c={activeCoordinate:aH(l),activeDataKey:mM(l),activeIndex:co(l),activeLabel:fM(l),activeTooltipIndex:co(l),isTooltipActive:sH(l)};r(c,n)}finally{dh.delete(s)}});dh.set(s,o)}}});var IQ=te([Io],e=>e.tooltipItemPayloads),RQ=te([IQ,(e,t)=>t,(e,t,r)=>r],(e,t,r)=>{if(t!=null){var n=e.find(i=>i.settings.graphicalItemId===r);if(n!=null){var{getPosition:s}=n;if(s!=null)return s(t)}}}),xO=pn("touchMove"),gO=vc();gO.startListening({actionCreator:xO,effect:(e,t)=>{var r=e.payload;if(!(r.touches==null||r.touches.length===0)){var n=t.getState(),s=nv(n,n.tooltip.settings.shared);if(s==="axis"){var i=r.touches[0];if(i==null)return;var o=bv(n,wv({clientX:i.clientX,clientY:i.clientY,currentTarget:r.currentTarget}));(o==null?void 0:o.activeIndex)!=null&&t.dispatch(eM({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if(s==="item"){var l,c=r.touches[0];if(document.elementFromPoint==null||c==null)return;var d=document.elementFromPoint(c.clientX,c.clientY);if(!d||!d.getAttribute)return;var u=d.getAttribute(f8),f=(l=d.getAttribute(m8))!==null&&l!==void 0?l:void 0,m=Ro(n).find(g=>g.id===f);if(u==null||m==null||f==null)return;var{dataKey:p}=m,x=RQ(n,u,f);t.dispatch(Z_({activeDataKey:p,activeIndex:u,activeCoordinate:x,activeGraphicalItemId:f}))}}}});var $Q=ZS({brush:RG,cartesianAxis:NG,chartData:nK,errorBars:PV,graphicalItems:cG,layout:GF,legend:eB,options:ZH,polarAxis:OY,polarOptions:TQ,referenceElements:FG,rootProps:PQ,tooltip:bq,zIndex:FH}),zQ=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return yF({reducer:$Q,preloadedState:t,middleware:n=>{var s;return n({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((s="es6")!==null&&s!==void 0?s:"")}).concat([cO.middleware,dO.middleware,jv.middleware,pO.middleware,gO.middleware])},enhancers:n=>{var s=n;return typeof n=="function"&&(s=n()),s.concat(m2({type:"raf"}))},devTools:{serialize:{replacer:OQ},name:"recharts-".concat(r)}})};function LQ(e){var{preloadedState:t,children:r,reduxStoreName:n}=e,s=Xr(),i=h.useRef(null);if(s)return r;i.current==null&&(i.current=zQ(t,n));var o=Jx;return h.createElement(sX,{context:o,store:i.current},r)}function FQ(e){var{layout:t,margin:r}=e,n=Et(),s=Xr();return h.useEffect(()=>{s||(n(HF(t)),n(qF(r)))},[n,s,t,r]),null}var BQ=h.memo(FQ,yv);function WQ(e){var t=Et();return h.useEffect(()=>{t(EQ(e))},[t,e]),null}function hj(e){var{zIndex:t,isPanorama:r}=e,n=h.useRef(null),s=Et();return h.useLayoutEffect(()=>(n.current&&s(zH({zIndex:t,element:n.current,isPanorama:r})),()=>{s(LH({zIndex:t,isPanorama:r}))}),[s,t,r]),h.createElement("g",{tabIndex:-1,ref:n})}function pj(e){var{children:t,isPanorama:r}=e,n=Ae(MH);if(!n||n.length===0)return t;var s=n.filter(o=>o<0),i=n.filter(o=>o>0);return h.createElement(h.Fragment,null,s.map(o=>h.createElement(hj,{key:o,zIndex:o,isPanorama:r})),t,i.map(o=>h.createElement(hj,{key:o,zIndex:o,isPanorama:r})))}var UQ=["children"];function qQ(e,t){if(e==null)return{};var r,n,s=HQ(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function HQ(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function Su(){return Su=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Su.apply(null,arguments)}var KQ={width:"100%",height:"100%",display:"block"},YQ=h.forwardRef((e,t)=>{var r=z2(),n=L2(),s=V2();if(!aa(r)||!aa(n))return null;var{children:i,otherAttributes:o,title:l,desc:c}=e,d,u;return o!=null&&(typeof o.tabIndex=="number"?d=o.tabIndex:d=s?0:void 0,typeof o.role=="string"?u=o.role:u=s?"application":void 0),h.createElement(nS,Su({},o,{title:l,desc:c,role:u,tabIndex:d,width:r,height:n,style:KQ,ref:t}),i)}),GQ=e=>{var{children:t}=e,r=Ae(Af);if(!r)return null;var{width:n,height:s,y:i,x:o}=r;return h.createElement(nS,{width:n,height:s,x:o,y:i},t)},xj=h.forwardRef((e,t)=>{var{children:r}=e,n=qQ(e,UQ),s=Xr();return s?h.createElement(GQ,null,h.createElement(pj,{isPanorama:!0},r)):h.createElement(YQ,Su({ref:t},n),h.createElement(pj,{isPanorama:!1},r))});function VQ(){var e=Et(),[t,r]=h.useState(null),n=Ae(u8);return h.useEffect(()=>{if(t!=null){var s=t.getBoundingClientRect(),i=s.width/t.offsetWidth;Ge(i)&&i!==n&&e(YF(i))}},[t,e,n]),r}function gj(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function XQ(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?gj(Object(r),!0).forEach(function(n){QQ(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gj(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function QQ(e,t,r){return(t=ZQ(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ZQ(e){var t=JQ(e,"string");return typeof t=="symbol"?t:t+""}function JQ(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vs(){return vs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},vs.apply(null,arguments)}var eZ=()=>(fK(),null);function Cu(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var tZ=h.forwardRef((e,t)=>{var r,n,s=h.useRef(null),[i,o]=h.useState({containerWidth:Cu((r=e.style)===null||r===void 0?void 0:r.width),containerHeight:Cu((n=e.style)===null||n===void 0?void 0:n.height)}),l=h.useCallback((d,u)=>{o(f=>{var m=Math.round(d),p=Math.round(u);return f.containerWidth===m&&f.containerHeight===p?f:{containerWidth:m,containerHeight:p}})},[]),c=h.useCallback(d=>{if(typeof t=="function"&&t(d),d!=null&&typeof ResizeObserver<"u"){var{width:u,height:f}=d.getBoundingClientRect();l(u,f);var m=x=>{var g=x[0];if(g!=null){var{width:v,height:y}=g.contentRect;l(v,y)}},p=new ResizeObserver(m);p.observe(d),s.current=p}},[t,l]);return h.useEffect(()=>()=>{var d=s.current;d!=null&&d.disconnect()},[l]),h.createElement(h.Fragment,null,h.createElement(bc,{width:i.containerWidth,height:i.containerHeight}),h.createElement("div",vs({ref:c},e)))}),rZ=h.forwardRef((e,t)=>{var{width:r,height:n}=e,[s,i]=h.useState({containerWidth:Cu(r),containerHeight:Cu(n)}),o=h.useCallback((c,d)=>{i(u=>{var f=Math.round(c),m=Math.round(d);return u.containerWidth===f&&u.containerHeight===m?u:{containerWidth:f,containerHeight:m}})},[]),l=h.useCallback(c=>{if(typeof t=="function"&&t(c),c!=null){var{width:d,height:u}=c.getBoundingClientRect();o(d,u)}},[t,o]);return h.createElement(h.Fragment,null,h.createElement(bc,{width:s.containerWidth,height:s.containerHeight}),h.createElement("div",vs({ref:l},e)))}),nZ=h.forwardRef((e,t)=>{var{width:r,height:n}=e;return h.createElement(h.Fragment,null,h.createElement(bc,{width:r,height:n}),h.createElement("div",vs({ref:t},e)))}),aZ=h.forwardRef((e,t)=>{var{width:r,height:n}=e;return typeof r=="string"||typeof n=="string"?h.createElement(rZ,vs({},e,{ref:t})):typeof r=="number"&&typeof n=="number"?h.createElement(nZ,vs({},e,{width:r,height:n,ref:t})):h.createElement(h.Fragment,null,h.createElement(bc,{width:r,height:n}),h.createElement("div",vs({ref:t},e)))});function sZ(e){return e?tZ:aZ}var iZ=h.forwardRef((e,t)=>{var{children:r,className:n,height:s,onClick:i,onContextMenu:o,onDoubleClick:l,onMouseDown:c,onMouseEnter:d,onMouseLeave:u,onMouseMove:f,onMouseUp:m,onTouchEnd:p,onTouchMove:x,onTouchStart:g,style:v,width:y,responsive:j,dispatchTouchEvents:N=!0}=e,w=h.useRef(null),k=Et(),[b,C]=h.useState(null),[_,S]=h.useState(null),I=VQ(),A=cg(),O=(A==null?void 0:A.width)>0?A.width:y,L=(A==null?void 0:A.height)>0?A.height:s,F=h.useCallback(B=>{I(B),typeof t=="function"&&t(B),C(B),S(B),B!=null&&(w.current=B)},[I,t,C,S]),X=h.useCallback(B=>{k(lO(B)),k(cn({handler:i,reactEvent:B}))},[k,i]),T=h.useCallback(B=>{k(Dp(B)),k(cn({handler:d,reactEvent:B}))},[k,d]),G=h.useCallback(B=>{k(J_()),k(cn({handler:u,reactEvent:B}))},[k,u]),re=h.useCallback(B=>{k(Dp(B)),k(cn({handler:f,reactEvent:B}))},[k,f]),J=h.useCallback(()=>{k(hO())},[k]),P=h.useCallback(B=>{k(mO(B.key))},[k]),M=h.useCallback(B=>{k(cn({handler:o,reactEvent:B}))},[k,o]),R=h.useCallback(B=>{k(cn({handler:l,reactEvent:B}))},[k,l]),q=h.useCallback(B=>{k(cn({handler:c,reactEvent:B}))},[k,c]),$=h.useCallback(B=>{k(cn({handler:m,reactEvent:B}))},[k,m]),K=h.useCallback(B=>{k(cn({handler:g,reactEvent:B}))},[k,g]),D=h.useCallback(B=>{N&&k(xO(B)),k(cn({handler:x,reactEvent:B}))},[k,N,x]),E=h.useCallback(B=>{k(cn({handler:p,reactEvent:B}))},[k,p]),Z=sZ(j);return h.createElement(bM.Provider,{value:b},h.createElement(Pz.Provider,{value:_},h.createElement(Z,{width:O??(v==null?void 0:v.width),height:L??(v==null?void 0:v.height),className:it("recharts-wrapper",n),style:XQ({position:"relative",cursor:"default",width:O,height:L},v),onClick:X,onContextMenu:M,onDoubleClick:R,onFocus:J,onKeyDown:P,onMouseDown:q,onMouseEnter:T,onMouseLeave:G,onMouseMove:re,onMouseUp:$,onTouchEnd:E,onTouchMove:D,onTouchStart:K,ref:F},h.createElement(eZ,null),r)))}),oZ=["width","height","responsive","children","className","style","compact","title","desc"];function lZ(e,t){if(e==null)return{};var r,n,s=cZ(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function cZ(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var dZ=h.forwardRef((e,t)=>{var{width:r,height:n,responsive:s,children:i,className:o,style:l,compact:c,title:d,desc:u}=e,f=lZ(e,oZ),m=Ea(f);return c?h.createElement(h.Fragment,null,h.createElement(bc,{width:r,height:n}),h.createElement(xj,{otherAttributes:m,title:d,desc:u},i)):h.createElement(iZ,{className:o,style:l,width:r,height:n,responsive:s??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},h.createElement(xj,{otherAttributes:m,title:d,desc:u,ref:t},h.createElement(WG,null,i)))});function Tp(){return Tp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Tp.apply(null,arguments)}var uZ={top:5,right:5,bottom:5,left:5},fZ={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:uZ,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},mZ=h.forwardRef(function(t,r){var n,s=sn(t.categoricalChartProps,fZ),{chartName:i,defaultTooltipEventType:o,validateTooltipEventTypes:l,tooltipPayloadSearcher:c,categoricalChartProps:d}=t,u={chartName:i,defaultTooltipEventType:o,validateTooltipEventTypes:l,tooltipPayloadSearcher:c,eventEmitter:void 0};return h.createElement(LQ,{preloadedState:{options:u},reduxStoreName:(n=d.id)!==null&&n!==void 0?n:i},h.createElement(IG,{chartData:d.data}),h.createElement(BQ,{layout:s.layout,margin:s.margin}),h.createElement(WQ,{baseValue:s.baseValue,accessibilityLayer:s.accessibilityLayer,barCategoryGap:s.barCategoryGap,maxBarSize:s.maxBarSize,stackOffset:s.stackOffset,barGap:s.barGap,barSize:s.barSize,syncId:s.syncId,syncMethod:s.syncMethod,className:s.className,reverseStackOrder:s.reverseStackOrder}),h.createElement(dZ,Tp({},s,{ref:r})))}),hZ=["axis","item"],_u=h.forwardRef((e,t)=>h.createElement(mZ,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:hZ,tooltipPayloadSearcher:XH,categoricalChartProps:e,ref:t}));const vO={all:["reporting"],timeLogs:e=>[...vO.all,"time-logs",e]};function yO(e,t){return Be({queryKey:vO.timeLogs(e),queryFn:()=>{const r=new URLSearchParams;return Object.entries(e).forEach(([n,s])=>{s&&(n==="workspace_ids"&&Array.isArray(s)?s.length>0&&r.set("workspace_ids",s.join(",")):typeof s=="string"&&r.set(n,s))}),oe.get(`/admin/reporting/time-logs?${r}`)},enabled:(t==null?void 0:t.enabled)??(Object.values(e).some(Boolean)||!!e.workspace_id)})}function Mu({value:e,onChange:t,placeholder:r="Pick a date",className:n}){return a.jsxs(Ot,{children:[a.jsx(Pt,{asChild:!0,children:a.jsxs(ne,{variant:"outline",className:z("h-8 w-36 justify-start text-left font-normal text-xs gap-1.5",!e&&"text-muted-foreground",n),children:[a.jsx(Wt,{className:"h-3.5 w-3.5 shrink-0"}),e?fe(e,"MMM d, yyyy"):a.jsx("span",{children:r}),e&&a.jsx("span",{role:"button",className:"ml-auto hover:text-foreground",onClick:s=>{s.stopPropagation(),t(void 0)},children:a.jsx(tt,{className:"h-3 w-3"})})]})}),a.jsx(_t,{className:"w-auto p-0",align:"start",children:a.jsx(gr,{mode:"single",selected:e,onSelect:t,initialFocus:!0})})]})}function hl(e){const t=Math.floor(e/60),r=e%60;return t===0?`${r}m`:r===0?`${t}h`:`${t}h ${r}m`}function vj({active:e,payload:t,label:r}){var n;return!e||!(t!=null&&t.length)?null:a.jsxs("div",{className:"bg-popover border border-border rounded-lg px-3 py-2 text-xs shadow-lg",children:[a.jsx("p",{className:"font-medium mb-0.5",children:r}),a.jsx("p",{className:"text-muted-foreground",children:hl(((n=t[0])==null?void 0:n.value)??0)})]})}function pZ({workspaceId:e}){const[t,r]=h.useState(void 0),[n,s]=h.useState(void 0),[i,o]=h.useState([]),[l,c]=h.useState([]),[d,u]=h.useState([]),{workspace:f}=Ie(),m=(f==null?void 0:f.slug)??"",{data:p=[],isLoading:x}=Nx(),{data:g=[],isLoading:v}=vo(e?void 0:{allWorkspaces:!0}),{data:y=[],isLoading:j}=xo(),{data:N}=ks(),w=t?fe(t,"yyyy-MM-dd"):void 0,k=n?fe(n,"yyyy-MM-dd"):void 0,b=h.useMemo(()=>new Map(g.map(P=>[P.id,P])),[g]),C=e?[e]:d.length>0?d:void 0,{data:_,isLoading:S}=yO({from:w,to:k,workspace_id:e,workspace_ids:C},{enabled:!0}),I=(_==null?void 0:_.time_logs)??[],A=h.useMemo(()=>{let P=I;return v||(P=P.filter(M=>!M.project_id||b.has(M.project_id))),i.length>0&&(P=P.filter(M=>i.includes(M.user_id))),l.length>0&&(P=P.filter(M=>M.project_id&&l.includes(M.project_id))),P},[I,i,l,b,v]),O=A.reduce((P,M)=>P+(M.duration_minutes??0),0),L=h.useMemo(()=>new Set(A.map(P=>P.user_id)).size,[A]),F=h.useMemo(()=>new Set(A.map(P=>P.project_id).filter(Boolean)).size,[A]),X=h.useMemo(()=>{const P=new Map;for(const M of A)P.set(M.user_id,(P.get(M.user_id)??0)+(M.duration_minutes??0));return Array.from(P.entries()).map(([M,R])=>{var q;return{name:((q=N==null?void 0:N.get(M))==null?void 0:q.name)??"Unknown",minutes:R}}).sort((M,R)=>R.minutes-M.minutes).slice(0,8)},[A,N]),T=h.useMemo(()=>{const P=new Map;for(const M of A){const R=M.project_id??"__none__";P.set(R,(P.get(R)??0)+(M.duration_minutes??0))}return Array.from(P.entries()).map(([M,R])=>{var q;return{name:M==="__none__"?"No project":((q=b.get(M))==null?void 0:q.name)??"Unknown",minutes:R}}).sort((M,R)=>R.minutes-M.minutes).slice(0,8)},[A,b]),G=h.useMemo(()=>p.map(P=>({value:P.id,label:[P.first_name,P.last_name].filter(Boolean).join(" ")||P.email})),[p]),re=h.useMemo(()=>y.map(P=>({value:P.id,label:P.name})),[y]),J=h.useMemo(()=>g.map(P=>({value:P.id,label:P.name})),[g]);return a.jsxs("div",{className:"p-2 space-y-2",children:[a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl px-6 py-4 flex items-center gap-3",children:[a.jsx("div",{className:"h-9 w-9 rounded-lg bg-muted flex items-center justify-center shrink-0",children:a.jsx(ys,{className:"h-4 w-4 text-muted-foreground"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-semibold",children:"Time Logs"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Filter by date range, employees, and projects to analyze time across the organization."})]})]}),a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl px-4 py-3 flex flex-col gap-3 md:flex-row md:items-center md:flex-wrap",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0",children:[a.jsx(ni,{className:"h-3.5 w-3.5"}),a.jsx("span",{className:"font-medium",children:"Date range"})]}),a.jsx(Mu,{value:t,onChange:r,placeholder:"From"}),a.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"→"}),a.jsx(Mu,{value:n,onChange:s,placeholder:"To"})]}),!e&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"hidden md:block w-px h-5 bg-border mx-1 shrink-0"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0",children:[a.jsx(I1,{className:"h-3.5 w-3.5"}),a.jsx("span",{className:"font-medium",children:"Workspaces"})]}),j?a.jsx(le,{className:"h-8 w-40"}):a.jsx(vl,{options:re,selected:d,onSelectionChange:u,placeholder:"All workspaces",className:"w-44"})]})]}),a.jsx("div",{className:"hidden md:block w-px h-5 bg-border mx-1 shrink-0"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0",children:[a.jsx(ba,{className:"h-3.5 w-3.5"}),a.jsx("span",{className:"font-medium",children:"Employees"})]}),x?a.jsx(le,{className:"h-8 w-40"}):a.jsx(vl,{options:G,selected:i,onSelectionChange:o,placeholder:"All employees",className:"w-44"})]}),a.jsx("div",{className:"hidden md:block w-px h-5 bg-border mx-1 shrink-0"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0",children:[a.jsx(Hr,{className:"h-3.5 w-3.5"}),a.jsx("span",{className:"font-medium",children:"Projects"})]}),v?a.jsx(le,{className:"h-8 w-40"}):a.jsx(vl,{options:J,selected:l,onSelectionChange:c,placeholder:"All projects",className:"w-44"})]})]}),S?a.jsx("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden divide-y divide-border",children:[1,2,3,4].map(P=>a.jsxs("div",{className:"px-6 py-4 flex items-center gap-4",children:[a.jsx(le,{className:"h-4 w-24"}),a.jsx(le,{className:"h-4 w-32"}),a.jsx(le,{className:"h-4 w-48"})]},P))}):A.length===0?a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl flex flex-col items-center justify-center py-16 text-center",children:[a.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:a.jsx(Tn,{className:"h-5 w-5 text-muted-foreground"})}),a.jsx("p",{className:"text-sm font-medium mb-1",children:"No time logs found"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:w||k||i.length>0||l.length>0||d.length>0?"Try adjusting your filters.":"No time has been logged yet."})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl px-5 py-4",children:[a.jsx("p",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Total time"}),a.jsx("p",{className:"text-2xl font-bold tabular-nums",children:hl(O)})]}),a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl px-5 py-4",children:[a.jsx("p",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Employees"}),a.jsx("p",{className:"text-2xl font-bold tabular-nums",children:L})]}),a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl px-5 py-4",children:[a.jsx("p",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Projects"}),a.jsx("p",{className:"text-2xl font-bold tabular-nums",children:F})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[X.length>0&&a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(ba,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Time by employee"})]}),a.jsx(Gd,{width:"100%",height:Math.max(80,X.length*36),children:a.jsxs(_u,{data:X,layout:"vertical",margin:{left:0,right:40,top:0,bottom:0},children:[a.jsx(Bl,{strokeDasharray:"3 3",horizontal:!1,stroke:"hsl(var(--border))"}),a.jsx(Ul,{type:"number",tickFormatter:P=>hl(P),tick:{fontSize:9,fill:"hsl(var(--muted-foreground))"},axisLine:!1,tickLine:!1}),a.jsx(ql,{type:"category",dataKey:"name",width:100,tick:{fontSize:11,fill:"hsl(var(--foreground))"},axisLine:!1,tickLine:!1}),a.jsx(vu,{content:a.jsx(vj,{}),cursor:{fill:"hsl(var(--muted))"}}),a.jsx(Wl,{dataKey:"minutes",fill:"#6366f1",radius:[0,4,4,0]})]})})]}),T.length>0&&a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(Hr,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Time by project"})]}),a.jsx(Gd,{width:"100%",height:Math.max(80,T.length*36),children:a.jsxs(_u,{data:T,layout:"vertical",margin:{left:0,right:40,top:0,bottom:0},children:[a.jsx(Bl,{strokeDasharray:"3 3",horizontal:!1,stroke:"hsl(var(--border))"}),a.jsx(Ul,{type:"number",tickFormatter:P=>hl(P),tick:{fontSize:9,fill:"hsl(var(--muted-foreground))"},axisLine:!1,tickLine:!1}),a.jsx(ql,{type:"category",dataKey:"name",width:100,tick:{fontSize:11,fill:"hsl(var(--foreground))"},axisLine:!1,tickLine:!1}),a.jsx(vu,{content:a.jsx(vj,{}),cursor:{fill:"hsl(var(--muted))"}}),a.jsx(Wl,{dataKey:"minutes",fill:"#6366f1",radius:[0,4,4,0]})]})})]})]}),a.jsx("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border bg-muted/20",children:[a.jsx("th",{className:"text-left px-6 py-2.5 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Employee"}),a.jsx("th",{className:"text-left px-6 py-2.5 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Project"}),a.jsx("th",{className:"text-left px-6 py-2.5 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Issue"}),a.jsx("th",{className:"text-left px-6 py-2.5 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Date"}),a.jsx("th",{className:"text-left px-6 py-2.5 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Description"}),a.jsx("th",{className:"text-right px-6 py-2.5 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Duration"})]})}),a.jsx("tbody",{className:"divide-y divide-border",children:A.map(P=>{var q;const M=P.project_id?b.get(P.project_id):void 0,R=((q=N==null?void 0:N.get(P.user_id))==null?void 0:q.name)??P.user_id.slice(0,8)+"…";return a.jsxs("tr",{className:"hover:bg-muted/30 transition-colors",children:[a.jsx("td",{className:"px-6 py-3 text-xs font-medium",children:R}),a.jsx("td",{className:"px-6 py-3 text-xs text-muted-foreground",children:(M==null?void 0:M.name)??(P.project_id?"Unknown":"—")}),a.jsx("td",{className:"px-6 py-3",children:P.issue_identifier?a.jsx(qr,{to:`/${m}/projects/${M==null?void 0:M.identifier}/issues/${P.issue_id}`,className:"font-mono text-xs text-indigo-600 dark:text-indigo-400 hover:underline",children:P.issue_identifier}):a.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[P.issue_id.slice(0,8),"…"]})}),a.jsx("td",{className:"px-6 py-3 text-xs text-muted-foreground tabular-nums whitespace-nowrap",children:P.logged_date?fe(new Date(P.logged_date),"MMM d, yyyy"):"—"}),a.jsx("td",{className:"px-6 py-3 text-xs text-muted-foreground truncate max-w-xs",children:P.description??a.jsx("span",{className:"italic",children:"—"})}),a.jsx("td",{className:"px-6 py-3 text-xs text-right tabular-nums font-semibold",children:P.duration_minutes!=null?hl(P.duration_minutes):"Running…"})]},P.id)})})]})})]})]})}function Li(e){const t=Math.floor(e/60),r=e%60;return t===0?`${r}m`:r===0?`${t}h`:`${t}h ${r}m`}function yj({active:e,payload:t,label:r}){var n;return!e||!(t!=null&&t.length)?null:a.jsxs("div",{className:"bg-popover border border-border rounded-lg px-3 py-2 text-xs shadow-lg",children:[a.jsx("p",{className:"font-medium mb-0.5",children:r}),a.jsx("p",{className:"text-muted-foreground",children:Li(((n=t[0])==null?void 0:n.value)??0)})]})}function xZ(){const{projectKey:e,workspace:t}=zt(),[r,n]=h.useState(void 0),[s,i]=h.useState(void 0),[o,l]=h.useState([]),{data:c}=Wa(e??""),{data:d}=ks(),{data:u=[]}=Nx(),f=r?fe(r,"yyyy-MM-dd"):void 0,m=s?fe(s,"yyyy-MM-dd"):void 0,{data:p,isLoading:x}=yO({project_id:c==null?void 0:c.id,from:f,to:m}),g=(p==null?void 0:p.time_logs)??[],v=h.useMemo(()=>o.length>0?g.filter(_=>o.includes(_.user_id)):g,[g,o]),y=h.useMemo(()=>v.reduce((_,S)=>_+(S.duration_minutes??0),0),[v]),j=h.useMemo(()=>{const _=new Map;for(const S of v){_.has(S.user_id)||_.set(S.user_id,{logs:[],totalMinutes:0});const I=_.get(S.user_id);I.logs.push(S),I.totalMinutes+=S.duration_minutes??0}return _},[v]),N=h.useMemo(()=>{const _=new Map;for(const S of v){_.has(S.issue_id)||_.set(S.issue_id,{logs:[],totalMinutes:0});const I=_.get(S.issue_id);I.logs.push(S),I.totalMinutes+=S.duration_minutes??0}return _},[v]),w=Array.from(j.entries()).sort((_,S)=>S[1].totalMinutes-_[1].totalMinutes).slice(0,8).map(([_,{totalMinutes:S}])=>{var I;return{name:((I=d==null?void 0:d.get(_))==null?void 0:I.name)??"Unknown",minutes:S}}),k=Array.from(N.entries()).sort((_,S)=>S[1].totalMinutes-_[1].totalMinutes).slice(0,8).map(([_,{totalMinutes:S,logs:I}])=>{var A;return{name:((A=I[0])==null?void 0:A.issue_identifier)??_.slice(0,8),minutes:S}}),b=h.useMemo(()=>u.map(_=>({value:_.id,label:[_.first_name,_.last_name].filter(Boolean).join(" ")||_.email})),[u]),C=v.length>0;return a.jsxs("div",{className:"p-2 pb-24 md:pb-2 space-y-2",children:[a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl px-4 py-3 flex flex-col gap-3 md:flex-row md:items-center md:flex-wrap",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0",children:[a.jsx(ni,{className:"h-3.5 w-3.5"}),a.jsx("span",{className:"font-medium",children:"Date range"})]}),a.jsx(Mu,{value:r,onChange:n,placeholder:"From"}),a.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"→"}),a.jsx(Mu,{value:s,onChange:i,placeholder:"To"})]}),a.jsx("div",{className:"hidden md:block w-px h-4 bg-border"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0",children:[a.jsx(ba,{className:"h-3.5 w-3.5"}),a.jsx("span",{className:"font-medium",children:"Employee"})]}),a.jsx(vl,{options:b,selected:o,onSelectionChange:l,placeholder:"All employees",className:"w-44"})]})]}),a.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{label:"Total logged",value:y>0?Li(y):"—",icon:Tn},{label:"Contributors",value:j.size>0?String(j.size):"—",icon:ba},{label:"Issues tracked",value:N.size>0?String(N.size):"—",icon:Jn}].map(({label:_,value:S,icon:I})=>a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl px-3 md:px-5 py-3 md:py-4 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[a.jsx(I,{className:"h-3.5 w-3.5 text-muted-foreground hidden md:block shrink-0"}),a.jsx("p",{className:"text-[11px] text-muted-foreground uppercase tracking-wider font-medium break-all",children:_})]}),a.jsx("p",{className:"text-xl md:text-2xl font-bold tabular-nums",children:S})]},_))}),x?a.jsx("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:a.jsx("div",{className:"divide-y divide-border",children:[1,2,3].map(_=>a.jsxs("div",{className:"flex items-center gap-4 px-6 py-4",children:[a.jsx(le,{className:"h-7 w-7 rounded-full"}),a.jsx(le,{className:"h-4 w-40"}),a.jsx("div",{className:"flex-1"}),a.jsx(le,{className:"h-4 w-20"})]},_))})}):c!=null&&c.id?C?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:[j.size>0&&a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(ba,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Time by user"})]}),a.jsx(Gd,{width:"100%",height:Math.max(100,w.length*36),children:a.jsxs(_u,{data:w,layout:"vertical",margin:{left:0,right:32,top:0,bottom:0},children:[a.jsx(Bl,{strokeDasharray:"3 3",horizontal:!1,stroke:"hsl(var(--border))"}),a.jsx(Ul,{type:"number",tickFormatter:_=>Li(_),tick:{fontSize:9,fill:"hsl(var(--muted-foreground))"},axisLine:!1,tickLine:!1}),a.jsx(ql,{type:"category",dataKey:"name",width:88,tick:{fontSize:11,fill:"hsl(var(--foreground))"},axisLine:!1,tickLine:!1}),a.jsx(vu,{content:a.jsx(yj,{}),cursor:{fill:"hsl(var(--muted))"}}),a.jsx(Wl,{dataKey:"minutes",fill:"#6366f1",radius:[0,4,4,0]})]})})]}),N.size>0&&a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(Jn,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Time by issue"})]}),a.jsx(Gd,{width:"100%",height:Math.max(100,k.length*36),children:a.jsxs(_u,{data:k,layout:"vertical",margin:{left:0,right:32,top:0,bottom:0},children:[a.jsx(Bl,{strokeDasharray:"3 3",horizontal:!1,stroke:"hsl(var(--border))"}),a.jsx(Ul,{type:"number",tickFormatter:_=>Li(_),tick:{fontSize:9,fill:"hsl(var(--muted-foreground))"},axisLine:!1,tickLine:!1}),a.jsx(ql,{type:"category",dataKey:"name",width:64,tick:{fontSize:11,fill:"hsl(var(--foreground))",fontFamily:"monospace"},axisLine:!1,tickLine:!1}),a.jsx(vu,{content:a.jsx(yj,{}),cursor:{fill:"hsl(var(--muted))"}}),a.jsx(Wl,{dataKey:"minutes",fill:"#818cf8",radius:[0,4,4,0]})]})})]})]}),a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-2 px-6 py-3 border-b border-border",children:[a.jsx(ba,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Time by user"})]}),a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border bg-muted/20",children:[a.jsx("th",{className:"text-left px-6 py-2 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"User"}),a.jsx("th",{className:"text-right px-6 py-2 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Issues"}),a.jsx("th",{className:"text-right px-6 py-2 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Total"})]})}),a.jsx("tbody",{className:"divide-y divide-border",children:Array.from(j.entries()).sort((_,S)=>S[1].totalMinutes-_[1].totalMinutes).map(([_,{logs:S,totalMinutes:I}])=>{const A=d==null?void 0:d.get(_),O=new Set(S.map(L=>L.issue_id)).size;return a.jsxs("tr",{className:"hover:bg-muted/30 transition-colors",children:[a.jsx("td",{className:"px-6 py-3 text-sm font-medium",children:(A==null?void 0:A.name)??_.slice(0,8)+"…"}),a.jsx("td",{className:"px-6 py-3 text-xs text-right text-muted-foreground tabular-nums",children:O}),a.jsx("td",{className:"px-6 py-3 text-sm text-right tabular-nums font-semibold",children:Li(I)})]},_)})})]})]}),a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-2 px-6 py-3 border-b border-border",children:[a.jsx(Jn,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Time by issue"})]}),a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border bg-muted/20",children:[a.jsx("th",{className:"text-left px-6 py-2 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Issue"}),a.jsx("th",{className:"text-left px-6 py-2 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Last logged"}),a.jsx("th",{className:"text-right px-6 py-2 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Contributors"}),a.jsx("th",{className:"text-right px-6 py-2 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Total"})]})}),a.jsx("tbody",{className:"divide-y divide-border",children:Array.from(N.entries()).sort((_,S)=>S[1].totalMinutes-_[1].totalMinutes).map(([_,{logs:S,totalMinutes:I}])=>{var X,T;const A=new Set(S.map(G=>G.user_id)).size,O=S.reduce((G,re)=>re.logged_date&&(!G||new Date(re.logged_date)>new Date(G))?re.logged_date:G,null),L=(X=S[0])==null?void 0:X.issue_identifier,F=(T=S[0])==null?void 0:T.issue_title;return a.jsxs("tr",{className:"hover:bg-muted/30 transition-colors",children:[a.jsx("td",{className:"px-6 py-3",children:a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[L?a.jsx(qr,{to:`/${t}/projects/${e}/issues/${_}`,className:"font-mono text-xs text-indigo-600 dark:text-indigo-400 hover:underline shrink-0",children:L}):a.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[_.slice(0,8),"…"]}),F&&a.jsx("span",{className:"text-xs text-muted-foreground truncate",children:F})]})}),a.jsx("td",{className:"px-6 py-3 text-xs text-muted-foreground",children:O?fe(new Date(O),"MMM d, yyyy"):"—"}),a.jsx("td",{className:"px-6 py-3 text-xs text-right text-muted-foreground tabular-nums",children:A}),a.jsx("td",{className:"px-6 py-3 text-sm text-right tabular-nums font-semibold",children:Li(I)})]},_)})})]})]})]}):a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl flex flex-col items-center justify-center py-16 text-center",children:[a.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:a.jsx(ys,{className:"h-5 w-5 text-muted-foreground"})}),a.jsx("p",{className:"text-sm font-medium mb-1",children:"No time logged"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:f||m||o.length>0?"No entries match the current filters.":"Start logging time on issues to see reports here."})]}):a.jsx("div",{className:"bg-white dark:bg-card border border-border rounded-xl flex items-center justify-center py-12",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading project…"})})]})}const gZ={share_enabled:{icon:wh,color:"text-green-600",bg:"bg-green-50 dark:bg-green-950/40",label:()=>"Enabled public link"},share_revoked:{icon:v5,color:"text-red-500",bg:"bg-red-50 dark:bg-red-950/40",label:()=>"Revoked public link"},member_added:{icon:po,color:"text-blue-500",bg:"bg-blue-50 dark:bg-blue-950/40",label:(e,t)=>{var i,o,l;const r=(i=e==null?void 0:e.user_id)==null?void 0:i.to,n=(o=e==null?void 0:e.role)==null?void 0:o.to,s=r?((l=t.get(r))==null?void 0:l.name)??r:"a user";return n?`Added ${s} as ${n}`:`Added ${s}`}},member_removed:{icon:Y1,color:"text-red-500",bg:"bg-red-50 dark:bg-red-950/40",label:(e,t)=>{var s,i;const r=(s=e==null?void 0:e.user_id)==null?void 0:s.from;return`Removed ${r?((i=t.get(r))==null?void 0:i.name)??r:"a user"}`}},team_added:{icon:ba,color:"text-indigo-500",bg:"bg-indigo-50 dark:bg-indigo-950/40",label:(e,t,r)=>{var i;const n=(i=e==null?void 0:e.team_id)==null?void 0:i.to;return`Added team ${n?r.get(n)??n:"a team"}`}},team_removed:{icon:G1,color:"text-orange-500",bg:"bg-orange-50 dark:bg-orange-950/40",label:(e,t,r)=>{var i;const n=(i=e==null?void 0:e.team_id)==null?void 0:i.from;return`Removed team ${n?r.get(n)??n:"a team"}`}},status_updated:{icon:E5,color:"text-violet-500",bg:"bg-violet-50 dark:bg-violet-950/40",label:e=>{var n,s;const t=(n=e==null?void 0:e.name)==null?void 0:n.from,r=(s=e==null?void 0:e.name)==null?void 0:s.to;return t&&r?`Renamed status "${t}" to "${r}"`:"Updated status"}},status_deleted:{icon:Mr,color:"text-red-500",bg:"bg-red-50 dark:bg-red-950/40",label:e=>{var r;const t=(r=e==null?void 0:e.name)==null?void 0:r.from;return t?`Deleted status "${t}"`:"Deleted status"}},updated:{icon:si,color:"text-amber-500",bg:"bg-amber-50 dark:bg-amber-950/40",label:()=>"Updated project"},created:{icon:dt,color:"text-emerald-600",bg:"bg-emerald-50 dark:bg-emerald-950/40",label:()=>"Created project"}},vZ={icon:$u,color:"text-zinc-500",bg:"bg-zinc-100 dark:bg-zinc-800",label:()=>"Activity"};function yZ({activity:e,userMap:t,teamMap:r}){const n=gZ[e.action]??vZ,s=n.icon,i=t.get(e.actor_id),o=(i==null?void 0:i.name)??"System",l=(i==null?void 0:i.initials)??"S",c=n.label(e.changes,t,r),d=(()=>{var u,f;if(e.action==="share_enabled"){const m=(f=(u=e.changes)==null?void 0:u.share_url)==null?void 0:f.to;return m?a.jsx("span",{className:"text-xs text-muted-foreground/60 font-mono break-all",children:m}):null}return null})();return a.jsxs("div",{className:"flex items-start md:items-center gap-3 md:gap-4 px-4 md:px-6 py-4 hover:bg-muted/30 transition-colors",children:[a.jsx("div",{className:z("h-8 w-8 rounded-full flex items-center justify-center shrink-0",n.bg),children:a.jsx(s,{className:z("h-4 w-4",n.color)})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex flex-wrap md:flex-nowrap items-center gap-x-2 gap-y-0.5",children:[a.jsx(Rt,{className:"h-5 w-5 shrink-0",children:a.jsx($t,{className:"text-[10px] font-medium",children:l})}),a.jsx("span",{className:"text-sm font-medium truncate",children:o}),a.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:c})]}),a.jsx("time",{className:"md:hidden text-[11px] text-muted-foreground/70 mt-1 block",children:fe(new Date(e.created_at),"MMM d, yyyy · h:mm a")}),d&&a.jsx("div",{className:"mt-0.5 pl-7",children:d})]}),a.jsx("time",{className:"hidden md:block text-xs text-muted-foreground shrink-0",children:fe(new Date(e.created_at),"MMM d, yyyy · h:mm a")})]})}function bZ(){const{projectKey:e}=zt(),{workspace:t}=Ie(),{data:r}=Wa(e??""),{data:n,isLoading:s}=PD((r==null?void 0:r.id)??""),{data:i=new Map}=ks(),{data:o=[]}=Fu((t==null?void 0:t.id)??""),l=new Map(o.map(d=>[d.id,d.name])),c=(n==null?void 0:n.length)??0;return a.jsx("div",{className:"p-2 pb-24 md:pb-2",children:a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-border",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold",children:"Activity"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"A log of share access changes, member updates, and project edits."})]}),!s&&c>0&&a.jsxs("p",{className:"text-xs text-muted-foreground shrink-0",children:[c," event",c!==1?"s":""]})]}),a.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/20",children:a.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Log"})}),s?a.jsx("div",{className:"divide-y divide-border",children:[1,2,3].map(d=>a.jsxs("div",{className:"flex items-center gap-4 px-6 py-4",children:[a.jsx(le,{className:"h-8 w-8 rounded-full shrink-0"}),a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsx(le,{className:"h-4 w-48"}),a.jsx(le,{className:"h-3 w-64"})]}),a.jsx(le,{className:"h-3 w-32 shrink-0"})]},d))}):!n||n.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[a.jsx($u,{className:"h-8 w-8 text-muted-foreground/20 mb-3"}),a.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"No activity yet"}),a.jsx("p",{className:"text-xs text-muted-foreground/60 mt-1",children:"Actions like sharing the project or adding members will appear here."})]}):a.jsx("div",{className:"divide-y divide-border",children:n.map(d=>a.jsx(yZ,{activity:d,userMap:i,teamMap:l},d.id))})]})})}function bO(){return Be({queryKey:["me"],queryFn:()=>oe.get("/admin/users/me")})}function wZ(){const e=Se(),{updateLocalUser:t}=Ie();return be({mutationFn:r=>oe.patch("/admin/users/me",r),onSuccess:({user:r})=>{t({first_name:r.first_name??"",last_name:r.last_name??"",designation:r.designation,phone_number:r.phone_number}),e.invalidateQueries({queryKey:["me"]})}})}function jZ(){const e=Se(),{updateLocalUser:t}=Ie();return be({mutationFn:r=>{const n=new FormData;return n.append("avatar",r),oe.upload("/admin/users/me/avatar",n)},onSuccess:({user:r})=>{t({avatar_url:r.avatar_url}),e.invalidateQueries({queryKey:["me"]})}})}function NZ(){const e=Se(),{updateLocalUser:t}=Ie();return be({mutationFn:()=>oe.delete("/admin/users/me/avatar"),onSuccess:()=>{t({avatar_url:null}),e.invalidateQueries({queryKey:["me"]})}})}function kZ(){return be({mutationFn:()=>oe.post("/admin/users/me/password/send-otp",{})})}function SZ(){const e=Se();return be({mutationFn:t=>oe.post("/admin/users/me/password",t),onSuccess:()=>{e.invalidateQueries({queryKey:["me"]})}})}function CZ(){const e=Se();return be({mutationFn:()=>oe.delete("/admin/users/me/google"),onSuccess:()=>{e.invalidateQueries({queryKey:["me"]})}})}const _Z=[{key:"mon",label:"Monday",short:"Mon"},{key:"tue",label:"Tuesday",short:"Tue"},{key:"wed",label:"Wednesday",short:"Wed"},{key:"thu",label:"Thursday",short:"Thu"},{key:"fri",label:"Friday",short:"Fri"},{key:"sat",label:"Saturday",short:"Sat"},{key:"sun",label:"Sunday",short:"Sun"}],MZ={mon:!0,tue:!0,wed:!0,thu:!0,fri:!0,sat:!1,sun:!1};function OZ({open:e,onClose:t,holiday:r}){const[n,s]=h.useState((r==null?void 0:r.name)??""),[i,o]=h.useState(r!=null&&r.date?r.date.split("T")[0]:""),[l,c]=h.useState((r==null?void 0:r.recurring)??!1);h.useEffect(()=>{e&&(s((r==null?void 0:r.name)??""),o(r!=null&&r.date?r.date.split("T")[0]:""),c((r==null?void 0:r.recurring)??!1))},[e,r==null?void 0:r.id]);const d=h4(),u=p4(),f=d.isPending||u.isPending,m=p=>{if(p.preventDefault(),!n.trim()){H.error("Holiday name is required");return}if(!i){H.error("Date is required");return}r?u.mutate({id:r.id,name:n.trim(),date:i,recurring:l},{onSuccess:()=>{H.success("Holiday updated"),t()},onError:()=>H.error("Failed to update holiday")}):d.mutate({name:n.trim(),date:i,recurring:l},{onSuccess:()=>{H.success("Holiday added"),t()},onError:()=>H.error("Failed to add holiday")})};return a.jsx(Ua,{open:e,onOpenChange:p=>!p&&t(),children:a.jsxs(ca,{className:"sm:max-w-md",children:[a.jsxs(qa,{children:[a.jsx(Ha,{children:r?"Edit holiday":"Add holiday"}),a.jsx(yo,{children:"Holidays are excluded from business day calculations across the app."})]}),a.jsxs("form",{onSubmit:m,className:"space-y-4 pt-1",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Name"}),a.jsx(Ee,{value:n,onChange:p=>s(p.target.value),placeholder:"e.g. New Year's Day",className:"h-9",autoFocus:!0,required:!0})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Date"}),a.jsx(Ee,{type:"date",value:i,onChange:p=>o(p.target.value),className:"h-9",required:!0})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Co,{checked:l,onCheckedChange:p=>c(p)}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"Recurring annually (applies every year on the same date)"})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[a.jsx(ne,{type:"button",variant:"outline",size:"sm",onClick:t,children:"Cancel"}),a.jsx(ne,{type:"submit",size:"sm",disabled:f,children:f?r?"Saving…":"Adding…":r?"Save changes":"Add holiday"})]})]})]})})}function PZ(){const{data:e,isLoading:t}=Sx(),r=m4(),n=(e==null?void 0:e.working_days)??MZ,s=(i,o)=>{const l={...n,[i]:o};r.mutate({working_days:l},{onSuccess:()=>H.success("Working days updated"),onError:()=>H.error("Failed to update working days")})};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/20 min-h-[45px] flex items-center",children:a.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Working days"})}),a.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/10",children:a.jsx("p",{className:"text-xs text-muted-foreground",children:"Configure which days count as business days. This affects duration calculations across the app."})}),t?a.jsx("div",{className:"px-6 py-4 space-y-3",children:[1,2,3,4,5,6,7].map(i=>a.jsx(le,{className:"h-8 w-full"},i))}):_Z.map(({key:i,label:o})=>{const l=n[i];return a.jsxs("div",{className:"grid grid-cols-[180px_1fr_auto] items-center gap-4 px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:o}),a.jsx("span",{className:z("text-xs font-medium",l?"text-foreground":"text-muted-foreground/60"),children:l?"Working day":"Not a working day"}),a.jsx(Co,{checked:l,onCheckedChange:c=>s(i,c),disabled:r.isPending})]},i)})]})}function EZ(){const[e,t]=h.useState(new Date().getFullYear()),[r,n]=h.useState(!1),[s,i]=h.useState(null),[o,l]=h.useState(null),{data:c=[],isLoading:d}=Cx(e),u=x4(),f=()=>{o&&u.mutate(o.id,{onSuccess:()=>{H.success("Holiday removed"),l(null)},onError:()=>H.error("Failed to remove holiday")})},m=[...c].sort((p,x)=>{const g=new Date(p.date).getMonth()*100+new Date(p.date).getDate(),v=new Date(x.date).getMonth()*100+new Date(x.date).getDate();return g-v});return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-2 border-b border-border bg-muted/20",children:[a.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Holidays"}),a.jsxs(ne,{size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>{i(null),n(!0)},children:[a.jsx(dt,{className:"h-3.5 w-3.5"}),"Add holiday"]})]}),a.jsxs("div",{className:"flex items-center gap-1 px-6 py-3 border-b border-border bg-muted/10",children:[a.jsxs("p",{className:"text-xs text-muted-foreground flex-1",children:["Showing holidays for"," ",a.jsx("span",{className:"font-medium text-foreground",children:e}),". Recurring holidays appear every year."]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>t(p=>p-1),className:"h-6 w-6 flex items-center justify-center rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",children:a.jsx(_a,{className:"h-3.5 w-3.5"})}),a.jsx("span",{className:"text-xs font-medium tabular-nums w-10 text-center",children:e}),a.jsx("button",{onClick:()=>t(p=>p+1),className:"h-6 w-6 flex items-center justify-center rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",children:a.jsx(vr,{className:"h-3.5 w-3.5"})})]})]}),a.jsxs("div",{className:"hidden md:grid grid-cols-[160px_1fr_120px_40px] gap-4 px-6 py-2 border-b border-border bg-muted/20",children:[a.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide",children:"Date"}),a.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide",children:"Name"}),a.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide",children:"Recurrence"}),a.jsx("span",{})]}),d?a.jsx("div",{className:"px-6 py-4 space-y-3",children:[1,2,3].map(p=>a.jsx(le,{className:"h-8 w-full"},p))}):m.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-6 text-center",children:[a.jsx(R1,{className:"h-8 w-8 text-muted-foreground/40 mb-3"}),a.jsxs("p",{className:"text-sm font-medium mb-1",children:["No holidays for ",e]}),a.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Add a holiday or use the year navigation to view other years."}),a.jsxs(ne,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1.5",onClick:()=>{i(null),n(!0)},children:[a.jsx(dt,{className:"h-3.5 w-3.5"}),"Add holiday"]})]}):m.map(p=>{const x=new Date(p.date),g=a.jsxs(Kr,{children:[a.jsx(Yr,{asChild:!0,children:a.jsx("button",{className:"h-6 w-6 flex items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:a.jsx(Ma,{className:"h-3.5 w-3.5"})})}),a.jsxs(Or,{align:"end",className:"w-36",children:[a.jsxs(at,{className:"gap-2 cursor-pointer",onClick:()=>{i(p),n(!0)},children:[a.jsx(si,{className:"h-3.5 w-3.5"}),"Edit"]}),a.jsxs(at,{className:"gap-2 cursor-pointer text-destructive focus:text-destructive",onClick:()=>l(p),children:[a.jsx(Mr,{className:"h-3.5 w-3.5"}),"Remove"]})]})]});return a.jsxs("div",{children:[a.jsxs("div",{className:"hidden md:grid grid-cols-[160px_1fr_120px_40px] gap-4 items-center px-6 py-3.5 border-b border-border hover:bg-muted/20 transition-colors",children:[a.jsx("span",{className:"text-sm tabular-nums text-muted-foreground",children:fe(x,"MMM d, yyyy")}),a.jsx("span",{className:"text-sm font-medium truncate",children:p.name}),a.jsx("span",{className:"text-sm",children:p.recurring?a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[a.jsx(Vi,{className:"h-3 w-3"}),"Every year"]}):a.jsx("span",{className:"text-xs text-muted-foreground/60",children:"One-time"})}),a.jsx("div",{className:"flex justify-end",children:g})]}),a.jsxs("div",{className:"md:hidden flex items-center gap-3 px-4 py-3 border-b border-border hover:bg-muted/20 transition-colors",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium truncate",children:p.name}),a.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[a.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:fe(x,"MMM d, yyyy")}),p.recurring&&a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[a.jsx(Vi,{className:"h-3 w-3"}),"Recurring"]})]})]}),g]})]},p.id)}),a.jsx(OZ,{open:r,onClose:()=>{n(!1),i(null)},holiday:s}),a.jsx(Zs,{open:!!o,onOpenChange:p=>!p&&l(null),children:a.jsxs(ds,{children:[a.jsxs(us,{children:[a.jsxs(ms,{children:['Remove "',o==null?void 0:o.name,'"?']}),a.jsx(hs,{children:"This holiday will no longer be excluded from business day calculations."})]}),a.jsxs(fs,{children:[a.jsx(xs,{children:"Cancel"}),a.jsx(ps,{onClick:f,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]})})]})}const bj=["super-admin","admin","member"],uh={"super-admin":"bg-purple-100 text-purple-700 dark:bg-purple-900/40 dark:text-purple-300",admin:"bg-indigo-100 text-indigo-700 dark:bg-indigo-900/40 dark:text-indigo-300",member:"bg-zinc-100 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-300"},ud={pending:"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",accepted:"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-300",revoked:"bg-zinc-100 text-zinc-500 dark:bg-zinc-800 dark:text-zinc-400"};function wj({value:e}){const[t,r]=h.useState(!1),n=()=>{navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1500)};return a.jsx("button",{onClick:n,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0",title:"Copy",children:t?a.jsx(dr,{className:"h-3.5 w-3.5 text-emerald-500"}):a.jsx(ex,{className:"h-3.5 w-3.5"})})}const fh={"super-admin":3,admin:2,moderator:1,member:0},zr=20;function AZ(){const{data:e}=bO(),t=fh[(e==null?void 0:e.role)??"member"]??0,[r,n]=h.useState(""),[s,i]=h.useState(""),[o,l]=h.useState(0),[c,d]=h.useState(0);h.useEffect(()=>{const $=setTimeout(()=>{i(r.trim()),l(0),d(0)},400);return()=>clearTimeout($)},[r]);const{data:u,isLoading:f}=qN({limit:zr,offset:o*zr,q:s}),m=(u==null?void 0:u.users)??[],p=(u==null?void 0:u.count)??0,{data:x,isLoading:g}=YI({limit:zr,offset:c*zr,q:s}),v=(x==null?void 0:x.invitations)??[],y=(x==null?void 0:x.count)??0,{data:j=[]}=df(),N=eS(),w=QI(),k=ZI(),b=JI(),C=GI(),_=VI(),S=XI(),[I,A]=h.useState(null),[O,L]=h.useState(null),[F,X]=h.useState(null),[T,G]=h.useState(!1),[re,J]=h.useState(""),[P,M]=h.useState("member"),R=$=>{$.preventDefault(),re.trim()&&S.mutate({email:re.trim().toLowerCase(),role:P},{onSuccess:()=>{H.success(`Invitation sent to ${re.trim()}`),G(!1),J(""),M("member")},onError:K=>H.error((K==null?void 0:K.message)??"Failed to send invitation")})},q=()=>{I&&k.mutate(I,{onSuccess:()=>{H.success("User deactivated"),A(null)},onError:()=>H.error("Failed to deactivate user")})};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-2 border-b border-border bg-muted/20",children:[a.jsxs("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide flex items-center gap-2",children:["All users",!f&&a.jsx(En,{variant:"secondary",className:"h-5 min-w-[20px] px-1.5 text-[11px] font-medium rounded-full",children:p})]}),a.jsxs(ne,{size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>G(!0),children:[a.jsx(dt,{className:"h-3.5 w-3.5"}),"Invite member"]})]}),a.jsxs("div",{className:"px-6 py-2 border-b border-border bg-muted/10 flex items-center gap-3",children:[a.jsx("p",{className:"text-xs text-muted-foreground flex-1",children:"View and manage all platform users. Change a user's custom role or remove them from the system."}),a.jsx(Ee,{value:r,onChange:$=>n($.target.value),placeholder:"Search by email or name…",className:"h-8 text-xs w-56 shrink-0"})]}),a.jsx(Ua,{open:T,onOpenChange:$=>{$||(G(!1),J(""),M("member"))},children:a.jsxs(ca,{className:"sm:max-w-md",children:[a.jsx(qa,{children:a.jsx(Ha,{children:"Invite member"})}),a.jsxs("form",{onSubmit:R,className:"space-y-4 pt-1",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Email"}),a.jsx(Ee,{type:"email",value:re,onChange:$=>J($.target.value),placeholder:"name@example.com",className:"h-9",autoFocus:!0,required:!0})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Role"}),a.jsxs(Le,{value:P,onValueChange:M,children:[a.jsx($e,{className:"h-9 text-sm",children:a.jsx(qe,{})}),a.jsx(ze,{children:bj.map($=>a.jsx(we,{value:$,className:"text-sm capitalize",children:$},$))})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"The user will receive an invite link to create their account. They won't be added to any workspace automatically — you can add them from workspace settings after they join."}),a.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[a.jsx(ne,{type:"button",variant:"outline",size:"sm",onClick:()=>G(!1),children:"Cancel"}),a.jsx(ne,{type:"submit",size:"sm",disabled:S.isPending,children:S.isPending?"Sending…":"Send invite"})]})]})]})}),a.jsxs("div",{className:"hidden md:grid grid-cols-[1fr_160px_200px_40px] gap-4 px-6 py-2 border-b border-border bg-muted/20",children:[a.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide",children:"User"}),a.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide",children:"Global role"}),a.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide",children:"Custom role"}),a.jsx("span",{})]}),f?a.jsx("div",{className:"px-6 py-4 space-y-3",children:[1,2,3].map($=>a.jsx(le,{className:"h-10 w-full"},$))}):m.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[a.jsx(ba,{className:"h-8 w-8 text-muted-foreground/40 mb-3"}),a.jsx("p",{className:"text-sm font-medium",children:s?"No users match your search":"No users found"}),s&&a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Try a different search term."})]}):a.jsxs(a.Fragment,{children:[m.map($=>{var pe;const K=$.first_name??"",D=$.last_name??"",E=`${K} ${D}`.trim()||$.email,Z=(K[0]??D[0]??((pe=$.email)==null?void 0:pe[0])??"U").toUpperCase(),B=fh[$.role??"member"]??0,Y=$.id===(e==null?void 0:e.id),ae=!Y&&B<t,ee=ae?a.jsxs(Le,{value:$.role??"member",onValueChange:ue=>w.mutate({userId:$.id,role:ue},{onSuccess:()=>H.success("Global role updated"),onError:ve=>H.error((ve==null?void 0:ve.message)??"Failed to update global role")}),children:[a.jsx($e,{className:"h-7 text-xs w-full",children:a.jsx(qe,{})}),a.jsx(ze,{children:bj.filter(ue=>(fh[ue]??0)<=t).map(ue=>a.jsx(we,{value:ue,className:"text-xs",children:a.jsx("span",{className:z("inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium",uh[ue]),children:ue})},ue))})]}):a.jsx("span",{className:z("inline-flex items-center px-2 py-0.5 rounded text-xs font-medium",uh[$.role??"member"]??uh.member),children:$.role??"member"}),se=a.jsxs(Le,{value:$.app_role_id??"none",disabled:!ae,onValueChange:ue=>N.mutate({userId:$.id,appRoleId:ue==="none"?null:ue},{onSuccess:()=>H.success("Custom role updated"),onError:()=>H.error("Failed to update custom role")}),children:[a.jsx($e,{className:z("h-7 text-xs w-full",!ae&&"opacity-60 cursor-not-allowed"),children:a.jsx(qe,{placeholder:"No role"})}),a.jsxs(ze,{children:[a.jsx(we,{value:"none",className:"text-xs",children:"No role"}),j.map(ue=>a.jsx(we,{value:ue.id,className:"text-xs",children:ue.name},ue.id))]})]}),V=$.is_active!==!1,ie=ae?a.jsxs(Kr,{children:[a.jsx(Yr,{asChild:!0,children:a.jsx("button",{className:"h-6 w-6 flex items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:a.jsx(Ma,{className:"h-3.5 w-3.5"})})}),a.jsx(Or,{align:"end",className:"w-40",children:V?a.jsxs(at,{className:"gap-2 cursor-pointer text-destructive focus:text-destructive",onClick:()=>A($.id),children:[a.jsx(G1,{className:"h-3.5 w-3.5"}),"Deactivate user"]}):a.jsxs(at,{className:"gap-2 cursor-pointer",onClick:()=>{b.mutate($.id,{onSuccess:()=>H.success("User reactivated"),onError:()=>H.error("Failed to reactivate user")})},children:[a.jsx(z5,{className:"h-3.5 w-3.5"}),"Reactivate user"]})})]}):null;return a.jsxs("div",{className:"border-b border-border hover:bg-muted/20 transition-colors group",children:[a.jsxs("div",{className:"hidden md:grid grid-cols-[1fr_160px_200px_40px] gap-4 items-center px-6 py-3",children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[a.jsx("div",{className:"h-7 w-7 rounded-full bg-zinc-200 dark:bg-zinc-700 flex items-center justify-center text-xs font-semibold text-zinc-600 dark:text-zinc-300 shrink-0",children:Z}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("p",{className:"text-sm font-medium truncate",children:[E,Y&&a.jsx("span",{className:"text-xs text-muted-foreground ml-1.5",children:"(you)"}),!V&&a.jsx("span",{className:"ml-1.5 inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",children:"Deactivated"})]}),a.jsx("p",{className:"text-xs text-muted-foreground truncate",children:$.email})]})]}),ee,se,a.jsx("div",{className:"flex justify-end opacity-0 group-hover:opacity-100 transition-opacity",children:ie})]}),a.jsxs("div",{className:"md:hidden px-4 py-3",children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0 mb-2",children:[a.jsx("div",{className:"h-7 w-7 rounded-full bg-zinc-200 dark:bg-zinc-700 flex items-center justify-center text-xs font-semibold text-zinc-600 dark:text-zinc-300 shrink-0",children:Z}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("p",{className:"text-sm font-medium truncate",children:[E,Y&&a.jsx("span",{className:"text-xs text-muted-foreground ml-1.5",children:"(you)"}),!V&&a.jsx("span",{className:"ml-1.5 inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",children:"Deactivated"})]}),a.jsx("p",{className:"text-xs text-muted-foreground truncate",children:$.email})]}),ie]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"flex-1",children:ee}),a.jsx("div",{className:"flex-1",children:se})]})]})]},$.id)}),p>zr&&a.jsxs("div",{className:"flex items-center justify-between px-4 md:px-6 py-3 border-t border-border",children:[a.jsxs("span",{className:"text-xs text-muted-foreground",children:[o*zr+1,"–",Math.min((o+1)*zr,p)," of ",p]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(ne,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>l($=>$-1),disabled:o===0,children:a.jsx(_a,{className:"h-3.5 w-3.5"})}),a.jsxs("span",{className:"text-xs text-muted-foreground tabular-nums w-12 text-center",children:[o+1," / ",Math.ceil(p/zr)]}),a.jsx(ne,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>l($=>$+1),disabled:(o+1)*zr>=p,children:a.jsx(vr,{className:"h-3.5 w-3.5"})})]})]})]}),a.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/20 mt-2",children:a.jsxs("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide flex items-center gap-2",children:["Invitations",!g&&y>0&&a.jsx(En,{variant:"secondary",className:"h-5 min-w-[20px] px-1.5 text-[11px] font-medium rounded-full bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400",children:y})]})}),g?a.jsx("div",{className:"px-6 py-4 space-y-3",children:[1,2,3].map($=>a.jsx(le,{className:"h-8 w-full"},$))}):v.length===0?a.jsx("div",{className:"px-6 py-6 text-center",children:a.jsx("p",{className:"text-xs text-muted-foreground",children:s?"No invitations match your search.":"No pending invitations."})}):v.map($=>{const K=`${window.location.origin}/invite/${$.token}`;return a.jsxs("div",{className:"px-6 py-3.5 border-b border-border hover:bg-muted/20 transition-colors group",children:[a.jsxs("div",{className:"hidden md:flex items-center gap-3",children:[a.jsx("div",{className:"h-7 w-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:a.jsx(ai,{className:"h-3.5 w-3.5 text-muted-foreground"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("p",{className:"text-sm font-medium truncate",children:$.email??"Shareable link"}),a.jsx("span",{className:z("inline-flex items-center text-[11px] px-1.5 py-0.5 rounded font-medium",$.role==="super-admin"?"bg-purple-50 text-purple-700 dark:bg-purple-950/30 dark:text-purple-300":$.role==="admin"?"bg-indigo-100 text-indigo-700 dark:bg-indigo-900/30 dark:text-indigo-300":"bg-muted text-muted-foreground"),children:$.role==="super-admin"?"Super Admin":$.role==="admin"?"Admin":"Member"}),$.workspace_name&&a.jsxs("span",{className:"text-[11px] text-muted-foreground truncate",children:["· ",$.workspace_name]})]}),a.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[a.jsx("span",{className:"text-xs font-mono text-muted-foreground truncate max-w-[320px]",children:K}),a.jsx(wj,{value:K})]})]}),a.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[a.jsx("span",{className:z("inline-flex items-center px-2 py-0.5 rounded text-[11px] font-medium",ud[$.status]??ud.revoked),children:$.status}),a.jsx("span",{className:"text-xs text-muted-foreground",children:fe(new Date($.created_at),"MMM d")}),$.status==="pending"&&$.email&&a.jsxs(Qn,{children:[a.jsx(Zn,{asChild:!0,children:a.jsx("button",{onClick:()=>X($),disabled:_.isPending,className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-foreground disabled:opacity-50",children:a.jsx(Cd,{className:z("h-3.5 w-3.5",_.isPending&&"animate-spin")})})}),a.jsx(_n,{children:"Resend invite"})]}),$.status==="pending"&&a.jsx("button",{onClick:()=>L($),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",title:"Revoke invitation",children:a.jsx(tt,{className:"h-3.5 w-3.5"})})]})]}),a.jsxs("div",{className:"md:hidden space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"h-7 w-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:a.jsx(ai,{className:"h-3.5 w-3.5 text-muted-foreground"})}),a.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[a.jsx("p",{className:"text-sm font-medium truncate",children:$.email??"Shareable link"}),a.jsx("span",{className:z("inline-flex items-center text-[11px] px-1.5 py-0.5 rounded font-medium shrink-0",$.role==="super-admin"?"bg-purple-50 text-purple-700 dark:bg-purple-950/30 dark:text-purple-300":$.role==="admin"?"bg-indigo-100 text-indigo-700 dark:bg-indigo-900/30 dark:text-indigo-300":"bg-muted text-muted-foreground"),children:$.role==="super-admin"?"Super Admin":$.role==="admin"?"Admin":"Member"})]}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[a.jsx("span",{className:z("inline-flex items-center px-2 py-0.5 rounded text-[11px] font-medium",ud[$.status]??ud.revoked),children:$.status}),$.status==="pending"&&$.email&&a.jsx("button",{onClick:()=>X($),disabled:_.isPending,className:"text-muted-foreground hover:text-foreground disabled:opacity-50",children:a.jsx(Cd,{className:z("h-3.5 w-3.5",_.isPending&&"animate-spin")})}),$.status==="pending"&&a.jsx("button",{onClick:()=>L($),className:"text-muted-foreground hover:text-destructive",title:"Revoke invitation",children:a.jsx(tt,{className:"h-3.5 w-3.5"})})]})]}),a.jsxs("div",{className:"flex items-center gap-2 pl-10",children:[a.jsx("span",{className:"text-xs font-mono text-muted-foreground truncate flex-1 min-w-0",children:K}),a.jsx(wj,{value:K}),$.workspace_name&&a.jsx("span",{className:"text-[11px] text-muted-foreground truncate shrink-0 max-w-[80px]",children:$.workspace_name}),a.jsx("span",{className:"text-[11px] text-muted-foreground shrink-0",children:fe(new Date($.created_at),"MMM d")})]})]})]},$.id)}),y>zr&&a.jsxs("div",{className:"flex items-center justify-between px-4 md:px-6 py-3 border-t border-border",children:[a.jsxs("span",{className:"text-xs text-muted-foreground",children:[c*zr+1,"–",Math.min((c+1)*zr,y)," of ",y]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(ne,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>d($=>$-1),disabled:c===0,children:a.jsx(_a,{className:"h-3.5 w-3.5"})}),a.jsxs("span",{className:"text-xs text-muted-foreground tabular-nums w-12 text-center",children:[c+1," / ",Math.ceil(y/zr)]}),a.jsx(ne,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>d($=>$+1),disabled:(c+1)*zr>=y,children:a.jsx(vr,{className:"h-3.5 w-3.5"})})]})]}),a.jsx(Zs,{open:!!I,onOpenChange:$=>!$&&A(null),children:a.jsxs(ds,{children:[a.jsxs(us,{children:[a.jsx(ms,{children:"Deactivate this user?"}),a.jsx(hs,{children:"The user will lose access immediately and be hidden from member lists. You can reactivate them later."})]}),a.jsxs(fs,{children:[a.jsx(xs,{children:"Cancel"}),a.jsx(ps,{onClick:q,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Deactivate"})]})]})}),a.jsx(Zs,{open:!!O,onOpenChange:$=>!$&&L(null),children:a.jsxs(ds,{children:[a.jsxs(us,{children:[a.jsx(ms,{children:"Revoke this invitation?"}),a.jsxs(hs,{children:["The invite link sent to ",a.jsx("span",{className:"font-medium",children:O==null?void 0:O.email})," will no longer work."]})]}),a.jsxs(fs,{children:[a.jsx(xs,{children:"Cancel"}),a.jsx(ps,{onClick:()=>{O&&C.mutate(O.id,{onSuccess:()=>{H.success("Invitation revoked"),L(null)},onError:()=>H.error("Failed to revoke invitation")})},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Revoke"})]})]})}),a.jsx(Zs,{open:!!F,onOpenChange:$=>!$&&X(null),children:a.jsxs(ds,{children:[a.jsxs(us,{children:[a.jsx(ms,{children:"Resend invitation?"}),a.jsxs(hs,{children:["A new invitation email will be sent to ",a.jsx("span",{className:"font-medium",children:F==null?void 0:F.email}),"."]})]}),a.jsxs(fs,{children:[a.jsx(xs,{children:"Cancel"}),a.jsx(ps,{onClick:()=>{F&&_.mutate(F.id,{onSuccess:()=>{H.success("Invitation resent"),X(null)},onError:()=>H.error("Failed to resend invitation")})},children:"Resend"})]})]})})]})}const DZ=["working-days","holidays","members"];function TZ(){const[e,t]=Gl(),r=e.get("tab"),n=r&&DZ.includes(r)?r:"working-days",s=o=>t({tab:o},{replace:!0}),i=[{id:"working-days",label:"Working Days"},{id:"holidays",label:"Holidays"},{id:"members",label:"Members"}];return a.jsx("div",{className:"p-2 md:pb-2 h-full",children:a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden flex flex-col h-full",children:[a.jsx("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border shrink-0",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(R1,{className:"h-5 w-5 text-muted-foreground"}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-base font-semibold",children:"Organization Settings"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Global configuration that applies across the entire Meridian deployment."})]})]})}),a.jsx("div",{className:"flex border-b border-border shrink-0 px-6",children:i.map(o=>a.jsx("button",{onClick:()=>s(o.id),className:z("px-1 py-3 mr-6 text-sm font-medium border-b-2 transition-colors",n===o.id?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:o.label},o.id))}),a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[n==="working-days"&&a.jsx(PZ,{}),n==="holidays"&&a.jsx(EZ,{}),n==="members"&&a.jsx(AZ,{})]})]})})}const mh=e=>{let{transform:t}=e;return{...t,y:0}};function Nv(){const[e,t]=h.useState({x:0,y:0,elementX:0,elementY:0,elementPositionX:0,elementPositionY:0}),r=h.useRef(null);return h.useLayoutEffect(()=>{const n=s=>{var o;let i={x:s.pageX,y:s.pageY};if(((o=r.current)==null?void 0:o.nodeType)===Node.ELEMENT_NODE){const{left:l,top:c}=r.current.getBoundingClientRect(),d=l+window.scrollX,u=c+window.scrollY,f=s.pageX-d,m=s.pageY-u;i.elementX=f,i.elementY=m,i.elementPositionX=d,i.elementPositionY=u}t(l=>({...l,...i}))};return document.addEventListener("mousemove",n),()=>{document.removeEventListener("mousemove",n)}},[]),[e,r]}function IZ(e,t=500){const[r,n]=h.useState(e),s=h.useRef(null);return h.useEffect(()=>{const i=Date.now();if(s.current&&i>=s.current+t)s.current=i,n(e);else{const o=window.setTimeout(()=>{s.current=i,n(e)},t);return()=>window.clearTimeout(o)}},[e,t]),r}function RZ(){const[e,t]=h.useState({x:null,y:null}),r=h.useCallback((...n)=>{if(typeof n[0]=="object")window.scrollTo(n[0]);else if(typeof n[0]=="number"&&typeof n[1]=="number")window.scrollTo(n[0],n[1]);else throw new Error("Invalid arguments passed to scrollTo. See here for more info. https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo")},[]);return h.useLayoutEffect(()=>{const n=()=>{t({x:window.scrollX,y:window.scrollY})};return n(),window.addEventListener("scroll",n),()=>{window.removeEventListener("scroll",n)}},[]),[e,r]}const Kn={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};function wO(e){return"init"in e}function Ip(e){return!!e.write}function jj(e){return"v"in e||"e"in e}function Ou(e){if("e"in e)throw e.e;if((Kn?"production":void 0)!=="production"&&!("v"in e))throw new Error("[Bug] atom state is not initialized");return e.v}function Pu(e){return typeof(e==null?void 0:e.then)=="function"}function jO(e,t,r){if(!r.p.has(e)){r.p.add(e);const n=()=>r.p.delete(e);t.then(n,n)}}function NO(e,t,r){var n;const s=new Set;for(const i of((n=r.get(e))==null?void 0:n.t)||[])s.add(i);for(const i of t.p)s.add(i);return s}const $Z=(e,t,...r)=>t.read(...r),zZ=(e,t,...r)=>t.write(...r),LZ=(e,t)=>{var r;return(r=t.INTERNAL_onInit)==null?void 0:r.call(t,e)},FZ=(e,t,r)=>{var n;return(n=t.onMount)==null?void 0:n.call(t,r)},BZ=(e,t)=>{var r;const n=Ut(e),s=n[0],i=n[6],o=n[9];if((Kn?"production":void 0)!=="production"&&!t)throw new Error("Atom is undefined or null");let l=s.get(t);return l||(l={d:new Map,p:new Set,n:0},s.set(t,l),(r=i.i)==null||r.call(i,t),o==null||o(e,t)),l},WZ=e=>{const t=Ut(e),r=t[1],n=t[3],s=t[4],i=t[5],o=t[6],l=t[13],c=[],d=u=>{try{u()}catch(f){c.push(f)}};do{o.f&&d(o.f);const u=new Set,f=u.add.bind(u);n.forEach(m=>{var p;return(p=r.get(m))==null?void 0:p.l.forEach(f)}),n.clear(),i.forEach(f),i.clear(),s.forEach(f),s.clear(),u.forEach(d),n.size&&l(e)}while(n.size||i.size||s.size);if(c.length)throw new AggregateError(c)},UZ=e=>{const t=Ut(e),r=t[1],n=t[2],s=t[3],i=t[11],o=t[14],l=t[17],c=[],d=new WeakSet,u=new WeakSet,f=Array.from(s);for(;f.length;){const m=f[f.length-1],p=i(e,m);if(u.has(m)){f.pop();continue}if(d.has(m)){if(n.get(m)===p.n)c.push([m,p]);else if((Kn?"production":void 0)!=="production"&&n.has(m))throw new Error("[Bug] invalidated atom exists");u.add(m),f.pop();continue}d.add(m);for(const x of NO(m,p,r))d.has(x)||f.push(x)}for(let m=c.length-1;m>=0;--m){const[p,x]=c[m];let g=!1;for(const v of x.d.keys())if(v!==p&&s.has(v)){g=!0;break}g&&(o(e,p),l(e,p)),n.delete(p)}},Rp=new WeakSet,qZ=(e,t)=>{var r,n;const s=Ut(e),i=s[1],o=s[2],l=s[3],c=s[6],d=s[7],u=s[11],f=s[12],m=s[13],p=s[14],x=s[16],g=s[17],v=s[20],y=s[26],j=u(e,t);if(jj(j)){if(i.has(t)&&o.get(t)!==j.n)return j;let L=!1;for(const[F,X]of j.d)if(p(e,F).n!==X){L=!0;break}if(!L)return j}let N=!0;const w=new Set(j.d.keys()),k=new Map,b=()=>{for(const L of w)k.has(L)||j.d.delete(L)},C=()=>{if(i.has(t)){const L=!l.size;g(e,t),L&&(m(e),f(e))}},_=L=>{var F;if(L===t){const T=u(e,L);if(!jj(T))if(wO(L))v(e,L,L.init);else throw new Error("no atom init");return Ou(T)}const X=p(e,L);try{return Ou(X)}finally{k.set(L,X.n),j.d.set(L,X.n),Pu(j.v)&&jO(t,j.v,X),i.has(t)&&((F=i.get(L))==null||F.t.add(t)),N||C()}};let S,I;const A={get signal(){return S||(S=new AbortController),S.signal},get setSelf(){return(Kn?"production":void 0)!=="production"&&console.warn("[DEPRECATED] setSelf is deprecated and will be removed in v3."),(Kn?"production":void 0)!=="production"&&!Ip(t)&&console.warn("setSelf function cannot be used with read-only atom"),!I&&Ip(t)&&(I=(...L)=>{if((Kn?"production":void 0)!=="production"&&N&&console.warn("setSelf function cannot be called in sync"),!N)try{return x(e,t,...L)}finally{m(e),f(e)}}),I}},O=j.n;try{(Kn?"production":void 0)!=="production"&&Rp.delete(e);const L=d(e,t,_,A);if((Kn?"production":void 0)!=="production"&&Rp.has(e)&&console.warn("Detected store mutation during atom read. This is not supported."),v(e,t,L),Pu(L)){y(e,L,()=>S==null?void 0:S.abort());const F=()=>{b(),C()};L.then(F,F)}else b();return(r=c.r)==null||r.call(c,t),j}catch(L){return delete j.v,j.e=L,++j.n,j}finally{N=!1,O!==j.n&&o.get(t)===O&&(o.set(t,j.n),l.add(t),(n=c.c)==null||n.call(c,t))}},HZ=(e,t)=>{const r=Ut(e),n=r[1],s=r[2],i=r[11],o=[t];for(;o.length;){const l=o.pop(),c=i(e,l);for(const d of NO(l,c,n)){const u=i(e,d);s.get(d)!==u.n&&(s.set(d,u.n),o.push(d))}}},KZ=(e,t,...r)=>{const n=Ut(e),s=n[3],i=n[6],o=n[8],l=n[11],c=n[12],d=n[13],u=n[14],f=n[15],m=n[16],p=n[17],x=n[20];let g=!0;const v=j=>Ou(u(e,j)),y=(j,...N)=>{var w;const k=l(e,j);try{if(j===t){if(!wO(j))throw new Error("atom not writable");(Kn?"production":void 0)!=="production"&&Rp.add(e);const b=k.n,C=N[0];x(e,j,C),p(e,j),b!==k.n&&(s.add(j),f(e,j),(w=i.c)==null||w.call(i,j));return}else return m(e,j,...N)}finally{g||(d(e),c(e))}};try{return o(e,t,v,y,...r)}finally{g=!1}},YZ=(e,t)=>{var r;const n=Ut(e),s=n[1],i=n[3],o=n[6],l=n[11],c=n[15],d=n[18],u=n[19],f=l(e,t),m=s.get(t);if(m){for(const[p,x]of f.d)if(!m.d.has(p)){const g=l(e,p);d(e,p).t.add(t),m.d.add(p),x!==g.n&&(i.add(p),c(e,p),(r=o.c)==null||r.call(o,p))}for(const p of m.d)if(!f.d.has(p)){m.d.delete(p);const x=u(e,p);x==null||x.t.delete(t)}}},GZ=(e,t)=>{var r;const n=Ut(e),s=n[1],i=n[4],o=n[6],l=n[10],c=n[11],d=n[12],u=n[13],f=n[14],m=n[16],p=n[18],x=c(e,t);let g=s.get(t);if(!g){f(e,t);for(const v of x.d.keys())p(e,v).t.add(t);if(g={l:new Set,d:new Set(x.d.keys()),t:new Set},s.set(t,g),Ip(t)){const v=()=>{let y=!0;const j=(...N)=>{try{return m(e,t,...N)}finally{y||(u(e),d(e))}};try{const N=l(e,t,j);N&&(g.u=()=>{y=!0;try{N()}finally{y=!1}})}finally{y=!1}};i.add(v)}(r=o.m)==null||r.call(o,t)}return g},VZ=(e,t)=>{var r,n;const s=Ut(e),i=s[1],o=s[5],l=s[6],c=s[11],d=s[19],u=c(e,t);let f=i.get(t);if(!f||f.l.size)return f;let m=!1;for(const p of f.t)if((r=i.get(p))!=null&&r.d.has(t)){m=!0;break}if(!m){f.u&&o.add(f.u),f=void 0,i.delete(t);for(const p of u.d.keys()){const x=d(e,p);x==null||x.t.delete(t)}(n=l.u)==null||n.call(l,t);return}return f},XZ=(e,t,r)=>{const n=Ut(e),s=n[11],i=n[27],o=s(e,t),l="v"in o,c=o.v;if(Pu(r))for(const d of o.d.keys())jO(t,r,s(e,d));o.v=r,delete o.e,(!l||!Object.is(c,o.v))&&(++o.n,Pu(c)&&i(e,c))},QZ=(e,t)=>{const r=Ut(e)[14];return Ou(r(e,t))},ZZ=(e,t,...r)=>{const n=Ut(e),s=n[12],i=n[13],o=n[16];try{return o(e,t,...r)}finally{i(e),s(e)}},JZ=(e,t,r)=>{const n=Ut(e),s=n[12],i=n[18],o=n[19],c=i(e,t).l;return c.add(r),s(e),()=>{c.delete(r),o(e,t),s(e)}},eJ=(e,t,r)=>{const s=Ut(e)[25];let i=s.get(t);if(!i){i=new Set,s.set(t,i);const o=()=>s.delete(t);t.then(o,o)}i.add(r)},tJ=(e,t)=>{const s=Ut(e)[25].get(t);s==null||s.forEach(i=>i())},kO=new WeakMap,Ut=e=>{const t=kO.get(e);if((Kn?"production":void 0)!=="production"&&!t)throw new Error("Store must be created by buildStore to read its building blocks");return t};function rJ(e){const t=Ut(e),r=t[24];return r?r(t):t}function nJ(...e){const t={get(n){const s=Ut(t)[21];return s(t,n)},set(n,...s){const i=Ut(t)[22];return i(t,n,...s)},sub(n,s){const i=Ut(t)[23];return i(t,n,s)}},r=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},$Z,zZ,LZ,FZ,BZ,WZ,UZ,qZ,HZ,KZ,YZ,GZ,VZ,XZ,QZ,ZZ,JZ,void 0,new WeakMap,eJ,tJ].map((n,s)=>e[s]||n);return kO.set(t,Object.freeze(r)),t}const SO={};let aJ=0;function CO(e,t){const r=`atom${++aJ}`,n={toString(){return(SO?"production":void 0)!=="production"&&this.debugLabel?r+":"+this.debugLabel:r}};return typeof e=="function"?n.read=e:(n.init=e,n.read=sJ,n.write=iJ),n}function sJ(e){return e(this)}function iJ(e,t,r){return t(this,typeof r=="function"?r(e(this)):r)}function oJ(){return nJ()}let ll;function lJ(){return ll||(ll=oJ(),(SO?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=ll),globalThis.__JOTAI_DEFAULT_STORE__!==ll&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),ll}const cJ={},dJ=h.createContext(void 0);function _O(e){return h.useContext(dJ)||lJ()}const $p=e=>typeof(e==null?void 0:e.then)=="function",zp=e=>{e.status||(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}))},uJ=W.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(zp(e),e)}),hh=new WeakMap,Nj=(e,t,r)=>{const s=rJ(e)[26];let i=hh.get(t);return i||(i=new Promise((o,l)=>{let c=t;const d=m=>p=>{c===m&&o(p)},u=m=>p=>{c===m&&l(p)},f=()=>{try{const m=r();$p(m)?(hh.set(m,i),c=m,m.then(d(m),u(m)),s(e,m,f)):o(m)}catch(m){l(m)}};t.then(d(t),u(t)),s(e,t,f)}),hh.set(t,i)),i};function fJ(e,t){const{delay:r,unstable_promiseStatus:n=!W.use}={},s=_O(),[[i,o,l],c]=h.useReducer(u=>{const f=s.get(e);return Object.is(u[0],f)&&u[1]===s&&u[2]===e?u:[f,s,e]},void 0,()=>[s.get(e),s,e]);let d=i;if((o!==s||l!==e)&&(c(),d=s.get(e)),h.useEffect(()=>{const u=s.sub(e,()=>{if(n)try{const f=s.get(e);$p(f)&&zp(Nj(s,f,()=>s.get(e)))}catch{}if(typeof r=="number"){setTimeout(c,r);return}c()});return c(),u},[s,e,r,n]),h.useDebugValue(d),$p(d)){const u=Nj(s,d,()=>s.get(e));return n&&zp(u),uJ(u)}return d}function mJ(e,t){const r=_O();return h.useCallback((...s)=>{if((cJ?"production":void 0)!=="production"&&!("write"in e))throw new Error("not writable atom");return r.set(e,...s)},[r,e])}function MO(e,t){return[fJ(e),mJ(e)]}var OO="Expected a function",kj=NaN,hJ="[object Symbol]",pJ=/^\s+|\s+$/g,xJ=/^[-+]0x[0-9a-f]+$/i,gJ=/^0b[01]+$/i,vJ=/^0o[0-7]+$/i,yJ=parseInt,bJ=typeof Ic=="object"&&Ic&&Ic.Object===Object&&Ic,wJ=typeof self=="object"&&self&&self.Object===Object&&self,jJ=bJ||wJ||Function("return this")(),NJ=Object.prototype,kJ=NJ.toString,SJ=Math.max,CJ=Math.min,ph=function(){return jJ.Date.now()};function _J(e,t,r){var n,s,i,o,l,c,d=0,u=!1,f=!1,m=!0;if(typeof e!="function")throw new TypeError(OO);t=Sj(t)||0,Eu(r)&&(u=!!r.leading,f="maxWait"in r,i=f?SJ(Sj(r.maxWait)||0,t):i,m="trailing"in r?!!r.trailing:m);function p(b){var C=n,_=s;return n=s=void 0,d=b,o=e.apply(_,C),o}function x(b){return d=b,l=setTimeout(y,t),u?p(b):o}function g(b){var C=b-c,_=b-d,S=t-C;return f?CJ(S,i-_):S}function v(b){var C=b-c,_=b-d;return c===void 0||C>=t||C<0||f&&_>=i}function y(){var b=ph();if(v(b))return j(b);l=setTimeout(y,g(b))}function j(b){return l=void 0,m&&n?p(b):(n=s=void 0,o)}function N(){l!==void 0&&clearTimeout(l),d=0,n=c=s=l=void 0}function w(){return l===void 0?o:j(ph())}function k(){var b=ph(),C=v(b);if(n=arguments,s=this,c=b,C){if(l===void 0)return x(c);if(f)return l=setTimeout(y,t),p(c)}return l===void 0&&(l=setTimeout(y,t)),o}return k.cancel=N,k.flush=w,k}function MJ(e,t,r){var n=!0,s=!0;if(typeof e!="function")throw new TypeError(OO);return Eu(r)&&(n="leading"in r?!!r.leading:n,s="trailing"in r?!!r.trailing:s),_J(e,t,{leading:n,maxWait:t,trailing:s})}function Eu(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function OJ(e){return!!e&&typeof e=="object"}function PJ(e){return typeof e=="symbol"||OJ(e)&&kJ.call(e)==hJ}function Sj(e){if(typeof e=="number")return e;if(PJ(e))return kj;if(Eu(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Eu(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(pJ,"");var r=gJ.test(e);return r||vJ.test(e)?yJ(e.slice(2),r?2:8):xJ.test(e)?kj:+e}var EJ=MJ;const AJ=Fa(EJ),PO=h.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:z("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));PO.displayName="Card";const DJ=h.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:z("flex flex-col space-y-1.5 p-6",e),...t}));DJ.displayName="CardHeader";const TJ=h.forwardRef(({className:e,...t},r)=>a.jsx("h3",{ref:r,className:z("text-2xl font-semibold leading-none tracking-tight",e),...t}));TJ.displayName="CardTitle";const IJ=h.forwardRef(({className:e,...t},r)=>a.jsx("p",{ref:r,className:z("text-sm text-muted-foreground",e),...t}));IJ.displayName="CardDescription";const RJ=h.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:z("p-6 pt-0",e),...t}));RJ.displayName="CardContent";const $J=h.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:z("flex items-center p-6 pt-0",e),...t}));$J.displayName="CardFooter";function zJ(e,t=[]){let r=[];function n(i,o){const l=h.createContext(o),c=r.length;r=[...r,o];const d=f=>{var y;const{scope:m,children:p,...x}=f,g=((y=m==null?void 0:m[e])==null?void 0:y[c])||l,v=h.useMemo(()=>x,Object.values(x));return a.jsx(g.Provider,{value:v,children:p})};d.displayName=i+"Provider";function u(f,m){var g;const p=((g=m==null?void 0:m[e])==null?void 0:g[c])||l,x=h.useContext(p);if(x)return x;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[d,u]}const s=()=>{const i=r.map(o=>h.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return h.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[n,LJ(s,...t)]}function LJ(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=n.reduce((l,{useScope:c,scopeName:d})=>{const f=c(i)[`__scope${d}`];return{...l,...f}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}function FJ(e){const t=BJ(e),r=h.forwardRef((n,s)=>{const{children:i,...o}=n,l=h.Children.toArray(i),c=l.find(UJ);if(c){const d=c.props.children,u=l.map(f=>f===c?h.Children.count(d)>1?h.Children.only(null):h.isValidElement(d)?d.props.children:null:f);return a.jsx(t,{...o,ref:s,children:h.isValidElement(d)?h.cloneElement(d,void 0,u):null})}return a.jsx(t,{...o,ref:s,children:i})});return r.displayName=`${e}.Slot`,r}function BJ(e){const t=h.forwardRef((r,n)=>{const{children:s,...i}=r;if(h.isValidElement(s)){const o=HJ(s),l=qJ(i,s.props);return s.type!==h.Fragment&&(l.ref=n?r1(n,o):o),h.cloneElement(s,l)}return h.Children.count(s)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var WJ=Symbol("radix.slottable");function UJ(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===WJ}function qJ(e,t){const r={...t};for(const n in t){const s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...i}:n==="className"&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}function HJ(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var KJ=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],YJ=KJ.reduce((e,t)=>{const r=FJ(`Primitive.${t}`),n=h.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),kv="ContextMenu",[GJ]=zJ(kv,[i1]),Tr=i1(),[VJ,EO]=GJ(kv),AO=e=>{const{__scopeContextMenu:t,children:r,onOpenChange:n,dir:s,modal:i=!0}=e,[o,l]=h.useState(!1),c=Tr(t),d=oE(n),u=h.useCallback(f=>{l(f),d(f)},[d]);return a.jsx(VJ,{scope:t,open:o,onOpenChange:u,modal:i,children:a.jsx(lE,{...c,dir:s,open:o,onOpenChange:u,modal:i,children:r})})};AO.displayName=kv;var DO="ContextMenuTrigger",TO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,disabled:n=!1,...s}=e,i=EO(DO,r),o=Tr(r),l=h.useRef({x:0,y:0}),c=h.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...l.current})}),d=h.useRef(0),u=h.useCallback(()=>window.clearTimeout(d.current),[]),f=m=>{l.current={x:m.clientX,y:m.clientY},i.onOpenChange(!0)};return h.useEffect(()=>u,[u]),h.useEffect(()=>void(n&&u()),[n,u]),a.jsxs(a.Fragment,{children:[a.jsx(cE,{...o,virtualRef:c}),a.jsx(YJ.span,{"data-state":i.open?"open":"closed","data-disabled":n?"":void 0,...s,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:n?e.onContextMenu:Fs(e.onContextMenu,m=>{u(),f(m),m.preventDefault()}),onPointerDown:n?e.onPointerDown:Fs(e.onPointerDown,fd(m=>{u(),d.current=window.setTimeout(()=>f(m),700)})),onPointerMove:n?e.onPointerMove:Fs(e.onPointerMove,fd(u)),onPointerCancel:n?e.onPointerCancel:Fs(e.onPointerCancel,fd(u)),onPointerUp:n?e.onPointerUp:Fs(e.onPointerUp,fd(u))})]})});TO.displayName=DO;var XJ="ContextMenuPortal",IO=e=>{const{__scopeContextMenu:t,...r}=e,n=Tr(t);return a.jsx(JP,{...n,...r})};IO.displayName=XJ;var RO="ContextMenuContent",$O=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,s=EO(RO,r),i=Tr(r),o=h.useRef(!1);return a.jsx(eE,{...i,...n,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:l=>{var c;(c=e.onCloseAutoFocus)==null||c.call(e,l),!l.defaultPrevented&&o.current&&l.preventDefault(),o.current=!1},onInteractOutside:l=>{var c;(c=e.onInteractOutside)==null||c.call(e,l),!l.defaultPrevented&&!s.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});$O.displayName=RO;var QJ="ContextMenuGroup",ZJ=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,s=Tr(r);return a.jsx(dE,{...s,...n,ref:t})});ZJ.displayName=QJ;var JJ="ContextMenuLabel",zO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,s=Tr(r);return a.jsx(sE,{...s,...n,ref:t})});zO.displayName=JJ;var eee="ContextMenuItem",LO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,s=Tr(r);return a.jsx(tE,{...s,...n,ref:t})});LO.displayName=eee;var tee="ContextMenuCheckboxItem",FO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,s=Tr(r);return a.jsx(rE,{...s,...n,ref:t})});FO.displayName=tee;var ree="ContextMenuRadioGroup",nee=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,s=Tr(r);return a.jsx(uE,{...s,...n,ref:t})});nee.displayName=ree;var aee="ContextMenuRadioItem",BO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,s=Tr(r);return a.jsx(aE,{...s,...n,ref:t})});BO.displayName=aee;var see="ContextMenuItemIndicator",WO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,s=Tr(r);return a.jsx(nE,{...s,...n,ref:t})});WO.displayName=see;var iee="ContextMenuSeparator",UO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,s=Tr(r);return a.jsx(iE,{...s,...n,ref:t})});UO.displayName=iee;var oee="ContextMenuArrow",lee=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,s=Tr(r);return a.jsx(fE,{...s,...n,ref:t})});lee.displayName=oee;var cee="ContextMenuSubTrigger",qO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,s=Tr(r);return a.jsx(QP,{...s,...n,ref:t})});qO.displayName=cee;var dee="ContextMenuSubContent",HO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,s=Tr(r);return a.jsx(ZP,{...s,...n,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});HO.displayName=dee;function fd(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var uee=AO,fee=TO,mee=IO,KO=$O,YO=zO,GO=LO,VO=FO,XO=BO,QO=WO,ZO=UO,JO=qO,eP=HO;const hee=uee,pee=fee,xee=h.forwardRef(({className:e,inset:t,children:r,...n},s)=>a.jsxs(JO,{ref:s,className:z("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t&&"pl-8",e),...n,children:[r,a.jsx(vr,{className:"ml-auto h-4 w-4"})]}));xee.displayName=JO.displayName;const gee=h.forwardRef(({className:e,...t},r)=>a.jsx(eP,{ref:r,className:z("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));gee.displayName=eP.displayName;const tP=h.forwardRef(({className:e,...t},r)=>a.jsx(mee,{children:a.jsx(KO,{ref:r,className:z("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t})}));tP.displayName=KO.displayName;const rP=h.forwardRef(({className:e,inset:t,...r},n)=>a.jsx(GO,{ref:n,className:z("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...r}));rP.displayName=GO.displayName;const vee=h.forwardRef(({className:e,children:t,checked:r,...n},s)=>a.jsxs(VO,{ref:s,className:z("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(QO,{children:a.jsx(dr,{className:"h-4 w-4"})})}),t]}));vee.displayName=VO.displayName;const yee=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(XO,{ref:n,className:z("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(QO,{children:a.jsx(_r,{className:"h-2 w-2 fill-current"})})}),t]}));yee.displayName=XO.displayName;const bee=h.forwardRef(({className:e,inset:t,...r},n)=>a.jsx(YO,{ref:n,className:z("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...r}));bee.displayName=YO.displayName;const wee=h.forwardRef(({className:e,...t},r)=>a.jsx(ZO,{ref:r,className:z("-mx-1 my-1 h-px bg-border",e),...t}));wee.displayName=ZO.displayName;const jee=CO(!1),Nee=CO(0),Sv=()=>MO(jee),Cv=()=>MO(Nee),kee=e=>{let t=r=>1;return(e==="monthly"||e==="quarterly")&&(t=ws),t},Tc=e=>{let t=DN;return(e==="monthly"||e==="quarterly")&&(t=RN),t},_v=e=>{let t=M3;return(e==="monthly"||e==="quarterly")&&(t=DN),t},Hl=e=>{let t=Qi;return(e==="monthly"||e==="quarterly")&&(t=zN),t},See=e=>{let t=IN;return(e==="monthly"||e==="quarterly")&&(t=bx),t},nP=e=>{let t=Ur;return(e==="monthly"||e==="quarterly")&&(t=gx),t},pl=(e,t)=>{const r=new Date(e.timelineData[0].year,0,1),n=e.columnWidth*e.zoom/100,s=Math.floor(t/n),i=kee(e.range),l=nP(e.range)(r,s),c=i(l),d=Math.round(n/c),u=Math.floor(t%n/d);return Ur(l,u)},Cee=e=>{const t=[];t.push({year:e.getFullYear()-1,quarters:new Array(4).fill(null)},{year:e.getFullYear(),quarters:new Array(4).fill(null)},{year:e.getFullYear()+1,quarters:new Array(4).fill(null)});for(const r of t)r.quarters=new Array(4).fill(null).map((n,s)=>({months:new Array(3).fill(null).map((i,o)=>{const l=s*3+o;return{days:ws(new Date(r.year,l,1))}})}));return t},aP=(e,t,r)=>{const n=r.columnWidth*r.zoom/100,s=Tc(r.range),i=Hl(r.range),o=s(i(e),t);if(r.range==="daily")return n*o;const l=e.getDate(),c=ws(e),d=n/c;return o*n+l*d},_ee=(e,t,r)=>{const n=r.columnWidth*r.zoom/100;if(!t)return n*2;const s=Tc(r.range);if(r.range==="daily"){const x=s(t,e);return n*(x||1)}const i=ws(e),o=n/i;if(Zi(e,t))return o;const l=_v(r.range),c=Hl(r.range);if(Zi(c(e),c(t)))return l(t,e)*o;const d=i-gl(e),u=gl(t),f=s(c(t),c(e)),m=ws(t),p=n/m;return(f-1)*n+d*o+u*p},sP=(e,t,r)=>{const n=Hl(t),s=See(t),i=_v(t),o=n(e),l=s(e),c=i(l,o);return e.getDate()/c*r},Rn=h.createContext({zoom:100,range:"monthly",columnWidth:50,headerHeight:60,sidebarWidth:300,rowHeight:36,onAddItem:void 0,placeholderLength:2,timelineData:[],ref:null,scrollToFeature:void 0}),Mv=({title:e,columns:t,renderHeaderItem:r})=>{const n=h.useId();return a.jsxs("div",{className:"sticky top-0 z-20 grid w-full shrink-0 bg-backdrop/90 backdrop-blur-sm",style:{height:"var(--gantt-header-height)"},children:[a.jsx("div",{children:a.jsx("div",{className:"sticky inline-flex whitespace-nowrap px-3 py-2 text-muted-foreground text-xs",style:{left:"var(--gantt-sidebar-width)"},children:a.jsx("p",{children:e})})}),a.jsx("div",{className:"grid w-full",style:{gridTemplateColumns:`repeat(${t}, var(--gantt-column-width))`},children:Array.from({length:t}).map((s,i)=>a.jsx("div",{className:"shrink-0 border-border/50 border-b py-1 text-center text-xs",children:r(i)},`${n}-${i}`))})]})},Mee=()=>h.useContext(Rn).timelineData.map(t=>t.quarters.flatMap(r=>r.months).map((r,n)=>a.jsxs("div",{className:"relative flex flex-col",children:[a.jsx(Mv,{columns:r.days,renderHeaderItem:s=>a.jsxs("div",{className:"flex items-center justify-center gap-1",children:[a.jsx("p",{children:fe(Ur(new Date(t.year,n,1),s),"d")}),a.jsx("p",{className:"text-muted-foreground",children:fe(Ur(new Date(t.year,n,1),s),"EEEEE")})]}),title:fe(new Date(t.year,n,1),"MMMM yyyy")}),a.jsx(Ov,{columns:r.days,isColumnSecondary:s=>[0,6].includes(Ur(new Date(t.year,n,1),s).getDay())})]},`${t.year}-${n}`))),Oee=()=>h.useContext(Rn).timelineData.map(t=>a.jsxs("div",{className:"relative flex flex-col",children:[a.jsx(Mv,{columns:t.quarters.flatMap(r=>r.months).length,renderHeaderItem:r=>a.jsx("p",{children:fe(new Date(t.year,r,1),"MMM")}),title:`${t.year}`}),a.jsx(Ov,{columns:t.quarters.flatMap(r=>r.months).length})]},t.year)),Pee=()=>h.useContext(Rn).timelineData.map(t=>t.quarters.map((r,n)=>a.jsxs("div",{className:"relative flex flex-col",children:[a.jsx(Mv,{columns:r.months.length,renderHeaderItem:s=>a.jsx("p",{children:fe(new Date(t.year,n*3+s,1),"MMM")}),title:`Q${n+1} ${t.year}`}),a.jsx(Ov,{columns:r.months.length})]},`${t.year}-${n}`))),Eee={daily:Mee,monthly:Oee,quarterly:Pee},Aee=({className:e})=>{const t=h.useContext(Rn),r=Eee[t.range];return a.jsx("div",{className:z("-space-x-px flex h-full w-max divide-x divide-border/50",e),children:a.jsx(r,{})})},xh=({feature:e,onSelectItem:t,className:r,duration:n})=>{const s=h.useContext(Rn),i=e.endAt&&Zi(e.startAt,e.endAt)?Ur(e.endAt,1):e.endAt,o=n??(i?_h(e.startAt,i):`${_h(e.startAt,new Date)} so far`),l=d=>{var u;d.target===d.currentTarget&&((u=s.scrollToFeature)==null||u.call(s,e),t==null||t(e.id))},c=d=>{var u;d.key==="Enter"&&((u=s.scrollToFeature)==null||u.call(s,e),t==null||t(e.id))};return a.jsxs("div",{className:z("relative flex items-center gap-2.5 p-2.5 text-xs hover:bg-secondary",r),onClick:l,onKeyDown:c,role:"button",style:{height:"var(--gantt-row-height)"},tabIndex:0,children:[a.jsx("div",{className:"pointer-events-none h-2 w-2 shrink-0 rounded-full",style:{backgroundColor:e.status.color}}),a.jsx("p",{className:"pointer-events-none flex-1 truncate text-left font-medium",children:e.name}),a.jsx("p",{className:"pointer-events-none text-muted-foreground",children:o})]},e.id)},Dee=()=>a.jsxs("div",{className:"sticky top-0 z-10 flex shrink-0 items-end justify-between gap-2.5 border-border/50 border-b bg-backdrop/90 p-2.5 font-medium text-muted-foreground text-xs backdrop-blur-sm",style:{height:"var(--gantt-header-height)"},children:[a.jsx("p",{className:"flex-1 truncate text-left",children:"Issues"}),a.jsx("p",{className:"shrink-0",children:"Duration"})]}),gh=({children:e,name:t,className:r})=>a.jsxs("div",{className:r,children:[a.jsx("p",{className:"w-full truncate p-2.5 text-left font-medium text-muted-foreground text-xs",style:{height:"var(--gantt-row-height)"},children:t}),a.jsx("div",{className:"divide-y divide-border/50",children:e})]}),Tee=({children:e,className:t})=>a.jsxs("div",{className:z("sticky left-0 z-30 h-max min-h-full overflow-clip border-border/50 border-r bg-white dark:bg-zinc-950 backdrop-blur-md",t),"data-roadmap-ui":"gantt-sidebar",children:[a.jsx(Dee,{}),a.jsx("div",{className:"space-y-4",children:e})]}),Iee=({top:e,className:t})=>{const[r]=Cv(),n=h.useContext(Rn),[s,i]=Nv(),o=()=>{var u,f,m;const l=(f=(u=n.ref)==null?void 0:u.current)==null?void 0:f.getBoundingClientRect(),c=s.x-((l==null?void 0:l.left)??0)+r-n.sidebarWidth,d=pl(n,c);(m=n.onAddItem)==null||m.call(n,d)};return a.jsx("div",{className:z("absolute top-0 w-full px-0.5",t),ref:i,style:{marginTop:-n.rowHeight/2,transform:`translateY(${e}px)`},children:a.jsx("button",{className:"flex h-full w-full items-center justify-center rounded-md border border-dashed p-2",onClick:o,type:"button",children:a.jsx(dt,{className:"pointer-events-none select-none text-muted-foreground",size:16})})})},Ree=({index:e,isColumnSecondary:t})=>{var m;const r=h.useContext(Rn),[n]=Sv(),[s,i]=Nv(),[o,l]=h.useState(!1),[c]=RZ(),d=()=>l(!0),u=()=>l(!1),f=IZ(s.y-(((m=i.current)==null?void 0:m.getBoundingClientRect().y)??0)-(c.y??0),10);return a.jsx("div",{className:z("group relative h-full overflow-hidden",t!=null&&t(e)?"bg-[#f59e0b]/5 dark:bg-[#f59e0b]/5":""),onMouseEnter:d,onMouseLeave:u,ref:i,children:!n&&o&&r.onAddItem?a.jsx(Iee,{top:f}):null})},Ov=({columns:e,isColumnSecondary:t})=>{const r=h.useId();return a.jsx("div",{className:"divide grid h-full w-full divide-x divide-border/50",style:{gridTemplateColumns:`repeat(${e}, var(--gantt-column-width))`},children:Array.from({length:e}).map((n,s)=>a.jsx(Ree,{index:s,isColumnSecondary:t},`${r}-${s}`))})},Cj=({direction:e,featureId:t,date:r})=>{const[,n]=Sv(),{attributes:s,listeners:i,setNodeRef:o}=d1({id:`feature-drag-helper-${t}`}),l=!!s["aria-pressed"];return h.useEffect(()=>n(l),[l,n]),a.jsxs("div",{className:z("group -translate-y-1/2 !cursor-col-resize absolute top-1/2 z-[3] h-full w-6 rounded-md outline-none",e==="left"?"-left-2.5":"-right-2.5"),ref:o,...s,...i,children:[a.jsx("div",{className:z("-translate-y-1/2 absolute top-1/2 h-[80%] w-1 rounded-sm bg-muted-foreground opacity-0 transition-all",e==="left"?"left-2.5":"right-2.5",e==="left"?"group-hover:left-0":"group-hover:right-0",l&&(e==="left"?"left-0":"right-0"),"group-hover:opacity-100",l&&"opacity-100")}),r&&a.jsx("div",{className:z("-translate-x-1/2 absolute top-10 hidden whitespace-nowrap rounded-lg border border-border/50 bg-background/90 px-2 py-1 text-foreground text-xs backdrop-blur-lg group-hover:block",l&&"block"),children:fe(r,"MMM dd, yyyy")})]})},$ee=({id:e,children:t})=>{const[,r]=Sv(),{attributes:n,listeners:s,setNodeRef:i}=d1({id:e}),o=!!n["aria-pressed"];return h.useEffect(()=>r(o),[o,r]),a.jsx(PO,{className:"h-full w-full rounded-md bg-background p-2 text-xs shadow-sm",children:a.jsx("div",{className:z("flex h-full w-full items-center justify-between gap-2 text-left",o&&"cursor-grabbing"),...n,...s,ref:i,children:t})})},_j=({onMove:e,children:t,className:r,...n})=>{const[s]=Cv(),i=h.useContext(Rn),o=h.useMemo(()=>{var A;return new Date(((A=i.timelineData.at(0))==null?void 0:A.year)??0,0,1)},[i.timelineData]),[l,c]=h.useState(n.startAt),[d,u]=h.useState(n.endAt),f=h.useMemo(()=>_ee(l,d,i),[l,d,i]),m=h.useMemo(()=>aP(l,o,i),[l,o,i]),p=h.useMemo(()=>nP(i.range),[i.range]),[x]=Nv(),[g,v]=h.useState(0),[y,j]=h.useState(l),[N,w]=h.useState(d),k=Up(yE,{activationConstraint:{distance:10}}),b=h.useCallback(()=>{v(x.x),j(l),w(d)},[x.x,l,d]),C=h.useCallback(()=>{const A=pl(i,x.x),O=pl(i,g),L=i.range==="daily"?Tc(i.range)(A,O):_v(i.range)(A,O),F=Ur(y,L),X=N?Ur(N,L):null;c(F),u(X)},[i,x.x,g,y,N]),_=h.useCallback(()=>e==null?void 0:e(n.id,l,d),[e,n.id,l,d]),S=h.useCallback(()=>{var X,T;const A=(T=(X=i.ref)==null?void 0:X.current)==null?void 0:T.getBoundingClientRect(),O=x.x-((A==null?void 0:A.left)??0)+s-i.sidebarWidth,F=Hl(i.range)(pl(i,O));c(F)},[i,x.x,s]),I=h.useCallback(()=>{var X,T;const A=(T=(X=i.ref)==null?void 0:X.current)==null?void 0:T.getBoundingClientRect(),O=x.x-((A==null?void 0:A.left)??0)+s-i.sidebarWidth,F=Hl(i.range)(pl(i,O));u(F)},[i,x.x,s]);return a.jsx("div",{className:z("relative flex w-max min-w-full py-0.5",r),style:{height:"var(--gantt-row-height)"},children:a.jsxs("div",{className:"pointer-events-auto absolute top-0.5",style:{height:"calc(var(--gantt-row-height) - 4px)",width:Math.round(f),left:Math.round(m)},children:[e&&a.jsx(xl,{modifiers:[mh],onDragEnd:_,onDragMove:S,sensors:[k],children:a.jsx(Cj,{date:l,direction:"left",featureId:n.id})}),a.jsx(xl,{modifiers:[mh],onDragEnd:_,onDragMove:C,onDragStart:b,sensors:[k],children:a.jsx($ee,{id:n.id,children:t??a.jsx("p",{className:"flex-1 truncate text-xs",children:n.name})})}),e&&a.jsx(xl,{modifiers:[mh],onDragEnd:_,onDragMove:I,sensors:[k],children:a.jsx(Cj,{date:d?UN(d,1):p(l,1),direction:"right",featureId:n.id})})]})})},vh=({children:e,className:t})=>a.jsx("div",{className:t,style:{paddingTop:"var(--gantt-row-height)"},children:e}),zee=({className:e,children:t})=>a.jsx("div",{className:z("absolute top-0 left-0 h-full w-max space-y-4",e),style:{marginTop:"var(--gantt-header-height)"},children:t}),iP=h.memo(({label:e,date:t,id:r,onRemove:n,className:s})=>{const i=h.useContext(Rn),o=h.useMemo(()=>Tc(i.range),[i.range]),l=h.useMemo(()=>{var f;return new Date(((f=i.timelineData.at(0))==null?void 0:f.year)??0,0,1)},[i.timelineData]),c=h.useMemo(()=>o(t,l),[o,t,l]),d=h.useMemo(()=>sP(t,i.range,i.columnWidth*i.zoom/100),[t,i.range,i.columnWidth,i.zoom]),u=h.useCallback(()=>n==null?void 0:n(r),[n,r]);return a.jsxs("div",{className:"pointer-events-none absolute top-0 left-0 z-20 flex h-full select-none flex-col items-center justify-center overflow-visible",style:{width:0,transform:`translateX(calc(var(--gantt-column-width) * ${c} + ${d}px))`},children:[a.jsxs(hee,{children:[a.jsx(pee,{asChild:!0,children:a.jsxs("div",{className:z("group pointer-events-auto sticky top-0 flex select-auto flex-col flex-nowrap items-center justify-center whitespace-nowrap rounded-b-md bg-card px-2 py-1 text-foreground text-xs",s),children:[e,a.jsx("span",{className:"max-h-[0] overflow-hidden opacity-80 transition-all group-hover:max-h-[2rem]",children:fe(t,"MMM dd, yyyy")})]})}),a.jsx(tP,{children:n?a.jsxs(rP,{className:"flex items-center gap-2 text-destructive",onClick:u,children:[a.jsx(T5,{size:16}),"Remove marker"]}):null})]}),a.jsx("div",{className:z("h-full w-px bg-card",s)})]})});iP.displayName="GanttMarker";const Lee=({zoom:e=100,range:t="monthly",onAddItem:r,children:n,className:s})=>{const i=h.useRef(null),[o,l]=h.useState(Cee(new Date)),[,c]=Cv(),[d,u]=h.useState(0),f=60,m=36;let p=50;t==="monthly"?p=150:t==="quarterly"&&(p=100);const x=h.useMemo(()=>({"--gantt-zoom":`${e}`,"--gantt-column-width":`${e/100*p}px`,"--gantt-header-height":`${f}px`,"--gantt-row-height":`${m}px`,"--gantt-sidebar-width":`${d}px`}),[e,p,d]);h.useEffect(()=>{i.current&&(i.current.scrollLeft=i.current.scrollWidth/2-i.current.clientWidth/2,c(i.current.scrollLeft))},[c]),h.useEffect(()=>{const y=()=>{var k;const w=((k=i.current)==null?void 0:k.querySelector('[data-roadmap-ui="gantt-sidebar"]'))?300:0;u(w)};y();const j=new MutationObserver(y);return i.current&&j.observe(i.current,{childList:!0,subtree:!0}),()=>{j.disconnect()}},[]);const g=h.useCallback(AJ(()=>{var k,b;const y=i.current;if(!y)return;const{scrollLeft:j,scrollWidth:N,clientWidth:w}=y;if(c(j),j===0){const C=(k=o[0])==null?void 0:k.year;if(!C)return;const _=[...o];_.unshift({year:C-1,quarters:new Array(4).fill(null).map((S,I)=>({months:new Array(3).fill(null).map((A,O)=>{const L=I*3+O;return{days:ws(new Date(C,L,1))}})}))}),l(_),y.scrollLeft=y.clientWidth,c(y.scrollLeft)}else if(j+w>=N){const C=(b=o.at(-1))==null?void 0:b.year;if(!C)return;const _=[...o];_.push({year:C+1,quarters:new Array(4).fill(null).map((S,I)=>({months:new Array(3).fill(null).map((A,O)=>{const L=I*3+O;return{days:ws(new Date(C,L,1))}})}))}),l(_),y.scrollLeft=y.scrollWidth-y.clientWidth,c(y.scrollLeft)}},100),[]);h.useEffect(()=>{const y=i.current;return y&&y.addEventListener("scroll",g),()=>{y&&y.removeEventListener("scroll",g)}},[g]);const v=h.useCallback(y=>{const j=i.current;if(!j)return;const N=new Date(o[0].year,0,1),w=aP(y.startAt,N,{zoom:e,range:t,columnWidth:p}),k=Math.max(0,w);j.scrollTo({left:k,behavior:"smooth"})},[o,e,t,p,d,r]);return a.jsx(Rn.Provider,{value:{zoom:e,range:t,headerHeight:f,columnWidth:p,sidebarWidth:d,rowHeight:m,onAddItem:r,timelineData:o,placeholderLength:2,ref:i,scrollToFeature:v},children:a.jsx("div",{className:z("gantt relative isolate grid h-full w-full flex-none select-none overflow-auto rounded-sm bg-secondary",t,s),ref:i,style:{...x,gridTemplateColumns:"var(--gantt-sidebar-width) 1fr"},children:n})})},Fee=({children:e,className:t})=>a.jsx("div",{className:z("relative flex h-full w-max flex-none overflow-clip",t),children:e}),Bee=({className:e})=>{const t="Today",r=h.useMemo(()=>new Date,[]),n=h.useContext(Rn),s=h.useMemo(()=>Tc(n.range),[n.range]),i=h.useMemo(()=>{var c;return new Date(((c=n.timelineData.at(0))==null?void 0:c.year)??0,0,1)},[n.timelineData]),o=h.useMemo(()=>s(r,i),[s,r,i]),l=h.useMemo(()=>sP(r,n.range,n.columnWidth*n.zoom/100),[r,n.range,n.columnWidth,n.zoom]);return a.jsxs("div",{className:"pointer-events-none absolute top-0 left-0 z-20 flex h-full select-none flex-col items-center justify-center overflow-visible",style:{width:0,transform:`translateX(calc(var(--gantt-column-width) * ${o} + ${l}px))`},children:[a.jsxs("div",{className:z("group pointer-events-auto sticky top-0 flex select-auto flex-col flex-nowrap items-center justify-center whitespace-nowrap rounded-b-md bg-card px-2 py-1 text-foreground text-xs",e),children:[t,a.jsx("span",{className:"max-h-[0] overflow-hidden opacity-80 transition-all group-hover:max-h-[2rem]",children:fe(r,"MMM dd, yyyy")})]}),a.jsx("div",{className:z("h-full w-px bg-card",e)})]})};function Wee(e){return Be({queryKey:["public","share",e],queryFn:()=>oe.get(`/public/share/${e}`),select:t=>t.project,enabled:!!e,retry:!1})}function Pv(e,t={}){const r=new URLSearchParams;t.status&&r.set("status",t.status),t.priority&&r.set("priority",t.priority),t.search&&r.set("search",t.search);const n=r.toString()?`?${r.toString()}`:"";return Be({queryKey:["public","share",e,"issues",t],queryFn:()=>oe.get(`/public/share/${e}/issues${n}`),select:s=>s.issues,enabled:!!e,retry:!1})}function oP(e){return Be({queryKey:["public","share",e,"sprints"],queryFn:()=>oe.get(`/public/share/${e}/sprints`),select:t=>t.sprints,enabled:!!e,retry:!1})}function Uee({priority:e,className:t}){const r=z("h-3.5 w-3.5 shrink-0",uc[e],t);switch(e){case"urgent":return a.jsx(oa,{className:r});case"high":return a.jsx(bi,{className:r});case"medium":return a.jsx(Ba,{className:r});case"low":return a.jsx(yi,{className:r});default:return a.jsx(_r,{className:z("h-3.5 w-3.5 shrink-0 text-zinc-300",t)})}}const Lp="grid-cols-[70px_250px_150px_120px_130px_140px_130px]";function lP({issue:e,statuses:t,statusLabels:r,statusColorMap:n,sprints:s,isChild:i=!1,children:o=[],childrenMap:l}){const[c,d]=h.useState(!1),u=o.length>0,f=n[e.status]??"#94a3b8",m=s.find(p=>p.id===e.sprint_id);return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:z(`group grid ${Lp} items-center py-3`,"hover:bg-[#f9fafb] dark:hover:bg-muted/30 transition-colors",i&&"bg-muted/10"),children:[a.jsx("span",{className:z("text-xs font-mono text-muted-foreground truncate","sticky left-0 z-10 pl-6 transition-colors","bg-white dark:bg-card group-hover:bg-[#f9fafb] dark:group-hover:bg-muted/30",i&&"text-muted-foreground/60"),children:e.identifier}),a.jsxs("div",{className:z("flex items-center gap-1 min-w-0 pr-3","sticky left-[70px] z-10 transition-colors","bg-white dark:bg-card group-hover:bg-[#f9fafb] dark:group-hover:bg-muted/30",i&&"bg-[#f8f9fa] dark:bg-muted/20"),children:[u?a.jsxs(Qn,{children:[a.jsx(Zn,{asChild:!0,children:a.jsx("button",{onClick:()=>d(!c),className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors p-0.5 rounded",children:c?a.jsx(ia,{className:"h-3.5 w-3.5"}):a.jsx(vr,{className:"h-3.5 w-3.5"})})}),a.jsx(_n,{side:"top",children:c?"Collapse":"Expand"})]}):i?a.jsx(Mn,{className:"h-3 w-3 text-muted-foreground/40 shrink-0"}):a.jsx("span",{className:"w-4 shrink-0"}),a.jsx("span",{className:z("text-sm text-foreground truncate",i&&"text-muted-foreground"),children:e.title}),u&&a.jsxs("span",{className:"shrink-0 flex items-center gap-0.5 ml-1 text-[10px] font-medium text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/50 px-1 py-0.5 rounded",children:[a.jsx(Mn,{className:"h-2.5 w-2.5"}),o.length]})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-1.5 py-1 max-w-full",children:[a.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:f}}),a.jsx("span",{className:"text-xs text-muted-foreground truncate",children:r[e.status]??e.status})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-1.5 py-1",children:[a.jsx(Uee,{priority:e.priority}),a.jsx("span",{className:"text-xs text-muted-foreground",children:rn[e.priority]??e.priority})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-1.5 py-1 max-w-full",children:[a.jsx(Hr,{className:"h-3.5 w-3.5 text-muted-foreground/50 shrink-0"}),a.jsx("span",{className:z("text-xs truncate",m?"text-foreground":"text-muted-foreground/50"),children:(m==null?void 0:m.name)??"—"})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-1.5 py-1",children:[a.jsx(Wt,{className:"h-3.5 w-3.5 text-muted-foreground/50 shrink-0"}),a.jsx("span",{className:z("text-xs",e.due_date?"text-foreground":"text-muted-foreground/50"),children:e.due_date?fe(new Date(e.due_date),"MMM d, yyyy"):"—"})]}),a.jsx("div",{className:"flex items-center px-1.5",children:a.jsx("div",{className:"flex -space-x-1.5",children:(e.assignees??[]).slice(0,3).map(p=>a.jsx("div",{title:p.name,className:"h-5 w-5 rounded-full bg-indigo-100 dark:bg-indigo-900 border border-white dark:border-card flex items-center justify-center text-[10px] font-medium text-indigo-700 dark:text-indigo-300",children:p.initials},p.id))})})]}),c&&o.map(p=>a.jsx(lP,{issue:p,statuses:t,statusLabels:r,statusColorMap:n,sprints:s,isChild:!0,children:(l==null?void 0:l[p.id])??[],childrenMap:l},p.id))]})}function qee({issues:e,childrenMap:t,statuses:r,statusLabels:n,statusColorMap:s,sprints:i,totalCount:o}){const[l,c]=h.useState(!1);return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 px-6 py-2 bg-muted/20 border-b border-border",children:[a.jsx("button",{onClick:()=>c(!l),className:"text-muted-foreground hover:text-foreground transition-colors",children:l?a.jsx(vr,{className:"h-3.5 w-3.5"}):a.jsx(ia,{className:"h-3.5 w-3.5"})}),a.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"Issues"}),a.jsx("span",{className:"text-[11px] text-muted-foreground/60 font-mono",children:o})]}),!l&&a.jsx("div",{className:"divide-y divide-border/60",children:e.length===0?a.jsx("div",{className:"px-14 py-5 text-xs text-muted-foreground/50 italic",children:"No issues match your filters"}):e.map(d=>a.jsx(lP,{issue:d,statuses:r,statusLabels:n,statusColorMap:s,sprints:i,children:t[d.id]??[],childrenMap:t},d.id))})]})}function Hee({token:e,statuses:t}){const[r,n]=h.useState("all"),[s,i]=h.useState("all"),[o,l]=h.useState("all"),[c,d]=h.useState(""),{data:u=[],isLoading:f}=Pv(e),{data:m=[]}=oP(e),p=Object.fromEntries(t.map(N=>[N.key,N.name])),x=Object.fromEntries(t.map(N=>[N.key,N.color])),g={};for(const N of u)N.parent_id&&(g[N.parent_id]||(g[N.parent_id]=[]),g[N.parent_id].push(N));const v=u.filter(N=>!N.parent_id).filter(N=>{const w=c.toLowerCase(),k=!c||N.title.toLowerCase().includes(w)||N.identifier.toLowerCase().includes(w),b=r==="all"||N.status===r,C=s==="all"||N.priority===s,_=o==="all"?!0:o==="none"?!N.sprint_id:N.sprint_id===o;return k&&b&&C&&_}).sort((N,w)=>{const k=parseInt(N.identifier.split("-")[1]??"0",10),b=parseInt(w.identifier.split("-")[1]??"0",10);return k-b}),y=v.reduce((N,w)=>{var k;return N+(((k=g[w.id])==null?void 0:k.length)??0)},0),j=v.length+y;return a.jsx("div",{className:"p-2",children:a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-border gap-3 flex-wrap",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(Le,{value:o,onValueChange:l,children:[a.jsx($e,{className:"h-8 text-xs w-[140px] bg-transparent",children:a.jsx(qe,{placeholder:"Sprint"})}),a.jsxs(ze,{children:[a.jsx(we,{value:"all",className:"text-xs",children:"All sprints"}),a.jsx(we,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),m.map(N=>a.jsx(we,{value:N.id,className:"text-xs",children:N.name},N.id))]})]}),a.jsxs(Le,{value:r,onValueChange:n,children:[a.jsx($e,{className:"h-8 text-xs w-[130px] bg-transparent",children:a.jsx(qe,{placeholder:"Status"})}),a.jsxs(ze,{children:[a.jsx(we,{value:"all",className:"text-xs",children:"All statuses"}),t.map(({key:N,name:w})=>a.jsx(we,{value:N,className:"text-xs",children:w},N))]})]}),a.jsxs(Le,{value:s,onValueChange:i,children:[a.jsx($e,{className:"h-8 text-xs w-[130px] bg-transparent",children:a.jsx(qe,{placeholder:"Priority"})}),a.jsxs(ze,{children:[a.jsx(we,{value:"all",className:"text-xs",children:"All priorities"}),Object.entries(rn).map(([N,w])=>a.jsx(we,{value:N,className:"text-xs",children:w},N))]})]})]}),a.jsxs("div",{className:"relative",children:[a.jsx(ji,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground pointer-events-none"}),a.jsx(Ee,{placeholder:"Search...",value:c,onChange:N=>d(N.target.value),className:"pl-8 h-8 w-[200px] text-xs bg-transparent"})]})]}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("div",{className:"min-w-[900px]",children:[a.jsxs("div",{className:z("grid items-center py-2.5 border-b border-border",Lp),children:[a.jsx("span",{className:"text-xs font-medium text-[#6b7280] sticky left-0 z-10 bg-white dark:bg-card pl-6",children:"ID"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280] sticky left-[70px] z-10 bg-white dark:bg-card",children:"Title"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Status"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Priority"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Sprint"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Due Date"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Assignees"})]}),f?a.jsx("div",{className:"divide-y divide-border",children:[1,2,3,4].map(N=>a.jsxs("div",{className:z("grid items-center px-6 py-3 gap-4",Lp),children:[a.jsx(le,{className:"h-4 w-14"}),a.jsx(le,{className:"h-4 w-56"}),a.jsx(le,{className:"h-5 w-20"}),a.jsx(le,{className:"h-4 w-16"}),a.jsx(le,{className:"h-4 w-20"}),a.jsx(le,{className:"h-4 w-24"}),a.jsx(le,{className:"h-6 w-16"})]},N))}):u.length===0?a.jsx("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:a.jsx("p",{className:"text-sm font-medium mb-1",children:"No issues yet"})}):a.jsx(Iu,{delayDuration:200,children:a.jsx(qee,{issues:v,childrenMap:g,statuses:t,statusLabels:p,statusColorMap:x,sprints:m,totalCount:j})})]})}),!f&&j>0&&a.jsx("div",{className:"flex items-center px-6 py-3 border-t border-border",children:a.jsxs("span",{className:"text-xs text-muted-foreground",children:[j," issue",j!==1?"s":""]})})]})})}function md(e,t){const r=e.start_date?new Date(e.start_date):new Date(e.due_date),n=e.due_date?Ur(new Date(e.due_date),1):Ur(r,1);return{id:e.id,name:`${e.identifier} ${e.title}`,startAt:r,endAt:n,status:{id:e.status,name:e.status,color:t}}}function Kee({token:e,statuses:t}){const[r,n]=h.useState("monthly"),s=h.useRef(null),{data:i=[]}=Pv(e),{data:o=[]}=oP(e);h.useEffect(()=>{const m=requestAnimationFrame(()=>{var j;const p=(j=s.current)==null?void 0:j.querySelector(".gantt");if(!p)return;const x=new Date,g=x.getFullYear()-1,v=300;let y;if(r==="daily")y=Math.floor((x.getTime()-new Date(g,0,1).getTime())/864e5)*50;else{const N=r==="monthly"?150:100,w=(x.getFullYear()-g)*12+x.getMonth(),k=new Date(x.getFullYear(),x.getMonth()+1,0).getDate();y=w*N+(x.getDate()-1)/k*N}p.scrollLeft=Math.max(0,y-(p.clientWidth-v)/2)});return()=>cancelAnimationFrame(m)},[r]);const l=Object.fromEntries(t.map(m=>[m.key,m.color])),c=i.filter(m=>m.due_date),d=i.filter(m=>!m.due_date),u={},f=[];for(const m of c)m.sprint_id?(u[m.sprint_id]||(u[m.sprint_id]=[]),u[m.sprint_id].push(m)):f.push(m);return a.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[a.jsx("div",{className:"flex items-center px-6 py-3 border-b border-border shrink-0 bg-white dark:bg-zinc-950",children:a.jsx("div",{className:"flex items-center gap-1 bg-muted rounded-md p-0.5",children:["daily","monthly","quarterly"].map(m=>a.jsx("button",{onClick:()=>n(m),className:`px-3 py-1 rounded text-xs font-medium transition-colors capitalize ${r===m?"bg-white dark:bg-zinc-900 text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:m},m))})}),a.jsx("div",{ref:s,className:"flex-1 min-h-0 overflow-hidden",children:a.jsxs(Lee,{range:r,zoom:100,className:"h-full bg-white dark:bg-zinc-950",children:[a.jsxs(Tee,{children:[o.map(m=>{const p=u[m.id]??[];return a.jsx(gh,{name:m.name,children:p.map(x=>a.jsx(xh,{feature:md(x,l[x.status]??"#94a3b8")},x.id))},m.id)}),f.length>0&&a.jsx(gh,{name:"No Sprint",children:f.map(m=>a.jsx(xh,{feature:md(m,l[m.status]??"#94a3b8")},m.id))}),d.length>0&&a.jsx(gh,{name:"Unscheduled",children:d.map(m=>a.jsx(xh,{feature:{id:m.id,name:`${m.identifier} ${m.title}`,startAt:new Date,endAt:new Date,status:{id:m.status,name:m.status,color:l[m.status]??"#94a3b8"}}},m.id))})]}),a.jsxs(Fee,{children:[a.jsx(Aee,{}),a.jsxs(zee,{children:[o.map(m=>a.jsx(vh,{children:(u[m.id]??[]).map(p=>a.jsx("div",{className:"flex",children:a.jsx(_j,{...md(p,l[p.status]??"#94a3b8")})},p.id))},m.id)),f.length>0&&a.jsx(vh,{children:f.map(m=>a.jsx("div",{className:"flex",children:a.jsx(_j,{...md(m,l[m.status]??"#94a3b8")})},m.id))}),d.length>0&&a.jsx(vh,{children:d.map(m=>a.jsx("div",{style:{height:"var(--gantt-row-height)"}},m.id))})]}),o.filter(m=>m.end_date).map(m=>a.jsx(iP,{id:m.id,date:new Date(m.end_date),label:`${m.name} end`},m.id)),a.jsx(Bee,{})]})]})})]})}function Yee(){const{token:e}=zt(),[t,r]=h.useState("board"),{data:n,isLoading:s,isError:i}=Wee(e??""),{data:o}=Pv(e??"");if(!e)return null;if(s)return a.jsx("div",{className:"min-h-screen flex items-center justify-center",children:a.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading…"})});if(i||!n)return a.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center gap-3",children:[a.jsx("p",{className:"text-lg font-semibold",children:"Link not found"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"This share link is invalid or has been revoked."})]});const l=[{key:"board",label:"Board"},{key:"issues",label:"Issues"},{key:"timeline",label:"Timeline"}];return a.jsxs("div",{className:"h-screen flex flex-col bg-background overflow-hidden",children:[a.jsx("header",{className:"border-b border-border px-6 py-3 bg-white dark:bg-card shrink-0",children:a.jsxs("div",{className:"flex items-center gap-3",children:[n.icon&&a.jsx("span",{className:"text-xl",children:n.icon}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs font-mono text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/50 border border-indigo-200 dark:border-indigo-800 px-2 py-0.5 rounded",children:n.identifier}),a.jsx("h1",{className:"text-sm font-semibold",children:n.name})]}),a.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"Read-only view"})]})}),a.jsx("div",{className:"border-b border-border bg-white dark:bg-card px-6 shrink-0",children:a.jsx("div",{className:"flex -mb-px",children:l.map(({key:c,label:d})=>a.jsx("button",{onClick:()=>r(c),className:`px-3 py-2 text-sm border-b-2 transition-colors ${t===c?"border-foreground text-foreground font-medium":"border-transparent text-muted-foreground hover:text-foreground"}`,children:d},c))})}),a.jsxs("div",{className:`flex-1 min-h-0 ${t==="timeline"?"overflow-hidden":"overflow-auto"}`,children:[t==="board"&&a.jsx(KN,{issues:o??[],projectId:n.id,statuses:n.statuses,readOnly:!0}),t==="issues"&&a.jsx(Hee,{token:e,statuses:n.statuses}),t==="timeline"&&a.jsx(Kee,{token:e,statuses:n.statuses})]})]})}const Gee=new URLSearchParams(window.location.search);function Vee(){const[e,t]=h.useState(null),r=pt(),n=Ie(),s=h.useRef(!1);if(h.useEffect(()=>{if(s.current)return;s.current=!0;const i=Gee;if(history.replaceState(null,"",window.location.pathname),i.get("linked")==="true"){r("/profile?linked=true",{replace:!0});return}const l=i.get("error");if(l){t(decodeURIComponent(l));return}const c=i.get("code");if(!c){t("No authorization code received from Google sign-in");return}(async()=>{const u=await fetch(`${Gi}/auth/google/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:c})});if(!u.ok)throw new Error(`Code exchange failed (${u.status}). Please try signing in again.`);const{token:f}=await u.json(),m=await fetch(`${Gi}/admin/users/me`,{headers:{Authorization:`Bearer ${f}`}});if(!m.ok)throw new Error(`Failed to load user profile (${m.status})`);const p=await m.json();n.login({id:p.id,email:p.email,first_name:p.first_name??"",last_name:p.last_name??"",avatar_url:p.avatar_url},f),r("/",{replace:!0})})().catch(u=>t(u.message??"Failed to complete sign-in"))},[]),e){const i=e.startsWith("GOOGLE_NOT_LINKED:"),o=i?e.replace("GOOGLE_NOT_LINKED: ",""):e;return a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[400px] bg-white dark:bg-card border border-border rounded-xl p-6 text-center space-y-4",children:[a.jsx("p",{className:"text-sm font-medium",children:i?"Google account not connected":"Sign-in failed"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:o}),i?a.jsxs("div",{className:"flex flex-col gap-2 pt-1",children:[a.jsx(qr,{to:"/login",children:a.jsx(ne,{className:"w-full",size:"sm",children:"Sign in with email & password"})}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["After signing in, go to ",a.jsx("strong",{children:"Profile"})," → ",a.jsx("strong",{children:"Connections"})," to link your Google account."]})]}):a.jsx(qr,{to:"/login",children:a.jsx(ne,{variant:"outline",size:"sm",children:"Back to login"})})]})})}return a.jsx("div",{className:"min-h-screen flex items-center justify-center",children:a.jsx("span",{className:"text-sm text-muted-foreground",children:"Completing sign-in..."})})}var Xee=Object.defineProperty,Qee=Object.defineProperties,Zee=Object.getOwnPropertyDescriptors,Au=Object.getOwnPropertySymbols,cP=Object.prototype.hasOwnProperty,dP=Object.prototype.propertyIsEnumerable,Mj=(e,t,r)=>t in e?Xee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Jee=(e,t)=>{for(var r in t||(t={}))cP.call(t,r)&&Mj(e,r,t[r]);if(Au)for(var r of Au(t))dP.call(t,r)&&Mj(e,r,t[r]);return e},ete=(e,t)=>Qee(e,Zee(t)),tte=(e,t)=>{var r={};for(var n in e)cP.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Au)for(var n of Au(e))t.indexOf(n)<0&&dP.call(e,n)&&(r[n]=e[n]);return r};function rte(e){let t=setTimeout(e,0),r=setTimeout(e,10),n=setTimeout(e,50);return[t,r,n]}function nte(e){let t=h.useRef();return h.useEffect(()=>{t.current=e}),t.current}var ate=18,uP=40,ste=`${uP}px`,ite=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function ote({containerRef:e,inputRef:t,pushPasswordManagerStrategy:r,isFocused:n}){let[s,i]=h.useState(!1),[o,l]=h.useState(!1),[c,d]=h.useState(!1),u=h.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&s&&o,[s,o,r]),f=h.useCallback(()=>{let m=e.current,p=t.current;if(!m||!p||c||r==="none")return;let x=m,g=x.getBoundingClientRect().left+x.offsetWidth,v=x.getBoundingClientRect().top+x.offsetHeight/2,y=g-ate,j=v;document.querySelectorAll(ite).length===0&&document.elementFromPoint(y,j)===m||(i(!0),d(!0))},[e,t,c,r]);return h.useEffect(()=>{let m=e.current;if(!m||r==="none")return;function p(){let g=window.innerWidth-m.getBoundingClientRect().right;l(g>=uP)}p();let x=setInterval(p,1e3);return()=>{clearInterval(x)}},[e,r]),h.useEffect(()=>{let m=n||document.activeElement===t.current;if(r==="none"||!m)return;let p=setTimeout(f,0),x=setTimeout(f,2e3),g=setTimeout(f,5e3),v=setTimeout(()=>{d(!0)},6e3);return()=>{clearTimeout(p),clearTimeout(x),clearTimeout(g),clearTimeout(v)}},[t,n,r,f]),{hasPWMBadge:s,willPushPWMBadge:u,PWM_BADGE_SPACE_WIDTH:ste}}var fP=h.createContext({}),mP=h.forwardRef((e,t)=>{var r=e,{value:n,onChange:s,maxLength:i,textAlign:o="left",pattern:l,placeholder:c,inputMode:d="numeric",onComplete:u,pushPasswordManagerStrategy:f="increase-width",pasteTransformer:m,containerClassName:p,noScriptCSSFallback:x=lte,render:g,children:v}=r,y=tte(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),j,N,w,k,b;let[C,_]=h.useState(typeof y.defaultValue=="string"?y.defaultValue:""),S=n??C,I=nte(S),A=h.useCallback(V=>{s==null||s(V),_(V)},[s]),O=h.useMemo(()=>l?typeof l=="string"?new RegExp(l):l:null,[l]),L=h.useRef(null),F=h.useRef(null),X=h.useRef({value:S,onChange:A,isIOS:typeof window<"u"&&((N=(j=window==null?void 0:window.CSS)==null?void 0:j.supports)==null?void 0:N.call(j,"-webkit-touch-callout","none"))}),T=h.useRef({prev:[(w=L.current)==null?void 0:w.selectionStart,(k=L.current)==null?void 0:k.selectionEnd,(b=L.current)==null?void 0:b.selectionDirection]});h.useImperativeHandle(t,()=>L.current,[]),h.useEffect(()=>{let V=L.current,ie=F.current;if(!V||!ie)return;X.current.value!==V.value&&X.current.onChange(V.value),T.current.prev=[V.selectionStart,V.selectionEnd,V.selectionDirection];function pe(){if(document.activeElement!==V){R(null),$(null);return}let Q=V.selectionStart,ge=V.selectionEnd,De=V.selectionDirection,Ue=V.maxLength,Fe=V.value,Ve=T.current.prev,ut=-1,Ke=-1,Ze;if(Fe.length!==0&&Q!==null&&ge!==null){let yr=Q===ge,nr=Q===Fe.length&&Fe.length<Ue;if(yr&&!nr){let yt=Q;if(yt===0)ut=0,Ke=1,Ze="forward";else if(yt===Ue)ut=yt-1,Ke=yt,Ze="backward";else if(Ue>1&&Fe.length>1){let Lt=0;if(Ve[0]!==null&&Ve[1]!==null){Ze=yt<Ve[1]?"backward":"forward";let Kt=Ve[0]===Ve[1]&&Ve[0]<Ue;Ze==="backward"&&!Kt&&(Lt=-1)}ut=Lt+yt,Ke=Lt+yt+1}}ut!==-1&&Ke!==-1&&ut!==Ke&&L.current.setSelectionRange(ut,Ke,Ze)}let tr=ut!==-1?ut:Q,Ir=Ke!==-1?Ke:ge,rr=Ze??De;R(tr),$(Ir),T.current.prev=[tr,Ir,rr]}if(document.addEventListener("selectionchange",pe,{capture:!0}),pe(),document.activeElement===V&&P(!0),!document.getElementById("input-otp-style")){let Q=document.createElement("style");if(Q.id="input-otp-style",document.head.appendChild(Q),Q.sheet){let ge="background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;";cl(Q.sheet,"[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"),cl(Q.sheet,`[data-input-otp]:autofill { ${ge} }`),cl(Q.sheet,`[data-input-otp]:-webkit-autofill { ${ge} }`),cl(Q.sheet,"@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"),cl(Q.sheet,"[data-input-otp] + * { pointer-events: all !important; }")}}let ue=()=>{ie&&ie.style.setProperty("--root-height",`${V.clientHeight}px`)};ue();let ve=new ResizeObserver(ue);return ve.observe(V),()=>{document.removeEventListener("selectionchange",pe,{capture:!0}),ve.disconnect()}},[]);let[G,re]=h.useState(!1),[J,P]=h.useState(!1),[M,R]=h.useState(null),[q,$]=h.useState(null);h.useEffect(()=>{rte(()=>{var V,ie,pe,ue;(V=L.current)==null||V.dispatchEvent(new Event("input"));let ve=(ie=L.current)==null?void 0:ie.selectionStart,Q=(pe=L.current)==null?void 0:pe.selectionEnd,ge=(ue=L.current)==null?void 0:ue.selectionDirection;ve!==null&&Q!==null&&(R(ve),$(Q),T.current.prev=[ve,Q,ge])})},[S,J]),h.useEffect(()=>{I!==void 0&&S!==I&&I.length<i&&S.length===i&&(u==null||u(S))},[i,u,I,S]);let K=ote({containerRef:F,inputRef:L,pushPasswordManagerStrategy:f,isFocused:J}),D=h.useCallback(V=>{let ie=V.currentTarget.value.slice(0,i);if(ie.length>0&&O&&!O.test(ie)){V.preventDefault();return}typeof I=="string"&&ie.length<I.length&&document.dispatchEvent(new Event("selectionchange")),A(ie)},[i,A,I,O]),E=h.useCallback(()=>{var V;if(L.current){let ie=Math.min(L.current.value.length,i-1),pe=L.current.value.length;(V=L.current)==null||V.setSelectionRange(ie,pe),R(ie),$(pe)}P(!0)},[i]),Z=h.useCallback(V=>{var ie,pe;let ue=L.current;if(!m&&(!X.current.isIOS||!V.clipboardData||!ue))return;let ve=V.clipboardData.getData("text/plain"),Q=m?m(ve):ve;V.preventDefault();let ge=(ie=L.current)==null?void 0:ie.selectionStart,De=(pe=L.current)==null?void 0:pe.selectionEnd,Ue=(ge!==De?S.slice(0,ge)+Q+S.slice(De):S.slice(0,ge)+Q+S.slice(ge)).slice(0,i);if(Ue.length>0&&O&&!O.test(Ue))return;ue.value=Ue,A(Ue);let Fe=Math.min(Ue.length,i-1),Ve=Ue.length;ue.setSelectionRange(Fe,Ve),R(Fe),$(Ve)},[i,A,O,S]),B=h.useMemo(()=>({position:"relative",cursor:y.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[y.disabled]),Y=h.useMemo(()=>({position:"absolute",inset:0,width:K.willPushPWMBadge?`calc(100% + ${K.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:K.willPushPWMBadge?`inset(0 ${K.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[K.PWM_BADGE_SPACE_WIDTH,K.willPushPWMBadge,o]),ae=h.useMemo(()=>h.createElement("input",ete(Jee({autoComplete:y.autoComplete||"one-time-code"},y),{"data-input-otp":!0,"data-input-otp-placeholder-shown":S.length===0||void 0,"data-input-otp-mss":M,"data-input-otp-mse":q,inputMode:d,pattern:O==null?void 0:O.source,"aria-placeholder":c,style:Y,maxLength:i,value:S,ref:L,onPaste:V=>{var ie;Z(V),(ie=y.onPaste)==null||ie.call(y,V)},onChange:D,onMouseOver:V=>{var ie;re(!0),(ie=y.onMouseOver)==null||ie.call(y,V)},onMouseLeave:V=>{var ie;re(!1),(ie=y.onMouseLeave)==null||ie.call(y,V)},onFocus:V=>{var ie;E(),(ie=y.onFocus)==null||ie.call(y,V)},onBlur:V=>{var ie;P(!1),(ie=y.onBlur)==null||ie.call(y,V)}})),[D,E,Z,d,Y,i,q,M,y,O==null?void 0:O.source,S]),ee=h.useMemo(()=>({slots:Array.from({length:i}).map((V,ie)=>{var pe;let ue=J&&M!==null&&q!==null&&(M===q&&ie===M||ie>=M&&ie<q),ve=S[ie]!==void 0?S[ie]:null,Q=S[0]!==void 0?null:(pe=c==null?void 0:c[ie])!=null?pe:null;return{char:ve,placeholderChar:Q,isActive:ue,hasFakeCaret:ue&&ve===null}}),isFocused:J,isHovering:!y.disabled&&G}),[J,G,i,q,M,y.disabled,S]),se=h.useMemo(()=>g?g(ee):h.createElement(fP.Provider,{value:ee},v),[v,ee,g]);return h.createElement(h.Fragment,null,x!==null&&h.createElement("noscript",null,h.createElement("style",null,x)),h.createElement("div",{ref:F,"data-input-otp-container":!0,style:B,className:p},se,h.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},ae)))});mP.displayName="Input";function cl(e,t){try{e.insertRule(t)}catch{console.error("input-otp could not insert CSS rule:",t)}}var lte=`
|
|
612
612
|
[data-input-otp] {
|
|
613
613
|
--nojs-bg: white !important;
|
|
614
614
|
--nojs-fg: black !important;
|
|
@@ -627,4 +627,4 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
|
|
|
627
627
|
--nojs-bg: black !important;
|
|
628
628
|
--nojs-fg: white !important;
|
|
629
629
|
}
|
|
630
|
-
}`;const hP=h.forwardRef(({className:e,containerClassName:t,...r},n)=>a.jsx(mP,{ref:n,containerClassName:z("flex items-center gap-2 has-[:disabled]:opacity-50",t),className:z("disabled:cursor-not-allowed",e),...r}));hP.displayName="InputOTP";const Fp=h.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:z("flex items-center",e),...t}));Fp.displayName="InputOTPGroup";const Ls=h.forwardRef(({index:e,className:t,...r},n)=>{const s=h.useContext(fP),{char:i,hasFakeCaret:o,isActive:l}=s.slots[e];return a.jsxs("div",{ref:n,className:z("relative flex h-10 w-10 items-center justify-center border-y border-r border-input text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md",l&&"z-10 ring-2 ring-ring ring-offset-background",t),...r,children:[i,o&&a.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:a.jsx("div",{className:"h-4 w-px animate-caret-blink bg-foreground duration-1000"})})]})});Ls.displayName="InputOTPSlot";const pP=h.forwardRef(({...e},t)=>a.jsx("div",{ref:t,role:"separator",...e,children:a.jsx(Ba,{})}));pP.displayName="InputOTPSeparator";function Oj({className:e}){return a.jsxs("svg",{className:e??"size-4",viewBox:"0 0 24 24","aria-hidden":"true",children:[a.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),a.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),a.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l3.66-2.84z",fill:"#FBBC05"}),a.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]})}function cte(){var B,Y,ae,ee;const[e,t]=Gl(),{user:r}=Ie(),{data:n,isLoading:s}=bO(),i=wZ(),o=jZ(),l=NZ(),c=CZ(),d=kZ(),u=SZ(),f=h.useRef(null),[m,p]=h.useState(""),[x,g]=h.useState(""),[v,y]=h.useState(""),[j,N]=h.useState(""),[w,k]=h.useState(!1),[b,C]=h.useState(!1),[_,S]=h.useState(""),[I,A]=h.useState(""),[O,L]=h.useState(""),[F,X]=h.useState(!1),[T,G]=h.useState(0),re=h.useRef(null);h.useEffect(()=>{n&&(p(n.first_name??""),g(n.last_name??""),y(n.designation??""),N(n.phone_number??""))},[n]),h.useEffect(()=>{e.get("linked")==="true"&&(H.success("Google account connected successfully"),t(se=>(se.delete("linked"),se),{replace:!0}))},[e,t]);const J=r&&(`${((B=r.first_name)==null?void 0:B[0])??""}${((Y=r.last_name)==null?void 0:Y[0])??""}`.toUpperCase()||((ee=(ae=r.email)==null?void 0:ae[0])==null?void 0:ee.toUpperCase()))||"?",P=se=>{var ie;const V=(ie=se.target.files)==null?void 0:ie[0];V&&(o.mutate(V,{onSuccess:()=>H.success("Avatar updated"),onError:pe=>H.error(pe.message??"Failed to upload avatar")}),se.target.value="")},M=()=>{l.mutate(void 0,{onSuccess:()=>H.success("Avatar removed"),onError:se=>H.error(se.message??"Failed to remove avatar")})},R=()=>{i.mutate({first_name:m,last_name:x,designation:v||null,phone_number:j||null},{onSuccess:()=>H.success("Profile updated"),onError:se=>H.error(se.message??"Failed to update profile")})},q=()=>{const se=localStorage.getItem("meridian_token");if(!se){H.error("You must be logged in to connect Google");return}window.location.href=`${Gi}/auth/google/link?token=${encodeURIComponent(se)}`},$=()=>{c.mutate(void 0,{onSuccess:()=>H.success("Google account disconnected"),onError:se=>H.error(se.message??"Failed to unlink Google account")})},K=h.useCallback(()=>{G(30),re.current&&clearInterval(re.current),re.current=setInterval(()=>{G(se=>se<=1?(re.current&&clearInterval(re.current),0):se-1)},1e3)},[]);h.useEffect(()=>()=>{re.current&&clearInterval(re.current)},[]);const D=()=>{d.mutate(void 0,{onSuccess:()=>{C(!0),K(),H.success("Verification code sent to your email")},onError:se=>H.error(se.message??"Failed to send verification code")})},E=()=>{if(I.length<8){H.error("New password must be at least 8 characters");return}if(I!==O){H.error("Passwords do not match");return}u.mutate({otp:_,new_password:I},{onSuccess:()=>{H.success("Password updated"),Z()},onError:se=>H.error(se.message??"Failed to set password")})},Z=()=>{k(!1),C(!1),S(""),A(""),L(""),X(!1),G(0),re.current&&clearInterval(re.current)};return a.jsx("div",{className:"p-2 md:h-full",children:a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden flex flex-col md:h-full",children:[a.jsx("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border shrink-0",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(tc,{className:"h-5 w-5 text-muted-foreground"}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-base font-semibold",children:"Profile"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Manage your personal details and account connections."})]})]})}),a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between px-4 md:px-6 py-4 border-b border-border gap-3",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Profile photo"}),a.jsxs("div",{className:"flex flex-1 items-center gap-4",children:[a.jsxs("div",{className:"relative",children:[a.jsxs(Rt,{className:"h-14 w-14 rounded-xl",children:[n!=null&&n.avatar_url?a.jsx(wl,{src:n.avatar_url,alt:"Avatar",className:"object-cover"}):null,a.jsx($t,{className:"rounded-xl bg-foreground text-background text-base font-medium",children:J})]}),o.isPending&&a.jsx("div",{className:"absolute inset-0 rounded-xl bg-black/40 flex items-center justify-center",children:a.jsx("span",{className:"text-white text-[10px]",children:"…"})})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ne,{variant:"outline",size:"sm",className:"h-8 gap-1.5",onClick:()=>{var se;return(se=f.current)==null?void 0:se.click()},disabled:o.isPending,children:[a.jsx(i5,{className:"size-3.5"}),"Change photo"]}),(n==null?void 0:n.avatar_url)&&a.jsxs(ne,{variant:"ghost",size:"sm",className:"h-8 gap-1.5 text-muted-foreground hover:text-destructive",onClick:M,disabled:l.isPending,children:[a.jsx(Mr,{className:"size-3.5"}),"Remove"]})]}),a.jsx("input",{ref:f,type:"file",accept:"image/*",className:"hidden",onChange:P})]})]}),a.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/10",children:a.jsx("p",{className:"text-xs text-muted-foreground",children:"Personal information"})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"First name"}),s?a.jsx(le,{className:"h-8 w-56"}):a.jsx(Ee,{value:m,onChange:se=>p(se.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"First name"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Last name"}),s?a.jsx(le,{className:"h-8 w-56"}):a.jsx(Ee,{value:x,onChange:se=>g(se.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"Last name"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Email"}),s?a.jsx(le,{className:"h-4 w-48"}):a.jsx("span",{className:"text-sm text-muted-foreground",children:(n==null?void 0:n.email)??"—"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Designation"}),s?a.jsx(le,{className:"h-8 w-56"}):a.jsx(Ee,{value:v,onChange:se=>y(se.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"e.g. Software Engineer"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Phone number"}),s?a.jsx(le,{className:"h-8 w-56"}):a.jsx(Ee,{value:j,onChange:se=>N(se.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"+1 555 000 0000"})]}),a.jsx("div",{className:"flex justify-end px-6 py-4 border-b border-border",children:a.jsx(ne,{size:"sm",onClick:R,disabled:i.isPending,children:i.isPending?"Saving…":"Save changes"})}),a.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/10",children:a.jsx("p",{className:"text-xs text-muted-foreground",children:"Connections"})}),a.jsx("div",{className:"px-4 md:px-6 py-3.5 border-b border-border",children:s?a.jsx(le,{className:"h-8 w-48"}):n!=null&&n.google_id?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(Oj,{className:"size-3.5 shrink-0"}),a.jsx("span",{className:"text-foreground font-medium",children:"Google"}),a.jsx(ta,{className:"size-3.5 text-emerald-500 shrink-0"}),a.jsx("span",{className:"text-foreground font-medium",children:"Connected"})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-sm text-muted-foreground truncate flex-1",children:n.email}),a.jsxs(ne,{size:"sm",className:"h-7 gap-1.5 bg-red-600 hover:bg-red-700 text-white shrink-0",onClick:$,disabled:c.isPending,children:[a.jsx(Jp,{className:"size-3.5"}),"Disconnect"]})]})]}):a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Oj,{className:"size-3.5 shrink-0"}),a.jsx("span",{className:"text-sm font-medium",children:"Google"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"Not connected"}),a.jsx(ne,{variant:"outline",size:"sm",className:"h-7 gap-1.5",onClick:q,children:"Connect"})]})}),a.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/10",children:a.jsx("p",{className:"text-xs text-muted-foreground",children:"Security"})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-4 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Password"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:(n==null?void 0:n.has_password)===!1?"No password set":"••••••••"}),a.jsxs(ne,{variant:"outline",size:"sm",className:"h-7 gap-1.5",onClick:()=>k(!0),children:[a.jsx(g5,{className:"size-3.5"}),(n==null?void 0:n.has_password)===!1?"Create password":"Change password"]})]})]}),a.jsx(Ua,{open:w,onOpenChange:se=>{se||Z()},children:a.jsxs(ca,{className:"sm:max-w-md",children:[a.jsxs(qa,{children:[a.jsx(Ha,{children:(n==null?void 0:n.has_password)===!1?"Create password":"Change password"}),a.jsxs(yo,{children:["We'll send a 6-digit verification code to ",a.jsx("span",{className:"font-medium text-foreground",children:n==null?void 0:n.email})]})]}),a.jsxs("div",{className:"space-y-4 py-2",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(mt,{className:"text-sm",children:"Verification code"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs(hP,{maxLength:6,value:_,onChange:S,children:[a.jsxs(Fp,{children:[a.jsx(Ls,{index:0}),a.jsx(Ls,{index:1}),a.jsx(Ls,{index:2})]}),a.jsx(pP,{}),a.jsxs(Fp,{children:[a.jsx(Ls,{index:3}),a.jsx(Ls,{index:4}),a.jsx(Ls,{index:5})]})]}),b?T>0?a.jsxs("span",{className:"text-xs text-muted-foreground shrink-0 tabular-nums w-16 text-center",children:["Resend in ",T,"s"]}):a.jsx(ne,{variant:"ghost",size:"sm",className:"h-8 shrink-0 text-indigo-500 hover:text-indigo-600",onClick:D,disabled:d.isPending,children:d.isPending?"Sending…":"Resend"}):a.jsx(ne,{variant:"outline",size:"sm",className:"h-8 shrink-0",onClick:D,disabled:d.isPending,children:d.isPending?"Sending…":"Send code"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(mt,{className:"text-sm",children:"New password"}),a.jsxs("div",{className:"relative",children:[a.jsx(Ee,{type:F?"text":"password",value:I,onChange:se=>A(se.target.value),className:"h-9 text-sm pr-9",placeholder:"At least 8 characters",autoComplete:"new-password"}),a.jsx("button",{type:"button",onClick:()=>X(!F),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,children:F?a.jsx(ec,{className:"size-3.5"}):a.jsx(wi,{className:"size-3.5"})})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(mt,{className:"text-sm",children:"Confirm password"}),a.jsx(Ee,{type:"password",value:O,onChange:se=>L(se.target.value),className:"h-9 text-sm",placeholder:"Re-enter new password",autoComplete:"new-password"})]})]}),a.jsxs(fx,{children:[a.jsx(ne,{variant:"ghost",size:"sm",onClick:Z,children:"Cancel"}),a.jsx(ne,{size:"sm",onClick:E,disabled:u.isPending||_.length!==6||!I||!O,children:u.isPending?"Saving…":(n==null?void 0:n.has_password)===!1?"Create password":"Update password"})]})]})})]})]})})}function dte(){const[e,t]=h.useState(""),[r,n]=h.useState(!1),s=sD(),i=o=>{o.preventDefault(),s.mutate({email:e},{onSuccess:()=>n(!0),onError:l=>H.error(l.message??"Something went wrong")})};return a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[360px]",children:[a.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[a.jsx("div",{className:"relative h-16 w-16 rounded-2xl bg-white dark:bg-card border border-border shadow-sm flex items-center justify-center",children:a.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:a.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:a.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})}),a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"text-lg font-semibold text-foreground",children:r?"Check your email":"Forgot password?"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:r?"If an account exists with that email, we've sent a reset link.":"Enter your email and we'll send you a reset link."})]})]}),r?a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-center text-muted-foreground",children:"Didn't receive an email? Check your spam folder or try again."}),a.jsx(ne,{variant:"outline",className:"w-full h-10",onClick:()=>{n(!1),t("")},children:"Try again"})]}):a.jsxs("form",{onSubmit:i,className:"space-y-2",children:[a.jsx(Ee,{type:"email",placeholder:"Email",value:e,onChange:o=>t(o.target.value),autoComplete:"email",required:!0,className:"bg-white dark:bg-card h-10",autoFocus:!0}),a.jsx("div",{className:"pt-1",children:a.jsx(ne,{type:"submit",className:"w-full h-10 font-medium",disabled:s.isPending,children:s.isPending?"Sending...":"Send reset link"})})]}),a.jsx("div",{className:"mt-6 text-center",children:a.jsxs(qr,{to:"/login",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(Jl,{className:"size-3.5"}),"Back to login"]})})]})})}function ute(){const[e]=Gl(),t=e.get("token")??"",r=pt(),n=iD(),[s,i]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState(!1),u=f=>{if(f.preventDefault(),s.length<8){H.error("Password must be at least 8 characters");return}if(s!==o){H.error("Passwords do not match");return}n.mutate({token:t,password:s},{onSuccess:()=>{H.success("Password has been reset. Please sign in."),r("/login",{replace:!0})},onError:m=>H.error(m.message??"Failed to reset password")})};return t?a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[360px]",children:[a.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[a.jsx("div",{className:"relative h-16 w-16 rounded-2xl bg-white dark:bg-card border border-border shadow-sm flex items-center justify-center",children:a.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:a.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:a.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})}),a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Set new password"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Enter your new password below."})]})]}),a.jsxs("form",{onSubmit:u,className:"space-y-2",children:[a.jsxs("div",{className:"relative",children:[a.jsx(Ee,{type:c?"text":"password",placeholder:"New password",value:s,onChange:f=>i(f.target.value),autoComplete:"new-password",required:!0,className:"bg-white dark:bg-card h-10 pr-10",autoFocus:!0}),a.jsx("button",{type:"button",onClick:()=>d(!c),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:c?a.jsx(ec,{className:"h-4 w-4"}):a.jsx(wi,{className:"h-4 w-4"})})]}),a.jsx(Ee,{type:"password",placeholder:"Confirm password",value:o,onChange:f=>l(f.target.value),autoComplete:"new-password",required:!0,className:"bg-white dark:bg-card h-10"}),a.jsx("div",{className:"pt-1",children:a.jsx(ne,{type:"submit",className:"w-full h-10 font-medium",disabled:n.isPending,children:n.isPending?"Resetting...":"Reset password"})})]}),a.jsx("div",{className:"mt-6 text-center",children:a.jsxs(qr,{to:"/login",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(Jl,{className:"size-3.5"}),"Back to login"]})})]})}):a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[360px] text-center space-y-4",children:[a.jsx("p",{className:"text-sm font-medium",children:"Invalid reset link"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"This link is missing or expired."}),a.jsx(qr,{to:"/forgot-password",children:a.jsx(ne,{variant:"outline",size:"sm",children:"Request a new link"})})]})})}const fte=h.lazy(()=>v1(()=>import("./ProjectTimelinePage-Dj_CbP_5.js"),__vite__mapDeps([0,1,2,3,4,5])).then(e=>({default:e.ProjectTimelinePage}))),mte=h.lazy(()=>v1(()=>import("./WorkspaceReportingPage-B3acX8jP.js"),__vite__mapDeps([6,1,2,3,4,5])).then(e=>({default:e.WorkspaceReportingPage})));function Ts({children:e}){const{isAuthenticated:t}=Ie();return t?a.jsx(a.Fragment,{children:e}):a.jsx(Xn,{to:"/login",replace:!0})}function hte({children:e}){var r;const{user:t}=Ie();return(r=t==null?void 0:t.roles)!=null&&r.includes("super-admin")?a.jsx(a.Fragment,{children:e}):a.jsx(Xn,{to:"/",replace:!0})}function Pj({children:e}){var s,i,o;const{user:t}=Ie(),r=((s=t==null?void 0:t.roles)==null?void 0:s.includes("super-admin"))||((i=t==null?void 0:t.roles)==null?void 0:i.includes("admin")),n=(o=t==null?void 0:t.permissions)==null?void 0:o.includes("workspace:admin");return r||n?a.jsx(a.Fragment,{children:e}):a.jsx(Xn,{to:"/",replace:!0})}function hd({children:e}){const{isAuthenticated:t}=Ie(),{data:r}=Bu(),n=Kl();return t?a.jsx(Xn,{to:"/",replace:!0}):r!=null&&r.needsSetup&&n.pathname==="/login"?a.jsx(Xn,{to:"/register",replace:!0}):r&&!r.needsSetup&&n.pathname==="/register"?a.jsx(Xn,{to:"/login",replace:!0}):a.jsx(a.Fragment,{children:e})}function pte(){const{workspace:e,setWorkspace:t,user:r}=Ie(),n=pt(),{data:s,isLoading:i}=xo();return h.useEffect(()=>{var o,l;if(!i&&s!==void 0){if(e){if(s.some(d=>d.id===e.id)){n(`/${e.slug}/projects`,{replace:!0});return}t(null)}if(s.length>0){const c=s[0];t({id:c.id,name:c.name,slug:c.slug}),n(`/${c.slug}/projects`,{replace:!0})}else{const c=((o=r==null?void 0:r.roles)==null?void 0:o.includes("super-admin"))||((l=r==null?void 0:r.roles)==null?void 0:l.includes("admin"));n(c?"/setup":"/awaiting-access",{replace:!0})}}},[s,i,n,t,r,e]),a.jsx("div",{className:"min-h-screen flex items-center justify-center",children:a.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})})}function xte(){const{workspace:e}=zt(),{workspace:t,setWorkspace:r,user:n}=Ie();dD();const s=pt(),{data:i,isLoading:o,isFetching:l}=xo();return h.useEffect(()=>{var d,u;if(o||!i)return;const c=i.find(f=>f.slug===e);if(c)c.id!==(t==null?void 0:t.id)&&r({id:c.id,name:c.name,slug:c.slug});else{if(l)return;if(i.length>0)r({id:i[0].id,name:i[0].name,slug:i[0].slug}),s(`/${i[0].slug}/projects`,{replace:!0});else{r(null);const f=((d=n==null?void 0:n.roles)==null?void 0:d.includes("super-admin"))||((u=n==null?void 0:n.roles)==null?void 0:u.includes("admin"));s(f?"/setup":"/awaiting-access",{replace:!0})}}},[i,e,o,l,t==null?void 0:t.id,s,r,n]),o||!t||t.slug!==e?a.jsx("div",{className:"min-h-screen flex items-center justify-center",children:a.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})}):a.jsxs(a.Fragment,{children:[a.jsx(HD,{}),a.jsx(OT,{})]})}function gte(){return a.jsxs(kP,{children:[a.jsx(Ye,{path:"/login",element:a.jsx(hd,{children:a.jsx(ET,{})})}),a.jsx(Ye,{path:"/register",element:a.jsx(hd,{children:a.jsx(AT,{})})}),a.jsx(Ye,{path:"/forgot-password",element:a.jsx(hd,{children:a.jsx(dte,{})})}),a.jsx(Ye,{path:"/reset-password",element:a.jsx(hd,{children:a.jsx(ute,{})})}),a.jsx(Ye,{path:"/invite/:token",element:a.jsx(bz,{})}),a.jsx(Ye,{path:"/oauth/google/callback",element:a.jsx(Vee,{})}),a.jsx(Ye,{path:"/share/:token",element:a.jsx(Yee,{})}),a.jsx(Ye,{path:"/reporting",element:a.jsx(Ts,{children:a.jsx(Pj,{children:a.jsx(QD,{})})}),children:a.jsx(Ye,{index:!0,element:a.jsx(pZ,{})})}),a.jsx(Ye,{path:"/org/settings",element:a.jsx(Ts,{children:a.jsx(Pj,{children:a.jsx(eT,{})})}),children:a.jsx(Ye,{index:!0,element:a.jsx(TZ,{})})}),a.jsx(Ye,{path:"/profile",element:a.jsx(Ts,{children:a.jsx(nT,{})}),children:a.jsx(Ye,{index:!0,element:a.jsx(cte,{})})}),a.jsx(Ye,{path:"/setup",element:a.jsx(Ts,{children:a.jsx(DT,{})})}),a.jsx(Ye,{path:"/awaiting-access",element:a.jsx(Ts,{children:a.jsx(TT,{})})}),a.jsx(Ye,{index:!0,element:a.jsx(Ts,{children:a.jsx(pte,{})})}),a.jsxs(Ye,{path:"/:workspace",element:a.jsx(Ts,{children:a.jsx(xte,{})}),children:[a.jsx(Ye,{index:!0,element:a.jsx(Xn,{to:"projects",replace:!0})}),a.jsx(Ye,{path:"projects",element:a.jsx(WI,{})}),a.jsxs(Ye,{path:"projects/:projectKey",element:a.jsx(GD,{}),children:[a.jsx(Ye,{path:"board",element:a.jsx(h6,{})}),a.jsx(Ye,{path:"issues",element:a.jsx(p6,{})}),a.jsx(Ye,{path:"issues/new",element:a.jsx(q6,{})}),a.jsx(Ye,{path:"issues/:issueId",element:a.jsx(L6,{})}),a.jsx(Ye,{path:"sprints",element:a.jsx(az,{})}),a.jsx(Ye,{path:"timeline",element:a.jsx(h.Suspense,{fallback:a.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading…"}),children:a.jsx(fte,{})})}),a.jsx(Ye,{path:"access",element:a.jsx(I6,{})}),a.jsx(Ye,{path:"reports",element:a.jsx(xZ,{})}),a.jsx(Ye,{path:"activity",element:a.jsx(bZ,{})})]}),a.jsx(Ye,{path:"my-tasks",element:a.jsx(Z6,{})}),a.jsx(Ye,{path:"notifications",element:a.jsx(ez,{})}),a.jsx(Ye,{path:"reporting",element:a.jsx(h.Suspense,{fallback:a.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading…"}),children:a.jsx(mte,{})})}),a.jsx(Ye,{path:"settings",element:a.jsx(pz,{})}),a.jsx(Ye,{path:"roles",element:a.jsx(hte,{children:a.jsx(vz,{})})})]}),a.jsx(Ye,{path:"*",element:a.jsx(Xn,{to:"/",replace:!0})})]})}window.__React=W;window.__ReactJsxRuntime=yP;const vte=new bP({defaultOptions:{queries:{staleTime:1e3*30,retry:1}}});(async()=>{let e=[];try{const r=await import("/admin-extensions.js");Array.isArray(r==null?void 0:r.default)&&(e=r.default)}catch{}g1(document.getElementById("root")).render(a.jsx(h.StrictMode,{children:a.jsx(ZA,{widgets:[...B5,...e],children:a.jsx(gA,{children:a.jsxs(wP,{client:vte,children:[a.jsx(vA,{children:a.jsx(yA,{children:a.jsx(SP,{children:a.jsxs(Iu,{delayDuration:300,children:[a.jsx(gte,{}),a.jsx(iA,{position:"bottom-right",toastOptions:{classNames:{toast:"bg-white dark:bg-card border border-border text-foreground text-sm rounded-lg shadow-sm",description:"text-muted-foreground"}}})]})})})}),a.jsx(DE,{initialIsOpen:!1})]})})})}))})();export{Ie as A,ne as B,of as C,tx as D,Lee as G,Ek as I,dt as P,pZ as R,Cr as W,v1 as _,Ur as a,Wa as b,Mh as c,Ql as d,ko as e,fe as f,So as g,Sx as h,y4 as i,Cx as j,ks as k,Tee as l,gh as m,xh as n,Fee as o,Aee as p,zee as q,vh as r,UN as s,_j as t,oN as u,iP as v,Bee as w,H as x,Tt as y,oe as z};
|
|
630
|
+
}`;const hP=h.forwardRef(({className:e,containerClassName:t,...r},n)=>a.jsx(mP,{ref:n,containerClassName:z("flex items-center gap-2 has-[:disabled]:opacity-50",t),className:z("disabled:cursor-not-allowed",e),...r}));hP.displayName="InputOTP";const Fp=h.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:z("flex items-center",e),...t}));Fp.displayName="InputOTPGroup";const Ls=h.forwardRef(({index:e,className:t,...r},n)=>{const s=h.useContext(fP),{char:i,hasFakeCaret:o,isActive:l}=s.slots[e];return a.jsxs("div",{ref:n,className:z("relative flex h-10 w-10 items-center justify-center border-y border-r border-input text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md",l&&"z-10 ring-2 ring-ring ring-offset-background",t),...r,children:[i,o&&a.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:a.jsx("div",{className:"h-4 w-px animate-caret-blink bg-foreground duration-1000"})})]})});Ls.displayName="InputOTPSlot";const pP=h.forwardRef(({...e},t)=>a.jsx("div",{ref:t,role:"separator",...e,children:a.jsx(Ba,{})}));pP.displayName="InputOTPSeparator";function Oj({className:e}){return a.jsxs("svg",{className:e??"size-4",viewBox:"0 0 24 24","aria-hidden":"true",children:[a.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),a.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),a.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l3.66-2.84z",fill:"#FBBC05"}),a.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]})}function cte(){var B,Y,ae,ee;const[e,t]=Gl(),{user:r}=Ie(),{data:n,isLoading:s}=bO(),i=wZ(),o=jZ(),l=NZ(),c=CZ(),d=kZ(),u=SZ(),f=h.useRef(null),[m,p]=h.useState(""),[x,g]=h.useState(""),[v,y]=h.useState(""),[j,N]=h.useState(""),[w,k]=h.useState(!1),[b,C]=h.useState(!1),[_,S]=h.useState(""),[I,A]=h.useState(""),[O,L]=h.useState(""),[F,X]=h.useState(!1),[T,G]=h.useState(0),re=h.useRef(null);h.useEffect(()=>{n&&(p(n.first_name??""),g(n.last_name??""),y(n.designation??""),N(n.phone_number??""))},[n]),h.useEffect(()=>{e.get("linked")==="true"&&(H.success("Google account connected successfully"),t(se=>(se.delete("linked"),se),{replace:!0}))},[e,t]);const J=r&&(`${((B=r.first_name)==null?void 0:B[0])??""}${((Y=r.last_name)==null?void 0:Y[0])??""}`.toUpperCase()||((ee=(ae=r.email)==null?void 0:ae[0])==null?void 0:ee.toUpperCase()))||"?",P=se=>{var ie;const V=(ie=se.target.files)==null?void 0:ie[0];V&&(o.mutate(V,{onSuccess:()=>H.success("Avatar updated"),onError:pe=>H.error(pe.message??"Failed to upload avatar")}),se.target.value="")},M=()=>{l.mutate(void 0,{onSuccess:()=>H.success("Avatar removed"),onError:se=>H.error(se.message??"Failed to remove avatar")})},R=()=>{i.mutate({first_name:m,last_name:x,designation:v||null,phone_number:j||null},{onSuccess:()=>H.success("Profile updated"),onError:se=>H.error(se.message??"Failed to update profile")})},q=()=>{const se=localStorage.getItem("meridian_token");if(!se){H.error("You must be logged in to connect Google");return}window.location.href=`${Gi}/auth/google/link?token=${encodeURIComponent(se)}`},$=()=>{c.mutate(void 0,{onSuccess:()=>H.success("Google account disconnected"),onError:se=>H.error(se.message??"Failed to unlink Google account")})},K=h.useCallback(()=>{G(30),re.current&&clearInterval(re.current),re.current=setInterval(()=>{G(se=>se<=1?(re.current&&clearInterval(re.current),0):se-1)},1e3)},[]);h.useEffect(()=>()=>{re.current&&clearInterval(re.current)},[]);const D=()=>{d.mutate(void 0,{onSuccess:()=>{C(!0),K(),H.success("Verification code sent to your email")},onError:se=>H.error(se.message??"Failed to send verification code")})},E=()=>{if(I.length<8){H.error("New password must be at least 8 characters");return}if(I!==O){H.error("Passwords do not match");return}u.mutate({otp:_,new_password:I},{onSuccess:()=>{H.success("Password updated"),Z()},onError:se=>H.error(se.message??"Failed to set password")})},Z=()=>{k(!1),C(!1),S(""),A(""),L(""),X(!1),G(0),re.current&&clearInterval(re.current)};return a.jsx("div",{className:"p-2 md:h-full",children:a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden flex flex-col md:h-full",children:[a.jsx("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border shrink-0",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(tc,{className:"h-5 w-5 text-muted-foreground"}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-base font-semibold",children:"Profile"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Manage your personal details and account connections."})]})]})}),a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between px-4 md:px-6 py-4 border-b border-border gap-3",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Profile photo"}),a.jsxs("div",{className:"flex flex-1 items-center gap-4",children:[a.jsxs("div",{className:"relative",children:[a.jsxs(Rt,{className:"h-14 w-14 rounded-xl",children:[n!=null&&n.avatar_url?a.jsx(wl,{src:n.avatar_url,alt:"Avatar",className:"object-cover"}):null,a.jsx($t,{className:"rounded-xl bg-foreground text-background text-base font-medium",children:J})]}),o.isPending&&a.jsx("div",{className:"absolute inset-0 rounded-xl bg-black/40 flex items-center justify-center",children:a.jsx("span",{className:"text-white text-[10px]",children:"…"})})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ne,{variant:"outline",size:"sm",className:"h-8 gap-1.5",onClick:()=>{var se;return(se=f.current)==null?void 0:se.click()},disabled:o.isPending,children:[a.jsx(i5,{className:"size-3.5"}),"Change photo"]}),(n==null?void 0:n.avatar_url)&&a.jsxs(ne,{variant:"ghost",size:"sm",className:"h-8 gap-1.5 text-muted-foreground hover:text-destructive",onClick:M,disabled:l.isPending,children:[a.jsx(Mr,{className:"size-3.5"}),"Remove"]})]}),a.jsx("input",{ref:f,type:"file",accept:"image/*",className:"hidden",onChange:P})]})]}),a.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/10",children:a.jsx("p",{className:"text-xs text-muted-foreground",children:"Personal information"})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"First name"}),s?a.jsx(le,{className:"h-8 w-56"}):a.jsx(Ee,{value:m,onChange:se=>p(se.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"First name"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Last name"}),s?a.jsx(le,{className:"h-8 w-56"}):a.jsx(Ee,{value:x,onChange:se=>g(se.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"Last name"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Email"}),s?a.jsx(le,{className:"h-4 w-48"}):a.jsx("span",{className:"text-sm text-muted-foreground",children:(n==null?void 0:n.email)??"—"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Designation"}),s?a.jsx(le,{className:"h-8 w-56"}):a.jsx(Ee,{value:v,onChange:se=>y(se.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"e.g. Software Engineer"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Phone number"}),s?a.jsx(le,{className:"h-8 w-56"}):a.jsx(Ee,{value:j,onChange:se=>N(se.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"+1 555 000 0000"})]}),a.jsx("div",{className:"flex justify-end px-6 py-4 border-b border-border",children:a.jsx(ne,{size:"sm",onClick:R,disabled:i.isPending,children:i.isPending?"Saving…":"Save changes"})}),a.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/10",children:a.jsx("p",{className:"text-xs text-muted-foreground",children:"Connections"})}),a.jsx("div",{className:"px-4 md:px-6 py-3.5 border-b border-border",children:s?a.jsx(le,{className:"h-8 w-48"}):n!=null&&n.google_id?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(Oj,{className:"size-3.5 shrink-0"}),a.jsx("span",{className:"text-foreground font-medium",children:"Google"}),a.jsx(ta,{className:"size-3.5 text-emerald-500 shrink-0"}),a.jsx("span",{className:"text-foreground font-medium",children:"Connected"})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-sm text-muted-foreground truncate flex-1",children:n.email}),a.jsxs(ne,{size:"sm",className:"h-7 gap-1.5 bg-red-600 hover:bg-red-700 text-white shrink-0",onClick:$,disabled:c.isPending,children:[a.jsx(Jp,{className:"size-3.5"}),"Disconnect"]})]})]}):a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Oj,{className:"size-3.5 shrink-0"}),a.jsx("span",{className:"text-sm font-medium",children:"Google"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"Not connected"}),a.jsx(ne,{variant:"outline",size:"sm",className:"h-7 gap-1.5",onClick:q,children:"Connect"})]})}),a.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/10",children:a.jsx("p",{className:"text-xs text-muted-foreground",children:"Security"})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-4 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Password"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:(n==null?void 0:n.has_password)===!1?"No password set":"••••••••"}),a.jsxs(ne,{variant:"outline",size:"sm",className:"h-7 gap-1.5",onClick:()=>k(!0),children:[a.jsx(g5,{className:"size-3.5"}),(n==null?void 0:n.has_password)===!1?"Create password":"Change password"]})]})]}),a.jsx(Ua,{open:w,onOpenChange:se=>{se||Z()},children:a.jsxs(ca,{className:"sm:max-w-md",children:[a.jsxs(qa,{children:[a.jsx(Ha,{children:(n==null?void 0:n.has_password)===!1?"Create password":"Change password"}),a.jsxs(yo,{children:["We'll send a 6-digit verification code to ",a.jsx("span",{className:"font-medium text-foreground",children:n==null?void 0:n.email})]})]}),a.jsxs("div",{className:"space-y-4 py-2",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(mt,{className:"text-sm",children:"Verification code"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs(hP,{maxLength:6,value:_,onChange:S,children:[a.jsxs(Fp,{children:[a.jsx(Ls,{index:0}),a.jsx(Ls,{index:1}),a.jsx(Ls,{index:2})]}),a.jsx(pP,{}),a.jsxs(Fp,{children:[a.jsx(Ls,{index:3}),a.jsx(Ls,{index:4}),a.jsx(Ls,{index:5})]})]}),b?T>0?a.jsxs("span",{className:"text-xs text-muted-foreground shrink-0 tabular-nums w-16 text-center",children:["Resend in ",T,"s"]}):a.jsx(ne,{variant:"ghost",size:"sm",className:"h-8 shrink-0 text-indigo-500 hover:text-indigo-600",onClick:D,disabled:d.isPending,children:d.isPending?"Sending…":"Resend"}):a.jsx(ne,{variant:"outline",size:"sm",className:"h-8 shrink-0",onClick:D,disabled:d.isPending,children:d.isPending?"Sending…":"Send code"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(mt,{className:"text-sm",children:"New password"}),a.jsxs("div",{className:"relative",children:[a.jsx(Ee,{type:F?"text":"password",value:I,onChange:se=>A(se.target.value),className:"h-9 text-sm pr-9",placeholder:"At least 8 characters",autoComplete:"new-password"}),a.jsx("button",{type:"button",onClick:()=>X(!F),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,children:F?a.jsx(ec,{className:"size-3.5"}):a.jsx(wi,{className:"size-3.5"})})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(mt,{className:"text-sm",children:"Confirm password"}),a.jsx(Ee,{type:"password",value:O,onChange:se=>L(se.target.value),className:"h-9 text-sm",placeholder:"Re-enter new password",autoComplete:"new-password"})]})]}),a.jsxs(fx,{children:[a.jsx(ne,{variant:"ghost",size:"sm",onClick:Z,children:"Cancel"}),a.jsx(ne,{size:"sm",onClick:E,disabled:u.isPending||_.length!==6||!I||!O,children:u.isPending?"Saving…":(n==null?void 0:n.has_password)===!1?"Create password":"Update password"})]})]})})]})]})})}function dte(){const[e,t]=h.useState(""),[r,n]=h.useState(!1),s=sD(),i=o=>{o.preventDefault(),s.mutate({email:e},{onSuccess:()=>n(!0),onError:l=>H.error(l.message??"Something went wrong")})};return a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[360px]",children:[a.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[a.jsx("div",{className:"relative h-16 w-16 rounded-2xl bg-white dark:bg-card border border-border shadow-sm flex items-center justify-center",children:a.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:a.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:a.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})}),a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"text-lg font-semibold text-foreground",children:r?"Check your email":"Forgot password?"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:r?"If an account exists with that email, we've sent a reset link.":"Enter your email and we'll send you a reset link."})]})]}),r?a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-center text-muted-foreground",children:"Didn't receive an email? Check your spam folder or try again."}),a.jsx(ne,{variant:"outline",className:"w-full h-10",onClick:()=>{n(!1),t("")},children:"Try again"})]}):a.jsxs("form",{onSubmit:i,className:"space-y-2",children:[a.jsx(Ee,{type:"email",placeholder:"Email",value:e,onChange:o=>t(o.target.value),autoComplete:"email",required:!0,className:"bg-white dark:bg-card h-10",autoFocus:!0}),a.jsx("div",{className:"pt-1",children:a.jsx(ne,{type:"submit",className:"w-full h-10 font-medium",disabled:s.isPending,children:s.isPending?"Sending...":"Send reset link"})})]}),a.jsx("div",{className:"mt-6 text-center",children:a.jsxs(qr,{to:"/login",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(Jl,{className:"size-3.5"}),"Back to login"]})})]})})}function ute(){const[e]=Gl(),t=e.get("token")??"",r=pt(),n=iD(),[s,i]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState(!1),u=f=>{if(f.preventDefault(),s.length<8){H.error("Password must be at least 8 characters");return}if(s!==o){H.error("Passwords do not match");return}n.mutate({token:t,password:s},{onSuccess:()=>{H.success("Password has been reset. Please sign in."),r("/login",{replace:!0})},onError:m=>H.error(m.message??"Failed to reset password")})};return t?a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[360px]",children:[a.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[a.jsx("div",{className:"relative h-16 w-16 rounded-2xl bg-white dark:bg-card border border-border shadow-sm flex items-center justify-center",children:a.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:a.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:a.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})}),a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Set new password"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Enter your new password below."})]})]}),a.jsxs("form",{onSubmit:u,className:"space-y-2",children:[a.jsxs("div",{className:"relative",children:[a.jsx(Ee,{type:c?"text":"password",placeholder:"New password",value:s,onChange:f=>i(f.target.value),autoComplete:"new-password",required:!0,className:"bg-white dark:bg-card h-10 pr-10",autoFocus:!0}),a.jsx("button",{type:"button",onClick:()=>d(!c),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:c?a.jsx(ec,{className:"h-4 w-4"}):a.jsx(wi,{className:"h-4 w-4"})})]}),a.jsx(Ee,{type:"password",placeholder:"Confirm password",value:o,onChange:f=>l(f.target.value),autoComplete:"new-password",required:!0,className:"bg-white dark:bg-card h-10"}),a.jsx("div",{className:"pt-1",children:a.jsx(ne,{type:"submit",className:"w-full h-10 font-medium",disabled:n.isPending,children:n.isPending?"Resetting...":"Reset password"})})]}),a.jsx("div",{className:"mt-6 text-center",children:a.jsxs(qr,{to:"/login",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(Jl,{className:"size-3.5"}),"Back to login"]})})]})}):a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[360px] text-center space-y-4",children:[a.jsx("p",{className:"text-sm font-medium",children:"Invalid reset link"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"This link is missing or expired."}),a.jsx(qr,{to:"/forgot-password",children:a.jsx(ne,{variant:"outline",size:"sm",children:"Request a new link"})})]})})}const fte=h.lazy(()=>v1(()=>import("./ProjectTimelinePage-BldkS_kf.js"),__vite__mapDeps([0,1,2,3,4,5])).then(e=>({default:e.ProjectTimelinePage}))),mte=h.lazy(()=>v1(()=>import("./WorkspaceReportingPage-YSDy9h9h.js"),__vite__mapDeps([6,1,2,3,4,5])).then(e=>({default:e.WorkspaceReportingPage})));function Ts({children:e}){const{isAuthenticated:t}=Ie();return t?a.jsx(a.Fragment,{children:e}):a.jsx(Xn,{to:"/login",replace:!0})}function hte({children:e}){var r;const{user:t}=Ie();return(r=t==null?void 0:t.roles)!=null&&r.includes("super-admin")?a.jsx(a.Fragment,{children:e}):a.jsx(Xn,{to:"/",replace:!0})}function Pj({children:e}){var s,i,o;const{user:t}=Ie(),r=((s=t==null?void 0:t.roles)==null?void 0:s.includes("super-admin"))||((i=t==null?void 0:t.roles)==null?void 0:i.includes("admin")),n=(o=t==null?void 0:t.permissions)==null?void 0:o.includes("workspace:admin");return r||n?a.jsx(a.Fragment,{children:e}):a.jsx(Xn,{to:"/",replace:!0})}function hd({children:e}){const{isAuthenticated:t}=Ie(),{data:r}=Bu(),n=Kl();return t?a.jsx(Xn,{to:"/",replace:!0}):r!=null&&r.needsSetup&&n.pathname==="/login"?a.jsx(Xn,{to:"/register",replace:!0}):r&&!r.needsSetup&&n.pathname==="/register"?a.jsx(Xn,{to:"/login",replace:!0}):a.jsx(a.Fragment,{children:e})}function pte(){const{workspace:e,setWorkspace:t,user:r}=Ie(),n=pt(),{data:s,isLoading:i}=xo();return h.useEffect(()=>{var o,l;if(!i&&s!==void 0){if(e){if(s.some(d=>d.id===e.id)){n(`/${e.slug}/projects`,{replace:!0});return}t(null)}if(s.length>0){const c=s[0];t({id:c.id,name:c.name,slug:c.slug}),n(`/${c.slug}/projects`,{replace:!0})}else{const c=((o=r==null?void 0:r.roles)==null?void 0:o.includes("super-admin"))||((l=r==null?void 0:r.roles)==null?void 0:l.includes("admin"));n(c?"/setup":"/awaiting-access",{replace:!0})}}},[s,i,n,t,r,e]),a.jsx("div",{className:"min-h-screen flex items-center justify-center",children:a.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})})}function xte(){const{workspace:e}=zt(),{workspace:t,setWorkspace:r,user:n}=Ie();dD();const s=pt(),{data:i,isLoading:o,isFetching:l}=xo();return h.useEffect(()=>{var d,u;if(o||!i)return;const c=i.find(f=>f.slug===e);if(c)c.id!==(t==null?void 0:t.id)&&r({id:c.id,name:c.name,slug:c.slug});else{if(l)return;if(i.length>0)r({id:i[0].id,name:i[0].name,slug:i[0].slug}),s(`/${i[0].slug}/projects`,{replace:!0});else{r(null);const f=((d=n==null?void 0:n.roles)==null?void 0:d.includes("super-admin"))||((u=n==null?void 0:n.roles)==null?void 0:u.includes("admin"));s(f?"/setup":"/awaiting-access",{replace:!0})}}},[i,e,o,l,t==null?void 0:t.id,s,r,n]),o||!t||t.slug!==e?a.jsx("div",{className:"min-h-screen flex items-center justify-center",children:a.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})}):a.jsxs(a.Fragment,{children:[a.jsx(HD,{}),a.jsx(OT,{})]})}function gte(){return a.jsxs(kP,{children:[a.jsx(Ye,{path:"/login",element:a.jsx(hd,{children:a.jsx(ET,{})})}),a.jsx(Ye,{path:"/register",element:a.jsx(hd,{children:a.jsx(AT,{})})}),a.jsx(Ye,{path:"/forgot-password",element:a.jsx(hd,{children:a.jsx(dte,{})})}),a.jsx(Ye,{path:"/reset-password",element:a.jsx(hd,{children:a.jsx(ute,{})})}),a.jsx(Ye,{path:"/invite/:token",element:a.jsx(bz,{})}),a.jsx(Ye,{path:"/oauth/google/callback",element:a.jsx(Vee,{})}),a.jsx(Ye,{path:"/share/:token",element:a.jsx(Yee,{})}),a.jsx(Ye,{path:"/reporting",element:a.jsx(Ts,{children:a.jsx(Pj,{children:a.jsx(QD,{})})}),children:a.jsx(Ye,{index:!0,element:a.jsx(pZ,{})})}),a.jsx(Ye,{path:"/org/settings",element:a.jsx(Ts,{children:a.jsx(Pj,{children:a.jsx(eT,{})})}),children:a.jsx(Ye,{index:!0,element:a.jsx(TZ,{})})}),a.jsx(Ye,{path:"/profile",element:a.jsx(Ts,{children:a.jsx(nT,{})}),children:a.jsx(Ye,{index:!0,element:a.jsx(cte,{})})}),a.jsx(Ye,{path:"/setup",element:a.jsx(Ts,{children:a.jsx(DT,{})})}),a.jsx(Ye,{path:"/awaiting-access",element:a.jsx(Ts,{children:a.jsx(TT,{})})}),a.jsx(Ye,{index:!0,element:a.jsx(Ts,{children:a.jsx(pte,{})})}),a.jsxs(Ye,{path:"/:workspace",element:a.jsx(Ts,{children:a.jsx(xte,{})}),children:[a.jsx(Ye,{index:!0,element:a.jsx(Xn,{to:"projects",replace:!0})}),a.jsx(Ye,{path:"projects",element:a.jsx(WI,{})}),a.jsxs(Ye,{path:"projects/:projectKey",element:a.jsx(GD,{}),children:[a.jsx(Ye,{path:"board",element:a.jsx(h6,{})}),a.jsx(Ye,{path:"issues",element:a.jsx(p6,{})}),a.jsx(Ye,{path:"issues/new",element:a.jsx(q6,{})}),a.jsx(Ye,{path:"issues/:issueId",element:a.jsx(L6,{})}),a.jsx(Ye,{path:"sprints",element:a.jsx(az,{})}),a.jsx(Ye,{path:"timeline",element:a.jsx(h.Suspense,{fallback:a.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading…"}),children:a.jsx(fte,{})})}),a.jsx(Ye,{path:"access",element:a.jsx(I6,{})}),a.jsx(Ye,{path:"reports",element:a.jsx(xZ,{})}),a.jsx(Ye,{path:"activity",element:a.jsx(bZ,{})})]}),a.jsx(Ye,{path:"my-tasks",element:a.jsx(Z6,{})}),a.jsx(Ye,{path:"notifications",element:a.jsx(ez,{})}),a.jsx(Ye,{path:"reporting",element:a.jsx(h.Suspense,{fallback:a.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading…"}),children:a.jsx(mte,{})})}),a.jsx(Ye,{path:"settings",element:a.jsx(pz,{})}),a.jsx(Ye,{path:"roles",element:a.jsx(hte,{children:a.jsx(vz,{})})})]}),a.jsx(Ye,{path:"*",element:a.jsx(Xn,{to:"/",replace:!0})})]})}window.__React=W;window.__ReactJsxRuntime=yP;const vte=new bP({defaultOptions:{queries:{staleTime:1e3*30,retry:1}}});(async()=>{let e=[];try{const r=await import("/admin-extensions.js");Array.isArray(r==null?void 0:r.default)&&(e=r.default)}catch{}g1(document.getElementById("root")).render(a.jsx(h.StrictMode,{children:a.jsx(ZA,{widgets:[...B5,...e],children:a.jsx(gA,{children:a.jsxs(wP,{client:vte,children:[a.jsx(vA,{children:a.jsx(yA,{children:a.jsx(SP,{children:a.jsxs(Iu,{delayDuration:300,children:[a.jsx(gte,{}),a.jsx(iA,{position:"bottom-right",toastOptions:{classNames:{toast:"bg-white dark:bg-card border border-border text-foreground text-sm rounded-lg shadow-sm",description:"text-muted-foreground"}}})]})})})}),a.jsx(DE,{initialIsOpen:!1})]})})})}))})();export{Ie as A,ne as B,of as C,tx as D,Lee as G,Ek as I,dt as P,pZ as R,Cr as W,v1 as _,Ur as a,Wa as b,Mh as c,Ql as d,ko as e,fe as f,So as g,Sx as h,y4 as i,Cx as j,ks as k,Tee as l,gh as m,xh as n,Fee as o,Aee as p,zee as q,vh as r,UN as s,_j as t,oN as u,iP as v,Bee as w,H as x,Tt as y,oe as z};
|