@meridianjs/admin-dashboard 1.16.0 → 1.17.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.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProjectTimelinePage-J-5wXOET.js","assets/vendor-query-CaIGp3JB.js","assets/vendor-react-Lycsri1F.js","assets/vendor-radix-PlE_1rlU.js","assets/vendor-dnd-DuI-3XLF.js","assets/vendor-editor-Dx6DLqmo.js","assets/WorkspaceReportingPage-DF5TdtKX.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProjectTimelinePage-CKfZVEnn.js","assets/vendor-query-CaIGp3JB.js","assets/vendor-react-Lycsri1F.js","assets/vendor-radix-PlE_1rlU.js","assets/vendor-dnd-DuI-3XLF.js","assets/vendor-editor-Dx6DLqmo.js","assets/WorkspaceReportingPage-ByyRyiRS.js"])))=>i.map(i=>d[i]);
2
2
  var xO=Object.defineProperty;var gO=(e,t,r)=>t in e?xO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var dm=(e,t,r)=>gO(e,typeof t!="symbol"?t+"":t,r);import{j as a,u as $e,a as Ne,b as ye,R as vO,Q as yO,c as bO}from"./vendor-query-CaIGp3JB.js";import{a as Rp,c as B,r as h,b as wO,u as zt,d as Wl,N as jn,e as pt,L as Mr,O as Ul,f as ql,h as Qn,g as Wa,R as jO,i as Ec,j as NO,k as Ke,B as kO}from"./vendor-react-Lycsri1F.js";import{C as kj,R as SO,T as CO,P as _O,S as $p,a as Sj,O as yi,b as Hl,c as bi,d as Pu,e as ho,D as po,f as Kl,g as Cj,h as _j,i as MO,j as Mj,I as Pj,k as Oj,l as Ej,m as Aj,L as Dj,n as Tj,o as PO,p as OO,q as Ij,r as Rj,F as $j,u as qi,t as Ss,s as EO,v as zj,w as AO,x as Lj,y as DO,z as TO,A as Fj,B as IO,E as Bj,G as Wj,H as RO,J as Uj,V as $O,K as qj,M as Hj,N as zO,Q as LO,U as Kj,W as FO,X as BO,Y as Yj,Z as Ou,_ as WO,$ as Ws,a0 as UO,a1 as qO,a2 as HO,a3 as Gj,a4 as KO,a5 as Vj,a6 as YO,a7 as GO,a8 as Xj,a9 as VO,aa as XO,ab as QO,ac as ZO,ad as JO,ae as eE,af as tE,ag as rE,ah as nE,ai as aE,aj as sE,ak as Qj,al as iE,am as oE,an as lE,ao as cE,ap as dE,aq as uE}from"./vendor-radix-PlE_1rlU.js";import{u as Zj,a as zp,P as Jj,D as vl,S as Lp,h as e1,b as ud,c as Fp,C as Bp,d as fE,v as mE,r as hE,p as pE,e as xE,f as gE,M as vE,g as t1}from"./vendor-dnd-DuI-3XLF.js";import{P as r1,a as yE,D as bE,b as wE,e as jE,N as NE,c as kE,d as SE,m as Ac,E as CE,u as n1,i as a1,f as s1,g as i1,h as o1,j as _E,k as ME,w as PE}from"./vendor-editor-Dx6DLqmo.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 l1,Tv=Rp;l1=Tv.createRoot,Tv.hydrateRoot;const OE="modulepreload",EE=function(e){return"/"+e},Iv={},c1=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=EE(c),c in Iv)return;Iv[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":OE,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 AE=function(){return null},DE=e=>{switch(e){case"success":return RE;case"info":return zE;case"warning":return $E;case"error":return LE;default:return null}},TE=Array(12).fill(0),IE=({visible:e,className:t})=>B.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},B.createElement("div",{className:"sonner-spinner"},TE.map((r,n)=>B.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),RE=B.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},B.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"})),$E=B.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},B.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"})),zE=B.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},B.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"})),LE=B.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},B.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"})),FE=B.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"},B.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),B.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),BE=()=>{let[e,t]=B.useState(document.hidden);return B.useEffect(()=>{let r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e},ph=1,WE=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:ph++,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],B.isValidElement(c))s=!1,this.create({id:r,type:"default",message:c});else if(qE(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)||ph++;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}},Br=new WE,UE=(e,t)=>{let r=(t==null?void 0:t.id)||ph++;return Br.addToast({title:e,...t,id:r}),r},qE=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",HE=UE,KE=()=>Br.toasts,YE=()=>Br.getActiveToasts(),U=Object.assign(HE,{success:Br.success,info:Br.info,warning:Br.warning,error:Br.error,custom:Br.custom,message:Br.message,promise:Br.promise,dismiss:Br.dismiss,loading:Br.loading},{getHistory:KE,getToasts:YE});function GE(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))}GE(`: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 Dc(e){return e.label!==void 0}var VE=3,XE="32px",QE="16px",Rv=4e3,ZE=356,JE=14,eA=20,tA=200;function bn(...e){return e.filter(Boolean).join(" ")}function rA(e){let[t,r]=e.split("-"),n=[];return t&&n.push(t),r&&n.push(r),n}var nA=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:S,closeButton:C,style:_,cancelButtonStyle:M,actionButtonStyle:D,className:A="",descriptionClassName:T="",duration:$,position:Z,gap:H,loadingIcon:Q,expandByDefault:ne,classNames:J,icons:O,closeButtonAriaLabel:E="Close toast",pauseWhenPageIsHidden:L}=e,[K,R]=B.useState(null),[Y,P]=B.useState(null),[I,te]=B.useState(!1),[F,X]=B.useState(!1),[W,G]=B.useState(!1),[se,V]=B.useState(!1),[ie,pe]=B.useState(!1),[ue,ve]=B.useState(0),[ee,ge]=B.useState(0),De=B.useRef(p.duration||$||Rv),We=B.useRef(null),ze=B.useRef(null),Ge=N===0,ut=N+1<=y,He=p.type,Ze=p.dismissible!==!1,rr=p.className||"",$r=p.descriptionClassName||"",nr=B.useMemo(()=>j.findIndex(de=>de.toastId===p.id)||0,[j,p.id]),br=B.useMemo(()=>{var de;return(de=p.closeButton)!=null?de:C},[p.closeButton,C]),ar=B.useMemo(()=>p.duration||$||Rv,[p.duration,$]),yt=B.useRef(0),Lt=B.useRef(0),Kt=B.useRef(0),sr=B.useRef(null),[zn,ha]=Z.split("-"),Oe=B.useMemo(()=>j.reduce((de,_e,Ie)=>Ie>=nr?de:de+_e.height,0),[j,nr]),xe=BE(),je=p.invert||m,he=He==="loading";Lt.current=B.useMemo(()=>nr*H+Oe,[nr,Oe]),B.useEffect(()=>{De.current=ar},[ar]),B.useEffect(()=>{te(!0)},[]),B.useEffect(()=>{let de=ze.current;if(de){let _e=de.getBoundingClientRect().height;return ge(_e),v(Ie=>[{toastId:p.id,height:_e,position:p.position},...Ie]),()=>v(Ie=>Ie.filter(bt=>bt.toastId!==p.id))}},[v,p.id]),B.useLayoutEffect(()=>{if(!I)return;let de=ze.current,_e=de.style.height;de.style.height="auto";let Ie=de.getBoundingClientRect().height;de.style.height=_e,ge(Ie),v(bt=>bt.find(rt=>rt.toastId===p.id)?bt.map(rt=>rt.toastId===p.id?{...rt,height:Ie}:rt):[{toastId:p.id,height:Ie,position:p.position},...bt])},[I,p.title,p.description,v,p.id]);let be=B.useCallback(()=>{X(!0),ve(Lt.current),v(de=>de.filter(_e=>_e.toastId!==p.id)),setTimeout(()=>{b(p)},tA)},[p,b,v,Lt]);B.useEffect(()=>{if(p.promise&&He==="loading"||p.duration===1/0||p.type==="loading")return;let de;return k||g||L&&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),be()},De.current)),()=>clearTimeout(de)},[k,g,p,He,L,xe,be]),B.useEffect(()=>{p.delete&&be()},[be,p.delete]);function Ve(){var de,_e,Ie;return O!=null&&O.loading?B.createElement("div",{className:bn(J==null?void 0:J.loader,(de=p==null?void 0:p.classNames)==null?void 0:de.loader,"sonner-loader"),"data-visible":He==="loading"},O.loading):Q?B.createElement("div",{className:bn(J==null?void 0:J.loader,(_e=p==null?void 0:p.classNames)==null?void 0:_e.loader,"sonner-loader"),"data-visible":He==="loading"},Q):B.createElement(IE,{className:bn(J==null?void 0:J.loader,(Ie=p==null?void 0:p.classNames)==null?void 0:Ie.loader),visible:He==="loading"})}return B.createElement("li",{tabIndex:0,ref:ze,className:bn(A,rr,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[He],(r=p==null?void 0:p.classNames)==null?void 0:r[He]),"data-sonner-toast":"","data-rich-colors":(n=p.richColors)!=null?n:S,"data-styled":!(p.jsx||p.unstyled||x),"data-mounted":I,"data-promise":!!p.promise,"data-swiped":ie,"data-removed":F,"data-visible":ut,"data-y-position":zn,"data-x-position":ha,"data-index":N,"data-front":Ge,"data-swiping":W,"data-dismissible":Ze,"data-type":He,"data-invert":je,"data-swipe-out":se,"data-swipe-direction":Y,"data-expanded":!!(k||ne&&I),style:{"--index":N,"--toasts-before":N,"--z-index":w.length-N,"--offset":`${F?ue:Lt.current}px`,"--initial-height":ne?"auto":`${ee}px`,..._,...p.style},onDragEnd:()=>{G(!1),R(null),sr.current=null},onPointerDown:de=>{he||!Ze||(We.current=new Date,ve(Lt.current),de.target.setPointerCapture(de.pointerId),de.target.tagName!=="BUTTON"&&(G(!0),sr.current={x:de.clientX,y:de.clientY}))},onPointerUp:()=>{var de,_e,Ie,bt;if(se||!Ze)return;sr.current=null;let rt=Number(((de=ze.current)==null?void 0:de.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),nt=Number(((_e=ze.current)==null?void 0:_e.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),wr=new Date().getTime()-((Ie=We.current)==null?void 0:Ie.getTime()),ir=K==="x"?rt:nt,Ln=Math.abs(ir)/wr;if(Math.abs(ir)>=eA||Ln>.11){ve(Lt.current),(bt=p.onDismiss)==null||bt.call(p,p),P(K==="x"?rt>0?"right":"left":nt>0?"down":"up"),be(),V(!0),pe(!1);return}G(!1),R(null)},onPointerMove:de=>{var _e,Ie,bt,rt;if(!sr.current||!Ze||((_e=window.getSelection())==null?void 0:_e.toString().length)>0)return;let nt=de.clientY-sr.current.y,wr=de.clientX-sr.current.x,ir=(Ie=e.swipeDirections)!=null?Ie:rA(Z);!K&&(Math.abs(wr)>1||Math.abs(nt)>1)&&R(Math.abs(wr)>Math.abs(nt)?"x":"y");let Ln={x:0,y:0};K==="y"?(ir.includes("top")||ir.includes("bottom"))&&(ir.includes("top")&&nt<0||ir.includes("bottom")&&nt>0)&&(Ln.y=nt):K==="x"&&(ir.includes("left")||ir.includes("right"))&&(ir.includes("left")&&wr<0||ir.includes("right")&&wr>0)&&(Ln.x=wr),(Math.abs(Ln.x)>0||Math.abs(Ln.y)>0)&&pe(!0),(bt=ze.current)==null||bt.style.setProperty("--swipe-amount-x",`${Ln.x}px`),(rt=ze.current)==null||rt.style.setProperty("--swipe-amount-y",`${Ln.y}px`)}},br&&!p.jsx?B.createElement("button",{"aria-label":E,"data-disabled":he,"data-close-button":!0,onClick:he||!Ze?()=>{}:()=>{var de;be(),(de=p.onDismiss)==null||de.call(p,p)},className:bn(J==null?void 0:J.closeButton,(s=p==null?void 0:p.classNames)==null?void 0:s.closeButton)},(i=O==null?void 0:O.close)!=null?i:FE):null,p.jsx||h.isValidElement(p.title)?p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title:B.createElement(B.Fragment,null,He||p.icon||p.promise?B.createElement("div",{"data-icon":"",className:bn(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||Ve():null,p.type!=="loading"?p.icon||(O==null?void 0:O[He])||DE(He):null):null,B.createElement("div",{"data-content":"",className:bn(J==null?void 0:J.content,(l=p==null?void 0:p.classNames)==null?void 0:l.content)},B.createElement("div",{"data-title":"",className:bn(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?B.createElement("div",{"data-description":"",className:bn(T,$r,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&&Dc(p.cancel)?B.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||M,onClick:de=>{var _e,Ie;Dc(p.cancel)&&Ze&&((Ie=(_e=p.cancel).onClick)==null||Ie.call(_e,de),be())},className:bn(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&&Dc(p.action)?B.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||D,onClick:de=>{var _e,Ie;Dc(p.action)&&((Ie=(_e=p.action).onClick)==null||Ie.call(_e,de),!de.defaultPrevented&&be())},className:bn(J==null?void 0:J.actionButton,(f=p==null?void 0:p.classNames)==null?void 0:f.actionButton)},p.action.label):null))};function $v(){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 aA(e,t){let r={};return[e,t].forEach((n,s)=>{let i=s===1,o=i?"--mobile-offset":"--offset",l=i?QE:XE;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 sA=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=VE,toastOptions:g,dir:v=$v(),gap:y=JE,loadingIcon:j,icons:N,containerAriaLabel:w="Notifications",pauseWhenPageIsHidden:k}=e,[b,S]=B.useState([]),C=B.useMemo(()=>Array.from(new Set([n].concat(b.filter(L=>L.position).map(L=>L.position)))),[b,n]),[_,M]=B.useState([]),[D,A]=B.useState(!1),[T,$]=B.useState(!1),[Z,H]=B.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Q=B.useRef(null),ne=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),J=B.useRef(null),O=B.useRef(!1),E=B.useCallback(L=>{S(K=>{var R;return(R=K.find(Y=>Y.id===L.id))!=null&&R.delete||Br.dismiss(L.id),K.filter(({id:Y})=>Y!==L.id)})},[]);return B.useEffect(()=>Br.subscribe(L=>{if(L.dismiss){S(K=>K.map(R=>R.id===L.id?{...R,delete:!0}:R));return}setTimeout(()=>{wO.flushSync(()=>{S(K=>{let R=K.findIndex(Y=>Y.id===L.id);return R!==-1?[...K.slice(0,R),{...K[R],...L},...K.slice(R+1)]:[L,...K]})})})}),[]),B.useEffect(()=>{if(u!=="system"){H(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?H("dark"):H("light")),typeof window>"u")return;let L=window.matchMedia("(prefers-color-scheme: dark)");try{L.addEventListener("change",({matches:K})=>{H(K?"dark":"light")})}catch{L.addListener(({matches:R})=>{try{H(R?"dark":"light")}catch(Y){console.error(Y)}})}},[u]),B.useEffect(()=>{b.length<=1&&A(!1)},[b]),B.useEffect(()=>{let L=K=>{var R,Y;s.every(P=>K[P]||K.code===P)&&(A(!0),(R=Q.current)==null||R.focus()),K.code==="Escape"&&(document.activeElement===Q.current||(Y=Q.current)!=null&&Y.contains(document.activeElement))&&A(!1)};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[s]),B.useEffect(()=>{if(Q.current)return()=>{J.current&&(J.current.focus({preventScroll:!0}),J.current=null,O.current=!1)}},[Q.current]),B.createElement("section",{ref:t,"aria-label":`${w} ${ne}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},C.map((L,K)=>{var R;let[Y,P]=L.split("-");return b.length?B.createElement("ol",{key:L,dir:v==="auto"?$v():v,tabIndex:-1,ref:Q,className:l,"data-sonner-toaster":!0,"data-theme":Z,"data-y-position":Y,"data-lifted":D&&b.length>1&&!i,"data-x-position":P,style:{"--front-toast-height":`${((R=_[0])==null?void 0:R.height)||0}px`,"--width":`${ZE}px`,"--gap":`${y}px`,...p,...aA(c,d)},onBlur:I=>{O.current&&!I.currentTarget.contains(I.relatedTarget)&&(O.current=!1,J.current&&(J.current.focus({preventScroll:!0}),J.current=null))},onFocus:I=>{I.target instanceof HTMLElement&&I.target.dataset.dismissible==="false"||O.current||(O.current=!0,J.current=I.relatedTarget)},onMouseEnter:()=>A(!0),onMouseMove:()=>A(!0),onMouseLeave:()=>{T||A(!1)},onDragEnd:()=>A(!1),onPointerDown:I=>{I.target instanceof HTMLElement&&I.target.dataset.dismissible==="false"||$(!0)},onPointerUp:()=>$(!1)},b.filter(I=>!I.position&&K===0||I.position===L).map((I,te)=>{var F,X;return B.createElement(nA,{key:I.id,icons:N,index:te,toast:I,defaultRichColors:f,duration:(F=g==null?void 0:g.duration)!=null?F:m,className:g==null?void 0:g.className,descriptionClassName:g==null?void 0:g.descriptionClassName,invert:r,visibleToasts:x,closeButton:(X=g==null?void 0:g.closeButton)!=null?X:o,interacting:T,position:L,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:E,toasts:b.filter(W=>W.position==I.position),heights:_.filter(W=>W.position==I.position),setHeights:M,expandByDefault:i,gap:y,loadingIcon:j,expanded:D,pauseWhenPageIsHidden:k,swipeDirections:e.swipeDirections})})):null}))}),iA=(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{}},zv=["light","dark"],d1="(prefers-color-scheme: dark)",oA=typeof window>"u",Wp=h.createContext(void 0),lA={setTheme:e=>{},themes:[]},cA=()=>{var e;return(e=h.useContext(Wp))!=null?e:lA},dA=e=>h.useContext(Wp)?h.createElement(h.Fragment,null,e.children):h.createElement(fA,{...e}),uA=["light","dark"],fA=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:r=!0,enableColorScheme:n=!0,storageKey:s="theme",themes:i=uA,defaultTheme:o=r?"system":"light",attribute:l="data-theme",value:c,children:d,nonce:u,scriptProps:f})=>{let[m,p]=h.useState(()=>hA(s,o)),[x,g]=h.useState(()=>m==="system"?um():m),v=c?Object.values(c):i,y=h.useCallback(k=>{let b=k;if(!b)return;k==="system"&&r&&(b=um());let S=c?c[b]:b,C=t?pA(u):null,_=document.documentElement,M=D=>{D==="class"?(_.classList.remove(...v),S&&_.classList.add(S)):D.startsWith("data-")&&(S?_.setAttribute(D,S):_.removeAttribute(D))};if(Array.isArray(l)?l.forEach(M):M(l),n){let D=zv.includes(o)?o:null,A=zv.includes(b)?b:D;_.style.colorScheme=A}C==null||C()},[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=um(k);g(b),m==="system"&&r&&!e&&y("system")},[m,e]);h.useEffect(()=>{let k=window.matchMedia(d1);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(Wp.Provider,{value:w},h.createElement(mA,{forcedTheme:e,storageKey:s,attribute:l,enableSystem:r,enableColorScheme:n,defaultTheme:o,value:c,themes:i,nonce:u,scriptProps:f}),d)},mA=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:`(${iA.toString()})(${u})`}})}),hA=(e,t)=>{if(oA)return;let r;try{r=localStorage.getItem(e)||void 0}catch{}return r||t},pA=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)}},um=e=>(e||(e=window.matchMedia(d1)),e.matches?"dark":"light");function xA({children:e}){return a.jsx(dA,{attribute:"class",defaultTheme:"system",enableSystem:!0,disableTransitionOnChange:!0,children:e})}const u1=h.createContext(null),Es="meridian_token",Bo="meridian_user",Tc="meridian_workspace";function Lv(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 gA({children:e}){const[t,r]=h.useState(()=>{try{const f=localStorage.getItem(Bo),m=localStorage.getItem(Es);if(!f)return null;const p=JSON.parse(f),{roles:x,permissions:g}=m?Lv(m):{roles:[],permissions:[]};return p.roles=x,p.permissions=g,p}catch{return null}}),[n,s]=h.useState(()=>{const f=localStorage.getItem(Es),m=localStorage.getItem(Bo);return f&&!m?(localStorage.removeItem(Es),null):f}),[i,o]=h.useState(()=>{try{const f=localStorage.getItem(Tc);return f?JSON.parse(f):null}catch{return null}}),l=(f,m)=>{const{roles:p,permissions:x}=Lv(m),g={...f,roles:p,permissions:x};r(g),s(m),localStorage.setItem(Es,m),localStorage.setItem(Bo,JSON.stringify(g))},c=()=>{const f=localStorage.getItem(Es);f&&fetch("/auth/logout",{method:"POST",headers:{Authorization:`Bearer ${f}`,"Content-Type":"application/json"}}).catch(()=>{}),r(null),s(null),o(null),localStorage.removeItem(Es),localStorage.removeItem(Bo),localStorage.removeItem(Tc)};h.useEffect(()=>{const f=()=>{localStorage.getItem(Es)&&c()};return window.addEventListener("meridian:unauthorized",f),()=>window.removeEventListener("meridian:unauthorized",f)},[]);const d=f=>{o(f),f?localStorage.setItem(Tc,JSON.stringify(f)):localStorage.removeItem(Tc)},u=f=>{r(m=>{if(!m)return m;const p={...m,...f};return localStorage.setItem(Bo,JSON.stringify(p)),p})};return a.jsx(u1.Provider,{value:{user:t,token:n,workspace:i,isAuthenticated:!!n&&!!t,login:l,logout:c,setWorkspace:d,updateLocalUser:u},children:e})}function Te(){const e=h.useContext(u1);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const f1=h.createContext(null);function vA({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(f1.Provider,{value:{open:t,setOpen:r,toggle:()=>r(n=>!n)},children:e})}function Up(){const e=h.useContext(f1);if(!e)throw new Error("useCommandPalette must be used within CommandPaletteProvider");return e}function m1(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=m1(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=m1(e))&&(n&&(n+=" "),n+=t);return n}const qp="-",yA=e=>{const t=wA(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(qp);return l[0]===""&&l.length!==1&&l.shift(),h1(l,t)||bA(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},h1=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),s=n?h1(e.slice(1),n):void 0;if(s)return s;if(t.validators.length===0)return;const i=e.join(qp);return(o=t.validators.find(({validator:l})=>l(i)))==null?void 0:o.classGroupId},Fv=/^\[(.+)\]$/,bA=e=>{if(Fv.test(e)){const t=Fv.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},wA=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return NA(Object.entries(e.classGroups),r).forEach(([i,o])=>{xh(o,n,i,t)}),n},xh=(e,t,r,n)=>{e.forEach(s=>{if(typeof s=="string"){const i=s===""?t:Bv(t,s);i.classGroupId=r;return}if(typeof s=="function"){if(jA(s)){xh(s(n),t,r,n);return}t.validators.push({validator:s,classGroupId:r});return}Object.entries(s).forEach(([i,o])=>{xh(o,Bv(t,i),r,n)})})},Bv=(e,t)=>{let r=e;return t.split(qp).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},jA=e=>e.isThemeGetter,NA=(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,kA=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)}}},p1="!",SA=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(p1),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},CA=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},_A=e=>({cache:kA(e.cacheSize),parseClassName:SA(e),...yA(e)}),MA=/\s+/,PA=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s}=t,i=[],o=e.trim().split(MA);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=CA(u).join(":"),y=f?v+p1: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 OA(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=x1(t))&&(n&&(n+=" "),n+=r);return n}const x1=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=x1(e[n]))&&(r&&(r+=" "),r+=t);return r};function EA(e,...t){let r,n,s,i=o;function o(c){const d=t.reduce((u,f)=>f(u),e());return r=_A(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(OA.apply(null,arguments))}}const ft=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},g1=/^\[(?:([a-z-]+):)?(.+)\]$/i,AA=/^\d+\/\d+$/,DA=new Set(["px","full","screen"]),TA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,IA=/\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$/,RA=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,$A=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,zA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ga=e=>Hi(e)||DA.has(e)||AA.test(e),as=e=>xo(e,"length",KA),Hi=e=>!!e&&!Number.isNaN(Number(e)),fm=e=>xo(e,"number",Hi),Wo=e=>!!e&&Number.isInteger(Number(e)),LA=e=>e.endsWith("%")&&Hi(e.slice(0,-1)),Re=e=>g1.test(e),ss=e=>TA.test(e),FA=new Set(["length","size","percentage"]),BA=e=>xo(e,FA,v1),WA=e=>xo(e,"position",v1),UA=new Set(["image","url"]),qA=e=>xo(e,UA,GA),HA=e=>xo(e,"",YA),Uo=()=>!0,xo=(e,t,r)=>{const n=g1.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},KA=e=>IA.test(e)&&!RA.test(e),v1=()=>!1,YA=e=>$A.test(e),GA=e=>zA.test(e),VA=()=>{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"),S=ft("space"),C=ft("translate"),_=()=>["auto","contain","none"],M=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto",Re,t],A=()=>[Re,t],T=()=>["",ga,as],$=()=>["auto",Hi,Re],Z=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],H=()=>["solid","dashed","dotted","double","none"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ne=()=>["start","end","center","between","around","evenly","stretch"],J=()=>["","0",Re],O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],E=()=>[Hi,Re];return{cacheSize:500,separator:":",theme:{colors:[Uo],spacing:[ga,as],blur:["none","",ss,Re],brightness:E(),borderColor:[e],borderRadius:["none","","full",ss,Re],borderSpacing:A(),borderWidth:T(),contrast:E(),grayscale:J(),hueRotate:E(),invert:J(),gap:A(),gradientColorStops:[e],gradientColorStopPositions:[LA,as],inset:D(),margin:D(),opacity:E(),padding:A(),saturate:E(),scale:E(),sepia:J(),skew:E(),space:A(),translate:A()},classGroups:{aspect:[{aspect:["auto","square","video",Re]}],container:["container"],columns:[{columns:[ss]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"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:[...Z(),Re]}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],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",Wo,Re]}],basis:[{basis:D()}],"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",Wo,Re]}],"grid-cols":[{"grid-cols":[Uo]}],"col-start-end":[{col:["auto",{span:["full",Wo,Re]},Re]}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":[Uo]}],"row-start-end":[{row:["auto",{span:[Wo,Re]},Re]}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"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",...ne()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ne(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ne(),"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":[S]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[S]}],"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:[ss]},ss]}],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",ss,as]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",fm]}],"font-family":[{font:[Uo]}],"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",Hi,fm]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ga,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:[...H(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ga,as]}],"underline-offset":[{"underline-offset":["auto",ga,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:A()}],"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:[...Z(),WA]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",BA]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},qA]}],"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:[...H(),"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:H()}],"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:["",...H()]}],"outline-offset":[{"outline-offset":[ga,Re]}],"outline-w":[{outline:[ga,as]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:T()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[ga,as]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",ss,HA]}],"shadow-color":[{shadow:[Uo]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...Q(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Q()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",ss,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:E()}],ease:[{ease:["linear","in","out","in-out",Re]}],delay:[{delay:E()}],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:[Wo,Re]}],"translate-x":[{"translate-x":[C]}],"translate-y":[{"translate-y":[C]}],"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":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"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:[ga,as,fm]}],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"]}}},XA=EA(VA);function z(...e){return XA(it(e))}const Eu=_O,Zn=SO,Jn=CO,Mn=h.forwardRef(({className:e,sideOffset:t=4,...r},n)=>a.jsx(kj,{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}));Mn.displayName=kj.displayName;const y1=h.createContext([]);function QA({widgets:e,children:t}){return B.createElement(y1.Provider,{value:e},t)}function ZA(e){return h.useContext(y1).filter(r=>r.zone===e).map(r=>r.component)}var jj;const Xi=((jj=window.__MERIDIAN_CONFIG__)==null?void 0:jj.apiUrl)??void 0??"";class Hp extends Error{constructor(t,r,n){super(r),this.status=t,this.data=n,this.name="ApiError"}}function b1(){return localStorage.getItem("meridian_token")}async function qo(e,t={}){var i;const r=b1(),n={"Content-Type":"application/json",...t.headers};r&&(n.Authorization=`Bearer ${r}`);const s=await fetch(`${Xi}${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 Hp(s.status,l,o)}if(s.status!==204)return s.json()}const oe={get:e=>qo(e,{method:"GET"}),post:(e,t)=>qo(e,{method:"POST",body:JSON.stringify(t)}),put:(e,t)=>qo(e,{method:"PUT",body:JSON.stringify(t)}),patch:(e,t)=>qo(e,{method:"PATCH",body:JSON.stringify(t)}),delete:e=>qo(e,{method:"DELETE"}),upload:async(e,t)=>{var i;const r=b1(),n={};r&&(n.Authorization=`Bearer ${r}`);const s=await fetch(`${Xi}${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 Hp(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 Yl(e,t){return $e({queryKey:e?Tt.byProject(e,t):Tt.all,queryFn:async()=>{var u,f,m;const r=new URLSearchParams;e&&(r.set("project_id",e),r.set("limit","1000")),(u=t==null?void 0:t.priority)!=null&&u.length&&r.set("priority",t.priority.join(",")),t!=null&&t.assignee_id&&r.set("assignee_id",t.assignee_id),(f=t==null?void 0:t.type)!=null&&f.length&&r.set("type",t.type.join(",")),(m=t==null?void 0:t.status)!=null&&m.length&&r.set("status",t.status.join(","));const n=await oe.get(`/admin/issues?${r}`);if(n.count<=n.issues.length)return n;const s=n.issues.length,i=n.count-s,o=Math.ceil(i/s),l=Array.from({length:o},(p,x)=>{const g=new URLSearchParams(r);return g.set("offset",String(s*(x+1))),oe.get(`/admin/issues?${g}`)}),c=await Promise.all(l);return{issues:n.issues.concat(...c.map(p=>p.issues)),count:n.count}},select:r=>r.issues,enabled:e!==void 0?!!e:!0})}function w1(e){return $e({queryKey:Tt.detail(e),queryFn:()=>oe.get(`/admin/issues/${e}`),select:t=>t.issue,enabled:!!e})}function JA(e){return $e({queryKey:Tt.comments(e),queryFn:()=>oe.get(`/admin/issues/${e}/comments`),select:t=>t.comments,enabled:!!e})}function j1(){const e=Ne();return ye({mutationFn:t=>oe.post("/admin/issues",t),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:Tt.byProject(r.project_id)})}})}function Au(e,t){const r=Ne();return ye({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 e5(e){return $e({queryKey:Tt.activities(e),queryFn:()=>oe.get(`/admin/issues/${e}/activities`),select:t=>t.activities,enabled:!!e})}function t5(e){const t=Ne();return ye({mutationFn:({body:r,metadata:n})=>oe.post(`/admin/issues/${e}/comments`,{body:r,metadata:n}),onSuccess:()=>{t.invalidateQueries({queryKey:Tt.comments(e)})}})}const Wv=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Uv=it,Gl=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return Uv(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=Wv(u)||Wv(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 Uv(e,o,c,r==null?void 0:r.class,r==null?void 0:r.className)},Ki=Gl("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"}}),ae=h.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...s},i)=>{const o=n?$p:"button";return a.jsx(o,{className:z(Ki({variant:t,size:r,className:e})),ref:i,...s})});ae.displayName="Button";const Me=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}));Me.displayName="Input";/**
4
4
  * @license lucide-react v0.468.0 - ISC
@@ -550,7 +550,7 @@ var xO=Object.defineProperty;var gO=(e,t,r)=>t in e?xO(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 ca=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 $5({issue:e}){const t=Au(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:()=>{U.success("Metadata saved"),n(""),i(""),l(!1)},onError:()=>U.error("Failed to save metadata")})},f=m=>{const p={...c};delete p[m],t.mutate({metadata:Object.keys(p).length?p:null},{onSuccess:()=>U.success("Entry removed"),onError:()=>U.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(o5,{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(Or,{className:"h-3 w-3"})})]},m)),o&&a.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[a.jsx(Me,{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(Me,{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(ae,{size:"sm",className:"h-7 px-2 text-xs",onClick:u,disabled:!r.trim()||t.isPending,children:"Save"}),a.jsx(ae,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",onClick:()=>{l(!1),n(""),i("")},children:"Cancel"})]})]})]})}const z5=[{zone:"issue.details.after",component:$5}];function yo(e=!0){return $e({queryKey:["workspaces"],queryFn:()=>oe.get("/admin/workspaces"),select:t=>t.workspaces,enabled:e})}function L5(){const e=Ne();return ye({mutationFn:t=>oe.post("/admin/workspaces",t),onSuccess:()=>{e.invalidateQueries({queryKey:["workspaces"]})}})}function F5(e){const t=Ne();return ye({mutationFn:r=>oe.put(`/admin/workspaces/${e}`,r),onSuccess:()=>{t.invalidateQueries({queryKey:["workspaces"]})}})}function B5(e){const t=Ne();return ye({mutationFn:r=>{const n=new FormData;return n.append("logo",r),oe.upload(`/admin/workspaces/${e}/logo`,n)},onSuccess:()=>t.invalidateQueries({queryKey:["workspaces"]})})}function W5(e){const t=Ne();return ye({mutationFn:()=>oe.delete(`/admin/workspaces/${e}/logo`),onSuccess:()=>t.invalidateQueries({queryKey:["workspaces"]})})}const nx={list:e=>["workspaces",e,"invitations"]};function U5(e){return $e({queryKey:nx.list(e),queryFn:()=>oe.get(`/admin/workspaces/${e}/invitations`),select:t=>t.invitations,enabled:!!e})}function q5(e){const t=Ne();return ye({mutationFn:r=>oe.post(`/admin/workspaces/${e}/invitations`,r),onSuccess:()=>{t.invalidateQueries({queryKey:nx.list(e)})}})}function H5(e){const t=Ne();return ye({mutationFn:r=>oe.delete(`/admin/workspaces/${e}/invitations/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:nx.list(e)})}})}function K5(e){return ye({mutationFn:t=>oe.post(`/admin/workspaces/${e}/invitations/${t}/resend`)})}const ax={list:e=>["workspaces",e,"members"]};function Zl(e){return $e({queryKey:ax.list(e),queryFn:()=>oe.get(`/admin/workspaces/${e}/members`),select:t=>t.members,enabled:!!e})}function Y5(e){const t=Ne();return ye({mutationFn:r=>oe.post(`/admin/workspaces/${e}/members/batch`,r),onSuccess:()=>{t.invalidateQueries({queryKey:ax.list(e)}),t.invalidateQueries({queryKey:["workspaces"]})}})}function G5(e){const t=Ne();return ye({mutationFn:r=>oe.delete(`/admin/workspaces/${e}/members/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:ax.list(e)}),t.invalidateQueries({queryKey:["workspaces"]})}})}const Ns={list:e=>["workspaces",e,"teams"],members:(e,t)=>["workspaces",e,"teams",t,"members"]};function Ru(e){return $e({queryKey:Ns.list(e),queryFn:()=>oe.get(`/admin/workspaces/${e}/teams`),select:t=>t.teams,enabled:!!e})}function V5(e){const t=Ne();return ye({mutationFn:r=>oe.post(`/admin/workspaces/${e}/teams`,r),onSuccess:()=>{t.invalidateQueries({queryKey:Ns.list(e)})}})}function X5(e){const t=Ne();return ye({mutationFn:r=>oe.delete(`/admin/workspaces/${e}/teams/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:Ns.list(e)})}})}function Q5(e,t){return $e({queryKey:Ns.members(e,t),queryFn:()=>oe.get(`/admin/workspaces/${e}/teams/${t}/members`),select:r=>r.members,enabled:!!(e&&t)})}function Z5(e,t){const r=Ne();return ye({mutationFn:n=>oe.post(`/admin/workspaces/${e}/teams/${t}/members`,{user_id:n}),onSuccess:()=>{r.invalidateQueries({queryKey:Ns.members(e,t)}),r.invalidateQueries({queryKey:Ns.list(e)})}})}function J5(e,t){const r=Ne();return ye({mutationFn:n=>oe.delete(`/admin/workspaces/${e}/teams/${t}/members/${n}`),onSuccess:()=>{r.invalidateQueries({queryKey:Ns.members(e,t)}),r.invalidateQueries({queryKey:Ns.list(e)})}})}function $u(){return $e({queryKey:["setup-status"],queryFn:()=>oe.get("/auth/setup"),staleTime:6e4,retry:!1})}function eD(){const{login:e}=Te();return ye({mutationFn:t=>oe.post("/auth/login",t),onSuccess:t=>{e(t.user,t.token)}})}function tD(){const{login:e}=Te();return ye({mutationFn:t=>oe.post("/auth/register",t),onSuccess:t=>{e(t.user,t.token)}})}function rD(){return ye({mutationFn:e=>oe.post("/auth/forgot-password",e)})}function nD(){return ye({mutationFn:e=>oe.post("/auth/reset-password",e)})}function aD(e){const{login:t}=Te();return ye({mutationFn:r=>oe.post(`/auth/invite/${e}`,r),onSuccess:r=>{t(r.user,r.token)}})}var Nj;const sD=((Nj=window.__MERIDIAN_CONFIG__)==null?void 0:Nj.apiUrl)??void 0??"";function iD(e,t){const r=`${sD}/admin/events?token=${encodeURIComponent(e)}&workspaceId=${encodeURIComponent(t)}`;return new EventSource(r)}function oD(){const{token:e,workspace:t}=Te(),r=Ne(),n=h.useRef(null);h.useEffect(()=>{if(!e||!t)return;const s=iD(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 mm=768;function lD(){const[e,t]=h.useState(void 0);return h.useEffect(()=>{const r=window.matchMedia(`(max-width: ${mm-1}px)`),n=()=>{t(window.innerWidth<mm)};return r.addEventListener("change",n),t(window.innerWidth<mm),()=>r.removeEventListener("change",n)},[]),!!e}const bo=h.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},s)=>a.jsx(Sj,{ref:s,decorative:r,orientation:t,className:z("shrink-0 bg-border",t==="horizontal"?"h-px w-full":"h-full w-px",e),...n}));bo.displayName=Sj.displayName;const cD=Kl,dD=Hl,W1=h.forwardRef(({className:e,...t},r)=>a.jsx(yi,{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}));W1.displayName=yi.displayName;const uD=Gl("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"}}),U1=h.forwardRef(({side:e="right",className:t,children:r,...n},s)=>a.jsxs(dD,{children:[a.jsx(W1,{}),a.jsxs(bi,{ref:s,className:z(uD({side:e}),t),...n,children:[r,a.jsxs(Pu,{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(Je,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));U1.displayName=bi.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 H1=h.forwardRef(({className:e,...t},r)=>a.jsx(ho,{ref:r,className:z("text-base font-semibold text-foreground",e),...t}));H1.displayName=ho.displayName;const K1=h.forwardRef(({className:e,...t},r)=>a.jsx(po,{ref:r,className:z("text-sm text-muted-foreground",e),...t}));K1.displayName=po.displayName;function le({className:e,...t}){return a.jsx("div",{className:z("animate-pulse rounded-md bg-muted",e),...t})}const fD="sidebar_state",mD=60*60*24*7,hD="16rem",pD="18rem",xD="3rem",gD="b",Y1=h.createContext(null);function sx(){const e=h.useContext(Y1);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function zu({defaultOpen:e=!0,open:t,onOpenChange:r,className:n,style:s,children:i,...o}){const l=lD(),[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=`${fD}=${j}; path=/; max-age=${mD}`},[r,m]),x=h.useCallback(()=>l?d(y=>!y):p(y=>!y),[l,p,d]);h.useEffect(()=>{const y=j=>{j.key===gD&&(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(Y1.Provider,{value:v,children:a.jsx(Eu,{delayDuration:0,children:a.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":hD,"--sidebar-width-icon":xD,...s},className:z("group/sidebar-wrapper has-[[data-variant=inset]]:bg-sidebar flex h-svh w-full",n),...o,children:i})})})}function Lu({side:e="left",variant:t="sidebar",collapsible:r="offcanvas",className:n,children:s,...i}){const{isMobile:o,state:l,openMobile:c,setOpenMobile:d}=sx();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(cD,{open:c,onOpenChange:d,...i,children:a.jsxs(U1,{"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":pD},side:e,children:[a.jsxs(q1,{className:"sr-only",children:[a.jsx(H1,{children:"Sidebar"}),a.jsx(K1,{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 Fu({className:e,onClick:t,...r}){const{toggleSidebar:n}=sx();return a.jsxs(ae,{"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(w5,{}),a.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function Bu({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 Wu({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 Uu({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 Kv({className:e,...t}){return a.jsx(bo,{"data-slot":"sidebar-separator","data-sidebar":"separator",className:z("bg-sidebar-border mx-2 w-auto",e),...t})}function qu({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 Hs({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 Yv({className:e,asChild:t=!1,...r}){const n=t?$p:"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 Ks({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 kr({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 vD=Gl("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?$p:"button",{isMobile:u,state:f}=sx(),m=a.jsx(d,{ref:c,"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":s,"data-active":r,className:z(vD({variant:n,size:s}),o),...l});return i?(typeof i=="string"&&(i={children:i}),a.jsxs(Zn,{children:[a.jsx(Jn,{asChild:!0,children:m}),a.jsx(Mn,{side:"right",align:"center",hidden:f!=="collapsed"||u,...i})]})):m});St.displayName="SidebarMenuButton";const yD=250,bD=300,en={all:["projects"],list:()=>[...en.all,"list"],detail:e=>[...en.all,e],byKey:e=>[...en.all,"key",e],activities:e=>[...en.all,e,"activities"]};function wo(e){const{workspace:t}=Te(),r=e==null?void 0:e.workspaceIds,n=!(e!=null&&e.allWorkspaces)&&!(r!=null&&r.length),s=n?t==null?void 0:t.id:void 0;return $e({queryKey:[...en.list(),s??r??"all"],queryFn:()=>{const i=new URLSearchParams;s?i.set("workspace_id",s):r!=null&&r.length&&i.set("workspace_ids",r.join(","));const o=i.toString()?`?${i}`:"";return oe.get(`/admin/projects${o}`)},select:i=>i.projects,enabled:n?!!(t!=null&&t.id):!0})}function qa(e){return $e({queryKey:en.byKey(e),queryFn:()=>oe.get(`/admin/projects/by-identifier/${encodeURIComponent(e)}`),select:t=>t.project,enabled:!!e})}function wD(e,t={}){const[r,n]=h.useState(e),s=t.enabled!==!1;return h.useEffect(()=>{if(!s)return;const l=setTimeout(()=>n(e),yD);return()=>clearTimeout(l)},[e,s]),{...$e({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 jD(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),bD);return()=>clearTimeout(l)},[r]);const o=$e({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 ND(){const e=Ne();return ye({mutationFn:t=>oe.post("/admin/projects",t),onSuccess:()=>{e.invalidateQueries({queryKey:en.list()})}})}function kD(){const e=Ne();return ye({mutationFn:t=>oe.delete(`/admin/projects/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:en.list()})}})}function SD(e){const t=Ne();return ye({mutationFn:()=>oe.post(`/admin/projects/${e}/share`,{}),onSuccess:()=>{t.invalidateQueries({queryKey:en.detail(e)}),t.invalidateQueries({queryKey:en.list()})}})}function CD(e){const t=Ne();return ye({mutationFn:()=>oe.delete(`/admin/projects/${e}/share`),onSuccess:()=>{t.invalidateQueries({queryKey:en.detail(e)}),t.invalidateQueries({queryKey:en.list()})}})}function _D(e){return $e({queryKey:en.activities(e),queryFn:()=>oe.get(`/admin/projects/${e}/activities`),select:t=>t.activities,enabled:!!e})}const Yr=PO,Gr=OO,MD=h.forwardRef(({className:e,inset:t,children:r,...n},s)=>a.jsxs(Cj,{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(hr,{className:"ml-auto"})]}));MD.displayName=Cj.displayName;const PD=h.forwardRef(({className:e,...t},r)=>a.jsx(_j,{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}));PD.displayName=_j.displayName;const Er=h.forwardRef(({className:e,sideOffset:t=4,...r},n)=>a.jsx(MO,{children:a.jsx(Mj,{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})}));Er.displayName=Mj.displayName;const at=h.forwardRef(({className:e,inset:t,...r},n)=>a.jsx(Pj,{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=Pj.displayName;const OD=h.forwardRef(({className:e,children:t,checked:r,...n},s)=>a.jsxs(Oj,{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(Ej,{children:a.jsx(Xt,{className:"h-4 w-4"})})}),t]}));OD.displayName=Oj.displayName;const ED=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(Aj,{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(Ej,{children:a.jsx(Pr,{className:"h-2 w-2 fill-current"})})}),t]}));ED.displayName=Aj.displayName;const ix=h.forwardRef(({className:e,inset:t,...r},n)=>a.jsx(Dj,{ref:n,className:z("px-2 py-1.5 text-xs font-medium text-muted-foreground",t&&"pl-8",e),...r}));ix.displayName=Dj.displayName;const En=h.forwardRef(({className:e,...t},r)=>a.jsx(Tj,{ref:r,className:z("-mx-1 my-1 h-px bg-border",e),...t}));En.displayName=Tj.displayName;const Rt=h.forwardRef(({className:e,...t},r)=>a.jsx(Ij,{ref:r,className:z("relative flex h-8 w-8 shrink-0 overflow-hidden rounded-full",e),...t}));Rt.displayName=Ij.displayName;const jl=h.forwardRef(({className:e,...t},r)=>a.jsx(Rj,{ref:r,className:z("aspect-square h-full w-full",e),...t}));jl.displayName=Rj.displayName;const $t=h.forwardRef(({className:e,...t},r)=>a.jsx($j,{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=$j.displayName;function AD(){var s;const{workspace:e,setWorkspace:t}=Te(),{data:r}=yo(),n=pt();return a.jsx(kr,{children:a.jsx(Mt,{children:a.jsxs(Yr,{children:[a.jsx(Gr,{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(go,{className:"ml-auto size-4 shrink-0"})]})}),a.jsxs(Er,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"bottom",align:"start",sideOffset:4,children:[a.jsx(ix,{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(Xt,{className:"size-3.5 text-muted-foreground shrink-0"})]},i.id)),a.jsx(En,{}),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 DD(){var i,o,l,c;const{user:e,logout:t}=Te(),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(kr,{children:a.jsx(Mt,{children:a.jsxs(Yr,{children:[a.jsx(Gr,{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(jl,{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(go,{className:"ml-auto size-4 shrink-0"})]})}),a.jsxs(Er,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[a.jsx(ix,{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(jl,{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(En,{}),a.jsxs(at,{className:"cursor-pointer gap-2",onClick:()=>r("/profile"),children:[a.jsx(Ql,{className:"size-4"}),"Profile"]}),a.jsx(En,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:t,children:[a.jsx(Tu,{className:"size-4"}),"Sign out"]})]})]})})})}function TD({...e}){var w,k,b;const{workspace:t,projectKey:r}=zt(),{data:n}=wo(),{toggle:s}=Up(),{user:i}=Te(),o=Wl(),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(Lu,{collapsible:"offcanvas",...e,children:[a.jsx(Wu,{children:a.jsx(AD,{})}),a.jsxs(qu,{children:[a.jsx(Hs,{children:a.jsx(Ks,{children:a.jsxs(kr,{children:[a.jsx(Mt,{children:a.jsxs(St,{onClick:s,tooltip:"Search",children:[a.jsx(ki,{}),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(jn,{to:`/${l}/my-tasks`,children:[a.jsx(Iu,{}),a.jsx("span",{children:"My Tasks"})]})})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:c,tooltip:"Projects",children:a.jsxs(jn,{to:`/${l}/projects`,end:!0,children:[a.jsx(Kr,{}),a.jsx("span",{children:"Projects"})]})})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:u,tooltip:"Notifications",children:a.jsxs(jn,{to:`/${l}/notifications`,children:[a.jsx(si,{}),a.jsx("span",{children:"Notifications"})]})})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:p,tooltip:"Reports",children:a.jsxs(jn,{to:`/${l}/reporting`,children:[a.jsx(ws,{}),a.jsx("span",{children:"Reports"})]})})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:f,tooltip:"Settings",children:a.jsxs(jn,{to:`/${l}/settings`,children:[a.jsx(rx,{}),a.jsx("span",{children:"Workspace settings"})]})})})]})})}),n&&n.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(Kv,{}),a.jsxs(Hs,{children:[a.jsx(Yv,{children:"Recent"}),a.jsx(Ks,{children:a.jsx(kr,{children:n.slice(0,5).map(S=>a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:S.identifier===r,tooltip:S.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(jn,{to:`/${l}/projects/${S.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:S.identifier}),a.jsx("span",{className:"truncate",children:S.name})]})})},S.id))})})]})]}),N&&a.jsxs(a.Fragment,{children:[a.jsx(Kv,{}),a.jsxs(Hs,{children:[a.jsx(Yv,{children:"Global"}),a.jsx(Ks,{children:a.jsxs(kr,{children:[a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:x,tooltip:"Global Reports",children:a.jsxs(jn,{to:"/reporting",children:[a.jsx(ws,{}),a.jsx("span",{children:"Global Reports"})]})})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:g,tooltip:"Org Settings",children:a.jsxs(jn,{to:"/org/settings",children:[a.jsx(tx,{}),a.jsx("span",{children:"Org Settings"})]})})})]})})]})]}),a.jsx(Hs,{className:"mt-auto",children:a.jsx(Ks,{children:a.jsx(kr,{children:v&&a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:m,tooltip:"Roles & Permissions",children:a.jsxs(jn,{to:`/${l}/roles`,children:[a.jsx(vh,{}),a.jsx("span",{children:"Custom Roles"})]})})})})})})]}),a.jsx(Uu,{children:a.jsx(DD,{})})]})}function Hu(){const{theme:e,setTheme:t}=cA();return a.jsxs(Zn,{children:[a.jsx(Jn,{asChild:!0,children:a.jsxs(ae,{variant:"ghost",size:"icon-sm",onClick:()=>t(e==="dark"?"light":"dark"),className:"text-muted-foreground hover:text-foreground",children:[a.jsx(M5,{className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),a.jsx(b5,{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(Mn,{children:"Toggle theme"})]})}const ur={byIssue:e=>["time-logs",e],activeTimer:e=>["time-logs",e,"active-timer"],globalActiveTimer:["time-logs","global-active-timer"]};function ID(e){return $e({queryKey:ur.byIssue(e),queryFn:()=>oe.get(`/admin/issues/${e}/time-logs`),enabled:!!e})}function RD(e){return $e({queryKey:ur.activeTimer(e),queryFn:()=>oe.get(`/admin/issues/${e}/time-logs/timer`),select:t=>t.active_timer,enabled:!!e,refetchInterval:1e4})}function $D(e){const t=Ne();return ye({mutationFn:r=>oe.post(`/admin/issues/${e}/time-logs`,r),onSuccess:()=>{t.invalidateQueries({queryKey:ur.byIssue(e)})}})}function zD(e){const t=Ne();return ye({mutationFn:()=>oe.post(`/admin/issues/${e}/time-logs/timer`,{action:"start"}),onSuccess:r=>{t.invalidateQueries({queryKey:ur.activeTimer(e)}),t.invalidateQueries({queryKey:ur.byIssue(e)}),t.invalidateQueries({queryKey:ur.globalActiveTimer}),r.stopped_timer&&r.stopped_timer.issue_id!==e&&(t.invalidateQueries({queryKey:ur.byIssue(r.stopped_timer.issue_id)}),t.invalidateQueries({queryKey:ur.activeTimer(r.stopped_timer.issue_id)}))}})}function LD(e){const t=Ne();return ye({mutationFn:()=>oe.post(`/admin/issues/${e}/time-logs/timer`,{action:"stop"}),onSuccess:()=>{t.invalidateQueries({queryKey:ur.activeTimer(e)}),t.invalidateQueries({queryKey:ur.byIssue(e)}),t.invalidateQueries({queryKey:ur.globalActiveTimer})}})}function FD(e){const t=Ne();return ye({mutationFn:r=>oe.delete(`/admin/issues/${e}/time-logs/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:ur.byIssue(e)})}})}function BD(e){const t=Ne();return ye({mutationFn:({logId:r,data:n})=>oe.put(`/admin/issues/${e}/time-logs/${r}`,n),onSuccess:()=>{t.invalidateQueries({queryKey:ur.byIssue(e)})}})}function WD(){return $e({queryKey:ur.globalActiveTimer,queryFn:()=>oe.get("/admin/time-logs/active-timer"),select:e=>e.active_timer,refetchInterval:1e4})}function UD(){const e=Ne();return ye({mutationFn:()=>oe.post("/admin/time-logs/active-timer"),onSuccess:t=>{e.invalidateQueries({queryKey:ur.globalActiveTimer}),t.time_log&&(e.invalidateQueries({queryKey:ur.byIssue(t.time_log.issue_id)}),e.invalidateQueries({queryKey:ur.activeTimer(t.time_log.issue_id)}))}})}function Nd(e){const t=Math.floor(e/60),r=e%60;return t===0?`${r}m`:r===0?`${t}h`:`${t}h ${r}m`}function kd(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 qD({startedAt:e}){const[t,r]=h.useState(()=>kd(e));return h.useEffect(()=>{const n=setInterval(()=>r(kd(e)),1e3);return()=>clearInterval(n)},[e]),a.jsx("span",{className:"font-mono tabular-nums text-xs font-semibold",children:t})}function HD(){const{data:e}=WD(),t=UD(),{workspace:r}=Te(),n=(r==null?void 0:r.slug)??"";if(!e||!e.started_at)return null;const s=e.issue_identifier??"Issue",i=e.project_identifier?`/${n}/projects/${e.project_identifier}/issues/${e.issue_id}`:`/${n}/projects`,o=()=>{t.mutate(void 0,{onSuccess:l=>{var d;const c=((d=l.time_log)==null?void 0:d.duration_minutes)??0;U.success(`Timer stopped — ${Nd(c)} logged`)},onError:()=>U.error("Failed to stop timer")})};return a.jsxs("div",{className:"flex items-center gap-1.5 rounded-full border border-emerald-200 dark:border-emerald-800 bg-emerald-50 dark:bg-emerald-950/40 px-2.5 py-1 text-emerald-700 dark:text-emerald-400",children:[a.jsx(L1,{className:"h-3 w-3 shrink-0"}),a.jsx(Mr,{to:i,className:"text-xs font-medium hover:underline truncate max-w-[100px]",title:e.issue_title??s,children:s}),a.jsx(qD,{startedAt:e.started_at}),a.jsx(ae,{variant:"ghost",size:"icon",className:"h-5 w-5 rounded-full text-emerald-700 dark:text-emerald-400 hover:bg-emerald-200 dark:hover:bg-emerald-900 hover:text-emerald-900 dark:hover:text-emerald-200",onClick:o,disabled:t.isPending,children:a.jsx($1,{className:"h-2.5 w-2.5 fill-current"})})]})}const Jl={all:["notifications"],list:()=>[...Jl.all,"list"]};function KD(){return $e({queryKey:Jl.list(),queryFn:()=>oe.get("/admin/notifications"),select:e=>e.notifications})}function G1(){return $e({queryKey:[...Jl.list(),"unread"],queryFn:()=>oe.get("/admin/notifications?unread=true"),select:e=>e.count,refetchInterval:3e4})}function YD(){const e=Ne();return ye({mutationFn:t=>oe.post(`/admin/notifications/${t}/read`),onSuccess:()=>{e.invalidateQueries({queryKey:Jl.all})}})}function GD(){const e=Ne();return ye({mutationFn:()=>oe.post("/admin/notifications/read-all"),onSuccess:()=>{e.invalidateQueries({queryKey:Jl.all})}})}function VD(){const e=Wl(),{projectKey:t}=zt(),{data:r}=wo(),n=r==null?void 0:r.find(i=>i.identifier===t),s=e.pathname;return s.includes("/board")?{icon:Kr,label:n?`${n.name} / Board`:"Board"}:s.includes("/issues")?{icon:ea,label:n?`${n.name} / Issues`:"Issues"}:s.includes("/sprints")?{icon:ca,label:n?`${n.name} / Sprints`:"Sprints"}:s.includes("/timeline")?{icon:ii,label:n?`${n.name} / Timeline`:"Timeline"}:s.includes("/access")?{icon:Ea,label:n?`${n.name} / Access`:"Access"}:s.includes("/reports")?{icon:ws,label:n?`${n.name} / Reports`:"Reports"}:s.includes("/activity")?{icon:Du,label:n?`${n.name} / Activity`:"Activity"}:s.endsWith("/projects")?{icon:wd,label:"Projects"}:s.includes("/notifications")?{icon:si,label:"Notifications"}:s.includes("/settings")?{icon:rx,label:"Settings"}:{icon:wd,label:"Meridian"}}function XD(){const{data:e=0}=G1(),{icon:t,label:r}=VD(),{workspace:n}=Te(),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(Fu,{className:"-ml-1"}),a.jsx(bo,{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-2",children:[a.jsx(HD,{}),a.jsx("span",{className:"hidden md:flex",children:a.jsx(Hu,{})}),a.jsx(ae,{variant:"ghost",size:"icon",asChild:!0,className:"relative size-8 text-muted-foreground hover:text-foreground",children:a.jsxs(Mr,{to:`/${s}/notifications`,children:[a.jsx(si,{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 QD(){const e=Wl(),{workspace:t}=zt(),r=t??"",{data:n=0}=G1(),{toggle:s}=Up(),i=[{key:"projects",label:"Projects",icon:D1,to:`/${r}/projects`,match:/\/projects($|\/)/},{key:"notifications",label:"Notifications",icon:si,to:`/${r}/notifications`,match:/\/notifications/,badge:n>0?n>9?"9+":String(n):null},{key:"my-tasks",label:"My Tasks",icon:Iu,to:`/${r}/my-tasks`,match:/\/my-tasks/},{key:"profile",label:"Profile",icon:Ql,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(Mr,{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(ki,{className:"h-5 w-5",strokeWidth:1.5}),a.jsx("span",{children:"Search"})]})]})})}function ZD(){const{user:e,token:t,login:r}=Te();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 JD(){return ZD(),a.jsxs(zu,{children:[a.jsx(TD,{variant:"inset"}),a.jsxs(Bu,{className:"flex flex-col min-w-0",children:[a.jsx(XD,{}),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(Ul,{})})]}),a.jsx(QD,{})]})}const ec={project:e=>["projects",e,"access"]};function da(e){return $e({queryKey:ec.project(e),queryFn:()=>oe.get(`/admin/projects/${e}/access`),enabled:!!e})}function V1(e){const t=Ne();return ye({mutationFn:({userIds:r,role:n})=>oe.post(`/admin/projects/${e}/members/batch`,{user_ids:r,role:n}),onSuccess:()=>{t.invalidateQueries({queryKey:ec.project(e)})}})}function X1(e){const t=Ne();return ye({mutationFn:r=>oe.delete(`/admin/projects/${e}/members/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:ec.project(e)})}})}function Q1(e){const t=Ne();return ye({mutationFn:r=>oe.post(`/admin/projects/${e}/teams/batch`,{team_ids:r}),onSuccess:()=>{t.invalidateQueries({queryKey:ec.project(e)})}})}function Z1(e){const t=Ne();return ye({mutationFn:r=>oe.delete(`/admin/projects/${e}/teams/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:ec.project(e)})}})}const Ha=Kl,eT=Hl,J1=h.forwardRef(({className:e,...t},r)=>a.jsx(yi,{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}));J1.displayName=yi.displayName;const ua=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(eT,{children:[a.jsx(J1,{}),a.jsxs(bi,{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(Pu,{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(Je,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ua.displayName=bi.displayName;const Ka=({className:e,...t})=>a.jsx("div",{className:z("flex flex-col space-y-1.5",e),...t});Ka.displayName="DialogHeader";const ox=({className:e,...t})=>a.jsx("div",{className:z("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});ox.displayName="DialogFooter";const Ya=h.forwardRef(({className:e,...t},r)=>a.jsx(ho,{ref:r,className:z("text-base font-semibold leading-none tracking-tight",e),...t}));Ya.displayName=ho.displayName;const jo=h.forwardRef(({className:e,...t},r)=>a.jsx(po,{ref:r,className:z("text-sm text-muted-foreground",e),...t}));jo.displayName=po.displayName;function tT({open:e,onClose:t,project:r}){const[n,s]=h.useState(null),i=SD(r.id),o=CD(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),U.success("Public link enabled")},onError:()=>U.error("Failed to enable public link")})},u=()=>{o.mutate(void 0,{onSuccess:()=>{s(null),U.success("Public link revoked")},onError:()=>U.error("Failed to revoke link")})},f=()=>{c&&navigator.clipboard.writeText(c).then(()=>{U.success("Link copied to clipboard")})},m=!!c;return a.jsx(Ha,{open:e,onOpenChange:p=>!p&&t(),children:a.jsxs(ua,{className:"sm:max-w-md overflow-hidden",children:[a.jsxs(Ka,{children:[a.jsxs(Ya,{className:"flex items-center gap-2",children:[a.jsx(oi,{className:"h-4 w-4"}),"Share project"]}),a.jsx(jo,{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(gh,{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(ae,{variant:"outline",size:"sm",className:"flex-1",onClick:f,children:[a.jsx(Vp,{className:"h-3.5 w-3.5 mr-1.5"}),"Copy link"]}),a.jsxs(ae,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:u,disabled:o.isPending,children:[a.jsx(Or,{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(Ea,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"This project is private"})]}),a.jsxs(ae,{className:"w-full",onClick:d,disabled:i.isPending,children:[a.jsx(gh,{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 eN(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 Gv=["board","issues","sprints","timeline","access","reports","activity"];function rT(){const{projectKey:e,workspace:t}=zt(),{data:r,error:n}=qa(e??""),{user:s}=Te(),{data:i}=da((r==null?void 0:r.id)??""),[o,l]=h.useState(!1),c=pt(),d=Wl(),[u]=ql(),f=eN(),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 Hp&&(n.status===403||n.status===404)&&c(`/${t}/projects`,{replace:!0})},[n,t,c]),h.useEffect(()=>{const k=u.get("tab");if(!k||!Gv.includes(k))return;Gv.every(S=>!d.pathname.endsWith(`/${S}`))&&c(`/${t}/projects/${e}/${k}`,{replace:!0})},[]);const v=`/${t}/projects/${e}`,y=[{to:`${v}/board`,label:"Board",icon:wd,end:!0,desktopOnly:!0},{to:`${v}/issues`,label:"Issues",icon:ea,end:!1},{to:`${v}/sprints`,label:"Sprints",icon:ca,end:!0},{to:`${v}/timeline`,label:"Timeline",icon:ii,end:!0,desktopOnly:!0},{to:`${v}/access`,label:"Access",icon:Ea,end:!0},{to:`${v}/reports`,label:"Reports",icon:ws,end:!0},{to:`${v}/activity`,label:"Activity",icon:Du,end:!0}],j=y,N=y.filter(k=>!k.desktopOnly),w=d.pathname.endsWith("/board")||d.pathname.endsWith("/timeline");return f&&w?a.jsx(Qn,{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:S,end:C})=>a.jsxs(jn,{to:k,end:C,className:({isActive:_})=>`flex items-center gap-1.5 px-3 py-2 text-sm border-b-2 transition-colors ${_?"border-foreground text-foreground font-medium":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[a.jsx(S,{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(ae,{variant:"ghost",size:"sm",onClick:()=>l(!0),className:"h-7 px-2 text-xs text-muted-foreground",children:[a.jsx(C5,{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:S,end:C})=>a.jsxs(jn,{to:k,end:C,className:({isActive:_})=>`flex items-center gap-1.5 px-3 py-2 text-sm border-b-2 whitespace-nowrap transition-colors shrink-0 ${_?"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(S,{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(Ul,{})}),r&&a.jsx(tT,{open:o,onClose:()=>l(!1),project:r})]})}function nT(){var s,i;const{user:e,logout:t}=Te(),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(kr,{children:a.jsx(Mt,{children:a.jsxs(Yr,{children:[a.jsx(Gr,{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(go,{className:"ml-auto size-4 shrink-0"})]})}),a.jsxs(Er,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[a.jsx(En,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:t,children:[a.jsx(Tu,{className:"size-4"}),"Sign out"]})]})]})})})}function aT(){const{workspace:e}=Te(),t=pt(),r=(e==null?void 0:e.slug)??"";return a.jsxs(Lu,{collapsible:"offcanvas",variant:"inset",children:[a.jsx(Wu,{children:a.jsx(kr,{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(ws,{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(qu,{children:a.jsx(Hs,{children:a.jsx(Ks,{children:a.jsx(kr,{children:a.jsx(Mt,{children:a.jsxs(St,{onClick:()=>t(r?`/${r}/projects`:"/"),tooltip:"Back to workspace",children:[a.jsx(Vl,{}),a.jsx("span",{children:"Back to workspace"})]})})})})})}),a.jsx(Uu,{children:a.jsx(nT,{})})]})}function sT(){return a.jsxs(zu,{children:[a.jsx(aT,{}),a.jsxs(Bu,{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(Fu,{className:"-ml-1"}),a.jsx(bo,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(ws,{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(Hu,{})})]})}),a.jsx("div",{className:"flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden",children:a.jsx(Ul,{})})]})]})}function iT(){var s,i;const{user:e,logout:t}=Te(),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(kr,{children:a.jsx(Mt,{children:a.jsxs(Yr,{children:[a.jsx(Gr,{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(go,{className:"ml-auto size-4 shrink-0"})]})}),a.jsxs(Er,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[a.jsx(En,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:t,children:[a.jsx(Tu,{className:"size-4"}),"Sign out"]})]})]})})})}function oT(){const{workspace:e}=Te(),t=pt(),r=(e==null?void 0:e.slug)??"";return a.jsxs(Lu,{collapsible:"offcanvas",variant:"inset",children:[a.jsx(Wu,{children:a.jsx(kr,{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(tx,{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(qu,{children:a.jsx(Hs,{children:a.jsx(Ks,{children:a.jsx(kr,{children:a.jsx(Mt,{children:a.jsxs(St,{onClick:()=>t(r?`/${r}/projects`:"/"),tooltip:"Back to workspace",children:[a.jsx(Vl,{}),a.jsx("span",{children:"Back to workspace"})]})})})})})}),a.jsx(Uu,{children:a.jsx(iT,{})})]})}function lT(){return a.jsxs(zu,{children:[a.jsx(oT,{}),a.jsxs(Bu,{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(Fu,{className:"-ml-1"}),a.jsx(bo,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(tx,{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(Hu,{})})]})}),a.jsx("div",{className:"flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden",children:a.jsx(Ul,{})})]})]})}function cT(){var s,i;const{user:e,logout:t}=Te(),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(kr,{children:a.jsx(Mt,{children:a.jsxs(Yr,{children:[a.jsx(Gr,{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(jl,{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(go,{className:"ml-auto size-4 shrink-0"})]})}),a.jsxs(Er,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[a.jsx(En,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:t,children:[a.jsx(Tu,{className:"size-4"}),"Sign out"]})]})]})})})}function dT(){const{workspace:e}=Te(),t=pt(),r=(e==null?void 0:e.slug)??"";return a.jsxs(Lu,{collapsible:"offcanvas",variant:"inset",children:[a.jsx(Wu,{children:a.jsx(kr,{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(Ql,{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(qu,{children:a.jsx(Hs,{children:a.jsx(Ks,{children:a.jsx(kr,{children:a.jsx(Mt,{children:a.jsxs(St,{onClick:()=>t(r?`/${r}/projects`:"/"),tooltip:"Back to workspace",children:[a.jsx(Vl,{}),a.jsx("span",{children:"Back to workspace"})]})})})})})}),a.jsx(Uu,{children:a.jsx(cT,{})})]})}function uT(){return a.jsxs(zu,{children:[a.jsx(dT,{}),a.jsxs(Bu,{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(Fu,{className:"-ml-1"}),a.jsx(bo,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(Ql,{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(Hu,{})})]})}),a.jsx("div",{className:"flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden",children:a.jsx(Ul,{})})]})]})}var Vv=1,fT=.9,mT=.8,hT=.17,hm=.1,pm=.999,pT=.9999,xT=.99,gT=/[\\\/_+.#"@\[\(\{&]/,vT=/[\\\/_+.#"@\[\(\{&]/g,yT=/[\s-]/,tN=/[\s-]/g;function yh(e,t,r,n,s,i,o){if(i===t.length)return s===e.length?Vv:xT;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=yh(e,t,r,n,d+1,i+1,o),f>u&&(d===s?f*=Vv:gT.test(e.charAt(d-1))?(f*=mT,p=e.slice(s,d-1).match(vT),p&&s>0&&(f*=Math.pow(pm,p.length))):yT.test(e.charAt(d-1))?(f*=fT,x=e.slice(s,d-1).match(tN),x&&s>0&&(f*=Math.pow(pm,x.length))):(f*=hT,s>0&&(f*=Math.pow(pm,d-s))),e.charAt(d)!==t.charAt(i)&&(f*=pT)),(f<hm&&r.charAt(d-1)===n.charAt(i+1)||n.charAt(i+1)===n.charAt(i)&&r.charAt(d-1)!==n.charAt(i))&&(m=yh(e,t,r,n,d+1,i+2,o),m*hm>f&&(f=m*hm)),f>u&&(u=f),d=r.indexOf(c,d+1);return o[l]=u,u}function Xv(e){return e.toLowerCase().replace(tN," ")}function bT(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,yh(e,t,Xv(e),Xv(t),0,0,{})}var Ho='[cmdk-group=""]',xm='[cmdk-group-items=""]',wT='[cmdk-group-heading=""]',lx='[cmdk-item=""]',Qv=`${lx}:not([aria-disabled="true"])`,bh="cmdk-item-select",Us="data-value",jT=(e,t,r)=>bT(e,t,r),rN=h.createContext(void 0),tc=()=>h.useContext(rN),nN=h.createContext(void 0),cx=()=>h.useContext(nN),aN=h.createContext(void 0),sN=h.forwardRef((e,t)=>{let r=Fi(()=>{var L,K;return{search:"",value:(K=(L=e.value)!=null?L:e.defaultValue)!=null?K:"",filtered:{count:0,items:new Map,groups:new Set}}}),n=Fi(()=>new Set),s=Fi(()=>new Map),i=Fi(()=>new Map),o=Fi(()=>new Set),l=iN(e),{label:c,children:d,value:u,onValueChange:f,filter:m,shouldFilter:p,loop:x,disablePointerSelection:g=!1,vimBindings:v=!0,...y}=e,j=qi(),N=qi(),w=qi(),k=h.useRef(null),b=DT();ci(()=>{if(u!==void 0){let L=u.trim();r.current.value=L,S.emit()}},[u]),ci(()=>{b(6,T)},[]);let S=h.useMemo(()=>({subscribe:L=>(o.current.add(L),()=>o.current.delete(L)),snapshot:()=>r.current,setState:(L,K,R)=>{var Y,P,I;if(!Object.is(r.current[L],K)){if(r.current[L]=K,L==="search")A(),M(),b(1,D);else if(L==="value"&&(R||b(5,T),((Y=l.current)==null?void 0:Y.value)!==void 0)){let te=K??"";(I=(P=l.current).onValueChange)==null||I.call(P,te);return}S.emit()}},emit:()=>{o.current.forEach(L=>L())}}),[]),C=h.useMemo(()=>({value:(L,K,R)=>{var Y;K!==((Y=i.current.get(L))==null?void 0:Y.value)&&(i.current.set(L,{value:K,keywords:R}),r.current.filtered.items.set(L,_(K,R)),b(2,()=>{M(),S.emit()}))},item:(L,K)=>(n.current.add(L),K&&(s.current.has(K)?s.current.get(K).add(L):s.current.set(K,new Set([L]))),b(3,()=>{A(),M(),r.current.value||D(),S.emit()}),()=>{i.current.delete(L),n.current.delete(L),r.current.filtered.items.delete(L);let R=$();b(4,()=>{A(),(R==null?void 0:R.getAttribute("id"))===L&&D(),S.emit()})}),group:L=>(s.current.has(L)||s.current.set(L,new Set),()=>{i.current.delete(L),s.current.delete(L)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:j,inputId:w,labelId:N,listInnerRef:k}),[]);function _(L,K){var R,Y;let P=(Y=(R=l.current)==null?void 0:R.filter)!=null?Y:jT;return L?P(L,r.current.search,K):0}function M(){if(!r.current.search||l.current.shouldFilter===!1)return;let L=r.current.filtered.items,K=[];r.current.filtered.groups.forEach(Y=>{let P=s.current.get(Y),I=0;P.forEach(te=>{let F=L.get(te);I=Math.max(F,I)}),K.push([Y,I])});let R=k.current;Z().sort((Y,P)=>{var I,te;let F=Y.getAttribute("id"),X=P.getAttribute("id");return((I=L.get(X))!=null?I:0)-((te=L.get(F))!=null?te:0)}).forEach(Y=>{let P=Y.closest(xm);P?P.appendChild(Y.parentElement===P?Y:Y.closest(`${xm} > *`)):R.appendChild(Y.parentElement===R?Y:Y.closest(`${xm} > *`))}),K.sort((Y,P)=>P[1]-Y[1]).forEach(Y=>{var P;let I=(P=k.current)==null?void 0:P.querySelector(`${Ho}[${Us}="${encodeURIComponent(Y[0])}"]`);I==null||I.parentElement.appendChild(I)})}function D(){let L=Z().find(R=>R.getAttribute("aria-disabled")!=="true"),K=L==null?void 0:L.getAttribute(Us);S.setState("value",K||void 0)}function A(){var L,K,R,Y;if(!r.current.search||l.current.shouldFilter===!1){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let P=0;for(let I of n.current){let te=(K=(L=i.current.get(I))==null?void 0:L.value)!=null?K:"",F=(Y=(R=i.current.get(I))==null?void 0:R.keywords)!=null?Y:[],X=_(te,F);r.current.filtered.items.set(I,X),X>0&&P++}for(let[I,te]of s.current)for(let F of te)if(r.current.filtered.items.get(F)>0){r.current.filtered.groups.add(I);break}r.current.filtered.count=P}function T(){var L,K,R;let Y=$();Y&&(((L=Y.parentElement)==null?void 0:L.firstChild)===Y&&((R=(K=Y.closest(Ho))==null?void 0:K.querySelector(wT))==null||R.scrollIntoView({block:"nearest"})),Y.scrollIntoView({block:"nearest"}))}function $(){var L;return(L=k.current)==null?void 0:L.querySelector(`${lx}[aria-selected="true"]`)}function Z(){var L;return Array.from(((L=k.current)==null?void 0:L.querySelectorAll(Qv))||[])}function H(L){let K=Z()[L];K&&S.setState("value",K.getAttribute(Us))}function Q(L){var K;let R=$(),Y=Z(),P=Y.findIndex(te=>te===R),I=Y[P+L];(K=l.current)!=null&&K.loop&&(I=P+L<0?Y[Y.length-1]:P+L===Y.length?Y[0]:Y[P+L]),I&&S.setState("value",I.getAttribute(Us))}function ne(L){let K=$(),R=K==null?void 0:K.closest(Ho),Y;for(;R&&!Y;)R=L>0?ET(R,Ho):AT(R,Ho),Y=R==null?void 0:R.querySelector(Qv);Y?S.setState("value",Y.getAttribute(Us)):Q(L)}let J=()=>H(Z().length-1),O=L=>{L.preventDefault(),L.metaKey?J():L.altKey?ne(1):Q(1)},E=L=>{L.preventDefault(),L.metaKey?H(0):L.altKey?ne(-1):Q(-1)};return h.createElement(Ss.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:L=>{var K;if((K=y.onKeyDown)==null||K.call(y,L),!L.defaultPrevented)switch(L.key){case"n":case"j":{v&&L.ctrlKey&&O(L);break}case"ArrowDown":{O(L);break}case"p":case"k":{v&&L.ctrlKey&&E(L);break}case"ArrowUp":{E(L);break}case"Home":{L.preventDefault(),H(0);break}case"End":{L.preventDefault(),J();break}case"Enter":if(!L.nativeEvent.isComposing&&L.keyCode!==229){L.preventDefault();let R=$();if(R){let Y=new Event(bh);R.dispatchEvent(Y)}}}}},h.createElement("label",{"cmdk-label":"",htmlFor:C.inputId,id:C.labelId,style:IT},c),Ku(e,L=>h.createElement(nN.Provider,{value:S},h.createElement(rN.Provider,{value:C},L))))}),NT=h.forwardRef((e,t)=>{var r,n;let s=qi(),i=h.useRef(null),o=h.useContext(aN),l=tc(),c=iN(e),d=(n=(r=c.current)==null?void 0:r.forceMount)!=null?n:o==null?void 0:o.forceMount;ci(()=>{if(!d)return l.item(s,o==null?void 0:o.id)},[d]);let u=oN(s,i,[e.value,e.children,i],e.keywords),f=cx(),m=di(b=>b.value&&b.value===u.current),p=di(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(bh,x),()=>b.removeEventListener(bh,x)},[p,e.onSelect,e.disabled]);function x(){var b,S;g(),(S=(b=c.current).onSelect)==null||S.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(Ss.div,{ref:Nl([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)}),kT=h.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:s,...i}=e,o=qi(),l=h.useRef(null),c=h.useRef(null),d=qi(),u=tc(),f=di(p=>s||u.filter()===!1?!0:p.search?p.filtered.groups.has(o):!0);ci(()=>u.group(o),[]),oN(o,l,[e.value,e.heading,c]);let m=h.useMemo(()=>({id:o,forceMount:s}),[s]);return h.createElement(Ss.div,{ref:Nl([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),Ku(e,p=>h.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},h.createElement(aN.Provider,{value:m},p))))}),ST=h.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,s=h.useRef(null),i=di(o=>!o.search);return!r&&!i?null:h.createElement(Ss.div,{ref:Nl([s,t]),...n,"cmdk-separator":"",role:"separator"})}),CT=h.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,s=e.value!=null,i=cx(),o=di(u=>u.search),l=di(u=>u.value),c=tc(),d=h.useMemo(()=>{var u;let f=(u=c.listInnerRef.current)==null?void 0:u.querySelector(`${lx}[${Us}="${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(Ss.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)}})}),_T=h.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...s}=e,i=h.useRef(null),o=h.useRef(null),l=tc();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(Ss.div,{ref:Nl([i,t]),...s,"cmdk-list":"",role:"listbox","aria-label":n,id:l.listId},Ku(e,c=>h.createElement("div",{ref:Nl([o,l.listInnerRef]),"cmdk-list-sizer":""},c)))}),MT=h.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:s,contentClassName:i,container:o,...l}=e;return h.createElement(Kl,{open:r,onOpenChange:n},h.createElement(Hl,{container:o},h.createElement(yi,{"cmdk-overlay":"",className:s}),h.createElement(bi,{"aria-label":e.label,"cmdk-dialog":"",className:i},h.createElement(sN,{ref:t,...l}))))}),PT=h.forwardRef((e,t)=>di(r=>r.filtered.count===0)?h.createElement(Ss.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),OT=h.forwardRef((e,t)=>{let{progress:r,children:n,label:s="Loading...",...i}=e;return h.createElement(Ss.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Ku(e,o=>h.createElement("div",{"aria-hidden":!0},o)))}),Vr=Object.assign(sN,{List:_T,Item:NT,Input:CT,Group:kT,Separator:ST,Dialog:MT,Empty:PT,Loading:OT});function ET(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function AT(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function iN(e){let t=h.useRef(e);return ci(()=>{t.current=e}),t}var ci=typeof window>"u"?h.useEffect:h.useLayoutEffect;function Fi(e){let t=h.useRef();return t.current===void 0&&(t.current=e()),t}function Nl(e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}function di(e){let t=cx(),r=()=>e(t.snapshot());return EO.useSyncExternalStore(t.subscribe,r,r)}function oN(e,t,r,n=[]){let s=h.useRef(),i=tc();return ci(()=>{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(Us,l),s.current=l}),s}var DT=()=>{let[e,t]=h.useState(),r=Fi(()=>new Map);return ci(()=>{r.current.forEach(n=>n()),r.current=new Map},[e]),(n,s)=>{r.current.set(n,s),t({})}};function TT(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Ku({asChild:e,children:t},r){return e&&h.isValidElement(t)?h.cloneElement(TT(t),{ref:t.ref},r(t.props.children)):r(t)}var IT={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Zs=h.forwardRef(({className:e,...t},r)=>a.jsx(Vr,{ref:r,className:z("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));Zs.displayName=Vr.displayName;const RT=({children:e,open:t,onOpenChange:r})=>a.jsx(Ha,{open:t,onOpenChange:r,children:a.jsx(ua,{className:"overflow-hidden p-0 shadow-lg max-w-[560px]",children:a.jsx(Zs,{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})})}),Yu=h.forwardRef(({className:e,...t},r)=>a.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[a.jsx(ki,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),a.jsx(Vr.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})]}));Yu.displayName=Vr.Input.displayName;const Js=h.forwardRef(({className:e,...t},r)=>a.jsx(Vr.List,{ref:r,className:z("max-h-[320px] overflow-y-auto overflow-x-hidden",e),...t}));Js.displayName=Vr.List.displayName;const Gu=h.forwardRef((e,t)=>a.jsx(Vr.Empty,{ref:t,className:"py-6 text-center text-sm text-muted-foreground",...e}));Gu.displayName=Vr.Empty.displayName;const us=h.forwardRef(({className:e,...t},r)=>a.jsx(Vr.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}));us.displayName=Vr.Group.displayName;const lN=h.forwardRef(({className:e,...t},r)=>a.jsx(Vr.Separator,{ref:r,className:z("-mx-1 h-px bg-border",e),...t}));lN.displayName=Vr.Separator.displayName;const fn=h.forwardRef(({className:e,...t},r)=>a.jsx(Vr.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}));fn.displayName=Vr.Item.displayName;function $T(){const{open:e,setOpen:t}=Up(),r=pt(),{data:n}=wo(),{workspace:s}=Te(),i=(s==null?void 0:s.slug)??"",o=l=>{t(!1),l()};return a.jsxs(RT,{open:e,onOpenChange:t,children:[a.jsx(Yu,{placeholder:"Search or jump to..."}),a.jsxs(Js,{children:[a.jsx(Gu,{children:"No results found."}),a.jsxs(us,{heading:"Navigation",children:[a.jsxs(fn,{onSelect:()=>o(()=>r(`/${i}/projects`)),children:[a.jsx(wd,{className:"text-muted-foreground"}),a.jsx("span",{children:"Projects"})]}),a.jsxs(fn,{onSelect:()=>o(()=>r(`/${i}/notifications`)),children:[a.jsx(si,{className:"text-muted-foreground"}),a.jsx("span",{children:"Notifications"})]}),a.jsxs(fn,{onSelect:()=>o(()=>r(`/${i}/settings`)),children:[a.jsx(rx,{className:"text-muted-foreground"}),a.jsx("span",{children:"Settings"})]})]}),n&&n.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(lN,{}),a.jsxs(us,{heading:"Projects",children:[n.map(l=>a.jsxs(fn,{value:`${l.name} board`,onSelect:()=>o(()=>r(`/${i}/projects/${l.identifier}/board`)),children:[a.jsx(Kr,{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(fn,{value:`${l.name} issues`,onSelect:()=>o(()=>r(`/${i}/projects/${l.identifier}/issues`)),children:[a.jsx(ea,{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 _r({zone:e,props:t}){const r=ZA(e);return r.length?a.jsx(a.Fragment,{children:r.map((n,s)=>a.jsx(n,{...t},n.displayName??n.name??s))}):null}function dx({flow:e,inviteToken:t,label:r,disabled:n}){const s=()=>{const i=`${Xi}/auth/google?flow=${e}${t?`&invite_token=${encodeURIComponent(t)}`:""}`;window.location.href=i};return a.jsxs(ae,{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 rc(){var e;return((e=window.__MERIDIAN_CONFIG__)==null?void 0:e.appName)??"Meridian"}function zT(){var e;return(e=window.__MERIDIAN_CONFIG__)==null?void 0:e.logoUrl}function nc({className:e}){const t=zT();return t?a.jsx("img",{src:t,alt:rc(),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 LT(){const[e,t]=h.useState(""),[r,n]=h.useState(""),[s,i]=h.useState(!1),o=pt(),l=eD(),{data:c}=$u(),d=u=>{u.preventDefault(),l.mutate({email:e,password:r},{onSuccess:()=>o("/"),onError:f=>U.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(_r,{zone:"login.before",props:{}}),a.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[a.jsx(nc,{}),a.jsxs("div",{className:"text-center",children:[a.jsxs("h1",{className:"text-lg font-semibold text-foreground",children:["Welcome to ",rc()]}),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(Me,{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(Me,{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(Xl,{className:"h-4 w-4"}):a.jsx(Ni,{className:"h-4 w-4"})})]}),a.jsx("div",{className:"flex justify-end",children:a.jsx(Mr,{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(ae,{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(dx,{flow:"login"})]}),a.jsxs("p",{className:"text-sm text-center text-muted-foreground mt-6",children:["Don't have an account?"," ",a.jsx(Mr,{to:"/register",className:"text-indigo hover:opacity-80 transition-opacity",children:"Create one"})]}),a.jsx(_r,{zone:"login.after",props:{}})]})})}function FT(){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=tD(),{data:m}=$u(),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=>U.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(nc,{}),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 ${rc()}`})]})]}),a.jsxs("form",{onSubmit:x,className:"space-y-2",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx(Me,{placeholder:"First name",value:e,onChange:g=>t(g.target.value),required:!0,className:"bg-white dark:bg-card h-10"}),a.jsx(Me,{placeholder:"Last name",value:r,onChange:g=>n(g.target.value),required:!0,className:"bg-white dark:bg-card h-10"})]}),a.jsx(Me,{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(Me,{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(Xl,{className:"h-4 w-4"}):a.jsx(Ni,{className:"h-4 w-4"})})]}),a.jsx("div",{className:"pt-1",children:a.jsx(ae,{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(dx,{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(Mr,{to:"/login",className:"text-indigo hover:opacity-80 transition-opacity",children:"Sign in"})]})]})})}function BT(){const[e,t]=h.useState(""),[r,n]=h.useState(!1),s=pt(),{setWorkspace:i}=Te(),o=L5(),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=>U.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(nc,{}),a.jsxs("div",{className:"text-center",children:[a.jsxs("h1",{className:"text-lg font-semibold text-foreground",children:["Create your ",rc()," 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(Me,{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(Ea,{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(ae,{type:"submit",className:"w-full h-10 font-medium",disabled:!e.trim()||o.isPending,children:o.isPending?"Creating workspace...":"Create workspace"})]})]})})}function WT(){const{logout:e}=Te();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(nc,{}),a.jsxs("div",{className:"text-center",children:[a.jsxs("h1",{className:"text-lg font-semibold text-foreground",children:["Waiting for ",rc()," 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(ae,{variant:"outline",className:"w-full",onClick:e,children:"Sign out"})]})})}function UT(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 cN=B.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}),ac=()=>{const e=B.useContext(cN);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};UT(`[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 ca=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 $5({issue:e}){const t=Au(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:()=>{U.success("Metadata saved"),n(""),i(""),l(!1)},onError:()=>U.error("Failed to save metadata")})},f=m=>{const p={...c};delete p[m],t.mutate({metadata:Object.keys(p).length?p:null},{onSuccess:()=>U.success("Entry removed"),onError:()=>U.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(o5,{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(Or,{className:"h-3 w-3"})})]},m)),o&&a.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[a.jsx(Me,{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(Me,{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(ae,{size:"sm",className:"h-7 px-2 text-xs",onClick:u,disabled:!r.trim()||t.isPending,children:"Save"}),a.jsx(ae,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",onClick:()=>{l(!1),n(""),i("")},children:"Cancel"})]})]})]})}const z5=[{zone:"issue.details.after",component:$5}];function yo(e=!0){return $e({queryKey:["workspaces"],queryFn:()=>oe.get("/admin/workspaces"),select:t=>t.workspaces,enabled:e})}function L5(){const e=Ne();return ye({mutationFn:t=>oe.post("/admin/workspaces",t),onSuccess:()=>{e.invalidateQueries({queryKey:["workspaces"]})}})}function F5(e){const t=Ne();return ye({mutationFn:r=>oe.put(`/admin/workspaces/${e}`,r),onSuccess:()=>{t.invalidateQueries({queryKey:["workspaces"]})}})}function B5(e){const t=Ne();return ye({mutationFn:r=>{const n=new FormData;return n.append("logo",r),oe.upload(`/admin/workspaces/${e}/logo`,n)},onSuccess:()=>t.invalidateQueries({queryKey:["workspaces"]})})}function W5(e){const t=Ne();return ye({mutationFn:()=>oe.delete(`/admin/workspaces/${e}/logo`),onSuccess:()=>t.invalidateQueries({queryKey:["workspaces"]})})}const nx={list:e=>["workspaces",e,"invitations"]};function U5(e){return $e({queryKey:nx.list(e),queryFn:()=>oe.get(`/admin/workspaces/${e}/invitations`),select:t=>t.invitations,enabled:!!e})}function q5(e){const t=Ne();return ye({mutationFn:r=>oe.post(`/admin/workspaces/${e}/invitations`,r),onSuccess:()=>{t.invalidateQueries({queryKey:nx.list(e)})}})}function H5(e){const t=Ne();return ye({mutationFn:r=>oe.delete(`/admin/workspaces/${e}/invitations/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:nx.list(e)})}})}function K5(e){return ye({mutationFn:t=>oe.post(`/admin/workspaces/${e}/invitations/${t}/resend`)})}const ax={list:e=>["workspaces",e,"members"]};function Zl(e){return $e({queryKey:ax.list(e),queryFn:()=>oe.get(`/admin/workspaces/${e}/members`),select:t=>t.members,enabled:!!e})}function Y5(e){const t=Ne();return ye({mutationFn:r=>oe.post(`/admin/workspaces/${e}/members/batch`,r),onSuccess:()=>{t.invalidateQueries({queryKey:ax.list(e)}),t.invalidateQueries({queryKey:["workspaces"]})}})}function G5(e){const t=Ne();return ye({mutationFn:r=>oe.delete(`/admin/workspaces/${e}/members/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:ax.list(e)}),t.invalidateQueries({queryKey:["workspaces"]})}})}const Ns={list:e=>["workspaces",e,"teams"],members:(e,t)=>["workspaces",e,"teams",t,"members"]};function Ru(e){return $e({queryKey:Ns.list(e),queryFn:()=>oe.get(`/admin/workspaces/${e}/teams`),select:t=>t.teams,enabled:!!e})}function V5(e){const t=Ne();return ye({mutationFn:r=>oe.post(`/admin/workspaces/${e}/teams`,r),onSuccess:()=>{t.invalidateQueries({queryKey:Ns.list(e)})}})}function X5(e){const t=Ne();return ye({mutationFn:r=>oe.delete(`/admin/workspaces/${e}/teams/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:Ns.list(e)})}})}function Q5(e,t){return $e({queryKey:Ns.members(e,t),queryFn:()=>oe.get(`/admin/workspaces/${e}/teams/${t}/members`),select:r=>r.members,enabled:!!(e&&t)})}function Z5(e,t){const r=Ne();return ye({mutationFn:n=>oe.post(`/admin/workspaces/${e}/teams/${t}/members`,{user_id:n}),onSuccess:()=>{r.invalidateQueries({queryKey:Ns.members(e,t)}),r.invalidateQueries({queryKey:Ns.list(e)})}})}function J5(e,t){const r=Ne();return ye({mutationFn:n=>oe.delete(`/admin/workspaces/${e}/teams/${t}/members/${n}`),onSuccess:()=>{r.invalidateQueries({queryKey:Ns.members(e,t)}),r.invalidateQueries({queryKey:Ns.list(e)})}})}function $u(){return $e({queryKey:["setup-status"],queryFn:()=>oe.get("/auth/setup"),staleTime:6e4,retry:!1})}function eD(){const{login:e}=Te();return ye({mutationFn:t=>oe.post("/auth/login",t),onSuccess:t=>{e(t.user,t.token)}})}function tD(){const{login:e}=Te();return ye({mutationFn:t=>oe.post("/auth/register",t),onSuccess:t=>{e(t.user,t.token)}})}function rD(){return ye({mutationFn:e=>oe.post("/auth/forgot-password",e)})}function nD(){return ye({mutationFn:e=>oe.post("/auth/reset-password",e)})}function aD(e){const{login:t}=Te();return ye({mutationFn:r=>oe.post(`/auth/invite/${e}`,r),onSuccess:r=>{t(r.user,r.token)}})}var Nj;const sD=((Nj=window.__MERIDIAN_CONFIG__)==null?void 0:Nj.apiUrl)??void 0??"";function iD(e,t){const r=`${sD}/admin/events?token=${encodeURIComponent(e)}&workspaceId=${encodeURIComponent(t)}`;return new EventSource(r)}function oD(){const{token:e,workspace:t}=Te(),r=Ne(),n=h.useRef(null);h.useEffect(()=>{if(!e||!t)return;const s=iD(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.addEventListener("timer.started",()=>{i([["time-logs"]])}),s.addEventListener("timer.stopped",()=>{i([["time-logs"]])}),s.addEventListener("notification.created",()=>{i([["notifications"]])}),s.onerror=()=>{},()=>{s.close(),n.current=null}},[e,t==null?void 0:t.id,r])}const mm=768;function lD(){const[e,t]=h.useState(void 0);return h.useEffect(()=>{const r=window.matchMedia(`(max-width: ${mm-1}px)`),n=()=>{t(window.innerWidth<mm)};return r.addEventListener("change",n),t(window.innerWidth<mm),()=>r.removeEventListener("change",n)},[]),!!e}const bo=h.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},s)=>a.jsx(Sj,{ref:s,decorative:r,orientation:t,className:z("shrink-0 bg-border",t==="horizontal"?"h-px w-full":"h-full w-px",e),...n}));bo.displayName=Sj.displayName;const cD=Kl,dD=Hl,W1=h.forwardRef(({className:e,...t},r)=>a.jsx(yi,{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}));W1.displayName=yi.displayName;const uD=Gl("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"}}),U1=h.forwardRef(({side:e="right",className:t,children:r,...n},s)=>a.jsxs(dD,{children:[a.jsx(W1,{}),a.jsxs(bi,{ref:s,className:z(uD({side:e}),t),...n,children:[r,a.jsxs(Pu,{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(Je,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));U1.displayName=bi.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 H1=h.forwardRef(({className:e,...t},r)=>a.jsx(ho,{ref:r,className:z("text-base font-semibold text-foreground",e),...t}));H1.displayName=ho.displayName;const K1=h.forwardRef(({className:e,...t},r)=>a.jsx(po,{ref:r,className:z("text-sm text-muted-foreground",e),...t}));K1.displayName=po.displayName;function le({className:e,...t}){return a.jsx("div",{className:z("animate-pulse rounded-md bg-muted",e),...t})}const fD="sidebar_state",mD=60*60*24*7,hD="16rem",pD="18rem",xD="3rem",gD="b",Y1=h.createContext(null);function sx(){const e=h.useContext(Y1);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function zu({defaultOpen:e=!0,open:t,onOpenChange:r,className:n,style:s,children:i,...o}){const l=lD(),[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=`${fD}=${j}; path=/; max-age=${mD}`},[r,m]),x=h.useCallback(()=>l?d(y=>!y):p(y=>!y),[l,p,d]);h.useEffect(()=>{const y=j=>{j.key===gD&&(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(Y1.Provider,{value:v,children:a.jsx(Eu,{delayDuration:0,children:a.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":hD,"--sidebar-width-icon":xD,...s},className:z("group/sidebar-wrapper has-[[data-variant=inset]]:bg-sidebar flex h-svh w-full",n),...o,children:i})})})}function Lu({side:e="left",variant:t="sidebar",collapsible:r="offcanvas",className:n,children:s,...i}){const{isMobile:o,state:l,openMobile:c,setOpenMobile:d}=sx();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(cD,{open:c,onOpenChange:d,...i,children:a.jsxs(U1,{"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":pD},side:e,children:[a.jsxs(q1,{className:"sr-only",children:[a.jsx(H1,{children:"Sidebar"}),a.jsx(K1,{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 Fu({className:e,onClick:t,...r}){const{toggleSidebar:n}=sx();return a.jsxs(ae,{"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(w5,{}),a.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function Bu({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 Wu({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 Uu({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 Kv({className:e,...t}){return a.jsx(bo,{"data-slot":"sidebar-separator","data-sidebar":"separator",className:z("bg-sidebar-border mx-2 w-auto",e),...t})}function qu({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 Hs({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 Yv({className:e,asChild:t=!1,...r}){const n=t?$p:"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 Ks({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 kr({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 vD=Gl("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?$p:"button",{isMobile:u,state:f}=sx(),m=a.jsx(d,{ref:c,"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":s,"data-active":r,className:z(vD({variant:n,size:s}),o),...l});return i?(typeof i=="string"&&(i={children:i}),a.jsxs(Zn,{children:[a.jsx(Jn,{asChild:!0,children:m}),a.jsx(Mn,{side:"right",align:"center",hidden:f!=="collapsed"||u,...i})]})):m});St.displayName="SidebarMenuButton";const yD=250,bD=300,en={all:["projects"],list:()=>[...en.all,"list"],detail:e=>[...en.all,e],byKey:e=>[...en.all,"key",e],activities:e=>[...en.all,e,"activities"]};function wo(e){const{workspace:t}=Te(),r=e==null?void 0:e.workspaceIds,n=!(e!=null&&e.allWorkspaces)&&!(r!=null&&r.length),s=n?t==null?void 0:t.id:void 0;return $e({queryKey:[...en.list(),s??r??"all"],queryFn:()=>{const i=new URLSearchParams;s?i.set("workspace_id",s):r!=null&&r.length&&i.set("workspace_ids",r.join(","));const o=i.toString()?`?${i}`:"";return oe.get(`/admin/projects${o}`)},select:i=>i.projects,enabled:n?!!(t!=null&&t.id):!0})}function qa(e){return $e({queryKey:en.byKey(e),queryFn:()=>oe.get(`/admin/projects/by-identifier/${encodeURIComponent(e)}`),select:t=>t.project,enabled:!!e})}function wD(e,t={}){const[r,n]=h.useState(e),s=t.enabled!==!1;return h.useEffect(()=>{if(!s)return;const l=setTimeout(()=>n(e),yD);return()=>clearTimeout(l)},[e,s]),{...$e({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 jD(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),bD);return()=>clearTimeout(l)},[r]);const o=$e({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 ND(){const e=Ne();return ye({mutationFn:t=>oe.post("/admin/projects",t),onSuccess:()=>{e.invalidateQueries({queryKey:en.list()})}})}function kD(){const e=Ne();return ye({mutationFn:t=>oe.delete(`/admin/projects/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:en.list()})}})}function SD(e){const t=Ne();return ye({mutationFn:()=>oe.post(`/admin/projects/${e}/share`,{}),onSuccess:()=>{t.invalidateQueries({queryKey:en.detail(e)}),t.invalidateQueries({queryKey:en.list()})}})}function CD(e){const t=Ne();return ye({mutationFn:()=>oe.delete(`/admin/projects/${e}/share`),onSuccess:()=>{t.invalidateQueries({queryKey:en.detail(e)}),t.invalidateQueries({queryKey:en.list()})}})}function _D(e){return $e({queryKey:en.activities(e),queryFn:()=>oe.get(`/admin/projects/${e}/activities`),select:t=>t.activities,enabled:!!e})}const Yr=PO,Gr=OO,MD=h.forwardRef(({className:e,inset:t,children:r,...n},s)=>a.jsxs(Cj,{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(hr,{className:"ml-auto"})]}));MD.displayName=Cj.displayName;const PD=h.forwardRef(({className:e,...t},r)=>a.jsx(_j,{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}));PD.displayName=_j.displayName;const Er=h.forwardRef(({className:e,sideOffset:t=4,...r},n)=>a.jsx(MO,{children:a.jsx(Mj,{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})}));Er.displayName=Mj.displayName;const at=h.forwardRef(({className:e,inset:t,...r},n)=>a.jsx(Pj,{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=Pj.displayName;const OD=h.forwardRef(({className:e,children:t,checked:r,...n},s)=>a.jsxs(Oj,{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(Ej,{children:a.jsx(Xt,{className:"h-4 w-4"})})}),t]}));OD.displayName=Oj.displayName;const ED=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(Aj,{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(Ej,{children:a.jsx(Pr,{className:"h-2 w-2 fill-current"})})}),t]}));ED.displayName=Aj.displayName;const ix=h.forwardRef(({className:e,inset:t,...r},n)=>a.jsx(Dj,{ref:n,className:z("px-2 py-1.5 text-xs font-medium text-muted-foreground",t&&"pl-8",e),...r}));ix.displayName=Dj.displayName;const En=h.forwardRef(({className:e,...t},r)=>a.jsx(Tj,{ref:r,className:z("-mx-1 my-1 h-px bg-border",e),...t}));En.displayName=Tj.displayName;const Rt=h.forwardRef(({className:e,...t},r)=>a.jsx(Ij,{ref:r,className:z("relative flex h-8 w-8 shrink-0 overflow-hidden rounded-full",e),...t}));Rt.displayName=Ij.displayName;const jl=h.forwardRef(({className:e,...t},r)=>a.jsx(Rj,{ref:r,className:z("aspect-square h-full w-full",e),...t}));jl.displayName=Rj.displayName;const $t=h.forwardRef(({className:e,...t},r)=>a.jsx($j,{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=$j.displayName;function AD(){var s;const{workspace:e,setWorkspace:t}=Te(),{data:r}=yo(),n=pt();return a.jsx(kr,{children:a.jsx(Mt,{children:a.jsxs(Yr,{children:[a.jsx(Gr,{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(go,{className:"ml-auto size-4 shrink-0"})]})}),a.jsxs(Er,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"bottom",align:"start",sideOffset:4,children:[a.jsx(ix,{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(Xt,{className:"size-3.5 text-muted-foreground shrink-0"})]},i.id)),a.jsx(En,{}),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 DD(){var i,o,l,c;const{user:e,logout:t}=Te(),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(kr,{children:a.jsx(Mt,{children:a.jsxs(Yr,{children:[a.jsx(Gr,{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(jl,{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(go,{className:"ml-auto size-4 shrink-0"})]})}),a.jsxs(Er,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[a.jsx(ix,{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(jl,{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(En,{}),a.jsxs(at,{className:"cursor-pointer gap-2",onClick:()=>r("/profile"),children:[a.jsx(Ql,{className:"size-4"}),"Profile"]}),a.jsx(En,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:t,children:[a.jsx(Tu,{className:"size-4"}),"Sign out"]})]})]})})})}function TD({...e}){var w,k,b;const{workspace:t,projectKey:r}=zt(),{data:n}=wo(),{toggle:s}=Up(),{user:i}=Te(),o=Wl(),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(Lu,{collapsible:"offcanvas",...e,children:[a.jsx(Wu,{children:a.jsx(AD,{})}),a.jsxs(qu,{children:[a.jsx(Hs,{children:a.jsx(Ks,{children:a.jsxs(kr,{children:[a.jsx(Mt,{children:a.jsxs(St,{onClick:s,tooltip:"Search",children:[a.jsx(ki,{}),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(jn,{to:`/${l}/my-tasks`,children:[a.jsx(Iu,{}),a.jsx("span",{children:"My Tasks"})]})})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:c,tooltip:"Projects",children:a.jsxs(jn,{to:`/${l}/projects`,end:!0,children:[a.jsx(Kr,{}),a.jsx("span",{children:"Projects"})]})})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:u,tooltip:"Notifications",children:a.jsxs(jn,{to:`/${l}/notifications`,children:[a.jsx(si,{}),a.jsx("span",{children:"Notifications"})]})})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:p,tooltip:"Reports",children:a.jsxs(jn,{to:`/${l}/reporting`,children:[a.jsx(ws,{}),a.jsx("span",{children:"Reports"})]})})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:f,tooltip:"Settings",children:a.jsxs(jn,{to:`/${l}/settings`,children:[a.jsx(rx,{}),a.jsx("span",{children:"Workspace settings"})]})})})]})})}),n&&n.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(Kv,{}),a.jsxs(Hs,{children:[a.jsx(Yv,{children:"Recent"}),a.jsx(Ks,{children:a.jsx(kr,{children:n.slice(0,5).map(S=>a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:S.identifier===r,tooltip:S.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(jn,{to:`/${l}/projects/${S.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:S.identifier}),a.jsx("span",{className:"truncate",children:S.name})]})})},S.id))})})]})]}),N&&a.jsxs(a.Fragment,{children:[a.jsx(Kv,{}),a.jsxs(Hs,{children:[a.jsx(Yv,{children:"Global"}),a.jsx(Ks,{children:a.jsxs(kr,{children:[a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:x,tooltip:"Global Reports",children:a.jsxs(jn,{to:"/reporting",children:[a.jsx(ws,{}),a.jsx("span",{children:"Global Reports"})]})})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:g,tooltip:"Org Settings",children:a.jsxs(jn,{to:"/org/settings",children:[a.jsx(tx,{}),a.jsx("span",{children:"Org Settings"})]})})})]})})]})]}),a.jsx(Hs,{className:"mt-auto",children:a.jsx(Ks,{children:a.jsx(kr,{children:v&&a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:m,tooltip:"Roles & Permissions",children:a.jsxs(jn,{to:`/${l}/roles`,children:[a.jsx(vh,{}),a.jsx("span",{children:"Custom Roles"})]})})})})})})]}),a.jsx(Uu,{children:a.jsx(DD,{})})]})}function Hu(){const{theme:e,setTheme:t}=cA();return a.jsxs(Zn,{children:[a.jsx(Jn,{asChild:!0,children:a.jsxs(ae,{variant:"ghost",size:"icon-sm",onClick:()=>t(e==="dark"?"light":"dark"),className:"text-muted-foreground hover:text-foreground",children:[a.jsx(M5,{className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),a.jsx(b5,{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(Mn,{children:"Toggle theme"})]})}const ur={byIssue:e=>["time-logs",e],activeTimer:e=>["time-logs",e,"active-timer"],globalActiveTimer:["time-logs","global-active-timer"]};function ID(e){return $e({queryKey:ur.byIssue(e),queryFn:()=>oe.get(`/admin/issues/${e}/time-logs`),enabled:!!e})}function RD(e){return $e({queryKey:ur.activeTimer(e),queryFn:()=>oe.get(`/admin/issues/${e}/time-logs/timer`),select:t=>t.active_timer,enabled:!!e})}function $D(e){const t=Ne();return ye({mutationFn:r=>oe.post(`/admin/issues/${e}/time-logs`,r),onSuccess:()=>{t.invalidateQueries({queryKey:ur.byIssue(e)})}})}function zD(e){const t=Ne();return ye({mutationFn:()=>oe.post(`/admin/issues/${e}/time-logs/timer`,{action:"start"}),onSuccess:r=>{t.invalidateQueries({queryKey:ur.activeTimer(e)}),t.invalidateQueries({queryKey:ur.byIssue(e)}),t.invalidateQueries({queryKey:ur.globalActiveTimer}),r.stopped_timer&&r.stopped_timer.issue_id!==e&&(t.invalidateQueries({queryKey:ur.byIssue(r.stopped_timer.issue_id)}),t.invalidateQueries({queryKey:ur.activeTimer(r.stopped_timer.issue_id)}))}})}function LD(e){const t=Ne();return ye({mutationFn:()=>oe.post(`/admin/issues/${e}/time-logs/timer`,{action:"stop"}),onSuccess:()=>{t.invalidateQueries({queryKey:ur.activeTimer(e)}),t.invalidateQueries({queryKey:ur.byIssue(e)}),t.invalidateQueries({queryKey:ur.globalActiveTimer})}})}function FD(e){const t=Ne();return ye({mutationFn:r=>oe.delete(`/admin/issues/${e}/time-logs/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:ur.byIssue(e)})}})}function BD(e){const t=Ne();return ye({mutationFn:({logId:r,data:n})=>oe.put(`/admin/issues/${e}/time-logs/${r}`,n),onSuccess:()=>{t.invalidateQueries({queryKey:ur.byIssue(e)})}})}function WD(){return $e({queryKey:ur.globalActiveTimer,queryFn:()=>oe.get("/admin/time-logs/active-timer"),select:e=>e.active_timer})}function UD(){const e=Ne();return ye({mutationFn:()=>oe.post("/admin/time-logs/active-timer"),onSuccess:t=>{e.invalidateQueries({queryKey:ur.globalActiveTimer}),t.time_log&&(e.invalidateQueries({queryKey:ur.byIssue(t.time_log.issue_id)}),e.invalidateQueries({queryKey:ur.activeTimer(t.time_log.issue_id)}))}})}function Nd(e){const t=Math.floor(e/60),r=e%60;return t===0?`${r}m`:r===0?`${t}h`:`${t}h ${r}m`}function kd(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 qD({startedAt:e}){const[t,r]=h.useState(()=>kd(e));return h.useEffect(()=>{const n=setInterval(()=>r(kd(e)),1e3);return()=>clearInterval(n)},[e]),a.jsx("span",{className:"font-mono tabular-nums text-xs font-semibold",children:t})}function HD(){const{data:e}=WD(),t=UD(),{workspace:r}=Te(),n=(r==null?void 0:r.slug)??"";if(!e||!e.started_at)return null;const s=e.issue_identifier??"Issue",i=e.project_identifier?`/${n}/projects/${e.project_identifier}/issues/${e.issue_id}`:`/${n}/projects`,o=()=>{t.mutate(void 0,{onSuccess:l=>{var d;const c=((d=l.time_log)==null?void 0:d.duration_minutes)??0;U.success(`Timer stopped — ${Nd(c)} logged`)},onError:()=>U.error("Failed to stop timer")})};return a.jsxs("div",{className:"flex items-center gap-1.5 rounded-full border border-emerald-200 dark:border-emerald-800 bg-emerald-50 dark:bg-emerald-950/40 px-2.5 py-1 text-emerald-700 dark:text-emerald-400",children:[a.jsx(L1,{className:"h-3 w-3 shrink-0"}),a.jsx(Mr,{to:i,className:"text-xs font-medium hover:underline truncate max-w-[100px]",title:e.issue_title??s,children:s}),a.jsx(qD,{startedAt:e.started_at}),a.jsx(ae,{variant:"ghost",size:"icon",className:"h-5 w-5 rounded-full text-emerald-700 dark:text-emerald-400 hover:bg-emerald-200 dark:hover:bg-emerald-900 hover:text-emerald-900 dark:hover:text-emerald-200",onClick:o,disabled:t.isPending,children:a.jsx($1,{className:"h-2.5 w-2.5 fill-current"})})]})}const Jl={all:["notifications"],list:()=>[...Jl.all,"list"]};function KD(){return $e({queryKey:Jl.list(),queryFn:()=>oe.get("/admin/notifications"),select:e=>e.notifications})}function G1(){return $e({queryKey:[...Jl.list(),"unread"],queryFn:()=>oe.get("/admin/notifications?unread=true"),select:e=>e.count})}function YD(){const e=Ne();return ye({mutationFn:t=>oe.post(`/admin/notifications/${t}/read`),onSuccess:()=>{e.invalidateQueries({queryKey:Jl.all})}})}function GD(){const e=Ne();return ye({mutationFn:()=>oe.post("/admin/notifications/read-all"),onSuccess:()=>{e.invalidateQueries({queryKey:Jl.all})}})}function VD(){const e=Wl(),{projectKey:t}=zt(),{data:r}=wo(),n=r==null?void 0:r.find(i=>i.identifier===t),s=e.pathname;return s.includes("/board")?{icon:Kr,label:n?`${n.name} / Board`:"Board"}:s.includes("/issues")?{icon:ea,label:n?`${n.name} / Issues`:"Issues"}:s.includes("/sprints")?{icon:ca,label:n?`${n.name} / Sprints`:"Sprints"}:s.includes("/timeline")?{icon:ii,label:n?`${n.name} / Timeline`:"Timeline"}:s.includes("/access")?{icon:Ea,label:n?`${n.name} / Access`:"Access"}:s.includes("/reports")?{icon:ws,label:n?`${n.name} / Reports`:"Reports"}:s.includes("/activity")?{icon:Du,label:n?`${n.name} / Activity`:"Activity"}:s.endsWith("/projects")?{icon:wd,label:"Projects"}:s.includes("/notifications")?{icon:si,label:"Notifications"}:s.includes("/settings")?{icon:rx,label:"Settings"}:{icon:wd,label:"Meridian"}}function XD(){const{data:e=0}=G1(),{icon:t,label:r}=VD(),{workspace:n}=Te(),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(Fu,{className:"-ml-1"}),a.jsx(bo,{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-2",children:[a.jsx(HD,{}),a.jsx("span",{className:"hidden md:flex",children:a.jsx(Hu,{})}),a.jsx(ae,{variant:"ghost",size:"icon",asChild:!0,className:"relative size-8 text-muted-foreground hover:text-foreground",children:a.jsxs(Mr,{to:`/${s}/notifications`,children:[a.jsx(si,{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 QD(){const e=Wl(),{workspace:t}=zt(),r=t??"",{data:n=0}=G1(),{toggle:s}=Up(),i=[{key:"projects",label:"Projects",icon:D1,to:`/${r}/projects`,match:/\/projects($|\/)/},{key:"notifications",label:"Notifications",icon:si,to:`/${r}/notifications`,match:/\/notifications/,badge:n>0?n>9?"9+":String(n):null},{key:"my-tasks",label:"My Tasks",icon:Iu,to:`/${r}/my-tasks`,match:/\/my-tasks/},{key:"profile",label:"Profile",icon:Ql,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(Mr,{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(ki,{className:"h-5 w-5",strokeWidth:1.5}),a.jsx("span",{children:"Search"})]})]})})}function ZD(){const{user:e,token:t,login:r}=Te();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 JD(){return ZD(),a.jsxs(zu,{children:[a.jsx(TD,{variant:"inset"}),a.jsxs(Bu,{className:"flex flex-col min-w-0",children:[a.jsx(XD,{}),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(Ul,{})})]}),a.jsx(QD,{})]})}const ec={project:e=>["projects",e,"access"]};function da(e){return $e({queryKey:ec.project(e),queryFn:()=>oe.get(`/admin/projects/${e}/access`),enabled:!!e})}function V1(e){const t=Ne();return ye({mutationFn:({userIds:r,role:n})=>oe.post(`/admin/projects/${e}/members/batch`,{user_ids:r,role:n}),onSuccess:()=>{t.invalidateQueries({queryKey:ec.project(e)})}})}function X1(e){const t=Ne();return ye({mutationFn:r=>oe.delete(`/admin/projects/${e}/members/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:ec.project(e)})}})}function Q1(e){const t=Ne();return ye({mutationFn:r=>oe.post(`/admin/projects/${e}/teams/batch`,{team_ids:r}),onSuccess:()=>{t.invalidateQueries({queryKey:ec.project(e)})}})}function Z1(e){const t=Ne();return ye({mutationFn:r=>oe.delete(`/admin/projects/${e}/teams/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:ec.project(e)})}})}const Ha=Kl,eT=Hl,J1=h.forwardRef(({className:e,...t},r)=>a.jsx(yi,{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}));J1.displayName=yi.displayName;const ua=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(eT,{children:[a.jsx(J1,{}),a.jsxs(bi,{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(Pu,{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(Je,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ua.displayName=bi.displayName;const Ka=({className:e,...t})=>a.jsx("div",{className:z("flex flex-col space-y-1.5",e),...t});Ka.displayName="DialogHeader";const ox=({className:e,...t})=>a.jsx("div",{className:z("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});ox.displayName="DialogFooter";const Ya=h.forwardRef(({className:e,...t},r)=>a.jsx(ho,{ref:r,className:z("text-base font-semibold leading-none tracking-tight",e),...t}));Ya.displayName=ho.displayName;const jo=h.forwardRef(({className:e,...t},r)=>a.jsx(po,{ref:r,className:z("text-sm text-muted-foreground",e),...t}));jo.displayName=po.displayName;function tT({open:e,onClose:t,project:r}){const[n,s]=h.useState(null),i=SD(r.id),o=CD(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),U.success("Public link enabled")},onError:()=>U.error("Failed to enable public link")})},u=()=>{o.mutate(void 0,{onSuccess:()=>{s(null),U.success("Public link revoked")},onError:()=>U.error("Failed to revoke link")})},f=()=>{c&&navigator.clipboard.writeText(c).then(()=>{U.success("Link copied to clipboard")})},m=!!c;return a.jsx(Ha,{open:e,onOpenChange:p=>!p&&t(),children:a.jsxs(ua,{className:"sm:max-w-md overflow-hidden",children:[a.jsxs(Ka,{children:[a.jsxs(Ya,{className:"flex items-center gap-2",children:[a.jsx(oi,{className:"h-4 w-4"}),"Share project"]}),a.jsx(jo,{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(gh,{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(ae,{variant:"outline",size:"sm",className:"flex-1",onClick:f,children:[a.jsx(Vp,{className:"h-3.5 w-3.5 mr-1.5"}),"Copy link"]}),a.jsxs(ae,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:u,disabled:o.isPending,children:[a.jsx(Or,{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(Ea,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"This project is private"})]}),a.jsxs(ae,{className:"w-full",onClick:d,disabled:i.isPending,children:[a.jsx(gh,{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 eN(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 Gv=["board","issues","sprints","timeline","access","reports","activity"];function rT(){const{projectKey:e,workspace:t}=zt(),{data:r,error:n}=qa(e??""),{user:s}=Te(),{data:i}=da((r==null?void 0:r.id)??""),[o,l]=h.useState(!1),c=pt(),d=Wl(),[u]=ql(),f=eN(),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 Hp&&(n.status===403||n.status===404)&&c(`/${t}/projects`,{replace:!0})},[n,t,c]),h.useEffect(()=>{const k=u.get("tab");if(!k||!Gv.includes(k))return;Gv.every(S=>!d.pathname.endsWith(`/${S}`))&&c(`/${t}/projects/${e}/${k}`,{replace:!0})},[]);const v=`/${t}/projects/${e}`,y=[{to:`${v}/board`,label:"Board",icon:wd,end:!0,desktopOnly:!0},{to:`${v}/issues`,label:"Issues",icon:ea,end:!1},{to:`${v}/sprints`,label:"Sprints",icon:ca,end:!0},{to:`${v}/timeline`,label:"Timeline",icon:ii,end:!0,desktopOnly:!0},{to:`${v}/access`,label:"Access",icon:Ea,end:!0},{to:`${v}/reports`,label:"Reports",icon:ws,end:!0},{to:`${v}/activity`,label:"Activity",icon:Du,end:!0}],j=y,N=y.filter(k=>!k.desktopOnly),w=d.pathname.endsWith("/board")||d.pathname.endsWith("/timeline");return f&&w?a.jsx(Qn,{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:S,end:C})=>a.jsxs(jn,{to:k,end:C,className:({isActive:_})=>`flex items-center gap-1.5 px-3 py-2 text-sm border-b-2 transition-colors ${_?"border-foreground text-foreground font-medium":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[a.jsx(S,{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(ae,{variant:"ghost",size:"sm",onClick:()=>l(!0),className:"h-7 px-2 text-xs text-muted-foreground",children:[a.jsx(C5,{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:S,end:C})=>a.jsxs(jn,{to:k,end:C,className:({isActive:_})=>`flex items-center gap-1.5 px-3 py-2 text-sm border-b-2 whitespace-nowrap transition-colors shrink-0 ${_?"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(S,{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(Ul,{})}),r&&a.jsx(tT,{open:o,onClose:()=>l(!1),project:r})]})}function nT(){var s,i;const{user:e,logout:t}=Te(),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(kr,{children:a.jsx(Mt,{children:a.jsxs(Yr,{children:[a.jsx(Gr,{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(go,{className:"ml-auto size-4 shrink-0"})]})}),a.jsxs(Er,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[a.jsx(En,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:t,children:[a.jsx(Tu,{className:"size-4"}),"Sign out"]})]})]})})})}function aT(){const{workspace:e}=Te(),t=pt(),r=(e==null?void 0:e.slug)??"";return a.jsxs(Lu,{collapsible:"offcanvas",variant:"inset",children:[a.jsx(Wu,{children:a.jsx(kr,{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(ws,{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(qu,{children:a.jsx(Hs,{children:a.jsx(Ks,{children:a.jsx(kr,{children:a.jsx(Mt,{children:a.jsxs(St,{onClick:()=>t(r?`/${r}/projects`:"/"),tooltip:"Back to workspace",children:[a.jsx(Vl,{}),a.jsx("span",{children:"Back to workspace"})]})})})})})}),a.jsx(Uu,{children:a.jsx(nT,{})})]})}function sT(){return a.jsxs(zu,{children:[a.jsx(aT,{}),a.jsxs(Bu,{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(Fu,{className:"-ml-1"}),a.jsx(bo,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(ws,{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(Hu,{})})]})}),a.jsx("div",{className:"flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden",children:a.jsx(Ul,{})})]})]})}function iT(){var s,i;const{user:e,logout:t}=Te(),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(kr,{children:a.jsx(Mt,{children:a.jsxs(Yr,{children:[a.jsx(Gr,{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(go,{className:"ml-auto size-4 shrink-0"})]})}),a.jsxs(Er,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[a.jsx(En,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:t,children:[a.jsx(Tu,{className:"size-4"}),"Sign out"]})]})]})})})}function oT(){const{workspace:e}=Te(),t=pt(),r=(e==null?void 0:e.slug)??"";return a.jsxs(Lu,{collapsible:"offcanvas",variant:"inset",children:[a.jsx(Wu,{children:a.jsx(kr,{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(tx,{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(qu,{children:a.jsx(Hs,{children:a.jsx(Ks,{children:a.jsx(kr,{children:a.jsx(Mt,{children:a.jsxs(St,{onClick:()=>t(r?`/${r}/projects`:"/"),tooltip:"Back to workspace",children:[a.jsx(Vl,{}),a.jsx("span",{children:"Back to workspace"})]})})})})})}),a.jsx(Uu,{children:a.jsx(iT,{})})]})}function lT(){return a.jsxs(zu,{children:[a.jsx(oT,{}),a.jsxs(Bu,{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(Fu,{className:"-ml-1"}),a.jsx(bo,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(tx,{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(Hu,{})})]})}),a.jsx("div",{className:"flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden",children:a.jsx(Ul,{})})]})]})}function cT(){var s,i;const{user:e,logout:t}=Te(),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(kr,{children:a.jsx(Mt,{children:a.jsxs(Yr,{children:[a.jsx(Gr,{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(jl,{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(go,{className:"ml-auto size-4 shrink-0"})]})}),a.jsxs(Er,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[a.jsx(En,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:t,children:[a.jsx(Tu,{className:"size-4"}),"Sign out"]})]})]})})})}function dT(){const{workspace:e}=Te(),t=pt(),r=(e==null?void 0:e.slug)??"";return a.jsxs(Lu,{collapsible:"offcanvas",variant:"inset",children:[a.jsx(Wu,{children:a.jsx(kr,{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(Ql,{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(qu,{children:a.jsx(Hs,{children:a.jsx(Ks,{children:a.jsx(kr,{children:a.jsx(Mt,{children:a.jsxs(St,{onClick:()=>t(r?`/${r}/projects`:"/"),tooltip:"Back to workspace",children:[a.jsx(Vl,{}),a.jsx("span",{children:"Back to workspace"})]})})})})})}),a.jsx(Uu,{children:a.jsx(cT,{})})]})}function uT(){return a.jsxs(zu,{children:[a.jsx(dT,{}),a.jsxs(Bu,{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(Fu,{className:"-ml-1"}),a.jsx(bo,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(Ql,{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(Hu,{})})]})}),a.jsx("div",{className:"flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden",children:a.jsx(Ul,{})})]})]})}var Vv=1,fT=.9,mT=.8,hT=.17,hm=.1,pm=.999,pT=.9999,xT=.99,gT=/[\\\/_+.#"@\[\(\{&]/,vT=/[\\\/_+.#"@\[\(\{&]/g,yT=/[\s-]/,tN=/[\s-]/g;function yh(e,t,r,n,s,i,o){if(i===t.length)return s===e.length?Vv:xT;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=yh(e,t,r,n,d+1,i+1,o),f>u&&(d===s?f*=Vv:gT.test(e.charAt(d-1))?(f*=mT,p=e.slice(s,d-1).match(vT),p&&s>0&&(f*=Math.pow(pm,p.length))):yT.test(e.charAt(d-1))?(f*=fT,x=e.slice(s,d-1).match(tN),x&&s>0&&(f*=Math.pow(pm,x.length))):(f*=hT,s>0&&(f*=Math.pow(pm,d-s))),e.charAt(d)!==t.charAt(i)&&(f*=pT)),(f<hm&&r.charAt(d-1)===n.charAt(i+1)||n.charAt(i+1)===n.charAt(i)&&r.charAt(d-1)!==n.charAt(i))&&(m=yh(e,t,r,n,d+1,i+2,o),m*hm>f&&(f=m*hm)),f>u&&(u=f),d=r.indexOf(c,d+1);return o[l]=u,u}function Xv(e){return e.toLowerCase().replace(tN," ")}function bT(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,yh(e,t,Xv(e),Xv(t),0,0,{})}var Ho='[cmdk-group=""]',xm='[cmdk-group-items=""]',wT='[cmdk-group-heading=""]',lx='[cmdk-item=""]',Qv=`${lx}:not([aria-disabled="true"])`,bh="cmdk-item-select",Us="data-value",jT=(e,t,r)=>bT(e,t,r),rN=h.createContext(void 0),tc=()=>h.useContext(rN),nN=h.createContext(void 0),cx=()=>h.useContext(nN),aN=h.createContext(void 0),sN=h.forwardRef((e,t)=>{let r=Fi(()=>{var L,K;return{search:"",value:(K=(L=e.value)!=null?L:e.defaultValue)!=null?K:"",filtered:{count:0,items:new Map,groups:new Set}}}),n=Fi(()=>new Set),s=Fi(()=>new Map),i=Fi(()=>new Map),o=Fi(()=>new Set),l=iN(e),{label:c,children:d,value:u,onValueChange:f,filter:m,shouldFilter:p,loop:x,disablePointerSelection:g=!1,vimBindings:v=!0,...y}=e,j=qi(),N=qi(),w=qi(),k=h.useRef(null),b=DT();ci(()=>{if(u!==void 0){let L=u.trim();r.current.value=L,S.emit()}},[u]),ci(()=>{b(6,T)},[]);let S=h.useMemo(()=>({subscribe:L=>(o.current.add(L),()=>o.current.delete(L)),snapshot:()=>r.current,setState:(L,K,R)=>{var Y,P,I;if(!Object.is(r.current[L],K)){if(r.current[L]=K,L==="search")A(),M(),b(1,D);else if(L==="value"&&(R||b(5,T),((Y=l.current)==null?void 0:Y.value)!==void 0)){let te=K??"";(I=(P=l.current).onValueChange)==null||I.call(P,te);return}S.emit()}},emit:()=>{o.current.forEach(L=>L())}}),[]),C=h.useMemo(()=>({value:(L,K,R)=>{var Y;K!==((Y=i.current.get(L))==null?void 0:Y.value)&&(i.current.set(L,{value:K,keywords:R}),r.current.filtered.items.set(L,_(K,R)),b(2,()=>{M(),S.emit()}))},item:(L,K)=>(n.current.add(L),K&&(s.current.has(K)?s.current.get(K).add(L):s.current.set(K,new Set([L]))),b(3,()=>{A(),M(),r.current.value||D(),S.emit()}),()=>{i.current.delete(L),n.current.delete(L),r.current.filtered.items.delete(L);let R=$();b(4,()=>{A(),(R==null?void 0:R.getAttribute("id"))===L&&D(),S.emit()})}),group:L=>(s.current.has(L)||s.current.set(L,new Set),()=>{i.current.delete(L),s.current.delete(L)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:j,inputId:w,labelId:N,listInnerRef:k}),[]);function _(L,K){var R,Y;let P=(Y=(R=l.current)==null?void 0:R.filter)!=null?Y:jT;return L?P(L,r.current.search,K):0}function M(){if(!r.current.search||l.current.shouldFilter===!1)return;let L=r.current.filtered.items,K=[];r.current.filtered.groups.forEach(Y=>{let P=s.current.get(Y),I=0;P.forEach(te=>{let F=L.get(te);I=Math.max(F,I)}),K.push([Y,I])});let R=k.current;Z().sort((Y,P)=>{var I,te;let F=Y.getAttribute("id"),X=P.getAttribute("id");return((I=L.get(X))!=null?I:0)-((te=L.get(F))!=null?te:0)}).forEach(Y=>{let P=Y.closest(xm);P?P.appendChild(Y.parentElement===P?Y:Y.closest(`${xm} > *`)):R.appendChild(Y.parentElement===R?Y:Y.closest(`${xm} > *`))}),K.sort((Y,P)=>P[1]-Y[1]).forEach(Y=>{var P;let I=(P=k.current)==null?void 0:P.querySelector(`${Ho}[${Us}="${encodeURIComponent(Y[0])}"]`);I==null||I.parentElement.appendChild(I)})}function D(){let L=Z().find(R=>R.getAttribute("aria-disabled")!=="true"),K=L==null?void 0:L.getAttribute(Us);S.setState("value",K||void 0)}function A(){var L,K,R,Y;if(!r.current.search||l.current.shouldFilter===!1){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let P=0;for(let I of n.current){let te=(K=(L=i.current.get(I))==null?void 0:L.value)!=null?K:"",F=(Y=(R=i.current.get(I))==null?void 0:R.keywords)!=null?Y:[],X=_(te,F);r.current.filtered.items.set(I,X),X>0&&P++}for(let[I,te]of s.current)for(let F of te)if(r.current.filtered.items.get(F)>0){r.current.filtered.groups.add(I);break}r.current.filtered.count=P}function T(){var L,K,R;let Y=$();Y&&(((L=Y.parentElement)==null?void 0:L.firstChild)===Y&&((R=(K=Y.closest(Ho))==null?void 0:K.querySelector(wT))==null||R.scrollIntoView({block:"nearest"})),Y.scrollIntoView({block:"nearest"}))}function $(){var L;return(L=k.current)==null?void 0:L.querySelector(`${lx}[aria-selected="true"]`)}function Z(){var L;return Array.from(((L=k.current)==null?void 0:L.querySelectorAll(Qv))||[])}function H(L){let K=Z()[L];K&&S.setState("value",K.getAttribute(Us))}function Q(L){var K;let R=$(),Y=Z(),P=Y.findIndex(te=>te===R),I=Y[P+L];(K=l.current)!=null&&K.loop&&(I=P+L<0?Y[Y.length-1]:P+L===Y.length?Y[0]:Y[P+L]),I&&S.setState("value",I.getAttribute(Us))}function ne(L){let K=$(),R=K==null?void 0:K.closest(Ho),Y;for(;R&&!Y;)R=L>0?ET(R,Ho):AT(R,Ho),Y=R==null?void 0:R.querySelector(Qv);Y?S.setState("value",Y.getAttribute(Us)):Q(L)}let J=()=>H(Z().length-1),O=L=>{L.preventDefault(),L.metaKey?J():L.altKey?ne(1):Q(1)},E=L=>{L.preventDefault(),L.metaKey?H(0):L.altKey?ne(-1):Q(-1)};return h.createElement(Ss.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:L=>{var K;if((K=y.onKeyDown)==null||K.call(y,L),!L.defaultPrevented)switch(L.key){case"n":case"j":{v&&L.ctrlKey&&O(L);break}case"ArrowDown":{O(L);break}case"p":case"k":{v&&L.ctrlKey&&E(L);break}case"ArrowUp":{E(L);break}case"Home":{L.preventDefault(),H(0);break}case"End":{L.preventDefault(),J();break}case"Enter":if(!L.nativeEvent.isComposing&&L.keyCode!==229){L.preventDefault();let R=$();if(R){let Y=new Event(bh);R.dispatchEvent(Y)}}}}},h.createElement("label",{"cmdk-label":"",htmlFor:C.inputId,id:C.labelId,style:IT},c),Ku(e,L=>h.createElement(nN.Provider,{value:S},h.createElement(rN.Provider,{value:C},L))))}),NT=h.forwardRef((e,t)=>{var r,n;let s=qi(),i=h.useRef(null),o=h.useContext(aN),l=tc(),c=iN(e),d=(n=(r=c.current)==null?void 0:r.forceMount)!=null?n:o==null?void 0:o.forceMount;ci(()=>{if(!d)return l.item(s,o==null?void 0:o.id)},[d]);let u=oN(s,i,[e.value,e.children,i],e.keywords),f=cx(),m=di(b=>b.value&&b.value===u.current),p=di(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(bh,x),()=>b.removeEventListener(bh,x)},[p,e.onSelect,e.disabled]);function x(){var b,S;g(),(S=(b=c.current).onSelect)==null||S.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(Ss.div,{ref:Nl([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)}),kT=h.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:s,...i}=e,o=qi(),l=h.useRef(null),c=h.useRef(null),d=qi(),u=tc(),f=di(p=>s||u.filter()===!1?!0:p.search?p.filtered.groups.has(o):!0);ci(()=>u.group(o),[]),oN(o,l,[e.value,e.heading,c]);let m=h.useMemo(()=>({id:o,forceMount:s}),[s]);return h.createElement(Ss.div,{ref:Nl([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),Ku(e,p=>h.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},h.createElement(aN.Provider,{value:m},p))))}),ST=h.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,s=h.useRef(null),i=di(o=>!o.search);return!r&&!i?null:h.createElement(Ss.div,{ref:Nl([s,t]),...n,"cmdk-separator":"",role:"separator"})}),CT=h.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,s=e.value!=null,i=cx(),o=di(u=>u.search),l=di(u=>u.value),c=tc(),d=h.useMemo(()=>{var u;let f=(u=c.listInnerRef.current)==null?void 0:u.querySelector(`${lx}[${Us}="${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(Ss.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)}})}),_T=h.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...s}=e,i=h.useRef(null),o=h.useRef(null),l=tc();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(Ss.div,{ref:Nl([i,t]),...s,"cmdk-list":"",role:"listbox","aria-label":n,id:l.listId},Ku(e,c=>h.createElement("div",{ref:Nl([o,l.listInnerRef]),"cmdk-list-sizer":""},c)))}),MT=h.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:s,contentClassName:i,container:o,...l}=e;return h.createElement(Kl,{open:r,onOpenChange:n},h.createElement(Hl,{container:o},h.createElement(yi,{"cmdk-overlay":"",className:s}),h.createElement(bi,{"aria-label":e.label,"cmdk-dialog":"",className:i},h.createElement(sN,{ref:t,...l}))))}),PT=h.forwardRef((e,t)=>di(r=>r.filtered.count===0)?h.createElement(Ss.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),OT=h.forwardRef((e,t)=>{let{progress:r,children:n,label:s="Loading...",...i}=e;return h.createElement(Ss.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Ku(e,o=>h.createElement("div",{"aria-hidden":!0},o)))}),Vr=Object.assign(sN,{List:_T,Item:NT,Input:CT,Group:kT,Separator:ST,Dialog:MT,Empty:PT,Loading:OT});function ET(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function AT(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function iN(e){let t=h.useRef(e);return ci(()=>{t.current=e}),t}var ci=typeof window>"u"?h.useEffect:h.useLayoutEffect;function Fi(e){let t=h.useRef();return t.current===void 0&&(t.current=e()),t}function Nl(e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}function di(e){let t=cx(),r=()=>e(t.snapshot());return EO.useSyncExternalStore(t.subscribe,r,r)}function oN(e,t,r,n=[]){let s=h.useRef(),i=tc();return ci(()=>{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(Us,l),s.current=l}),s}var DT=()=>{let[e,t]=h.useState(),r=Fi(()=>new Map);return ci(()=>{r.current.forEach(n=>n()),r.current=new Map},[e]),(n,s)=>{r.current.set(n,s),t({})}};function TT(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Ku({asChild:e,children:t},r){return e&&h.isValidElement(t)?h.cloneElement(TT(t),{ref:t.ref},r(t.props.children)):r(t)}var IT={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Zs=h.forwardRef(({className:e,...t},r)=>a.jsx(Vr,{ref:r,className:z("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));Zs.displayName=Vr.displayName;const RT=({children:e,open:t,onOpenChange:r})=>a.jsx(Ha,{open:t,onOpenChange:r,children:a.jsx(ua,{className:"overflow-hidden p-0 shadow-lg max-w-[560px]",children:a.jsx(Zs,{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})})}),Yu=h.forwardRef(({className:e,...t},r)=>a.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[a.jsx(ki,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),a.jsx(Vr.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})]}));Yu.displayName=Vr.Input.displayName;const Js=h.forwardRef(({className:e,...t},r)=>a.jsx(Vr.List,{ref:r,className:z("max-h-[320px] overflow-y-auto overflow-x-hidden",e),...t}));Js.displayName=Vr.List.displayName;const Gu=h.forwardRef((e,t)=>a.jsx(Vr.Empty,{ref:t,className:"py-6 text-center text-sm text-muted-foreground",...e}));Gu.displayName=Vr.Empty.displayName;const us=h.forwardRef(({className:e,...t},r)=>a.jsx(Vr.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}));us.displayName=Vr.Group.displayName;const lN=h.forwardRef(({className:e,...t},r)=>a.jsx(Vr.Separator,{ref:r,className:z("-mx-1 h-px bg-border",e),...t}));lN.displayName=Vr.Separator.displayName;const fn=h.forwardRef(({className:e,...t},r)=>a.jsx(Vr.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}));fn.displayName=Vr.Item.displayName;function $T(){const{open:e,setOpen:t}=Up(),r=pt(),{data:n}=wo(),{workspace:s}=Te(),i=(s==null?void 0:s.slug)??"",o=l=>{t(!1),l()};return a.jsxs(RT,{open:e,onOpenChange:t,children:[a.jsx(Yu,{placeholder:"Search or jump to..."}),a.jsxs(Js,{children:[a.jsx(Gu,{children:"No results found."}),a.jsxs(us,{heading:"Navigation",children:[a.jsxs(fn,{onSelect:()=>o(()=>r(`/${i}/projects`)),children:[a.jsx(wd,{className:"text-muted-foreground"}),a.jsx("span",{children:"Projects"})]}),a.jsxs(fn,{onSelect:()=>o(()=>r(`/${i}/notifications`)),children:[a.jsx(si,{className:"text-muted-foreground"}),a.jsx("span",{children:"Notifications"})]}),a.jsxs(fn,{onSelect:()=>o(()=>r(`/${i}/settings`)),children:[a.jsx(rx,{className:"text-muted-foreground"}),a.jsx("span",{children:"Settings"})]})]}),n&&n.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(lN,{}),a.jsxs(us,{heading:"Projects",children:[n.map(l=>a.jsxs(fn,{value:`${l.name} board`,onSelect:()=>o(()=>r(`/${i}/projects/${l.identifier}/board`)),children:[a.jsx(Kr,{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(fn,{value:`${l.name} issues`,onSelect:()=>o(()=>r(`/${i}/projects/${l.identifier}/issues`)),children:[a.jsx(ea,{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 _r({zone:e,props:t}){const r=ZA(e);return r.length?a.jsx(a.Fragment,{children:r.map((n,s)=>a.jsx(n,{...t},n.displayName??n.name??s))}):null}function dx({flow:e,inviteToken:t,label:r,disabled:n}){const s=()=>{const i=`${Xi}/auth/google?flow=${e}${t?`&invite_token=${encodeURIComponent(t)}`:""}`;window.location.href=i};return a.jsxs(ae,{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 rc(){var e;return((e=window.__MERIDIAN_CONFIG__)==null?void 0:e.appName)??"Meridian"}function zT(){var e;return(e=window.__MERIDIAN_CONFIG__)==null?void 0:e.logoUrl}function nc({className:e}){const t=zT();return t?a.jsx("img",{src:t,alt:rc(),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 LT(){const[e,t]=h.useState(""),[r,n]=h.useState(""),[s,i]=h.useState(!1),o=pt(),l=eD(),{data:c}=$u(),d=u=>{u.preventDefault(),l.mutate({email:e,password:r},{onSuccess:()=>o("/"),onError:f=>U.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(_r,{zone:"login.before",props:{}}),a.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[a.jsx(nc,{}),a.jsxs("div",{className:"text-center",children:[a.jsxs("h1",{className:"text-lg font-semibold text-foreground",children:["Welcome to ",rc()]}),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(Me,{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(Me,{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(Xl,{className:"h-4 w-4"}):a.jsx(Ni,{className:"h-4 w-4"})})]}),a.jsx("div",{className:"flex justify-end",children:a.jsx(Mr,{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(ae,{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(dx,{flow:"login"})]}),a.jsxs("p",{className:"text-sm text-center text-muted-foreground mt-6",children:["Don't have an account?"," ",a.jsx(Mr,{to:"/register",className:"text-indigo hover:opacity-80 transition-opacity",children:"Create one"})]}),a.jsx(_r,{zone:"login.after",props:{}})]})})}function FT(){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=tD(),{data:m}=$u(),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=>U.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(nc,{}),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 ${rc()}`})]})]}),a.jsxs("form",{onSubmit:x,className:"space-y-2",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx(Me,{placeholder:"First name",value:e,onChange:g=>t(g.target.value),required:!0,className:"bg-white dark:bg-card h-10"}),a.jsx(Me,{placeholder:"Last name",value:r,onChange:g=>n(g.target.value),required:!0,className:"bg-white dark:bg-card h-10"})]}),a.jsx(Me,{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(Me,{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(Xl,{className:"h-4 w-4"}):a.jsx(Ni,{className:"h-4 w-4"})})]}),a.jsx("div",{className:"pt-1",children:a.jsx(ae,{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(dx,{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(Mr,{to:"/login",className:"text-indigo hover:opacity-80 transition-opacity",children:"Sign in"})]})]})})}function BT(){const[e,t]=h.useState(""),[r,n]=h.useState(!1),s=pt(),{setWorkspace:i}=Te(),o=L5(),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=>U.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(nc,{}),a.jsxs("div",{className:"text-center",children:[a.jsxs("h1",{className:"text-lg font-semibold text-foreground",children:["Create your ",rc()," 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(Me,{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(Ea,{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(ae,{type:"submit",className:"w-full h-10 font-medium",disabled:!e.trim()||o.isPending,children:o.isPending?"Creating workspace...":"Create workspace"})]})]})})}function WT(){const{logout:e}=Te();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(nc,{}),a.jsxs("div",{className:"text-center",children:[a.jsxs("h1",{className:"text-lg font-semibold text-foreground",children:["Waiting for ",rc()," 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(ae,{variant:"outline",className:"w-full",onClick:e,children:"Sign out"})]})})}function UT(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 cN=B.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}),ac=()=>{const e=B.useContext(cN);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};UT(`[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 qT(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function HT(){return ux(/^Mac/)}function KT(){return ux(/^iPhone/)}function Zv(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function YT(){return ux(/^iPad/)||HT()&&navigator.maxTouchPoints>1}function dN(){return KT()||YT()}function ux(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const GT=24,VT=typeof window<"u"?h.useLayoutEffect:h.useEffect;function Jv(...e){return(...t)=>{for(let r of e)typeof r=="function"&&r(...t)}}const gm=typeof document<"u"&&window.visualViewport;function ey(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function uN(e){for(ey(e)&&(e=e.parentElement);e&&!ey(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const XT=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let Ic=0,vm;function QT(e={}){let{isDisabled:t}=e;VT(()=>{if(!t)return Ic++,Ic===1&&dN()&&(vm=ZT()),()=>{Ic--,Ic===0&&(vm==null||vm())}},[t])}function ZT(){let e,t=0,r=f=>{e=uN(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;wh(m)&&m!==document.activeElement&&(f.preventDefault(),m.style.transform="translateY(-2000px)",m.focus(),requestAnimationFrame(()=>{m.style.transform=""}))},i=f=>{let m=f.target;wh(m)&&(m.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{m.style.transform="",gm&&(gm.height<window.innerHeight?requestAnimationFrame(()=>{ty(m)}):gm.addEventListener("resize",()=>ty(m),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},l=window.pageXOffset,c=window.pageYOffset,d=Jv(JT(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let u=Jv(Ko(document,"touchstart",r,{passive:!1,capture:!0}),Ko(document,"touchmove",n,{passive:!1,capture:!0}),Ko(document,"touchend",s,{passive:!1,capture:!0}),Ko(document,"focus",i,!0),Ko(window,"scroll",o));return()=>{d(),u(),window.scrollTo(l,c)}}function JT(e,t,r){let n=e.style[t];return e.style[t]=r,()=>{e.style[t]=n}}function Ko(e,t,r,n){return e.addEventListener(t,r,n),()=>{e.removeEventListener(t,r,n)}}function ty(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let r=uN(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+GT;i>o&&(r.scrollTop+=s-n)}e=r.parentElement}}function wh(e){return e instanceof HTMLInputElement&&!XT.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function e3(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function t3(...e){return t=>e.forEach(r=>e3(r,t))}function fN(...e){return h.useCallback(t3(...e),e)}const mN=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&&mN.set(e,n)}function r3(e,t){if(!e||!(e instanceof HTMLElement))return;let r=mN.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 Rc(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 n3(e){return 8*(Math.log(e+1)-2)}function ym(e,t){if(!e)return()=>{};const r=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=r}}function a3(...e){return(...t)=>{for(const r of e)typeof r=="function"&&r(...t)}}const wt={DURATION:.5,EASE:[.32,.72,0,1]},hN=.4,s3=.25,i3=100,pN=8,As=16,jh=26,bm="vaul-dragging";function xN(e){const t=B.useRef(e);return B.useEffect(()=>{t.current=e}),B.useMemo(()=>(...r)=>t.current==null?void 0:t.current.call(t,...r),[])}function o3({defaultProp:e,onChange:t}){const r=B.useState(e),[n]=r,s=B.useRef(n),i=xN(t);return B.useEffect(()=>{s.current!==n&&(i(n),s.current=n)},[n,s,i]),r}function gN({prop:e,defaultProp:t,onChange:r=()=>{}}){const[n,s]=o3({defaultProp:t,onChange:r}),i=e!==void 0,o=i?e:n,l=xN(r),c=B.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 l3({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:r,drawerRef:n,overlayRef:s,fadeFromIndex:i,onSnapPointChange:o,direction:l="bottom",container:c,snapToSequentialPoint:d}){const[u,f]=gN({prop:e,defaultProp:r==null?void 0:r[0],onChange:t}),[m,p]=B.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);B.useEffect(()=>{function S(){p({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]);const x=B.useMemo(()=>u===(r==null?void 0:r[r.length-1])||null,[r,u]),g=B.useMemo(()=>{var S;return(S=r==null?void 0:r.findIndex(C=>C===u))!=null?S:null},[r,u]),v=r&&r.length>0&&(i||i===0)&&!Number.isNaN(i)&&r[i]===u||!r,y=B.useMemo(()=>{const S=c?{width:c.getBoundingClientRect().width,height:c.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var C;return(C=r==null?void 0:r.map(_=>{const M=typeof _=="string";let D=0;if(M&&(D=parseInt(_,10)),Dt(l)){const T=M?D:m?_*S.height:0;return m?l==="bottom"?S.height-T:-S.height+T:T}const A=M?D:m?_*S.width:0;return m?l==="right"?S.width-A:-S.width+A:A}))!=null?C:[]},[r,m,c]),j=B.useMemo(()=>g!==null?y==null?void 0:y[g]:null,[y,g]),N=B.useCallback(S=>{var C;const _=(C=y==null?void 0:y.findIndex(M=>M===S))!=null?C:null;o(_),Ft(n.current,{transition:`transform ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,transform:Dt(l)?`translate3d(0, ${S}px, 0)`:`translate3d(${S}px, 0, 0)`}),y&&_!==y.length-1&&i!==void 0&&_!==i&&_<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(_,0)])},[n.current,r,y,i,s,f]);B.useEffect(()=>{if(u||e){var S;const C=(S=r==null?void 0:r.findIndex(_=>_===e||_===u))!=null?S:-1;y&&C!==-1&&typeof y[C]=="number"&&N(y[C])}},[u,e,r,y,N]);function w({draggedDistance:S,closeDrawer:C,velocity:_,dismissible:M}){if(i===void 0)return;const D=l==="bottom"||l==="right"?(j??0)-S:(j??0)+S,A=g===i-1,T=g===0,$=S>0;if(A&&Ft(s.current,{transition:`opacity ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`}),!d&&_>2&&!$){M?C():N(y[0]);return}if(!d&&_>2&&$&&y&&r){N(y[r.length-1]);return}const Z=y==null?void 0:y.reduce((Q,ne)=>typeof Q!="number"||typeof ne!="number"?Q:Math.abs(ne-D)<Math.abs(Q-D)?ne:Q),H=Dt(l)?window.innerHeight:window.innerWidth;if(_>hN&&Math.abs(S)<H*.4){const Q=$?1:-1;if(Q>0&&x&&r){N(y[r.length-1]);return}if(T&&Q<0&&M&&C(),g===null)return;N(y[g+Q]);return}N(Z)}function k({draggedDistance:S}){if(j===null)return;const C=l==="bottom"||l==="right"?j-S:j+S;(l==="bottom"||l==="right")&&C<y[y.length-1]||(l==="top"||l==="left")&&C>y[y.length-1]||Ft(n.current,{transform:Dt(l)?`translate3d(0, ${C}px, 0)`:`translate3d(${C}px, 0, 0)`})}function b(S,C){if(!r||typeof g!="number"||!y||i===void 0)return null;const _=g===i-1;if(g>=i&&C)return 0;if(_&&!C)return 1;if(!v&&!_)return null;const D=_?g+1:g-1,A=_?y[D]-y[D-1]:y[D+1]-y[D],T=S/Math.abs(A);return _?1-T:T}return{isLastSnapPoint:x,activeSnapPoint:u,shouldFade:v,getPercentageDragged:b,setActiveSnapPoint:f,activeSnapPointIndex:g,onRelease:w,onDrag:k,snapPointsOffset:y}}const c3=()=>()=>{};function d3(){const{direction:e,isOpen:t,shouldScaleBackground:r,setBackgroundColorOnScale:n,noBodyStyles:s}=ac(),i=B.useRef(null),o=h.useMemo(()=>document.body.style.backgroundColor,[]);function l(){return(window.innerWidth-jh)/window.innerWidth}B.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;a3(n&&!s?ym(document.body,{background:"black"}):c3,ym(c,{transformOrigin:Dt(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${wt.DURATION}s`,transitionTimingFunction:`cubic-bezier(${wt.EASE.join(",")})`}));const d=ym(c,{borderRadius:`${pN}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 Yo=null;function u3({isOpen:e,modal:t,nested:r,hasBeenOpened:n,preventScrollRestoration:s,noBodyStyles:i}){const[o,l]=B.useState(()=>typeof window<"u"?window.location.href:""),c=B.useRef(0),d=B.useCallback(()=>{if(Zv()&&Yo===null&&e&&!i){Yo={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=B.useCallback(()=>{if(Zv()&&Yo!==null&&!i){const f=-parseInt(document.body.style.top,10),m=-parseInt(document.body.style.left,10);Object.assign(document.body.style,Yo),window.requestAnimationFrame(()=>{if(s&&o!==window.location.href){l(window.location.href);return}window.scrollTo(m,f)}),Yo=null}},[o]);return B.useEffect(()=>{function f(){c.current=window.scrollY}return f(),window.addEventListener("scroll",f),()=>{window.removeEventListener("scroll",f)}},[]),B.useEffect(()=>{if(t)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||u()}},[t,u]),B.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 f3({open:e,onOpenChange:t,children:r,onDrag:n,onRelease:s,snapPoints:i,shouldScaleBackground:o=!1,setBackgroundColorOnScale:l=!0,closeThreshold:c=s3,scrollLockTimeout:d=i3,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:S=!1,preventScrollRestoration:C=!1,repositionInputs:_=!0,onAnimationEnd:M,container:D,autoFocus:A=!1}){var T,$;const[Z=!1,H]=gN({defaultProp:k,prop:e,onChange:Oe=>{t==null||t(Oe),!Oe&&!j&&Ze(),setTimeout(()=>{M==null||M(Oe)},wt.DURATION*1e3),Oe&&!v&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),Oe||(document.body.style.pointerEvents="auto")}}),[Q,ne]=B.useState(!1),[J,O]=B.useState(!1),[E,L]=B.useState(!1),K=B.useRef(null),R=B.useRef(null),Y=B.useRef(null),P=B.useRef(null),I=B.useRef(null),te=B.useRef(!1),F=B.useRef(null),X=B.useRef(0),W=B.useRef(!1),G=B.useRef(!k),se=B.useRef(0),V=B.useRef(null),ie=B.useRef(((T=V.current)==null?void 0:T.getBoundingClientRect().height)||0),pe=B.useRef((($=V.current)==null?void 0:$.getBoundingClientRect().width)||0),ue=B.useRef(0),ve=B.useCallback(Oe=>{i&&Oe===ze.length-1&&(R.current=new Date)},[]),{activeSnapPoint:ee,activeSnapPointIndex:ge,setActiveSnapPoint:De,onRelease:We,snapPointsOffset:ze,onDrag:Ge,shouldFade:ut,getPercentageDragged:He}=l3({snapPoints:i,activeSnapPointProp:p,setActiveSnapPointProp:x,drawerRef:V,fadeFromIndex:m,overlayRef:K,onSnapPointChange:ve,direction:w,container:D,snapToSequentialPoint:S});QT({isDisabled:!Z||J||!v||E||!Q||!_||!b});const{restorePositionSetting:Ze}=u3({isOpen:Z,modal:v,nested:j??!1,hasBeenOpened:Q,preventScrollRestoration:C,noBodyStyles:N});function rr(){return(window.innerWidth-jh)/window.innerWidth}function $r(Oe){var xe,je;!u&&!i||V.current&&!V.current.contains(Oe.target)||(ie.current=((xe=V.current)==null?void 0:xe.getBoundingClientRect().height)||0,pe.current=((je=V.current)==null?void 0:je.getBoundingClientRect().width)||0,O(!0),Y.current=new Date,dN()&&window.addEventListener("touchend",()=>te.current=!1,{once:!0}),Oe.target.setPointerCapture(Oe.pointerId),X.current=Dt(w)?Oe.pageY:Oe.pageX)}function nr(Oe,xe){var je;let he=Oe;const be=(je=window.getSelection())==null?void 0:je.toString(),Ve=V.current?Rc(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(R.current&&de.getTime()-R.current.getTime()<500)return!1;if(Ve!==null&&(w==="bottom"?Ve>0:Ve<0))return!0;if(be&&be.length>0)return!1;if(I.current&&de.getTime()-I.current.getTime()<d&&Ve===0||xe)return I.current=de,!1;for(;he;){if(he.scrollHeight>he.clientHeight){if(he.scrollTop!==0)return I.current=new Date,!1;if(he.getAttribute("role")==="dialog")return!0}he=he.parentNode}return!0}function br(Oe){if(V.current&&J){const xe=w==="bottom"||w==="right"?1:-1,je=(X.current-(Dt(w)?Oe.pageY:Oe.pageX))*xe,he=je>0,be=i&&!u&&!he;if(be&&ge===0)return;const Ve=Math.abs(je),de=document.querySelector("[data-vaul-drawer-wrapper]"),_e=w==="bottom"||w==="top"?ie.current:pe.current;let Ie=Ve/_e;const bt=He(Ve,he);if(bt!==null&&(Ie=bt),be&&Ie>=1||!te.current&&!nr(Oe.target,he))return;if(V.current.classList.add(bm),te.current=!0,Ft(V.current,{transition:"none"}),Ft(K.current,{transition:"none"}),i&&Ge({draggedDistance:je}),he&&!i){const nt=n3(je),wr=Math.min(nt*-1,0)*xe;Ft(V.current,{transform:Dt(w)?`translate3d(0, ${wr}px, 0)`:`translate3d(${wr}px, 0, 0)`});return}const rt=1-Ie;if((ut||m&&ge===m-1)&&(n==null||n(Oe,Ie),Ft(K.current,{opacity:`${rt}`,transition:"none"},!0)),de&&K.current&&o){const nt=Math.min(rr()+Ie*(1-rr()),1),wr=8-Ie*8,ir=Math.max(0,14-Ie*14);Ft(de,{borderRadius:`${wr}px`,transform:Dt(w)?`scale(${nt}) translate3d(0, ${ir}px, 0)`:`scale(${nt}) translate3d(${ir}px, 0, 0)`,transition:"none"},!0)}if(!i){const nt=Ve*xe;Ft(V.current,{transform:Dt(w)?`translate3d(0, ${nt}px, 0)`:`translate3d(${nt}px, 0, 0)`})}}}B.useEffect(()=>{window.requestAnimationFrame(()=>{G.current=!0})},[]),B.useEffect(()=>{var Oe;function xe(){if(!V.current||!_)return;const je=document.activeElement;if(wh(je)||W.current){var he;const be=((he=window.visualViewport)==null?void 0:he.height)||0,Ve=window.innerHeight;let de=Ve-be;const _e=V.current.getBoundingClientRect().height||0,Ie=_e>Ve*.8;ue.current||(ue.current=_e);const bt=V.current.getBoundingClientRect().top;if(Math.abs(se.current-de)>60&&(W.current=!W.current),i&&i.length>0&&ze&&ge){const rt=ze[ge]||0;de+=rt}if(se.current=de,_e>be||W.current){const rt=V.current.getBoundingClientRect().height;let nt=rt;rt>be&&(nt=be-(Ie?bt:jh)),g?V.current.style.height=`${rt-Math.max(de,0)}px`:V.current.style.height=`${Math.max(nt,be-bt)}px`}else qT()||(V.current.style.height=`${ue.current}px`);i&&i.length>0&&!W.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 je;return(je=window.visualViewport)==null?void 0:je.removeEventListener("resize",xe)}},[ge,i,ze]);function ar(Oe){Lt(),y==null||y(),Oe||H(!1),setTimeout(()=>{i&&De(i[0])},wt.DURATION*1e3)}function yt(){if(!V.current)return;const Oe=document.querySelector("[data-vaul-drawer-wrapper]"),xe=Rc(V.current,w);Ft(V.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`}),Ft(K.current,{transition:`opacity ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,opacity:"1"}),o&&xe&&xe>0&&Z&&Ft(Oe,{borderRadius:`${pN}px`,overflow:"hidden",...Dt(w)?{transform:`scale(${rr()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${rr()}) 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(bm),te.current=!1,O(!1),P.current=new Date)}function Kt(Oe){if(!J||!V.current)return;V.current.classList.remove(bm),te.current=!1,O(!1),P.current=new Date;const xe=Rc(V.current,w);if(!Oe||!nr(Oe.target,!1)||!xe||Number.isNaN(xe)||Y.current===null)return;const je=P.current.getTime()-Y.current.getTime(),he=X.current-(Dt(w)?Oe.pageY:Oe.pageX),be=Math.abs(he)/je;if(be>.05&&(L(!0),setTimeout(()=>{L(!1)},200)),i){We({draggedDistance:he*(w==="bottom"||w==="right"?1:-1),closeDrawer:ar,velocity:be,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(be>hN){ar(),s==null||s(Oe,!1);return}var Ve;const de=Math.min((Ve=V.current.getBoundingClientRect().height)!=null?Ve:0,window.innerHeight);var _e;const Ie=Math.min((_e=V.current.getBoundingClientRect().width)!=null?_e:0,window.innerWidth),bt=w==="left"||w==="right";if(Math.abs(xe)>=(bt?Ie:de)*c){ar(),s==null||s(Oe,!1);return}s==null||s(Oe,!0),yt()}B.useEffect(()=>(Z&&(Ft(document.documentElement,{scrollBehavior:"auto"}),R.current=new Date),()=>{r3(document.documentElement,"scrollBehavior")}),[Z]);function sr(Oe){const xe=Oe?(window.innerWidth-As)/window.innerWidth:1,je=Oe?-As:0;F.current&&window.clearTimeout(F.current),Ft(V.current,{transition:`transform ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,transform:Dt(w)?`scale(${xe}) translate3d(0, ${je}px, 0)`:`scale(${xe}) translate3d(${je}px, 0, 0)`}),!Oe&&V.current&&(F.current=setTimeout(()=>{const he=Rc(V.current,w);Ft(V.current,{transition:"none",transform:Dt(w)?`translate3d(0, ${he}px, 0)`:`translate3d(${he}px, 0, 0)`})},500))}function zn(Oe,xe){if(xe<0)return;const je=(window.innerWidth-As)/window.innerWidth,he=je+xe*(1-je),be=-As+xe*As;Ft(V.current,{transform:Dt(w)?`scale(${he}) translate3d(0, ${be}px, 0)`:`scale(${he}) translate3d(${be}px, 0, 0)`,transition:"none"})}function ha(Oe,xe){const je=Dt(w)?window.innerHeight:window.innerWidth,he=xe?(je-As)/je:1,be=xe?-As:0;xe&&Ft(V.current,{transition:`transform ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,transform:Dt(w)?`scale(${he}) translate3d(0, ${be}px, 0)`:`scale(${he}) translate3d(${be}px, 0, 0)`})}return B.useEffect(()=>{v||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[v]),B.createElement(Kl,{defaultOpen:k,onOpenChange:Oe=>{!u&&!Oe||(Oe?ne(!0):ar(!0),H(Oe))},open:Z},B.createElement(cN.Provider,{value:{activeSnapPoint:ee,snapPoints:i,setActiveSnapPoint:De,drawerRef:V,overlayRef:K,onOpenChange:t,onPress:$r,onRelease:Kt,onDrag:br,dismissible:u,shouldAnimate:G,handleOnly:f,isOpen:Z,isDragging:J,shouldFade:ut,closeDrawer:ar,onNestedDrag:zn,onNestedOpenChange:sr,onNestedRelease:ha,keyboardIsOpen:W,modal:v,snapPointsOffset:ze,activeSnapPointIndex:ge,direction:w,shouldScaleBackground:o,setBackgroundColorOnScale:l,noBodyStyles:N,container:D,autoFocus:A}},r))}const vN=B.forwardRef(function({...e},t){const{overlayRef:r,snapPoints:n,onRelease:s,shouldFade:i,isOpen:o,modal:l,shouldAnimate:c}=ac(),d=fN(t,r),u=n&&n.length>0;if(!l)return null;const f=B.useCallback(m=>s(m),[s]);return B.createElement(yi,{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})});vN.displayName="Drawer.Overlay";const yN=B.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}=ac(),[w,k]=B.useState(!1),b=fN(s,i),S=B.useRef(null),C=B.useRef(null),_=B.useRef(!1),M=g&&g.length>0;d3();const D=(T,$,Z=0)=>{if(_.current)return!0;const H=Math.abs(T.y),Q=Math.abs(T.x),ne=Q>H,J=["bottom","right"].includes($)?1:-1;if($==="left"||$==="right"){if(!(T.x*J<0)&&Q>=0&&Q<=Z)return ne}else if(!(T.y*J<0)&&H>=0&&H<=Z)return!ne;return _.current=!0,!0};B.useEffect(()=>{M&&window.requestAnimationFrame(()=>{k(!0)})},[]);function A(T){S.current=null,_.current=!1,l(T)}return B.createElement(bi,{"data-vaul-drawer-direction":x,"data-vaul-drawer":"","data-vaul-delayed-snap-points":w?"true":"false","data-vaul-snap-points":p&&M?"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:T=>{y||(n.onPointerDown==null||n.onPointerDown.call(n,T),S.current={x:T.pageX,y:T.pageY},o(T))},onOpenAutoFocus:T=>{r==null||r(T),N||T.preventDefault()},onPointerDownOutside:T=>{if(e==null||e(T),!m||T.defaultPrevented){T.preventDefault();return}d.current&&(d.current=!1)},onFocusOutside:T=>{if(!m){T.preventDefault();return}},onPointerMove:T=>{if(C.current=T,y||(n.onPointerMove==null||n.onPointerMove.call(n,T),!S.current))return;const $=T.pageY-S.current.y,Z=T.pageX-S.current.x,H=T.pointerType==="touch"?10:2;D({x:Z,y:$},x,H)?c(T):(Math.abs(Z)>H||Math.abs($)>H)&&(S.current=null)},onPointerUp:T=>{n.onPointerUp==null||n.onPointerUp.call(n,T),S.current=null,_.current=!1,l(T)},onPointerOut:T=>{n.onPointerOut==null||n.onPointerOut.call(n,T),A(C.current)},onContextMenu:T=>{n.onContextMenu==null||n.onContextMenu.call(n,T),C.current&&A(C.current)}})});yN.displayName="Drawer.Content";const m3=250,h3=120,p3=B.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}=ac(),x=B.useRef(null),g=B.useRef(!1);function v(){if(g.current){N();return}window.setTimeout(()=>{y()},h3)}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(S=>S===l);if(k===-1)return;const b=o[k+1];c(b)}function j(){x.current=window.setTimeout(()=>{g.current=!0},m3)}function N(){x.current&&window.clearTimeout(x.current),g.current=!1}return B.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},B.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});p3.displayName="Drawer.Handle";function x3(e){const t=ac(),{container:r=t.container,...n}=e;return B.createElement(Hl,{container:r,...n})}const Ga={Root:f3,Content:yN,Overlay:vN,Portal:x3,Title:ho,Description:po},Si=({shouldScaleBackground:e=!1,direction:t="right",...r})=>a.jsx(Ga.Root,{shouldScaleBackground:e,direction:t,...r});Si.displayName="Drawer";const g3=Ga.Portal,bN=h.forwardRef(({className:e,...t},r)=>a.jsx(Ga.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}));bN.displayName=Ga.Overlay.displayName;const Ci=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(g3,{children:[a.jsx(bN,{}),a.jsx(Ga.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})]}));Ci.displayName="DrawerContent";const No=({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});No.displayName="DrawerHeader";const ko=({className:e,...t})=>a.jsx("div",{className:z("flex-1 overflow-y-auto px-6 py-4",e),...t});ko.displayName="DrawerBody";const sc=({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});sc.displayName="DrawerFooter";const So=h.forwardRef(({className:e,...t},r)=>a.jsx(Ga.Title,{ref:r,className:z("text-base font-semibold text-foreground",e),...t}));So.displayName=Ga.Title.displayName;const v3=h.forwardRef(({className:e,...t},r)=>a.jsx(Ga.Description,{ref:r,className:z("text-sm text-muted-foreground",e),...t}));v3.displayName=Ga.Description.displayName;const y3=Gl("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),mt=h.forwardRef(({className:e,...t},r)=>a.jsx(zj,{ref:r,className:z(y3(),e),...t}));mt.displayName=zj.displayName;const Vu=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}));Vu.displayName="Textarea";const ry=[{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}],wm=["#94a3b8","#64748b","#6366f1","#f59e0b","#10b981","#ef4444","#3b82f6","#8b5cf6"];function b3(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function w3({chip:e,onRemove:t}){const{attributes:r,listeners:n,setNodeRef:s,transform:i,transition:o,isDragging:l}=Fp({id:e.key});return a.jsxs("div",{ref:s,style:{transform:Bp.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(E1,{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(Je,{className:"h-3 w-3"})})]})}const j3=3;function N3({open:e,onClose:t}){var Z;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(ry),[x,g]=h.useState(""),[v,y]=h.useState(wm[2]),{workspace:j}=Te(),N=ND(),w=wD(r,{enabled:e}),k=jD(s,{enabled:e});h.useEffect(()=>{e&&w.data&&!c&&i(w.data)},[e,w.data,c]);const b=k.available===!1||N.isError&&((Z=N.error)==null?void 0:Z.status)===409,S=s.trim().length>=j3&&/^[A-Z0-9]+$/i.test(s.trim()),C=Zj(zp(Jj,{activationConstraint:{distance:5}})),_=H=>{n(H)},M=()=>{r.trim()&&!c&&w.flush()},D=()=>{n(""),i(""),l(""),d(!1),f(!1),p(ry),g(""),y(wm[2]),N.reset(),t()},A=()=>{if(!x.trim())return;const H=b3(x.trim());if(m.some(Q=>Q.key===H)){U.error("A status with this name already exists");return}p(Q=>[...Q,{name:x.trim(),key:H,color:v,category:"started",position:Q.length}]),g("")},T=H=>{const{active:Q,over:ne}=H;!ne||Q.id===ne.id||p(J=>{const O=J.findIndex(L=>L.key===Q.id),E=J.findIndex(L=>L.key===ne.id);return ud(J,O,E).map((L,K)=>({...L,position:K}))})},$=H=>{H.preventDefault(),!(!r.trim()||!s.trim()||!S||b)&&N.mutate({name:r.trim(),identifier:s.trim().toUpperCase(),description:o.trim()||void 0,workspace_id:j.id,initial_statuses:m},{onSuccess:()=>{U.success("Project created"),D()},onError:Q=>{(Q==null?void 0:Q.status)===409?U.error("This project key is already in use."):U.error(Q.message??"Failed to create project")}})};return a.jsx(Si,{open:e,onOpenChange:H=>!H&&D(),dismissible:!1,children:a.jsxs(Ci,{className:"max-w-md",children:[a.jsx(No,{children:a.jsx(So,{children:"New project"})}),a.jsxs("form",{onSubmit:$,className:"flex flex-col flex-1 overflow-hidden",children:[a.jsxs(ko,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{htmlFor:"project-name",children:"Name"}),a.jsx(Me,{id:"project-name",placeholder:"My Project",value:r,onChange:H=>_(H.target.value),onBlur:M,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(Me,{id:"project-id",placeholder:"PROJ",value:s,onChange:H=>{i(H.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(Vu,{id:"project-desc",placeholder:"What is this project about?",value:o,onChange:H=>l(H.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(la,{className:"h-3.5 w-3.5"}):a.jsx(hr,{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(vl,{sensors:C,onDragEnd:T,children:a.jsx(Lp,{items:m.map(H=>H.key),strategy:e1,children:a.jsx("div",{className:"flex flex-wrap gap-1.5",children:m.map(H=>a.jsx(w3,{chip:H,onRemove:()=>p(Q=>Q.filter(ne=>ne.key!==H.key).map((ne,J)=>({...ne,position:J})))},H.key))})})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:wm.map(H=>a.jsx("button",{type:"button",onClick:()=>y(H),className:z("h-4 w-4 rounded-full border-2 transition-transform hover:scale-110",v===H?"border-foreground scale-110":"border-transparent"),style:{backgroundColor:H}},H))}),a.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[a.jsx(Me,{placeholder:"Status name…",value:x,onChange:H=>g(H.target.value),onKeyDown:H=>{H.key==="Enter"&&(H.preventDefault(),A())},className:"h-7 text-xs flex-1"}),a.jsx(ae,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7 shrink-0",onClick:A,disabled:!x.trim(),children:a.jsx(dt,{className:"h-3.5 w-3.5"})})]})]})]})]})]}),a.jsxs(sc,{children:[a.jsx(ae,{type:"button",variant:"ghost",onClick:D,children:"Cancel"}),a.jsx(ae,{type:"submit",disabled:!r.trim()||!s.trim()||!S||b||N.isPending,children:N.isPending?"Creating...":"Create project"})]})]})]})})}const Pt=DO,Ot=TO,_t=h.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},s)=>a.jsx(AO,{children:a.jsx(Lj,{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=Lj.displayName;function _a({options:e,selected:t,onSelectionChange:r,placeholder:n="Select…",className:s}){var d;const[i,o]=h.useState(!1);function l(u){t.includes(u)?r(t.filter(f=>f!==u)):r([...t,u])}const c=t.length===0?null:t.length===1?(d=e.find(u=>u.value===t[0]))==null?void 0:d.label:`${t.length} selected`;return a.jsxs(Pt,{open:i,onOpenChange:o,children:[a.jsx(Ot,{asChild:!0,children:a.jsxs(ae,{variant:"outline",role:"combobox","aria-expanded":i,className:z("h-8 justify-between text-xs font-normal min-w-36",!c&&"text-muted-foreground",s),children:[a.jsx("span",{className:"truncate",children:c??n}),a.jsx(go,{className:"ml-2 h-3.5 w-3.5 shrink-0 opacity-50"})]})}),a.jsxs(_t,{className:"w-56 p-0",align:"start",children:[a.jsxs(Zs,{children:[a.jsx(Yu,{placeholder:"Search…",className:"h-8 text-xs"}),a.jsxs(Js,{children:[a.jsx(Gu,{className:"text-xs py-4 text-center text-muted-foreground",children:"No results."}),a.jsx(us,{children:e.map(u=>a.jsxs(fn,{value:u.label,onSelect:()=>l(u.value),className:"text-xs cursor-pointer",children:[a.jsx(Xt,{className:z("mr-2 h-3.5 w-3.5",t.includes(u.value)?"opacity-100":"opacity-0")}),u.label]},u.value))})]})]}),t.length>0&&a.jsx("div",{className:"border-t p-2",children:a.jsxs(ae,{variant:"ghost",size:"sm",className:"h-7 w-full text-xs text-muted-foreground",onClick:()=>r([]),children:[a.jsx(Je,{className:"h-3 w-3 mr-1"}),"Clear all"]})})]})]})}function k3({open:e,onClose:t,projectId:r,projectName:n}){const{workspace:s}=Te(),i=(s==null?void 0:s.id)??"",{data:o,isLoading:l}=da(r),{data:c}=Zl(i),{data:d}=Ru(i),u=V1(r),f=X1(r),m=Q1(r),p=Z1(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(Ha,{open:e,onOpenChange:b=>!b&&t(),children:a.jsxs(ua,{className:"sm:max-w-[480px]",children:[a.jsx(Ka,{children:a.jsxs(Ya,{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 A;const S=b.user,C=(S==null?void 0:S.first_name)??"",_=(S==null?void 0:S.last_name)??"",M=`${C} ${_}`.trim()||(S==null?void 0:S.email)||"Unknown",D=(C[0]??_[0]??((A=S==null?void 0:S.email)==null?void 0:A[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:D})}),a.jsx("span",{className:"flex-1 text-sm truncate",children:M}),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:()=>U.success("Access removed"),onError:()=>U.error("Failed to remove")}),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",children:a.jsx(Je,{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(vo,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),a.jsx(_a,{options:w.map(b=>{const S=b.user,C=(S==null?void 0:S.first_name)??"",_=(S==null?void 0:S.last_name)??"";return{value:b.user_id,label:`${C} ${_}`.trim()||(S==null?void 0:S.email)||"Unknown"}}),selected:x,onSelectionChange:g,placeholder:"Add people…",className:"flex-1"}),x.length>0&&a.jsx(ae,{size:"sm",className:"h-8 px-3 text-xs shrink-0",disabled:u.isPending,onClick:()=>u.mutate({userIds:x},{onSuccess:b=>{U.success(`${b.added} member${b.added===1?"":"s"} added`),g([])},onError:()=>U.error("Failed to grant access")}),children:x.length===1?"Add":`Add ${x.length} members`})]})]}),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 S=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(li,{className:"h-3.5 w-3.5 text-muted-foreground"})}),a.jsx("span",{className:"flex-1 text-sm truncate",children:(S==null?void 0:S.name)??"Unknown team"}),S&&a.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[S.member_count," ",S.member_count===1?"member":"members"]}),a.jsx("button",{onClick:()=>p.mutate(b.team_id,{onSuccess:()=>U.success("Team access removed"),onError:()=>U.error("Failed to remove team")}),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",children:a.jsx(Je,{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(li,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),a.jsx(_a,{options:k.map(b=>({value:b.id,label:b.name})),selected:v,onSelectionChange:y,placeholder:"Add teams…",className:"flex-1"}),v.length>0&&a.jsx(ae,{size:"sm",className:"h-8 px-3 text-xs shrink-0",disabled:m.isPending,onClick:()=>m.mutate(v,{onSuccess:b=>{U.success(`${b.added} team${b.added===1?"":"s"} added`),y([])},onError:()=>U.error("Failed to add teams")}),children:v.length===1?"Add":`Add ${v.length} teams`})]})]}),a.jsx("div",{className:"flex justify-end pt-1",children:a.jsx(ae,{variant:"outline",size:"sm",onClick:t,children:"Close"})})]})]})})}const wN=6048e5,S3=864e5,C3=36e5,$c=43200,ny=1440,ay=Symbol.for("constructDateFrom");function Nt(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&ay in e?e[ay](t):e instanceof Date?new e.constructor(t):new Date(t)}function qe(e,t){return Nt(t||e,e)}function Hr(e,t,r){const n=qe(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 fx(e,t,r){const n=qe(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 _3={};function Co(){return _3}function Zi(e,t){var l,c,d,u;const r=Co(),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=qe(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 kl(e,t){return Zi(e,{...t,weekStartsOn:1})}function jN(e,t){const r=qe(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=kl(s),o=Nt(r,0);o.setFullYear(n,0,4),o.setHours(0,0,0,0);const l=kl(o);return r.getTime()>=i.getTime()?n+1:r.getTime()>=l.getTime()?n:n-1}function Sd(e){const t=qe(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 fa(e,...t){const r=Nt.bind(null,e||t.find(n=>typeof n=="object"));return t.map(r)}function Ji(e,t){const r=qe(e,t==null?void 0:t.in);return r.setHours(0,0,0,0),r}function Xu(e,t,r){const[n,s]=fa(r==null?void 0:r.in,e,t),i=Ji(n),o=Ji(s),l=+i-Sd(i),c=+o-Sd(o);return Math.round((l-c)/S3)}function M3(e,t){const r=jN(e,t),n=Nt(e,0);return n.setFullYear(r,0,4),n.setHours(0,0,0,0),kl(n)}function P3(e,t,r){return Hr(e,t*7,r)}function O3(e,t,r){return fx(e,t*12,r)}function E3(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=qe(s,n);(!r||r<i||isNaN(+i))&&(r=i)}),Nt(n,r||NaN)}function A3(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=qe(s,n);(!r||r>i||isNaN(+i))&&(r=i)}),Nt(n,r||NaN)}function fd(e,t){const r=+qe(e)-+qe(t);return r<0?-1:r>0?1:r}function mx(e){return Nt(e,Date.now())}function eo(e,t,r){const[n,s]=fa(r==null?void 0:r.in,e,t);return+Ji(n)==+Ji(s)}function NN(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function D3(e){return!(!NN(e)&&typeof e!="number"||isNaN(+qe(e)))}function hx(e,t,r){const[n,s]=fa(r==null?void 0:r.in,e,t),i=n.getFullYear()-s.getFullYear(),o=n.getMonth()-s.getMonth();return i*12+o}function kN(e,t,r){const[n,s]=fa(r==null?void 0:r.in,e,t),i=sy(n,s),o=Math.abs(Xu(n,s));n.setDate(n.getDate()-i*o);const l=+(sy(n,s)===-i),c=i*(o-l);return c===0?0:c}function sy(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 SN(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function T3(e,t,r){const[n,s]=fa(r==null?void 0:r.in,e,t),i=(+n-+s)/C3;return SN(r==null?void 0:r.roundingMethod)(i)}function I3(e,t){return+qe(e)-+qe(t)}function CN(e,t){const r=qe(e,t==null?void 0:t.in);return r.setHours(23,59,59,999),r}function px(e,t){const r=qe(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 R3(e,t){const r=qe(e,t==null?void 0:t.in);return+CN(r,t)==+px(r,t)}function _N(e,t,r){const[n,s,i]=fa(r==null?void 0:r.in,e,e,t),o=fd(s,i),l=Math.abs(hx(s,i));if(l<1)return 0;s.getMonth()===1&&s.getDate()>27&&s.setDate(30),s.setMonth(s.getMonth()-o*l);let c=fd(s,i)===-o;R3(n)&&l===1&&fd(n,i)===1&&(c=!1);const d=o*(l-+c);return d===0?0:d}function $3(e,t,r){const n=I3(e,t)/1e3;return SN(r==null?void 0:r.roundingMethod)(n)}function MN(e,t){const[r,n]=fa(e,t.start,t.end);return{start:r,end:n}}function z3(e,t){const{start:r,end:n}=MN(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 PN(e,t){const r=qe(e,t==null?void 0:t.in);return r.setDate(1),r.setHours(0,0,0,0),r}function L3(e,t){const r=qe(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 ON(e,t){const r=qe(e,t==null?void 0:t.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}function F3(e,t){const{start:r,end:n}=MN(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 EN(e,t){var l,c,d,u;const r=Co(),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=qe(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 B3(e,t){return EN(e,{...t,weekStartsOn:1})}const W3={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"}},U3=(e,t,r)=>{let n;const s=W3[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 jm(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}const q3={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},H3={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},K3={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Y3={date:jm({formats:q3,defaultWidth:"full"}),time:jm({formats:H3,defaultWidth:"full"}),dateTime:jm({formats:K3,defaultWidth:"full"})},G3={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},V3=(e,t,r,n)=>G3[e];function Go(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 X3={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Q3={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Z3={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"]},J3={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"]},eI={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"}},tI={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"}},rI=(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"},nI={ordinalNumber:rI,era:Go({values:X3,defaultWidth:"wide"}),quarter:Go({values:Q3,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Go({values:Z3,defaultWidth:"wide"}),day:Go({values:J3,defaultWidth:"wide"}),dayPeriod:Go({values:eI,defaultWidth:"wide",formattingValues:tI,defaultFormattingWidth:"wide"})};function Vo(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)?sI(l,f=>f.test(o)):aI(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 aI(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function sI(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}function iI(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 oI=/^(\d+)(th|st|nd|rd)?/i,lI=/\d+/i,cI={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},dI={any:[/^b/i,/^(a|c)/i]},uI={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},fI={any:[/1/i,/2/i,/3/i,/4/i]},mI={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},hI={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]},pI={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},xI={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]},gI={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},vI={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}},yI={ordinalNumber:iI({matchPattern:oI,parsePattern:lI,valueCallback:e=>parseInt(e,10)}),era:Vo({matchPatterns:cI,defaultMatchWidth:"wide",parsePatterns:dI,defaultParseWidth:"any"}),quarter:Vo({matchPatterns:uI,defaultMatchWidth:"wide",parsePatterns:fI,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Vo({matchPatterns:mI,defaultMatchWidth:"wide",parsePatterns:hI,defaultParseWidth:"any"}),day:Vo({matchPatterns:pI,defaultMatchWidth:"wide",parsePatterns:xI,defaultParseWidth:"any"}),dayPeriod:Vo({matchPatterns:gI,defaultMatchWidth:"any",parsePatterns:vI,defaultParseWidth:"any"})},qs={code:"en-US",formatDistance:U3,formatLong:Y3,formatRelative:V3,localize:nI,match:yI,options:{weekStartsOn:0,firstWeekContainsDate:1}};function bI(e,t){const r=qe(e,t==null?void 0:t.in);return Xu(r,ON(r))+1}function xx(e,t){const r=qe(e,t==null?void 0:t.in),n=+kl(r)-+M3(r);return Math.round(n/wN)+1}function AN(e,t){var u,f,m,p;const r=qe(e,t==null?void 0:t.in),n=r.getFullYear(),s=Co(),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=Zi(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=Zi(c,t);return+r>=+l?n+1:+r>=+d?n:n-1}function wI(e,t){var l,c,d,u;const r=Co(),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=AN(e,t),i=Nt((t==null?void 0:t.in)||e,0);return i.setFullYear(s,0,n),i.setHours(0,0,0,0),Zi(i,t)}function gx(e,t){const r=qe(e,t==null?void 0:t.in),n=+Zi(r,t)-+wI(r,t);return Math.round(n/wN)+1}function et(e,t){const r=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return r+n}const is={y(e,t){const r=e.getFullYear(),n=r>0?r:1-r;return et(t==="yy"?n%100:n,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):et(r+1,2)},d(e,t){return et(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 et(e.getHours()%12||12,t.length)},H(e,t){return et(e.getHours(),t.length)},m(e,t){return et(e.getMinutes(),t.length)},s(e,t){return et(e.getSeconds(),t.length)},S(e,t){const r=t.length,n=e.getMilliseconds(),s=Math.trunc(n*Math.pow(10,r-3));return et(s,t.length)}},Di={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},iy={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 is.y(e,t)},Y:function(e,t,r,n){const s=AN(e,n),i=s>0?s:1-s;if(t==="YY"){const o=i%100;return et(o,2)}return t==="Yo"?r.ordinalNumber(i,{unit:"year"}):et(i,t.length)},R:function(e,t){const r=jN(e);return et(r,t.length)},u:function(e,t){const r=e.getFullYear();return et(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 et(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 et(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 is.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 et(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=gx(e,n);return t==="wo"?r.ordinalNumber(s,{unit:"week"}):et(s,t.length)},I:function(e,t,r){const n=xx(e);return t==="Io"?r.ordinalNumber(n,{unit:"week"}):et(n,t.length)},d:function(e,t,r){return t==="do"?r.ordinalNumber(e.getDate(),{unit:"date"}):is.d(e,t)},D:function(e,t,r){const n=bI(e);return t==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):et(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 et(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 et(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 et(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=Di.noon:n===0?s=Di.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=Di.evening:n>=12?s=Di.afternoon:n>=4?s=Di.morning:s=Di.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 is.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):is.H(e,t)},K:function(e,t,r){const n=e.getHours()%12;return t==="Ko"?r.ordinalNumber(n,{unit:"hour"}):et(n,t.length)},k:function(e,t,r){let n=e.getHours();return n===0&&(n=24),t==="ko"?r.ordinalNumber(n,{unit:"hour"}):et(n,t.length)},m:function(e,t,r){return t==="mo"?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):is.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):is.s(e,t)},S:function(e,t){return is.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return ly(n);case"XXXX":case"XX":return $s(n);case"XXXXX":case"XXX":default:return $s(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return ly(n);case"xxxx":case"xx":return $s(n);case"xxxxx":case"xxx":default:return $s(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+oy(n,":");case"OOOO":default:return"GMT"+$s(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+oy(n,":");case"zzzz":default:return"GMT"+$s(n,":")}},t:function(e,t,r){const n=Math.trunc(+e/1e3);return et(n,t.length)},T:function(e,t,r){return et(+e,t.length)}};function oy(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+et(i,2)}function ly(e,t){return e%60===0?(e>0?"-":"+")+et(Math.abs(e)/60,2):$s(e,t)}function $s(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),s=et(Math.trunc(n/60),2),i=et(n%60,2);return r+s+t+i}const cy=(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"})}},DN=(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"})}},jI=(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],s=r[2];if(!s)return cy(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}}",cy(n,t)).replace("{{time}}",DN(s,t))},NI={p:DN,P:jI},kI=/^D+$/,SI=/^Y+$/,CI=["D","DD","YY","YYYY"];function _I(e){return kI.test(e)}function MI(e){return SI.test(e)}function PI(e,t,r){const n=OI(e,t,r);if(console.warn(n),CI.includes(e))throw new RangeError(n)}function OI(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 EI=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,AI=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,DI=/^'([^]*?)'?$/,TI=/''/g,II=/[a-zA-Z]/;function fe(e,t,r){var u,f,m,p,x,g,v,y;const n=Co(),s=(r==null?void 0:r.locale)??n.locale??qs,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=qe(e,r==null?void 0:r.in);if(!D3(l))throw new RangeError("Invalid time value");let c=t.match(AI).map(j=>{const N=j[0];if(N==="p"||N==="P"){const w=NI[N];return w(j,s.formatLong)}return j}).join("").match(EI).map(j=>{if(j==="''")return{isToken:!1,value:"'"};const N=j[0];if(N==="'")return{isToken:!1,value:RI(j)};if(iy[N])return{isToken:!0,value:j};if(N.match(II))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)&&MI(N)||!(r!=null&&r.useAdditionalDayOfYearTokens)&&_I(N))&&PI(N,t,String(e));const w=iy[N[0]];return w(l,N,s.localize,d)}).join("")}function RI(e){const t=e.match(DI);return t?t[1].replace(TI,"'"):e}function Nh(e,t,r){const n=Co(),s=(r==null?void 0:r.locale)??n.locale??qs,i=2520,o=fd(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]=fa(r==null?void 0:r.in,...o>0?[t,e]:[e,t]),u=$3(d,c),f=(Sd(d)-Sd(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<ny){const x=Math.round(m/60);return s.formatDistance("aboutXHours",x,l)}else{if(m<i)return s.formatDistance("xDays",1,l);if(m<$c){const x=Math.round(m/ny);return s.formatDistance("xDays",x,l)}else if(m<$c*2)return p=Math.round(m/$c),s.formatDistance("aboutXMonths",p,l)}if(p=_N(d,c),p<12){const x=Math.round(m/$c);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 $I(e,t){return Nh(e,mx(e),t)}function yl(e,t){return qe(e,t==null?void 0:t.in).getDate()}function zI(e,t){return qe(e,t==null?void 0:t.in).getDay()}function ks(e,t){const r=qe(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 md(e,t){return qe(e,t==null?void 0:t.in).getMonth()}function LI(e,t){return qe(e,t==null?void 0:t.in).getFullYear()}function FI(e,t){return+qe(e)>+qe(t)}function BI(e,t){return+qe(e)<+qe(t)}function WI(e,t,r){const[n,s]=fa(r==null?void 0:r.in,e,t);return n.getFullYear()===s.getFullYear()&&n.getMonth()===s.getMonth()}function UI(e,t,r){const[n,s]=fa(r==null?void 0:r.in,e,t);return n.getFullYear()===s.getFullYear()}function qI(e,t){return eo(Nt(e,e),mx(e))}function TN(e,t,r){return Hr(e,-t,r)}function HI(e,t){return eo(Nt(e,e),TN(mx(e),1))}function KI(e,t,r){const n=qe(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=ks(o);return n.setMonth(t,Math.min(i,l)),n}function YI(e,t,r){const n=qe(e,r==null?void 0:r.in);return isNaN(+n)?Nt(e,NaN):(n.setFullYear(t),n)}function GI(){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}=wo(),f=kD(),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(ae,{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(ki,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),a.jsx(Me,{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(Kr,{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(ae,{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(Yr,{children:[a.jsx(Gr,{asChild:!0,children:a.jsx(ae,{variant:"ghost",size:"icon-sm",className:"h-7 w-7 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",children:a.jsx(Oa,{className:"h-4 w-4"})})}),a.jsxs(Er,{align:"end",children:[a.jsxs(at,{onClick:()=>m(`/${c}/projects/${x.identifier}/board`),children:[a.jsx(Kr,{className:"h-4 w-4"}),"Open board"]}),a.jsxs(at,{onClick:()=>m(`/${c}/projects/${x.identifier}/issues`),children:[a.jsx(ea,{className:"h-4 w-4"}),"View issues"]}),a.jsxs(at,{onClick:()=>n({id:x.id,name:x.name}),children:[a.jsx(Ea,{className:"h-4 w-4"}),"Manage access"]}),a.jsx(En,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive",onClick:()=>{confirm(`Delete "${x.name}"? This cannot be undone.`)&&f.mutate(x.id,{onSuccess:()=>U.success("Project deleted"),onError:()=>U.error("Failed to delete project")})},children:[a.jsx(Or,{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(Yr,{children:[a.jsx(Gr,{asChild:!0,children:a.jsx(ae,{variant:"ghost",size:"icon-sm",className:"h-8 w-8 text-muted-foreground",children:a.jsx(Oa,{className:"h-4 w-4"})})}),a.jsxs(Er,{align:"end",children:[a.jsxs(at,{onClick:()=>m(`/${c}/projects/${x.identifier}/issues`),children:[a.jsx(ea,{className:"h-4 w-4"}),"View issues"]}),a.jsxs(at,{onClick:()=>n({id:x.id,name:x.name}),children:[a.jsx(Ea,{className:"h-4 w-4"}),"Manage access"]}),a.jsx(En,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive",onClick:()=>{confirm(`Delete "${x.name}"? This cannot be undone.`)&&f.mutate(x.id,{onSuccess:()=>U.success("Project deleted"),onError:()=>U.error("Failed to delete project")})},children:[a.jsx(Or,{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(ae,{variant:"ghost",size:"sm",className:"h-7 text-xs",disabled:!0,children:"Prev"}),a.jsx(ae,{variant:"ghost",size:"sm",className:"h-7 text-xs",disabled:!0,children:"Next"})]})]})]}),a.jsx(N3,{open:e,onClose:()=>t(!1)}),r&&a.jsx(k3,{open:!!r,onClose:()=>n(null),projectId:r.id,projectName:r.name})]})}const ic={byProject:e=>["projects",e,"statuses"]};function _o(e){return $e({queryKey:ic.byProject(e??""),queryFn:()=>oe.get(`/admin/projects/${e}/statuses`),select:t=>t.statuses,enabled:!!e})}function VI(e){const t=Ne();return ye({mutationFn:r=>oe.post(`/admin/projects/${e}/statuses`,r),onSuccess:()=>{t.invalidateQueries({queryKey:ic.byProject(e)})}})}function XI(e,t){const r=Ne();return ye({mutationFn:n=>oe.put(`/admin/projects/${e}/statuses/${t}`,n),onSuccess:()=>{r.invalidateQueries({queryKey:ic.byProject(e)})}})}function QI(e){const t=Ne();return ye({mutationFn:r=>oe.delete(`/admin/projects/${e}/statuses/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:ic.byProject(e)})}})}function ZI(e){const t=Ne();return ye({mutationFn:r=>oe.post(`/admin/projects/${e}/statuses/reorder`,{orderedIds:r}),onSuccess:()=>{t.invalidateQueries({queryKey:ic.byProject(e)})}})}const _i={all:["users"],list:e=>[..._i.all,"list",e??{}]};function IN(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),$e({queryKey:_i.list({limit:t,offset:r,q:n}),queryFn:()=>oe.get(`/admin/users?${s}`),staleTime:1e3*60*5,placeholderData:i=>i})}const Qu={all:["org-invitations"],list:e=>[...Qu.all,"list",e??{}]};function JI(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),$e({queryKey:Qu.list({limit:t,offset:r,q:n}),queryFn:()=>oe.get(`/admin/users/invitations?${s}`),staleTime:1e3*30,placeholderData:i=>i})}function e4(){const e=Ne();return ye({mutationFn:t=>oe.delete(`/admin/users/invitations/${t}`),onSuccess:()=>e.invalidateQueries({queryKey:Qu.all})})}function t4(){return ye({mutationFn:e=>oe.post(`/admin/users/invitations/${e}/resend`)})}function r4(){const e=Ne();return ye({mutationFn:({email:t,role:r})=>oe.post("/admin/users/invite",{email:t,role:r}),onSuccess:()=>e.invalidateQueries({queryKey:Qu.all})})}function n4(){const e=Ne();return ye({mutationFn:({userId:t,role:r})=>oe.patch(`/admin/users/${t}`,{role:r}),onSuccess:()=>e.invalidateQueries({queryKey:_i.all})})}function a4(){const e=Ne();return ye({mutationFn:t=>oe.delete(`/admin/users/${t}`),onSuccess:()=>e.invalidateQueries({queryKey:_i.all})})}function s4(){const e=Ne();return ye({mutationFn:t=>oe.post(`/admin/users/${t}/reactivate`),onSuccess:()=>e.invalidateQueries({queryKey:_i.all})})}function RN(){return $e({queryKey:[..._i.all,"map-list"],queryFn:()=>oe.get("/admin/users/map"),select:e=>e.users,staleTime:1e3*60*5})}function Cs(){return $e({queryKey:[..._i.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 ui={backlog:"Backlog",todo:"Todo",in_progress:"In Progress",in_review:"In Review",done:"Done",cancelled:"Cancelled"},nn={urgent:"Urgent",high:"High",medium:"Medium",low:"Low",none:"None"},oc={urgent:"text-red-500",high:"text-orange-500",medium:"text-yellow-500",low:"text-blue-400",none:"text-zinc-400"},Aa={task:"Task",bug:"Bug",feature:"Feature",improvement:"Improvement",epic:"Epic"},i4=({priority:e})=>{const t=z("h-3 w-3 shrink-0",oc[e]);switch(e){case"urgent":return a.jsx(ca,{className:t});case"high":return a.jsx(ji,{className:t});case"medium":return a.jsx(Ua,{className:t});case"low":return a.jsx(wi,{className:t});default:return a.jsx(Pr,{className:"h-3 w-3 shrink-0 text-zinc-300"})}};function $N({issue:e,childCount:t=0,onClick:r}){var f,m;const{data:n}=Cs(),{attributes:s,listeners:i,setNodeRef:o,transform:l,transition:c,isDragging:d}=Fp({id:e.id}),u={transform:Bp.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(Pn,{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(Pn,{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(i4,{priority:e.priority})]})]})]})}function zc(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 o4=({category:e,color:t})=>{const r="h-3.5 w-3.5 shrink-0",n={color:t};switch(e){case"completed":return a.jsx(na,{className:r,style:n});case"started":return a.jsx(In,{className:r,style:n});default:return a.jsx(Pr,{className:r,style:n})}};function l4({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}=fE({id:e}),{attributes:y,listeners:j,setNodeRef:N,transform:w,transition:k,isDragging:b}=Fp({id:e,disabled:!o}),S=h.useRef(null),C=h.useRef(!1);h.useEffect(()=>{u&&(C.current=!1,setTimeout(()=>{var $;return($=S.current)==null?void 0:$.focus()},0))},[u]);const _=o?{transform:Bp.Transform.toString(w),transition:k}:void 0,M=zc(r,.08),D=zc(r,.16),A=zc(r,.35),T=!!(c||d);return a.jsxs("div",{ref:N,style:_,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(E1,{className:"h-3.5 w-3.5"})}),a.jsx(o4,{category:n,color:r}),u?a.jsx("input",{ref:S,value:f??"",onChange:$=>m==null?void 0:m($.target.value),onKeyDown:$=>{$.key==="Enter"&&($.preventDefault(),p==null||p()),$.key==="Escape"&&($.preventDefault(),C.current=!0,x==null||x())},onBlur:()=>{C.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:zc(r,.12),color:r},children:s.length}),T&&!u&&a.jsxs(Yr,{children:[a.jsx(Gr,{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:$=>$.stopPropagation(),children:a.jsx(Oa,{className:"h-3.5 w-3.5"})})}),a.jsxs(Er,{align:"end",className:"w-40",children:[c&&a.jsx(at,{onClick:c,children:"Rename"}),c&&d&&a.jsx(En,{}),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?D:M,boxShadow:v?`inset 0 0 0 1px ${A}`:void 0},children:[a.jsx(Lp,{items:s.map($=>$.id),strategy:mE,children:s.map($=>a.jsx($N,{issue:$,childCount:(i==null?void 0:i.get($.id))??0,onClick:()=>l==null?void 0:l($)},$.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 Ue=FO,Xe=BO,Fe=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(Fj,{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(IO,{asChild:!0,children:a.jsx(la,{className:"h-4 w-4 opacity-50"})})]}));Fe.displayName=Fj.displayName;const zN=h.forwardRef(({className:e,...t},r)=>a.jsx(Bj,{ref:r,className:z("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Yp,{className:"h-4 w-4"})}));zN.displayName=Bj.displayName;const LN=h.forwardRef(({className:e,...t},r)=>a.jsx(Wj,{ref:r,className:z("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(la,{className:"h-4 w-4"})}));LN.displayName=Wj.displayName;const Be=h.forwardRef(({className:e,children:t,position:r="popper",...n},s)=>a.jsx(RO,{children:a.jsxs(Uj,{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(zN,{}),a.jsx($O,{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(LN,{})]})}));Be.displayName=Uj.displayName;const c4=h.forwardRef(({className:e,...t},r)=>a.jsx(qj,{ref:r,className:z("px-2 py-1.5 text-xs font-medium text-muted-foreground",e),...t}));c4.displayName=qj.displayName;const ke=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(Hj,{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(zO,{children:a.jsx(Xt,{className:"h-4 w-4"})})}),a.jsx(LO,{children:t})]}));ke.displayName=Hj.displayName;const d4=h.forwardRef(({className:e,...t},r)=>a.jsx(Kj,{ref:r,className:z("-mx-1 my-1 h-px bg-border",e),...t}));d4.displayName=Kj.displayName;const Nm=["#94a3b8","#64748b","#6366f1","#f59e0b","#10b981","#ef4444","#3b82f6","#8b5cf6"],u4=[{value:"backlog",label:"Backlog"},{value:"unstarted",label:"Not Started"},{value:"started",label:"In Progress"},{value:"completed",label:"Done"},{value:"cancelled",label:"Cancelled"}];function f4({open:e,onClose:t,projectId:r}){const[n,s]=h.useState(""),[i,o]=h.useState(Nm[0]),[l,c]=h.useState(""),[d,u]=h.useState("started"),f=VI(r),m=l||i,p=()=>{n.trim()&&f.mutate({name:n.trim(),color:m,category:d},{onSuccess:()=>{U.success("Status created"),s(""),o(Nm[0]),c(""),u("started"),t()},onError:()=>U.error("Failed to create status")})};return a.jsx(Si,{open:e,onOpenChange:x=>!x&&t(),children:a.jsxs(Ci,{className:"sm:max-w-sm",children:[a.jsx(No,{children:a.jsx(So,{className:"text-sm font-medium",children:"New Status"})}),a.jsx(ko,{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(Me,{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:[Nm.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(Me,{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(Ue,{value:d,onValueChange:x=>u(x),children:[a.jsx(Fe,{className:"h-8 text-xs",children:a.jsx(Xe,{})}),a.jsx(Be,{children:u4.map(x=>a.jsx(ke,{value:x.value,className:"text-xs",children:x.label},x.value))})]})]})]})}),a.jsxs(sc,{className:"mt-2",children:[a.jsx(ae,{variant:"ghost",size:"sm",onClick:t,className:"text-xs",children:"Cancel"}),a.jsx(ae,{size:"sm",onClick:p,disabled:!n.trim()||f.isPending,className:"text-xs",children:"Create"})]})]})})}function m4({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(f4,{open:t,onClose:()=>r(!1),projectId:e})]})}function h4({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(Ha,{open:e,onOpenChange:u=>{u||i()},children:a.jsxs(ua,{className:"sm:max-w-md",children:[a.jsxs(Ka,{children:[a.jsx(Ya,{children:"Delete status"}),a.jsx(jo,{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(Ue,{value:l,onValueChange:c,children:[a.jsx(Fe,{children:a.jsx(Xe,{placeholder:"Select a status..."})}),a.jsx(Be,{children:n.map(u=>a.jsx(ke,{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(ox,{children:[a.jsx(ae,{variant:"outline",onClick:i,disabled:o,children:"Cancel"}),a.jsx(ae,{variant:"destructive",onClick:d,disabled:r>0&&!l||o,children:o?"Deleting…":"Delete status"})]})]})})}var vx={};(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 O=new OffscreenCanvas(1,1),E=O.getContext("2d");E.fillRect(0,0,1,1);var L=O.transferToImageBitmap();E.createPattern(L,"no-repeat")}catch{return!1}return!0}();function c(){}function d(O){var E=r.exports.Promise,L=E!==void 0?E:t.Promise;return typeof L=="function"?new L(O):(O(c,c),null)}var u=function(O,E){return{transform:function(L){if(O)return L;if(E.has(L))return E.get(L);var K=new OffscreenCanvas(L.width,L.height),R=K.getContext("2d");return R.drawImage(L,0,0),E.set(L,K),K},clear:function(){E.clear()}}}(l,new Map),f=function(){var O=Math.floor(16.666666666666668),E,L,K={},R=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(E=function(Y){var P=Math.random();return K[P]=requestAnimationFrame(function I(te){R===te||R+O-1<te?(R=te,delete K[P],Y()):K[P]=requestAnimationFrame(I)}),P},L=function(Y){K[Y]&&cancelAnimationFrame(K[Y])}):(E=function(Y){return setTimeout(Y,O)},L=function(Y){return clearTimeout(Y)}),{frame:E,cancel:L}}(),m=function(){var O,E,L={};function K(R){function Y(P,I){R.postMessage({options:P||{},callback:I})}R.init=function(I){var te=I.transferControlToOffscreen();R.postMessage({canvas:te},[te])},R.fire=function(I,te,F){if(E)return Y(I,null),E;var X=Math.random().toString(36).slice(2);return E=d(function(W){function G(se){se.data.callback===X&&(delete L[X],R.removeEventListener("message",G),E=null,u.clear(),F(),W())}R.addEventListener("message",G),Y(I,X),L[X]=G.bind(null,{data:{callback:X}})}),E},R.reset=function(){R.postMessage({reset:!0});for(var I in L)L[I](),delete L[I]}}return function(){if(O)return O;if(!n&&i){var R=["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{O=new Worker(URL.createObjectURL(new Blob([R])))}catch(Y){return typeof console<"u"&&typeof console.warn=="function"&&console.warn("🎊 Could not load worker",Y),null}K(O)}return O}}(),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(O,E){return E?E(O):O}function g(O){return O!=null}function v(O,E,L){return x(O&&g(O[E])?O[E]:p[E],L)}function y(O){return O<0?0:Math.floor(O)}function j(O,E){return Math.floor(Math.random()*(E-O))+O}function N(O){return parseInt(O,16)}function w(O){return O.map(k)}function k(O){var E=String(O).replace(/[^0-9a-f]/gi,"");return E.length<6&&(E=E[0]+E[0]+E[1]+E[1]+E[2]+E[2]),{r:N(E.substring(0,2)),g:N(E.substring(2,4)),b:N(E.substring(4,6))}}function b(O){var E=v(O,"origin",Object);return E.x=v(E,"x",Number),E.y=v(E,"y",Number),E}function S(O){O.width=document.documentElement.clientWidth,O.height=document.documentElement.clientHeight}function C(O){var E=O.getBoundingClientRect();O.width=E.width,O.height=E.height}function _(O){var E=document.createElement("canvas");return E.style.position="fixed",E.style.top="0px",E.style.left="0px",E.style.pointerEvents="none",E.style.zIndex=O,E}function M(O,E,L,K,R,Y,P,I,te){O.save(),O.translate(E,L),O.rotate(Y),O.scale(K,R),O.arc(0,0,1,P,I,te),O.restore()}function D(O){var E=O.angle*(Math.PI/180),L=O.spread*(Math.PI/180);return{x:O.x,y:O.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:O.startVelocity*.5+Math.random()*O.startVelocity,angle2D:-E+(.5*L-Math.random()*L),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:O.color,shape:O.shape,tick:0,totalTicks:O.ticks,decay:O.decay,drift:O.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:O.gravity*3,ovalScalar:.6,scalar:O.scalar,flat:O.flat}}function A(O,E){E.x+=Math.cos(E.angle2D)*E.velocity+E.drift,E.y+=Math.sin(E.angle2D)*E.velocity+E.gravity,E.velocity*=E.decay,E.flat?(E.wobble=0,E.wobbleX=E.x+10*E.scalar,E.wobbleY=E.y+10*E.scalar,E.tiltSin=0,E.tiltCos=0,E.random=1):(E.wobble+=E.wobbleSpeed,E.wobbleX=E.x+10*E.scalar*Math.cos(E.wobble),E.wobbleY=E.y+10*E.scalar*Math.sin(E.wobble),E.tiltAngle+=.1,E.tiltSin=Math.sin(E.tiltAngle),E.tiltCos=Math.cos(E.tiltAngle),E.random=Math.random()+2);var L=E.tick++/E.totalTicks,K=E.x+E.random*E.tiltCos,R=E.y+E.random*E.tiltSin,Y=E.wobbleX+E.random*E.tiltCos,P=E.wobbleY+E.random*E.tiltSin;if(O.fillStyle="rgba("+E.color.r+", "+E.color.g+", "+E.color.b+", "+(1-L)+")",O.beginPath(),o&&E.shape.type==="path"&&typeof E.shape.path=="string"&&Array.isArray(E.shape.matrix))O.fill(Q(E.shape.path,E.shape.matrix,E.x,E.y,Math.abs(Y-K)*.1,Math.abs(P-R)*.1,Math.PI/10*E.wobble));else if(E.shape.type==="bitmap"){var I=Math.PI/10*E.wobble,te=Math.abs(Y-K)*.1,F=Math.abs(P-R)*.1,X=E.shape.bitmap.width*E.scalar,W=E.shape.bitmap.height*E.scalar,G=new DOMMatrix([Math.cos(I)*te,Math.sin(I)*te,-Math.sin(I)*F,Math.cos(I)*F,E.x,E.y]);G.multiplySelf(new DOMMatrix(E.shape.matrix));var se=O.createPattern(u.transform(E.shape.bitmap),"no-repeat");se.setTransform(G),O.globalAlpha=1-L,O.fillStyle=se,O.fillRect(E.x-X/2,E.y-W/2,X,W),O.globalAlpha=1}else if(E.shape==="circle")O.ellipse?O.ellipse(E.x,E.y,Math.abs(Y-K)*E.ovalScalar,Math.abs(P-R)*E.ovalScalar,Math.PI/10*E.wobble,0,2*Math.PI):M(O,E.x,E.y,Math.abs(Y-K)*E.ovalScalar,Math.abs(P-R)*E.ovalScalar,Math.PI/10*E.wobble,0,2*Math.PI);else if(E.shape==="star")for(var V=Math.PI/2*3,ie=4*E.scalar,pe=8*E.scalar,ue=E.x,ve=E.y,ee=5,ge=Math.PI/ee;ee--;)ue=E.x+Math.cos(V)*pe,ve=E.y+Math.sin(V)*pe,O.lineTo(ue,ve),V+=ge,ue=E.x+Math.cos(V)*ie,ve=E.y+Math.sin(V)*ie,O.lineTo(ue,ve),V+=ge;else O.moveTo(Math.floor(E.x),Math.floor(E.y)),O.lineTo(Math.floor(E.wobbleX),Math.floor(R)),O.lineTo(Math.floor(Y),Math.floor(P)),O.lineTo(Math.floor(K),Math.floor(E.wobbleY));return O.closePath(),O.fill(),E.tick<E.totalTicks}function T(O,E,L,K,R){var Y=E.slice(),P=O.getContext("2d"),I,te,F=d(function(X){function W(){I=te=null,P.clearRect(0,0,K.width,K.height),u.clear(),R(),X()}function G(){n&&!(K.width===s.width&&K.height===s.height)&&(K.width=O.width=s.width,K.height=O.height=s.height),!K.width&&!K.height&&(L(O),K.width=O.width,K.height=O.height),P.clearRect(0,0,K.width,K.height),Y=Y.filter(function(se){return A(P,se)}),Y.length?I=f.frame(G):W()}I=f.frame(G),te=W});return{addFettis:function(X){return Y=Y.concat(X),F},canvas:O,promise:F,reset:function(){I&&f.cancel(I),te&&te()}}}function $(O,E){var L=!O,K=!!v(E||{},"resize"),R=!1,Y=v(E,"disableForReducedMotion",Boolean),P=i&&!!v(E||{},"useWorker"),I=P?m():null,te=L?S:C,F=O&&I?!!O.__confetti_initialized:!1,X=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion)").matches,W;function G(V,ie,pe){for(var ue=v(V,"particleCount",y),ve=v(V,"angle",Number),ee=v(V,"spread",Number),ge=v(V,"startVelocity",Number),De=v(V,"decay",Number),We=v(V,"gravity",Number),ze=v(V,"drift",Number),Ge=v(V,"colors",w),ut=v(V,"ticks",Number),He=v(V,"shapes"),Ze=v(V,"scalar"),rr=!!v(V,"flat"),$r=b(V),nr=ue,br=[],ar=O.width*$r.x,yt=O.height*$r.y;nr--;)br.push(D({x:ar,y:yt,angle:ve,spread:ee,startVelocity:ge,color:Ge[nr%Ge.length],shape:He[j(0,He.length)],ticks:ut,decay:De,gravity:We,drift:ze,scalar:Ze,flat:rr}));return W?W.addFettis(br):(W=T(O,br,te,ie,pe),W.promise)}function se(V){var ie=Y||v(V,"disableForReducedMotion",Boolean),pe=v(V,"zIndex",Number);if(ie&&X)return d(function(ge){ge()});L&&W?O=W.canvas:L&&!O&&(O=_(pe),document.body.appendChild(O)),K&&!F&&te(O);var ue={width:O.width,height:O.height};I&&!F&&I.init(O),F=!0,I&&(O.__confetti_initialized=!0);function ve(){if(I){var ge={getBoundingClientRect:function(){if(!L)return O.getBoundingClientRect()}};te(ge),I.postMessage({resize:{width:ge.width,height:ge.height}});return}ue.width=ue.height=null}function ee(){W=null,K&&(R=!1,t.removeEventListener("resize",ve)),L&&O&&(document.body.contains(O)&&document.body.removeChild(O),O=null,F=!1)}return K&&!R&&(R=!0,t.addEventListener("resize",ve,!1)),I?I.fire(V,ue,ee):G(V,ue,ee)}return se.reset=function(){I&&I.reset(),W&&W.reset()},se}var Z;function H(){return Z||(Z=$(null,{useWorker:!0,resize:!0})),Z}function Q(O,E,L,K,R,Y,P){var I=new Path2D(O),te=new Path2D;te.addPath(I,new DOMMatrix(E));var F=new Path2D;return F.addPath(te,new DOMMatrix([Math.cos(P)*R,Math.sin(P)*R,-Math.sin(P)*Y,Math.cos(P)*Y,L,K])),F}function ne(O){if(!o)throw new Error("path confetti are not supported in this browser");var E,L;typeof O=="string"?E=O:(E=O.path,L=O.matrix);var K=new Path2D(E),R=document.createElement("canvas"),Y=R.getContext("2d");if(!L){for(var P=1e3,I=P,te=P,F=0,X=0,W,G,se=0;se<P;se+=2)for(var V=0;V<P;V+=2)Y.isPointInPath(K,se,V,"nonzero")&&(I=Math.min(I,se),te=Math.min(te,V),F=Math.max(F,se),X=Math.max(X,V));W=F-I,G=X-te;var ie=10,pe=Math.min(ie/W,ie/G);L=[pe,0,0,pe,-Math.round(W/2+I)*pe,-Math.round(G/2+te)*pe]}return{type:"path",path:E,matrix:L}}function J(O){var E,L=1,K="#000000",R='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';typeof O=="string"?E=O:(E=O.text,L="scalar"in O?O.scalar:L,R="fontFamily"in O?O.fontFamily:R,K="color"in O?O.color:K);var Y=10*L,P=""+Y+"px "+R,I=new OffscreenCanvas(Y,Y),te=I.getContext("2d");te.font=P;var F=te.measureText(E),X=Math.ceil(F.actualBoundingBoxRight+F.actualBoundingBoxLeft),W=Math.ceil(F.actualBoundingBoxAscent+F.actualBoundingBoxDescent),G=2,se=F.actualBoundingBoxLeft+G,V=F.actualBoundingBoxAscent+G;X+=G+G,W+=G+G,I=new OffscreenCanvas(X,W),te=I.getContext("2d"),te.font=P,te.fillStyle=K,te.fillText(E,se,V);var ie=1/L;return{type:"bitmap",bitmap:I.transferToImageBitmap(),matrix:[ie,0,0,ie,-X*ie/2,-W*ie/2]}}r.exports=function(){return H().apply(this,arguments)},r.exports.reset=function(){H().reset()},r.exports.create=$,r.exports.shapeFromPath=ne,r.exports.shapeFromText=J})(function(){return typeof window<"u"?window:typeof self<"u"?self:this||{}}(),vx,!1);const p4=vx.exports;vx.exports.create;function km(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 x4(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 FN({issues:e,projectId:t,statuses:r,onIssueClick:n,onColumnsReorder:s,readOnly:i=!1,filters:o}){var Y;const[l,c]=h.useState(()=>r.map(P=>P.id)),[d,u]=h.useState(()=>km(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),S=Ne(),C=Tt.byProject(t,o),_=QI(t),M=XI(t,y??""),D=h.useMemo(()=>{const P=new Map;for(const I of e)I.parent_id&&P.set(I.parent_id,(P.get(I.parent_id)??0)+1);return P},[e]);h.useEffect(()=>{c(P=>{const I=new Set(r.map(X=>X.id)),te=P.filter(X=>I.has(X)),F=r.map(X=>X.id).filter(X=>!P.includes(X));return te.length===P.length&&F.length===0?P:[...te,...F]})},[r]),h.useEffect(()=>{b.current||u(P=>x4(P,e,r))},[e,r]);const A=[...r].sort((P,I)=>{const te=l.indexOf(P.id),F=l.indexOf(I.id);return te===-1&&F===-1?P.position-I.position:te===-1?1:F===-1?-1:te-F}),T=Zj(zp(Jj,i?{activationConstraint:{distance:1/0}}:{activationConstraint:{distance:5}})),$=h.useCallback(P=>{if(p){const te=P.droppableContainers.filter(F=>l.includes(F.id));return hE({...P,droppableContainers:te})}const I=pE(P);return I.length>0?I:xE(P)},[p,l]),Z=h.useCallback(P=>{for(const[I,te]of Object.entries(d))if(te.some(F=>F.id===P))return I;return null},[d]),H=h.useCallback(P=>r.some(I=>I.id===P),[r]),Q=P=>{const I=P.active.id;if(b.current=!0,H(I)){x(I);return}for(const[te,F]of Object.entries(d)){const X=F.find(W=>W.id===I);if(X){m(X),k.current=te;return}}},ne=P=>{const{active:I,over:te}=P;if(!te||p)return;const F=I.id,X=te.id;if(H(F))return;const W=Z(F),G=r.find(V=>V.key===X||V.id===X),se=(G==null?void 0:G.key)??Z(X);!W||!se||W===se||u(V=>{const ie=[...V[W]??[]],pe=[...V[se]??[]],ue=ie.findIndex(ge=>ge.id===F);if(ue===-1)return V;const[ve]=ie.splice(ue,1),ee={...ve,status:se};if(G)pe.push(ee);else{const ge=pe.findIndex(De=>De.id===X);if(ge===-1)pe.push(ee);else{const De=I.rect.current.translated!=null&&I.rect.current.translated.top>te.rect.top+te.rect.height/2;pe.splice(De?ge+1:ge,0,ee)}}return{...V,[W]:ie,[se]:pe}})},J=P=>{var V;const{active:I,over:te}=P;if(m(null),p){if(x(null),b.current=!1,!te||I.id===te.id)return;const ie=l.indexOf(I.id),pe=l.indexOf(te.id);if(ie===-1||pe===-1||ie===pe)return;const ue=ud(l,ie,pe);c(ue),s==null||s(ue);return}if(!te){b.current=!1;const ie=k.current;k.current=null,ie&&u(km(e,r));return}const F=I.id,X=te.id,W=k.current;k.current=null;const G=r.find(ie=>ie.key===X||ie.id===X),se=(G==null?void 0:G.key)??Z(X);if(!W||!se){b.current=!1;return}if(W===se)b.current=!1,u(ie=>{const pe=ie[W]??[],ue=pe.findIndex(ee=>ee.id===F),ve=pe.findIndex(ee=>ee.id===X);return ue===-1||ve===-1||ue===ve?ie:{...ie,[W]:ud(pe,ue,ve)}});else{if(!r.find(ue=>ue.key===X||ue.id===X))u(ue=>{const ve=[...ue[se]??[]],ee=ve.findIndex(Ge=>Ge.id===F);if(ee===-1)return ue;const ge=P.active.rect.current.translated!=null&&P.active.rect.current.translated.top>P.over.rect.top+P.over.rect.height/2,[De]=ve.splice(ee,1),We=ve.findIndex(Ge=>Ge.id===X);if(We===-1)return ve.splice(ee,0,De),ue;const ze=ge?We+1:We;return ve.splice(ze,0,De),{...ue,[se]:ve}});else{const ue=((V=P.active.rect.current.translated)==null?void 0:V.top)??1/0,ve=P.over.rect.top+P.over.rect.height/2;ue<ve&&u(ee=>{const ge=ee[se]??[],De=ge.findIndex(We=>We.id===F);return De<=0?ee:{...ee,[se]:ud(ge,De,0)}})}const pe=S.getQueryData(C);S.cancelQueries({queryKey:C}),S.setQueryData(C,ue=>ue&&{...ue,issues:ue.issues.map(ve=>ve.id===F?{...ve,status:se}:ve)}),oe.put(`/admin/issues/${F}`,{status:se}).then(()=>{b.current=!1,S.invalidateQueries({queryKey:C});const ue=r.find(ve=>ve.key===se);(ue==null?void 0:ue.category)==="completed"&&p4({particleCount:80,spread:60,origin:{y:.6}})}).catch(()=>{b.current=!1,pe&&S.setQueryData(C,pe),u(km((pe==null?void 0:pe.issues)??e,r)),U.error("Failed to update issue status")})}},O=P=>{v(P)},E=async P=>{if(!g)return;const I=d[g.key]??[];if(I.length>0){const te=r.find(F=>F.id===P);if(!te)return;try{await Promise.all(I.map(F=>oe.put(`/admin/issues/${F.id}`,{status:te.key}))),S.invalidateQueries({queryKey:Tt.byProject(t)})}catch{U.error("Failed to move issues");return}}_.mutate(g.id,{onSuccess:()=>{U.success(`Status "${g.name}" deleted`),v(null)},onError:()=>U.error("Failed to delete status")})},L=()=>{const P=N.trim();!P||!y||M.mutate({name:P},{onSuccess:()=>{U.success("Status renamed"),j(null)},onError:()=>U.error("Failed to rename status")})},K=()=>{j(null)},R=p?r.find(P=>P.id===p):null;return a.jsxs(vl,{sensors:T,collisionDetection:$,onDragStart:Q,onDragOver:ne,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(Lp,{items:l,strategy:e1,children:A.map(P=>a.jsx(l4,{id:P.id,label:P.name,color:P.color,category:P.category,issues:d[P.key]??[],childCounts:D,sortable:!0,onIssueClick:n,onRename:i?void 0:()=>{j(P.id),w(P.name)},onDelete:i?void 0:()=>O(P),isRenaming:y===P.id,renameValue:y===P.id?N:"",onRenameChange:w,onRenameSubmit:L,onRenameCancel:K},P.id))}),!i&&a.jsx(m4,{projectId:t})]}),a.jsxs(gE,{children:[f&&a.jsx($N,{issue:f}),R&&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:R.color}}),R.name]})})]}),g&&a.jsx(h4,{open:!!g,statusName:g.name,issueCount:((Y=d[g.key])==null?void 0:Y.length)??0,otherStatuses:r.filter(P=>P.id!==g.id),onConfirm:E,onCancel:()=>v(null),isLoading:_.isPending})]})}const g4=[{value:"urgent",label:"Urgent"},{value:"high",label:"High"},{value:"medium",label:"Medium"},{value:"low",label:"Low"},{value:"none",label:"None"}],v4=[{value:"bug",label:"Bug"},{value:"feature",label:"Feature"},{value:"task",label:"Task"},{value:"epic",label:"Epic"},{value:"story",label:"Story"}];function Lc({label:e,activeCount:t,children:r}){const[n,s]=h.useState(!1);return a.jsxs(Pt,{open:n,onOpenChange:s,children:[a.jsx(Ot,{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(la,{className:"h-3 w-3 opacity-60"})]})}),a.jsx(_t,{className:"w-48 p-1",align:"start",children:r})]})}function Sm({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(Xt,{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 y4({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(Lc,{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(Xt,{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(Lc,{label:"Priority",activeCount:((m=r.priority)==null?void 0:m.length)??0,children:a.jsx(Sm,{options:g4,selected:r.priority??[],onToggle:g=>i("priority",g)})}),a.jsx(Lc,{label:"Type",activeCount:((p=r.type)==null?void 0:p.length)??0,children:a.jsx(Sm,{options:v4,selected:r.type??[],onToggle:g=>i("type",g)})}),a.jsx(Lc,{label:"Status",activeCount:((x=r.status)==null?void 0:x.length)??0,children:a.jsx(Sm,{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(Je,{className:"h-3 w-3"}),"Clear"]})]})}const b4={mon:!0,tue:!0,wed:!0,thu:!0,fri:!0,sat:!1,sun:!1};function yx(){return $e({queryKey:["org","calendar"],queryFn:()=>oe.get("/admin/org/calendar"),select:e=>({working_days:e.working_days??b4,timezone:e.timezone})})}function w4(){const e=Ne();return ye({mutationFn:t=>oe.put("/admin/org/calendar",t),onSuccess:()=>{e.invalidateQueries({queryKey:["org","calendar"]})}})}function bx(e){const t=e??new Date().getFullYear();return $e({queryKey:["org","holidays",t],queryFn:()=>oe.get(`/admin/org/holidays?year=${t}`),select:r=>r.holidays})}function j4(){const e=Ne();return ye({mutationFn:t=>oe.post("/admin/org/holidays",t),onSuccess:()=>{e.invalidateQueries({queryKey:["org","holidays"]})}})}function N4(){const e=Ne();return ye({mutationFn:({id:t,...r})=>oe.put(`/admin/org/holidays/${t}`,r),onSuccess:()=>{e.invalidateQueries({queryKey:["org","holidays"]})}})}function k4(){const e=Ne();return ye({mutationFn:t=>oe.delete(`/admin/org/holidays/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:["org","holidays"]})}})}function BN(){return $e({queryKey:["app-config"],queryFn:()=>oe.get("/admin/config"),staleTime:1/0})}const S4=["sun","mon","tue","wed","thu","fri","sat"];function C4(e,t,r){const n=S4[zI(e)];if(!t[n])return!1;const s=md(e),i=yl(e);for(const o of r){const l=new Date(o.date);if(o.recurring){if(md(l)===s&&yl(l)===i)return!1}else if(l.getFullYear()===e.getFullYear()&&md(l)===s&&yl(l)===i)return!1}return!0}function kh(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;)C4(i,r,n)&&s++,i=Hr(i,1);return s}const to={all:["sprints"],byProject:e=>["sprints","project",e],detail:e=>["sprints",e]};function Mo(e){return $e({queryKey:e?to.byProject(e):to.all,queryFn:()=>{const t=e?`/admin/sprints?project_id=${e}`:"/admin/sprints";return oe.get(t)},select:t=>t.sprints,enabled:!!e})}function _4(e){const t=Ne();return ye({mutationFn:r=>oe.post("/admin/sprints",{...r,project_id:e}),onSuccess:()=>{t.invalidateQueries({queryKey:to.byProject(e)})}})}function M4(e,t){const r=Ne();return ye({mutationFn:n=>oe.put(`/admin/sprints/${e}`,n),onSuccess:()=>{r.invalidateQueries({queryKey:to.byProject(t)}),r.invalidateQueries({queryKey:to.detail(e)})}})}function P4(e){const t=Ne();return ye({mutationFn:r=>oe.delete(`/admin/sprints/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:to.byProject(e)})}})}const Zu={byProject:e=>["task-lists","project",e]};function lc(e){return $e({queryKey:e?Zu.byProject(e):["task-lists"],queryFn:()=>oe.get(`/admin/projects/${e}/task-lists`),select:t=>t.task_lists,enabled:!!e})}function O4(e){const t=Ne();return ye({mutationFn:r=>oe.post(`/admin/projects/${e}/task-lists`,r),onSuccess:()=>{t.invalidateQueries({queryKey:Zu.byProject(e)})}})}function E4(e){const t=Ne();return ye({mutationFn:({id:r,...n})=>oe.put(`/admin/task-lists/${r}`,n),onSuccess:()=>{t.invalidateQueries({queryKey:Zu.byProject(e)})}})}function A4(e){const t=Ne();return ye({mutationFn:r=>oe.delete(`/admin/task-lists/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:Zu.byProject(e)}),t.invalidateQueries({queryKey:Tt.byProject(e)})}})}function dy(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 uy(e,t,r){return`${e??""} ${t??""}`.trim()||r}function cc({value:e,onChange:t,disabled:r,users:n}){const[s,i]=h.useState(!1),[o,l]=h.useState(e),{data:c}=RN(),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(Pt,{open:s,onOpenChange:i,children:[a.jsx(Ot,{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(vo,{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:dy(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?uy(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(Zs,{children:[a.jsx(Yu,{placeholder:"Search users...",className:"h-8 text-xs"}),a.jsxs(Js,{children:[a.jsx(Gu,{className:"text-xs py-4",children:"No users found."}),a.jsx(us,{children:d.map(p=>{const x=o.includes(p.id),g=uy(p.first_name,p.last_name,p.email),v=dy(p.first_name,p.last_name,p.email);return a.jsxs(fn,{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(Xt,{className:z("h-3.5 w-3.5 shrink-0",x?"opacity-100 text-indigo-500":"opacity-0")})]},p.id)})})]})]})})]})}function D4(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 Cm={},ml={};function Ys(e,t){try{const n=(Cm[e]||(Cm[e]=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format))(t).split("GMT")[1];return n in ml?ml[n]:fy(n,n.split(":"))}catch{if(e in ml)return ml[e];const r=e==null?void 0:e.match(T4);return r?fy(e,r.slice(1)):NaN}}const T4=/([+-]\d\d):?(\d\d)?/;function fy(e,t){const r=+(t[0]||0),n=+(t[1]||0),s=+(t[2]||0)/60;return ml[e]=r*60+n>0?r*60+n+s:r*60-n-s}class Gn extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(Ys(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)),WN(this),Sh(this)):this.setTime(Date.now())}static tz(t,...r){return r.length?new Gn(...r,t):new Gn(Date.now(),t)}withTimeZone(t){return new Gn(+this,t)}getTimezoneOffset(){const t=-Ys(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),Sh(this),+this}[Symbol.for("constructDateFrom")](t){return new Gn(+new Date(t),this.timeZone)}}const my=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!my.test(e))return;const t=e.replace(my,"$1UTC");Gn.prototype[t]&&(e.startsWith("get")?Gn.prototype[e]=function(){return this.internal[t]()}:(Gn.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),I4(this),+this},Gn.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),Sh(this),+this}))});function Sh(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-Ys(e.timeZone,e)*60))}function I4(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()),WN(e)}function WN(e){const t=Ys(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(-(Ys(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=Ys(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=Ys(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 gr extends Gn{static tz(t,...r){return r.length?new gr(...r,t):new gr(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} (${D4(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 gr(+this,t)}[Symbol.for("constructDateFrom")](t){return new gr(+new Date(t),this.timeZone)}}const hy=5,R4=4;function $4(e,t){const r=t.startOfMonth(e),n=r.getDay()>0?r.getDay():7,s=t.addDays(e,-n+1),i=t.addDays(s,hy*7-1);return t.getMonth(e)===t.getMonth(i)?hy:R4}function UN(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 z4(e,t){const r=UN(e,t),n=$4(e,t);return t.addDays(r,n*7-1)}const qN={...qs,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:qs,...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:qs,...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:qs,...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:qs,...t}),n(e,"cccc")}}};class an{constructor(t,r){this.Date=Date,this.today=()=>{var n;return(n=this.overrides)!=null&&n.today?this.overrides.today():this.options.timeZone?gr.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 gr(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):Hr(n,s)},this.addMonths=(n,s)=>{var i;return(i=this.overrides)!=null&&i.addMonths?this.overrides.addMonths(n,s):fx(n,s)},this.addWeeks=(n,s)=>{var i;return(i=this.overrides)!=null&&i.addWeeks?this.overrides.addWeeks(n,s):P3(n,s)},this.addYears=(n,s)=>{var i;return(i=this.overrides)!=null&&i.addYears?this.overrides.addYears(n,s):O3(n,s)},this.differenceInCalendarDays=(n,s)=>{var i;return(i=this.overrides)!=null&&i.differenceInCalendarDays?this.overrides.differenceInCalendarDays(n,s):Xu(n,s)},this.differenceInCalendarMonths=(n,s)=>{var i;return(i=this.overrides)!=null&&i.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(n,s):hx(n,s)},this.eachMonthOfInterval=n=>{var s;return(s=this.overrides)!=null&&s.eachMonthOfInterval?this.overrides.eachMonthOfInterval(n):z3(n)},this.eachYearOfInterval=n=>{var l;const s=(l=this.overrides)!=null&&l.eachYearOfInterval?this.overrides.eachYearOfInterval(n):F3(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):z4(n,this)},this.endOfISOWeek=n=>{var s;return(s=this.overrides)!=null&&s.endOfISOWeek?this.overrides.endOfISOWeek(n):B3(n)},this.endOfMonth=n=>{var s;return(s=this.overrides)!=null&&s.endOfMonth?this.overrides.endOfMonth(n):px(n)},this.endOfWeek=(n,s)=>{var i;return(i=this.overrides)!=null&&i.endOfWeek?this.overrides.endOfWeek(n,s):EN(n,this.options)},this.endOfYear=n=>{var s;return(s=this.overrides)!=null&&s.endOfYear?this.overrides.endOfYear(n):L3(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):xx(n)},this.getMonth=(n,s)=>{var i;return(i=this.overrides)!=null&&i.getMonth?this.overrides.getMonth(n,this.options):md(n,this.options)},this.getYear=(n,s)=>{var i;return(i=this.overrides)!=null&&i.getYear?this.overrides.getYear(n,this.options):LI(n,this.options)},this.getWeek=(n,s)=>{var i;return(i=this.overrides)!=null&&i.getWeek?this.overrides.getWeek(n,this.options):gx(n,this.options)},this.isAfter=(n,s)=>{var i;return(i=this.overrides)!=null&&i.isAfter?this.overrides.isAfter(n,s):FI(n,s)},this.isBefore=(n,s)=>{var i;return(i=this.overrides)!=null&&i.isBefore?this.overrides.isBefore(n,s):BI(n,s)},this.isDate=n=>{var s;return(s=this.overrides)!=null&&s.isDate?this.overrides.isDate(n):NN(n)},this.isSameDay=(n,s)=>{var i;return(i=this.overrides)!=null&&i.isSameDay?this.overrides.isSameDay(n,s):eo(n,s)},this.isSameMonth=(n,s)=>{var i;return(i=this.overrides)!=null&&i.isSameMonth?this.overrides.isSameMonth(n,s):WI(n,s)},this.isSameYear=(n,s)=>{var i;return(i=this.overrides)!=null&&i.isSameYear?this.overrides.isSameYear(n,s):UI(n,s)},this.max=n=>{var s;return(s=this.overrides)!=null&&s.max?this.overrides.max(n):E3(n)},this.min=n=>{var s;return(s=this.overrides)!=null&&s.min?this.overrides.min(n):A3(n)},this.setMonth=(n,s)=>{var i;return(i=this.overrides)!=null&&i.setMonth?this.overrides.setMonth(n,s):KI(n,s)},this.setYear=(n,s)=>{var i;return(i=this.overrides)!=null&&i.setYear?this.overrides.setYear(n,s):YI(n,s)},this.startOfBroadcastWeek=(n,s)=>{var i;return(i=this.overrides)!=null&&i.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(n,this):UN(n,this)},this.startOfDay=n=>{var s;return(s=this.overrides)!=null&&s.startOfDay?this.overrides.startOfDay(n):Ji(n)},this.startOfISOWeek=n=>{var s;return(s=this.overrides)!=null&&s.startOfISOWeek?this.overrides.startOfISOWeek(n):kl(n)},this.startOfMonth=n=>{var s;return(s=this.overrides)!=null&&s.startOfMonth?this.overrides.startOfMonth(n):PN(n)},this.startOfWeek=(n,s)=>{var i;return(i=this.overrides)!=null&&i.startOfWeek?this.overrides.startOfWeek(n,this.options):Zi(n,this.options)},this.startOfYear=n=>{var s;return(s=this.overrides)!=null&&s.startOfYear?this.overrides.startOfYear(n):ON(n)},this.options={locale:qN,...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&&an.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&&an.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)}}an.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 ma=new an;class HN{constructor(t,r,n=ma){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 L4{constructor(t,r){this.date=t,this.weeks=r}}class F4{constructor(t,r){this.days=r,this.weekNumber=t}}function B4(e){return B.createElement("button",{...e})}function W4(e){return B.createElement("span",{...e})}function U4(e){const{size:t=24,orientation:r="left",className:n}=e;return B.createElement("svg",{className:n,width:t,height:t,viewBox:"0 0 24 24"},r==="up"&&B.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),r==="down"&&B.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),r==="left"&&B.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),r==="right"&&B.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function q4(e){const{day:t,modifiers:r,...n}=e;return B.createElement("td",{...n})}function H4(e){const{day:t,modifiers:r,...n}=e,s=B.useRef(null);return B.useEffect(()=>{var i;r.focused&&((i=s.current)==null||i.focus())},[r.focused]),B.createElement("button",{ref:s,...n})}var Pe;(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"})(Pe||(Pe={}));var jt;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(jt||(jt={}));var _n;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(_n||(_n={}));var Zr;(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"})(Zr||(Zr={}));function K4(e){const{options:t,className:r,components:n,classNames:s,...i}=e,o=[s[Pe.Dropdown],r].join(" "),l=t==null?void 0:t.find(({value:c})=>c===i.value);return B.createElement("span",{"data-disabled":i.disabled,className:s[Pe.DropdownRoot]},B.createElement(n.Select,{className:o,...i},t==null?void 0:t.map(({value:c,label:d,disabled:u})=>B.createElement(n.Option,{key:c,value:c,disabled:u},d))),B.createElement("span",{className:s[Pe.CaptionLabel],"aria-hidden":!0},l==null?void 0:l.label,B.createElement(n.Chevron,{orientation:"down",size:18,className:s[Pe.Chevron]})))}function Y4(e){return B.createElement("div",{...e})}function G4(e){return B.createElement("div",{...e})}function V4(e){const{calendarMonth:t,displayIndex:r,...n}=e;return B.createElement("div",{...n},e.children)}function X4(e){const{calendarMonth:t,displayIndex:r,...n}=e;return B.createElement("div",{...n})}function Q4(e){return B.createElement("table",{...e})}function Z4(e){return B.createElement("div",{...e})}const KN=h.createContext(void 0);function dc(){const e=h.useContext(KN);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function J4(e){const{components:t}=dc();return B.createElement(t.Dropdown,{...e})}function eR(e){const{onPreviousClick:t,onNextClick:r,previousMonth:n,nextMonth:s,...i}=e,{components:o,classNames:l,labels:{labelPrevious:c,labelNext:d}}=dc(),u=h.useCallback(m=>{s&&(r==null||r(m))},[s,r]),f=h.useCallback(m=>{n&&(t==null||t(m))},[n,t]);return B.createElement("nav",{...i},B.createElement(o.PreviousMonthButton,{type:"button",className:l[Pe.PreviousMonthButton],tabIndex:n?void 0:-1,"aria-disabled":n?void 0:!0,"aria-label":c(n),onClick:f},B.createElement(o.Chevron,{disabled:n?void 0:!0,className:l[Pe.Chevron],orientation:"left"})),B.createElement(o.NextMonthButton,{type:"button",className:l[Pe.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":d(s),onClick:u},B.createElement(o.Chevron,{disabled:s?void 0:!0,orientation:"right",className:l[Pe.Chevron]})))}function tR(e){const{components:t}=dc();return B.createElement(t.Button,{...e})}function rR(e){return B.createElement("option",{...e})}function nR(e){const{components:t}=dc();return B.createElement(t.Button,{...e})}function aR(e){const{rootRef:t,...r}=e;return B.createElement("div",{...r,ref:t})}function sR(e){return B.createElement("select",{...e})}function iR(e){const{week:t,...r}=e;return B.createElement("tr",{...r})}function oR(e){return B.createElement("th",{...e})}function lR(e){return B.createElement("thead",{"aria-hidden":!0},B.createElement("tr",{...e}))}function cR(e){const{week:t,...r}=e;return B.createElement("th",{...r})}function dR(e){return B.createElement("th",{...e})}function uR(e){return B.createElement("tbody",{...e})}function fR(e){const{components:t}=dc();return B.createElement(t.Dropdown,{...e})}const mR=Object.freeze(Object.defineProperty({__proto__:null,Button:B4,CaptionLabel:W4,Chevron:U4,Day:q4,DayButton:H4,Dropdown:K4,DropdownNav:Y4,Footer:G4,Month:V4,MonthCaption:X4,MonthGrid:Q4,Months:Z4,MonthsDropdown:J4,Nav:eR,NextMonthButton:tR,Option:rR,PreviousMonthButton:nR,Root:aR,Select:sR,Week:iR,WeekNumber:cR,WeekNumberHeader:dR,Weekday:oR,Weekdays:lR,Weeks:uR,YearsDropdown:fR},Symbol.toStringTag,{value:"Module"}));function Na(e,t,r=!1,n=ma){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 wx(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function Ju(e){return!!(e&&typeof e=="object"&&"from"in e)}function jx(e){return!!(e&&typeof e=="object"&&"after"in e)}function Nx(e){return!!(e&&typeof e=="object"&&"before"in e)}function YN(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function GN(e,t){return Array.isArray(e)&&e.every(t.isDate)}function ka(e,t,r=ma){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(GN(l,r))return l.some(c=>s(e,c));if(Ju(l))return Na(l,e,!1,r);if(YN(l))return Array.isArray(l.dayOfWeek)?l.dayOfWeek.includes(e.getDay()):l.dayOfWeek===e.getDay();if(wx(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 jx(l)?i(e,l.after)>0:Nx(l)?i(l.before,e)>0:typeof l=="function"?l(e):!1})}function hR(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:S}=k,C=!!(S&&!m(b,S)),_=!!(y&&x(b,y)),M=!!(j&&v(b,j)),D=!!(i&&ka(b,i,s)),A=!!(o&&ka(b,o,s))||_||M||!d&&!c&&C||d&&c===!1&&C,T=f(b,u);C&&N.outside.push(k),D&&N.disabled.push(k),A&&N.hidden.push(k),T&&N.today.push(k),l&&Object.keys(l).forEach($=>{const Z=l==null?void 0:l[$];Z&&ka(b,Z,s)&&(w[$]?w[$].push(k):w[$]=[k])})}return k=>{const b={[jt.focused]:!1,[jt.disabled]:!1,[jt.hidden]:!1,[jt.outside]:!1,[jt.today]:!1},S={};for(const C in N){const _=N[C];b[C]=_.some(M=>M===k)}for(const C in w)S[C]=w[C].some(_=>_===k);return{...b,...S}}}function pR(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[_n[i]]&&s.push(t[_n[i]]),s),[t[Pe.Day]])}function xR(e){return{...mR,...e}}function gR(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 vR(){const e={};for(const t in Pe)e[Pe[t]]=`rdp-${Pe[t]}`;for(const t in jt)e[jt[t]]=`rdp-${jt[t]}`;for(const t in _n)e[_n[t]]=`rdp-${_n[t]}`;for(const t in Zr)e[Zr[t]]=`rdp-${Zr[t]}`;return e}function VN(e,t,r){return(r??new an(t)).formatMonthYear(e)}const yR=VN;function bR(e,t,r){return(r??new an(t)).format(e,"d")}function wR(e,t=ma){return t.format(e,"LLLL")}function jR(e,t,r){return(r??new an(t)).format(e,"cccccc")}function NR(e,t=ma){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function kR(){return""}function XN(e,t=ma){return t.format(e,"yyyy")}const SR=XN,CR=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:VN,formatDay:bR,formatMonthCaption:yR,formatMonthDropdown:wR,formatWeekNumber:NR,formatWeekNumberHeader:kR,formatWeekdayName:jR,formatYearCaption:SR,formatYearDropdown:XN},Symbol.toStringTag,{value:"Module"}));function _R(e){return e!=null&&e.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e!=null&&e.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...CR,...e}}function kx(e,t,r,n){let s=(n??new an(r)).format(e,"PPPP");return t.today&&(s=`Today, ${s}`),t.selected&&(s=`${s}, selected`),s}const MR=kx;function Sx(e,t,r){return(r??new an(t)).formatMonthYear(e)}const PR=Sx;function QN(e,t,r,n){let s=(n??new an(r)).format(e,"PPPP");return t!=null&&t.today&&(s=`Today, ${s}`),s}function ZN(e){return"Choose the Month"}function JN(){return""}const OR="Go to the Next Month";function ek(e,t){return OR}function tk(e){return"Go to the Previous Month"}function rk(e,t,r){return(r??new an(t)).format(e,"cccc")}function nk(e,t){return`Week ${e}`}function ak(e){return"Week Number"}function sk(e){return"Choose the Year"}const ER=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:PR,labelDay:MR,labelDayButton:kx,labelGrid:Sx,labelGridcell:QN,labelMonthDropdown:ZN,labelNav:JN,labelNext:ek,labelPrevious:tk,labelWeekNumber:nk,labelWeekNumberHeader:ak,labelWeekday:rk,labelYearDropdown:sk},Symbol.toStringTag,{value:"Module"})),wn=(e,t,r)=>t||(r?typeof r=="function"?r:(...n)=>r:e);function AR(e,t){var n;const r=((n=t.locale)==null?void 0:n.labels)??{};return{...ER,...e??{},labelDayButton:wn(kx,e==null?void 0:e.labelDayButton,r.labelDayButton),labelMonthDropdown:wn(ZN,e==null?void 0:e.labelMonthDropdown,r.labelMonthDropdown),labelNext:wn(ek,e==null?void 0:e.labelNext,r.labelNext),labelPrevious:wn(tk,e==null?void 0:e.labelPrevious,r.labelPrevious),labelWeekNumber:wn(nk,e==null?void 0:e.labelWeekNumber,r.labelWeekNumber),labelYearDropdown:wn(sk,e==null?void 0:e.labelYearDropdown,r.labelYearDropdown),labelGrid:wn(Sx,e==null?void 0:e.labelGrid,r.labelGrid),labelGridcell:wn(QN,e==null?void 0:e.labelGridcell,r.labelGridcell),labelNav:wn(JN,e==null?void 0:e.labelNav,r.labelNav),labelWeekNumberHeader:wn(ak,e==null?void 0:e.labelWeekNumberHeader,r.labelWeekNumberHeader),labelWeekday:wn(rk,e==null?void 0:e.labelWeekday,r.labelWeekday)}}function DR(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 TR(e,t={},r={}){let n={...t==null?void 0:t[Pe.Day]};return Object.entries(e).filter(([,s])=>s===!0).forEach(([s])=>{n={...n,...r==null?void 0:r[s]}}),n}function IR(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 RR(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 $R(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 gr(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(gr.tz(e)),newDate:(c,d,u)=>new gr(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 gr(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 gr(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 gr(d.getFullYear(),0,1,12,0,0,e);for(;m.getFullYear()<=u.getFullYear();)f.push(new gr(m,e)),m.setFullYear(m.getFullYear()+1,0,1);return f},getWeek:(c,d)=>{var f;const u=o(c);return gx(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 xx(d)},differenceInCalendarDays:(c,d)=>{const u=o(c),f=o(d);return Xu(u,f)},differenceInCalendarMonths:(c,d)=>{const u=o(c),f=o(d);return hx(u,f)}}}const uc=e=>e instanceof HTMLElement?e:null,_m=e=>[...e.querySelectorAll("[data-animated-month]")??[]],zR=e=>uc(e.querySelector("[data-animated-month]")),Mm=e=>uc(e.querySelector("[data-animated-caption]")),Pm=e=>uc(e.querySelector("[data-animated-weeks]")),LR=e=>uc(e.querySelector("[data-animated-nav]")),FR=e=>uc(e.querySelector("[data-animated-weekdays]"));function BR(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[Zr.caption_after_enter]:r[Zr.caption_before_enter],p=f?r[Zr.weeks_after_enter]:r[Zr.weeks_before_enter],x=o.current,g=e.current.cloneNode(!0);if(g instanceof HTMLElement?(_m(g).forEach(N=>{if(!(N instanceof HTMLElement))return;const w=zR(N);w&&N.contains(w)&&N.removeChild(w);const k=Mm(N);k&&k.classList.remove(m);const b=Pm(N);b&&b.classList.remove(p)}),o.current=g):o.current=null,c.current||u||s)return;const v=x instanceof HTMLElement?_m(x):[],y=_m(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=LR(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=Mm(N);b&&b.classList.add(m);const S=Pm(N);S&&S.classList.add(p);const C=()=>{c.current=!1,e.current&&(e.current.style.isolation=""),j&&(j.style.zIndex=""),b&&b.classList.remove(m),S&&S.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 _=FR(k);_&&(_.style.opacity="0");const M=Mm(k);M&&(M.classList.add(f?r[Zr.caption_before_exit]:r[Zr.caption_after_exit]),M.addEventListener("animationend",C));const D=Pm(k);D&&D.classList.add(f?r[Zr.weeks_before_exit]:r[Zr.weeks_after_exit]),N.insertBefore(k,N.firstChild)})}})}function WR(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)),S=b&&v(k,b)?b:k,C=u(S,w),_=f(i,s)+1,M=[];for(let T=0;T<=C;T++){const $=d(w,T);M.push($)}const A=(c?35:42)*_;if(l&&M.length<A){const T=A-M.length;for(let $=0;$<T;$++){const Z=d(M[M.length-1],1);M.push(Z)}}return M}function UR(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 qR(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 py(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 HR(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(S=>S>=y&&S<=j),w=r.broadcastCalendar?35:42;if(r.fixedWeeks&&N.length<w){const S=t.filter(C=>{const _=w-N.length;return C>j&&C<=s(j,_)});N.push(...S)}const k=N.reduce((S,C)=>{const _=r.ISOWeek?d(C):u(C),M=S.find(A=>A.weekNumber===_),D=new HN(C,v,n);return M?M.days.push(D):S.push(new F4(_,[D])),S},[]),b=new L4(v,k);return g.push(b),g},[]);return r.reverseMonths?x.reverse():x}function KR(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 YR(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 GR(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 VR(e){const t=[];return e.reduce((r,n)=>r.concat(n.weeks.slice()),t.slice())}function ef(e,t){const[r,n]=h.useState(e);return[t===void 0?r:t,n]}function XR(e,t){var w;const[r,n]=KR(e,t),{startOfMonth:s,endOfMonth:i}=t,o=py(e,r,n,t),[l,c]=ef(o,e.month?o:void 0);h.useEffect(()=>{const k=py(e,r,n,t);c(k)},[e.timeZone]);const{months:d,weeks:u,days:f,previousMonth:m,nextMonth:p}=h.useMemo(()=>{const k=qR(l,n,{numberOfMonths:e.numberOfMonths},t),b=WR(k,e.endMonth?i(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),S=HR(k,b,{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t),C=VR(S),_=UR(S),M=GR(l,r,e,t),D=YR(l,n,e,t);return{months:S,weeks:C,days:_,previousMonth:M,nextMonth:D}},[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(S=>S.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 Kn;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(Kn||(Kn={}));function xy(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);xy(l)&&(l[jt.focused]&&i<Kn.FocusedModifier?(s=o,i=Kn.FocusedModifier):n!=null&&n.isEqualTo(o)&&i<Kn.LastFocused?(s=o,i=Kn.LastFocused):r(o.date)&&i<Kn.Selected?(s=o,i=Kn.Selected):l[jt.today]&&i<Kn.Today&&(s=o,i=Kn.Today))}return s||(s=e.find(o=>xy(t(o)))),s}function ZR(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:S=>c?j(S,o):l?N(S):w(S),endOfWeek:S=>c?p(S):l?x(S):g(S)}[e](r,t==="after"?1:-1);return t==="before"&&n?b=v([n,b]):t==="after"&&s&&(b=y([s,b])),b}function ik(e,t,r,n,s,i,o,l=0){if(l>365)return;const c=ZR(e,t,r.date,n,s,i,o),d=!!(i.disabled&&ka(c,i.disabled,o)),u=!!(i.hidden&&ka(c,i.hidden,o)),f=c,m=new HN(c,f,o);return!d&&!u?m:ik(e,t,m,n,s,i,o,l+1)}function JR(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=ik(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 e$(e,t){const{selected:r,required:n,onSelect:s}=e,[i,o]=ef(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 t$(e,t,r=0,n=0,s=!1,i=ma){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 r$(e,t,r=ma){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 gy(e,t,r=ma){return Na(e,t.from,!1,r)||Na(e,t.to,!1,r)||Na(t,e.from,!1,r)||Na(t,e.to,!1,r)}function n$(e,t,r=ma){const n=Array.isArray(t)?t:[t];if(n.filter(l=>typeof l!="function").some(l=>typeof l=="boolean"?l:r.isDate(l)?Na(e,l,!1,r):GN(l,r)?l.some(c=>Na(e,c,!1,r)):Ju(l)?l.from&&l.to?gy(e,{from:l.from,to:l.to},r):!1:YN(l)?r$(e,l.dayOfWeek,r):wx(l)?r.isAfter(l.before,l.after)?gy(e,{from:r.addDays(l.after,1),to:r.addDays(l.before,-1)},r):ka(e.from,l,r)||ka(e.to,l,r):jx(l)||Nx(l)?ka(e.from,l,r)||ka(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 a$(e,t){const{disabled:r,excludeDisabled:n,selected:s,required:i,onSelect:o}=e,[l,c]=ef(s,o?s:void 0),d=o?s:l;return{selected:d,select:(m,p,x)=>{const{min:g,max:v}=e,y=m?t$(m,d,g,v,i,t):void 0;return n&&r&&(y!=null&&y.from)&&y.to&&n$({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&&Na(d,m,!1,t)}}function s$(e,t){const{selected:r,required:n,onSelect:s}=e,[i,o]=ef(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 i$(e,t){const r=s$(e,t),n=e$(e,t),s=a$(e,t);switch(e.mode){case"single":return r;case"multiple":return n;case"range":return s;default:return}}function un(e,t){return e instanceof gr&&e.timeZone===t?e:new gr(e,t)}function Ti(e,t,r){return un(e,t)}function vy(e,t,r){return typeof e=="boolean"||typeof e=="function"?e:e instanceof Date?Ti(e,t):Array.isArray(e)?e.map(n=>n instanceof Date?Ti(n,t):n):Ju(e)?{...e,from:e.from?un(e.from,t):e.from,to:e.to?un(e.to,t):e.to}:wx(e)?{before:Ti(e.before,t),after:Ti(e.after,t)}:jx(e)?{after:Ti(e.after,t)}:Nx(e)?{before:Ti(e.before,t)}:e}function Om(e,t,r){return e&&(Array.isArray(e)?e.map(n=>vy(n,t)):vy(e,t))}function o$(e){var Oe;let t=e;const r=t.timeZone;if(r&&(t={...e,timeZone:r},t.today&&(t.today=un(t.today,r)),t.month&&(t.month=un(t.month,r)),t.defaultMonth&&(t.defaultMonth=un(t.defaultMonth,r)),t.startMonth&&(t.startMonth=un(t.startMonth,r)),t.endMonth&&(t.endMonth=un(t.endMonth,r)),t.mode==="single"&&t.selected?t.selected=un(t.selected,r):t.mode==="multiple"&&t.selected?t.selected=(Oe=t.selected)==null?void 0:Oe.map(xe=>un(xe,r)):t.mode==="range"&&t.selected&&(t.selected={from:t.selected.from?un(t.selected.from,r):t.selected.from,to:t.selected.to?un(t.selected.to,r):t.selected.to}),t.disabled!==void 0&&(t.disabled=Om(t.disabled,r)),t.hidden!==void 0&&(t.hidden=Om(t.hidden,r)),t.modifiers)){const xe={};Object.keys(t.modifiers).forEach(je=>{var he;xe[je]=Om((he=t.modifiers)==null?void 0:he[je],r)}),t.modifiers=xe}const{components:n,formatters:s,labels:i,dateLib:o,locale:l,classNames:c}=h.useMemo(()=>{const xe={...qN,...t.locale},je=t.broadcastCalendar?1:t.weekStartsOn,he=t.noonSafe&&t.timeZone?$R(t.timeZone,{weekStartsOn:je,locale:xe}):void 0,be=t.dateLib&&he?{...he,...t.dateLib}:t.dateLib??he,Ve=new an({locale:xe,weekStartsOn:je,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},be);return{dateLib:Ve,components:xR(t.components),formatters:_R(t.formatters),labels:AR(t.labels,Ve.options),locale:xe,classNames:{...vR(),...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:S,formatDay:C,formatMonthDropdown:_,formatWeekNumber:M,formatWeekNumberHeader:D,formatWeekdayName:A,formatYearDropdown:T}=s,$=XR(t,o),{days:Z,months:H,navStart:Q,navEnd:ne,previousMonth:J,nextMonth:O,goToMonth:E}=$,L=hR(Z,t,Q,ne,o),{isSelected:K,select:R,selected:Y}=i$(t,o)??{},{blur:P,focused:I,isFocusTarget:te,moveFocus:F,setFocused:X}=JR(t,$,L,K??(()=>!1),o),{labelDayButton:W,labelGridcell:G,labelGrid:se,labelMonthDropdown:V,labelNav:ie,labelPrevious:pe,labelNext:ue,labelWeekday:ve,labelWeekNumber:ee,labelWeekNumberHeader:ge,labelYearDropdown:De}=i,We=h.useMemo(()=>IR(o,t.ISOWeek,t.broadcastCalendar,t.today),[o,t.ISOWeek,t.broadcastCalendar,t.today]),ze=u!==void 0||x!==void 0,Ge=h.useCallback(()=>{J&&(E(J),w==null||w(J))},[J,E,w]),ut=h.useCallback(()=>{O&&(E(O),N==null||N(O))},[E,O,N]),He=h.useCallback((xe,je)=>he=>{he.preventDefault(),he.stopPropagation(),X(xe),!je.disabled&&(R==null||R(xe.date,je,he),x==null||x(xe.date,je,he))},[R,x,X]),Ze=h.useCallback((xe,je)=>he=>{X(xe),g==null||g(xe.date,je,he)},[g,X]),rr=h.useCallback((xe,je)=>he=>{P(),p==null||p(xe.date,je,he)},[P,p]),$r=h.useCallback((xe,je)=>he=>{const be={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(be[he.key]){he.preventDefault(),he.stopPropagation();const[Ve,de]=be[he.key];F(Ve,de)}v==null||v(xe.date,je,he)},[F,v,t.dir]),nr=h.useCallback((xe,je)=>he=>{y==null||y(xe.date,je,he)},[y]),br=h.useCallback((xe,je)=>he=>{j==null||j(xe.date,je,he)},[j]),ar=h.useCallback(xe=>je=>{const he=Number(je.target.value),be=o.setMonth(o.startOfMonth(xe),he);E(be)},[o,E]),yt=h.useCallback(xe=>je=>{const he=Number(je.target.value),be=o.setYear(o.startOfMonth(xe),he);E(be)},[o,E]),{className:Lt,style:Kt}=h.useMemo(()=>({className:[c[Pe.Root],t.className].filter(Boolean).join(" "),style:{...b==null?void 0:b[Pe.Root],...t.style}}),[c,t.className,t.style,b]),sr=gR(t),zn=h.useRef(null);BR(zn,!!t.animate,{classNames:c,months:H,focused:I,dateLib:o});const ha={dayPickerProps:t,selected:Y,select:R,isSelected:K,months:H,nextMonth:O,previousMonth:J,goToMonth:E,getModifiers:L,components:n,classNames:c,styles:b,labels:i,formatters:s};return B.createElement(KN.Provider,{value:ha},B.createElement(n.Root,{rootRef:t.animate?zn: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"],...sr},B.createElement(n.Months,{className:c[Pe.Months],style:b==null?void 0:b[Pe.Months]},!t.hideNavigation&&!f&&B.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:c[Pe.Nav],style:b==null?void 0:b[Pe.Nav],"aria-label":ie(),onPreviousClick:Ge,onNextClick:ut,previousMonth:J,nextMonth:O}),H.map((xe,je)=>B.createElement(n.Month,{"data-animated-month":t.animate?"true":void 0,className:c[Pe.Month],style:b==null?void 0:b[Pe.Month],key:je,displayIndex:je,calendarMonth:xe},f==="around"&&!t.hideNavigation&&je===0&&B.createElement(n.PreviousMonthButton,{type:"button",className:c[Pe.PreviousMonthButton],tabIndex:J?void 0:-1,"aria-disabled":J?void 0:!0,"aria-label":pe(J),onClick:Ge,"data-animated-button":t.animate?"true":void 0},B.createElement(n.Chevron,{disabled:J?void 0:!0,className:c[Pe.Chevron],orientation:t.dir==="rtl"?"right":"left"})),B.createElement(n.MonthCaption,{"data-animated-caption":t.animate?"true":void 0,className:c[Pe.MonthCaption],style:b==null?void 0:b[Pe.MonthCaption],calendarMonth:xe,displayIndex:je},d!=null&&d.startsWith("dropdown")?B.createElement(n.DropdownNav,{className:c[Pe.Dropdowns],style:b==null?void 0:b[Pe.Dropdowns]},(()=>{const he=d==="dropdown"||d==="dropdown-months"?B.createElement(n.MonthsDropdown,{key:"month",className:c[Pe.MonthsDropdown],"aria-label":V(),classNames:c,components:n,disabled:!!t.disableNavigation,onChange:ar(xe.date),options:DR(xe.date,Q,ne,s,o),style:b==null?void 0:b[Pe.Dropdown],value:o.getMonth(xe.date)}):B.createElement("span",{key:"month"},_(xe.date,o)),be=d==="dropdown"||d==="dropdown-years"?B.createElement(n.YearsDropdown,{key:"year",className:c[Pe.YearsDropdown],"aria-label":De(o.options),classNames:c,components:n,disabled:!!t.disableNavigation,onChange:yt(xe.date),options:RR(Q,ne,s,o,!!t.reverseYears),style:b==null?void 0:b[Pe.Dropdown],value:o.getYear(xe.date)}):B.createElement("span",{key:"year"},T(xe.date,o));return o.getMonthYearOrder()==="year-first"?[be,he]:[he,be]})(),B.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"}},S(xe.date,o.options,o))):B.createElement(n.CaptionLabel,{className:c[Pe.CaptionLabel],role:"status","aria-live":"polite"},S(xe.date,o.options,o))),f==="around"&&!t.hideNavigation&&je===m-1&&B.createElement(n.NextMonthButton,{type:"button",className:c[Pe.NextMonthButton],tabIndex:O?void 0:-1,"aria-disabled":O?void 0:!0,"aria-label":ue(O),onClick:ut,"data-animated-button":t.animate?"true":void 0},B.createElement(n.Chevron,{disabled:O?void 0:!0,className:c[Pe.Chevron],orientation:t.dir==="rtl"?"left":"right"})),je===m-1&&f==="after"&&!t.hideNavigation&&B.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:c[Pe.Nav],style:b==null?void 0:b[Pe.Nav],"aria-label":ie(),onPreviousClick:Ge,onNextClick:ut,previousMonth:J,nextMonth:O}),B.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":u==="multiple"||u==="range","aria-label":se(xe.date,o.options,o)||void 0,className:c[Pe.MonthGrid],style:b==null?void 0:b[Pe.MonthGrid]},!t.hideWeekdays&&B.createElement(n.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:c[Pe.Weekdays],style:b==null?void 0:b[Pe.Weekdays]},k&&B.createElement(n.WeekNumberHeader,{"aria-label":ge(o.options),className:c[Pe.WeekNumberHeader],style:b==null?void 0:b[Pe.WeekNumberHeader],scope:"col"},D()),We.map(he=>B.createElement(n.Weekday,{"aria-label":ve(he,o.options,o),className:c[Pe.Weekday],key:String(he),style:b==null?void 0:b[Pe.Weekday],scope:"col"},A(he,o.options,o)))),B.createElement(n.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:c[Pe.Weeks],style:b==null?void 0:b[Pe.Weeks]},xe.weeks.map(he=>B.createElement(n.Week,{className:c[Pe.Week],key:he.weekNumber,style:b==null?void 0:b[Pe.Week],week:he},k&&B.createElement(n.WeekNumber,{week:he,style:b==null?void 0:b[Pe.WeekNumber],"aria-label":ee(he.weekNumber,{locale:l}),className:c[Pe.WeekNumber],scope:"row",role:"rowheader"},M(he.weekNumber,o)),he.days.map(be=>{const{date:Ve}=be,de=L(be);if(de[jt.focused]=!de.hidden&&!!(I!=null&&I.isEqualTo(be)),de[_n.selected]=(K==null?void 0:K(Ve))||de.selected,Ju(Y)){const{from:rt,to:nt}=Y;de[_n.range_start]=!!(rt&&nt&&o.isSameDay(Ve,rt)),de[_n.range_end]=!!(rt&&nt&&o.isSameDay(Ve,nt)),de[_n.range_middle]=Na(Y,Ve,!0,o)}const _e=TR(de,b,t.modifiersStyles),Ie=pR(de,c,t.modifiersClassNames),bt=!ze&&!de.hidden?G(Ve,de,o.options,o):void 0;return B.createElement(n.Day,{key:`${be.isoDate}_${be.displayMonthId}`,day:be,modifiers:de,className:Ie.join(" "),style:_e,role:"gridcell","aria-selected":de.selected||void 0,"aria-label":bt,"data-day":be.isoDate,"data-month":be.outside?be.dateMonthId:void 0,"data-selected":de.selected||void 0,"data-disabled":de.disabled||void 0,"data-hidden":de.hidden||void 0,"data-outside":be.outside||void 0,"data-focused":de.focused||void 0,"data-today":de.today||void 0},!de.hidden&&ze?B.createElement(n.DayButton,{className:c[Pe.DayButton],style:b==null?void 0:b[Pe.DayButton],type:"button",day:be,modifiers:de,disabled:!de.focused&&de.disabled||void 0,"aria-disabled":de.focused&&de.disabled||void 0,tabIndex:te(be)?0:-1,"aria-label":W(Ve,de,o.options,o),onClick:He(be,de),onBlur:rr(be,de),onFocus:Ze(be,de),onKeyDown:$r(be,de),onMouseEnter:nr(be,de),onMouseLeave:br(be,de)},C(Ve,o.options,o)):!de.hidden&&C(be.date,o.options,o))})))))))),t.footer&&B.createElement(n.Footer,{className:c[Pe.Footer],style:b==null?void 0:b[Pe.Footer],role:"status","aria-live":"polite"},t.footer)))}function yr({className:e,classNames:t,showOutsideDays:r=!0,...n}){return a.jsx(o$,{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(Ki({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(Ki({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(Ki({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(ra,{className:"h-4 w-4"}):a.jsx(hr,{className:"h-4 w-4"})},...n})}yr.displayName="Calendar";function l$(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,c$(s,...t)]}function c$(...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 d$(e){const t=u$(e),r=h.forwardRef((n,s)=>{const{children:i,...o}=n,l=h.Children.toArray(i),c=l.find(m$);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 u$(e){const t=h.forwardRef((r,n)=>{const{children:s,...i}=r;if(h.isValidElement(s)){const o=p$(s),l=h$(i,s.props);return s.type!==h.Fragment&&(l.ref=n?Yj(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 f$=Symbol("radix.slottable");function m$(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===f$}function h$(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 p$(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 x$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ok=x$.reduce((e,t)=>{const r=d$(`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}},{}),tf="Switch",[g$]=l$(tf),[v$,y$]=g$(tf),lk=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=Ou(t,N=>p(N)),g=h.useRef(!1),v=m?u||!!m.closest("form"):!0,[y,j]=WO({prop:s,defaultProp:i??!1,onChange:d,caller:tf});return a.jsxs(v$,{scope:r,checked:y,disabled:l,children:[a.jsx(ok.button,{type:"button",role:"switch","aria-checked":y,"aria-required":o,"data-state":fk(y),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:x,onClick:Ws(e.onClick,N=>{j(w=>!w),v&&(g.current=N.isPropagationStopped(),g.current||N.stopPropagation())})}),v&&a.jsx(uk,{control:m,bubbles:!g.current,name:n,value:c,checked:y,required:o,disabled:l,form:u,style:{transform:"translateX(-100%)"}})]})});lk.displayName=tf;var ck="SwitchThumb",dk=h.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,s=y$(ck,r);return a.jsx(ok.span,{"data-state":fk(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:t})});dk.displayName=ck;var b$="SwitchBubbleInput",uk=h.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...s},i)=>{const o=h.useRef(null),l=Ou(o,i),c=UO(r),d=qO(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}})});uk.displayName=b$;function fk(e){return e?"checked":"unchecked"}var mk=lk,w$=dk;const Po=h.forwardRef(({className:e,...t},r)=>a.jsx(mk,{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(w$,{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")})}));Po.displayName=mk.displayName;function j$(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 rf({open:e,onClose:t,projectId:r,defaultStatus:n="backlog",defaultTaskListId:s,defaultParentId:i}){const o=pt(),{workspace:l,projectKey:c}=zt(),{workspace:d}=Te(),[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,S]=h.useState(""),[C,_]=h.useState(s??""),[M,D]=h.useState(void 0),[A,T]=h.useState(void 0),[$,Z]=h.useState(!1),[H,Q]=h.useState("weekly"),[ne,J]=h.useState(void 0),O=j1(),{data:E}=da(r),L=h.useMemo(()=>E?E.members.filter(X=>X.user).map(X=>X.user):void 0,[E]),{data:K}=_o(r),{data:R}=Mo(r||void 0),{data:Y}=lc(r||void 0),P=(R??[]).filter(X=>X.status!=="completed"),I=K&&K.length>0?Object.fromEntries(K.map(X=>[X.key,X.name])):ui,te=()=>{f(""),p(""),g(n),y("medium"),N("task"),k([]),S(""),_(s??""),D(void 0),T(void 0),Z(!1),Q("weekly"),J(void 0),t()},F=X=>{X.preventDefault(),u.trim()&&O.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:C||null,parent_id:i||null,start_date:M?fe(M,"yyyy-MM-dd"):null,due_date:A?fe(A,"yyyy-MM-dd"):null,recurrence_frequency:$?H:void 0,recurrence_end_date:$&&ne?fe(ne,"yyyy-MM-dd"):void 0},{onSuccess:()=>{U.success("Issue created"),te()},onError:W=>U.error(W.message??"Failed to create issue")})};return a.jsx(Si,{open:e,onOpenChange:X=>!X&&te(),children:a.jsxs(Ci,{className:"max-w-md",children:[a.jsx(No,{children:a.jsx(So,{children:"New issue"})}),a.jsxs("form",{onSubmit:F,className:"flex flex-col flex-1 overflow-hidden",children:[a.jsxs(ko,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{htmlFor:"issue-title",children:"Title"}),a.jsx(Me,{id:"issue-title",placeholder:"Issue title",value:u,onChange:X=>f(X.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(Vu,{id:"issue-desc",placeholder:"Add more context...",value:m,onChange:X=>p(X.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(Ue,{value:x,onValueChange:g,children:[a.jsx(Fe,{className:"h-8 text-xs",children:a.jsx(Xe,{})}),a.jsx(Be,{children:Object.entries(I).map(([X,W])=>a.jsx(ke,{value:X,className:"text-xs",children:W},X))})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{children:"Priority"}),a.jsxs(Ue,{value:v,onValueChange:y,children:[a.jsx(Fe,{className:"h-8 text-xs",children:a.jsx(Xe,{})}),a.jsx(Be,{children:Object.entries(nn).map(([X,W])=>a.jsx(ke,{value:X,className:"text-xs",children:W},X))})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{children:"Type"}),a.jsxs(Ue,{value:j,onValueChange:N,children:[a.jsx(Fe,{className:"h-8 text-xs",children:a.jsx(Xe,{})}),a.jsx(Be,{children:Object.entries(Aa).map(([X,W])=>a.jsx(ke,{value:X,className:"text-xs",children:W},X))})]})]})]}),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"}),(Y??[]).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(Ue,{value:C||"none",onValueChange:X=>_(X==="none"?"":X),children:[a.jsx(Fe,{className:"h-8 text-xs",children:a.jsx(Xe,{placeholder:"No list"})}),a.jsxs(Be,{children:[a.jsx(ke,{value:"none",className:"text-xs",children:a.jsx("span",{className:"text-muted-foreground",children:"No list"})}),(Y??[]).map(X=>a.jsx(ke,{value:X.id,className:"text-xs",children:X.name},X.id))]})]})]}),P.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(Ue,{value:b||"none",onValueChange:X=>S(X==="none"?"":X),children:[a.jsx(Fe,{className:"h-8 text-xs",children:a.jsx(Xe,{placeholder:"No sprint"})}),a.jsxs(Be,{children:[a.jsx(ke,{value:"none",className:"text-xs",children:a.jsx("span",{className:"text-muted-foreground",children:"No sprint"})}),P.map(X=>{const W=j$(X);return a.jsx(ke,{value:X.id,className:"text-xs",children:a.jsxs("div",{children:[a.jsx("span",{children:X.name}),W&&a.jsx("span",{className:"block text-[10px] text-muted-foreground leading-tight",children:W})]})},X.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(cc,{value:w,onChange:k,users:L})]}),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(Pt,{children:[a.jsx(Ot,{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:M?"text-foreground":"text-muted-foreground",children:M?fe(M,"MMM d, yyyy"):"No start date"}),M&&a.jsx("button",{type:"button",onClick:X=>{X.stopPropagation(),D(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:a.jsx(Je,{className:"h-3.5 w-3.5"})})]})}),a.jsx(_t,{className:"w-auto p-0",align:"start",children:a.jsx(yr,{mode:"single",selected:M,onSelect:D,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(Pt,{children:[a.jsx(Ot,{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:A?"text-foreground":"text-muted-foreground",children:A?fe(A,"MMM d, yyyy"):"No due date"}),A&&a.jsx("button",{type:"button",onClick:X=>{X.stopPropagation(),T(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:a.jsx(Je,{className:"h-3.5 w-3.5"})})]})}),a.jsx(_t,{className:"w-auto p-0",align:"start",children:a.jsx(yr,{mode:"single",selected:A,onSelect:T,initialFocus:!0})})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Po,{id:"recurring",checked:$,onCheckedChange:Z}),a.jsxs(mt,{htmlFor:"recurring",className:"cursor-pointer font-normal flex items-center gap-1.5",children:[a.jsx(Qi,{className:"h-3.5 w-3.5 text-muted-foreground"}),"Recurring"]})]}),$&&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(Ue,{value:H,onValueChange:X=>Q(X),children:[a.jsx(Fe,{className:"h-8 text-xs",children:a.jsx(Xe,{})}),a.jsxs(Be,{children:[a.jsx(ke,{value:"weekly",className:"text-xs",children:"Weekly"}),a.jsx(ke,{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(Pt,{children:[a.jsx(Ot,{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:ne?"text-foreground":"text-muted-foreground",children:ne?fe(ne,"MMM d, yyyy"):"No end date"}),ne&&a.jsx("button",{type:"button",onClick:X=>{X.stopPropagation(),J(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:a.jsx(Je,{className:"h-3.5 w-3.5"})})]})}),a.jsx(_t,{className:"w-auto p-0",align:"start",children:a.jsx(yr,{mode:"single",selected:ne,onSelect:J,initialFocus:!0})})]})]})]})})]})]}),a.jsxs(sc,{className:"flex-col-reverse sm:flex-row sm:items-center sm:justify-between gap-2",children:[a.jsxs(ae,{type:"button",variant:"ghost",size:"sm",className:"text-muted-foreground gap-1.5 justify-start sm:justify-center",onClick:()=>{te(),o(`/${l}/projects/${c}/issues/new`)},children:[a.jsx(Qp,{className:"h-3.5 w-3.5"}),"Open full form"]}),a.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[a.jsx(ae,{type:"button",variant:"ghost",onClick:te,children:"Cancel"}),a.jsx(ae,{type:"submit",disabled:!u.trim()||O.isPending,children:O.isPending?"Creating...":"Create issue"})]})]})]})]})})}const Cx={byIssue:e=>["attachments",e]};function hk(e){return $e({queryKey:Cx.byIssue(e),queryFn:()=>oe.get(`/admin/issues/${e}/attachments`),select:t=>t.attachments,enabled:!!e})}function pk(e){const t=Ne();return ye({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:Cx.byIssue(e)})}})}function N$(e){const t=Ne();return ye({mutationFn:r=>oe.delete(`/admin/issues/${e}/attachments/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:Cx.byIssue(e)})}})}function Sl(e){return e.startsWith("image/")}function nf(e){return e.startsWith("video/")}function af(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Cd(e){if(e.startsWith("/"))return!0;try{const{protocol:t}=new URL(e);return t==="http:"||t==="https:"}catch{return!1}}function _x(e,t){if(!Cd(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 Mx({mimeType:e,className:t}){return Sl(e)?a.jsx(d5,{className:t}):nf(e)?a.jsx(wl,{className:t}):e.startsWith("text/")||e.includes("json")?a.jsx(c5,{className:t}):e.includes("zip")||e.includes("tar")||e.includes("gz")?a.jsx(l5,{className:t}):e.includes("pdf")||e.includes("word")||e.includes("document")?a.jsx(u5,{className:t}):a.jsx(f5,{className:t})}function xk({attachment:e,onClose:t}){return e?a.jsx(Si,{open:!0,onOpenChange:r=>!r&&t(),children:a.jsxs(Ci,{className:"max-w-2xl w-full p-0 overflow-hidden",children:[a.jsxs(No,{className:"flex-row items-center justify-between px-4 py-3 border-b border-border shrink-0 pr-10",children:[a.jsx(So,{className:"text-sm font-medium truncate",children:e.original_name}),a.jsxs(ae,{variant:"ghost",size:"sm",className:"h-7 text-xs gap-1.5 shrink-0",onClick:()=>_x(e.url,e.original_name),children:[a.jsx(Xp,{className:"h-3.5 w-3.5"}),"Download"]})]}),a.jsxs(ko,{className:"flex items-center justify-center bg-black/5 dark:bg-black/30 min-h-[320px] max-h-[75vh] overflow-auto p-0",children:[Sl(e.mime_type)&&Cd(e.url)&&a.jsx("img",{src:e.url,alt:e.original_name,className:"max-w-full max-h-[75vh] object-contain"}),nf(e.mime_type)&&Cd(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:af(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 k$({attachment:e}){const[t,r]=h.useState(null),n=Sl(e.mime_type)||nf(e.mime_type),s=()=>{n?r(e):_x(e.url,e.original_name)};return a.jsxs(a.Fragment,{children:[Sl(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:Cd(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(Mx,{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:af(e.size)}),!n&&a.jsx(Xp,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]}),t&&a.jsx(xk,{attachment:t,onClose:()=>r(null)})]})}function S$({attachment:e,onOpen:t,onDelete:r,isDeleting:n}){const s=Sl(e.mime_type)||nf(e.mime_type),i=()=>{s?t(e):_x(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(Mx,{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:af(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(Xp,{className:"h-2.5 w-2.5"}),"Click to download"]})]})]})]}),a.jsx(ae,{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(Or,{className:"h-3.5 w-3.5"})})]})}function C$({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(T5,{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 _$({issueId:e,className:t}){const[r,n]=h.useState(null),{data:s,isLoading:i}=hk(e),o=pk(e),l=N$(e),c=u=>{u.forEach(f=>{o.mutate({file:f},{onSuccess:()=>U.success(`${f.name} uploaded`),onError:()=>U.error(`Failed to upload ${f.name}`)})})},d=u=>{l.mutate(u,{onSuccess:()=>U.success("Attachment removed"),onError:()=>U.error("Failed to remove attachment")})};return a.jsxs("div",{className:z("px-6 py-4 space-y-4",t),children:[a.jsx(C$,{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(ex,{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(S$,{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(xk,{attachment:r,onClose:()=>n(null)})]})}const M$=Gl("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 An({className:e,variant:t,...r}){return a.jsx("div",{className:z(M$({variant:t}),e),...r})}function P$(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,O$(s,...t)]}function O$(...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}var E$=Symbol("radix.slottable");function A$(e){const t=({children:r})=>a.jsx(a.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=E$,t}var gk="AlertDialog",[D$]=P$(gk,[Gj]),Va=Gj(),vk=e=>{const{__scopeAlertDialog:t,...r}=e,n=Va(t);return a.jsx(Kl,{...n,...r,modal:!0})};vk.displayName=gk;var T$="AlertDialogTrigger",I$=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Va(r);return a.jsx(KO,{...s,...n,ref:t})});I$.displayName=T$;var R$="AlertDialogPortal",yk=e=>{const{__scopeAlertDialog:t,...r}=e,n=Va(t);return a.jsx(Hl,{...n,...r})};yk.displayName=R$;var $$="AlertDialogOverlay",bk=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Va(r);return a.jsx(yi,{...s,...n,ref:t})});bk.displayName=$$;var Yi="AlertDialogContent",[z$,L$]=D$(Yi),F$=A$("AlertDialogContent"),wk=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:n,...s}=e,i=Va(r),o=h.useRef(null),l=Ou(t,o),c=h.useRef(null);return a.jsx(HO,{contentName:Yi,titleName:jk,docsSlug:"alert-dialog",children:a.jsx(z$,{scope:r,cancelRef:c,children:a.jsxs(bi,{role:"alertdialog",...i,...s,ref:l,onOpenAutoFocus:Ws(s.onOpenAutoFocus,d=>{var u;d.preventDefault(),(u=c.current)==null||u.focus({preventScroll:!0})}),onPointerDownOutside:d=>d.preventDefault(),onInteractOutside:d=>d.preventDefault(),children:[a.jsx(F$,{children:n}),a.jsx(W$,{contentRef:o})]})})})});wk.displayName=Yi;var jk="AlertDialogTitle",Nk=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Va(r);return a.jsx(ho,{...s,...n,ref:t})});Nk.displayName=jk;var kk="AlertDialogDescription",Sk=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Va(r);return a.jsx(po,{...s,...n,ref:t})});Sk.displayName=kk;var B$="AlertDialogAction",Ck=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Va(r);return a.jsx(Pu,{...s,...n,ref:t})});Ck.displayName=B$;var _k="AlertDialogCancel",Mk=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,{cancelRef:s}=L$(_k,r),i=Va(r),o=Ou(t,s);return a.jsx(Pu,{...i,...n,ref:o})});Mk.displayName=_k;var W$=({contentRef:e})=>{const t=`\`${Yi}\` requires a description for the component to be accessible for screen reader users.
@@ -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 mO=h.forwardRef(({className:e,containerClassName:t,...r},n)=>a.jsx(fO,{ref:n,containerClassName:z("flex items-center gap-2 has-[:disabled]:opacity-50",t),className:z("disabled:cursor-not-allowed",e),...r}));mO.displayName="InputOTP";const Ip=h.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:z("flex items-center",e),...t}));Ip.displayName="InputOTPGroup";const Bs=h.forwardRef(({index:e,className:t,...r},n)=>{const s=h.useContext(uO),{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"})})]})});Bs.displayName="InputOTPSlot";const hO=h.forwardRef(({...e},t)=>a.jsx("div",{ref:t,role:"separator",...e,children:a.jsx(Ua,{})}));hO.displayName="InputOTPSeparator";function bj({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 vte(){var F,X,W,G;const[e,t]=ql(),{user:r}=Te(),{data:n,isLoading:s}=yP(),i=OZ(),o=EZ(),l=AZ(),c=IZ(),d=DZ(),u=TZ(),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,S]=h.useState(!1),[C,_]=h.useState(""),[M,D]=h.useState(""),[A,T]=h.useState(""),[$,Z]=h.useState(!1),[H,Q]=h.useState(0),ne=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"&&(U.success("Google account connected successfully"),t(se=>(se.delete("linked"),se),{replace:!0}))},[e,t]);const J=r&&(`${((F=r.first_name)==null?void 0:F[0])??""}${((X=r.last_name)==null?void 0:X[0])??""}`.toUpperCase()||((G=(W=r.email)==null?void 0:W[0])==null?void 0:G.toUpperCase()))||"?",O=se=>{var ie;const V=(ie=se.target.files)==null?void 0:ie[0];V&&(o.mutate(V,{onSuccess:()=>U.success("Avatar updated"),onError:pe=>U.error(pe.message??"Failed to upload avatar")}),se.target.value="")},E=()=>{l.mutate(void 0,{onSuccess:()=>U.success("Avatar removed"),onError:se=>U.error(se.message??"Failed to remove avatar")})},L=()=>{i.mutate({first_name:m,last_name:x,designation:v||null,phone_number:j||null},{onSuccess:()=>U.success("Profile updated"),onError:se=>U.error(se.message??"Failed to update profile")})},K=()=>{const se=localStorage.getItem("meridian_token");if(!se){U.error("You must be logged in to connect Google");return}window.location.href=`${Xi}/auth/google/link?token=${encodeURIComponent(se)}`},R=()=>{c.mutate(void 0,{onSuccess:()=>U.success("Google account disconnected"),onError:se=>U.error(se.message??"Failed to unlink Google account")})},Y=h.useCallback(()=>{Q(30),ne.current&&clearInterval(ne.current),ne.current=setInterval(()=>{Q(se=>se<=1?(ne.current&&clearInterval(ne.current),0):se-1)},1e3)},[]);h.useEffect(()=>()=>{ne.current&&clearInterval(ne.current)},[]);const P=()=>{d.mutate(void 0,{onSuccess:()=>{S(!0),Y(),U.success("Verification code sent to your email")},onError:se=>U.error(se.message??"Failed to send verification code")})},I=()=>{if(M.length<8){U.error("New password must be at least 8 characters");return}if(M!==A){U.error("Passwords do not match");return}u.mutate({otp:C,new_password:M},{onSuccess:()=>{U.success("Password updated"),te()},onError:se=>U.error(se.message??"Failed to set password")})},te=()=>{k(!1),S(!1),_(""),D(""),T(""),Z(!1),Q(0),ne.current&&clearInterval(ne.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(Ql,{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(jl,{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(ae,{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(s5,{className:"size-3.5"}),"Change photo"]}),(n==null?void 0:n.avatar_url)&&a.jsxs(ae,{variant:"ghost",size:"sm",className:"h-8 gap-1.5 text-muted-foreground hover:text-destructive",onClick:E,disabled:l.isPending,children:[a.jsx(Or,{className:"size-3.5"}),"Remove"]})]}),a.jsx("input",{ref:f,type:"file",accept:"image/*",className:"hidden",onChange:O})]})]}),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(Me,{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(Me,{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(Me,{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(Me,{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(ae,{size:"sm",onClick:L,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(bj,{className:"size-3.5 shrink-0"}),a.jsx("span",{className:"text-foreground font-medium",children:"Google"}),a.jsx(na,{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(ae,{size:"sm",className:"h-7 gap-1.5 bg-red-600 hover:bg-red-700 text-white shrink-0",onClick:R,disabled:c.isPending,children:[a.jsx(Gp,{className:"size-3.5"}),"Disconnect"]})]})]}):a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(bj,{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(ae,{variant:"outline",size:"sm",className:"h-7 gap-1.5",onClick:K,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(ae,{variant:"outline",size:"sm",className:"h-7 gap-1.5",onClick:()=>k(!0),children:[a.jsx(x5,{className:"size-3.5"}),(n==null?void 0:n.has_password)===!1?"Create password":"Change password"]})]})]}),a.jsx(Ha,{open:w,onOpenChange:se=>{se||te()},children:a.jsxs(ua,{className:"sm:max-w-md",children:[a.jsxs(Ka,{children:[a.jsx(Ya,{children:(n==null?void 0:n.has_password)===!1?"Create password":"Change password"}),a.jsxs(jo,{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(mO,{maxLength:6,value:C,onChange:_,children:[a.jsxs(Ip,{children:[a.jsx(Bs,{index:0}),a.jsx(Bs,{index:1}),a.jsx(Bs,{index:2})]}),a.jsx(hO,{}),a.jsxs(Ip,{children:[a.jsx(Bs,{index:3}),a.jsx(Bs,{index:4}),a.jsx(Bs,{index:5})]})]}),b?H>0?a.jsxs("span",{className:"text-xs text-muted-foreground shrink-0 tabular-nums w-16 text-center",children:["Resend in ",H,"s"]}):a.jsx(ae,{variant:"ghost",size:"sm",className:"h-8 shrink-0 text-indigo-500 hover:text-indigo-600",onClick:P,disabled:d.isPending,children:d.isPending?"Sending…":"Resend"}):a.jsx(ae,{variant:"outline",size:"sm",className:"h-8 shrink-0",onClick:P,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(Me,{type:$?"text":"password",value:M,onChange:se=>D(se.target.value),className:"h-9 text-sm pr-9",placeholder:"At least 8 characters",autoComplete:"new-password"}),a.jsx("button",{type:"button",onClick:()=>Z(!$),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,children:$?a.jsx(Xl,{className:"size-3.5"}):a.jsx(Ni,{className:"size-3.5"})})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(mt,{className:"text-sm",children:"Confirm password"}),a.jsx(Me,{type:"password",value:A,onChange:se=>T(se.target.value),className:"h-9 text-sm",placeholder:"Re-enter new password",autoComplete:"new-password"})]})]}),a.jsxs(ox,{children:[a.jsx(ae,{variant:"ghost",size:"sm",onClick:te,children:"Cancel"}),a.jsx(ae,{size:"sm",onClick:I,disabled:u.isPending||C.length!==6||!M||!A,children:u.isPending?"Saving…":(n==null?void 0:n.has_password)===!1?"Create password":"Update password"})]})]})})]})]})})}function yte(){const[e,t]=h.useState(""),[r,n]=h.useState(!1),s=rD(),i=o=>{o.preventDefault(),s.mutate({email:e},{onSuccess:()=>n(!0),onError:l=>U.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(ae,{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(Me,{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(ae,{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(Mr,{to:"/login",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(Vl,{className:"size-3.5"}),"Back to login"]})})]})})}function bte(){const[e]=ql(),t=e.get("token")??"",r=pt(),n=nD(),[s,i]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState(!1),u=f=>{if(f.preventDefault(),s.length<8){U.error("Password must be at least 8 characters");return}if(s!==o){U.error("Passwords do not match");return}n.mutate({token:t,password:s},{onSuccess:()=>{U.success("Password has been reset. Please sign in."),r("/login",{replace:!0})},onError:m=>U.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(Me,{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(Xl,{className:"h-4 w-4"}):a.jsx(Ni,{className:"h-4 w-4"})})]}),a.jsx(Me,{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(ae,{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(Mr,{to:"/login",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(Vl,{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(Mr,{to:"/forgot-password",children:a.jsx(ae,{variant:"outline",size:"sm",children:"Request a new link"})})]})})}const wte=h.lazy(()=>c1(()=>import("./ProjectTimelinePage-J-5wXOET.js"),__vite__mapDeps([0,1,2,3,4,5])).then(e=>({default:e.ProjectTimelinePage}))),jte=h.lazy(()=>c1(()=>import("./WorkspaceReportingPage-DF5TdtKX.js"),__vite__mapDeps([6,1,2,3,4,5])).then(e=>({default:e.WorkspaceReportingPage})));function Rs({children:e}){const{isAuthenticated:t}=Te();return t?a.jsx(a.Fragment,{children:e}):a.jsx(Qn,{to:"/login",replace:!0})}function Nte({children:e}){var r;const{user:t}=Te();return(r=t==null?void 0:t.roles)!=null&&r.includes("super-admin")?a.jsx(a.Fragment,{children:e}):a.jsx(Qn,{to:"/",replace:!0})}function wj({children:e}){var s,i,o;const{user:t}=Te(),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(Qn,{to:"/",replace:!0})}function dd({children:e}){const{isAuthenticated:t}=Te(),{data:r}=$u(),n=Wl();return t?a.jsx(Qn,{to:"/",replace:!0}):r!=null&&r.needsSetup&&n.pathname==="/login"?a.jsx(Qn,{to:"/register",replace:!0}):r&&!r.needsSetup&&n.pathname==="/register"?a.jsx(Qn,{to:"/login",replace:!0}):a.jsx(a.Fragment,{children:e})}function kte(){const{workspace:e,setWorkspace:t,user:r}=Te(),n=pt(),{data:s,isLoading:i}=yo();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 Ste(){const{workspace:e}=zt(),{workspace:t,setWorkspace:r,user:n}=Te();oD();const s=pt(),{data:i,isLoading:o,isFetching:l}=yo();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(JD,{}),a.jsx($T,{})]})}function Cte(){return a.jsxs(NO,{children:[a.jsx(Ke,{path:"/login",element:a.jsx(dd,{children:a.jsx(LT,{})})}),a.jsx(Ke,{path:"/register",element:a.jsx(dd,{children:a.jsx(FT,{})})}),a.jsx(Ke,{path:"/forgot-password",element:a.jsx(dd,{children:a.jsx(yte,{})})}),a.jsx(Ke,{path:"/reset-password",element:a.jsx(dd,{children:a.jsx(bte,{})})}),a.jsx(Ke,{path:"/invite/:token",element:a.jsx(kz,{})}),a.jsx(Ke,{path:"/oauth/google/callback",element:a.jsx(ate,{})}),a.jsx(Ke,{path:"/share/:token",element:a.jsx(rte,{})}),a.jsx(Ke,{path:"/reporting",element:a.jsx(Rs,{children:a.jsx(wj,{children:a.jsx(sT,{})})}),children:a.jsx(Ke,{index:!0,element:a.jsx(kZ,{})})}),a.jsx(Ke,{path:"/org/settings",element:a.jsx(Rs,{children:a.jsx(wj,{children:a.jsx(lT,{})})}),children:a.jsx(Ke,{index:!0,element:a.jsx(UZ,{})})}),a.jsx(Ke,{path:"/profile",element:a.jsx(Rs,{children:a.jsx(uT,{})}),children:a.jsx(Ke,{index:!0,element:a.jsx(vte,{})})}),a.jsx(Ke,{path:"/setup",element:a.jsx(Rs,{children:a.jsx(BT,{})})}),a.jsx(Ke,{path:"/awaiting-access",element:a.jsx(Rs,{children:a.jsx(WT,{})})}),a.jsx(Ke,{index:!0,element:a.jsx(Rs,{children:a.jsx(kte,{})})}),a.jsxs(Ke,{path:"/:workspace",element:a.jsx(Rs,{children:a.jsx(Ste,{})}),children:[a.jsx(Ke,{index:!0,element:a.jsx(Qn,{to:"projects",replace:!0})}),a.jsx(Ke,{path:"projects",element:a.jsx(GI,{})}),a.jsxs(Ke,{path:"projects/:projectKey",element:a.jsx(rT,{}),children:[a.jsx(Ke,{path:"board",element:a.jsx(D6,{})}),a.jsx(Ke,{path:"issues",element:a.jsx(T6,{})}),a.jsx(Ke,{path:"issues/new",element:a.jsx(Y6,{})}),a.jsx(Ke,{path:"issues/:issueId",element:a.jsx(W6,{})}),a.jsx(Ke,{path:"sprints",element:a.jsx(oz,{})}),a.jsx(Ke,{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(wte,{})})}),a.jsx(Ke,{path:"access",element:a.jsx($6,{})}),a.jsx(Ke,{path:"reports",element:a.jsx(SZ,{})}),a.jsx(Ke,{path:"activity",element:a.jsx(PZ,{})})]}),a.jsx(Ke,{path:"my-tasks",element:a.jsx(tz,{})}),a.jsx(Ke,{path:"notifications",element:a.jsx(nz,{})}),a.jsx(Ke,{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(jte,{})})}),a.jsx(Ke,{path:"settings",element:a.jsx(yz,{})}),a.jsx(Ke,{path:"roles",element:a.jsx(Nte,{children:a.jsx(jz,{})})})]}),a.jsx(Ke,{path:"*",element:a.jsx(Qn,{to:"/",replace:!0})})]})}window.__React=B;window.__ReactJsxRuntime=vO;const _te=new yO({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{}l1(document.getElementById("root")).render(a.jsx(h.StrictMode,{children:a.jsx(QA,{widgets:[...z5,...e],children:a.jsx(xA,{children:a.jsxs(bO,{client:_te,children:[a.jsx(gA,{children:a.jsx(vA,{children:a.jsx(kO,{children:a.jsxs(Eu,{delayDuration:300,children:[a.jsx(Cte,{}),a.jsx(sA,{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(AE,{initialIsOpen:!1})]})})})}))})();export{Te as A,ae as B,rf as C,Xp as D,Gee as G,Hk as I,dt as P,kZ as R,_r as W,c1 as _,Hr as a,qa as b,kh as c,Yl as d,_o as e,fe as f,Mo as g,yx as h,C4 as i,bx as j,Cs as k,Uee as l,mh as m,fh as n,Vee as o,Bee as p,Yee as q,hh as r,TN as s,vj as t,eN as u,sO as v,Xee as w,U as x,Tt as y,oe as z};
630
+ }`;const mO=h.forwardRef(({className:e,containerClassName:t,...r},n)=>a.jsx(fO,{ref:n,containerClassName:z("flex items-center gap-2 has-[:disabled]:opacity-50",t),className:z("disabled:cursor-not-allowed",e),...r}));mO.displayName="InputOTP";const Ip=h.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:z("flex items-center",e),...t}));Ip.displayName="InputOTPGroup";const Bs=h.forwardRef(({index:e,className:t,...r},n)=>{const s=h.useContext(uO),{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"})})]})});Bs.displayName="InputOTPSlot";const hO=h.forwardRef(({...e},t)=>a.jsx("div",{ref:t,role:"separator",...e,children:a.jsx(Ua,{})}));hO.displayName="InputOTPSeparator";function bj({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 vte(){var F,X,W,G;const[e,t]=ql(),{user:r}=Te(),{data:n,isLoading:s}=yP(),i=OZ(),o=EZ(),l=AZ(),c=IZ(),d=DZ(),u=TZ(),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,S]=h.useState(!1),[C,_]=h.useState(""),[M,D]=h.useState(""),[A,T]=h.useState(""),[$,Z]=h.useState(!1),[H,Q]=h.useState(0),ne=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"&&(U.success("Google account connected successfully"),t(se=>(se.delete("linked"),se),{replace:!0}))},[e,t]);const J=r&&(`${((F=r.first_name)==null?void 0:F[0])??""}${((X=r.last_name)==null?void 0:X[0])??""}`.toUpperCase()||((G=(W=r.email)==null?void 0:W[0])==null?void 0:G.toUpperCase()))||"?",O=se=>{var ie;const V=(ie=se.target.files)==null?void 0:ie[0];V&&(o.mutate(V,{onSuccess:()=>U.success("Avatar updated"),onError:pe=>U.error(pe.message??"Failed to upload avatar")}),se.target.value="")},E=()=>{l.mutate(void 0,{onSuccess:()=>U.success("Avatar removed"),onError:se=>U.error(se.message??"Failed to remove avatar")})},L=()=>{i.mutate({first_name:m,last_name:x,designation:v||null,phone_number:j||null},{onSuccess:()=>U.success("Profile updated"),onError:se=>U.error(se.message??"Failed to update profile")})},K=()=>{const se=localStorage.getItem("meridian_token");if(!se){U.error("You must be logged in to connect Google");return}window.location.href=`${Xi}/auth/google/link?token=${encodeURIComponent(se)}`},R=()=>{c.mutate(void 0,{onSuccess:()=>U.success("Google account disconnected"),onError:se=>U.error(se.message??"Failed to unlink Google account")})},Y=h.useCallback(()=>{Q(30),ne.current&&clearInterval(ne.current),ne.current=setInterval(()=>{Q(se=>se<=1?(ne.current&&clearInterval(ne.current),0):se-1)},1e3)},[]);h.useEffect(()=>()=>{ne.current&&clearInterval(ne.current)},[]);const P=()=>{d.mutate(void 0,{onSuccess:()=>{S(!0),Y(),U.success("Verification code sent to your email")},onError:se=>U.error(se.message??"Failed to send verification code")})},I=()=>{if(M.length<8){U.error("New password must be at least 8 characters");return}if(M!==A){U.error("Passwords do not match");return}u.mutate({otp:C,new_password:M},{onSuccess:()=>{U.success("Password updated"),te()},onError:se=>U.error(se.message??"Failed to set password")})},te=()=>{k(!1),S(!1),_(""),D(""),T(""),Z(!1),Q(0),ne.current&&clearInterval(ne.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(Ql,{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(jl,{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(ae,{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(s5,{className:"size-3.5"}),"Change photo"]}),(n==null?void 0:n.avatar_url)&&a.jsxs(ae,{variant:"ghost",size:"sm",className:"h-8 gap-1.5 text-muted-foreground hover:text-destructive",onClick:E,disabled:l.isPending,children:[a.jsx(Or,{className:"size-3.5"}),"Remove"]})]}),a.jsx("input",{ref:f,type:"file",accept:"image/*",className:"hidden",onChange:O})]})]}),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(Me,{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(Me,{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(Me,{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(Me,{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(ae,{size:"sm",onClick:L,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(bj,{className:"size-3.5 shrink-0"}),a.jsx("span",{className:"text-foreground font-medium",children:"Google"}),a.jsx(na,{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(ae,{size:"sm",className:"h-7 gap-1.5 bg-red-600 hover:bg-red-700 text-white shrink-0",onClick:R,disabled:c.isPending,children:[a.jsx(Gp,{className:"size-3.5"}),"Disconnect"]})]})]}):a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(bj,{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(ae,{variant:"outline",size:"sm",className:"h-7 gap-1.5",onClick:K,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(ae,{variant:"outline",size:"sm",className:"h-7 gap-1.5",onClick:()=>k(!0),children:[a.jsx(x5,{className:"size-3.5"}),(n==null?void 0:n.has_password)===!1?"Create password":"Change password"]})]})]}),a.jsx(Ha,{open:w,onOpenChange:se=>{se||te()},children:a.jsxs(ua,{className:"sm:max-w-md",children:[a.jsxs(Ka,{children:[a.jsx(Ya,{children:(n==null?void 0:n.has_password)===!1?"Create password":"Change password"}),a.jsxs(jo,{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(mO,{maxLength:6,value:C,onChange:_,children:[a.jsxs(Ip,{children:[a.jsx(Bs,{index:0}),a.jsx(Bs,{index:1}),a.jsx(Bs,{index:2})]}),a.jsx(hO,{}),a.jsxs(Ip,{children:[a.jsx(Bs,{index:3}),a.jsx(Bs,{index:4}),a.jsx(Bs,{index:5})]})]}),b?H>0?a.jsxs("span",{className:"text-xs text-muted-foreground shrink-0 tabular-nums w-16 text-center",children:["Resend in ",H,"s"]}):a.jsx(ae,{variant:"ghost",size:"sm",className:"h-8 shrink-0 text-indigo-500 hover:text-indigo-600",onClick:P,disabled:d.isPending,children:d.isPending?"Sending…":"Resend"}):a.jsx(ae,{variant:"outline",size:"sm",className:"h-8 shrink-0",onClick:P,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(Me,{type:$?"text":"password",value:M,onChange:se=>D(se.target.value),className:"h-9 text-sm pr-9",placeholder:"At least 8 characters",autoComplete:"new-password"}),a.jsx("button",{type:"button",onClick:()=>Z(!$),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,children:$?a.jsx(Xl,{className:"size-3.5"}):a.jsx(Ni,{className:"size-3.5"})})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(mt,{className:"text-sm",children:"Confirm password"}),a.jsx(Me,{type:"password",value:A,onChange:se=>T(se.target.value),className:"h-9 text-sm",placeholder:"Re-enter new password",autoComplete:"new-password"})]})]}),a.jsxs(ox,{children:[a.jsx(ae,{variant:"ghost",size:"sm",onClick:te,children:"Cancel"}),a.jsx(ae,{size:"sm",onClick:I,disabled:u.isPending||C.length!==6||!M||!A,children:u.isPending?"Saving…":(n==null?void 0:n.has_password)===!1?"Create password":"Update password"})]})]})})]})]})})}function yte(){const[e,t]=h.useState(""),[r,n]=h.useState(!1),s=rD(),i=o=>{o.preventDefault(),s.mutate({email:e},{onSuccess:()=>n(!0),onError:l=>U.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(ae,{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(Me,{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(ae,{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(Mr,{to:"/login",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(Vl,{className:"size-3.5"}),"Back to login"]})})]})})}function bte(){const[e]=ql(),t=e.get("token")??"",r=pt(),n=nD(),[s,i]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState(!1),u=f=>{if(f.preventDefault(),s.length<8){U.error("Password must be at least 8 characters");return}if(s!==o){U.error("Passwords do not match");return}n.mutate({token:t,password:s},{onSuccess:()=>{U.success("Password has been reset. Please sign in."),r("/login",{replace:!0})},onError:m=>U.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(Me,{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(Xl,{className:"h-4 w-4"}):a.jsx(Ni,{className:"h-4 w-4"})})]}),a.jsx(Me,{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(ae,{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(Mr,{to:"/login",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(Vl,{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(Mr,{to:"/forgot-password",children:a.jsx(ae,{variant:"outline",size:"sm",children:"Request a new link"})})]})})}const wte=h.lazy(()=>c1(()=>import("./ProjectTimelinePage-CKfZVEnn.js"),__vite__mapDeps([0,1,2,3,4,5])).then(e=>({default:e.ProjectTimelinePage}))),jte=h.lazy(()=>c1(()=>import("./WorkspaceReportingPage-ByyRyiRS.js"),__vite__mapDeps([6,1,2,3,4,5])).then(e=>({default:e.WorkspaceReportingPage})));function Rs({children:e}){const{isAuthenticated:t}=Te();return t?a.jsx(a.Fragment,{children:e}):a.jsx(Qn,{to:"/login",replace:!0})}function Nte({children:e}){var r;const{user:t}=Te();return(r=t==null?void 0:t.roles)!=null&&r.includes("super-admin")?a.jsx(a.Fragment,{children:e}):a.jsx(Qn,{to:"/",replace:!0})}function wj({children:e}){var s,i,o;const{user:t}=Te(),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(Qn,{to:"/",replace:!0})}function dd({children:e}){const{isAuthenticated:t}=Te(),{data:r}=$u(),n=Wl();return t?a.jsx(Qn,{to:"/",replace:!0}):r!=null&&r.needsSetup&&n.pathname==="/login"?a.jsx(Qn,{to:"/register",replace:!0}):r&&!r.needsSetup&&n.pathname==="/register"?a.jsx(Qn,{to:"/login",replace:!0}):a.jsx(a.Fragment,{children:e})}function kte(){const{workspace:e,setWorkspace:t,user:r}=Te(),n=pt(),{data:s,isLoading:i}=yo();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 Ste(){const{workspace:e}=zt(),{workspace:t,setWorkspace:r,user:n}=Te();oD();const s=pt(),{data:i,isLoading:o,isFetching:l}=yo();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(JD,{}),a.jsx($T,{})]})}function Cte(){return a.jsxs(NO,{children:[a.jsx(Ke,{path:"/login",element:a.jsx(dd,{children:a.jsx(LT,{})})}),a.jsx(Ke,{path:"/register",element:a.jsx(dd,{children:a.jsx(FT,{})})}),a.jsx(Ke,{path:"/forgot-password",element:a.jsx(dd,{children:a.jsx(yte,{})})}),a.jsx(Ke,{path:"/reset-password",element:a.jsx(dd,{children:a.jsx(bte,{})})}),a.jsx(Ke,{path:"/invite/:token",element:a.jsx(kz,{})}),a.jsx(Ke,{path:"/oauth/google/callback",element:a.jsx(ate,{})}),a.jsx(Ke,{path:"/share/:token",element:a.jsx(rte,{})}),a.jsx(Ke,{path:"/reporting",element:a.jsx(Rs,{children:a.jsx(wj,{children:a.jsx(sT,{})})}),children:a.jsx(Ke,{index:!0,element:a.jsx(kZ,{})})}),a.jsx(Ke,{path:"/org/settings",element:a.jsx(Rs,{children:a.jsx(wj,{children:a.jsx(lT,{})})}),children:a.jsx(Ke,{index:!0,element:a.jsx(UZ,{})})}),a.jsx(Ke,{path:"/profile",element:a.jsx(Rs,{children:a.jsx(uT,{})}),children:a.jsx(Ke,{index:!0,element:a.jsx(vte,{})})}),a.jsx(Ke,{path:"/setup",element:a.jsx(Rs,{children:a.jsx(BT,{})})}),a.jsx(Ke,{path:"/awaiting-access",element:a.jsx(Rs,{children:a.jsx(WT,{})})}),a.jsx(Ke,{index:!0,element:a.jsx(Rs,{children:a.jsx(kte,{})})}),a.jsxs(Ke,{path:"/:workspace",element:a.jsx(Rs,{children:a.jsx(Ste,{})}),children:[a.jsx(Ke,{index:!0,element:a.jsx(Qn,{to:"projects",replace:!0})}),a.jsx(Ke,{path:"projects",element:a.jsx(GI,{})}),a.jsxs(Ke,{path:"projects/:projectKey",element:a.jsx(rT,{}),children:[a.jsx(Ke,{path:"board",element:a.jsx(D6,{})}),a.jsx(Ke,{path:"issues",element:a.jsx(T6,{})}),a.jsx(Ke,{path:"issues/new",element:a.jsx(Y6,{})}),a.jsx(Ke,{path:"issues/:issueId",element:a.jsx(W6,{})}),a.jsx(Ke,{path:"sprints",element:a.jsx(oz,{})}),a.jsx(Ke,{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(wte,{})})}),a.jsx(Ke,{path:"access",element:a.jsx($6,{})}),a.jsx(Ke,{path:"reports",element:a.jsx(SZ,{})}),a.jsx(Ke,{path:"activity",element:a.jsx(PZ,{})})]}),a.jsx(Ke,{path:"my-tasks",element:a.jsx(tz,{})}),a.jsx(Ke,{path:"notifications",element:a.jsx(nz,{})}),a.jsx(Ke,{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(jte,{})})}),a.jsx(Ke,{path:"settings",element:a.jsx(yz,{})}),a.jsx(Ke,{path:"roles",element:a.jsx(Nte,{children:a.jsx(jz,{})})})]}),a.jsx(Ke,{path:"*",element:a.jsx(Qn,{to:"/",replace:!0})})]})}window.__React=B;window.__ReactJsxRuntime=vO;const _te=new yO({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{}l1(document.getElementById("root")).render(a.jsx(h.StrictMode,{children:a.jsx(QA,{widgets:[...z5,...e],children:a.jsx(xA,{children:a.jsxs(bO,{client:_te,children:[a.jsx(gA,{children:a.jsx(vA,{children:a.jsx(kO,{children:a.jsxs(Eu,{delayDuration:300,children:[a.jsx(Cte,{}),a.jsx(sA,{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(AE,{initialIsOpen:!1})]})})})}))})();export{Te as A,ae as B,rf as C,Xp as D,Gee as G,Hk as I,dt as P,kZ as R,_r as W,c1 as _,Hr as a,qa as b,kh as c,Yl as d,_o as e,fe as f,Mo as g,yx as h,C4 as i,bx as j,Cs as k,Uee as l,mh as m,fh as n,Vee as o,Bee as p,Yee as q,hh as r,TN as s,vj as t,eN as u,sO as v,Xee as w,U as x,Tt as y,oe as z};