@meridianjs/admin-dashboard 1.9.0 → 1.10.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-DkPzfr3R.js","assets/vendor-query-CaIGp3JB.js","assets/vendor-react-Lycsri1F.js","assets/vendor-radix-CeigSZIw.js","assets/vendor-dnd-DuI-3XLF.js","assets/vendor-editor-BoEtjgAn.js","assets/WorkspaceReportingPage-_2-92Ufq.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProjectTimelinePage-DXUS6oUP.js","assets/vendor-query-CaIGp3JB.js","assets/vendor-react-Lycsri1F.js","assets/vendor-radix-CeigSZIw.js","assets/vendor-dnd-DuI-3XLF.js","assets/vendor-editor-BoEtjgAn.js","assets/WorkspaceReportingPage-6VlVrdNu.js"])))=>i.map(i=>d[i]);
2
2
  var gP=Object.defineProperty;var vP=(e,t,r)=>t in e?gP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var hm=(e,t,r)=>vP(e,typeof t!="symbol"?t+"":t,r);import{j as a,u as Fe,a as Se,b as be,R as yP,Q as bP,c as wP}from"./vendor-query-CaIGp3JB.js";import{a as Bp,c as W,r as h,b as jP,u as zt,d as Kl,N as wn,e as pt,L as qr,O as Yl,f as Gl,h as Xn,g as Fa,R as NP,i as Ic,j as kP,k as Ye,B as SP}from"./vendor-react-Lycsri1F.js";import{C as Aj,R as CP,T as _P,P as MP,S as Wp,a as Dj,O as gi,b as Vl,c as vi,d as Du,e as uo,D as fo,f as Xl,g as Tj,h as Ij,i as OP,j as Rj,I as $j,k as zj,l as Lj,m as Fj,L as Bj,n as Wj,o as PP,p as EP,q as Uj,r as qj,F as Hj,u as Wi,t as Ns,s as AP,v as Kj,w as Yj,x as DP,y as Gj,z as Vj,A as TP,B as Xj,V as IP,E as Qj,G as Zj,H as RP,J as $P,K as Jj,M as zP,N as LP,Q as FP,U as e1,W as BP,X as WP,Y as t1,Z as Tu,_ as UP,$ as Fs,a0 as qP,a1 as HP,a2 as r1,a3 as KP,a4 as YP,a5 as n1,a6 as GP,a7 as VP,a8 as a1,a9 as XP,aa as QP,ab as ZP,ac as JP,ad as eE,ae as tE,af as rE,ag as nE,ah as aE,ai as sE,aj as iE,ak as s1,al as oE,am as lE,an as cE,ao as dE,ap as uE,aq as fE}from"./vendor-radix-CeigSZIw.js";import{u as i1,a as Up,P as o1,D as xl,S as qp,h as l1,b as pd,c as Hp,C as Kp,d as mE,v as hE,r as pE,p as xE,e as gE,f as vE,M as yE,g as c1}from"./vendor-dnd-DuI-3XLF.js";import{P as d1,a as bE,D as wE,b as jE,e as NE,N as kE,c as SE,d as CE,m as Rc,E as _E,u as u1,i as f1,f as m1,g as h1,h as p1,j as ME,k as OE,w as PE}from"./vendor-editor-BoEtjgAn.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(s){if(s.ep)return;s.ep=!0;const i=r(s);fetch(s.href,i)}})();var x1,Lv=Bp;x1=Lv.createRoot,Lv.hydrateRoot;const EE="modulepreload",AE=function(e){return"/"+e},Fv={},g1=function(t,r,n){let s=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(r.map(c=>{if(c=AE(c),c in Fv)return;Fv[c]=!0;const d=c.endsWith(".css"),u=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const f=document.createElement("link");if(f.rel=d?"stylesheet":EE,d||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),d)return new Promise((m,p)=>{f.addEventListener("load",m),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return s.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})};var DE=function(){return null},TE=e=>{switch(e){case"success":return $E;case"info":return LE;case"warning":return zE;case"error":return FE;default:return null}},IE=Array(12).fill(0),RE=({visible:e,className:t})=>W.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},W.createElement("div",{className:"sonner-spinner"},IE.map((r,n)=>W.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),$E=W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},W.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),zE=W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},W.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),LE=W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},W.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),FE=W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},W.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),BE=W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},W.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),W.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),WE=()=>{let[e,t]=W.useState(document.hidden);return W.useEffect(()=>{let r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e},yh=1,UE=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:r,...n}=e,s=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:yh++,i=this.toasts.find(l=>l.id===s),o=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),i?this.toasts=this.toasts.map(l=>l.id===s?(this.publish({...l,...e,id:s,title:r}),{...l,...e,id:s,dismissible:o,title:r}):l):this.addToast({title:r,...n,dismissible:o,id:s}),s},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(r=>r({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let r;t.loading!==void 0&&(r=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let n=e instanceof Promise?e:e(),s=r!==void 0,i,o=n.then(async c=>{if(i=["resolve",c],W.isValidElement(c))s=!1,this.create({id:r,type:"default",message:c});else if(HE(c)&&!c.ok){s=!1;let d=typeof t.error=="function"?await t.error(`HTTP error! status: ${c.status}`):t.error,u=typeof t.description=="function"?await t.description(`HTTP error! status: ${c.status}`):t.description;this.create({id:r,type:"error",message:d,description:u})}else if(t.success!==void 0){s=!1;let d=typeof t.success=="function"?await t.success(c):t.success,u=typeof t.description=="function"?await t.description(c):t.description;this.create({id:r,type:"success",message:d,description:u})}}).catch(async c=>{if(i=["reject",c],t.error!==void 0){s=!1;let d=typeof t.error=="function"?await t.error(c):t.error,u=typeof t.description=="function"?await t.description(c):t.description;this.create({id:r,type:"error",message:d,description:u})}}).finally(()=>{var c;s&&(this.dismiss(r),r=void 0),(c=t.finally)==null||c.call(t)}),l=()=>new Promise((c,d)=>o.then(()=>i[0]==="reject"?d(i[1]):c(i[1])).catch(d));return typeof r!="string"&&typeof r!="number"?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(e,t)=>{let r=(t==null?void 0:t.id)||yh++;return this.create({jsx:e(r),id:r,...t}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Lr=new UE,qE=(e,t)=>{let r=(t==null?void 0:t.id)||yh++;return Lr.addToast({title:e,...t,id:r}),r},HE=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",KE=qE,YE=()=>Lr.toasts,GE=()=>Lr.getActiveToasts(),H=Object.assign(KE,{success:Lr.success,info:Lr.info,warning:Lr.warning,error:Lr.error,custom:Lr.custom,message:Lr.message,promise:Lr.promise,dismiss:Lr.dismiss,loading:Lr.loading},{getHistory:YE,getToasts:GE});function VE(e,{insertAt:t}={}){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t==="top"&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}VE(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
3
3
  `);function $c(e){return e.label!==void 0}var XE=3,QE="32px",ZE="16px",Bv=4e3,JE=356,eA=14,tA=20,rA=200;function yn(...e){return e.filter(Boolean).join(" ")}function nA(e){let[t,r]=e.split("-"),n=[];return t&&n.push(t),r&&n.push(r),n}var aA=e=>{var t,r,n,s,i,o,l,c,d,u,f;let{invert:m,toast:p,unstyled:x,interacting:g,setHeights:v,visibleToasts:y,heights:j,index:N,toasts:w,expanded:k,removeToast:b,defaultRichColors:C,closeButton:_,style:S,cancelButtonStyle:I,actionButtonStyle:A,className:O="",descriptionClassName:L="",duration:F,position:X,gap:T,loadingIcon:G,expandByDefault:re,classNames:J,icons:P,closeButtonAriaLabel:M="Close toast",pauseWhenPageIsHidden:R}=e,[U,$]=W.useState(null),[K,D]=W.useState(null),[E,Z]=W.useState(!1),[B,Y]=W.useState(!1),[ae,ee]=W.useState(!1),[se,V]=W.useState(!1),[ie,pe]=W.useState(!1),[ue,ve]=W.useState(0),[Q,ge]=W.useState(0),De=W.useRef(p.duration||F||Bv),Ue=W.useRef(null),Be=W.useRef(null),Ve=N===0,ut=N+1<=y,Ke=p.type,Ze=p.dismissible!==!1,tr=p.className||"",Ir=p.descriptionClassName||"",rr=W.useMemo(()=>j.findIndex(de=>de.toastId===p.id)||0,[j,p.id]),yr=W.useMemo(()=>{var de;return(de=p.closeButton)!=null?de:_},[p.closeButton,_]),nr=W.useMemo(()=>p.duration||F||Bv,[p.duration,F]),yt=W.useRef(0),Lt=W.useRef(0),Kt=W.useRef(0),ar=W.useRef(null),[$n,fa]=X.split("-"),Oe=W.useMemo(()=>j.reduce((de,_e,Te)=>Te>=rr?de:de+_e.height,0),[j,rr]),xe=WE(),Ne=p.invert||m,he=Ke==="loading";Lt.current=W.useMemo(()=>rr*T+Oe,[rr,Oe]),W.useEffect(()=>{De.current=nr},[nr]),W.useEffect(()=>{Z(!0)},[]),W.useEffect(()=>{let de=Be.current;if(de){let _e=de.getBoundingClientRect().height;return ge(_e),v(Te=>[{toastId:p.id,height:_e,position:p.position},...Te]),()=>v(Te=>Te.filter(bt=>bt.toastId!==p.id))}},[v,p.id]),W.useLayoutEffect(()=>{if(!E)return;let de=Be.current,_e=de.style.height;de.style.height="auto";let Te=de.getBoundingClientRect().height;de.style.height=_e,ge(Te),v(bt=>bt.find(rt=>rt.toastId===p.id)?bt.map(rt=>rt.toastId===p.id?{...rt,height:Te}:rt):[{toastId:p.id,height:Te,position:p.position},...bt])},[E,p.title,p.description,v,p.id]);let ye=W.useCallback(()=>{Y(!0),ve(Lt.current),v(de=>de.filter(_e=>_e.toastId!==p.id)),setTimeout(()=>{b(p)},rA)},[p,b,v,Lt]);W.useEffect(()=>{if(p.promise&&Ke==="loading"||p.duration===1/0||p.type==="loading")return;let de;return k||g||R&&xe?(()=>{if(Kt.current<yt.current){let _e=new Date().getTime()-yt.current;De.current=De.current-_e}Kt.current=new Date().getTime()})():De.current!==1/0&&(yt.current=new Date().getTime(),de=setTimeout(()=>{var _e;(_e=p.onAutoClose)==null||_e.call(p,p),ye()},De.current)),()=>clearTimeout(de)},[k,g,p,Ke,R,xe,ye]),W.useEffect(()=>{p.delete&&ye()},[ye,p.delete]);function Xe(){var de,_e,Te;return P!=null&&P.loading?W.createElement("div",{className:yn(J==null?void 0:J.loader,(de=p==null?void 0:p.classNames)==null?void 0:de.loader,"sonner-loader"),"data-visible":Ke==="loading"},P.loading):G?W.createElement("div",{className:yn(J==null?void 0:J.loader,(_e=p==null?void 0:p.classNames)==null?void 0:_e.loader,"sonner-loader"),"data-visible":Ke==="loading"},G):W.createElement(RE,{className:yn(J==null?void 0:J.loader,(Te=p==null?void 0:p.classNames)==null?void 0:Te.loader),visible:Ke==="loading"})}return W.createElement("li",{tabIndex:0,ref:Be,className:yn(O,tr,J==null?void 0:J.toast,(t=p==null?void 0:p.classNames)==null?void 0:t.toast,J==null?void 0:J.default,J==null?void 0:J[Ke],(r=p==null?void 0:p.classNames)==null?void 0:r[Ke]),"data-sonner-toast":"","data-rich-colors":(n=p.richColors)!=null?n:C,"data-styled":!(p.jsx||p.unstyled||x),"data-mounted":E,"data-promise":!!p.promise,"data-swiped":ie,"data-removed":B,"data-visible":ut,"data-y-position":$n,"data-x-position":fa,"data-index":N,"data-front":Ve,"data-swiping":ae,"data-dismissible":Ze,"data-type":Ke,"data-invert":Ne,"data-swipe-out":se,"data-swipe-direction":K,"data-expanded":!!(k||re&&E),style:{"--index":N,"--toasts-before":N,"--z-index":w.length-N,"--offset":`${B?ue:Lt.current}px`,"--initial-height":re?"auto":`${Q}px`,...S,...p.style},onDragEnd:()=>{ee(!1),$(null),ar.current=null},onPointerDown:de=>{he||!Ze||(Ue.current=new Date,ve(Lt.current),de.target.setPointerCapture(de.pointerId),de.target.tagName!=="BUTTON"&&(ee(!0),ar.current={x:de.clientX,y:de.clientY}))},onPointerUp:()=>{var de,_e,Te,bt;if(se||!Ze)return;ar.current=null;let rt=Number(((de=Be.current)==null?void 0:de.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),nt=Number(((_e=Be.current)==null?void 0:_e.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),br=new Date().getTime()-((Te=Ue.current)==null?void 0:Te.getTime()),sr=U==="x"?rt:nt,zn=Math.abs(sr)/br;if(Math.abs(sr)>=tA||zn>.11){ve(Lt.current),(bt=p.onDismiss)==null||bt.call(p,p),D(U==="x"?rt>0?"right":"left":nt>0?"down":"up"),ye(),V(!0),pe(!1);return}ee(!1),$(null)},onPointerMove:de=>{var _e,Te,bt,rt;if(!ar.current||!Ze||((_e=window.getSelection())==null?void 0:_e.toString().length)>0)return;let nt=de.clientY-ar.current.y,br=de.clientX-ar.current.x,sr=(Te=e.swipeDirections)!=null?Te:nA(X);!U&&(Math.abs(br)>1||Math.abs(nt)>1)&&$(Math.abs(br)>Math.abs(nt)?"x":"y");let zn={x:0,y:0};U==="y"?(sr.includes("top")||sr.includes("bottom"))&&(sr.includes("top")&&nt<0||sr.includes("bottom")&&nt>0)&&(zn.y=nt):U==="x"&&(sr.includes("left")||sr.includes("right"))&&(sr.includes("left")&&br<0||sr.includes("right")&&br>0)&&(zn.x=br),(Math.abs(zn.x)>0||Math.abs(zn.y)>0)&&pe(!0),(bt=Be.current)==null||bt.style.setProperty("--swipe-amount-x",`${zn.x}px`),(rt=Be.current)==null||rt.style.setProperty("--swipe-amount-y",`${zn.y}px`)}},yr&&!p.jsx?W.createElement("button",{"aria-label":M,"data-disabled":he,"data-close-button":!0,onClick:he||!Ze?()=>{}:()=>{var de;ye(),(de=p.onDismiss)==null||de.call(p,p)},className:yn(J==null?void 0:J.closeButton,(s=p==null?void 0:p.classNames)==null?void 0:s.closeButton)},(i=P==null?void 0:P.close)!=null?i:BE):null,p.jsx||h.isValidElement(p.title)?p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title:W.createElement(W.Fragment,null,Ke||p.icon||p.promise?W.createElement("div",{"data-icon":"",className:yn(J==null?void 0:J.icon,(o=p==null?void 0:p.classNames)==null?void 0:o.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||Xe():null,p.type!=="loading"?p.icon||(P==null?void 0:P[Ke])||TE(Ke):null):null,W.createElement("div",{"data-content":"",className:yn(J==null?void 0:J.content,(l=p==null?void 0:p.classNames)==null?void 0:l.content)},W.createElement("div",{"data-title":"",className:yn(J==null?void 0:J.title,(c=p==null?void 0:p.classNames)==null?void 0:c.title)},typeof p.title=="function"?p.title():p.title),p.description?W.createElement("div",{"data-description":"",className:yn(L,Ir,J==null?void 0:J.description,(d=p==null?void 0:p.classNames)==null?void 0:d.description)},typeof p.description=="function"?p.description():p.description):null),h.isValidElement(p.cancel)?p.cancel:p.cancel&&$c(p.cancel)?W.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||I,onClick:de=>{var _e,Te;$c(p.cancel)&&Ze&&((Te=(_e=p.cancel).onClick)==null||Te.call(_e,de),ye())},className:yn(J==null?void 0:J.cancelButton,(u=p==null?void 0:p.classNames)==null?void 0:u.cancelButton)},p.cancel.label):null,h.isValidElement(p.action)?p.action:p.action&&$c(p.action)?W.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||A,onClick:de=>{var _e,Te;$c(p.action)&&((Te=(_e=p.action).onClick)==null||Te.call(_e,de),!de.defaultPrevented&&ye())},className:yn(J==null?void 0:J.actionButton,(f=p==null?void 0:p.classNames)==null?void 0:f.actionButton)},p.action.label):null))};function Wv(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function sA(e,t){let r={};return[e,t].forEach((n,s)=>{let i=s===1,o=i?"--mobile-offset":"--offset",l=i?ZE:QE;function c(d){["top","right","bottom","left"].forEach(u=>{r[`${o}-${u}`]=typeof d=="number"?`${d}px`:d})}typeof n=="number"||typeof n=="string"?c(n):typeof n=="object"?["top","right","bottom","left"].forEach(d=>{n[d]===void 0?r[`${o}-${d}`]=l:r[`${o}-${d}`]=typeof n[d]=="number"?`${n[d]}px`:n[d]}):c(l)}),r}var iA=h.forwardRef(function(e,t){let{invert:r,position:n="bottom-right",hotkey:s=["altKey","KeyT"],expand:i,closeButton:o,className:l,offset:c,mobileOffset:d,theme:u="light",richColors:f,duration:m,style:p,visibleToasts:x=XE,toastOptions:g,dir:v=Wv(),gap:y=eA,loadingIcon:j,icons:N,containerAriaLabel:w="Notifications",pauseWhenPageIsHidden:k}=e,[b,C]=W.useState([]),_=W.useMemo(()=>Array.from(new Set([n].concat(b.filter(R=>R.position).map(R=>R.position)))),[b,n]),[S,I]=W.useState([]),[A,O]=W.useState(!1),[L,F]=W.useState(!1),[X,T]=W.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),G=W.useRef(null),re=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),J=W.useRef(null),P=W.useRef(!1),M=W.useCallback(R=>{C(U=>{var $;return($=U.find(K=>K.id===R.id))!=null&&$.delete||Lr.dismiss(R.id),U.filter(({id:K})=>K!==R.id)})},[]);return W.useEffect(()=>Lr.subscribe(R=>{if(R.dismiss){C(U=>U.map($=>$.id===R.id?{...$,delete:!0}:$));return}setTimeout(()=>{jP.flushSync(()=>{C(U=>{let $=U.findIndex(K=>K.id===R.id);return $!==-1?[...U.slice(0,$),{...U[$],...R},...U.slice($+1)]:[R,...U]})})})}),[]),W.useEffect(()=>{if(u!=="system"){T(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?T("dark"):T("light")),typeof window>"u")return;let R=window.matchMedia("(prefers-color-scheme: dark)");try{R.addEventListener("change",({matches:U})=>{T(U?"dark":"light")})}catch{R.addListener(({matches:$})=>{try{T($?"dark":"light")}catch(K){console.error(K)}})}},[u]),W.useEffect(()=>{b.length<=1&&O(!1)},[b]),W.useEffect(()=>{let R=U=>{var $,K;s.every(D=>U[D]||U.code===D)&&(O(!0),($=G.current)==null||$.focus()),U.code==="Escape"&&(document.activeElement===G.current||(K=G.current)!=null&&K.contains(document.activeElement))&&O(!1)};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[s]),W.useEffect(()=>{if(G.current)return()=>{J.current&&(J.current.focus({preventScroll:!0}),J.current=null,P.current=!1)}},[G.current]),W.createElement("section",{ref:t,"aria-label":`${w} ${re}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},_.map((R,U)=>{var $;let[K,D]=R.split("-");return b.length?W.createElement("ol",{key:R,dir:v==="auto"?Wv():v,tabIndex:-1,ref:G,className:l,"data-sonner-toaster":!0,"data-theme":X,"data-y-position":K,"data-lifted":A&&b.length>1&&!i,"data-x-position":D,style:{"--front-toast-height":`${(($=S[0])==null?void 0:$.height)||0}px`,"--width":`${JE}px`,"--gap":`${y}px`,...p,...sA(c,d)},onBlur:E=>{P.current&&!E.currentTarget.contains(E.relatedTarget)&&(P.current=!1,J.current&&(J.current.focus({preventScroll:!0}),J.current=null))},onFocus:E=>{E.target instanceof HTMLElement&&E.target.dataset.dismissible==="false"||P.current||(P.current=!0,J.current=E.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{L||O(!1)},onDragEnd:()=>O(!1),onPointerDown:E=>{E.target instanceof HTMLElement&&E.target.dataset.dismissible==="false"||F(!0)},onPointerUp:()=>F(!1)},b.filter(E=>!E.position&&U===0||E.position===R).map((E,Z)=>{var B,Y;return W.createElement(aA,{key:E.id,icons:N,index:Z,toast:E,defaultRichColors:f,duration:(B=g==null?void 0:g.duration)!=null?B:m,className:g==null?void 0:g.className,descriptionClassName:g==null?void 0:g.descriptionClassName,invert:r,visibleToasts:x,closeButton:(Y=g==null?void 0:g.closeButton)!=null?Y:o,interacting:L,position:R,style:g==null?void 0:g.style,unstyled:g==null?void 0:g.unstyled,classNames:g==null?void 0:g.classNames,cancelButtonStyle:g==null?void 0:g.cancelButtonStyle,actionButtonStyle:g==null?void 0:g.actionButtonStyle,removeToast:M,toasts:b.filter(ae=>ae.position==E.position),heights:S.filter(ae=>ae.position==E.position),setHeights:I,expandByDefault:i,gap:y,loadingIcon:j,expanded:A,pauseWhenPageIsHidden:k,swipeDirections:e.swipeDirections})})):null}))}),oA=(e,t,r,n,s,i,o,l)=>{let c=document.documentElement,d=["light","dark"];function u(p){(Array.isArray(e)?e:[e]).forEach(x=>{let g=x==="class",v=g&&i?s.map(y=>i[y]||y):s;g?(c.classList.remove(...v),c.classList.add(i&&i[p]?i[p]:p)):c.setAttribute(x,p)}),f(p)}function f(p){l&&d.includes(p)&&(c.style.colorScheme=p)}function m(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(n)u(n);else try{let p=localStorage.getItem(t)||r,x=o&&p==="system"?m():p;u(x)}catch{}},Uv=["light","dark"],v1="(prefers-color-scheme: dark)",lA=typeof window>"u",Yp=h.createContext(void 0),cA={setTheme:e=>{},themes:[]},dA=()=>{var e;return(e=h.useContext(Yp))!=null?e:cA},uA=e=>h.useContext(Yp)?h.createElement(h.Fragment,null,e.children):h.createElement(mA,{...e}),fA=["light","dark"],mA=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:r=!0,enableColorScheme:n=!0,storageKey:s="theme",themes:i=fA,defaultTheme:o=r?"system":"light",attribute:l="data-theme",value:c,children:d,nonce:u,scriptProps:f})=>{let[m,p]=h.useState(()=>pA(s,o)),[x,g]=h.useState(()=>m==="system"?pm():m),v=c?Object.values(c):i,y=h.useCallback(k=>{let b=k;if(!b)return;k==="system"&&r&&(b=pm());let C=c?c[b]:b,_=t?xA(u):null,S=document.documentElement,I=A=>{A==="class"?(S.classList.remove(...v),C&&S.classList.add(C)):A.startsWith("data-")&&(C?S.setAttribute(A,C):S.removeAttribute(A))};if(Array.isArray(l)?l.forEach(I):I(l),n){let A=Uv.includes(o)?o:null,O=Uv.includes(b)?b:A;S.style.colorScheme=O}_==null||_()},[u]),j=h.useCallback(k=>{let b=typeof k=="function"?k(m):k;p(b);try{localStorage.setItem(s,b)}catch{}},[m]),N=h.useCallback(k=>{let b=pm(k);g(b),m==="system"&&r&&!e&&y("system")},[m,e]);h.useEffect(()=>{let k=window.matchMedia(v1);return k.addListener(N),N(k),()=>k.removeListener(N)},[N]),h.useEffect(()=>{let k=b=>{b.key===s&&(b.newValue?p(b.newValue):j(o))};return window.addEventListener("storage",k),()=>window.removeEventListener("storage",k)},[j]),h.useEffect(()=>{y(e??m)},[e,m]);let w=h.useMemo(()=>({theme:m,setTheme:j,forcedTheme:e,resolvedTheme:m==="system"?x:m,themes:r?[...i,"system"]:i,systemTheme:r?x:void 0}),[m,j,e,x,r,i]);return h.createElement(Yp.Provider,{value:w},h.createElement(hA,{forcedTheme:e,storageKey:s,attribute:l,enableSystem:r,enableColorScheme:n,defaultTheme:o,value:c,themes:i,nonce:u,scriptProps:f}),d)},hA=h.memo(({forcedTheme:e,storageKey:t,attribute:r,enableSystem:n,enableColorScheme:s,defaultTheme:i,value:o,themes:l,nonce:c,scriptProps:d})=>{let u=JSON.stringify([r,t,i,e,l,o,n,s]).slice(1,-1);return h.createElement("script",{...d,suppressHydrationWarning:!0,nonce:typeof window>"u"?c:"",dangerouslySetInnerHTML:{__html:`(${oA.toString()})(${u})`}})}),pA=(e,t)=>{if(lA)return;let r;try{r=localStorage.getItem(e)||void 0}catch{}return r||t},xA=e=>{let t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},pm=e=>(e||(e=window.matchMedia(v1)),e.matches?"dark":"light");function gA({children:e}){return a.jsx(uA,{attribute:"class",defaultTheme:"system",enableSystem:!0,disableTransitionOnChange:!0,children:e})}const y1=h.createContext(null),Os="meridian_token",zo="meridian_user",zc="meridian_workspace";function qv(e){try{const t=e.split(".")[1],r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(r));return{roles:Array.isArray(n.roles)?n.roles:[],permissions:Array.isArray(n.permissions)?n.permissions:[]}}catch{return{roles:[],permissions:[]}}}function vA({children:e}){const[t,r]=h.useState(()=>{try{const f=localStorage.getItem(zo),m=localStorage.getItem(Os);if(!f)return null;const p=JSON.parse(f),{roles:x,permissions:g}=m?qv(m):{roles:[],permissions:[]};return p.roles=x,p.permissions=g,p}catch{return null}}),[n,s]=h.useState(()=>{const f=localStorage.getItem(Os),m=localStorage.getItem(zo);return f&&!m?(localStorage.removeItem(Os),null):f}),[i,o]=h.useState(()=>{try{const f=localStorage.getItem(zc);return f?JSON.parse(f):null}catch{return null}}),l=(f,m)=>{const{roles:p,permissions:x}=qv(m),g={...f,roles:p,permissions:x};r(g),s(m),localStorage.setItem(Os,m),localStorage.setItem(zo,JSON.stringify(g))},c=()=>{const f=localStorage.getItem(Os);f&&fetch("/auth/logout",{method:"POST",headers:{Authorization:`Bearer ${f}`,"Content-Type":"application/json"}}).catch(()=>{}),r(null),s(null),o(null),localStorage.removeItem(Os),localStorage.removeItem(zo),localStorage.removeItem(zc)};h.useEffect(()=>{const f=()=>{localStorage.getItem(Os)&&c()};return window.addEventListener("meridian:unauthorized",f),()=>window.removeEventListener("meridian:unauthorized",f)},[]);const d=f=>{o(f),f?localStorage.setItem(zc,JSON.stringify(f)):localStorage.removeItem(zc)},u=f=>{r(m=>{if(!m)return m;const p={...m,...f};return localStorage.setItem(zo,JSON.stringify(p)),p})};return a.jsx(y1.Provider,{value:{user:t,token:n,workspace:i,isAuthenticated:!!n&&!!t,login:l,logout:c,setWorkspace:d,updateLocalUser:u},children:e})}function Ie(){const e=h.useContext(y1);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const b1=h.createContext(null);function yA({children:e}){const[t,r]=h.useState(!1);return h.useEffect(()=>{const n=s=>{(s.metaKey||s.ctrlKey)&&s.key==="k"&&(s.preventDefault(),r(i=>!i))};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[]),a.jsx(b1.Provider,{value:{open:t,setOpen:r,toggle:()=>r(n=>!n)},children:e})}function Gp(){const e=h.useContext(b1);if(!e)throw new Error("useCommandPalette must be used within CommandPaletteProvider");return e}function w1(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=w1(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=w1(e))&&(n&&(n+=" "),n+=t);return n}const Vp="-",bA=e=>{const t=jA(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(Vp);return l[0]===""&&l.length!==1&&l.shift(),j1(l,t)||wA(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},j1=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),s=n?j1(e.slice(1),n):void 0;if(s)return s;if(t.validators.length===0)return;const i=e.join(Vp);return(o=t.validators.find(({validator:l})=>l(i)))==null?void 0:o.classGroupId},Hv=/^\[(.+)\]$/,wA=e=>{if(Hv.test(e)){const t=Hv.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},jA=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return kA(Object.entries(e.classGroups),r).forEach(([i,o])=>{bh(o,n,i,t)}),n},bh=(e,t,r,n)=>{e.forEach(s=>{if(typeof s=="string"){const i=s===""?t:Kv(t,s);i.classGroupId=r;return}if(typeof s=="function"){if(NA(s)){bh(s(n),t,r,n);return}t.validators.push({validator:s,classGroupId:r});return}Object.entries(s).forEach(([i,o])=>{bh(o,Kv(t,i),r,n)})})},Kv=(e,t)=>{let r=e;return t.split(Vp).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},NA=e=>e.isThemeGetter,kA=(e,t)=>t?e.map(([r,n])=>{const s=n.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,l])=>[t+o,l])):i);return[r,s]}):e,SA=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const s=(i,o)=>{r.set(i,o),t++,t>e&&(t=0,n=r,r=new Map)};return{get(i){let o=r.get(i);if(o!==void 0)return o;if((o=n.get(i))!==void 0)return s(i,o),o},set(i,o){r.has(i)?r.set(i,o):s(i,o)}}},N1="!",CA=e=>{const{separator:t,experimentalParseClassName:r}=e,n=t.length===1,s=t[0],i=t.length,o=l=>{const c=[];let d=0,u=0,f;for(let v=0;v<l.length;v++){let y=l[v];if(d===0){if(y===s&&(n||l.slice(v,v+i)===t)){c.push(l.slice(u,v)),u=v+i;continue}if(y==="/"){f=v;continue}}y==="["?d++:y==="]"&&d--}const m=c.length===0?l:l.substring(u),p=m.startsWith(N1),x=p?m.substring(1):m,g=f&&f>u?f-u:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:x,maybePostfixModifierPosition:g}};return r?l=>r({className:l,parseClassName:o}):o},_A=e=>{if(e.length<=1)return e;const t=[];let r=[];return e.forEach(n=>{n[0]==="["?(t.push(...r.sort(),n),r=[]):r.push(n)}),t.push(...r.sort()),t},MA=e=>({cache:SA(e.cacheSize),parseClassName:CA(e),...bA(e)}),OA=/\s+/,PA=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s}=t,i=[],o=e.trim().split(OA);let l="";for(let c=o.length-1;c>=0;c-=1){const d=o[c],{modifiers:u,hasImportantModifier:f,baseClassName:m,maybePostfixModifierPosition:p}=r(d);let x=!!p,g=n(x?m.substring(0,p):m);if(!g){if(!x){l=d+(l.length>0?" "+l:l);continue}if(g=n(m),!g){l=d+(l.length>0?" "+l:l);continue}x=!1}const v=_A(u).join(":"),y=f?v+N1:v,j=y+g;if(i.includes(j))continue;i.push(j);const N=s(g,x);for(let w=0;w<N.length;++w){const k=N[w];i.push(y+k)}l=d+(l.length>0?" "+l:l)}return l};function EA(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=k1(t))&&(n&&(n+=" "),n+=r);return n}const k1=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=k1(e[n]))&&(r&&(r+=" "),r+=t);return r};function AA(e,...t){let r,n,s,i=o;function o(c){const d=t.reduce((u,f)=>f(u),e());return r=MA(d),n=r.cache.get,s=r.cache.set,i=l,l(c)}function l(c){const d=n(c);if(d)return d;const u=PA(c,r);return s(c,u),u}return function(){return i(EA.apply(null,arguments))}}const ft=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},S1=/^\[(?:([a-z-]+):)?(.+)\]$/i,DA=/^\d+\/\d+$/,TA=new Set(["px","full","screen"]),IA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,RA=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,$A=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,zA=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,LA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,pa=e=>Ui(e)||TA.has(e)||DA.test(e),rs=e=>mo(e,"length",YA),Ui=e=>!!e&&!Number.isNaN(Number(e)),xm=e=>mo(e,"number",Ui),Lo=e=>!!e&&Number.isInteger(Number(e)),FA=e=>e.endsWith("%")&&Ui(e.slice(0,-1)),Re=e=>S1.test(e),ns=e=>IA.test(e),BA=new Set(["length","size","percentage"]),WA=e=>mo(e,BA,C1),UA=e=>mo(e,"position",C1),qA=new Set(["image","url"]),HA=e=>mo(e,qA,VA),KA=e=>mo(e,"",GA),Fo=()=>!0,mo=(e,t,r)=>{const n=S1.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},YA=e=>RA.test(e)&&!$A.test(e),C1=()=>!1,GA=e=>zA.test(e),VA=e=>LA.test(e),XA=()=>{const e=ft("colors"),t=ft("spacing"),r=ft("blur"),n=ft("brightness"),s=ft("borderColor"),i=ft("borderRadius"),o=ft("borderSpacing"),l=ft("borderWidth"),c=ft("contrast"),d=ft("grayscale"),u=ft("hueRotate"),f=ft("invert"),m=ft("gap"),p=ft("gradientColorStops"),x=ft("gradientColorStopPositions"),g=ft("inset"),v=ft("margin"),y=ft("opacity"),j=ft("padding"),N=ft("saturate"),w=ft("scale"),k=ft("sepia"),b=ft("skew"),C=ft("space"),_=ft("translate"),S=()=>["auto","contain","none"],I=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto",Re,t],O=()=>[Re,t],L=()=>["",pa,rs],F=()=>["auto",Ui,Re],X=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],T=()=>["solid","dashed","dotted","double","none"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],re=()=>["start","end","center","between","around","evenly","stretch"],J=()=>["","0",Re],P=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[Ui,Re];return{cacheSize:500,separator:":",theme:{colors:[Fo],spacing:[pa,rs],blur:["none","",ns,Re],brightness:M(),borderColor:[e],borderRadius:["none","","full",ns,Re],borderSpacing:O(),borderWidth:L(),contrast:M(),grayscale:J(),hueRotate:M(),invert:J(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[FA,rs],inset:A(),margin:A(),opacity:M(),padding:O(),saturate:M(),scale:M(),sepia:J(),skew:M(),space:O(),translate:O()},classGroups:{aspect:[{aspect:["auto","square","video",Re]}],container:["container"],columns:[{columns:[ns]}],"break-after":[{"break-after":P()}],"break-before":[{"break-before":P()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...X(),Re]}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Lo,Re]}],basis:[{basis:A()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Re]}],grow:[{grow:J()}],shrink:[{shrink:J()}],order:[{order:["first","last","none",Lo,Re]}],"grid-cols":[{"grid-cols":[Fo]}],"col-start-end":[{col:["auto",{span:["full",Lo,Re]},Re]}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":[Fo]}],"row-start-end":[{row:["auto",{span:[Lo,Re]},Re]}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Re]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Re]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...re()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...re(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...re(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[j]}],px:[{px:[j]}],py:[{py:[j]}],ps:[{ps:[j]}],pe:[{pe:[j]}],pt:[{pt:[j]}],pr:[{pr:[j]}],pb:[{pb:[j]}],pl:[{pl:[j]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[C]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[C]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Re,t]}],"min-w":[{"min-w":[Re,t,"min","max","fit"]}],"max-w":[{"max-w":[Re,t,"none","full","min","max","fit","prose",{screen:[ns]},ns]}],h:[{h:[Re,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Re,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Re,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Re,t,"auto","min","max","fit"]}],"font-size":[{text:["base",ns,rs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",xm]}],"font-family":[{font:[Fo]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Re]}],"line-clamp":[{"line-clamp":["none",Ui,xm]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",pa,Re]}],"list-image":[{"list-image":["none",Re]}],"list-style-type":[{list:["none","disc","decimal",Re]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...T(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",pa,rs]}],"underline-offset":[{"underline-offset":["auto",pa,Re]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Re]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Re]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...X(),UA]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",WA]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},HA]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[...T(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:T()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...T()]}],"outline-offset":[{"outline-offset":[pa,Re]}],"outline-w":[{outline:[pa,rs]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:L()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[pa,rs]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",ns,KA]}],"shadow-color":[{shadow:[Fo]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...G(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":G()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",ns,Re]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[f]}],saturate:[{saturate:[N]}],sepia:[{sepia:[k]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[N]}],"backdrop-sepia":[{"backdrop-sepia":[k]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Re]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",Re]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",Re]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[Lo,Re]}],"translate-x":[{"translate-x":[_]}],"translate-y":[{"translate-y":[_]}],"skew-x":[{"skew-x":[b]}],"skew-y":[{"skew-y":[b]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Re]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Re]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Re]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[pa,rs,xm]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},QA=AA(XA);function z(...e){return QA(it(e))}const Iu=MP,Qn=CP,Zn=_P,_n=h.forwardRef(({className:e,sideOffset:t=4,...r},n)=>a.jsx(Aj,{ref:n,sideOffset:t,className:z("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r}));_n.displayName=Aj.displayName;const _1=h.createContext([]);function ZA({widgets:e,children:t}){return W.createElement(_1.Provider,{value:e},t)}function JA(e){return h.useContext(_1).filter(r=>r.zone===e).map(r=>r.component)}var Pj;const Gi=((Pj=window.__MERIDIAN_CONFIG__)==null?void 0:Pj.apiUrl)??void 0??"";class Xp extends Error{constructor(t,r,n){super(r),this.status=t,this.data=n,this.name="ApiError"}}function M1(){return localStorage.getItem("meridian_token")}async function Bo(e,t={}){var i;const r=M1(),n={"Content-Type":"application/json",...t.headers};r&&(n.Authorization=`Bearer ${r}`);const s=await fetch(`${Gi}${e}`,{...t,headers:n});if(!s.ok){let o;try{o=await s.json()}catch{o=null}const l=((i=o==null?void 0:o.error)==null?void 0:i.message)??`HTTP ${s.status}`;throw s.status===401&&window.dispatchEvent(new CustomEvent("meridian:unauthorized")),new Xp(s.status,l,o)}if(s.status!==204)return s.json()}const oe={get:e=>Bo(e,{method:"GET"}),post:(e,t)=>Bo(e,{method:"POST",body:JSON.stringify(t)}),put:(e,t)=>Bo(e,{method:"PUT",body:JSON.stringify(t)}),patch:(e,t)=>Bo(e,{method:"PATCH",body:JSON.stringify(t)}),delete:e=>Bo(e,{method:"DELETE"}),upload:async(e,t)=>{var i;const r=M1(),n={};r&&(n.Authorization=`Bearer ${r}`);const s=await fetch(`${Gi}${e}`,{method:"POST",headers:n,body:t});if(!s.ok){let o;try{o=await s.json()}catch{o=null}const l=((i=o==null?void 0:o.error)==null?void 0:i.message)??`HTTP ${s.status}`;throw s.status===401&&window.dispatchEvent(new CustomEvent("meridian:unauthorized")),new Xp(s.status,l,o)}if(s.status!==204)return s.json()}},Tt={all:["issues"],byProject:(e,t)=>[...Tt.all,"project",e,...t?[t]:[]],detail:e=>[...Tt.all,e],comments:e=>[...Tt.all,e,"comments"],activities:e=>[...Tt.all,e,"activities"]};function Ql(e,t){return Fe({queryKey:e?Tt.byProject(e,t):Tt.all,queryFn:()=>{var n,s,i;const r=new URLSearchParams;return e&&r.set("project_id",e),(n=t==null?void 0:t.priority)!=null&&n.length&&r.set("priority",t.priority.join(",")),t!=null&&t.assignee_id&&r.set("assignee_id",t.assignee_id),(s=t==null?void 0:t.type)!=null&&s.length&&r.set("type",t.type.join(",")),(i=t==null?void 0:t.status)!=null&&i.length&&r.set("status",t.status.join(",")),oe.get(`/admin/issues?${r}`)},select:r=>r.issues,enabled:e!==void 0?!!e:!0})}function O1(e){return Fe({queryKey:Tt.detail(e),queryFn:()=>oe.get(`/admin/issues/${e}`),select:t=>t.issue,enabled:!!e})}function e5(e){return Fe({queryKey:Tt.comments(e),queryFn:()=>oe.get(`/admin/issues/${e}/comments`),select:t=>t.comments,enabled:!!e})}function P1(){const e=Se();return be({mutationFn:t=>oe.post("/admin/issues",t),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:Tt.byProject(r.project_id)})}})}function Ru(e,t){const r=Se();return be({mutationFn:n=>oe.put(`/admin/issues/${e}`,n),onMutate:async n=>{await r.cancelQueries({queryKey:Tt.byProject(t)});const s=r.getQueryData(Tt.byProject(t));return r.setQueryData(Tt.byProject(t),i=>i&&{...i,issues:i.issues.map(o=>o.id===e?{...o,...n}:o)}),{previous:s}},onError:(n,s,i)=>{i!=null&&i.previous&&r.setQueryData(Tt.byProject(t),i.previous)},onSettled:()=>{r.invalidateQueries({queryKey:Tt.byProject(t)}),r.invalidateQueries({queryKey:Tt.detail(e)})}})}function t5(e){return Fe({queryKey:Tt.activities(e),queryFn:()=>oe.get(`/admin/issues/${e}/activities`),select:t=>t.activities,enabled:!!e})}function r5(e){const t=Se();return be({mutationFn:({body:r,metadata:n})=>oe.post(`/admin/issues/${e}/comments`,{body:r,metadata:n}),onSuccess:()=>{t.invalidateQueries({queryKey:Tt.comments(e)})}})}const Yv=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Gv=it,Zl=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return Gv(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=Yv(u)||Yv(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 Gv(e,o,c,r==null?void 0:r.class,r==null?void 0:r.className)},qi=Zl("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline",indigo:"bg-indigo text-indigo-foreground hover:opacity-90"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9","icon-sm":"h-7 w-7"}},defaultVariants:{variant:"default",size:"default"}}),ne=h.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...s},i)=>{const o=n?Wp:"button";return a.jsx(o,{className:z(qi({variant:t,size:r,className:e})),ref:i,...s})});ne.displayName="Button";const Ee=h.forwardRef(({className:e,type:t,...r},n)=>a.jsx("input",{type:t,className:z("flex h-9 w-full rounded-lg border border-input bg-transparent px-3 py-1 text-sm shadow-none transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-[#9ca3af] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...r}));Ee.displayName="Input";/**
4
4
  * @license lucide-react v0.468.0 - ISC
@@ -554,7 +554,7 @@ var gP=Object.defineProperty;var vP=(e,t,r)=>t in e?gP(e,t,{enumerable:!0,config
554
554
  [data-state=closed]
555
555
  ){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function RT(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function $T(){return xx(/^Mac/)}function zT(){return xx(/^iPhone/)}function ny(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function LT(){return xx(/^iPad/)||$T()&&navigator.maxTouchPoints>1}function xN(){return zT()||LT()}function xx(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const FT=24,BT=typeof window<"u"?h.useLayoutEffect:h.useEffect;function ay(...e){return(...t)=>{for(let r of e)typeof r=="function"&&r(...t)}}const wm=typeof document<"u"&&window.visualViewport;function sy(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function gN(e){for(sy(e)&&(e=e.parentElement);e&&!sy(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const WT=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let Lc=0,jm;function UT(e={}){let{isDisabled:t}=e;BT(()=>{if(!t)return Lc++,Lc===1&&xN()&&(jm=qT()),()=>{Lc--,Lc===0&&(jm==null||jm())}},[t])}function qT(){let e,t=0,r=f=>{e=gN(f.target),!(e===document.documentElement&&e===document.body)&&(t=f.changedTouches[0].pageY)},n=f=>{if(!e||e===document.documentElement||e===document.body){f.preventDefault();return}let m=f.changedTouches[0].pageY,p=e.scrollTop,x=e.scrollHeight-e.clientHeight;x!==0&&((p<=0&&m>t||p>=x&&m<t)&&f.preventDefault(),t=m)},s=f=>{let m=f.target;Sh(m)&&m!==document.activeElement&&(f.preventDefault(),m.style.transform="translateY(-2000px)",m.focus(),requestAnimationFrame(()=>{m.style.transform=""}))},i=f=>{let m=f.target;Sh(m)&&(m.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{m.style.transform="",wm&&(wm.height<window.innerHeight?requestAnimationFrame(()=>{iy(m)}):wm.addEventListener("resize",()=>iy(m),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},l=window.pageXOffset,c=window.pageYOffset,d=ay(HT(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let u=ay(Uo(document,"touchstart",r,{passive:!1,capture:!0}),Uo(document,"touchmove",n,{passive:!1,capture:!0}),Uo(document,"touchend",s,{passive:!1,capture:!0}),Uo(document,"focus",i,!0),Uo(window,"scroll",o));return()=>{d(),u(),window.scrollTo(l,c)}}function HT(e,t,r){let n=e.style[t];return e.style[t]=r,()=>{e.style[t]=n}}function Uo(e,t,r,n){return e.addEventListener(t,r,n),()=>{e.removeEventListener(t,r,n)}}function iy(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let r=gN(e);if(r!==document.documentElement&&r!==document.body&&r!==e){let n=r.getBoundingClientRect().top,s=e.getBoundingClientRect().top,i=e.getBoundingClientRect().bottom;const o=r.getBoundingClientRect().bottom+FT;i>o&&(r.scrollTop+=s-n)}e=r.parentElement}}function Sh(e){return e instanceof HTMLInputElement&&!WT.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function KT(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function YT(...e){return t=>e.forEach(r=>KT(r,t))}function vN(...e){return h.useCallback(YT(...e),e)}const yN=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&&yN.set(e,n)}function GT(e,t){if(!e||!(e instanceof HTMLElement))return;let r=yN.get(e);r&&(e.style[t]=r[t])}const Dt=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function Fc(e,t){if(!e)return null;const r=window.getComputedStyle(e),n=r.transform||r.webkitTransform||r.mozTransform;let s=n.match(/^matrix3d\((.+)\)$/);return s?parseFloat(s[1].split(", ")[Dt(t)?13:12]):(s=n.match(/^matrix\((.+)\)$/),s?parseFloat(s[1].split(", ")[Dt(t)?5:4]):null)}function VT(e){return 8*(Math.log(e+1)-2)}function Nm(e,t){if(!e)return()=>{};const r=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=r}}function XT(...e){return(...t)=>{for(const r of e)typeof r=="function"&&r(...t)}}const wt={DURATION:.5,EASE:[.32,.72,0,1]},bN=.4,QT=.25,ZT=100,wN=8,Ps=16,Ch=26,km="vaul-dragging";function jN(e){const t=W.useRef(e);return W.useEffect(()=>{t.current=e}),W.useMemo(()=>(...r)=>t.current==null?void 0:t.current.call(t,...r),[])}function JT({defaultProp:e,onChange:t}){const r=W.useState(e),[n]=r,s=W.useRef(n),i=jN(t);return W.useEffect(()=>{s.current!==n&&(i(n),s.current=n)},[n,s,i]),r}function NN({prop:e,defaultProp:t,onChange:r=()=>{}}){const[n,s]=JT({defaultProp:t,onChange:r}),i=e!==void 0,o=i?e:n,l=jN(r),c=W.useCallback(d=>{if(i){const f=typeof d=="function"?d(e):d;f!==e&&l(f)}else s(d)},[i,e,s,l]);return[o,c]}function e3({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:r,drawerRef:n,overlayRef:s,fadeFromIndex:i,onSnapPointChange:o,direction:l="bottom",container:c,snapToSequentialPoint:d}){const[u,f]=NN({prop:e,defaultProp:r==null?void 0:r[0],onChange:t}),[m,p]=W.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);W.useEffect(()=>{function C(){p({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[]);const x=W.useMemo(()=>u===(r==null?void 0:r[r.length-1])||null,[r,u]),g=W.useMemo(()=>{var C;return(C=r==null?void 0:r.findIndex(_=>_===u))!=null?C:null},[r,u]),v=r&&r.length>0&&(i||i===0)&&!Number.isNaN(i)&&r[i]===u||!r,y=W.useMemo(()=>{const C=c?{width:c.getBoundingClientRect().width,height:c.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var _;return(_=r==null?void 0:r.map(S=>{const I=typeof S=="string";let A=0;if(I&&(A=parseInt(S,10)),Dt(l)){const L=I?A:m?S*C.height:0;return m?l==="bottom"?C.height-L:-C.height+L:L}const O=I?A:m?S*C.width:0;return m?l==="right"?C.width-O:-C.width+O:O}))!=null?_:[]},[r,m,c]),j=W.useMemo(()=>g!==null?y==null?void 0:y[g]:null,[y,g]),N=W.useCallback(C=>{var _;const S=(_=y==null?void 0:y.findIndex(I=>I===C))!=null?_:null;o(S),Ft(n.current,{transition:`transform ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,transform:Dt(l)?`translate3d(0, ${C}px, 0)`:`translate3d(${C}px, 0, 0)`}),y&&S!==y.length-1&&i!==void 0&&S!==i&&S<i?Ft(s.current,{transition:`opacity ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,opacity:"0"}):Ft(s.current,{transition:`opacity ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,opacity:"1"}),f(r==null?void 0:r[Math.max(S,0)])},[n.current,r,y,i,s,f]);W.useEffect(()=>{if(u||e){var C;const _=(C=r==null?void 0:r.findIndex(S=>S===e||S===u))!=null?C:-1;y&&_!==-1&&typeof y[_]=="number"&&N(y[_])}},[u,e,r,y,N]);function w({draggedDistance:C,closeDrawer:_,velocity:S,dismissible:I}){if(i===void 0)return;const A=l==="bottom"||l==="right"?(j??0)-C:(j??0)+C,O=g===i-1,L=g===0,F=C>0;if(O&&Ft(s.current,{transition:`opacity ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`}),!d&&S>2&&!F){I?_():N(y[0]);return}if(!d&&S>2&&F&&y&&r){N(y[r.length-1]);return}const X=y==null?void 0:y.reduce((G,re)=>typeof G!="number"||typeof re!="number"?G:Math.abs(re-A)<Math.abs(G-A)?re:G),T=Dt(l)?window.innerHeight:window.innerWidth;if(S>bN&&Math.abs(C)<T*.4){const G=F?1:-1;if(G>0&&x&&r){N(y[r.length-1]);return}if(L&&G<0&&I&&_(),g===null)return;N(y[g+G]);return}N(X)}function k({draggedDistance:C}){if(j===null)return;const _=l==="bottom"||l==="right"?j-C:j+C;(l==="bottom"||l==="right")&&_<y[y.length-1]||(l==="top"||l==="left")&&_>y[y.length-1]||Ft(n.current,{transform:Dt(l)?`translate3d(0, ${_}px, 0)`:`translate3d(${_}px, 0, 0)`})}function b(C,_){if(!r||typeof g!="number"||!y||i===void 0)return null;const S=g===i-1;if(g>=i&&_)return 0;if(S&&!_)return 1;if(!v&&!S)return null;const A=S?g+1:g-1,O=S?y[A]-y[A-1]:y[A+1]-y[A],L=C/Math.abs(O);return S?1-L:L}return{isLastSnapPoint:x,activeSnapPoint:u,shouldFade:v,getPercentageDragged:b,setActiveSnapPoint:f,activeSnapPointIndex:g,onRelease:w,onDrag:k,snapPointsOffset:y}}const t3=()=>()=>{};function r3(){const{direction:e,isOpen:t,shouldScaleBackground:r,setBackgroundColorOnScale:n,noBodyStyles:s}=lc(),i=W.useRef(null),o=h.useMemo(()=>document.body.style.backgroundColor,[]);function l(){return(window.innerWidth-Ch)/window.innerWidth}W.useEffect(()=>{if(t&&r){i.current&&clearTimeout(i.current);const c=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!c)return;XT(n&&!s?Nm(document.body,{background:"black"}):t3,Nm(c,{transformOrigin:Dt(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${wt.DURATION}s`,transitionTimingFunction:`cubic-bezier(${wt.EASE.join(",")})`}));const d=Nm(c,{borderRadius:`${wN}px`,overflow:"hidden",...Dt(e)?{transform:`scale(${l()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${l()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{d(),i.current=window.setTimeout(()=>{o?document.body.style.background=o:document.body.style.removeProperty("background")},wt.DURATION*1e3)}}},[t,r,o])}let qo=null;function n3({isOpen:e,modal:t,nested:r,hasBeenOpened:n,preventScrollRestoration:s,noBodyStyles:i}){const[o,l]=W.useState(()=>typeof window<"u"?window.location.href:""),c=W.useRef(0),d=W.useCallback(()=>{if(ny()&&qo===null&&e&&!i){qo={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:f,innerHeight:m}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-c.current}px`,left:`${-f}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const p=m-window.innerHeight;p&&c.current>=m&&(document.body.style.top=`${-(c.current+p)}px`)}),300)}},[e]),u=W.useCallback(()=>{if(ny()&&qo!==null&&!i){const f=-parseInt(document.body.style.top,10),m=-parseInt(document.body.style.left,10);Object.assign(document.body.style,qo),window.requestAnimationFrame(()=>{if(s&&o!==window.location.href){l(window.location.href);return}window.scrollTo(m,f)}),qo=null}},[o]);return W.useEffect(()=>{function f(){c.current=window.scrollY}return f(),window.addEventListener("scroll",f),()=>{window.removeEventListener("scroll",f)}},[]),W.useEffect(()=>{if(t)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||u()}},[t,u]),W.useEffect(()=>{r||!n||(e?(!window.matchMedia("(display-mode: standalone)").matches&&d(),t||window.setTimeout(()=>{u()},500)):u())},[e,n,o,t,r,d,u]),{restorePositionSetting:u}}function a3({open:e,onOpenChange:t,children:r,onDrag:n,onRelease:s,snapPoints:i,shouldScaleBackground:o=!1,setBackgroundColorOnScale:l=!0,closeThreshold:c=QT,scrollLockTimeout:d=ZT,dismissible:u=!0,handleOnly:f=!1,fadeFromIndex:m=i&&i.length-1,activeSnapPoint:p,setActiveSnapPoint:x,fixed:g,modal:v=!0,onClose:y,nested:j,noBodyStyles:N=!1,direction:w="bottom",defaultOpen:k=!1,disablePreventScroll:b=!0,snapToSequentialPoint:C=!1,preventScrollRestoration:_=!1,repositionInputs:S=!0,onAnimationEnd:I,container:A,autoFocus:O=!1}){var L,F;const[X=!1,T]=NN({defaultProp:k,prop:e,onChange:Oe=>{t==null||t(Oe),!Oe&&!j&&Ze(),setTimeout(()=>{I==null||I(Oe)},wt.DURATION*1e3),Oe&&!v&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),Oe||(document.body.style.pointerEvents="auto")}}),[G,re]=W.useState(!1),[J,P]=W.useState(!1),[M,R]=W.useState(!1),U=W.useRef(null),$=W.useRef(null),K=W.useRef(null),D=W.useRef(null),E=W.useRef(null),Z=W.useRef(!1),B=W.useRef(null),Y=W.useRef(0),ae=W.useRef(!1),ee=W.useRef(!k),se=W.useRef(0),V=W.useRef(null),ie=W.useRef(((L=V.current)==null?void 0:L.getBoundingClientRect().height)||0),pe=W.useRef(((F=V.current)==null?void 0:F.getBoundingClientRect().width)||0),ue=W.useRef(0),ve=W.useCallback(Oe=>{i&&Oe===Be.length-1&&($.current=new Date)},[]),{activeSnapPoint:Q,activeSnapPointIndex:ge,setActiveSnapPoint:De,onRelease:Ue,snapPointsOffset:Be,onDrag:Ve,shouldFade:ut,getPercentageDragged:Ke}=e3({snapPoints:i,activeSnapPointProp:p,setActiveSnapPointProp:x,drawerRef:V,fadeFromIndex:m,overlayRef:U,onSnapPointChange:ve,direction:w,container:A,snapToSequentialPoint:C});UT({isDisabled:!X||J||!v||M||!G||!S||!b});const{restorePositionSetting:Ze}=n3({isOpen:X,modal:v,nested:j??!1,hasBeenOpened:G,preventScrollRestoration:_,noBodyStyles:N});function tr(){return(window.innerWidth-Ch)/window.innerWidth}function Ir(Oe){var xe,Ne;!u&&!i||V.current&&!V.current.contains(Oe.target)||(ie.current=((xe=V.current)==null?void 0:xe.getBoundingClientRect().height)||0,pe.current=((Ne=V.current)==null?void 0:Ne.getBoundingClientRect().width)||0,P(!0),K.current=new Date,xN()&&window.addEventListener("touchend",()=>Z.current=!1,{once:!0}),Oe.target.setPointerCapture(Oe.pointerId),Y.current=Dt(w)?Oe.pageY:Oe.pageX)}function rr(Oe,xe){var Ne;let he=Oe;const ye=(Ne=window.getSelection())==null?void 0:Ne.toString(),Xe=V.current?Fc(V.current,w):null,de=new Date;if(he.tagName==="SELECT"||he.hasAttribute("data-vaul-no-drag")||he.closest("[data-vaul-no-drag]"))return!1;if(w==="right"||w==="left")return!0;if($.current&&de.getTime()-$.current.getTime()<500)return!1;if(Xe!==null&&(w==="bottom"?Xe>0:Xe<0))return!0;if(ye&&ye.length>0)return!1;if(E.current&&de.getTime()-E.current.getTime()<d&&Xe===0||xe)return E.current=de,!1;for(;he;){if(he.scrollHeight>he.clientHeight){if(he.scrollTop!==0)return E.current=new Date,!1;if(he.getAttribute("role")==="dialog")return!0}he=he.parentNode}return!0}function yr(Oe){if(V.current&&J){const xe=w==="bottom"||w==="right"?1:-1,Ne=(Y.current-(Dt(w)?Oe.pageY:Oe.pageX))*xe,he=Ne>0,ye=i&&!u&&!he;if(ye&&ge===0)return;const Xe=Math.abs(Ne),de=document.querySelector("[data-vaul-drawer-wrapper]"),_e=w==="bottom"||w==="top"?ie.current:pe.current;let Te=Xe/_e;const bt=Ke(Xe,he);if(bt!==null&&(Te=bt),ye&&Te>=1||!Z.current&&!rr(Oe.target,he))return;if(V.current.classList.add(km),Z.current=!0,Ft(V.current,{transition:"none"}),Ft(U.current,{transition:"none"}),i&&Ve({draggedDistance:Ne}),he&&!i){const nt=VT(Ne),br=Math.min(nt*-1,0)*xe;Ft(V.current,{transform:Dt(w)?`translate3d(0, ${br}px, 0)`:`translate3d(${br}px, 0, 0)`});return}const rt=1-Te;if((ut||m&&ge===m-1)&&(n==null||n(Oe,Te),Ft(U.current,{opacity:`${rt}`,transition:"none"},!0)),de&&U.current&&o){const nt=Math.min(tr()+Te*(1-tr()),1),br=8-Te*8,sr=Math.max(0,14-Te*14);Ft(de,{borderRadius:`${br}px`,transform:Dt(w)?`scale(${nt}) translate3d(0, ${sr}px, 0)`:`scale(${nt}) translate3d(${sr}px, 0, 0)`,transition:"none"},!0)}if(!i){const nt=Xe*xe;Ft(V.current,{transform:Dt(w)?`translate3d(0, ${nt}px, 0)`:`translate3d(${nt}px, 0, 0)`})}}}W.useEffect(()=>{window.requestAnimationFrame(()=>{ee.current=!0})},[]),W.useEffect(()=>{var Oe;function xe(){if(!V.current||!S)return;const Ne=document.activeElement;if(Sh(Ne)||ae.current){var he;const ye=((he=window.visualViewport)==null?void 0:he.height)||0,Xe=window.innerHeight;let de=Xe-ye;const _e=V.current.getBoundingClientRect().height||0,Te=_e>Xe*.8;ue.current||(ue.current=_e);const bt=V.current.getBoundingClientRect().top;if(Math.abs(se.current-de)>60&&(ae.current=!ae.current),i&&i.length>0&&Be&&ge){const rt=Be[ge]||0;de+=rt}if(se.current=de,_e>ye||ae.current){const rt=V.current.getBoundingClientRect().height;let nt=rt;rt>ye&&(nt=ye-(Te?bt:Ch)),g?V.current.style.height=`${rt-Math.max(de,0)}px`:V.current.style.height=`${Math.max(nt,ye-bt)}px`}else RT()||(V.current.style.height=`${ue.current}px`);i&&i.length>0&&!ae.current?V.current.style.bottom="0px":V.current.style.bottom=`${Math.max(de,0)}px`}}return(Oe=window.visualViewport)==null||Oe.addEventListener("resize",xe),()=>{var Ne;return(Ne=window.visualViewport)==null?void 0:Ne.removeEventListener("resize",xe)}},[ge,i,Be]);function nr(Oe){Lt(),y==null||y(),Oe||T(!1),setTimeout(()=>{i&&De(i[0])},wt.DURATION*1e3)}function yt(){if(!V.current)return;const Oe=document.querySelector("[data-vaul-drawer-wrapper]"),xe=Fc(V.current,w);Ft(V.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`}),Ft(U.current,{transition:`opacity ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,opacity:"1"}),o&&xe&&xe>0&&X&&Ft(Oe,{borderRadius:`${wN}px`,overflow:"hidden",...Dt(w)?{transform:`scale(${tr()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${tr()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${wt.DURATION}s`,transitionTimingFunction:`cubic-bezier(${wt.EASE.join(",")})`},!0)}function Lt(){!J||!V.current||(V.current.classList.remove(km),Z.current=!1,P(!1),D.current=new Date)}function Kt(Oe){if(!J||!V.current)return;V.current.classList.remove(km),Z.current=!1,P(!1),D.current=new Date;const xe=Fc(V.current,w);if(!Oe||!rr(Oe.target,!1)||!xe||Number.isNaN(xe)||K.current===null)return;const Ne=D.current.getTime()-K.current.getTime(),he=Y.current-(Dt(w)?Oe.pageY:Oe.pageX),ye=Math.abs(he)/Ne;if(ye>.05&&(R(!0),setTimeout(()=>{R(!1)},200)),i){Ue({draggedDistance:he*(w==="bottom"||w==="right"?1:-1),closeDrawer:nr,velocity:ye,dismissible:u}),s==null||s(Oe,!0);return}if(w==="bottom"||w==="right"?he>0:he<0){yt(),s==null||s(Oe,!0);return}if(ye>bN){nr(),s==null||s(Oe,!1);return}var Xe;const de=Math.min((Xe=V.current.getBoundingClientRect().height)!=null?Xe:0,window.innerHeight);var _e;const Te=Math.min((_e=V.current.getBoundingClientRect().width)!=null?_e:0,window.innerWidth),bt=w==="left"||w==="right";if(Math.abs(xe)>=(bt?Te:de)*c){nr(),s==null||s(Oe,!1);return}s==null||s(Oe,!0),yt()}W.useEffect(()=>(X&&(Ft(document.documentElement,{scrollBehavior:"auto"}),$.current=new Date),()=>{GT(document.documentElement,"scrollBehavior")}),[X]);function ar(Oe){const xe=Oe?(window.innerWidth-Ps)/window.innerWidth:1,Ne=Oe?-Ps:0;B.current&&window.clearTimeout(B.current),Ft(V.current,{transition:`transform ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,transform:Dt(w)?`scale(${xe}) translate3d(0, ${Ne}px, 0)`:`scale(${xe}) translate3d(${Ne}px, 0, 0)`}),!Oe&&V.current&&(B.current=setTimeout(()=>{const he=Fc(V.current,w);Ft(V.current,{transition:"none",transform:Dt(w)?`translate3d(0, ${he}px, 0)`:`translate3d(${he}px, 0, 0)`})},500))}function $n(Oe,xe){if(xe<0)return;const Ne=(window.innerWidth-Ps)/window.innerWidth,he=Ne+xe*(1-Ne),ye=-Ps+xe*Ps;Ft(V.current,{transform:Dt(w)?`scale(${he}) translate3d(0, ${ye}px, 0)`:`scale(${he}) translate3d(${ye}px, 0, 0)`,transition:"none"})}function fa(Oe,xe){const Ne=Dt(w)?window.innerHeight:window.innerWidth,he=xe?(Ne-Ps)/Ne:1,ye=xe?-Ps:0;xe&&Ft(V.current,{transition:`transform ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,transform:Dt(w)?`scale(${he}) translate3d(0, ${ye}px, 0)`:`scale(${he}) translate3d(${ye}px, 0, 0)`})}return W.useEffect(()=>{v||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[v]),W.createElement(Xl,{defaultOpen:k,onOpenChange:Oe=>{!u&&!Oe||(Oe?re(!0):nr(!0),T(Oe))},open:X},W.createElement(pN.Provider,{value:{activeSnapPoint:Q,snapPoints:i,setActiveSnapPoint:De,drawerRef:V,overlayRef:U,onOpenChange:t,onPress:Ir,onRelease:Kt,onDrag:yr,dismissible:u,shouldAnimate:ee,handleOnly:f,isOpen:X,isDragging:J,shouldFade:ut,closeDrawer:nr,onNestedDrag:$n,onNestedOpenChange:ar,onNestedRelease:fa,keyboardIsOpen:ae,modal:v,snapPointsOffset:Be,activeSnapPointIndex:ge,direction:w,shouldScaleBackground:o,setBackgroundColorOnScale:l,noBodyStyles:N,container:A,autoFocus:O}},r))}const kN=W.forwardRef(function({...e},t){const{overlayRef:r,snapPoints:n,onRelease:s,shouldFade:i,isOpen:o,modal:l,shouldAnimate:c}=lc(),d=vN(t,r),u=n&&n.length>0;if(!l)return null;const f=W.useCallback(m=>s(m),[s]);return W.createElement(gi,{onMouseUp:f,ref:d,"data-vaul-overlay":"","data-vaul-snap-points":o&&u?"true":"false","data-vaul-snap-points-overlay":o&&i?"true":"false","data-vaul-animate":c!=null&&c.current?"true":"false",...e})});kN.displayName="Drawer.Overlay";const SN=W.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:r,...n},s){const{drawerRef:i,onPress:o,onRelease:l,onDrag:c,keyboardIsOpen:d,snapPointsOffset:u,activeSnapPointIndex:f,modal:m,isOpen:p,direction:x,snapPoints:g,container:v,handleOnly:y,shouldAnimate:j,autoFocus:N}=lc(),[w,k]=W.useState(!1),b=vN(s,i),C=W.useRef(null),_=W.useRef(null),S=W.useRef(!1),I=g&&g.length>0;r3();const A=(L,F,X=0)=>{if(S.current)return!0;const T=Math.abs(L.y),G=Math.abs(L.x),re=G>T,J=["bottom","right"].includes(F)?1:-1;if(F==="left"||F==="right"){if(!(L.x*J<0)&&G>=0&&G<=X)return re}else if(!(L.y*J<0)&&T>=0&&T<=X)return!re;return S.current=!0,!0};W.useEffect(()=>{I&&window.requestAnimationFrame(()=>{k(!0)})},[]);function O(L){C.current=null,S.current=!1,l(L)}return W.createElement(vi,{"data-vaul-drawer-direction":x,"data-vaul-drawer":"","data-vaul-delayed-snap-points":w?"true":"false","data-vaul-snap-points":p&&I?"true":"false","data-vaul-custom-container":v?"true":"false","data-vaul-animate":j!=null&&j.current?"true":"false",...n,ref:b,style:u&&u.length>0?{"--snap-point-height":`${u[f??0]}px`,...t}:t,onPointerDown:L=>{y||(n.onPointerDown==null||n.onPointerDown.call(n,L),C.current={x:L.pageX,y:L.pageY},o(L))},onOpenAutoFocus:L=>{r==null||r(L),N||L.preventDefault()},onPointerDownOutside:L=>{if(e==null||e(L),!m||L.defaultPrevented){L.preventDefault();return}d.current&&(d.current=!1)},onFocusOutside:L=>{if(!m){L.preventDefault();return}},onPointerMove:L=>{if(_.current=L,y||(n.onPointerMove==null||n.onPointerMove.call(n,L),!C.current))return;const F=L.pageY-C.current.y,X=L.pageX-C.current.x,T=L.pointerType==="touch"?10:2;A({x:X,y:F},x,T)?c(L):(Math.abs(X)>T||Math.abs(F)>T)&&(C.current=null)},onPointerUp:L=>{n.onPointerUp==null||n.onPointerUp.call(n,L),C.current=null,S.current=!1,l(L)},onPointerOut:L=>{n.onPointerOut==null||n.onPointerOut.call(n,L),O(_.current)},onContextMenu:L=>{n.onContextMenu==null||n.onContextMenu.call(n,L),_.current&&O(_.current)}})});SN.displayName="Drawer.Content";const s3=250,i3=120,o3=W.forwardRef(function({preventCycle:e=!1,children:t,...r},n){const{closeDrawer:s,isDragging:i,snapPoints:o,activeSnapPoint:l,setActiveSnapPoint:c,dismissible:d,handleOnly:u,isOpen:f,onPress:m,onDrag:p}=lc(),x=W.useRef(null),g=W.useRef(!1);function v(){if(g.current){N();return}window.setTimeout(()=>{y()},i3)}function y(){if(i||e||g.current){N();return}if(N(),!o||o.length===0){d||s();return}if(l===o[o.length-1]&&d){s();return}const k=o.findIndex(C=>C===l);if(k===-1)return;const b=o[k+1];c(b)}function j(){x.current=window.setTimeout(()=>{g.current=!0},s3)}function N(){x.current&&window.clearTimeout(x.current),g.current=!1}return W.createElement("div",{onClick:v,onPointerCancel:N,onPointerDown:w=>{u&&m(w),j()},onPointerMove:w=>{u&&p(w)},ref:n,"data-vaul-drawer-visible":f?"true":"false","data-vaul-handle":"","aria-hidden":"true",...r},W.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});o3.displayName="Drawer.Handle";function l3(e){const t=lc(),{container:r=t.container,...n}=e;return W.createElement(Vl,{container:r,...n})}const Ka={Root:a3,Content:SN,Overlay:kN,Portal:l3,Title:uo,Description:fo},Ni=({shouldScaleBackground:e=!1,direction:t="right",...r})=>a.jsx(Ka.Root,{shouldScaleBackground:e,direction:t,...r});Ni.displayName="Drawer";const c3=Ka.Portal,CN=h.forwardRef(({className:e,...t},r)=>a.jsx(Ka.Overlay,{ref:r,className:z("fixed inset-0 z-50 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));CN.displayName=Ka.Overlay.displayName;const ki=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(c3,{children:[a.jsx(CN,{}),a.jsx(Ka.Content,{ref:n,className:z("fixed inset-y-0 right-0 z-50 flex h-full flex-col border-l border-border bg-background shadow-xl","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right","w-full max-w-lg",e),...r,children:t})]}));ki.displayName="DrawerContent";const bo=({className:e,...t})=>a.jsx("div",{className:z("flex flex-col space-y-1.5 px-6 pt-6 pb-4 border-b border-border shrink-0",e),...t});bo.displayName="DrawerHeader";const wo=({className:e,...t})=>a.jsx("div",{className:z("flex-1 overflow-y-auto px-6 py-4",e),...t});wo.displayName="DrawerBody";const cc=({className:e,...t})=>a.jsx("div",{className:z("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 px-6 py-4 border-t border-border shrink-0",e),...t});cc.displayName="DrawerFooter";const jo=h.forwardRef(({className:e,...t},r)=>a.jsx(Ka.Title,{ref:r,className:z("text-base font-semibold text-foreground",e),...t}));jo.displayName=Ka.Title.displayName;const d3=h.forwardRef(({className:e,...t},r)=>a.jsx(Ka.Description,{ref:r,className:z("text-sm text-muted-foreground",e),...t}));d3.displayName=Ka.Description.displayName;const u3=Zl("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),mt=h.forwardRef(({className:e,...t},r)=>a.jsx(Kj,{ref:r,className:z(u3(),e),...t}));mt.displayName=Kj.displayName;const Ju=h.forwardRef(({className:e,...t},r)=>a.jsx("textarea",{className:z("flex min-h-[80px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-none placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 resize-none",e),ref:r,...t}));Ju.displayName="Textarea";const oy=[{name:"Backlog",key:"backlog",color:"#94a3b8",category:"backlog",position:0},{name:"Todo",key:"todo",color:"#64748b",category:"unstarted",position:1},{name:"In Progress",key:"in_progress",color:"#6366f1",category:"started",position:2},{name:"In Review",key:"in_review",color:"#f59e0b",category:"started",position:3},{name:"Done",key:"done",color:"#10b981",category:"completed",position:4},{name:"Cancelled",key:"cancelled",color:"#9ca3af",category:"cancelled",position:5}],Sm=["#94a3b8","#64748b","#6366f1","#f59e0b","#10b981","#ef4444","#3b82f6","#8b5cf6"];function f3(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function m3({chip:e,onRemove:t}){const{attributes:r,listeners:n,setNodeRef:s,transform:i,transition:o,isDragging:l}=Hp({id:e.key});return a.jsxs("div",{ref:s,style:{transform:Kp.Transform.toString(i),transition:o},className:z("flex items-center gap-1 pl-1 pr-1.5 py-0.5 rounded-full border text-xs font-medium transition-opacity",l?"opacity-50":"opacity-100"),children:[a.jsx("span",{...r,...n,className:"text-muted-foreground/50 hover:text-muted-foreground cursor-grab touch-none",children:a.jsx(L1,{className:"h-3 w-3"})}),a.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:e.color}}),a.jsx("span",{className:"text-[11px]",children:e.name}),a.jsx("button",{type:"button",onClick:t,className:"ml-0.5 text-muted-foreground/50 hover:text-muted-foreground transition-colors",children:a.jsx(tt,{className:"h-3 w-3"})})]})}const h3=3;function p3({open:e,onClose:t}){var X;const[r,n]=h.useState(""),[s,i]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState(!1),[u,f]=h.useState(!1),[m,p]=h.useState(oy),[x,g]=h.useState(""),[v,y]=h.useState(Sm[2]),{workspace:j}=Ie(),N=CD(),w=kD(r,{enabled:e}),k=SD(s,{enabled:e});h.useEffect(()=>{e&&w.data&&!c&&i(w.data)},[e,w.data,c]);const b=k.available===!1||N.isError&&((X=N.error)==null?void 0:X.status)===409,C=s.trim().length>=h3&&/^[A-Z0-9]+$/i.test(s.trim()),_=i1(Up(o1,{activationConstraint:{distance:5}})),S=T=>{n(T)},I=()=>{r.trim()&&!c&&w.flush()},A=()=>{n(""),i(""),l(""),d(!1),f(!1),p(oy),g(""),y(Sm[2]),N.reset(),t()},O=()=>{if(!x.trim())return;const T=f3(x.trim());if(m.some(G=>G.key===T)){H.error("A status with this name already exists");return}p(G=>[...G,{name:x.trim(),key:T,color:v,category:"started",position:G.length}]),g("")},L=T=>{const{active:G,over:re}=T;!re||G.id===re.id||p(J=>{const P=J.findIndex(R=>R.key===G.id),M=J.findIndex(R=>R.key===re.id);return pd(J,P,M).map((R,U)=>({...R,position:U}))})},F=T=>{T.preventDefault(),!(!r.trim()||!s.trim()||!C||b)&&N.mutate({name:r.trim(),identifier:s.trim().toUpperCase(),description:o.trim()||void 0,workspace_id:j.id,initial_statuses:m},{onSuccess:()=>{H.success("Project created"),A()},onError:G=>{(G==null?void 0:G.status)===409?H.error("This project key is already in use."):H.error(G.message??"Failed to create project")}})};return a.jsx(Ni,{open:e,onOpenChange:T=>!T&&A(),dismissible:!1,children:a.jsxs(ki,{className:"max-w-md",children:[a.jsx(bo,{children:a.jsx(jo,{children:"New project"})}),a.jsxs("form",{onSubmit:F,className:"flex flex-col flex-1 overflow-hidden",children:[a.jsxs(wo,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{htmlFor:"project-name",children:"Name"}),a.jsx(Ee,{id:"project-name",placeholder:"My Project",value:r,onChange:T=>S(T.target.value),onBlur:I,autoFocus:!0}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Project key below will auto-fill when you finish typing; you can change it."})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{htmlFor:"project-id",children:["Identifier",a.jsx("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:"Used as issue prefix (e.g. PROJ-1)"})]}),a.jsx(Ee,{id:"project-id",placeholder:"PROJ",value:s,onChange:T=>{i(T.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"")),d(!0)},maxLength:5,className:z("font-mono",b&&"border-destructive"),"aria-invalid":b}),b&&a.jsx("p",{className:"text-xs text-destructive",children:"This project key is already in use."})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{htmlFor:"project-desc",children:["Description",a.jsx("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsx(Ju,{id:"project-desc",placeholder:"What is this project about?",value:o,onChange:T=>l(T.target.value),className:"min-h-[80px]"})]}),a.jsxs("div",{className:"border border-border rounded-lg overflow-hidden",children:[a.jsx("button",{type:"button",onClick:()=>f(!u),className:"w-full flex items-center justify-between px-3 py-2.5 text-xs font-medium hover:bg-muted/40 transition-colors",children:a.jsxs("span",{className:"flex items-center gap-1.5",children:[u?a.jsx(ia,{className:"h-3.5 w-3.5"}):a.jsx(vr,{className:"h-3.5 w-3.5"}),"Statuses",a.jsxs("span",{className:"text-muted-foreground font-normal",children:["(",m.length,")"]})]})}),u&&a.jsxs("div",{className:"px-3 pb-3 border-t border-border space-y-3 pt-3",children:[a.jsx(xl,{sensors:_,onDragEnd:L,children:a.jsx(qp,{items:m.map(T=>T.key),strategy:l1,children:a.jsx("div",{className:"flex flex-wrap gap-1.5",children:m.map(T=>a.jsx(m3,{chip:T,onRemove:()=>p(G=>G.filter(re=>re.key!==T.key).map((re,J)=>({...re,position:J})))},T.key))})})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:Sm.map(T=>a.jsx("button",{type:"button",onClick:()=>y(T),className:z("h-4 w-4 rounded-full border-2 transition-transform hover:scale-110",v===T?"border-foreground scale-110":"border-transparent"),style:{backgroundColor:T}},T))}),a.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[a.jsx(Ee,{placeholder:"Status name…",value:x,onChange:T=>g(T.target.value),onKeyDown:T=>{T.key==="Enter"&&(T.preventDefault(),O())},className:"h-7 text-xs flex-1"}),a.jsx(ne,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7 shrink-0",onClick:O,disabled:!x.trim(),children:a.jsx(dt,{className:"h-3.5 w-3.5"})})]})]})]})]})]}),a.jsxs(cc,{children:[a.jsx(ne,{type:"button",variant:"ghost",onClick:A,children:"Cancel"}),a.jsx(ne,{type:"submit",disabled:!r.trim()||!s.trim()||!C||b||N.isPending,children:N.isPending?"Creating...":"Create project"})]})]})]})})}const Le=zP,qe=LP,$e=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(Yj,{ref:n,className:z("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-none ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,a.jsx(DP,{asChild:!0,children:a.jsx(ia,{className:"h-4 w-4 opacity-50"})})]}));$e.displayName=Yj.displayName;const _N=h.forwardRef(({className:e,...t},r)=>a.jsx(Gj,{ref:r,className:z("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Zp,{className:"h-4 w-4"})}));_N.displayName=Gj.displayName;const MN=h.forwardRef(({className:e,...t},r)=>a.jsx(Vj,{ref:r,className:z("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(ia,{className:"h-4 w-4"})}));MN.displayName=Vj.displayName;const ze=h.forwardRef(({className:e,children:t,position:r="popper",...n},s)=>a.jsx(TP,{children:a.jsxs(Xj,{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(_N,{}),a.jsx(IP,{className:z("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),a.jsx(MN,{})]})}));ze.displayName=Xj.displayName;const x3=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}));x3.displayName=Qj.displayName;const we=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(Zj,{ref:n,className:z("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[a.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(RP,{children:a.jsx(dr,{className:"h-4 w-4"})})}),a.jsx($P,{children:t})]}));we.displayName=Zj.displayName;const g3=h.forwardRef(({className:e,...t},r)=>a.jsx(Jj,{ref:r,className:z("-mx-1 my-1 h-px bg-border",e),...t}));g3.displayName=Jj.displayName;function v3({open:e,onClose:t,projectId:r,projectName:n}){const{workspace:s}=Ie(),i=(s==null?void 0:s.id)??"",{data:o,isLoading:l}=la(r),{data:c}=rc(i),{data:d}=Fu(i),u=tN(r),f=rN(r),m=nN(r),p=aN(r),[x,g]=h.useState(""),[v,y]=h.useState(""),j=new Set((o==null?void 0:o.members.map(b=>b.user_id))??[]),N=new Set((o==null?void 0:o.teams.map(b=>b.team_id))??[]),w=(c??[]).filter(b=>!j.has(b.user_id)),k=(d??[]).filter(b=>!N.has(b.id));return a.jsx(Ua,{open:e,onOpenChange:b=>!b&&t(),children:a.jsxs(ca,{className:"sm:max-w-[480px]",children:[a.jsx(qa,{children:a.jsxs(Ha,{children:["Access — ",n]})}),a.jsxs("div",{className:"space-y-5 pt-1",children:[a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"People"})}),l?a.jsx("div",{className:"space-y-2",children:[1,2].map(b=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(le,{className:"h-7 w-7 rounded-full"}),a.jsx(le,{className:"h-3.5 w-32"})]},b))}):(o==null?void 0:o.members.length)===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No individual members."}):a.jsx("div",{className:"space-y-1",children:o==null?void 0:o.members.map(b=>{var O;const C=b.user,_=(C==null?void 0:C.first_name)??"",S=(C==null?void 0:C.last_name)??"",I=`${_} ${S}`.trim()||(C==null?void 0:C.email)||"Unknown",A=(_[0]??S[0]??((O=C==null?void 0:C.email)==null?void 0:O[0])??"U").toUpperCase();return a.jsxs("div",{className:"flex items-center gap-2.5 py-1 group",children:[a.jsx(Rt,{className:"h-7 w-7 shrink-0",children:a.jsx($t,{className:"text-[11px] font-medium",children:A})}),a.jsx("span",{className:"flex-1 text-sm truncate",children:I}),a.jsx("span",{className:z("text-[11px] px-1.5 py-0.5 rounded font-medium shrink-0",b.role==="manager"?"bg-indigo/10 text-indigo":"bg-muted text-muted-foreground"),children:b.role}),a.jsx("button",{onClick:()=>f.mutate(b.user_id,{onSuccess:()=>H.success("Access removed"),onError:()=>H.error("Failed to remove")}),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",children:a.jsx(tt,{className:"h-3.5 w-3.5"})})]},b.id)})}),w.length>0&&a.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[a.jsx(po,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),a.jsxs(Le,{value:x,onValueChange:g,children:[a.jsx($e,{className:"h-8 text-xs flex-1",children:a.jsx(qe,{placeholder:"Add person…"})}),a.jsx(ze,{children:w.map(b=>{const C=b.user,_=(C==null?void 0:C.first_name)??"",S=(C==null?void 0:C.last_name)??"",I=`${_} ${S}`.trim()||(C==null?void 0:C.email)||"Unknown";return a.jsx(we,{value:b.user_id,children:I},b.user_id)})})]}),x&&a.jsx(ne,{size:"sm",className:"h-8 px-3 text-xs shrink-0",disabled:u.isPending,onClick:()=>u.mutate({userId:x},{onSuccess:()=>{H.success("Access granted"),g("")},onError:()=>H.error("Failed to grant access")}),children:"Add"})]})]}),a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Teams"})}),l?a.jsx("div",{className:"space-y-2",children:[1].map(b=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(le,{className:"h-7 w-7 rounded-lg"}),a.jsx(le,{className:"h-3.5 w-28"})]},b))}):(o==null?void 0:o.teams.length)===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No teams have access."}):a.jsx("div",{className:"space-y-1",children:o==null?void 0:o.teams.map(b=>{const C=b.team;return a.jsxs("div",{className:"flex items-center gap-2.5 py-1 group",children:[a.jsx("div",{className:"h-7 w-7 rounded-lg bg-muted flex items-center justify-center shrink-0",children:a.jsx(ii,{className:"h-3.5 w-3.5 text-muted-foreground"})}),a.jsx("span",{className:"flex-1 text-sm truncate",children:(C==null?void 0:C.name)??"Unknown team"}),C&&a.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[C.member_count," ",C.member_count===1?"member":"members"]}),a.jsx("button",{onClick:()=>p.mutate(b.team_id,{onSuccess:()=>H.success("Team access removed"),onError:()=>H.error("Failed to remove team")}),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",children:a.jsx(tt,{className:"h-3.5 w-3.5"})})]},b.id)})}),k.length>0&&a.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[a.jsx(ii,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),a.jsxs(Le,{value:v,onValueChange:y,children:[a.jsx($e,{className:"h-8 text-xs flex-1",children:a.jsx(qe,{placeholder:"Add team…"})}),a.jsx(ze,{children:k.map(b=>a.jsx(we,{value:b.id,children:b.name},b.id))})]}),v&&a.jsx(ne,{size:"sm",className:"h-8 px-3 text-xs shrink-0",disabled:m.isPending,onClick:()=>m.mutate(v,{onSuccess:()=>{H.success("Team access granted"),y("")},onError:()=>H.error("Failed to add team")}),children:"Add"})]})]}),a.jsx("div",{className:"flex justify-end pt-1",children:a.jsx(ne,{variant:"outline",size:"sm",onClick:t,children:"Close"})})]})]})})}const ON=6048e5,y3=864e5,b3=36e5,Bc=43200,ly=1440,cy=Symbol.for("constructDateFrom");function Nt(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&cy in e?e[cy](t):e instanceof Date?new e.constructor(t):new Date(t)}function He(e,t){return Nt(t||e,e)}function Ur(e,t,r){const n=He(e,r==null?void 0:r.in);return isNaN(t)?Nt((r==null?void 0:r.in)||e,NaN):(t&&n.setDate(n.getDate()+t),n)}function gx(e,t,r){const n=He(e,r==null?void 0:r.in);if(isNaN(t))return Nt((r==null?void 0:r.in)||e,NaN);if(!t)return n;const s=n.getDate(),i=Nt((r==null?void 0:r.in)||e,n.getTime());i.setMonth(n.getMonth()+t+1,0);const o=i.getDate();return s>=o?i:(n.setFullYear(i.getFullYear(),i.getMonth(),s),n)}let w3={};function No(){return w3}function Xi(e,t){var l,c,d,u;const r=No(),n=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??r.weekStartsOn??((u=(d=r.locale)==null?void 0:d.options)==null?void 0:u.weekStartsOn)??0,s=He(e,t==null?void 0:t.in),i=s.getDay(),o=(i<n?7:0)+i-n;return s.setDate(s.getDate()-o),s.setHours(0,0,0,0),s}function Nl(e,t){return Xi(e,{...t,weekStartsOn:1})}function PN(e,t){const r=He(e,t==null?void 0:t.in),n=r.getFullYear(),s=Nt(r,0);s.setFullYear(n+1,0,4),s.setHours(0,0,0,0);const i=Nl(s),o=Nt(r,0);o.setFullYear(n,0,4),o.setHours(0,0,0,0);const l=Nl(o);return r.getTime()>=i.getTime()?n+1:r.getTime()>=l.getTime()?n:n-1}function _d(e){const t=He(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r}function da(e,...t){const r=Nt.bind(null,e||t.find(n=>typeof n=="object"));return t.map(r)}function Qi(e,t){const r=He(e,t==null?void 0:t.in);return r.setHours(0,0,0,0),r}function ef(e,t,r){const[n,s]=da(r==null?void 0:r.in,e,t),i=Qi(n),o=Qi(s),l=+i-_d(i),c=+o-_d(o);return Math.round((l-c)/y3)}function j3(e,t){const r=PN(e,t),n=Nt(e,0);return n.setFullYear(r,0,4),n.setHours(0,0,0,0),Nl(n)}function N3(e,t,r){return Ur(e,t*7,r)}function k3(e,t,r){return gx(e,t*12,r)}function S3(e,t){let r,n=t==null?void 0:t.in;return e.forEach(s=>{!n&&typeof s=="object"&&(n=Nt.bind(null,s));const i=He(s,n);(!r||r<i||isNaN(+i))&&(r=i)}),Nt(n,r||NaN)}function C3(e,t){let r,n=t==null?void 0:t.in;return e.forEach(s=>{!n&&typeof s=="object"&&(n=Nt.bind(null,s));const i=He(s,n);(!r||r>i||isNaN(+i))&&(r=i)}),Nt(n,r||NaN)}function xd(e,t){const r=+He(e)-+He(t);return r<0?-1:r>0?1:r}function vx(e){return Nt(e,Date.now())}function Zi(e,t,r){const[n,s]=da(r==null?void 0:r.in,e,t);return+Qi(n)==+Qi(s)}function EN(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function _3(e){return!(!EN(e)&&typeof e!="number"||isNaN(+He(e)))}function yx(e,t,r){const[n,s]=da(r==null?void 0:r.in,e,t),i=n.getFullYear()-s.getFullYear(),o=n.getMonth()-s.getMonth();return i*12+o}function AN(e,t,r){const[n,s]=da(r==null?void 0:r.in,e,t),i=dy(n,s),o=Math.abs(ef(n,s));n.setDate(n.getDate()-i*o);const l=+(dy(n,s)===-i),c=i*(o-l);return c===0?0:c}function dy(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 DN(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function M3(e,t,r){const[n,s]=da(r==null?void 0:r.in,e,t),i=(+n-+s)/b3;return DN(r==null?void 0:r.roundingMethod)(i)}function O3(e,t){return+He(e)-+He(t)}function TN(e,t){const r=He(e,t==null?void 0:t.in);return r.setHours(23,59,59,999),r}function bx(e,t){const r=He(e,t==null?void 0:t.in),n=r.getMonth();return r.setFullYear(r.getFullYear(),n+1,0),r.setHours(23,59,59,999),r}function P3(e,t){const r=He(e,t==null?void 0:t.in);return+TN(r,t)==+bx(r,t)}function IN(e,t,r){const[n,s,i]=da(r==null?void 0:r.in,e,e,t),o=xd(s,i),l=Math.abs(yx(s,i));if(l<1)return 0;s.getMonth()===1&&s.getDate()>27&&s.setDate(30),s.setMonth(s.getMonth()-o*l);let c=xd(s,i)===-o;P3(n)&&l===1&&xd(n,i)===1&&(c=!1);const d=o*(l-+c);return d===0?0:d}function E3(e,t,r){const n=O3(e,t)/1e3;return DN(r==null?void 0:r.roundingMethod)(n)}function RN(e,t){const[r,n]=da(e,t.start,t.end);return{start:r,end:n}}function A3(e,t){const{start:r,end:n}=RN(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 $N(e,t){const r=He(e,t==null?void 0:t.in);return r.setDate(1),r.setHours(0,0,0,0),r}function D3(e,t){const r=He(e,t==null?void 0:t.in),n=r.getFullYear();return r.setFullYear(n+1,0,0),r.setHours(23,59,59,999),r}function zN(e,t){const r=He(e,t==null?void 0:t.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}function T3(e,t){const{start:r,end:n}=RN(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 LN(e,t){var l,c,d,u;const r=No(),n=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??r.weekStartsOn??((u=(d=r.locale)==null?void 0:d.options)==null?void 0:u.weekStartsOn)??0,s=He(e,t==null?void 0:t.in),i=s.getDay(),o=(i<n?-7:0)+6-(i-n);return s.setDate(s.getDate()+o),s.setHours(23,59,59,999),s}function I3(e,t){return LN(e,{...t,weekStartsOn:1})}const R3={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},$3=(e,t,r)=>{let n;const s=R3[e];return typeof s=="string"?n=s:t===1?n=s.one:n=s.other.replace("{{count}}",t.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function Cm(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}const z3={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},L3={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},F3={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},B3={date:Cm({formats:z3,defaultWidth:"full"}),time:Cm({formats:L3,defaultWidth:"full"}),dateTime:Cm({formats:F3,defaultWidth:"full"})},W3={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},U3=(e,t,r,n)=>W3[e];function Ho(e){return(t,r)=>{const n=r!=null&&r.context?String(r.context):"standalone";let s;if(n==="formatting"&&e.formattingValues){const o=e.defaultFormattingWidth||e.defaultWidth,l=r!=null&&r.width?String(r.width):o;s=e.formattingValues[l]||e.formattingValues[o]}else{const o=e.defaultWidth,l=r!=null&&r.width?String(r.width):e.defaultWidth;s=e.values[l]||e.values[o]}const i=e.argumentCallback?e.argumentCallback(t):t;return s[i]}}const q3={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},H3={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},K3={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Y3={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},G3={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},V3={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},X3=(e,t)=>{const r=Number(e),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},Q3={ordinalNumber:X3,era:Ho({values:q3,defaultWidth:"wide"}),quarter:Ho({values:H3,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Ho({values:K3,defaultWidth:"wide"}),day:Ho({values:Y3,defaultWidth:"wide"}),dayPeriod:Ho({values:G3,defaultWidth:"wide",formattingValues:V3,defaultFormattingWidth:"wide"})};function Ko(e){return(t,r={})=>{const n=r.width,s=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],i=t.match(s);if(!i)return null;const o=i[0],l=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?J3(l,f=>f.test(o)):Z3(l,f=>f.test(o));let d;d=e.valueCallback?e.valueCallback(c):c,d=r.valueCallback?r.valueCallback(d):d;const u=t.slice(o.length);return{value:d,rest:u}}}function Z3(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function J3(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}function eI(e){return(t,r={})=>{const n=t.match(e.matchPattern);if(!n)return null;const s=n[0],i=t.match(e.parsePattern);if(!i)return null;let o=e.valueCallback?e.valueCallback(i[0]):i[0];o=r.valueCallback?r.valueCallback(o):o;const l=t.slice(s.length);return{value:o,rest:l}}}const tI=/^(\d+)(th|st|nd|rd)?/i,rI=/\d+/i,nI={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},aI={any:[/^b/i,/^(a|c)/i]},sI={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},iI={any:[/1/i,/2/i,/3/i,/4/i]},oI={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},lI={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},cI={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},dI={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},uI={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},fI={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},mI={ordinalNumber:eI({matchPattern:tI,parsePattern:rI,valueCallback:e=>parseInt(e,10)}),era:Ko({matchPatterns:nI,defaultMatchWidth:"wide",parsePatterns:aI,defaultParseWidth:"any"}),quarter:Ko({matchPatterns:sI,defaultMatchWidth:"wide",parsePatterns:iI,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Ko({matchPatterns:oI,defaultMatchWidth:"wide",parsePatterns:lI,defaultParseWidth:"any"}),day:Ko({matchPatterns:cI,defaultMatchWidth:"wide",parsePatterns:dI,defaultParseWidth:"any"}),dayPeriod:Ko({matchPatterns:uI,defaultMatchWidth:"any",parsePatterns:fI,defaultParseWidth:"any"})},Ws={code:"en-US",formatDistance:$3,formatLong:B3,formatRelative:U3,localize:Q3,match:mI,options:{weekStartsOn:0,firstWeekContainsDate:1}};function hI(e,t){const r=He(e,t==null?void 0:t.in);return ef(r,zN(r))+1}function wx(e,t){const r=He(e,t==null?void 0:t.in),n=+Nl(r)-+j3(r);return Math.round(n/ON)+1}function FN(e,t){var u,f,m,p;const r=He(e,t==null?void 0:t.in),n=r.getFullYear(),s=No(),i=(t==null?void 0:t.firstWeekContainsDate)??((f=(u=t==null?void 0:t.locale)==null?void 0:u.options)==null?void 0:f.firstWeekContainsDate)??s.firstWeekContainsDate??((p=(m=s.locale)==null?void 0:m.options)==null?void 0:p.firstWeekContainsDate)??1,o=Nt((t==null?void 0:t.in)||e,0);o.setFullYear(n+1,0,i),o.setHours(0,0,0,0);const l=Xi(o,t),c=Nt((t==null?void 0:t.in)||e,0);c.setFullYear(n,0,i),c.setHours(0,0,0,0);const d=Xi(c,t);return+r>=+l?n+1:+r>=+d?n:n-1}function pI(e,t){var l,c,d,u;const r=No(),n=(t==null?void 0:t.firstWeekContainsDate)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??r.firstWeekContainsDate??((u=(d=r.locale)==null?void 0:d.options)==null?void 0:u.firstWeekContainsDate)??1,s=FN(e,t),i=Nt((t==null?void 0:t.in)||e,0);return i.setFullYear(s,0,n),i.setHours(0,0,0,0),Xi(i,t)}function jx(e,t){const r=He(e,t==null?void 0:t.in),n=+Xi(r,t)-+pI(r,t);return Math.round(n/ON)+1}function Je(e,t){const r=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return r+n}const as={y(e,t){const r=e.getFullYear(),n=r>0?r:1-r;return Je(t==="yy"?n%100:n,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):Je(r+1,2)},d(e,t){return Je(e.getDate(),t.length)},a(e,t){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(e,t){return Je(e.getHours()%12||12,t.length)},H(e,t){return Je(e.getHours(),t.length)},m(e,t){return Je(e.getMinutes(),t.length)},s(e,t){return Je(e.getSeconds(),t.length)},S(e,t){const r=t.length,n=e.getMilliseconds(),s=Math.trunc(n*Math.pow(10,r-3));return Je(s,t.length)}},Ei={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},uy={G:function(e,t,r){const n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if(t==="yo"){const n=e.getFullYear(),s=n>0?n:1-n;return r.ordinalNumber(s,{unit:"year"})}return as.y(e,t)},Y:function(e,t,r,n){const s=FN(e,n),i=s>0?s:1-s;if(t==="YY"){const o=i%100;return Je(o,2)}return t==="Yo"?r.ordinalNumber(i,{unit:"year"}):Je(i,t.length)},R:function(e,t){const r=PN(e);return Je(r,t.length)},u:function(e,t){const r=e.getFullYear();return Je(r,t.length)},Q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return Je(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return Je(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){const n=e.getMonth();switch(t){case"M":case"MM":return as.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){const n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return Je(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){const s=jx(e,n);return t==="wo"?r.ordinalNumber(s,{unit:"week"}):Je(s,t.length)},I:function(e,t,r){const n=wx(e);return t==="Io"?r.ordinalNumber(n,{unit:"week"}):Je(n,t.length)},d:function(e,t,r){return t==="do"?r.ordinalNumber(e.getDate(),{unit:"date"}):as.d(e,t)},D:function(e,t,r){const n=hI(e);return t==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):Je(n,t.length)},E:function(e,t,r){const n=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){const s=e.getDay(),i=(s-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return Je(i,2);case"eo":return r.ordinalNumber(i,{unit:"day"});case"eee":return r.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(s,{width:"short",context:"formatting"});case"eeee":default:return r.day(s,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){const s=e.getDay(),i=(s-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return Je(i,t.length);case"co":return r.ordinalNumber(i,{unit:"day"});case"ccc":return r.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(s,{width:"narrow",context:"standalone"});case"cccccc":return r.day(s,{width:"short",context:"standalone"});case"cccc":default:return r.day(s,{width:"wide",context:"standalone"})}},i:function(e,t,r){const n=e.getDay(),s=n===0?7:n;switch(t){case"i":return String(s);case"ii":return Je(s,t.length);case"io":return r.ordinalNumber(s,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){const s=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(e,t,r){const n=e.getHours();let s;switch(n===12?s=Ei.noon:n===0?s=Ei.midnight:s=n/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,r){const n=e.getHours();let s;switch(n>=17?s=Ei.evening:n>=12?s=Ei.afternoon:n>=4?s=Ei.morning:s=Ei.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,r){if(t==="ho"){let n=e.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return as.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):as.H(e,t)},K:function(e,t,r){const n=e.getHours()%12;return t==="Ko"?r.ordinalNumber(n,{unit:"hour"}):Je(n,t.length)},k:function(e,t,r){let n=e.getHours();return n===0&&(n=24),t==="ko"?r.ordinalNumber(n,{unit:"hour"}):Je(n,t.length)},m:function(e,t,r){return t==="mo"?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):as.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):as.s(e,t)},S:function(e,t){return as.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return my(n);case"XXXX":case"XX":return Is(n);case"XXXXX":case"XXX":default:return Is(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return my(n);case"xxxx":case"xx":return Is(n);case"xxxxx":case"xxx":default:return Is(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+fy(n,":");case"OOOO":default:return"GMT"+Is(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+fy(n,":");case"zzzz":default:return"GMT"+Is(n,":")}},t:function(e,t,r){const n=Math.trunc(+e/1e3);return Je(n,t.length)},T:function(e,t,r){return Je(+e,t.length)}};function fy(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),s=Math.trunc(n/60),i=n%60;return i===0?r+String(s):r+String(s)+t+Je(i,2)}function my(e,t){return e%60===0?(e>0?"-":"+")+Je(Math.abs(e)/60,2):Is(e,t)}function Is(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),s=Je(Math.trunc(n/60),2),i=Je(n%60,2);return r+s+t+i}const hy=(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"})}},BN=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},xI=(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],s=r[2];if(!s)return hy(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}}",hy(n,t)).replace("{{time}}",BN(s,t))},gI={p:BN,P:xI},vI=/^D+$/,yI=/^Y+$/,bI=["D","DD","YY","YYYY"];function wI(e){return vI.test(e)}function jI(e){return yI.test(e)}function NI(e,t,r){const n=kI(e,t,r);if(console.warn(n),bI.includes(e))throw new RangeError(n)}function kI(e,t,r){const n=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const SI=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,CI=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,_I=/^'([^]*?)'?$/,MI=/''/g,OI=/[a-zA-Z]/;function fe(e,t,r){var u,f,m,p,x,g,v,y;const n=No(),s=(r==null?void 0:r.locale)??n.locale??Ws,i=(r==null?void 0:r.firstWeekContainsDate)??((f=(u=r==null?void 0:r.locale)==null?void 0:u.options)==null?void 0:f.firstWeekContainsDate)??n.firstWeekContainsDate??((p=(m=n.locale)==null?void 0:m.options)==null?void 0:p.firstWeekContainsDate)??1,o=(r==null?void 0:r.weekStartsOn)??((g=(x=r==null?void 0:r.locale)==null?void 0:x.options)==null?void 0:g.weekStartsOn)??n.weekStartsOn??((y=(v=n.locale)==null?void 0:v.options)==null?void 0:y.weekStartsOn)??0,l=He(e,r==null?void 0:r.in);if(!_3(l))throw new RangeError("Invalid time value");let c=t.match(CI).map(j=>{const N=j[0];if(N==="p"||N==="P"){const w=gI[N];return w(j,s.formatLong)}return j}).join("").match(SI).map(j=>{if(j==="''")return{isToken:!1,value:"'"};const N=j[0];if(N==="'")return{isToken:!1,value:PI(j)};if(uy[N])return{isToken:!0,value:j};if(N.match(OI))throw new RangeError("Format string contains an unescaped latin alphabet character `"+N+"`");return{isToken:!1,value:j}});s.localize.preprocessor&&(c=s.localize.preprocessor(l,c));const d={firstWeekContainsDate:i,weekStartsOn:o,locale:s};return c.map(j=>{if(!j.isToken)return j.value;const N=j.value;(!(r!=null&&r.useAdditionalWeekYearTokens)&&jI(N)||!(r!=null&&r.useAdditionalDayOfYearTokens)&&wI(N))&&NI(N,t,String(e));const w=uy[N[0]];return w(l,N,s.localize,d)}).join("")}function PI(e){const t=e.match(_I);return t?t[1].replace(MI,"'"):e}function _h(e,t,r){const n=No(),s=(r==null?void 0:r.locale)??n.locale??Ws,i=2520,o=xd(e,t);if(isNaN(o))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:o}),[c,d]=da(r==null?void 0:r.in,...o>0?[t,e]:[e,t]),u=E3(d,c),f=(_d(d)-_d(c))/1e3,m=Math.round((u-f)/60);let p;if(m<2)return r!=null&&r.includeSeconds?u<5?s.formatDistance("lessThanXSeconds",5,l):u<10?s.formatDistance("lessThanXSeconds",10,l):u<20?s.formatDistance("lessThanXSeconds",20,l):u<40?s.formatDistance("halfAMinute",0,l):u<60?s.formatDistance("lessThanXMinutes",1,l):s.formatDistance("xMinutes",1,l):m===0?s.formatDistance("lessThanXMinutes",1,l):s.formatDistance("xMinutes",m,l);if(m<45)return s.formatDistance("xMinutes",m,l);if(m<90)return s.formatDistance("aboutXHours",1,l);if(m<ly){const x=Math.round(m/60);return s.formatDistance("aboutXHours",x,l)}else{if(m<i)return s.formatDistance("xDays",1,l);if(m<Bc){const x=Math.round(m/ly);return s.formatDistance("xDays",x,l)}else if(m<Bc*2)return p=Math.round(m/Bc),s.formatDistance("aboutXMonths",p,l)}if(p=IN(d,c),p<12){const x=Math.round(m/Bc);return s.formatDistance("xMonths",x,l)}else{const x=p%12,g=Math.trunc(p/12);return x<3?s.formatDistance("aboutXYears",g,l):x<9?s.formatDistance("overXYears",g,l):s.formatDistance("almostXYears",g+1,l)}}function EI(e,t){return _h(e,vx(e),t)}function gl(e,t){return He(e,t==null?void 0:t.in).getDate()}function AI(e,t){return He(e,t==null?void 0:t.in).getDay()}function ws(e,t){const r=He(e,t==null?void 0:t.in),n=r.getFullYear(),s=r.getMonth(),i=Nt(r,0);return i.setFullYear(n,s+1,0),i.setHours(0,0,0,0),i.getDate()}function gd(e,t){return He(e,t==null?void 0:t.in).getMonth()}function DI(e,t){return He(e,t==null?void 0:t.in).getFullYear()}function TI(e,t){return+He(e)>+He(t)}function II(e,t){return+He(e)<+He(t)}function RI(e,t,r){const[n,s]=da(r==null?void 0:r.in,e,t);return n.getFullYear()===s.getFullYear()&&n.getMonth()===s.getMonth()}function $I(e,t,r){const[n,s]=da(r==null?void 0:r.in,e,t);return n.getFullYear()===s.getFullYear()}function zI(e,t){return Zi(Nt(e,e),vx(e))}function WN(e,t,r){return Ur(e,-t,r)}function LI(e,t){return Zi(Nt(e,e),WN(vx(e),1))}function FI(e,t,r){const n=He(e,r==null?void 0:r.in),s=n.getFullYear(),i=n.getDate(),o=Nt(e,0);o.setFullYear(s,t,15),o.setHours(0,0,0,0);const l=ws(o);return n.setMonth(t,Math.min(i,l)),n}function BI(e,t,r){const n=He(e,r==null?void 0:r.in);return isNaN(+n)?Nt(e,NaN):(n.setFullYear(t),n)}function WI(){const[e,t]=h.useState(!1),[r,n]=h.useState(null),[s,i]=h.useState(""),[o,l]=h.useState("all"),{workspace:c}=zt(),{data:d,isLoading:u}=vo(),f=_D(),m=pt(),p=(d??[]).filter(x=>(o==="all"||x.status===o)&&(!s||x.name.toLowerCase().includes(s.toLowerCase())||x.identifier.toLowerCase().includes(s.toLowerCase())));return a.jsxs("div",{className:"p-2 pb-24 md:pb-2",children:[a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[a.jsx("h1",{className:"text-base font-semibold",children:"Projects"}),a.jsxs(ne,{size:"sm",onClick:()=>t(!0),children:[a.jsx(dt,{className:"h-4 w-4"}),"Create"]})]}),a.jsxs("div",{className:"flex flex-col gap-2 px-4 md:px-6 py-3 md:py-4 border-b border-border md:flex-row md:items-center md:justify-between",children:[a.jsx("div",{className:"flex items-center gap-1 overflow-x-auto scrollbar-none",children:["all","active","paused","archived"].map(x=>a.jsx("button",{onClick:()=>l(x),className:z("px-3 h-7 rounded-md text-xs font-medium transition-colors whitespace-nowrap shrink-0",o===x?"bg-foreground text-background":"text-muted-foreground hover:text-foreground hover:bg-muted"),children:x==="all"?"All":x.charAt(0).toUpperCase()+x.slice(1)},x))}),a.jsxs("div",{className:"relative",children:[a.jsx(ji,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),a.jsx(Ee,{placeholder:"Search...",value:s,onChange:x=>i(x.target.value),className:"pl-8 h-8 w-full md:w-[200px] text-xs bg-transparent"})]})]}),a.jsxs("div",{className:"hidden md:grid grid-cols-[2fr_1fr_1fr_1fr_40px] items-center px-6 py-2.5 border-b border-border",children:[a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Project"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Identifier"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Status"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Created"}),a.jsx("span",{})]}),u?a.jsx("div",{className:"divide-y divide-border",children:[1,2,3].map(x=>a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"hidden md:grid grid-cols-[2fr_1fr_1fr_1fr_40px] items-center px-6 py-3",children:[a.jsx(le,{className:"h-4 w-48"}),a.jsx(le,{className:"h-4 w-12"}),a.jsx(le,{className:"h-5 w-16 rounded-full"}),a.jsx(le,{className:"h-4 w-24"}),a.jsx("div",{})]},`d-${x}`),a.jsxs("div",{className:"md:hidden flex items-center gap-3 px-4 py-3",children:[a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsx(le,{className:"h-4 w-40"}),a.jsx(le,{className:"h-3 w-24"})]}),a.jsx(le,{className:"h-6 w-6 rounded-full"})]},`m-${x}`)]}))}):p.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[a.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:a.jsx(Hr,{className:"h-5 w-5 text-muted-foreground"})}),a.jsx("p",{className:"text-sm font-medium mb-1",children:s||o!=="all"?"No projects match":"No projects yet"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:s||o!=="all"?"Try adjusting your filters.":"Create your first project to get started."}),!s&&o==="all"&&a.jsxs(ne,{size:"sm",onClick:()=>t(!0),children:[a.jsx(dt,{className:"h-4 w-4"}),"Create project"]})]}):a.jsx("div",{className:"divide-y divide-border",children:p.map(x=>a.jsxs("div",{children:[a.jsxs("div",{className:"hidden md:grid grid-cols-[2fr_1fr_1fr_1fr_40px] items-center px-6 py-3 hover:bg-[#f9fafb] dark:hover:bg-muted/30 cursor-pointer transition-colors group",onClick:()=>m(`/${c}/projects/${x.identifier}/board`),children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[a.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:x.name}),x.description&&a.jsx("span",{className:"text-xs text-muted-foreground truncate hidden xl:block",children:x.description})]}),a.jsx("span",{className:"text-sm text-muted-foreground font-mono",children:x.identifier}),a.jsx("div",{children:a.jsxs("span",{className:z("inline-flex items-center gap-1.5 text-xs",x.status==="active"&&"text-emerald-600",x.status==="paused"&&"text-amber-600",x.status==="archived"&&"text-muted-foreground"),children:[a.jsx("span",{className:z("h-1.5 w-1.5 rounded-full shrink-0",x.status==="active"&&"bg-emerald-500",x.status==="paused"&&"bg-amber-500",x.status==="archived"&&"bg-zinc-400")}),x.status.charAt(0).toUpperCase()+x.status.slice(1)]})}),a.jsx("span",{className:"text-sm text-muted-foreground",children:fe(new Date(x.created_at),"MMM d, yyyy")}),a.jsx("div",{className:"flex justify-end",onClick:g=>g.stopPropagation(),children:a.jsxs(Kr,{children:[a.jsx(Yr,{asChild:!0,children:a.jsx(ne,{variant:"ghost",size:"icon-sm",className:"h-7 w-7 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",children:a.jsx(Ma,{className:"h-4 w-4"})})}),a.jsxs(Or,{align:"end",children:[a.jsxs(at,{onClick:()=>m(`/${c}/projects/${x.identifier}/board`),children:[a.jsx(Hr,{className:"h-4 w-4"}),"Open board"]}),a.jsxs(at,{onClick:()=>m(`/${c}/projects/${x.identifier}/issues`),children:[a.jsx(Jn,{className:"h-4 w-4"}),"View issues"]}),a.jsxs(at,{onClick:()=>n({id:x.id,name:x.name}),children:[a.jsx(Oa,{className:"h-4 w-4"}),"Manage access"]}),a.jsx(Pn,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive",onClick:()=>{confirm(`Delete "${x.name}"? This cannot be undone.`)&&f.mutate(x.id,{onSuccess:()=>H.success("Project deleted"),onError:()=>H.error("Failed to delete project")})},children:[a.jsx(Mr,{className:"h-4 w-4"}),"Delete"]})]})]})})]}),a.jsxs("div",{className:"md:hidden flex items-center gap-3 px-4 py-3 hover:bg-[#f9fafb] dark:hover:bg-muted/30 cursor-pointer transition-colors",onClick:()=>m(`/${c}/projects/${x.identifier}/issues`),children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:x.name}),a.jsx("span",{className:"text-[10px] font-mono text-muted-foreground shrink-0",children:x.identifier})]}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:z("h-1.5 w-1.5 rounded-full shrink-0",x.status==="active"&&"bg-emerald-500",x.status==="paused"&&"bg-amber-500",x.status==="archived"&&"bg-zinc-400")}),a.jsx("span",{className:z("text-xs",x.status==="active"&&"text-emerald-600",x.status==="paused"&&"text-amber-600",x.status==="archived"&&"text-muted-foreground"),children:x.status.charAt(0).toUpperCase()+x.status.slice(1)}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"·"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:fe(new Date(x.created_at),"MMM d, yyyy")})]})]}),a.jsx("div",{onClick:g=>g.stopPropagation(),children:a.jsxs(Kr,{children:[a.jsx(Yr,{asChild:!0,children:a.jsx(ne,{variant:"ghost",size:"icon-sm",className:"h-8 w-8 text-muted-foreground",children:a.jsx(Ma,{className:"h-4 w-4"})})}),a.jsxs(Or,{align:"end",children:[a.jsxs(at,{onClick:()=>m(`/${c}/projects/${x.identifier}/issues`),children:[a.jsx(Jn,{className:"h-4 w-4"}),"View issues"]}),a.jsxs(at,{onClick:()=>n({id:x.id,name:x.name}),children:[a.jsx(Oa,{className:"h-4 w-4"}),"Manage access"]}),a.jsx(Pn,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive",onClick:()=>{confirm(`Delete "${x.name}"? This cannot be undone.`)&&f.mutate(x.id,{onSuccess:()=>H.success("Project deleted"),onError:()=>H.error("Failed to delete project")})},children:[a.jsx(Mr,{className:"h-4 w-4"}),"Delete"]})]})]})})]})]},x.id))}),!u&&p.length>0&&a.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-t border-border",children:[a.jsxs("span",{className:"text-xs text-muted-foreground",children:["1 — ",p.length," of ",p.length," result",p.length!==1?"s":""]}),a.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[a.jsx("span",{children:"1 of 1 pages"}),a.jsx(ne,{variant:"ghost",size:"sm",className:"h-7 text-xs",disabled:!0,children:"Prev"}),a.jsx(ne,{variant:"ghost",size:"sm",className:"h-7 text-xs",disabled:!0,children:"Next"})]})]})]}),a.jsx(p3,{open:e,onClose:()=>t(!1)}),r&&a.jsx(v3,{open:!!r,onClose:()=>n(null),projectId:r.id,projectName:r.name})]})}const dc={byProject:e=>["projects",e,"statuses"]};function ko(e){return Fe({queryKey:dc.byProject(e??""),queryFn:()=>oe.get(`/admin/projects/${e}/statuses`),select:t=>t.statuses,enabled:!!e})}function UI(e){const t=Se();return be({mutationFn:r=>oe.post(`/admin/projects/${e}/statuses`,r),onSuccess:()=>{t.invalidateQueries({queryKey:dc.byProject(e)})}})}function qI(e,t){const r=Se();return be({mutationFn:n=>oe.put(`/admin/projects/${e}/statuses/${t}`,n),onSuccess:()=>{r.invalidateQueries({queryKey:dc.byProject(e)})}})}function HI(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/projects/${e}/statuses/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:dc.byProject(e)})}})}function KI(e){const t=Se();return be({mutationFn:r=>oe.post(`/admin/projects/${e}/statuses/reorder`,{orderedIds:r}),onSuccess:()=>{t.invalidateQueries({queryKey:dc.byProject(e)})}})}const Si={all:["users"],list:e=>[...Si.all,"list",e??{}]};function UN(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),Fe({queryKey:Si.list({limit:t,offset:r,q:n}),queryFn:()=>oe.get(`/admin/users?${s}`),staleTime:1e3*60*5,placeholderData:i=>i})}const tf={all:["org-invitations"],list:e=>[...tf.all,"list",e??{}]};function YI(e){const{limit:t=20,offset:r=0,q:n=""}=e??{},s=new URLSearchParams;return s.set("limit",String(t)),s.set("offset",String(r)),n&&s.set("q",n),Fe({queryKey:tf.list({limit:t,offset:r,q:n}),queryFn:()=>oe.get(`/admin/users/invitations?${s}`),staleTime:1e3*30,placeholderData:i=>i})}function GI(){const e=Se();return be({mutationFn:t=>oe.delete(`/admin/users/invitations/${t}`),onSuccess:()=>e.invalidateQueries({queryKey:tf.all})})}function VI(){return be({mutationFn:e=>oe.post(`/admin/users/invitations/${e}/resend`)})}function XI(){const e=Se();return be({mutationFn:({email:t,role:r})=>oe.post("/admin/users/invite",{email:t,role:r}),onSuccess:()=>e.invalidateQueries({queryKey:tf.all})})}function QI(){const e=Se();return be({mutationFn:({userId:t,role:r})=>oe.patch(`/admin/users/${t}`,{role:r}),onSuccess:()=>e.invalidateQueries({queryKey:Si.all})})}function ZI(){const e=Se();return be({mutationFn:t=>oe.delete(`/admin/users/${t}`),onSuccess:()=>e.invalidateQueries({queryKey:Si.all})})}function JI(){const e=Se();return be({mutationFn:t=>oe.post(`/admin/users/${t}/reactivate`),onSuccess:()=>e.invalidateQueries({queryKey:Si.all})})}function qN(){return Fe({queryKey:[...Si.all,"map"],queryFn:()=>oe.get("/admin/users/map"),select:e=>e.users.map(t=>({...t,role:"",app_role_id:null,is_active:!0})),staleTime:1e3*60*5})}function ks(){return Fe({queryKey:[...Si.all,"map"],queryFn:()=>oe.get("/admin/users/map"),select:e=>new Map(e.users.map(t=>{var o;const r=t.first_name??"",n=t.last_name??"",s=`${r} ${n}`.trim()||t.email,i=(r[0]??n[0]??((o=t.email)==null?void 0:o[0])??"U").toUpperCase();return[t.id,{name:s,initials:i}]})),staleTime:1e3*60*5})}const ci={backlog:"Backlog",todo:"Todo",in_progress:"In Progress",in_review:"In Review",done:"Done",cancelled:"Cancelled"},rn={urgent:"Urgent",high:"High",medium:"Medium",low:"Low",none:"None"},uc={urgent:"text-red-500",high:"text-orange-500",medium:"text-yellow-500",low:"text-blue-400",none:"text-zinc-400"},Pa={task:"Task",bug:"Bug",feature:"Feature",improvement:"Improvement",epic:"Epic"},e4=({priority:e})=>{const t=z("h-3 w-3 shrink-0",uc[e]);switch(e){case"urgent":return a.jsx(oa,{className:t});case"high":return a.jsx(bi,{className:t});case"medium":return a.jsx(Ba,{className:t});case"low":return a.jsx(yi,{className:t});default:return a.jsx(_r,{className:"h-3 w-3 shrink-0 text-zinc-300"})}};function HN({issue:e,childCount:t=0,onClick:r}){var f,m;const{data:n}=ks(),{attributes:s,listeners:i,setNodeRef:o,transform:l,transition:c,isDragging:d}=Hp({id:e.id}),u={transform:Kp.Transform.toString(l),transition:c};return a.jsxs("div",{ref:o,style:u,...s,...i,onClick:r,className:z("bg-white dark:bg-card border border-border rounded-lg px-3 py-2.5 cursor-pointer select-none","hover:border-zinc-300 dark:hover:border-zinc-600 transition-colors",d&&"opacity-40 shadow-lg ring-2 ring-indigo/30"),children:[a.jsx("p",{className:"text-[13px] text-foreground leading-snug line-clamp-2 mb-2",children:e.title}),a.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-muted-foreground mb-2",children:[a.jsx(Wt,{className:"h-2.5 w-2.5 shrink-0"}),a.jsx("span",{children:e.start_date?fe(new Date(e.start_date),"MMM d"):"?"}),a.jsx("span",{children:"→"}),a.jsx("span",{children:e.due_date?fe(new Date(e.due_date),"MMM d"):"?"})]}),a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[a.jsx("span",{className:"text-[11px] font-mono text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/50 px-1 py-0.5 rounded shrink-0",children:e.identifier}),e.parent_id&&a.jsx("span",{className:"flex items-center text-zinc-400 dark:text-zinc-500 shrink-0",title:"Child issue",children:a.jsx(Mn,{className:"h-3 w-3"})}),t>0&&a.jsxs("span",{className:"flex items-center gap-0.5 text-[10px] font-medium text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/50 px-1 py-0.5 rounded shrink-0",children:[a.jsx(Mn,{className:"h-2.5 w-2.5"}),t]})]}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[(e.assignee_ids??[]).length>0&&a.jsxs("div",{className:"flex -space-x-1",children:[(e.assignee_ids??[]).slice(0,2).map(p=>{const x=n==null?void 0:n.get(p);return a.jsx(Rt,{className:"h-4 w-4 border border-background",children:a.jsx($t,{className:"text-[8px] bg-indigo-100 text-indigo-700 dark:bg-indigo-900/50 dark:text-indigo-300",children:(x==null?void 0:x.initials)??"?"})},p)}),(((f=e.assignee_ids)==null?void 0:f.length)??0)>2&&a.jsxs("span",{className:"text-[9px] text-muted-foreground ml-1.5 self-center",children:["+",(((m=e.assignee_ids)==null?void 0:m.length)??0)-2]})]}),a.jsx(e4,{priority:e.priority})]})]})]})}function Wc(e,t){const r=e.replace("#",""),n=parseInt(r.substring(0,2),16),s=parseInt(r.substring(2,4),16),i=parseInt(r.substring(4,6),16);return isNaN(n)||isNaN(s)||isNaN(i)?`rgba(148,163,184,${t})`:`rgba(${n},${s},${i},${t})`}const t4=({category:e,color:t})=>{const r="h-3.5 w-3.5 shrink-0",n={color:t};switch(e){case"completed":return a.jsx(ta,{className:r,style:n});case"started":return a.jsx(Tn,{className:r,style:n});default:return a.jsx(_r,{className:r,style:n})}};function r4({id:e,label:t,color:r,category:n,issues:s,childCounts:i,sortable:o,onIssueClick:l,onRename:c,onDelete:d,isRenaming:u,renameValue:f,onRenameChange:m,onRenameSubmit:p,onRenameCancel:x}){const{setNodeRef:g,isOver:v}=mE({id:e}),{attributes:y,listeners:j,setNodeRef:N,transform:w,transition:k,isDragging:b}=Hp({id:e,disabled:!o}),C=h.useRef(null),_=h.useRef(!1);h.useEffect(()=>{u&&(_.current=!1,setTimeout(()=>{var F;return(F=C.current)==null?void 0:F.focus()},0))},[u]);const S=o?{transform:Kp.Transform.toString(w),transition:k}:void 0,I=Wc(r,.08),A=Wc(r,.16),O=Wc(r,.35),L=!!(c||d);return a.jsxs("div",{ref:N,style:S,className:z("flex flex-col min-w-[260px] max-w-[280px] w-full group/col",b&&"opacity-50"),children:[a.jsxs("div",{className:z("flex items-center gap-2 mb-2 px-1",o&&"cursor-grab"),children:[o&&a.jsx("span",{...y,...j,className:"text-muted-foreground/40 hover:text-muted-foreground touch-none",children:a.jsx(L1,{className:"h-3.5 w-3.5"})}),a.jsx(t4,{category:n,color:r}),u?a.jsx("input",{ref:C,value:f??"",onChange:F=>m==null?void 0:m(F.target.value),onKeyDown:F=>{F.key==="Enter"&&(F.preventDefault(),p==null||p()),F.key==="Escape"&&(F.preventDefault(),_.current=!0,x==null||x())},onBlur:()=>{_.current||p==null||p()},className:"flex-1 text-xs font-medium bg-transparent border-b border-foreground/30 outline-none py-0.5 min-w-0"}):a.jsx("span",{className:"text-xs font-medium text-foreground",children:t}),a.jsx("span",{className:"ml-1 text-[11px] font-medium rounded-full px-1.5 py-0.5 tabular-nums min-w-[18px] text-center",style:{backgroundColor:Wc(r,.12),color:r},children:s.length}),L&&!u&&a.jsxs(Kr,{children:[a.jsx(Yr,{asChild:!0,children:a.jsx("button",{className:"ml-auto h-5 w-5 flex items-center justify-center rounded opacity-0 group-hover/col:opacity-100 hover:bg-muted transition-opacity text-muted-foreground hover:text-foreground",onClick:F=>F.stopPropagation(),children:a.jsx(Ma,{className:"h-3.5 w-3.5"})})}),a.jsxs(Or,{align:"end",className:"w-40",children:[c&&a.jsx(at,{onClick:c,children:"Rename"}),c&&d&&a.jsx(Pn,{}),d&&a.jsx(at,{className:"text-destructive focus:text-destructive",onClick:d,children:"Delete status"})]})]})]}),a.jsxs("div",{ref:g,className:z("flex-1 flex flex-col gap-2 min-h-[200px] p-2 rounded-xl transition-colors"),style:{backgroundColor:v?A:I,boxShadow:v?`inset 0 0 0 1px ${O}`:void 0},children:[a.jsx(qp,{items:s.map(F=>F.id),strategy:hE,children:s.map(F=>a.jsx(HN,{issue:F,childCount:(i==null?void 0:i.get(F.id))??0,onClick:()=>l==null?void 0:l(F)},F.id))}),s.length===0&&a.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[120px]",children:a.jsx("p",{className:"text-xs text-muted-foreground/40",children:"Drop here"})})]})]})}const _m=["#94a3b8","#64748b","#6366f1","#f59e0b","#10b981","#ef4444","#3b82f6","#8b5cf6"],n4=[{value:"backlog",label:"Backlog"},{value:"unstarted",label:"Not Started"},{value:"started",label:"In Progress"},{value:"completed",label:"Done"},{value:"cancelled",label:"Cancelled"}];function a4({open:e,onClose:t,projectId:r}){const[n,s]=h.useState(""),[i,o]=h.useState(_m[0]),[l,c]=h.useState(""),[d,u]=h.useState("started"),f=UI(r),m=l||i,p=()=>{n.trim()&&f.mutate({name:n.trim(),color:m,category:d},{onSuccess:()=>{H.success("Status created"),s(""),o(_m[0]),c(""),u("started"),t()},onError:()=>H.error("Failed to create status")})};return a.jsx(Ni,{open:e,onOpenChange:x=>!x&&t(),children:a.jsxs(ki,{className:"sm:max-w-sm",children:[a.jsx(bo,{children:a.jsx(jo,{className:"text-sm font-medium",children:"New Status"})}),a.jsx(wo,{children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Name"}),a.jsx(Ee,{placeholder:"e.g. In Review",value:n,onChange:x=>s(x.target.value),onKeyDown:x=>x.key==="Enter"&&p(),autoFocus:!0,className:"h-8 text-sm"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Color"}),a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[_m.map(x=>a.jsx("button",{onClick:()=>{o(x),c("")},className:z("h-6 w-6 rounded-full border-2 transition-transform hover:scale-110",i===x&&!l?"border-foreground scale-110":"border-transparent"),style:{backgroundColor:x}},x)),a.jsxs("div",{className:"flex items-center gap-1.5 ml-1",children:[a.jsx("div",{className:"h-6 w-6 rounded-full border border-border shrink-0",style:{backgroundColor:l||"#e5e7eb"}}),a.jsx(Ee,{placeholder:"#hex",value:l,onChange:x=>c(x.target.value),className:"h-6 w-20 text-xs px-1.5"})]})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Category"}),a.jsxs(Le,{value:d,onValueChange:x=>u(x),children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{})}),a.jsx(ze,{children:n4.map(x=>a.jsx(we,{value:x.value,className:"text-xs",children:x.label},x.value))})]})]})]})}),a.jsxs(cc,{className:"mt-2",children:[a.jsx(ne,{variant:"ghost",size:"sm",onClick:t,className:"text-xs",children:"Cancel"}),a.jsx(ne,{size:"sm",onClick:p,disabled:!n.trim()||f.isPending,className:"text-xs",children:"Create"})]})]})})}function s4({projectId:e}){const[t,r]=h.useState(!1);return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex flex-col min-w-[260px] max-w-[280px] w-full",children:a.jsxs("button",{onClick:()=>r(!0),className:"flex items-center gap-2 px-3 py-2 rounded-xl border border-dashed border-border text-muted-foreground hover:text-foreground hover:border-foreground/30 hover:bg-muted/30 transition-colors text-xs font-medium h-9",children:[a.jsx(dt,{className:"h-3.5 w-3.5"}),"Add status"]})}),a.jsx(a4,{open:t,onClose:()=>r(!1),projectId:e})]})}function i4({open:e,statusName:t,issueCount:r,otherStatuses:n,onConfirm:s,onCancel:i,isLoading:o}){const[l,c]=h.useState(""),d=()=>{r>0&&!l||s(r>0?l:null)};return a.jsx(Ua,{open:e,onOpenChange:u=>{u||i()},children:a.jsxs(ca,{className:"sm:max-w-md",children:[a.jsxs(qa,{children:[a.jsx(Ha,{children:"Delete status"}),a.jsx(yo,{children:r>0?`${r} issue${r!==1?"s":""} in "${t}" will be moved to another status.`:`Delete the "${t}" status. This cannot be undone.`})]}),r>0&&a.jsxs("div",{className:"py-2",children:[a.jsx("label",{className:"text-sm font-medium mb-1.5 block",children:"Move issues to"}),a.jsxs(Le,{value:l,onValueChange:c,children:[a.jsx($e,{children:a.jsx(qe,{placeholder:"Select a status..."})}),a.jsx(ze,{children:n.map(u=>a.jsx(we,{value:u.id,children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:u.color}}),u.name]})},u.id))})]})]}),a.jsxs(fx,{children:[a.jsx(ne,{variant:"outline",onClick:i,disabled:o,children:"Cancel"}),a.jsx(ne,{variant:"destructive",onClick:d,disabled:r>0&&!l||o,children:o?"Deleting…":"Delete status"})]})]})})}var Nx={};(function e(t,r,n,s){var i=!!(t.Worker&&t.Blob&&t.Promise&&t.OffscreenCanvas&&t.OffscreenCanvasRenderingContext2D&&t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype.transferControlToOffscreen&&t.URL&&t.URL.createObjectURL),o=typeof Path2D=="function"&&typeof DOMMatrix=="function",l=function(){if(!t.OffscreenCanvas)return!1;try{var P=new OffscreenCanvas(1,1),M=P.getContext("2d");M.fillRect(0,0,1,1);var R=P.transferToImageBitmap();M.createPattern(R,"no-repeat")}catch{return!1}return!0}();function c(){}function d(P){var M=r.exports.Promise,R=M!==void 0?M:t.Promise;return typeof R=="function"?new R(P):(P(c,c),null)}var u=function(P,M){return{transform:function(R){if(P)return R;if(M.has(R))return M.get(R);var U=new OffscreenCanvas(R.width,R.height),$=U.getContext("2d");return $.drawImage(R,0,0),M.set(R,U),U},clear:function(){M.clear()}}}(l,new Map),f=function(){var P=Math.floor(16.666666666666668),M,R,U={},$=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(M=function(K){var D=Math.random();return U[D]=requestAnimationFrame(function E(Z){$===Z||$+P-1<Z?($=Z,delete U[D],K()):U[D]=requestAnimationFrame(E)}),D},R=function(K){U[K]&&cancelAnimationFrame(U[K])}):(M=function(K){return setTimeout(K,P)},R=function(K){return clearTimeout(K)}),{frame:M,cancel:R}}(),m=function(){var P,M,R={};function U($){function K(D,E){$.postMessage({options:D||{},callback:E})}$.init=function(E){var Z=E.transferControlToOffscreen();$.postMessage({canvas:Z},[Z])},$.fire=function(E,Z,B){if(M)return K(E,null),M;var Y=Math.random().toString(36).slice(2);return M=d(function(ae){function ee(se){se.data.callback===Y&&(delete R[Y],$.removeEventListener("message",ee),M=null,u.clear(),B(),ae())}$.addEventListener("message",ee),K(E,Y),R[Y]=ee.bind(null,{data:{callback:Y}})}),M},$.reset=function(){$.postMessage({reset:!0});for(var E in R)R[E](),delete R[E]}}return function(){if(P)return P;if(!n&&i){var $=["var CONFETTI, SIZE = {}, module = {};","("+e.toString()+")(this, module, true, SIZE);","onmessage = function(msg) {"," if (msg.data.options) {"," CONFETTI(msg.data.options).then(function () {"," if (msg.data.callback) {"," postMessage({ callback: msg.data.callback });"," }"," });"," } else if (msg.data.reset) {"," CONFETTI && CONFETTI.reset();"," } else if (msg.data.resize) {"," SIZE.width = msg.data.resize.width;"," SIZE.height = msg.data.resize.height;"," } else if (msg.data.canvas) {"," SIZE.width = msg.data.canvas.width;"," SIZE.height = msg.data.canvas.height;"," CONFETTI = module.exports.create(msg.data.canvas);"," }","}"].join(`
556
556
  `);try{P=new Worker(URL.createObjectURL(new Blob([$])))}catch(K){return typeof console<"u"&&typeof console.warn=="function"&&console.warn("🎊 Could not load worker",K),null}U(P)}return P}}(),p={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function x(P,M){return M?M(P):P}function g(P){return P!=null}function v(P,M,R){return x(P&&g(P[M])?P[M]:p[M],R)}function y(P){return P<0?0:Math.floor(P)}function j(P,M){return Math.floor(Math.random()*(M-P))+P}function N(P){return parseInt(P,16)}function w(P){return P.map(k)}function k(P){var M=String(P).replace(/[^0-9a-f]/gi,"");return M.length<6&&(M=M[0]+M[0]+M[1]+M[1]+M[2]+M[2]),{r:N(M.substring(0,2)),g:N(M.substring(2,4)),b:N(M.substring(4,6))}}function b(P){var M=v(P,"origin",Object);return M.x=v(M,"x",Number),M.y=v(M,"y",Number),M}function C(P){P.width=document.documentElement.clientWidth,P.height=document.documentElement.clientHeight}function _(P){var M=P.getBoundingClientRect();P.width=M.width,P.height=M.height}function S(P){var M=document.createElement("canvas");return M.style.position="fixed",M.style.top="0px",M.style.left="0px",M.style.pointerEvents="none",M.style.zIndex=P,M}function I(P,M,R,U,$,K,D,E,Z){P.save(),P.translate(M,R),P.rotate(K),P.scale(U,$),P.arc(0,0,1,D,E,Z),P.restore()}function A(P){var M=P.angle*(Math.PI/180),R=P.spread*(Math.PI/180);return{x:P.x,y:P.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:P.startVelocity*.5+Math.random()*P.startVelocity,angle2D:-M+(.5*R-Math.random()*R),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:P.color,shape:P.shape,tick:0,totalTicks:P.ticks,decay:P.decay,drift:P.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:P.gravity*3,ovalScalar:.6,scalar:P.scalar,flat:P.flat}}function O(P,M){M.x+=Math.cos(M.angle2D)*M.velocity+M.drift,M.y+=Math.sin(M.angle2D)*M.velocity+M.gravity,M.velocity*=M.decay,M.flat?(M.wobble=0,M.wobbleX=M.x+10*M.scalar,M.wobbleY=M.y+10*M.scalar,M.tiltSin=0,M.tiltCos=0,M.random=1):(M.wobble+=M.wobbleSpeed,M.wobbleX=M.x+10*M.scalar*Math.cos(M.wobble),M.wobbleY=M.y+10*M.scalar*Math.sin(M.wobble),M.tiltAngle+=.1,M.tiltSin=Math.sin(M.tiltAngle),M.tiltCos=Math.cos(M.tiltAngle),M.random=Math.random()+2);var R=M.tick++/M.totalTicks,U=M.x+M.random*M.tiltCos,$=M.y+M.random*M.tiltSin,K=M.wobbleX+M.random*M.tiltCos,D=M.wobbleY+M.random*M.tiltSin;if(P.fillStyle="rgba("+M.color.r+", "+M.color.g+", "+M.color.b+", "+(1-R)+")",P.beginPath(),o&&M.shape.type==="path"&&typeof M.shape.path=="string"&&Array.isArray(M.shape.matrix))P.fill(G(M.shape.path,M.shape.matrix,M.x,M.y,Math.abs(K-U)*.1,Math.abs(D-$)*.1,Math.PI/10*M.wobble));else if(M.shape.type==="bitmap"){var E=Math.PI/10*M.wobble,Z=Math.abs(K-U)*.1,B=Math.abs(D-$)*.1,Y=M.shape.bitmap.width*M.scalar,ae=M.shape.bitmap.height*M.scalar,ee=new DOMMatrix([Math.cos(E)*Z,Math.sin(E)*Z,-Math.sin(E)*B,Math.cos(E)*B,M.x,M.y]);ee.multiplySelf(new DOMMatrix(M.shape.matrix));var se=P.createPattern(u.transform(M.shape.bitmap),"no-repeat");se.setTransform(ee),P.globalAlpha=1-R,P.fillStyle=se,P.fillRect(M.x-Y/2,M.y-ae/2,Y,ae),P.globalAlpha=1}else if(M.shape==="circle")P.ellipse?P.ellipse(M.x,M.y,Math.abs(K-U)*M.ovalScalar,Math.abs(D-$)*M.ovalScalar,Math.PI/10*M.wobble,0,2*Math.PI):I(P,M.x,M.y,Math.abs(K-U)*M.ovalScalar,Math.abs(D-$)*M.ovalScalar,Math.PI/10*M.wobble,0,2*Math.PI);else if(M.shape==="star")for(var V=Math.PI/2*3,ie=4*M.scalar,pe=8*M.scalar,ue=M.x,ve=M.y,Q=5,ge=Math.PI/Q;Q--;)ue=M.x+Math.cos(V)*pe,ve=M.y+Math.sin(V)*pe,P.lineTo(ue,ve),V+=ge,ue=M.x+Math.cos(V)*ie,ve=M.y+Math.sin(V)*ie,P.lineTo(ue,ve),V+=ge;else P.moveTo(Math.floor(M.x),Math.floor(M.y)),P.lineTo(Math.floor(M.wobbleX),Math.floor($)),P.lineTo(Math.floor(K),Math.floor(D)),P.lineTo(Math.floor(U),Math.floor(M.wobbleY));return P.closePath(),P.fill(),M.tick<M.totalTicks}function L(P,M,R,U,$){var K=M.slice(),D=P.getContext("2d"),E,Z,B=d(function(Y){function ae(){E=Z=null,D.clearRect(0,0,U.width,U.height),u.clear(),$(),Y()}function ee(){n&&!(U.width===s.width&&U.height===s.height)&&(U.width=P.width=s.width,U.height=P.height=s.height),!U.width&&!U.height&&(R(P),U.width=P.width,U.height=P.height),D.clearRect(0,0,U.width,U.height),K=K.filter(function(se){return O(D,se)}),K.length?E=f.frame(ee):ae()}E=f.frame(ee),Z=ae});return{addFettis:function(Y){return K=K.concat(Y),B},canvas:P,promise:B,reset:function(){E&&f.cancel(E),Z&&Z()}}}function F(P,M){var R=!P,U=!!v(M||{},"resize"),$=!1,K=v(M,"disableForReducedMotion",Boolean),D=i&&!!v(M||{},"useWorker"),E=D?m():null,Z=R?C:_,B=P&&E?!!P.__confetti_initialized:!1,Y=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion)").matches,ae;function ee(V,ie,pe){for(var ue=v(V,"particleCount",y),ve=v(V,"angle",Number),Q=v(V,"spread",Number),ge=v(V,"startVelocity",Number),De=v(V,"decay",Number),Ue=v(V,"gravity",Number),Be=v(V,"drift",Number),Ve=v(V,"colors",w),ut=v(V,"ticks",Number),Ke=v(V,"shapes"),Ze=v(V,"scalar"),tr=!!v(V,"flat"),Ir=b(V),rr=ue,yr=[],nr=P.width*Ir.x,yt=P.height*Ir.y;rr--;)yr.push(A({x:nr,y:yt,angle:ve,spread:Q,startVelocity:ge,color:Ve[rr%Ve.length],shape:Ke[j(0,Ke.length)],ticks:ut,decay:De,gravity:Ue,drift:Be,scalar:Ze,flat:tr}));return ae?ae.addFettis(yr):(ae=L(P,yr,Z,ie,pe),ae.promise)}function se(V){var ie=K||v(V,"disableForReducedMotion",Boolean),pe=v(V,"zIndex",Number);if(ie&&Y)return d(function(ge){ge()});R&&ae?P=ae.canvas:R&&!P&&(P=S(pe),document.body.appendChild(P)),U&&!B&&Z(P);var ue={width:P.width,height:P.height};E&&!B&&E.init(P),B=!0,E&&(P.__confetti_initialized=!0);function ve(){if(E){var ge={getBoundingClientRect:function(){if(!R)return P.getBoundingClientRect()}};Z(ge),E.postMessage({resize:{width:ge.width,height:ge.height}});return}ue.width=ue.height=null}function Q(){ae=null,U&&($=!1,t.removeEventListener("resize",ve)),R&&P&&(document.body.contains(P)&&document.body.removeChild(P),P=null,B=!1)}return U&&!$&&($=!0,t.addEventListener("resize",ve,!1)),E?E.fire(V,ue,Q):ee(V,ue,Q)}return se.reset=function(){E&&E.reset(),ae&&ae.reset()},se}var X;function T(){return X||(X=F(null,{useWorker:!0,resize:!0})),X}function G(P,M,R,U,$,K,D){var E=new Path2D(P),Z=new Path2D;Z.addPath(E,new DOMMatrix(M));var B=new Path2D;return B.addPath(Z,new DOMMatrix([Math.cos(D)*$,Math.sin(D)*$,-Math.sin(D)*K,Math.cos(D)*K,R,U])),B}function re(P){if(!o)throw new Error("path confetti are not supported in this browser");var M,R;typeof P=="string"?M=P:(M=P.path,R=P.matrix);var U=new Path2D(M),$=document.createElement("canvas"),K=$.getContext("2d");if(!R){for(var D=1e3,E=D,Z=D,B=0,Y=0,ae,ee,se=0;se<D;se+=2)for(var V=0;V<D;V+=2)K.isPointInPath(U,se,V,"nonzero")&&(E=Math.min(E,se),Z=Math.min(Z,V),B=Math.max(B,se),Y=Math.max(Y,V));ae=B-E,ee=Y-Z;var ie=10,pe=Math.min(ie/ae,ie/ee);R=[pe,0,0,pe,-Math.round(ae/2+E)*pe,-Math.round(ee/2+Z)*pe]}return{type:"path",path:M,matrix:R}}function J(P){var M,R=1,U="#000000",$='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';typeof P=="string"?M=P:(M=P.text,R="scalar"in P?P.scalar:R,$="fontFamily"in P?P.fontFamily:$,U="color"in P?P.color:U);var K=10*R,D=""+K+"px "+$,E=new OffscreenCanvas(K,K),Z=E.getContext("2d");Z.font=D;var B=Z.measureText(M),Y=Math.ceil(B.actualBoundingBoxRight+B.actualBoundingBoxLeft),ae=Math.ceil(B.actualBoundingBoxAscent+B.actualBoundingBoxDescent),ee=2,se=B.actualBoundingBoxLeft+ee,V=B.actualBoundingBoxAscent+ee;Y+=ee+ee,ae+=ee+ee,E=new OffscreenCanvas(Y,ae),Z=E.getContext("2d"),Z.font=D,Z.fillStyle=U,Z.fillText(M,se,V);var ie=1/R;return{type:"bitmap",bitmap:E.transferToImageBitmap(),matrix:[ie,0,0,ie,-Y*ie/2,-ae*ie/2]}}r.exports=function(){return T().apply(this,arguments)},r.exports.reset=function(){T().reset()},r.exports.create=F,r.exports.shapeFromPath=re,r.exports.shapeFromText=J})(function(){return typeof window<"u"?window:typeof self<"u"?self:this||{}}(),Nx,!1);const o4=Nx.exports;Nx.exports.create;function Mm(e,t){var n;const r={};for(const s of t)r[s.key]=[];for(const s of e)if(r[s.status]!==void 0)r[s.status].push(s);else{const i=((n=t[0])==null?void 0:n.key)??"backlog";r[i]=[...r[i]??[],s]}return r}function l4(e,t,r){var i;const n=new Map(t.map(o=>[o.id,o])),s={};for(const o of r)s[o.key]=[];for(const o of r)for(const l of e[o.key]??[]){const c=n.get(l.id);c&&c.status===o.key&&(s[o.key].push(c),n.delete(l.id))}for(const o of n.values()){const l=s[o.status];if(l)l.push(o);else{const c=(i=r[0])==null?void 0:i.key;c&&s[c].push(o)}}return s}function KN({issues:e,projectId:t,statuses:r,onIssueClick:n,onColumnsReorder:s,readOnly:i=!1,filters:o}){var K;const[l,c]=h.useState(()=>r.map(D=>D.id)),[d,u]=h.useState(()=>Mm(e,r)),[f,m]=h.useState(null),[p,x]=h.useState(null),[g,v]=h.useState(null),[y,j]=h.useState(null),[N,w]=h.useState(""),k=h.useRef(null),b=h.useRef(!1),C=Se(),_=Tt.byProject(t,o),S=HI(t),I=qI(t,y??""),A=h.useMemo(()=>{const D=new Map;for(const E of e)E.parent_id&&D.set(E.parent_id,(D.get(E.parent_id)??0)+1);return D},[e]);h.useEffect(()=>{c(D=>{const E=new Set(r.map(Y=>Y.id)),Z=D.filter(Y=>E.has(Y)),B=r.map(Y=>Y.id).filter(Y=>!D.includes(Y));return Z.length===D.length&&B.length===0?D:[...Z,...B]})},[r]),h.useEffect(()=>{b.current||u(D=>l4(D,e,r))},[e,r]);const O=[...r].sort((D,E)=>{const Z=l.indexOf(D.id),B=l.indexOf(E.id);return Z===-1&&B===-1?D.position-E.position:Z===-1?1:B===-1?-1:Z-B}),L=i1(Up(o1,i?{activationConstraint:{distance:1/0}}:{activationConstraint:{distance:5}})),F=h.useCallback(D=>{if(p){const Z=D.droppableContainers.filter(B=>l.includes(B.id));return pE({...D,droppableContainers:Z})}const E=xE(D);return E.length>0?E:gE(D)},[p,l]),X=h.useCallback(D=>{for(const[E,Z]of Object.entries(d))if(Z.some(B=>B.id===D))return E;return null},[d]),T=h.useCallback(D=>r.some(E=>E.id===D),[r]),G=D=>{const E=D.active.id;if(b.current=!0,T(E)){x(E);return}for(const[Z,B]of Object.entries(d)){const Y=B.find(ae=>ae.id===E);if(Y){m(Y),k.current=Z;return}}},re=D=>{const{active:E,over:Z}=D;if(!Z||p)return;const B=E.id,Y=Z.id;if(T(B))return;const ae=X(B),ee=r.find(V=>V.key===Y||V.id===Y),se=(ee==null?void 0:ee.key)??X(Y);!ae||!se||ae===se||u(V=>{const ie=[...V[ae]??[]],pe=[...V[se]??[]],ue=ie.findIndex(ge=>ge.id===B);if(ue===-1)return V;const[ve]=ie.splice(ue,1),Q={...ve,status:se};if(ee)pe.push(Q);else{const ge=pe.findIndex(De=>De.id===Y);if(ge===-1)pe.push(Q);else{const De=E.rect.current.translated!=null&&E.rect.current.translated.top>Z.rect.top+Z.rect.height/2;pe.splice(De?ge+1:ge,0,Q)}}return{...V,[ae]:ie,[se]:pe}})},J=D=>{var V;const{active:E,over:Z}=D;if(m(null),p){if(x(null),b.current=!1,!Z||E.id===Z.id)return;const ie=l.indexOf(E.id),pe=l.indexOf(Z.id);if(ie===-1||pe===-1||ie===pe)return;const ue=pd(l,ie,pe);c(ue),s==null||s(ue);return}if(!Z){b.current=!1;const ie=k.current;k.current=null,ie&&u(Mm(e,r));return}const B=E.id,Y=Z.id,ae=k.current;k.current=null;const ee=r.find(ie=>ie.key===Y||ie.id===Y),se=(ee==null?void 0:ee.key)??X(Y);if(!ae||!se){b.current=!1;return}if(ae===se)b.current=!1,u(ie=>{const pe=ie[ae]??[],ue=pe.findIndex(Q=>Q.id===B),ve=pe.findIndex(Q=>Q.id===Y);return ue===-1||ve===-1||ue===ve?ie:{...ie,[ae]:pd(pe,ue,ve)}});else{if(!r.find(ue=>ue.key===Y||ue.id===Y))u(ue=>{const ve=[...ue[se]??[]],Q=ve.findIndex(Ve=>Ve.id===B);if(Q===-1)return ue;const ge=D.active.rect.current.translated!=null&&D.active.rect.current.translated.top>D.over.rect.top+D.over.rect.height/2,[De]=ve.splice(Q,1),Ue=ve.findIndex(Ve=>Ve.id===Y);if(Ue===-1)return ve.splice(Q,0,De),ue;const Be=ge?Ue+1:Ue;return ve.splice(Be,0,De),{...ue,[se]:ve}});else{const ue=((V=D.active.rect.current.translated)==null?void 0:V.top)??1/0,ve=D.over.rect.top+D.over.rect.height/2;ue<ve&&u(Q=>{const ge=Q[se]??[],De=ge.findIndex(Ue=>Ue.id===B);return De<=0?Q:{...Q,[se]:pd(ge,De,0)}})}const pe=C.getQueryData(_);C.cancelQueries({queryKey:_}),C.setQueryData(_,ue=>ue&&{...ue,issues:ue.issues.map(ve=>ve.id===B?{...ve,status:se}:ve)}),oe.put(`/admin/issues/${B}`,{status:se}).then(()=>{b.current=!1,C.invalidateQueries({queryKey:_});const ue=r.find(ve=>ve.key===se);(ue==null?void 0:ue.category)==="completed"&&o4({particleCount:80,spread:60,origin:{y:.6}})}).catch(()=>{b.current=!1,pe&&C.setQueryData(_,pe),u(Mm((pe==null?void 0:pe.issues)??e,r)),H.error("Failed to update issue status")})}},P=D=>{v(D)},M=async D=>{if(!g)return;const E=d[g.key]??[];if(E.length>0){const Z=r.find(B=>B.id===D);if(!Z)return;try{await Promise.all(E.map(B=>oe.put(`/admin/issues/${B.id}`,{status:Z.key}))),C.invalidateQueries({queryKey:Tt.byProject(t)})}catch{H.error("Failed to move issues");return}}S.mutate(g.id,{onSuccess:()=>{H.success(`Status "${g.name}" deleted`),v(null)},onError:()=>H.error("Failed to delete status")})},R=()=>{const D=N.trim();!D||!y||I.mutate({name:D},{onSuccess:()=>{H.success("Status renamed"),j(null)},onError:()=>H.error("Failed to rename status")})},U=()=>{j(null)},$=p?r.find(D=>D.id===p):null;return a.jsxs(xl,{sensors:L,collisionDetection:F,onDragStart:G,onDragOver:re,onDragEnd:J,children:[a.jsxs("div",{className:"flex gap-4 min-h-full overflow-x-auto px-6 py-4 pb-6",children:[a.jsx(qp,{items:l,strategy:l1,children:O.map(D=>a.jsx(r4,{id:D.id,label:D.name,color:D.color,category:D.category,issues:d[D.key]??[],childCounts:A,sortable:!0,onIssueClick:n,onRename:i?void 0:()=>{j(D.id),w(D.name)},onDelete:i?void 0:()=>P(D),isRenaming:y===D.id,renameValue:y===D.id?N:"",onRenameChange:w,onRenameSubmit:R,onRenameCancel:U},D.id))}),!i&&a.jsx(s4,{projectId:t})]}),a.jsxs(vE,{children:[f&&a.jsx(HN,{issue:f}),$&&a.jsx("div",{className:"opacity-80 min-w-[260px] max-w-[280px]",children:a.jsxs("div",{className:"h-9 flex items-center gap-2 px-3 rounded-xl border border-border bg-background text-xs font-medium text-foreground",children:[a.jsx("div",{className:"h-3 w-3 rounded-full shrink-0",style:{backgroundColor:$.color}}),$.name]})})]}),g&&a.jsx(i4,{open:!!g,statusName:g.name,issueCount:((K=d[g.key])==null?void 0:K.length)??0,otherStatuses:r.filter(D=>D.id!==g.id),onConfirm:M,onCancel:()=>v(null),isLoading:S.isPending})]})}const Ot=BP,Pt=WP,_t=h.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},s)=>a.jsx(FP,{children:a.jsx(e1,{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=e1.displayName;const c4=[{value:"urgent",label:"Urgent"},{value:"high",label:"High"},{value:"medium",label:"Medium"},{value:"low",label:"Low"},{value:"none",label:"None"}],d4=[{value:"bug",label:"Bug"},{value:"feature",label:"Feature"},{value:"task",label:"Task"},{value:"epic",label:"Epic"},{value:"story",label:"Story"}];function Uc({label:e,activeCount:t,children:r}){const[n,s]=h.useState(!1);return a.jsxs(Ot,{open:n,onOpenChange:s,children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{className:z("inline-flex items-center gap-1.5 h-7 px-2.5 rounded-md border text-xs font-medium transition-colors",t>0?"border-foreground/30 bg-foreground/5 text-foreground":"border-border text-muted-foreground hover:text-foreground hover:bg-muted"),children:[e,t>0&&a.jsx("span",{className:"flex items-center justify-center h-4 w-4 rounded-full bg-foreground text-background text-[10px] font-semibold",children:t}),a.jsx(ia,{className:"h-3 w-3 opacity-60"})]})}),a.jsx(_t,{className:"w-48 p-1",align:"start",children:r})]})}function Om({options:e,selected:t,onToggle:r}){return a.jsx("div",{className:"flex flex-col gap-0.5",children:e.map(n=>{const s=t.includes(n.value);return a.jsxs("button",{onClick:()=>r(n.value),className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs hover:bg-muted w-full text-left",children:[a.jsx("div",{className:z("h-3.5 w-3.5 rounded border flex items-center justify-center shrink-0",s?"bg-foreground border-foreground":"border-border"),children:s&&a.jsx(dr,{className:"h-2.5 w-2.5 text-background"})}),n.color&&a.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:n.color}}),a.jsx("span",{className:"truncate",children:n.label})]},n.value)})})}function u4({statuses:e,members:t,filters:r,onChange:n}){var c,d,u,f,m,p,x;const s=(((c=r.priority)==null?void 0:c.length)??0)>0||!!r.assignee_id||(((d=r.type)==null?void 0:d.length)??0)>0||(((u=r.status)==null?void 0:u.length)??0)>0,i=(g,v)=>{const y=r[g]??[],j=y.includes(v)?y.filter(N=>N!==v):[...y,v];n({...r,[g]:j.length?j:void 0})},o=g=>{n({...r,assignee_id:r.assignee_id===g?void 0:g})},l=r.assignee_id?((f=t.find(g=>g.userId===r.assignee_id))==null?void 0:f.name)??"Assignee":"Assignee";return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Uc,{label:r.assignee_id?l:"Assignee",activeCount:r.assignee_id?1:0,children:a.jsxs("div",{className:"flex flex-col gap-0.5",children:[t.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground px-2 py-1.5",children:"No members"}),t.map(g=>{const v=r.assignee_id===g.userId;return a.jsxs("button",{onClick:()=>o(g.userId),className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs hover:bg-muted w-full text-left",children:[a.jsx("div",{className:z("h-3.5 w-3.5 rounded border flex items-center justify-center shrink-0",v?"bg-foreground border-foreground":"border-border"),children:v&&a.jsx(dr,{className:"h-2.5 w-2.5 text-background"})}),a.jsx("span",{className:"h-5 w-5 rounded-full bg-muted flex items-center justify-center text-[10px] font-medium shrink-0",children:g.initials}),a.jsx("span",{className:"truncate",children:g.name})]},g.userId)})]})}),a.jsx(Uc,{label:"Priority",activeCount:((m=r.priority)==null?void 0:m.length)??0,children:a.jsx(Om,{options:c4,selected:r.priority??[],onToggle:g=>i("priority",g)})}),a.jsx(Uc,{label:"Type",activeCount:((p=r.type)==null?void 0:p.length)??0,children:a.jsx(Om,{options:d4,selected:r.type??[],onToggle:g=>i("type",g)})}),a.jsx(Uc,{label:"Status",activeCount:((x=r.status)==null?void 0:x.length)??0,children:a.jsx(Om,{options:e.map(g=>({value:g.key,label:g.name,color:g.color})),selected:r.status??[],onToggle:g=>i("status",g)})}),s&&a.jsxs("button",{onClick:()=>n({}),className:"inline-flex items-center gap-1 h-7 px-2 rounded text-xs text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[a.jsx(tt,{className:"h-3 w-3"}),"Clear"]})]})}const f4={mon:!0,tue:!0,wed:!0,thu:!0,fri:!0,sat:!1,sun:!1};function kx(){return Fe({queryKey:["org","calendar"],queryFn:()=>oe.get("/admin/org/calendar"),select:e=>({working_days:e.working_days??f4,timezone:e.timezone})})}function m4(){const e=Se();return be({mutationFn:t=>oe.put("/admin/org/calendar",t),onSuccess:()=>{e.invalidateQueries({queryKey:["org","calendar"]})}})}function Sx(e){const t=e??new Date().getFullYear();return Fe({queryKey:["org","holidays",t],queryFn:()=>oe.get(`/admin/org/holidays?year=${t}`),select:r=>r.holidays})}function h4(){const e=Se();return be({mutationFn:t=>oe.post("/admin/org/holidays",t),onSuccess:()=>{e.invalidateQueries({queryKey:["org","holidays"]})}})}function p4(){const e=Se();return be({mutationFn:({id:t,...r})=>oe.put(`/admin/org/holidays/${t}`,r),onSuccess:()=>{e.invalidateQueries({queryKey:["org","holidays"]})}})}function x4(){const e=Se();return be({mutationFn:t=>oe.delete(`/admin/org/holidays/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:["org","holidays"]})}})}function g4(){return Fe({queryKey:["app-config"],queryFn:()=>oe.get("/admin/config"),staleTime:1/0})}const v4=["sun","mon","tue","wed","thu","fri","sat"];function y4(e,t,r){const n=v4[AI(e)];if(!t[n])return!1;const s=gd(e),i=gl(e);for(const o of r){const l=new Date(o.date);if(o.recurring){if(gd(l)===s&&gl(l)===i)return!1}else if(l.getFullYear()===e.getFullYear()&&gd(l)===s&&gl(l)===i)return!1}return!0}function Mh(e,t,r,n){let s=0,i=new Date(e);i.setHours(0,0,0,0);const o=new Date(t);for(o.setHours(0,0,0,0);i<=o;)y4(i,r,n)&&s++,i=Ur(i,1);return s}const Ji={all:["sprints"],byProject:e=>["sprints","project",e],detail:e=>["sprints",e]};function So(e){return Fe({queryKey:e?Ji.byProject(e):Ji.all,queryFn:()=>{const t=e?`/admin/sprints?project_id=${e}`:"/admin/sprints";return oe.get(t)},select:t=>t.sprints,enabled:!!e})}function b4(e){const t=Se();return be({mutationFn:r=>oe.post("/admin/sprints",{...r,project_id:e}),onSuccess:()=>{t.invalidateQueries({queryKey:Ji.byProject(e)})}})}function w4(e,t){const r=Se();return be({mutationFn:n=>oe.put(`/admin/sprints/${e}`,n),onSuccess:()=>{r.invalidateQueries({queryKey:Ji.byProject(t)}),r.invalidateQueries({queryKey:Ji.detail(e)})}})}function j4(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/sprints/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:Ji.byProject(e)})}})}const rf={byProject:e=>["task-lists","project",e]};function fc(e){return Fe({queryKey:e?rf.byProject(e):["task-lists"],queryFn:()=>oe.get(`/admin/projects/${e}/task-lists`),select:t=>t.task_lists,enabled:!!e})}function N4(e){const t=Se();return be({mutationFn:r=>oe.post(`/admin/projects/${e}/task-lists`,r),onSuccess:()=>{t.invalidateQueries({queryKey:rf.byProject(e)})}})}function k4(e){const t=Se();return be({mutationFn:({id:r,...n})=>oe.put(`/admin/task-lists/${r}`,n),onSuccess:()=>{t.invalidateQueries({queryKey:rf.byProject(e)})}})}function S4(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/task-lists/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:rf.byProject(e)}),t.invalidateQueries({queryKey:Tt.byProject(e)})}})}function py(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 xy(e,t,r){return`${e??""} ${t??""}`.trim()||r}function mc({value:e,onChange:t,disabled:r,users:n}){const[s,i]=h.useState(!1),[o,l]=h.useState(e),{data:c}=qN(),d=n??c??[],u=e.slice().sort().join(",");h.useEffect(()=>{l(e)},[u]);const f=p=>{const x=o.includes(p)?o.filter(g=>g!==p):[...o,p];l(x),t(x)},m=d.filter(p=>o.includes(p.id));return a.jsxs(Ot,{open:s,onOpenChange:i,children:[a.jsx(Pt,{asChild:!0,disabled:r,children:a.jsx("button",{type:"button",className:z("flex items-center gap-1 min-h-[28px] rounded-md px-1.5 py-1","hover:bg-accent transition-colors text-left","focus:outline-none focus-visible:ring-1 focus-visible:ring-ring",r&&"pointer-events-none opacity-50"),children:m.length===0?a.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[a.jsx(po,{className:"h-3.5 w-3.5"}),"Assign"]}):a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("div",{className:"flex -space-x-1.5",children:m.slice(0,3).map(p=>a.jsx(Rt,{className:"h-5 w-5 border border-background ring-0",children:a.jsx($t,{className:"text-[9px] bg-indigo-100 text-indigo-700 dark:bg-indigo-900/50 dark:text-indigo-300",children:py(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?xy(m[0].first_name,m[0].last_name,m[0].email):`${m.length} assignees`})]})})}),a.jsx(_t,{className:"w-60 p-0",align:"start",children:a.jsxs(Xs,{children:[a.jsx(Qu,{placeholder:"Search users...",className:"h-8 text-xs"}),a.jsxs(Qs,{children:[a.jsx(Zu,{className:"text-xs py-4",children:"No users found."}),a.jsx(cs,{children:d.map(p=>{const x=o.includes(p.id),g=xy(p.first_name,p.last_name,p.email),v=py(p.first_name,p.last_name,p.email);return a.jsxs(un,{value:g,onSelect:()=>f(p.id),className:"gap-2 py-1.5",children:[a.jsx(Rt,{className:"h-5 w-5 shrink-0",children:a.jsx($t,{className:"text-[9px] bg-muted text-muted-foreground",children:v})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-xs font-medium truncate",children:g}),a.jsx("p",{className:"text-[10px] text-muted-foreground truncate",children:p.email})]}),a.jsx(dr,{className:z("h-3.5 w-3.5 shrink-0",x?"opacity-100 text-indigo-500":"opacity-0")})]},p.id)})})]})]})})]})}function C4(e,t,r="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:r}).format(t).split(/\s/g).slice(2).join(" ")}const Pm={},dl={};function Hs(e,t){try{const n=(Pm[e]||(Pm[e]=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format))(t).split("GMT")[1];return n in dl?dl[n]:gy(n,n.split(":"))}catch{if(e in dl)return dl[e];const r=e==null?void 0:e.match(_4);return r?gy(e,r.slice(1)):NaN}}const _4=/([+-]\d\d):?(\d\d)?/;function gy(e,t){const r=+(t[0]||0),n=+(t[1]||0),s=+(t[2]||0)/60;return dl[e]=r*60+n>0?r*60+n+s:r*60-n-s}class Yn extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(Hs(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),YN(this),Oh(this)):this.setTime(Date.now())}static tz(t,...r){return r.length?new Yn(...r,t):new Yn(Date.now(),t)}withTimeZone(t){return new Yn(+this,t)}getTimezoneOffset(){const t=-Hs(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),Oh(this),+this}[Symbol.for("constructDateFrom")](t){return new Yn(+new Date(t),this.timeZone)}}const vy=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!vy.test(e))return;const t=e.replace(vy,"$1UTC");Yn.prototype[t]&&(e.startsWith("get")?Yn.prototype[e]=function(){return this.internal[t]()}:(Yn.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),M4(this),+this},Yn.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),Oh(this),+this}))});function Oh(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-Hs(e.timeZone,e)*60))}function M4(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),YN(e)}function YN(e){const t=Hs(e.timeZone,e),r=t>0?Math.floor(t):Math.ceil(t),n=new Date(+e);n.setUTCHours(n.getUTCHours()-1);const s=-new Date(+e).getTimezoneOffset(),i=-new Date(+n).getTimezoneOffset(),o=s-i,l=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();o&&l&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+o);const c=s-r;c&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+c);const d=new Date(+e);d.setUTCSeconds(0);const u=s>0?d.getSeconds():(d.getSeconds()-60)%60,f=Math.round(-(Hs(e.timeZone,e)*60))%60;(f||u)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+f),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+f+u));const m=Hs(e.timeZone,e),p=m>0?Math.floor(m):Math.ceil(m),g=-new Date(+e).getTimezoneOffset()-p,v=p!==r,y=g-c;if(v&&y){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+y);const j=Hs(e.timeZone,e),N=j>0?Math.floor(j):Math.ceil(j),w=p-N;w&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+w),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+w))}}class pr extends Yn{static tz(t,...r){return r.length?new pr(...r,t):new pr(Date.now(),t)}toISOString(){const[t,r,n]=this.tzComponents(),s=`${t}${r}:${n}`;return this.internal.toISOString().slice(0,-1)+s}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,r,n,s]=this.internal.toUTCString().split(" ");return`${t==null?void 0:t.slice(0,-1)} ${n} ${r} ${s}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[r,n,s]=this.tzComponents();return`${t} GMT${r}${n}${s} (${C4(this.timeZone,this)})`}toLocaleString(t,r){return Date.prototype.toLocaleString.call(this,t,{...r,timeZone:(r==null?void 0:r.timeZone)||this.timeZone})}toLocaleDateString(t,r){return Date.prototype.toLocaleDateString.call(this,t,{...r,timeZone:(r==null?void 0:r.timeZone)||this.timeZone})}toLocaleTimeString(t,r){return Date.prototype.toLocaleTimeString.call(this,t,{...r,timeZone:(r==null?void 0:r.timeZone)||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),r=t>0?"-":"+",n=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),s=String(Math.abs(t)%60).padStart(2,"0");return[r,n,s]}withTimeZone(t){return new pr(+this,t)}[Symbol.for("constructDateFrom")](t){return new pr(+new Date(t),this.timeZone)}}const yy=5,O4=4;function P4(e,t){const r=t.startOfMonth(e),n=r.getDay()>0?r.getDay():7,s=t.addDays(e,-n+1),i=t.addDays(s,yy*7-1);return t.getMonth(e)===t.getMonth(i)?yy:O4}function GN(e,t){const r=t.startOfMonth(e),n=r.getDay();return n===1?r:n===0?t.addDays(r,-1*6):t.addDays(r,-1*(n-1))}function E4(e,t){const r=GN(e,t),n=P4(e,t);return t.addDays(r,n*7-1)}const VN={...Ws,labels:{labelDayButton:(e,t,r,n)=>{let s;n&&typeof n.format=="function"?s=n.format.bind(n):s=(o,l)=>fe(o,l,{locale:Ws,...r});let i=s(e,"PPPP");return t.today&&(i=`Today, ${i}`),t.selected&&(i=`${i}, selected`),i},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:e=>`Week ${e}`,labelYearDropdown:"Choose the Year",labelGrid:(e,t,r)=>{let n;return r&&typeof r.format=="function"?n=r.format.bind(r):n=(s,i)=>fe(s,i,{locale:Ws,...t}),n(e,"LLLL yyyy")},labelGridcell:(e,t,r,n)=>{let s;n&&typeof n.format=="function"?s=n.format.bind(n):s=(o,l)=>fe(o,l,{locale:Ws,...r});let i=s(e,"PPPP");return t!=null&&t.today&&(i=`Today, ${i}`),i},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(e,t,r)=>{let n;return r&&typeof r.format=="function"?n=r.format.bind(r):n=(s,i)=>fe(s,i,{locale:Ws,...t}),n(e,"cccc")}}};class nn{constructor(t,r){this.Date=Date,this.today=()=>{var n;return(n=this.overrides)!=null&&n.today?this.overrides.today():this.options.timeZone?pr.tz(this.options.timeZone):new this.Date},this.newDate=(n,s,i)=>{var o;return(o=this.overrides)!=null&&o.newDate?this.overrides.newDate(n,s,i):this.options.timeZone?new pr(n,s,i,this.options.timeZone):new Date(n,s,i)},this.addDays=(n,s)=>{var i;return(i=this.overrides)!=null&&i.addDays?this.overrides.addDays(n,s):Ur(n,s)},this.addMonths=(n,s)=>{var i;return(i=this.overrides)!=null&&i.addMonths?this.overrides.addMonths(n,s):gx(n,s)},this.addWeeks=(n,s)=>{var i;return(i=this.overrides)!=null&&i.addWeeks?this.overrides.addWeeks(n,s):N3(n,s)},this.addYears=(n,s)=>{var i;return(i=this.overrides)!=null&&i.addYears?this.overrides.addYears(n,s):k3(n,s)},this.differenceInCalendarDays=(n,s)=>{var i;return(i=this.overrides)!=null&&i.differenceInCalendarDays?this.overrides.differenceInCalendarDays(n,s):ef(n,s)},this.differenceInCalendarMonths=(n,s)=>{var i;return(i=this.overrides)!=null&&i.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(n,s):yx(n,s)},this.eachMonthOfInterval=n=>{var s;return(s=this.overrides)!=null&&s.eachMonthOfInterval?this.overrides.eachMonthOfInterval(n):A3(n)},this.eachYearOfInterval=n=>{var l;const s=(l=this.overrides)!=null&&l.eachYearOfInterval?this.overrides.eachYearOfInterval(n):T3(n),i=new Set(s.map(c=>this.getYear(c)));if(i.size===s.length)return s;const o=[];return i.forEach(c=>{o.push(new Date(c,0,1))}),o},this.endOfBroadcastWeek=n=>{var s;return(s=this.overrides)!=null&&s.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(n):E4(n,this)},this.endOfISOWeek=n=>{var s;return(s=this.overrides)!=null&&s.endOfISOWeek?this.overrides.endOfISOWeek(n):I3(n)},this.endOfMonth=n=>{var s;return(s=this.overrides)!=null&&s.endOfMonth?this.overrides.endOfMonth(n):bx(n)},this.endOfWeek=(n,s)=>{var i;return(i=this.overrides)!=null&&i.endOfWeek?this.overrides.endOfWeek(n,s):LN(n,this.options)},this.endOfYear=n=>{var s;return(s=this.overrides)!=null&&s.endOfYear?this.overrides.endOfYear(n):D3(n)},this.format=(n,s,i)=>{var l;const o=(l=this.overrides)!=null&&l.format?this.overrides.format(n,s,this.options):fe(n,s,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(o):o},this.getISOWeek=n=>{var s;return(s=this.overrides)!=null&&s.getISOWeek?this.overrides.getISOWeek(n):wx(n)},this.getMonth=(n,s)=>{var i;return(i=this.overrides)!=null&&i.getMonth?this.overrides.getMonth(n,this.options):gd(n,this.options)},this.getYear=(n,s)=>{var i;return(i=this.overrides)!=null&&i.getYear?this.overrides.getYear(n,this.options):DI(n,this.options)},this.getWeek=(n,s)=>{var i;return(i=this.overrides)!=null&&i.getWeek?this.overrides.getWeek(n,this.options):jx(n,this.options)},this.isAfter=(n,s)=>{var i;return(i=this.overrides)!=null&&i.isAfter?this.overrides.isAfter(n,s):TI(n,s)},this.isBefore=(n,s)=>{var i;return(i=this.overrides)!=null&&i.isBefore?this.overrides.isBefore(n,s):II(n,s)},this.isDate=n=>{var s;return(s=this.overrides)!=null&&s.isDate?this.overrides.isDate(n):EN(n)},this.isSameDay=(n,s)=>{var i;return(i=this.overrides)!=null&&i.isSameDay?this.overrides.isSameDay(n,s):Zi(n,s)},this.isSameMonth=(n,s)=>{var i;return(i=this.overrides)!=null&&i.isSameMonth?this.overrides.isSameMonth(n,s):RI(n,s)},this.isSameYear=(n,s)=>{var i;return(i=this.overrides)!=null&&i.isSameYear?this.overrides.isSameYear(n,s):$I(n,s)},this.max=n=>{var s;return(s=this.overrides)!=null&&s.max?this.overrides.max(n):S3(n)},this.min=n=>{var s;return(s=this.overrides)!=null&&s.min?this.overrides.min(n):C3(n)},this.setMonth=(n,s)=>{var i;return(i=this.overrides)!=null&&i.setMonth?this.overrides.setMonth(n,s):FI(n,s)},this.setYear=(n,s)=>{var i;return(i=this.overrides)!=null&&i.setYear?this.overrides.setYear(n,s):BI(n,s)},this.startOfBroadcastWeek=(n,s)=>{var i;return(i=this.overrides)!=null&&i.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(n,this):GN(n,this)},this.startOfDay=n=>{var s;return(s=this.overrides)!=null&&s.startOfDay?this.overrides.startOfDay(n):Qi(n)},this.startOfISOWeek=n=>{var s;return(s=this.overrides)!=null&&s.startOfISOWeek?this.overrides.startOfISOWeek(n):Nl(n)},this.startOfMonth=n=>{var s;return(s=this.overrides)!=null&&s.startOfMonth?this.overrides.startOfMonth(n):$N(n)},this.startOfWeek=(n,s)=>{var i;return(i=this.overrides)!=null&&i.startOfWeek?this.overrides.startOfWeek(n,this.options):Xi(n,this.options)},this.startOfYear=n=>{var s;return(s=this.overrides)!=null&&s.startOfYear?this.overrides.startOfYear(n):zN(n)},this.options={locale:VN,...t},this.overrides=r}getDigitMap(){const{numerals:t="latn"}=this.options,r=new Intl.NumberFormat("en-US",{numberingSystem:t}),n={};for(let s=0;s<10;s++)n[s.toString()]=r.format(s);return n}replaceDigits(t){const r=this.getDigitMap();return t.replace(/\d/g,n=>r[n]||n)}formatNumber(t){return this.replaceDigits(t.toString())}getMonthYearOrder(){var r;const t=(r=this.options.locale)==null?void 0:r.code;return t&&nn.yearFirstLocales.has(t)?"year-first":"month-first"}formatMonthYear(t){const{locale:r,timeZone:n,numerals:s}=this.options,i=r==null?void 0:r.code;if(i&&nn.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:n,numberingSystem:s}).format(t)}catch{}const o=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(t,o)}}nn.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const ua=new nn;class XN{constructor(t,r,n=ua){this.date=t,this.displayMonth=r,this.outside=!!(r&&!n.isSameMonth(t,r)),this.dateLib=n,this.isoDate=n.format(t,"yyyy-MM-dd"),this.displayMonthId=n.format(r,"yyyy-MM"),this.dateMonthId=n.format(t,"yyyy-MM")}isEqualTo(t){return this.dateLib.isSameDay(t.date,this.date)&&this.dateLib.isSameMonth(t.displayMonth,this.displayMonth)}}class A4{constructor(t,r){this.date=t,this.weeks=r}}class D4{constructor(t,r){this.days=r,this.weekNumber=t}}function T4(e){return W.createElement("button",{...e})}function I4(e){return W.createElement("span",{...e})}function R4(e){const{size:t=24,orientation:r="left",className:n}=e;return W.createElement("svg",{className:n,width:t,height:t,viewBox:"0 0 24 24"},r==="up"&&W.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),r==="down"&&W.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),r==="left"&&W.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),r==="right"&&W.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function $4(e){const{day:t,modifiers:r,...n}=e;return W.createElement("td",{...n})}function z4(e){const{day:t,modifiers:r,...n}=e,s=W.useRef(null);return W.useEffect(()=>{var i;r.focused&&((i=s.current)==null||i.focus())},[r.focused]),W.createElement("button",{ref:s,...n})}var Me;(function(e){e.Root="root",e.Chevron="chevron",e.Day="day",e.DayButton="day_button",e.CaptionLabel="caption_label",e.Dropdowns="dropdowns",e.Dropdown="dropdown",e.DropdownRoot="dropdown_root",e.Footer="footer",e.MonthGrid="month_grid",e.MonthCaption="month_caption",e.MonthsDropdown="months_dropdown",e.Month="month",e.Months="months",e.Nav="nav",e.NextMonthButton="button_next",e.PreviousMonthButton="button_previous",e.Week="week",e.Weeks="weeks",e.Weekday="weekday",e.Weekdays="weekdays",e.WeekNumber="week_number",e.WeekNumberHeader="week_number_header",e.YearsDropdown="years_dropdown"})(Me||(Me={}));var jt;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(jt||(jt={}));var Cn;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(Cn||(Cn={}));var Qr;(function(e){e.weeks_before_enter="weeks_before_enter",e.weeks_before_exit="weeks_before_exit",e.weeks_after_enter="weeks_after_enter",e.weeks_after_exit="weeks_after_exit",e.caption_after_enter="caption_after_enter",e.caption_after_exit="caption_after_exit",e.caption_before_enter="caption_before_enter",e.caption_before_exit="caption_before_exit"})(Qr||(Qr={}));function L4(e){const{options:t,className:r,components:n,classNames:s,...i}=e,o=[s[Me.Dropdown],r].join(" "),l=t==null?void 0:t.find(({value:c})=>c===i.value);return W.createElement("span",{"data-disabled":i.disabled,className:s[Me.DropdownRoot]},W.createElement(n.Select,{className:o,...i},t==null?void 0:t.map(({value:c,label:d,disabled:u})=>W.createElement(n.Option,{key:c,value:c,disabled:u},d))),W.createElement("span",{className:s[Me.CaptionLabel],"aria-hidden":!0},l==null?void 0:l.label,W.createElement(n.Chevron,{orientation:"down",size:18,className:s[Me.Chevron]})))}function F4(e){return W.createElement("div",{...e})}function B4(e){return W.createElement("div",{...e})}function W4(e){const{calendarMonth:t,displayIndex:r,...n}=e;return W.createElement("div",{...n},e.children)}function U4(e){const{calendarMonth:t,displayIndex:r,...n}=e;return W.createElement("div",{...n})}function q4(e){return W.createElement("table",{...e})}function H4(e){return W.createElement("div",{...e})}const QN=h.createContext(void 0);function hc(){const e=h.useContext(QN);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function K4(e){const{components:t}=hc();return W.createElement(t.Dropdown,{...e})}function Y4(e){const{onPreviousClick:t,onNextClick:r,previousMonth:n,nextMonth:s,...i}=e,{components:o,classNames:l,labels:{labelPrevious:c,labelNext:d}}=hc(),u=h.useCallback(m=>{s&&(r==null||r(m))},[s,r]),f=h.useCallback(m=>{n&&(t==null||t(m))},[n,t]);return W.createElement("nav",{...i},W.createElement(o.PreviousMonthButton,{type:"button",className:l[Me.PreviousMonthButton],tabIndex:n?void 0:-1,"aria-disabled":n?void 0:!0,"aria-label":c(n),onClick:f},W.createElement(o.Chevron,{disabled:n?void 0:!0,className:l[Me.Chevron],orientation:"left"})),W.createElement(o.NextMonthButton,{type:"button",className:l[Me.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":d(s),onClick:u},W.createElement(o.Chevron,{disabled:s?void 0:!0,orientation:"right",className:l[Me.Chevron]})))}function G4(e){const{components:t}=hc();return W.createElement(t.Button,{...e})}function V4(e){return W.createElement("option",{...e})}function X4(e){const{components:t}=hc();return W.createElement(t.Button,{...e})}function Q4(e){const{rootRef:t,...r}=e;return W.createElement("div",{...r,ref:t})}function Z4(e){return W.createElement("select",{...e})}function J4(e){const{week:t,...r}=e;return W.createElement("tr",{...r})}function eR(e){return W.createElement("th",{...e})}function tR(e){return W.createElement("thead",{"aria-hidden":!0},W.createElement("tr",{...e}))}function rR(e){const{week:t,...r}=e;return W.createElement("th",{...r})}function nR(e){return W.createElement("th",{...e})}function aR(e){return W.createElement("tbody",{...e})}function sR(e){const{components:t}=hc();return W.createElement(t.Dropdown,{...e})}const iR=Object.freeze(Object.defineProperty({__proto__:null,Button:T4,CaptionLabel:I4,Chevron:R4,Day:$4,DayButton:z4,Dropdown:L4,DropdownNav:F4,Footer:B4,Month:W4,MonthCaption:U4,MonthGrid:q4,Months:H4,MonthsDropdown:K4,Nav:Y4,NextMonthButton:G4,Option:V4,PreviousMonthButton:X4,Root:Q4,Select:Z4,Week:J4,WeekNumber:rR,WeekNumberHeader:nR,Weekday:eR,Weekdays:tR,Weeks:aR,YearsDropdown:sR},Symbol.toStringTag,{value:"Module"}));function wa(e,t,r=!1,n=ua){let{from:s,to:i}=e;const{differenceInCalendarDays:o,isSameDay:l}=n;return s&&i?(o(i,s)<0&&([s,i]=[i,s]),o(t,s)>=(r?1:0)&&o(i,t)>=(r?1:0)):!r&&i?l(i,t):!r&&s?l(s,t):!1}function Cx(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function nf(e){return!!(e&&typeof e=="object"&&"from"in e)}function _x(e){return!!(e&&typeof e=="object"&&"after"in e)}function Mx(e){return!!(e&&typeof e=="object"&&"before"in e)}function ZN(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function JN(e,t){return Array.isArray(e)&&e.every(t.isDate)}function ja(e,t,r=ua){const n=Array.isArray(t)?t:[t],{isSameDay:s,differenceInCalendarDays:i,isAfter:o}=r;return n.some(l=>{if(typeof l=="boolean")return l;if(r.isDate(l))return s(e,l);if(JN(l,r))return l.some(c=>s(e,c));if(nf(l))return wa(l,e,!1,r);if(ZN(l))return Array.isArray(l.dayOfWeek)?l.dayOfWeek.includes(e.getDay()):l.dayOfWeek===e.getDay();if(Cx(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 _x(l)?i(e,l.after)>0:Mx(l)?i(l.before,e)>0:typeof l=="function"?l(e):!1})}function oR(e,t,r,n,s){const{disabled:i,hidden:o,modifiers:l,showOutsideDays:c,broadcastCalendar:d,today:u=s.today()}=t,{isSameDay:f,isSameMonth:m,startOfMonth:p,isBefore:x,endOfMonth:g,isAfter:v}=s,y=r&&p(r),j=n&&g(n),N={[jt.focused]:[],[jt.outside]:[],[jt.disabled]:[],[jt.hidden]:[],[jt.today]:[]},w={};for(const k of e){const{date:b,displayMonth:C}=k,_=!!(C&&!m(b,C)),S=!!(y&&x(b,y)),I=!!(j&&v(b,j)),A=!!(i&&ja(b,i,s)),O=!!(o&&ja(b,o,s))||S||I||!d&&!c&&_||d&&c===!1&&_,L=f(b,u);_&&N.outside.push(k),A&&N.disabled.push(k),O&&N.hidden.push(k),L&&N.today.push(k),l&&Object.keys(l).forEach(F=>{const X=l==null?void 0:l[F];X&&ja(b,X,s)&&(w[F]?w[F].push(k):w[F]=[k])})}return k=>{const b={[jt.focused]:!1,[jt.disabled]:!1,[jt.hidden]:!1,[jt.outside]:!1,[jt.today]:!1},C={};for(const _ in N){const S=N[_];b[_]=S.some(I=>I===k)}for(const _ in w)C[_]=w[_].some(S=>S===k);return{...b,...C}}}function lR(e,t,r={}){return Object.entries(e).filter(([,s])=>s===!0).reduce((s,[i])=>(r[i]?s.push(r[i]):t[jt[i]]?s.push(t[jt[i]]):t[Cn[i]]&&s.push(t[Cn[i]]),s),[t[Me.Day]])}function cR(e){return{...iR,...e}}function dR(e){const t={"data-mode":e.mode??void 0,"data-required":"required"in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([r,n])=>{r.startsWith("data-")&&(t[r]=n)}),t}function uR(){const e={};for(const t in Me)e[Me[t]]=`rdp-${Me[t]}`;for(const t in jt)e[jt[t]]=`rdp-${jt[t]}`;for(const t in Cn)e[Cn[t]]=`rdp-${Cn[t]}`;for(const t in Qr)e[Qr[t]]=`rdp-${Qr[t]}`;return e}function ek(e,t,r){return(r??new nn(t)).formatMonthYear(e)}const fR=ek;function mR(e,t,r){return(r??new nn(t)).format(e,"d")}function hR(e,t=ua){return t.format(e,"LLLL")}function pR(e,t,r){return(r??new nn(t)).format(e,"cccccc")}function xR(e,t=ua){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function gR(){return""}function tk(e,t=ua){return t.format(e,"yyyy")}const vR=tk,yR=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:ek,formatDay:mR,formatMonthCaption:fR,formatMonthDropdown:hR,formatWeekNumber:xR,formatWeekNumberHeader:gR,formatWeekdayName:pR,formatYearCaption:vR,formatYearDropdown:tk},Symbol.toStringTag,{value:"Module"}));function bR(e){return e!=null&&e.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e!=null&&e.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...yR,...e}}function Ox(e,t,r,n){let s=(n??new nn(r)).format(e,"PPPP");return t.today&&(s=`Today, ${s}`),t.selected&&(s=`${s}, selected`),s}const wR=Ox;function Px(e,t,r){return(r??new nn(t)).formatMonthYear(e)}const jR=Px;function rk(e,t,r,n){let s=(n??new nn(r)).format(e,"PPPP");return t!=null&&t.today&&(s=`Today, ${s}`),s}function nk(e){return"Choose the Month"}function ak(){return""}const NR="Go to the Next Month";function sk(e,t){return NR}function ik(e){return"Go to the Previous Month"}function ok(e,t,r){return(r??new nn(t)).format(e,"cccc")}function lk(e,t){return`Week ${e}`}function ck(e){return"Week Number"}function dk(e){return"Choose the Year"}const kR=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:jR,labelDay:wR,labelDayButton:Ox,labelGrid:Px,labelGridcell:rk,labelMonthDropdown:nk,labelNav:ak,labelNext:sk,labelPrevious:ik,labelWeekNumber:lk,labelWeekNumberHeader:ck,labelWeekday:ok,labelYearDropdown:dk},Symbol.toStringTag,{value:"Module"})),bn=(e,t,r)=>t||(r?typeof r=="function"?r:(...n)=>r:e);function SR(e,t){var n;const r=((n=t.locale)==null?void 0:n.labels)??{};return{...kR,...e??{},labelDayButton:bn(Ox,e==null?void 0:e.labelDayButton,r.labelDayButton),labelMonthDropdown:bn(nk,e==null?void 0:e.labelMonthDropdown,r.labelMonthDropdown),labelNext:bn(sk,e==null?void 0:e.labelNext,r.labelNext),labelPrevious:bn(ik,e==null?void 0:e.labelPrevious,r.labelPrevious),labelWeekNumber:bn(lk,e==null?void 0:e.labelWeekNumber,r.labelWeekNumber),labelYearDropdown:bn(dk,e==null?void 0:e.labelYearDropdown,r.labelYearDropdown),labelGrid:bn(Px,e==null?void 0:e.labelGrid,r.labelGrid),labelGridcell:bn(rk,e==null?void 0:e.labelGridcell,r.labelGridcell),labelNav:bn(ak,e==null?void 0:e.labelNav,r.labelNav),labelWeekNumberHeader:bn(ck,e==null?void 0:e.labelWeekNumberHeader,r.labelWeekNumberHeader),labelWeekday:bn(ok,e==null?void 0:e.labelWeekday,r.labelWeekday)}}function CR(e,t,r,n,s){const{startOfMonth:i,startOfYear:o,endOfYear:l,eachMonthOfInterval:c,getMonth:d}=s;return c({start:o(e),end:l(e)}).map(m=>{const p=n.formatMonthDropdown(m,s),x=d(m),g=t&&m<i(t)||r&&m>i(r)||!1;return{value:x,label:p,disabled:g}})}function _R(e,t={},r={}){let n={...t==null?void 0:t[Me.Day]};return Object.entries(e).filter(([,s])=>s===!0).forEach(([s])=>{n={...n,...r==null?void 0:r[s]}}),n}function MR(e,t,r,n){const s=n??e.today(),i=r?e.startOfBroadcastWeek(s,e):t?e.startOfISOWeek(s):e.startOfWeek(s),o=[];for(let l=0;l<7;l++){const c=e.addDays(i,l);o.push(c)}return o}function OR(e,t,r,n,s=!1){if(!e||!t)return;const{startOfYear:i,endOfYear:o,eachYearOfInterval:l,getYear:c}=n,d=i(e),u=o(t),f=l({start:d,end:u});return s&&f.reverse(),f.map(m=>{const p=r.formatYearDropdown(m,n);return{value:c(m),label:p,disabled:!1}})}function PR(e,t={}){var l;const{weekStartsOn:r,locale:n}=t,s=r??((l=n==null?void 0:n.options)==null?void 0:l.weekStartsOn)??0,i=c=>{const d=typeof c=="number"||typeof c=="string"?new Date(c):c;return new pr(d.getFullYear(),d.getMonth(),d.getDate(),12,0,0,e)},o=c=>{const d=i(c);return new Date(d.getFullYear(),d.getMonth(),d.getDate(),0,0,0,0)};return{today:()=>i(pr.tz(e)),newDate:(c,d,u)=>new pr(c,d,u,12,0,0,e),startOfDay:c=>i(c),startOfWeek:(c,d)=>{const u=i(c),f=(d==null?void 0:d.weekStartsOn)??s,m=(u.getDay()-f+7)%7;return u.setDate(u.getDate()-m),u},startOfISOWeek:c=>{const d=i(c),u=(d.getDay()-1+7)%7;return d.setDate(d.getDate()-u),d},startOfMonth:c=>{const d=i(c);return d.setDate(1),d},startOfYear:c=>{const d=i(c);return d.setMonth(0,1),d},endOfWeek:(c,d)=>{const u=i(c),p=((((d==null?void 0:d.weekStartsOn)??s)+6)%7-u.getDay()+7)%7;return u.setDate(u.getDate()+p),u},endOfISOWeek:c=>{const d=i(c),u=(7-d.getDay())%7;return d.setDate(d.getDate()+u),d},endOfMonth:c=>{const d=i(c);return d.setMonth(d.getMonth()+1,0),d},endOfYear:c=>{const d=i(c);return d.setMonth(11,31),d},eachMonthOfInterval:c=>{const d=i(c.start),u=i(c.end),f=[],m=new pr(d.getFullYear(),d.getMonth(),1,12,0,0,e),p=u.getFullYear()*12+u.getMonth();for(;m.getFullYear()*12+m.getMonth()<=p;)f.push(new pr(m,e)),m.setMonth(m.getMonth()+1,1);return f},addDays:(c,d)=>{const u=i(c);return u.setDate(u.getDate()+d),u},addWeeks:(c,d)=>{const u=i(c);return u.setDate(u.getDate()+d*7),u},addMonths:(c,d)=>{const u=i(c);return u.setMonth(u.getMonth()+d),u},addYears:(c,d)=>{const u=i(c);return u.setFullYear(u.getFullYear()+d),u},eachYearOfInterval:c=>{const d=i(c.start),u=i(c.end),f=[],m=new pr(d.getFullYear(),0,1,12,0,0,e);for(;m.getFullYear()<=u.getFullYear();)f.push(new pr(m,e)),m.setFullYear(m.getFullYear()+1,0,1);return f},getWeek:(c,d)=>{var f;const u=o(c);return jx(u,{weekStartsOn:(d==null?void 0:d.weekStartsOn)??s,firstWeekContainsDate:(d==null?void 0:d.firstWeekContainsDate)??((f=n==null?void 0:n.options)==null?void 0:f.firstWeekContainsDate)??1})},getISOWeek:c=>{const d=o(c);return wx(d)},differenceInCalendarDays:(c,d)=>{const u=o(c),f=o(d);return ef(u,f)},differenceInCalendarMonths:(c,d)=>{const u=o(c),f=o(d);return yx(u,f)}}}const pc=e=>e instanceof HTMLElement?e:null,Em=e=>[...e.querySelectorAll("[data-animated-month]")??[]],ER=e=>pc(e.querySelector("[data-animated-month]")),Am=e=>pc(e.querySelector("[data-animated-caption]")),Dm=e=>pc(e.querySelector("[data-animated-weeks]")),AR=e=>pc(e.querySelector("[data-animated-nav]")),DR=e=>pc(e.querySelector("[data-animated-weekdays]"));function TR(e,t,{classNames:r,months:n,focused:s,dateLib:i}){const o=h.useRef(null),l=h.useRef(n),c=h.useRef(!1);h.useLayoutEffect(()=>{const d=l.current;if(l.current=n,!t||!e.current||!(e.current instanceof HTMLElement)||n.length===0||d.length===0||n.length!==d.length)return;const u=i.isSameMonth(n[0].date,d[0].date),f=i.isAfter(n[0].date,d[0].date),m=f?r[Qr.caption_after_enter]:r[Qr.caption_before_enter],p=f?r[Qr.weeks_after_enter]:r[Qr.weeks_before_enter],x=o.current,g=e.current.cloneNode(!0);if(g instanceof HTMLElement?(Em(g).forEach(N=>{if(!(N instanceof HTMLElement))return;const w=ER(N);w&&N.contains(w)&&N.removeChild(w);const k=Am(N);k&&k.classList.remove(m);const b=Dm(N);b&&b.classList.remove(p)}),o.current=g):o.current=null,c.current||u||s)return;const v=x instanceof HTMLElement?Em(x):[],y=Em(e.current);if(y!=null&&y.every(j=>j instanceof HTMLElement)&&v&&v.every(j=>j instanceof HTMLElement)){c.current=!0,e.current.style.isolation="isolate";const j=AR(e.current);j&&(j.style.zIndex="1"),y.forEach((N,w)=>{const k=v[w];if(!k)return;N.style.position="relative",N.style.overflow="hidden";const b=Am(N);b&&b.classList.add(m);const C=Dm(N);C&&C.classList.add(p);const _=()=>{c.current=!1,e.current&&(e.current.style.isolation=""),j&&(j.style.zIndex=""),b&&b.classList.remove(m),C&&C.classList.remove(p),N.style.position="",N.style.overflow="",N.contains(k)&&N.removeChild(k)};k.style.pointerEvents="none",k.style.position="absolute",k.style.overflow="hidden",k.setAttribute("aria-hidden","true");const S=DR(k);S&&(S.style.opacity="0");const I=Am(k);I&&(I.classList.add(f?r[Qr.caption_before_exit]:r[Qr.caption_after_exit]),I.addEventListener("animationend",_));const A=Dm(k);A&&A.classList.add(f?r[Qr.weeks_before_exit]:r[Qr.weeks_after_exit]),N.insertBefore(k,N.firstChild)})}})}function IR(e,t,r,n){const s=e[0],i=e[e.length-1],{ISOWeek:o,fixedWeeks:l,broadcastCalendar:c}=r??{},{addDays:d,differenceInCalendarDays:u,differenceInCalendarMonths:f,endOfBroadcastWeek:m,endOfISOWeek:p,endOfMonth:x,endOfWeek:g,isAfter:v,startOfBroadcastWeek:y,startOfISOWeek:j,startOfWeek:N}=n,w=c?y(s,n):o?j(s):N(s),k=c?m(i):o?p(x(i)):g(x(i)),b=t&&(c?m(t):o?p(t):g(t)),C=b&&v(k,b)?b:k,_=u(C,w),S=f(i,s)+1,I=[];for(let L=0;L<=_;L++){const F=d(w,L);I.push(F)}const O=(c?35:42)*S;if(l&&I.length<O){const L=O-I.length;for(let F=0;F<L;F++){const X=d(I[I.length-1],1);I.push(X)}}return I}function RR(e){const t=[];return e.reduce((r,n)=>{const s=n.weeks.reduce((i,o)=>i.concat(o.days.slice()),t.slice());return r.concat(s.slice())},t.slice())}function $R(e,t,r,n){const{numberOfMonths:s=1}=r,i=[];for(let o=0;o<s;o++){const l=n.addMonths(e,o);if(t&&l>t)break;i.push(l)}return i}function by(e,t,r,n){const{month:s,defaultMonth:i,today:o=n.today(),numberOfMonths:l=1}=e;let c=s||i||o;const{differenceInCalendarMonths:d,addMonths:u,startOfMonth:f}=n;if(r&&d(r,c)<l-1){const m=-1*(l-1);c=u(r,m)}return t&&d(c,t)<0&&(c=t),f(c)}function zR(e,t,r,n){const{addDays:s,endOfBroadcastWeek:i,endOfISOWeek:o,endOfMonth:l,endOfWeek:c,getISOWeek:d,getWeek:u,startOfBroadcastWeek:f,startOfISOWeek:m,startOfWeek:p}=n,x=e.reduce((g,v)=>{const y=r.broadcastCalendar?f(v,n):r.ISOWeek?m(v):p(v),j=r.broadcastCalendar?i(v):r.ISOWeek?o(l(v)):c(l(v)),N=t.filter(C=>C>=y&&C<=j),w=r.broadcastCalendar?35:42;if(r.fixedWeeks&&N.length<w){const C=t.filter(_=>{const S=w-N.length;return _>j&&_<=s(j,S)});N.push(...C)}const k=N.reduce((C,_)=>{const S=r.ISOWeek?d(_):u(_),I=C.find(O=>O.weekNumber===S),A=new XN(_,v,n);return I?I.days.push(A):C.push(new D4(S,[A])),C},[]),b=new A4(v,k);return g.push(b),g},[]);return r.reverseMonths?x.reverse():x}function LR(e,t){let{startMonth:r,endMonth:n}=e;const{startOfYear:s,startOfDay:i,startOfMonth:o,endOfMonth:l,addYears:c,endOfYear:d,newDate:u,today:f}=t,{fromYear:m,toYear:p,fromMonth:x,toMonth:g}=e;!r&&x&&(r=x),!r&&m&&(r=t.newDate(m,0,1)),!n&&g&&(n=g),!n&&p&&(n=u(p,11,31));const v=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return r?r=o(r):m?r=u(m,0,1):!r&&v&&(r=s(c(e.today??f(),-100))),n?n=l(n):p?n=u(p,11,31):!n&&v&&(n=d(e.today??f())),[r&&i(r),n&&i(n)]}function FR(e,t,r,n){if(r.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i=1}=r,{startOfMonth:o,addMonths:l,differenceInCalendarMonths:c}=n,d=s?i:1,u=o(e);if(!t)return l(u,d);if(!(c(t,e)<i))return l(u,d)}function BR(e,t,r,n){if(r.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i}=r,{startOfMonth:o,addMonths:l,differenceInCalendarMonths:c}=n,d=s?i??1:1,u=o(e);if(!t)return l(u,-d);if(!(c(u,t)<=0))return l(u,-d)}function WR(e){const t=[];return e.reduce((r,n)=>r.concat(n.weeks.slice()),t.slice())}function af(e,t){const[r,n]=h.useState(e);return[t===void 0?r:t,n]}function UR(e,t){var w;const[r,n]=LR(e,t),{startOfMonth:s,endOfMonth:i}=t,o=by(e,r,n,t),[l,c]=af(o,e.month?o:void 0);h.useEffect(()=>{const k=by(e,r,n,t);c(k)},[e.timeZone]);const{months:d,weeks:u,days:f,previousMonth:m,nextMonth:p}=h.useMemo(()=>{const k=$R(l,n,{numberOfMonths:e.numberOfMonths},t),b=IR(k,e.endMonth?i(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),C=zR(k,b,{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t),_=WR(C),S=RR(C),I=BR(l,r,e,t),A=FR(l,n,e,t);return{months:C,weeks:_,days:S,previousMonth:I,nextMonth:A}},[t,l.getTime(),n==null?void 0:n.getTime(),r==null?void 0:r.getTime(),e.disableNavigation,e.broadcastCalendar,(w=e.endMonth)==null?void 0:w.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:x,onMonthChange:g}=e,v=k=>u.some(b=>b.days.some(C=>C.isEqualTo(k))),y=k=>{if(x)return;let b=s(k);r&&b<s(r)&&(b=s(r)),n&&b>s(n)&&(b=s(n)),c(b),g==null||g(b)};return{months:d,weeks:u,days:f,navStart:r,navEnd:n,previousMonth:m,nextMonth:p,goToMonth:y,goToDay:k=>{v(k)||y(k.date)}}}var Hn;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(Hn||(Hn={}));function wy(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);wy(l)&&(l[jt.focused]&&i<Hn.FocusedModifier?(s=o,i=Hn.FocusedModifier):n!=null&&n.isEqualTo(o)&&i<Hn.LastFocused?(s=o,i=Hn.LastFocused):r(o.date)&&i<Hn.Selected?(s=o,i=Hn.Selected):l[jt.today]&&i<Hn.Today&&(s=o,i=Hn.Today))}return s||(s=e.find(o=>wy(t(o)))),s}function HR(e,t,r,n,s,i,o){const{ISOWeek:l,broadcastCalendar:c}=i,{addDays:d,addMonths:u,addWeeks:f,addYears:m,endOfBroadcastWeek:p,endOfISOWeek:x,endOfWeek:g,max:v,min:y,startOfBroadcastWeek:j,startOfISOWeek:N,startOfWeek:w}=o;let b={day:d,week:f,month:u,year:m,startOfWeek:C=>c?j(C,o):l?N(C):w(C),endOfWeek:C=>c?p(C):l?x(C):g(C)}[e](r,t==="after"?1:-1);return t==="before"&&n?b=v([n,b]):t==="after"&&s&&(b=y([s,b])),b}function uk(e,t,r,n,s,i,o,l=0){if(l>365)return;const c=HR(e,t,r.date,n,s,i,o),d=!!(i.disabled&&ja(c,i.disabled,o)),u=!!(i.hidden&&ja(c,i.hidden,o)),f=c,m=new XN(c,f,o);return!d&&!u?m:uk(e,t,m,n,s,i,o,l+1)}function KR(e,t,r,n,s){const{autoFocus:i}=e,[o,l]=h.useState(),c=qR(t.days,r,n||(()=>!1),o),[d,u]=h.useState(i?c:void 0);return{isFocusTarget:g=>!!(c!=null&&c.isEqualTo(g)),setFocused:u,focused:d,blur:()=>{l(d),u(void 0)},moveFocus:(g,v)=>{if(!d)return;const y=uk(g,v,d,t.navStart,t.navEnd,e,s);y&&(e.disableNavigation&&!t.days.some(N=>N.isEqualTo(y))||(t.goToDay(y),u(y)))}}}function YR(e,t){const{selected:r,required:n,onSelect:s}=e,[i,o]=af(r,s?r:void 0),l=s?r:i,{isSameDay:c}=t,d=p=>(l==null?void 0:l.some(x=>c(x,p)))??!1,{min:u,max:f}=e;return{selected:l,select:(p,x,g)=>{let v=[...l??[]];if(d(p)){if((l==null?void 0:l.length)===u||n&&(l==null?void 0:l.length)===1)return;v=l==null?void 0:l.filter(y=>!c(y,p))}else(l==null?void 0:l.length)===f?v=[p]:v=[...v,p];return s||o(v),s==null||s(v,p,x,g),v},isSelected:d}}function GR(e,t,r=0,n=0,s=!1,i=ua){const{from:o,to:l}=t||{},{isSameDay:c,isAfter:d,isBefore:u}=i;let f;if(!o&&!l)f={from:e,to:r>0?void 0:e};else if(o&&!l)c(o,e)?r===0?f={from:o,to:e}:s?f={from:o,to:void 0}:f=void 0:u(e,o)?f={from:e,to:o}:f={from:o,to:e};else if(o&&l)if(c(o,e)&&c(l,e))s?f={from:o,to:l}:f=void 0;else if(c(o,e))f={from:o,to:r>0?void 0:e};else if(c(l,e))f={from:e,to:r>0?void 0:e};else if(u(e,o))f={from:e,to:l};else if(d(e,o))f={from:o,to:e};else if(d(e,l))f={from:o,to:e};else throw new Error("Invalid range");if(f!=null&&f.from&&(f!=null&&f.to)){const m=i.differenceInCalendarDays(f.to,f.from);n>0&&m>n?f={from:e,to:void 0}:r>1&&m<r&&(f={from:e,to:void 0})}return f}function VR(e,t,r=ua){const n=Array.isArray(t)?t:[t];let s=e.from;const i=r.differenceInCalendarDays(e.to,e.from),o=Math.min(i,6);for(let l=0;l<=o;l++){if(n.includes(s.getDay()))return!0;s=r.addDays(s,1)}return!1}function jy(e,t,r=ua){return wa(e,t.from,!1,r)||wa(e,t.to,!1,r)||wa(t,e.from,!1,r)||wa(t,e.to,!1,r)}function XR(e,t,r=ua){const n=Array.isArray(t)?t:[t];if(n.filter(l=>typeof l!="function").some(l=>typeof l=="boolean"?l:r.isDate(l)?wa(e,l,!1,r):JN(l,r)?l.some(c=>wa(e,c,!1,r)):nf(l)?l.from&&l.to?jy(e,{from:l.from,to:l.to},r):!1:ZN(l)?VR(e,l.dayOfWeek,r):Cx(l)?r.isAfter(l.before,l.after)?jy(e,{from:r.addDays(l.after,1),to:r.addDays(l.before,-1)},r):ja(e.from,l,r)||ja(e.to,l,r):_x(l)||Mx(l)?ja(e.from,l,r)||ja(e.to,l,r):!1))return!0;const o=n.filter(l=>typeof l=="function");if(o.length){let l=e.from;const c=r.differenceInCalendarDays(e.to,e.from);for(let d=0;d<=c;d++){if(o.some(u=>u(l)))return!0;l=r.addDays(l,1)}}return!1}function QR(e,t){const{disabled:r,excludeDisabled:n,selected:s,required:i,onSelect:o}=e,[l,c]=af(s,o?s:void 0),d=o?s:l;return{selected:d,select:(m,p,x)=>{const{min:g,max:v}=e,y=m?GR(m,d,g,v,i,t):void 0;return n&&r&&(y!=null&&y.from)&&y.to&&XR({from:y.from,to:y.to},r,t)&&(y.from=m,y.to=void 0),o||c(y),o==null||o(y,m,p,x),y},isSelected:m=>d&&wa(d,m,!1,t)}}function ZR(e,t){const{selected:r,required:n,onSelect:s}=e,[i,o]=af(r,s?r:void 0),l=s?r:i,{isSameDay:c}=t;return{selected:l,select:(f,m,p)=>{let x=f;return!n&&l&&l&&c(f,l)&&(x=void 0),s||o(x),s==null||s(x,f,m,p),x},isSelected:f=>l?c(l,f):!1}}function JR(e,t){const r=ZR(e,t),n=YR(e,t),s=QR(e,t);switch(e.mode){case"single":return r;case"multiple":return n;case"range":return s;default:return}}function dn(e,t){return e instanceof pr&&e.timeZone===t?e:new pr(e,t)}function Ai(e,t,r){return dn(e,t)}function Ny(e,t,r){return typeof e=="boolean"||typeof e=="function"?e:e instanceof Date?Ai(e,t):Array.isArray(e)?e.map(n=>n instanceof Date?Ai(n,t):n):nf(e)?{...e,from:e.from?dn(e.from,t):e.from,to:e.to?dn(e.to,t):e.to}:Cx(e)?{before:Ai(e.before,t),after:Ai(e.after,t)}:_x(e)?{after:Ai(e.after,t)}:Mx(e)?{before:Ai(e.before,t)}:e}function Tm(e,t,r){return e&&(Array.isArray(e)?e.map(n=>Ny(n,t)):Ny(e,t))}function e$(e){var Oe;let t=e;const r=t.timeZone;if(r&&(t={...e,timeZone:r},t.today&&(t.today=dn(t.today,r)),t.month&&(t.month=dn(t.month,r)),t.defaultMonth&&(t.defaultMonth=dn(t.defaultMonth,r)),t.startMonth&&(t.startMonth=dn(t.startMonth,r)),t.endMonth&&(t.endMonth=dn(t.endMonth,r)),t.mode==="single"&&t.selected?t.selected=dn(t.selected,r):t.mode==="multiple"&&t.selected?t.selected=(Oe=t.selected)==null?void 0:Oe.map(xe=>dn(xe,r)):t.mode==="range"&&t.selected&&(t.selected={from:t.selected.from?dn(t.selected.from,r):t.selected.from,to:t.selected.to?dn(t.selected.to,r):t.selected.to}),t.disabled!==void 0&&(t.disabled=Tm(t.disabled,r)),t.hidden!==void 0&&(t.hidden=Tm(t.hidden,r)),t.modifiers)){const xe={};Object.keys(t.modifiers).forEach(Ne=>{var he;xe[Ne]=Tm((he=t.modifiers)==null?void 0:he[Ne],r)}),t.modifiers=xe}const{components:n,formatters:s,labels:i,dateLib:o,locale:l,classNames:c}=h.useMemo(()=>{const xe={...VN,...t.locale},Ne=t.broadcastCalendar?1:t.weekStartsOn,he=t.noonSafe&&t.timeZone?PR(t.timeZone,{weekStartsOn:Ne,locale:xe}):void 0,ye=t.dateLib&&he?{...he,...t.dateLib}:t.dateLib??he,Xe=new nn({locale:xe,weekStartsOn:Ne,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},ye);return{dateLib:Xe,components:cR(t.components),formatters:bR(t.formatters),labels:SR(t.labels,Xe.options),locale:xe,classNames:{...uR(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.noonSafe,t.components,t.formatters,t.labels,t.classNames]);t.today||(t={...t,today:o.today()});const{captionLayout:d,mode:u,navLayout:f,numberOfMonths:m=1,onDayBlur:p,onDayClick:x,onDayFocus:g,onDayKeyDown:v,onDayMouseEnter:y,onDayMouseLeave:j,onNextClick:N,onPrevClick:w,showWeekNumber:k,styles:b}=t,{formatCaption:C,formatDay:_,formatMonthDropdown:S,formatWeekNumber:I,formatWeekNumberHeader:A,formatWeekdayName:O,formatYearDropdown:L}=s,F=UR(t,o),{days:X,months:T,navStart:G,navEnd:re,previousMonth:J,nextMonth:P,goToMonth:M}=F,R=oR(X,t,G,re,o),{isSelected:U,select:$,selected:K}=JR(t,o)??{},{blur:D,focused:E,isFocusTarget:Z,moveFocus:B,setFocused:Y}=KR(t,F,R,U??(()=>!1),o),{labelDayButton:ae,labelGridcell:ee,labelGrid:se,labelMonthDropdown:V,labelNav:ie,labelPrevious:pe,labelNext:ue,labelWeekday:ve,labelWeekNumber:Q,labelWeekNumberHeader:ge,labelYearDropdown:De}=i,Ue=h.useMemo(()=>MR(o,t.ISOWeek,t.broadcastCalendar,t.today),[o,t.ISOWeek,t.broadcastCalendar,t.today]),Be=u!==void 0||x!==void 0,Ve=h.useCallback(()=>{J&&(M(J),w==null||w(J))},[J,M,w]),ut=h.useCallback(()=>{P&&(M(P),N==null||N(P))},[M,P,N]),Ke=h.useCallback((xe,Ne)=>he=>{he.preventDefault(),he.stopPropagation(),Y(xe),!Ne.disabled&&($==null||$(xe.date,Ne,he),x==null||x(xe.date,Ne,he))},[$,x,Y]),Ze=h.useCallback((xe,Ne)=>he=>{Y(xe),g==null||g(xe.date,Ne,he)},[g,Y]),tr=h.useCallback((xe,Ne)=>he=>{D(),p==null||p(xe.date,Ne,he)},[D,p]),Ir=h.useCallback((xe,Ne)=>he=>{const ye={ArrowLeft:[he.shiftKey?"month":"day",t.dir==="rtl"?"after":"before"],ArrowRight:[he.shiftKey?"month":"day",t.dir==="rtl"?"before":"after"],ArrowDown:[he.shiftKey?"year":"week","after"],ArrowUp:[he.shiftKey?"year":"week","before"],PageUp:[he.shiftKey?"year":"month","before"],PageDown:[he.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(ye[he.key]){he.preventDefault(),he.stopPropagation();const[Xe,de]=ye[he.key];B(Xe,de)}v==null||v(xe.date,Ne,he)},[B,v,t.dir]),rr=h.useCallback((xe,Ne)=>he=>{y==null||y(xe.date,Ne,he)},[y]),yr=h.useCallback((xe,Ne)=>he=>{j==null||j(xe.date,Ne,he)},[j]),nr=h.useCallback(xe=>Ne=>{const he=Number(Ne.target.value),ye=o.setMonth(o.startOfMonth(xe),he);M(ye)},[o,M]),yt=h.useCallback(xe=>Ne=>{const he=Number(Ne.target.value),ye=o.setYear(o.startOfMonth(xe),he);M(ye)},[o,M]),{className:Lt,style:Kt}=h.useMemo(()=>({className:[c[Me.Root],t.className].filter(Boolean).join(" "),style:{...b==null?void 0:b[Me.Root],...t.style}}),[c,t.className,t.style,b]),ar=dR(t),$n=h.useRef(null);TR($n,!!t.animate,{classNames:c,months:T,focused:E,dateLib:o});const fa={dayPickerProps:t,selected:K,select:$,isSelected:U,months:T,nextMonth:P,previousMonth:J,goToMonth:M,getModifiers:R,components:n,classNames:c,styles:b,labels:i,formatters:s};return W.createElement(QN.Provider,{value:fa},W.createElement(n.Root,{rootRef:t.animate?$n:void 0,className:Lt,style:Kt,dir:t.dir,id:t.id,lang:t.lang,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t["aria-label"],"aria-labelledby":t["aria-labelledby"],...ar},W.createElement(n.Months,{className:c[Me.Months],style:b==null?void 0:b[Me.Months]},!t.hideNavigation&&!f&&W.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:c[Me.Nav],style:b==null?void 0:b[Me.Nav],"aria-label":ie(),onPreviousClick:Ve,onNextClick:ut,previousMonth:J,nextMonth:P}),T.map((xe,Ne)=>W.createElement(n.Month,{"data-animated-month":t.animate?"true":void 0,className:c[Me.Month],style:b==null?void 0:b[Me.Month],key:Ne,displayIndex:Ne,calendarMonth:xe},f==="around"&&!t.hideNavigation&&Ne===0&&W.createElement(n.PreviousMonthButton,{type:"button",className:c[Me.PreviousMonthButton],tabIndex:J?void 0:-1,"aria-disabled":J?void 0:!0,"aria-label":pe(J),onClick:Ve,"data-animated-button":t.animate?"true":void 0},W.createElement(n.Chevron,{disabled:J?void 0:!0,className:c[Me.Chevron],orientation:t.dir==="rtl"?"right":"left"})),W.createElement(n.MonthCaption,{"data-animated-caption":t.animate?"true":void 0,className:c[Me.MonthCaption],style:b==null?void 0:b[Me.MonthCaption],calendarMonth:xe,displayIndex:Ne},d!=null&&d.startsWith("dropdown")?W.createElement(n.DropdownNav,{className:c[Me.Dropdowns],style:b==null?void 0:b[Me.Dropdowns]},(()=>{const he=d==="dropdown"||d==="dropdown-months"?W.createElement(n.MonthsDropdown,{key:"month",className:c[Me.MonthsDropdown],"aria-label":V(),classNames:c,components:n,disabled:!!t.disableNavigation,onChange:nr(xe.date),options:CR(xe.date,G,re,s,o),style:b==null?void 0:b[Me.Dropdown],value:o.getMonth(xe.date)}):W.createElement("span",{key:"month"},S(xe.date,o)),ye=d==="dropdown"||d==="dropdown-years"?W.createElement(n.YearsDropdown,{key:"year",className:c[Me.YearsDropdown],"aria-label":De(o.options),classNames:c,components:n,disabled:!!t.disableNavigation,onChange:yt(xe.date),options:OR(G,re,s,o,!!t.reverseYears),style:b==null?void 0:b[Me.Dropdown],value:o.getYear(xe.date)}):W.createElement("span",{key:"year"},L(xe.date,o));return o.getMonthYearOrder()==="year-first"?[ye,he]:[he,ye]})(),W.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},C(xe.date,o.options,o))):W.createElement(n.CaptionLabel,{className:c[Me.CaptionLabel],role:"status","aria-live":"polite"},C(xe.date,o.options,o))),f==="around"&&!t.hideNavigation&&Ne===m-1&&W.createElement(n.NextMonthButton,{type:"button",className:c[Me.NextMonthButton],tabIndex:P?void 0:-1,"aria-disabled":P?void 0:!0,"aria-label":ue(P),onClick:ut,"data-animated-button":t.animate?"true":void 0},W.createElement(n.Chevron,{disabled:P?void 0:!0,className:c[Me.Chevron],orientation:t.dir==="rtl"?"left":"right"})),Ne===m-1&&f==="after"&&!t.hideNavigation&&W.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:c[Me.Nav],style:b==null?void 0:b[Me.Nav],"aria-label":ie(),onPreviousClick:Ve,onNextClick:ut,previousMonth:J,nextMonth:P}),W.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":u==="multiple"||u==="range","aria-label":se(xe.date,o.options,o)||void 0,className:c[Me.MonthGrid],style:b==null?void 0:b[Me.MonthGrid]},!t.hideWeekdays&&W.createElement(n.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:c[Me.Weekdays],style:b==null?void 0:b[Me.Weekdays]},k&&W.createElement(n.WeekNumberHeader,{"aria-label":ge(o.options),className:c[Me.WeekNumberHeader],style:b==null?void 0:b[Me.WeekNumberHeader],scope:"col"},A()),Ue.map(he=>W.createElement(n.Weekday,{"aria-label":ve(he,o.options,o),className:c[Me.Weekday],key:String(he),style:b==null?void 0:b[Me.Weekday],scope:"col"},O(he,o.options,o)))),W.createElement(n.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:c[Me.Weeks],style:b==null?void 0:b[Me.Weeks]},xe.weeks.map(he=>W.createElement(n.Week,{className:c[Me.Week],key:he.weekNumber,style:b==null?void 0:b[Me.Week],week:he},k&&W.createElement(n.WeekNumber,{week:he,style:b==null?void 0:b[Me.WeekNumber],"aria-label":Q(he.weekNumber,{locale:l}),className:c[Me.WeekNumber],scope:"row",role:"rowheader"},I(he.weekNumber,o)),he.days.map(ye=>{const{date:Xe}=ye,de=R(ye);if(de[jt.focused]=!de.hidden&&!!(E!=null&&E.isEqualTo(ye)),de[Cn.selected]=(U==null?void 0:U(Xe))||de.selected,nf(K)){const{from:rt,to:nt}=K;de[Cn.range_start]=!!(rt&&nt&&o.isSameDay(Xe,rt)),de[Cn.range_end]=!!(rt&&nt&&o.isSameDay(Xe,nt)),de[Cn.range_middle]=wa(K,Xe,!0,o)}const _e=_R(de,b,t.modifiersStyles),Te=lR(de,c,t.modifiersClassNames),bt=!Be&&!de.hidden?ee(Xe,de,o.options,o):void 0;return W.createElement(n.Day,{key:`${ye.isoDate}_${ye.displayMonthId}`,day:ye,modifiers:de,className:Te.join(" "),style:_e,role:"gridcell","aria-selected":de.selected||void 0,"aria-label":bt,"data-day":ye.isoDate,"data-month":ye.outside?ye.dateMonthId:void 0,"data-selected":de.selected||void 0,"data-disabled":de.disabled||void 0,"data-hidden":de.hidden||void 0,"data-outside":ye.outside||void 0,"data-focused":de.focused||void 0,"data-today":de.today||void 0},!de.hidden&&Be?W.createElement(n.DayButton,{className:c[Me.DayButton],style:b==null?void 0:b[Me.DayButton],type:"button",day:ye,modifiers:de,disabled:!de.focused&&de.disabled||void 0,"aria-disabled":de.focused&&de.disabled||void 0,tabIndex:Z(ye)?0:-1,"aria-label":ae(Xe,de,o.options,o),onClick:Ke(ye,de),onBlur:tr(ye,de),onFocus:Ze(ye,de),onKeyDown:Ir(ye,de),onMouseEnter:rr(ye,de),onMouseLeave:yr(ye,de)},_(Xe,o.options,o)):!de.hidden&&_(ye.date,o.options,o))})))))))),t.footer&&W.createElement(n.Footer,{className:c[Me.Footer],style:b==null?void 0:b[Me.Footer],role:"status","aria-live":"polite"},t.footer)))}function gr({className:e,classNames:t,showOutsideDays:r=!0,...n}){return a.jsx(e$,{showOutsideDays:r,className:z("p-3",e),classNames:{months:"flex flex-col sm:flex-row gap-2",month:"flex flex-col gap-4",month_caption:"flex justify-center pt-1 relative items-center w-full",caption_label:"text-sm font-medium pointer-events-none",nav:"flex items-center gap-1",button_previous:z(qi({variant:"outline"}),"absolute left-1 top-0 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100 z-10"),button_next:z(qi({variant:"outline"}),"absolute right-1 top-0 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100 z-10"),month_grid:"w-full border-collapse",weekdays:"flex",weekday:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem] text-center",week:"flex w-full mt-2",day:"relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 rounded-md",day_button:z(qi({variant:"ghost"}),"size-8 p-0 font-normal aria-selected:opacity-100"),selected:"[&>button]:bg-primary [&>button]:text-primary-foreground [&>button]:hover:bg-primary [&>button]:hover:text-primary-foreground [&>button]:focus:bg-primary [&>button]:focus:text-primary-foreground",today:"[&>button]:bg-accent [&>button]:text-accent-foreground",outside:"day-outside text-muted-foreground [&>button]:text-muted-foreground aria-selected:text-muted-foreground",disabled:"text-muted-foreground opacity-50",hidden:"invisible",...t},components:{Chevron:({orientation:s})=>s==="left"?a.jsx(_a,{className:"h-4 w-4"}):a.jsx(vr,{className:"h-4 w-4"})},...n})}gr.displayName="Calendar";function t$(e,t=[]){let r=[];function n(i,o){const l=h.createContext(o),c=r.length;r=[...r,o];const d=f=>{var y;const{scope:m,children:p,...x}=f,g=((y=m==null?void 0:m[e])==null?void 0:y[c])||l,v=h.useMemo(()=>x,Object.values(x));return a.jsx(g.Provider,{value:v,children:p})};d.displayName=i+"Provider";function u(f,m){var g;const p=((g=m==null?void 0:m[e])==null?void 0:g[c])||l,x=h.useContext(p);if(x)return x;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[d,u]}const s=()=>{const i=r.map(o=>h.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return h.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[n,r$(s,...t)]}function r$(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=n.reduce((l,{useScope:c,scopeName:d})=>{const f=c(i)[`__scope${d}`];return{...l,...f}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}function n$(e){const t=a$(e),r=h.forwardRef((n,s)=>{const{children:i,...o}=n,l=h.Children.toArray(i),c=l.find(i$);if(c){const d=c.props.children,u=l.map(f=>f===c?h.Children.count(d)>1?h.Children.only(null):h.isValidElement(d)?d.props.children:null:f);return a.jsx(t,{...o,ref:s,children:h.isValidElement(d)?h.cloneElement(d,void 0,u):null})}return a.jsx(t,{...o,ref:s,children:i})});return r.displayName=`${e}.Slot`,r}function a$(e){const t=h.forwardRef((r,n)=>{const{children:s,...i}=r;if(h.isValidElement(s)){const o=l$(s),l=o$(i,s.props);return s.type!==h.Fragment&&(l.ref=n?t1(n,o):o),h.cloneElement(s,l)}return h.Children.count(s)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var s$=Symbol("radix.slottable");function i$(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===s$}function o$(e,t){const r={...t};for(const n in t){const s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...i}:n==="className"&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}function l$(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var c$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],fk=c$.reduce((e,t)=>{const r=n$(`Primitive.${t}`),n=h.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),sf="Switch",[d$]=t$(sf),[u$,f$]=d$(sf),mk=h.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:s,defaultChecked:i,required:o,disabled:l,value:c="on",onCheckedChange:d,form:u,...f}=e,[m,p]=h.useState(null),x=Tu(t,N=>p(N)),g=h.useRef(!1),v=m?u||!!m.closest("form"):!0,[y,j]=UP({prop:s,defaultProp:i??!1,onChange:d,caller:sf});return a.jsxs(u$,{scope:r,checked:y,disabled:l,children:[a.jsx(fk.button,{type:"button",role:"switch","aria-checked":y,"aria-required":o,"data-state":gk(y),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:x,onClick:Fs(e.onClick,N=>{j(w=>!w),v&&(g.current=N.isPropagationStopped(),g.current||N.stopPropagation())})}),v&&a.jsx(xk,{control:m,bubbles:!g.current,name:n,value:c,checked:y,required:o,disabled:l,form:u,style:{transform:"translateX(-100%)"}})]})});mk.displayName=sf;var hk="SwitchThumb",pk=h.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,s=f$(hk,r);return a.jsx(fk.span,{"data-state":gk(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:t})});pk.displayName=hk;var m$="SwitchBubbleInput",xk=h.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...s},i)=>{const o=h.useRef(null),l=Tu(o,i),c=qP(r),d=HP(t);return h.useEffect(()=>{const u=o.current;if(!u)return;const f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(c!==r&&p){const x=new Event("click",{bubbles:n});p.call(u,r),u.dispatchEvent(x)}},[c,r,n]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:l,style:{...s.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});xk.displayName=m$;function gk(e){return e?"checked":"unchecked"}var vk=mk,h$=pk;const Co=h.forwardRef(({className:e,...t},r)=>a.jsx(vk,{className:z("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:r,children:a.jsx(h$,{className:z("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Co.displayName=vk.displayName;function p$(e){if(!e.start_date&&!e.end_date)return null;const t=e.start_date?fe(new Date(e.start_date),"MMM d"):"—",r=e.end_date?fe(new Date(e.end_date),"MMM d"):"—";return`${t} – ${r}`}function of({open:e,onClose:t,projectId:r,defaultStatus:n="backlog",defaultTaskListId:s,defaultParentId:i}){const o=pt(),{workspace:l,projectKey:c}=zt(),{workspace:d}=Ie(),[u,f]=h.useState(""),[m,p]=h.useState(""),[x,g]=h.useState(n),[v,y]=h.useState("medium"),[j,N]=h.useState("task"),[w,k]=h.useState([]),[b,C]=h.useState(""),[_,S]=h.useState(s??""),[I,A]=h.useState(void 0),[O,L]=h.useState(void 0),[F,X]=h.useState(!1),[T,G]=h.useState("weekly"),[re,J]=h.useState(void 0),P=P1(),{data:M}=la(r),R=h.useMemo(()=>M?M.members.filter(Y=>Y.user).map(Y=>Y.user):void 0,[M]),{data:U}=ko(r),{data:$}=So(r||void 0),{data:K}=fc(r||void 0),D=($??[]).filter(Y=>Y.status!=="completed"),E=U&&U.length>0?Object.fromEntries(U.map(Y=>[Y.key,Y.name])):ci,Z=()=>{f(""),p(""),g(n),y("medium"),N("task"),k([]),C(""),S(s??""),A(void 0),L(void 0),X(!1),G("weekly"),J(void 0),t()},B=Y=>{Y.preventDefault(),u.trim()&&P.mutate({title:u.trim(),description:m.trim()||void 0,status:x,priority:v,type:j,project_id:r,workspace_id:d.id,assignee_ids:w.length>0?w:void 0,sprint_id:b||null,task_list_id:_||null,parent_id:i||null,start_date:I?fe(I,"yyyy-MM-dd"):null,due_date:O?fe(O,"yyyy-MM-dd"):null,recurrence_frequency:F?T:void 0,recurrence_end_date:F&&re?fe(re,"yyyy-MM-dd"):void 0},{onSuccess:()=>{H.success("Issue created"),Z()},onError:ae=>H.error(ae.message??"Failed to create issue")})};return a.jsx(Ni,{open:e,onOpenChange:Y=>!Y&&Z(),children:a.jsxs(ki,{className:"max-w-md",children:[a.jsx(bo,{children:a.jsx(jo,{children:"New issue"})}),a.jsxs("form",{onSubmit:B,className:"flex flex-col flex-1 overflow-hidden",children:[a.jsxs(wo,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{htmlFor:"issue-title",children:"Title"}),a.jsx(Ee,{id:"issue-title",placeholder:"Issue title",value:u,onChange:Y=>f(Y.target.value),autoFocus:!0})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{htmlFor:"issue-desc",children:["Description ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsx(Ju,{id:"issue-desc",placeholder:"Add more context...",value:m,onChange:Y=>p(Y.target.value)})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{children:"Status"}),a.jsxs(Le,{value:x,onValueChange:g,children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{})}),a.jsx(ze,{children:Object.entries(E).map(([Y,ae])=>a.jsx(we,{value:Y,className:"text-xs",children:ae},Y))})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{children:"Priority"}),a.jsxs(Le,{value:v,onValueChange:y,children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{})}),a.jsx(ze,{children:Object.entries(rn).map(([Y,ae])=>a.jsx(we,{value:Y,className:"text-xs",children:ae},Y))})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{children:"Type"}),a.jsxs(Le,{value:j,onValueChange:N,children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{})}),a.jsx(ze,{children:Object.entries(Pa).map(([Y,ae])=>a.jsx(we,{value:Y,className:"text-xs",children:ae},Y))})]})]})]}),i&&a.jsx("div",{className:"rounded-md bg-muted/50 border border-border px-3 py-2 text-xs text-muted-foreground",children:"Will be created as a child issue"}),(K??[]).length>0&&!i&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{children:["List ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsxs(Le,{value:_||"none",onValueChange:Y=>S(Y==="none"?"":Y),children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{placeholder:"No list"})}),a.jsxs(ze,{children:[a.jsx(we,{value:"none",className:"text-xs",children:a.jsx("span",{className:"text-muted-foreground",children:"No list"})}),(K??[]).map(Y=>a.jsx(we,{value:Y.id,className:"text-xs",children:Y.name},Y.id))]})]})]}),D.length>0&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{children:["Sprint ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsxs(Le,{value:b||"none",onValueChange:Y=>C(Y==="none"?"":Y),children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{placeholder:"No sprint"})}),a.jsxs(ze,{children:[a.jsx(we,{value:"none",className:"text-xs",children:a.jsx("span",{className:"text-muted-foreground",children:"No sprint"})}),D.map(Y=>{const ae=p$(Y);return a.jsx(we,{value:Y.id,className:"text-xs",children:a.jsxs("div",{children:[a.jsx("span",{children:Y.name}),ae&&a.jsx("span",{className:"block text-[10px] text-muted-foreground leading-tight",children:ae})]})},Y.id)})]})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{children:["Assignees ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsx(mc,{value:w,onChange:k,users:R})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{children:["Start Date ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsxs(Ot,{children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex items-center gap-2 h-9 w-full rounded-md border border-input px-3 text-sm bg-transparent hover:bg-accent transition-colors text-left",children:[a.jsx(Wt,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:I?"text-foreground":"text-muted-foreground",children:I?fe(I,"MMM d, yyyy"):"No start date"}),I&&a.jsx("button",{type:"button",onClick:Y=>{Y.stopPropagation(),A(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:a.jsx(tt,{className:"h-3.5 w-3.5"})})]})}),a.jsx(_t,{className:"w-auto p-0",align:"start",children:a.jsx(gr,{mode:"single",selected:I,onSelect:A,initialFocus:!0})})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{children:["Due Date ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsxs(Ot,{children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex items-center gap-2 h-9 w-full rounded-md border border-input px-3 text-sm bg-transparent hover:bg-accent transition-colors text-left",children:[a.jsx(Wt,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:O?"text-foreground":"text-muted-foreground",children:O?fe(O,"MMM d, yyyy"):"No due date"}),O&&a.jsx("button",{type:"button",onClick:Y=>{Y.stopPropagation(),L(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:a.jsx(tt,{className:"h-3.5 w-3.5"})})]})}),a.jsx(_t,{className:"w-auto p-0",align:"start",children:a.jsx(gr,{mode:"single",selected:O,onSelect:L,initialFocus:!0})})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Co,{id:"recurring",checked:F,onCheckedChange:X}),a.jsxs(mt,{htmlFor:"recurring",className:"cursor-pointer font-normal flex items-center gap-1.5",children:[a.jsx(Vi,{className:"h-3.5 w-3.5 text-muted-foreground"}),"Recurring"]})]}),F&&a.jsx("div",{className:"space-y-3 pl-4 border-l-2 border-indigo-200 dark:border-indigo-800",children:a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{children:"Frequency"}),a.jsxs(Le,{value:T,onValueChange:Y=>G(Y),children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{})}),a.jsxs(ze,{children:[a.jsx(we,{value:"weekly",className:"text-xs",children:"Weekly"}),a.jsx(we,{value:"monthly",className:"text-xs",children:"Monthly"})]})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{children:["Until ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsxs(Ot,{children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex items-center gap-2 h-8 w-full rounded-md border border-input px-3 text-xs bg-transparent hover:bg-accent transition-colors text-left",children:[a.jsx(Wt,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:re?"text-foreground":"text-muted-foreground",children:re?fe(re,"MMM d, yyyy"):"No end date"}),re&&a.jsx("button",{type:"button",onClick:Y=>{Y.stopPropagation(),J(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:a.jsx(tt,{className:"h-3.5 w-3.5"})})]})}),a.jsx(_t,{className:"w-auto p-0",align:"start",children:a.jsx(gr,{mode:"single",selected:re,onSelect:J,initialFocus:!0})})]})]})]})})]})]}),a.jsxs(cc,{className:"flex-col-reverse sm:flex-row sm:items-center sm:justify-between gap-2",children:[a.jsxs(ne,{type:"button",variant:"ghost",size:"sm",className:"text-muted-foreground gap-1.5 justify-start sm:justify-center",onClick:()=>{Z(),o(`/${l}/projects/${c}/issues/new`)},children:[a.jsx(rx,{className:"h-3.5 w-3.5"}),"Open full form"]}),a.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[a.jsx(ne,{type:"button",variant:"ghost",onClick:Z,children:"Cancel"}),a.jsx(ne,{type:"submit",disabled:!u.trim()||P.isPending,children:P.isPending?"Creating...":"Create issue"})]})]})]})]})})}const Ex={byIssue:e=>["attachments",e]};function yk(e){return Fe({queryKey:Ex.byIssue(e),queryFn:()=>oe.get(`/admin/issues/${e}/attachments`),select:t=>t.attachments,enabled:!!e})}function bk(e){const t=Se();return be({mutationFn:({file:r,commentId:n})=>{const s=new FormData;return s.append("file",r),n&&s.append("comment_id",n),oe.upload(`/admin/issues/${e}/attachments`,s)},onSuccess:()=>{t.invalidateQueries({queryKey:Ex.byIssue(e)})}})}function x$(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/issues/${e}/attachments/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:Ex.byIssue(e)})}})}function kl(e){return e.startsWith("image/")}function lf(e){return e.startsWith("video/")}function cf(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Md(e){if(e.startsWith("/"))return!0;try{const{protocol:t}=new URL(e);return t==="http:"||t==="https:"}catch{return!1}}function Ax(e,t){if(!Md(e)){console.error("downloadFile: blocked unsafe URL",e);return}const r=document.createElement("a");r.href=e,r.download=t,r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r)}function Dx({mimeType:e,className:t}){return kl(e)?a.jsx(u5,{className:t}):lf(e)?a.jsx(bl,{className:t}):e.startsWith("text/")||e.includes("json")?a.jsx(d5,{className:t}):e.includes("zip")||e.includes("tar")||e.includes("gz")?a.jsx(c5,{className:t}):e.includes("pdf")||e.includes("word")||e.includes("document")?a.jsx(f5,{className:t}):a.jsx(m5,{className:t})}function wk({attachment:e,onClose:t}){return e?a.jsx(Ni,{open:!0,onOpenChange:r=>!r&&t(),children:a.jsxs(ki,{className:"max-w-2xl w-full p-0 overflow-hidden",children:[a.jsxs(bo,{className:"flex-row items-center justify-between px-4 py-3 border-b border-border shrink-0 pr-10",children:[a.jsx(jo,{className:"text-sm font-medium truncate",children:e.original_name}),a.jsxs(ne,{variant:"ghost",size:"sm",className:"h-7 text-xs gap-1.5 shrink-0",onClick:()=>Ax(e.url,e.original_name),children:[a.jsx(tx,{className:"h-3.5 w-3.5"}),"Download"]})]}),a.jsxs(wo,{className:"flex items-center justify-center bg-black/5 dark:bg-black/30 min-h-[320px] max-h-[75vh] overflow-auto p-0",children:[kl(e.mime_type)&&Md(e.url)&&a.jsx("img",{src:e.url,alt:e.original_name,className:"max-w-full max-h-[75vh] object-contain"}),lf(e.mime_type)&&Md(e.url)&&a.jsx("video",{src:e.url,controls:!0,className:"max-w-full max-h-[75vh]"})]}),a.jsxs("div",{className:"px-4 py-2 border-t border-border text-[11px] text-muted-foreground flex items-center gap-3 shrink-0",children:[a.jsx("span",{children:cf(e.size)}),a.jsx("span",{children:"·"}),a.jsx("span",{children:e.mime_type}),a.jsx("span",{children:"·"}),a.jsxs("span",{children:["Uploaded ",fe(new Date(e.created_at),"MMM d, yyyy")]})]})]})}):null}function g$({attachment:e}){const[t,r]=h.useState(null),n=kl(e.mime_type)||lf(e.mime_type),s=()=>{n?r(e):Ax(e.url,e.original_name)};return a.jsxs(a.Fragment,{children:[kl(e.mime_type)?a.jsx("button",{type:"button",onClick:s,className:"block rounded-md overflow-hidden border border-border hover:opacity-90 transition-opacity",title:e.original_name,children:a.jsx("img",{src:Md(e.url)?e.url:"",alt:e.original_name,className:"max-h-48 max-w-xs object-cover"})}):a.jsxs("button",{type:"button",onClick:s,className:"flex items-center gap-2 px-2.5 py-1.5 rounded-lg border border-border bg-muted/40 hover:bg-muted transition-colors text-left max-w-xs",title:n?"View":"Download",children:[a.jsx(Dx,{mimeType:e.mime_type,className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"text-xs text-foreground truncate",children:e.original_name}),a.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:cf(e.size)}),!n&&a.jsx(tx,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]}),t&&a.jsx(wk,{attachment:t,onClose:()=>r(null)})]})}function v$({attachment:e,onOpen:t,onDelete:r,isDeleting:n}){const s=kl(e.mime_type)||lf(e.mime_type),i=()=>{s?t(e):Ax(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(Dx,{mimeType:e.mime_type,className:"h-4 w-4"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("button",{type:"button",onClick:i,className:"text-xs font-medium text-foreground truncate block text-left w-full hover:underline",children:e.original_name}),a.jsxs("p",{className:"text-[11px] text-muted-foreground mt-0.5 flex items-center gap-1.5",children:[a.jsx("span",{children:cf(e.size)}),a.jsx("span",{children:"·"}),a.jsx("span",{children:fe(new Date(e.created_at),"MMM d, yyyy")}),e.comment_id&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"·"}),a.jsx("span",{className:"italic",children:"from comment"})]}),!s&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"·"}),a.jsxs("span",{className:"flex items-center gap-0.5",children:[a.jsx(tx,{className:"h-2.5 w-2.5"}),"Click to download"]})]})]})]}),a.jsx(ne,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100 text-muted-foreground hover:text-destructive transition-all",onClick:()=>r(e.id),disabled:n,children:a.jsx(Mr,{className:"h-3.5 w-3.5"})})]})}function y$({onFiles:e,isUploading:t}){const[r,n]=h.useState(!1),s=h.useRef(null),i=h.useCallback(o=>{o.preventDefault(),n(!1);const l=Array.from(o.dataTransfer.files);l.length>0&&e(l)},[e]);return a.jsxs("div",{onDragOver:o=>{o.preventDefault(),n(!0)},onDragLeave:()=>n(!1),onDrop:i,onClick:()=>{var o;return!t&&((o=s.current)==null?void 0:o.click())},className:z("flex flex-col items-center justify-center gap-1.5 rounded-xl border-2 border-dashed px-4 py-6","cursor-pointer transition-colors",r?"border-primary/60 bg-primary/5":"border-border hover:border-muted-foreground/40 hover:bg-muted/30",t&&"opacity-60 cursor-wait"),children:[a.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-muted",children:a.jsx($5,{className:"h-4 w-4 text-muted-foreground"})}),a.jsx("p",{className:"text-xs font-medium text-foreground",children:t?"Uploading…":"Drop files or click to browse"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Up to 50 MB per file"}),a.jsx("input",{ref:s,type:"file",multiple:!0,className:"hidden",onChange:o=>{const l=Array.from(o.target.files??[]);l.length>0&&e(l),o.target.value=""}})]})}function b$({issueId:e,className:t}){const[r,n]=h.useState(null),{data:s,isLoading:i}=yk(e),o=bk(e),l=x$(e),c=u=>{u.forEach(f=>{o.mutate({file:f},{onSuccess:()=>H.success(`${f.name} uploaded`),onError:()=>H.error(`Failed to upload ${f.name}`)})})},d=u=>{l.mutate(u,{onSuccess:()=>H.success("Attachment removed"),onError:()=>H.error("Failed to remove attachment")})};return a.jsxs("div",{className:z("px-6 py-4 space-y-4",t),children:[a.jsx(y$,{onFiles:c,isUploading:o.isPending}),i?a.jsx("div",{className:"space-y-2",children:[1,2].map(u=>a.jsxs("div",{className:"flex items-center gap-3 px-3",children:[a.jsx(le,{className:"h-8 w-8 rounded-md shrink-0"}),a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsx(le,{className:"h-3 w-2/3"}),a.jsx(le,{className:"h-2.5 w-1/3"})]})]},u))}):s&&s.length>0?a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[a.jsx(sx,{className:"h-3 w-3 text-muted-foreground"}),a.jsxs("span",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:[s.length," ",s.length===1?"file":"files"]})]}),a.jsx("div",{children:s.map(u=>a.jsx(v$,{attachment:u,onOpen:n,onDelete:d,isDeleting:l.isPending},u.id))})]}):a.jsx("p",{className:"text-sm text-muted-foreground/50 text-center py-1",children:"No attachments yet."}),a.jsx(wk,{attachment:r,onClose:()=>n(null)})]})}const js={byIssue:e=>["time-logs",e],activeTimer:e=>["time-logs",e,"active-timer"]};function w$(e){return Fe({queryKey:js.byIssue(e),queryFn:()=>oe.get(`/admin/issues/${e}/time-logs`),enabled:!!e})}function j$(e){return Fe({queryKey:js.activeTimer(e),queryFn:()=>oe.get(`/admin/issues/${e}/time-logs/timer`),select:t=>t.active_timer,enabled:!!e,refetchInterval:1e4})}function N$(e){const t=Se();return be({mutationFn:r=>oe.post(`/admin/issues/${e}/time-logs`,r),onSuccess:()=>{t.invalidateQueries({queryKey:js.byIssue(e)})}})}function k$(e){const t=Se();return be({mutationFn:()=>oe.post(`/admin/issues/${e}/time-logs/timer`,{action:"start"}),onSuccess:()=>{t.invalidateQueries({queryKey:js.activeTimer(e)}),t.invalidateQueries({queryKey:js.byIssue(e)})}})}function S$(e){const t=Se();return be({mutationFn:()=>oe.post(`/admin/issues/${e}/time-logs/timer`,{action:"stop"}),onSuccess:()=>{t.invalidateQueries({queryKey:js.activeTimer(e)}),t.invalidateQueries({queryKey:js.byIssue(e)})}})}function C$(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/issues/${e}/time-logs/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:js.byIssue(e)})}})}const _$=Zl("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-destructive-foreground",outline:"text-foreground",muted:"border-transparent bg-muted text-muted-foreground"}},defaultVariants:{variant:"default"}});function En({className:e,variant:t,...r}){return a.jsx("div",{className:z(_$({variant:t}),e),...r})}function Ph(e){const t=Math.floor(e/60),r=e%60;return t===0?`${r}m`:r===0?`${t}h`:`${t}h ${r}m`}function ky(e){const t=Date.now()-new Date(e).getTime(),r=Math.floor(t/1e3),n=Math.floor(r/3600),s=Math.floor(r%3600/60),i=r%60,o=String(s).padStart(2,"0"),l=String(i).padStart(2,"0");return n>0?`${n}:${o}:${l}`:`${o}:${l}`}function M$({startedAt:e}){const[t,r]=h.useState(()=>ky(e));return h.useEffect(()=>{const n=setInterval(()=>r(ky(e)),1e3);return()=>clearInterval(n)},[e]),a.jsx("span",{className:"font-mono tabular-nums text-sm font-semibold text-foreground",children:t})}function O$({onSubmit:e,isPending:t,onCancel:r}){const[n,s]=h.useState(""),[i,o]=h.useState(""),[l,c]=h.useState(""),[d,u]=h.useState(new Date().toISOString().split("T")[0]),f=m=>{m.preventDefault();const p=parseInt(n||"0",10),x=parseInt(i||"0",10),g=p*60+x;if(g<=0){H.error("Please enter a duration greater than 0.");return}e({duration_minutes:g,description:l.trim()||void 0,logged_date:d||void 0})};return a.jsxs("form",{onSubmit:f,className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[a.jsx("p",{className:"text-xs font-medium text-foreground",children:"Log time manually"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Hours"}),a.jsx(Ee,{type:"number",min:"0",max:"999",placeholder:"0",value:n,onChange:m=>s(m.target.value),className:"h-8 text-sm"})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Minutes"}),a.jsx(Ee,{type:"number",min:"0",max:"59",placeholder:"0",value:i,onChange:m=>o(m.target.value),className:"h-8 text-sm"})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Date"}),a.jsx(Ee,{type:"date",value:d,onChange:m=>u(m.target.value),className:"h-8 text-sm"})]})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:["Description ",a.jsx("span",{className:"text-muted-foreground/60",children:"(optional)"})]}),a.jsx(Ee,{placeholder:"What did you work on?",value:l,onChange:m=>c(m.target.value),className:"h-8 text-sm"})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[a.jsx(ne,{type:"button",variant:"ghost",size:"sm",onClick:r,className:"h-7 text-xs",children:"Cancel"}),a.jsx(ne,{type:"submit",size:"sm",disabled:t,className:"h-7 text-xs",children:t?"Saving…":"Log time"})]})]})}function P$({entry:e,userName:t,onDelete:r,isDeleting:n}){const s=e.started_at!=null&&e.stopped_at==null;return a.jsxs("div",{className:"flex items-start gap-3 py-2.5 px-3 rounded-lg hover:bg-muted/50 group transition-colors",children:[a.jsx("div",{className:z("flex h-7 w-7 shrink-0 items-center justify-center rounded-full mt-0.5",s?"bg-emerald-50 dark:bg-emerald-950/40":"bg-muted"),children:s?a.jsx(D5,{className:"h-3.5 w-3.5 text-emerald-600"}):e.source==="timer"?a.jsx(Tn,{className:"h-3.5 w-3.5 text-muted-foreground"}):a.jsx(o5,{className:"h-3.5 w-3.5 text-muted-foreground"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s?a.jsx(M$,{startedAt:e.started_at}):a.jsx("span",{className:"text-sm font-semibold text-foreground tabular-nums",children:Ph(e.duration_minutes??0)}),a.jsx(En,{variant:"muted",className:z("text-[10px] px-1.5 py-0",s?"bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-400":""),children:s?"Running":e.source==="timer"?"Timer":"Manual"}),t&&a.jsx("span",{className:"text-[11px] text-muted-foreground",children:t})]}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:e.description}),e.logged_date&&!s&&a.jsx("p",{className:"text-[11px] text-muted-foreground/60 mt-0.5",children:fe(new Date(e.logged_date),"MMM d, yyyy")})]}),!s&&a.jsx(ne,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100 text-muted-foreground hover:text-destructive transition-all mt-0.5",onClick:()=>r(e.id),disabled:n,children:a.jsx(Mr,{className:"h-3.5 w-3.5"})})]})}function E$({issueId:e,className:t}){const[r,n]=h.useState(!1),{data:s,isLoading:i}=w$(e),{data:o}=j$(e),{data:l}=ks(),c=N$(e),d=k$(e),u=S$(e),f=C$(e),m=(s==null?void 0:s.time_logs)??[],p=(s==null?void 0:s.total_minutes)??0,x=o!=null,g=N=>{c.mutate(N,{onSuccess:()=>{n(!1),H.success("Time logged")},onError:()=>H.error("Failed to log time")})},v=()=>{d.mutate(void 0,{onSuccess:()=>H.success("Timer started"),onError:N=>H.error(N.message??"Failed to start timer")})},y=()=>{u.mutate(void 0,{onSuccess:N=>{const w=N.time_log.duration_minutes??0;H.success(`Timer stopped — ${Ph(w)} logged`)},onError:()=>H.error("Failed to stop timer")})},j=N=>{f.mutate(N,{onSuccess:()=>H.success("Time entry removed"),onError:()=>H.error("Failed to remove entry")})};return a.jsxs("div",{className:z("px-6 py-4 space-y-4",t),children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-[11px] text-muted-foreground uppercase tracking-wider font-medium mb-0.5",children:"Total logged"}),a.jsx("p",{className:"text-xl font-bold text-foreground tabular-nums",children:p>0?Ph(p):"—"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[!r&&a.jsxs(ne,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5",onClick:()=>n(!0),children:[a.jsx(dt,{className:"h-3.5 w-3.5"}),"Log time"]}),x?a.jsxs(ne,{size:"sm",variant:"destructive",className:"h-8 text-xs gap-1.5",onClick:y,disabled:u.isPending,children:[a.jsx(O5,{className:"h-3.5 w-3.5 fill-current"}),"Stop"]}):a.jsxs(ne,{size:"sm",className:"h-8 text-xs gap-1.5 bg-emerald-600 hover:bg-emerald-700 text-white",onClick:v,disabled:d.isPending,children:[a.jsx(bl,{className:"h-3.5 w-3.5 fill-current"}),"Start"]})]})]}),r&&a.jsx(O$,{onSubmit:g,isPending:c.isPending,onCancel:()=>n(!1)}),i?a.jsx("div",{className:"space-y-2",children:[1,2].map(N=>a.jsxs("div",{className:"flex items-center gap-3 px-3",children:[a.jsx(le,{className:"h-7 w-7 rounded-full shrink-0"}),a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsx(le,{className:"h-3 w-1/3"}),a.jsx(le,{className:"h-2.5 w-1/4"})]})]},N))}):m.length>0?a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[a.jsx(Tn,{className:"h-3 w-3 text-muted-foreground"}),a.jsxs("span",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:[m.length," ",m.length===1?"entry":"entries"]})]}),a.jsx("div",{children:m.map(N=>{var w;return a.jsx(P$,{entry:N,userName:(w=l==null?void 0:l.get(N.user_id))==null?void 0:w.name,onDelete:j,isDeleting:f.isPending},N.id)})})]}):a.jsx("p",{className:"text-sm text-muted-foreground/50 text-center py-1",children:"No time logged yet."})]})}function A$(e){var t;const{char:r,allowSpaces:n,allowToIncludeChar:s,allowedPrefixes:i,startOfLine:o,$position:l}=e,c=n&&!s,d=NE(r),u=new RegExp(`\\s${d}$`),f=o?"^":"",m=s?"":d,p=c?new RegExp(`${f}${d}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${f}(?:^)?${d}[^\\s${m}]*`,"gm"),x=((t=l.nodeBefore)==null?void 0:t.isText)&&l.nodeBefore.text;if(!x)return null;const g=l.pos-x.length,v=Array.from(x.matchAll(p)).pop();if(!v||v.input===void 0||v.index===void 0)return null;const y=v.input.slice(Math.max(0,v.index-1),v.index),j=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(y);if(i!==null&&!j)return null;const N=g+v.index;let w=N+v[0].length;return c&&u.test(x.slice(w-1,w+1))&&(v[0]+=" ",w+=1),N<l.pos&&w>=l.pos?{range:{from:N,to:w},query:v[0].slice(r.length),text:v[0]}:null}var D$=new d1("suggestion");function T$({pluginKey:e=D$,editor:t,char:r="@",allowSpaces:n=!1,allowToIncludeChar:s=!1,allowedPrefixes:i=[" "],startOfLine:o=!1,decorationTag:l="span",decorationClass:c="suggestion",decorationContent:d="",decorationEmptyClass:u="is-empty",command:f=()=>null,items:m=()=>[],render:p=()=>({}),allow:x=()=>!0,findSuggestionMatch:g=A$,shouldShow:v}){let y;const j=p==null?void 0:p(),N=()=>{const C=t.state.selection.$anchor.pos,_=t.view.coordsAtPos(C),{top:S,right:I,bottom:A,left:O}=_;try{return new DOMRect(O,S,I-O,A-S)}catch{return null}},w=(C,_)=>_?()=>{const S=e.getState(t.state),I=S==null?void 0:S.decorationId,A=C.dom.querySelector(`[data-decoration-id="${I}"]`);return(A==null?void 0:A.getBoundingClientRect())||null}:N;function k(C,_){var S;try{const A=e.getState(C.state),O=A!=null&&A.decorationId?C.dom.querySelector(`[data-decoration-id="${A.decorationId}"]`):null,L={editor:t,range:(A==null?void 0:A.range)||{from:0,to:0},query:(A==null?void 0:A.query)||null,text:(A==null?void 0:A.text)||null,items:[],command:F=>f({editor:t,range:(A==null?void 0:A.range)||{from:0,to:0},props:F}),decorationNode:O,clientRect:w(C,O)};(S=j==null?void 0:j.onExit)==null||S.call(j,L)}catch{}const I=C.state.tr.setMeta(_,{exit:!0});C.dispatch(I)}const b=new bE({key:e,view(){return{update:async(C,_)=>{var S,I,A,O,L,F,X;const T=(S=this.key)==null?void 0:S.getState(_),G=(I=this.key)==null?void 0:I.getState(C.state),re=T.active&&G.active&&T.range.from!==G.range.from,J=!T.active&&G.active,P=T.active&&!G.active,M=!J&&!P&&T.query!==G.query,R=J||re&&M,U=M||re,$=P||re&&M;if(!R&&!U&&!$)return;const K=$&&!R?T:G,D=C.dom.querySelector(`[data-decoration-id="${K.decorationId}"]`);y={editor:t,range:K.range,query:K.query,text:K.text,items:[],command:E=>f({editor:t,range:K.range,props:E}),decorationNode:D,clientRect:w(C,D)},R&&((A=j==null?void 0:j.onBeforeStart)==null||A.call(j,y)),U&&((O=j==null?void 0:j.onBeforeUpdate)==null||O.call(j,y)),(U||R)&&(y.items=await m({editor:t,query:K.query})),$&&((L=j==null?void 0:j.onExit)==null||L.call(j,y)),U&&((F=j==null?void 0:j.onUpdate)==null||F.call(j,y)),R&&((X=j==null?void 0:j.onStart)==null||X.call(j,y))},destroy:()=>{var C;y&&((C=j==null?void 0:j.onExit)==null||C.call(j,y))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(C,_,S,I){const{isEditable:A}=t,{composing:O}=t.view,{selection:L}=C,{empty:F,from:X}=L,T={..._},G=C.getMeta(e);if(G&&G.exit)return T.active=!1,T.decorationId=null,T.range={from:0,to:0},T.query=null,T.text=null,T;if(T.composing=O,A&&(F||t.view.composing)){(X<_.range.from||X>_.range.to)&&!O&&!_.composing&&(T.active=!1);const re=g({char:r,allowSpaces:n,allowToIncludeChar:s,allowedPrefixes:i,startOfLine:o,$position:L.$from}),J=`id_${Math.floor(Math.random()*4294967295)}`;re&&x({editor:t,state:I,range:re.range,isActive:_.active})&&(!v||v({editor:t,range:re.range,query:re.query,text:re.text,transaction:C}))?(T.active=!0,T.decorationId=_.decorationId?_.decorationId:J,T.range=re.range,T.query=re.query,T.text=re.text):T.active=!1}else T.active=!1;return T.active||(T.decorationId=null,T.range={from:0,to:0},T.query=null,T.text=null),T}},props:{handleKeyDown(C,_){var S,I,A,O;const{active:L,range:F}=b.getState(C.state);if(!L)return!1;if(_.key==="Escape"||_.key==="Esc"){const T=b.getState(C.state),G=(S=y==null?void 0:y.decorationNode)!=null?S:null,re=G??(T!=null&&T.decorationId?C.dom.querySelector(`[data-decoration-id="${T.decorationId}"]`):null);if(((I=j==null?void 0:j.onKeyDown)==null?void 0:I.call(j,{view:C,event:_,range:T.range}))||!1)return!0;const P={editor:t,range:T.range,query:T.query,text:T.text,items:[],command:M=>f({editor:t,range:T.range,props:M}),decorationNode:re,clientRect:re?()=>re.getBoundingClientRect()||null:null};return(A=j==null?void 0:j.onExit)==null||A.call(j,P),k(C,e),!0}return((O=j==null?void 0:j.onKeyDown)==null?void 0:O.call(j,{view:C,event:_,range:F}))||!1},decorations(C){const{active:_,range:S,decorationId:I,query:A}=b.getState(C);if(!_)return null;const O=!(A!=null&&A.length),L=[c];return O&&L.push(u),wE.create(C.doc,[jE.inline(S.from,S.to,{nodeName:l,class:L.join(" "),"data-decoration-id":I,"data-decoration-content":d})])}}});return b}function I$({editor:e,overrideSuggestionOptions:t,extensionName:r,char:n="@"}){const s=new d1;return{editor:e,char:n,pluginKey:s,command:({editor:i,range:o,props:l})=>{var c,d,u;const f=i.view.state.selection.$to.nodeAfter;((c=f==null?void 0:f.text)==null?void 0:c.startsWith(" "))&&(o.to+=1),i.chain().focus().insertContentAt(o,[{type:r,attrs:{...l,mentionSuggestionChar:n}},{type:"text",text:" "}]).run(),(u=(d=i.view.dom.ownerDocument.defaultView)==null?void 0:d.getSelection())==null||u.collapseToEnd()},allow:({state:i,range:o})=>{const l=i.doc.resolve(o.from),c=i.schema.nodes[r];return!!l.parent.type.contentMatch.matchType(c)},...t}}function jk(e){return(e.options.suggestions.length?e.options.suggestions:[e.options.suggestion]).map(t=>I$({editor:e.editor,overrideSuggestionOptions:t,extensionName:e.name,char:t.char}))}function Sy(e,t){const r=jk(e),n=r.find(s=>s.char===t);return n||(r.length?r[0]:null)}var R$=kE.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:e,suggestion:t}){var r,n;return`${(r=t==null?void 0:t.char)!=null?r:"@"}${(n=e.attrs.label)!=null?n:e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:e,node:t,suggestion:r}){var n,s;return["span",Rc(this.HTMLAttributes,e.HTMLAttributes),`${(n=r==null?void 0:r.char)!=null?n:"@"}${(s=t.attrs.label)!=null?s:t.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:e=>e.getAttribute("data-id"),renderHTML:e=>e.id?{"data-id":e.id}:{}},label:{default:null,parseHTML:e=>e.getAttribute("data-label"),renderHTML:e=>e.label?{"data-label":e.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:e=>e.getAttribute("data-mention-suggestion-char"),renderHTML:e=>({"data-mention-suggestion-char":e.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:e,HTMLAttributes:t}){const r=Sy(this,e.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Rc({"data-type":this.name},this.options.HTMLAttributes,t),this.options.renderLabel({options:this.options,node:e,suggestion:r})];const n={...this.options};n.HTMLAttributes=Rc({"data-type":this.name},this.options.HTMLAttributes,t);const s=this.options.renderHTML({options:n,node:e,suggestion:r});return typeof s=="string"?["span",Rc({"data-type":this.name},this.options.HTMLAttributes,t),s]:s},...CE({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:e=>{const t={},r=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let n=r.exec(e);for(;n!==null;){const[,s,i,o]=n,l=i??o;t[s==="char"?"mentionSuggestionChar":s]=l,n=r.exec(e)}return t},serializeAttributes:e=>Object.entries(e).filter(([,t])=>t!=null).map(([t,r])=>`${t==="mentionSuggestionChar"?"char":t}="${r}"`).join(" ")}),renderText({node:e}){const t={options:this.options,node:e,suggestion:Sy(this,e.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(t)):this.options.renderText(t)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let r=!1;const{selection:n}=t,{empty:s,anchor:i}=n;if(!s)return!1;let o=new SE,l=0;return t.doc.nodesBetween(i-1,i,(c,d)=>{if(c.type.name===this.name)return r=!0,o=c,l=d,!1}),r&&e.insertText(this.options.deleteTriggerWithBackspace?"":o.attrs.mentionSuggestionChar,l,l+o.nodeSize),r})}},addProseMirrorPlugins(){return jk(this).map(T$)}}),$$=R$;function z$({items:e,selectedIndex:t,onSelect:r}){const n=h.useRef(null);return h.useEffect(()=>{var i;const s=(i=n.current)==null?void 0:i.querySelector(`[data-index="${t}"]`);s==null||s.scrollIntoView({block:"nearest"})},[t]),e.length===0?null:a.jsx("div",{className:z("z-50 min-w-[220px] max-w-[280px] rounded-md border border-border","bg-popover shadow-md overflow-hidden","animate-in fade-in-0 zoom-in-95"),children:a.jsx("div",{ref:n,className:"max-h-[200px] overflow-y-auto p-1",role:"listbox",children:e.map((s,i)=>{const o=s.label.split(" ").map(c=>c[0]).join("").toUpperCase().slice(0,2)||"?",l=Rx(s.label);return a.jsxs("button",{"data-index":i,role:"option","aria-selected":i===t,onMouseDown:c=>{c.preventDefault(),r(s)},className:z("flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs cursor-pointer","transition-colors",i===t?"bg-accent text-accent-foreground":"hover:bg-accent/60"),children:[a.jsx(Rt,{className:"h-5 w-5 shrink-0",children:a.jsx($t,{className:z("text-[9px] font-semibold",l.bg,l.text),children:o})}),a.jsxs("div",{className:"flex flex-col items-start min-w-0",children:[a.jsx("span",{className:"font-medium text-foreground truncate leading-tight",children:s.label}),a.jsx("span",{className:"text-[10px] text-muted-foreground truncate leading-tight",children:s.email})]})]},s.id)})})})}function Es({onClick:e,active:t,title:r,children:n}){return a.jsx("button",{type:"button",title:r,onMouseDown:s=>{s.preventDefault(),e()},className:z("flex h-6 w-6 items-center justify-center rounded transition-colors shrink-0","text-muted-foreground hover:text-foreground hover:bg-muted",t&&"bg-muted text-foreground"),children:n})}function Cy(){return a.jsx("span",{className:"mx-0.5 h-3.5 w-px shrink-0 bg-border"})}const qc={active:!1,items:[],selectedIndex:0,rect:null,command:null};function Nk({issueId:e,projectId:t,compact:r,className:n,onSuccess:s}){const[i,o]=h.useState(!0),[l,c]=h.useState([]),[d,u]=h.useState(!1),[f,m]=h.useState(qc),p=h.useRef(null),x=h.useRef(async()=>{}),g=h.useRef(null),{user:v}=Ie(),y=r5(e),j=bk(e),{data:N}=la(t??""),w=h.useMemo(()=>N!=null&&N.members?N.members.filter(D=>D.user).map(D=>{const E=D.user,Z=`${E.first_name??""} ${E.last_name??""}`.trim()||E.email;return{id:E.id,label:Z,email:E.email}}):[],[N]),k=h.useRef([]);k.current=w;const b=h.useRef(m);b.current=m;const C=h.useRef([]),_=h.useRef(null),S=h.useRef(0),I=(v==null?void 0:v.first_name)??"",A=(v==null?void 0:v.last_name)??"",O=`${I} ${A}`.trim()||(v==null?void 0:v.email)||"?",L=v&&`${I[0]??""}${A[0]??""}`.toUpperCase()||"?",F=Rx(O),X=h.useMemo(()=>_E.create({name:"submitShortcut",addKeyboardShortcuts(){return{"Mod-Enter":()=>(x.current(),!0)}}}),[]),T=h.useMemo(()=>$$.configure({HTMLAttributes:{class:"mention"},suggestion:{items:({query:D})=>{const E=k.current;if(!E.length)return[];const Z=D.toLowerCase();return E.filter(B=>!Z||B.label.toLowerCase().includes(Z)||B.email.toLowerCase().includes(Z)).slice(0,8)},render:()=>({onStart:D=>{var E;C.current=D.items,_.current=D.command,S.current=0,b.current({active:!0,items:D.items,selectedIndex:0,rect:((E=D.clientRect)==null?void 0:E.call(D))??null,command:D.command})},onUpdate:D=>{var E;C.current=D.items,_.current=D.command,S.current=0,b.current({active:!0,items:D.items,selectedIndex:0,rect:((E=D.clientRect)==null?void 0:E.call(D))??null,command:D.command})},onKeyDown:({event:D})=>{var Z;const E=C.current;if(!E.length)return!1;if(D.key==="Escape")return b.current(qc),!0;if(D.key==="ArrowDown"){const B=(S.current+1)%E.length;return S.current=B,b.current(Y=>({...Y,selectedIndex:B})),!0}if(D.key==="ArrowUp"){const B=(S.current-1+E.length)%E.length;return S.current=B,b.current(Y=>({...Y,selectedIndex:B})),!0}if(D.key==="Enter"){const B=E[S.current];return B&&((Z=_.current)==null||Z.call(_,B)),!0}return!1},onExit:()=>{b.current(qc),_.current=null}})}}),[]),G=u1({extensions:[f1,m1,h1.configure({placeholder:"Leave a comment… (type @ to mention)"}),X,T],editorProps:{attributes:{class:"meridian-editor"}},onUpdate({editor:D}){o(D.isEmpty)}}),re=!i||l.length>0,J=25*1024*1024,P=D=>{const E=D.filter(B=>B.size>J);E.length>0&&H.error(`Files must be under 25 MB: ${E.map(B=>B.name).join(", ")}`);const Z=D.filter(B=>B.size<=J);c(B=>{const Y=new Set(B.map(ae=>`${ae.name}-${ae.size}`));return[...B,...Z.filter(ae=>!Y.has(`${ae.name}-${ae.size}`))]})},M=D=>{c(E=>E.filter((Z,B)=>B!==D))},R=h.useCallback(D=>{var E;(E=_.current)==null||E.call(_,D),m(qc)},[]),U=async()=>{if(!(!re||d)){u(!0);try{const D=G!=null&&G.isEmpty?"":(G==null?void 0:G.getHTML())??"",E=[];D&&new DOMParser().parseFromString(D,"text/html").querySelectorAll("[data-type='mention']").forEach(se=>{const V=se.getAttribute("data-id");V&&!E.includes(V)&&E.push(V)});const Z=E.length>0?{mentioned_user_ids:E}:void 0,Y=(await y.mutateAsync({body:D||" ",metadata:Z})).comment.id;for(const ae of l)await j.mutateAsync({file:ae,commentId:Y});G==null||G.commands.clearContent(),o(!0),c([]),H.success("Comment added"),s==null||s()}catch{H.error("Failed to add comment")}finally{u(!1)}}};x.current=U;const $="h-3 w-3",K=h.useMemo(()=>{if(!f.rect||!g.current)return{bottom:"105%",left:0};const D=g.current.getBoundingClientRect(),E=Math.max(0,f.rect.left-D.left);return{top:f.rect.bottom-D.top+4,left:E}},[f.rect]);return a.jsxs("div",{className:z("flex gap-3 items-start",n),children:[a.jsx(Rt,{className:"h-7 w-7 shrink-0 mt-1",children:a.jsx($t,{className:z("text-[11px] font-semibold",F.bg,F.text),children:L})}),a.jsxs("div",{className:"flex-1 min-w-0 relative",ref:g,children:[a.jsxs("div",{className:z("rounded-md border border-input overflow-hidden transition-shadow","focus-within:ring-1 focus-within:ring-ring",d&&"opacity-60 pointer-events-none"),children:[G&&a.jsxs("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-border/70 bg-muted/30",children:[a.jsx(Es,{title:"Bold (⌘B)",active:G.isActive("bold"),onClick:()=>G.chain().focus().toggleBold().run(),children:a.jsx(A1,{className:$})}),a.jsx(Es,{title:"Italic (⌘I)",active:G.isActive("italic"),onClick:()=>G.chain().focus().toggleItalic().run(),children:a.jsx(F1,{className:$})}),a.jsx(Es,{title:"Strikethrough",active:G.isActive("strike"),onClick:()=>G.chain().focus().toggleStrike().run(),children:a.jsx(H1,{className:$})}),a.jsx(Es,{title:"Inline code",active:G.isActive("code"),onClick:()=>G.chain().focus().toggleCode().run(),children:a.jsx(z1,{className:$})}),a.jsx(Cy,{}),a.jsx(Es,{title:"Bullet list",active:G.isActive("bulletList"),onClick:()=>G.chain().focus().toggleBulletList().run(),children:a.jsx(ax,{className:$})}),a.jsx(Es,{title:"Ordered list",active:G.isActive("orderedList"),onClick:()=>G.chain().focus().toggleOrderedList().run(),children:a.jsx(W1,{className:$})}),a.jsx(Cy,{}),a.jsx(Es,{title:"Code block",active:G.isActive("codeBlock"),onClick:()=>G.chain().focus().toggleCodeBlock().run(),children:a.jsx($1,{className:$})})]}),a.jsx(p1,{editor:G,className:z("px-3 py-2.5 text-sm",r?"min-h-[68px]":"min-h-[80px]")})]}),l.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:l.map((D,E)=>a.jsxs("span",{className:"inline-flex items-center gap-1 pl-1.5 pr-1 py-0.5 rounded-md bg-muted border border-border text-[11px] text-foreground max-w-[180px]",children:[a.jsx(Dx,{mimeType:D.type,className:"h-3 w-3 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"truncate",children:D.name}),a.jsxs("span",{className:"text-muted-foreground shrink-0",children:["(",cf(D.size),")"]}),a.jsx("button",{type:"button",onClick:()=>M(E),className:"ml-0.5 rounded hover:text-destructive transition-colors shrink-0",children:a.jsx(tt,{className:"h-3 w-3"})})]},E))}),a.jsxs("div",{className:"flex items-center justify-between mt-2",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(ne,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>{var D;return(D=p.current)==null?void 0:D.click()},disabled:d,title:"Attach files",children:a.jsx(sx,{className:"h-3.5 w-3.5"})}),a.jsxs("span",{className:"text-[11px] text-muted-foreground/50 hidden sm:block",children:[a.jsx("kbd",{className:"px-1 py-0.5 rounded border border-border bg-muted font-mono text-[10px]",children:"⌘ Enter"})," to submit"]})]}),a.jsx(ne,{size:"icon",className:"h-8 w-8",onClick:U,disabled:!re||d,children:a.jsx(C5,{className:"h-3.5 w-3.5"})})]}),a.jsx("input",{ref:p,type:"file",multiple:!0,className:"hidden",onChange:D=>{const E=Array.from(D.target.files??[]);E.length>0&&P(E),D.target.value=""}}),f.active&&f.items.length>0&&a.jsx("div",{className:"absolute z-[9999]",style:K,children:a.jsx(z$,{items:f.items,selectedIndex:f.selectedIndex,onSelect:R})})]})]})}/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:kk,setPrototypeOf:_y,isFrozen:L$,getPrototypeOf:F$,getOwnPropertyDescriptor:B$}=Object;let{freeze:Pr,seal:mn,create:Eh}=Object,{apply:Ah,construct:Dh}=typeof Reflect<"u"&&Reflect;Pr||(Pr=function(t){return t});mn||(mn=function(t){return t});Ah||(Ah=function(t,r){for(var n=arguments.length,s=new Array(n>2?n-2:0),i=2;i<n;i++)s[i-2]=arguments[i];return t.apply(r,s)});Dh||(Dh=function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return new t(...n)});const Hc=Er(Array.prototype.forEach),W$=Er(Array.prototype.lastIndexOf),My=Er(Array.prototype.pop),Yo=Er(Array.prototype.push),U$=Er(Array.prototype.splice),vd=Er(String.prototype.toLowerCase),Im=Er(String.prototype.toString),Rm=Er(String.prototype.match),Go=Er(String.prototype.replace),q$=Er(String.prototype.indexOf),H$=Er(String.prototype.trim),jn=Er(Object.prototype.hasOwnProperty),wr=Er(RegExp.prototype.test),Vo=K$(TypeError);function Er(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return Ah(e,t,n)}}function K$(e){return function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return Dh(e,r)}}function We(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:vd;_y&&_y(e,null);let n=t.length;for(;n--;){let s=t[n];if(typeof s=="string"){const i=r(s);i!==s&&(L$(t)||(t[n]=i),s=i)}e[s]=!0}return e}function Y$(e){for(let t=0;t<e.length;t++)jn(e,t)||(e[t]=null);return e}function qn(e){const t=Eh(null);for(const[r,n]of kk(e))jn(e,r)&&(Array.isArray(n)?t[r]=Y$(n):n&&typeof n=="object"&&n.constructor===Object?t[r]=qn(n):t[r]=n);return t}function Xo(e,t){for(;e!==null;){const n=B$(e,t);if(n){if(n.get)return Er(n.get);if(typeof n.value=="function")return Er(n.value)}e=F$(e)}function r(){return null}return r}const Oy=Pr(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),$m=Pr(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),zm=Pr(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),G$=Pr(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Lm=Pr(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),V$=Pr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Py=Pr(["#text"]),Ey=Pr(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Fm=Pr(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Ay=Pr(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Kc=Pr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),X$=mn(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Q$=mn(/<%[\w\W]*|[\w\W]*%>/gm),Z$=mn(/\$\{[\w\W]*/gm),J$=mn(/^data-[\-\w.\u00B7-\uFFFF]+$/),e6=mn(/^aria-[\-\w]+$/),Sk=mn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),t6=mn(/^(?:\w+script|data):/i),r6=mn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ck=mn(/^html$/i),n6=mn(/^[a-z][.\w]*(-[.\w]+)+$/i);var Dy=Object.freeze({__proto__:null,ARIA_ATTR:e6,ATTR_WHITESPACE:r6,CUSTOM_ELEMENT:n6,DATA_ATTR:J$,DOCTYPE_NAME:Ck,ERB_EXPR:Q$,IS_ALLOWED_URI:Sk,IS_SCRIPT_OR_DATA:t6,MUSTACHE_EXPR:X$,TMPLIT_EXPR:Z$});const Qo={element:1,text:3,progressingInstruction:7,comment:8,document:9},a6=function(){return typeof window>"u"?null:window},s6=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let n=null;const s="data-tt-policy-suffix";r&&r.hasAttribute(s)&&(n=r.getAttribute(s));const i="dompurify"+(n?"#"+n:"");try{return t.createPolicy(i,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Ty=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function _k(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:a6();const t=Pe=>_k(Pe);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Qo.document||!e.Element)return t.isSupported=!1,t;let{document:r}=e;const n=r,s=n.currentScript,{DocumentFragment:i,HTMLTemplateElement:o,Node:l,Element:c,NodeFilter:d,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:m,trustedTypes:p}=e,x=c.prototype,g=Xo(x,"cloneNode"),v=Xo(x,"remove"),y=Xo(x,"nextSibling"),j=Xo(x,"childNodes"),N=Xo(x,"parentNode");if(typeof o=="function"){const Pe=r.createElement("template");Pe.content&&Pe.content.ownerDocument&&(r=Pe.content.ownerDocument)}let w,k="";const{implementation:b,createNodeIterator:C,createDocumentFragment:_,getElementsByTagName:S}=r,{importNode:I}=n;let A=Ty();t.isSupported=typeof kk=="function"&&typeof N=="function"&&b&&b.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:O,ERB_EXPR:L,TMPLIT_EXPR:F,DATA_ATTR:X,ARIA_ATTR:T,IS_SCRIPT_OR_DATA:G,ATTR_WHITESPACE:re,CUSTOM_ELEMENT:J}=Dy;let{IS_ALLOWED_URI:P}=Dy,M=null;const R=We({},[...Oy,...$m,...zm,...Lm,...Py]);let U=null;const $=We({},[...Ey,...Fm,...Ay,...Kc]);let K=Object.seal(Eh(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),D=null,E=null;const Z=Object.seal(Eh(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let B=!0,Y=!0,ae=!1,ee=!0,se=!1,V=!0,ie=!1,pe=!1,ue=!1,ve=!1,Q=!1,ge=!1,De=!0,Ue=!1;const Be="user-content-";let Ve=!0,ut=!1,Ke={},Ze=null;const tr=We({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ir=null;const rr=We({},["audio","video","img","source","image","track"]);let yr=null;const nr=We({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),yt="http://www.w3.org/1998/Math/MathML",Lt="http://www.w3.org/2000/svg",Kt="http://www.w3.org/1999/xhtml";let ar=Kt,$n=!1,fa=null;const Oe=We({},[yt,Lt,Kt],Im);let xe=We({},["mi","mo","mn","ms","mtext"]),Ne=We({},["annotation-xml"]);const he=We({},["title","style","font","a","script"]);let ye=null;const Xe=["application/xhtml+xml","text/html"],de="text/html";let _e=null,Te=null;const bt=r.createElement("form"),rt=function(q){return q instanceof RegExp||q instanceof Function},nt=function(){let q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Te&&Te===q)){if((!q||typeof q!="object")&&(q={}),q=qn(q),ye=Xe.indexOf(q.PARSER_MEDIA_TYPE)===-1?de:q.PARSER_MEDIA_TYPE,_e=ye==="application/xhtml+xml"?Im:vd,M=jn(q,"ALLOWED_TAGS")?We({},q.ALLOWED_TAGS,_e):R,U=jn(q,"ALLOWED_ATTR")?We({},q.ALLOWED_ATTR,_e):$,fa=jn(q,"ALLOWED_NAMESPACES")?We({},q.ALLOWED_NAMESPACES,Im):Oe,yr=jn(q,"ADD_URI_SAFE_ATTR")?We(qn(nr),q.ADD_URI_SAFE_ATTR,_e):nr,Ir=jn(q,"ADD_DATA_URI_TAGS")?We(qn(rr),q.ADD_DATA_URI_TAGS,_e):rr,Ze=jn(q,"FORBID_CONTENTS")?We({},q.FORBID_CONTENTS,_e):tr,D=jn(q,"FORBID_TAGS")?We({},q.FORBID_TAGS,_e):qn({}),E=jn(q,"FORBID_ATTR")?We({},q.FORBID_ATTR,_e):qn({}),Ke=jn(q,"USE_PROFILES")?q.USE_PROFILES:!1,B=q.ALLOW_ARIA_ATTR!==!1,Y=q.ALLOW_DATA_ATTR!==!1,ae=q.ALLOW_UNKNOWN_PROTOCOLS||!1,ee=q.ALLOW_SELF_CLOSE_IN_ATTR!==!1,se=q.SAFE_FOR_TEMPLATES||!1,V=q.SAFE_FOR_XML!==!1,ie=q.WHOLE_DOCUMENT||!1,ve=q.RETURN_DOM||!1,Q=q.RETURN_DOM_FRAGMENT||!1,ge=q.RETURN_TRUSTED_TYPE||!1,ue=q.FORCE_BODY||!1,De=q.SANITIZE_DOM!==!1,Ue=q.SANITIZE_NAMED_PROPS||!1,Ve=q.KEEP_CONTENT!==!1,ut=q.IN_PLACE||!1,P=q.ALLOWED_URI_REGEXP||Sk,ar=q.NAMESPACE||Kt,xe=q.MATHML_TEXT_INTEGRATION_POINTS||xe,Ne=q.HTML_INTEGRATION_POINTS||Ne,K=q.CUSTOM_ELEMENT_HANDLING||{},q.CUSTOM_ELEMENT_HANDLING&&rt(q.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(K.tagNameCheck=q.CUSTOM_ELEMENT_HANDLING.tagNameCheck),q.CUSTOM_ELEMENT_HANDLING&&rt(q.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(K.attributeNameCheck=q.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),q.CUSTOM_ELEMENT_HANDLING&&typeof q.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(K.allowCustomizedBuiltInElements=q.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),se&&(Y=!1),Q&&(ve=!0),Ke&&(M=We({},Py),U=[],Ke.html===!0&&(We(M,Oy),We(U,Ey)),Ke.svg===!0&&(We(M,$m),We(U,Fm),We(U,Kc)),Ke.svgFilters===!0&&(We(M,zm),We(U,Fm),We(U,Kc)),Ke.mathMl===!0&&(We(M,Lm),We(U,Ay),We(U,Kc))),q.ADD_TAGS&&(typeof q.ADD_TAGS=="function"?Z.tagCheck=q.ADD_TAGS:(M===R&&(M=qn(M)),We(M,q.ADD_TAGS,_e))),q.ADD_ATTR&&(typeof q.ADD_ATTR=="function"?Z.attributeCheck=q.ADD_ATTR:(U===$&&(U=qn(U)),We(U,q.ADD_ATTR,_e))),q.ADD_URI_SAFE_ATTR&&We(yr,q.ADD_URI_SAFE_ATTR,_e),q.FORBID_CONTENTS&&(Ze===tr&&(Ze=qn(Ze)),We(Ze,q.FORBID_CONTENTS,_e)),q.ADD_FORBID_CONTENTS&&(Ze===tr&&(Ze=qn(Ze)),We(Ze,q.ADD_FORBID_CONTENTS,_e)),Ve&&(M["#text"]=!0),ie&&We(M,["html","head","body"]),M.table&&(We(M,["tbody"]),delete D.tbody),q.TRUSTED_TYPES_POLICY){if(typeof q.TRUSTED_TYPES_POLICY.createHTML!="function")throw Vo('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof q.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Vo('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=q.TRUSTED_TYPES_POLICY,k=w.createHTML("")}else w===void 0&&(w=s6(p,s)),w!==null&&typeof k=="string"&&(k=w.createHTML(""));Pr&&Pr(q),Te=q}},br=We({},[...$m,...zm,...G$]),sr=We({},[...Lm,...V$]),zn=function(q){let me=N(q);(!me||!me.tagName)&&(me={namespaceURI:ar,tagName:"template"});const ke=vd(q.tagName),xt=vd(me.tagName);return fa[q.namespaceURI]?q.namespaceURI===Lt?me.namespaceURI===Kt?ke==="svg":me.namespaceURI===yt?ke==="svg"&&(xt==="annotation-xml"||xe[xt]):!!br[ke]:q.namespaceURI===yt?me.namespaceURI===Kt?ke==="math":me.namespaceURI===Lt?ke==="math"&&Ne[xt]:!!sr[ke]:q.namespaceURI===Kt?me.namespaceURI===Lt&&!Ne[xt]||me.namespaceURI===yt&&!xe[xt]?!1:!sr[ke]&&(he[ke]||!br[ke]):!!(ye==="application/xhtml+xml"&&fa[q.namespaceURI]):!1},Ln=function(q){Yo(t.removed,{element:q});try{N(q).removeChild(q)}catch{v(q)}},Ms=function(q,me){try{Yo(t.removed,{attribute:me.getAttributeNode(q),from:me})}catch{Yo(t.removed,{attribute:null,from:me})}if(me.removeAttribute(q),q==="is")if(ve||Q)try{Ln(me)}catch{}else try{me.setAttribute(q,"")}catch{}},Pv=function(q){let me=null,ke=null;if(ue)q="<remove></remove>"+q;else{const At=Rm(q,/^[\r\n\t ]+/);ke=At&&At[0]}ye==="application/xhtml+xml"&&ar===Kt&&(q='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+q+"</body></html>");const xt=w?w.createHTML(q):q;if(ar===Kt)try{me=new m().parseFromString(xt,ye)}catch{}if(!me||!me.documentElement){me=b.createDocument(ar,"template",null);try{me.documentElement.innerHTML=$n?k:xt}catch{}}const mr=me.body||me.documentElement;return q&&ke&&mr.insertBefore(r.createTextNode(ke),mr.childNodes[0]||null),ar===Kt?S.call(me,ie?"html":"body")[0]:ie?me.documentElement:mr},Ev=function(q){return C.call(q.ownerDocument||q,q,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},fm=function(q){return q instanceof f&&(typeof q.nodeName!="string"||typeof q.textContent!="string"||typeof q.removeChild!="function"||!(q.attributes instanceof u)||typeof q.removeAttribute!="function"||typeof q.setAttribute!="function"||typeof q.namespaceURI!="string"||typeof q.insertBefore!="function"||typeof q.hasChildNodes!="function")},Av=function(q){return typeof l=="function"&&q instanceof l};function ma(Pe,q,me){Hc(Pe,ke=>{ke.call(t,q,me,Te)})}const Dv=function(q){let me=null;if(ma(A.beforeSanitizeElements,q,null),fm(q))return Ln(q),!0;const ke=_e(q.nodeName);if(ma(A.uponSanitizeElement,q,{tagName:ke,allowedTags:M}),V&&q.hasChildNodes()&&!Av(q.firstElementChild)&&wr(/<[/\w!]/g,q.innerHTML)&&wr(/<[/\w!]/g,q.textContent)||q.nodeType===Qo.progressingInstruction||V&&q.nodeType===Qo.comment&&wr(/<[/\w]/g,q.data))return Ln(q),!0;if(!(Z.tagCheck instanceof Function&&Z.tagCheck(ke))&&(!M[ke]||D[ke])){if(!D[ke]&&Iv(ke)&&(K.tagNameCheck instanceof RegExp&&wr(K.tagNameCheck,ke)||K.tagNameCheck instanceof Function&&K.tagNameCheck(ke)))return!1;if(Ve&&!Ze[ke]){const xt=N(q)||q.parentNode,mr=j(q)||q.childNodes;if(mr&&xt){const At=mr.length;for(let Rr=At-1;Rr>=0;--Rr){const ha=g(mr[Rr],!0);ha.__removalCount=(q.__removalCount||0)+1,xt.insertBefore(ha,y(q))}}}return Ln(q),!0}return q instanceof c&&!zn(q)||(ke==="noscript"||ke==="noembed"||ke==="noframes")&&wr(/<\/no(script|embed|frames)/i,q.innerHTML)?(Ln(q),!0):(se&&q.nodeType===Qo.text&&(me=q.textContent,Hc([O,L,F],xt=>{me=Go(me,xt," ")}),q.textContent!==me&&(Yo(t.removed,{element:q.cloneNode()}),q.textContent=me)),ma(A.afterSanitizeElements,q,null),!1)},Tv=function(q,me,ke){if(De&&(me==="id"||me==="name")&&(ke in r||ke in bt))return!1;if(!(Y&&!E[me]&&wr(X,me))){if(!(B&&wr(T,me))){if(!(Z.attributeCheck instanceof Function&&Z.attributeCheck(me,q))){if(!U[me]||E[me]){if(!(Iv(q)&&(K.tagNameCheck instanceof RegExp&&wr(K.tagNameCheck,q)||K.tagNameCheck instanceof Function&&K.tagNameCheck(q))&&(K.attributeNameCheck instanceof RegExp&&wr(K.attributeNameCheck,me)||K.attributeNameCheck instanceof Function&&K.attributeNameCheck(me,q))||me==="is"&&K.allowCustomizedBuiltInElements&&(K.tagNameCheck instanceof RegExp&&wr(K.tagNameCheck,ke)||K.tagNameCheck instanceof Function&&K.tagNameCheck(ke))))return!1}else if(!yr[me]){if(!wr(P,Go(ke,re,""))){if(!((me==="src"||me==="xlink:href"||me==="href")&&q!=="script"&&q$(ke,"data:")===0&&Ir[q])){if(!(ae&&!wr(G,Go(ke,re,"")))){if(ke)return!1}}}}}}}return!0},Iv=function(q){return q!=="annotation-xml"&&Rm(q,J)},Rv=function(q){ma(A.beforeSanitizeAttributes,q,null);const{attributes:me}=q;if(!me||fm(q))return;const ke={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:U,forceKeepAttr:void 0};let xt=me.length;for(;xt--;){const mr=me[xt],{name:At,namespaceURI:Rr,value:ha}=mr,Pi=_e(At),mm=ha;let ir=At==="value"?mm:H$(mm);if(ke.attrName=Pi,ke.attrValue=ir,ke.keepAttr=!0,ke.forceKeepAttr=void 0,ma(A.uponSanitizeAttribute,q,ke),ir=ke.attrValue,Ue&&(Pi==="id"||Pi==="name")&&(Ms(At,q),ir=Be+ir),V&&wr(/((--!?|])>)|<\/(style|title|textarea)/i,ir)){Ms(At,q);continue}if(Pi==="attributename"&&Rm(ir,"href")){Ms(At,q);continue}if(ke.forceKeepAttr)continue;if(!ke.keepAttr){Ms(At,q);continue}if(!ee&&wr(/\/>/i,ir)){Ms(At,q);continue}se&&Hc([O,L,F],zv=>{ir=Go(ir,zv," ")});const $v=_e(q.nodeName);if(!Tv($v,Pi,ir)){Ms(At,q);continue}if(w&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!Rr)switch(p.getAttributeType($v,Pi)){case"TrustedHTML":{ir=w.createHTML(ir);break}case"TrustedScriptURL":{ir=w.createScriptURL(ir);break}}if(ir!==mm)try{Rr?q.setAttributeNS(Rr,At,ir):q.setAttribute(At,ir),fm(q)?Ln(q):My(t.removed)}catch{Ms(At,q)}}ma(A.afterSanitizeAttributes,q,null)},xP=function Pe(q){let me=null;const ke=Ev(q);for(ma(A.beforeSanitizeShadowDOM,q,null);me=ke.nextNode();)ma(A.uponSanitizeShadowNode,me,null),Dv(me),Rv(me),me.content instanceof i&&Pe(me.content);ma(A.afterSanitizeShadowDOM,q,null)};return t.sanitize=function(Pe){let q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},me=null,ke=null,xt=null,mr=null;if($n=!Pe,$n&&(Pe="<!-->"),typeof Pe!="string"&&!Av(Pe))if(typeof Pe.toString=="function"){if(Pe=Pe.toString(),typeof Pe!="string")throw Vo("dirty is not a string, aborting")}else throw Vo("toString is not a function");if(!t.isSupported)return Pe;if(pe||nt(q),t.removed=[],typeof Pe=="string"&&(ut=!1),ut){if(Pe.nodeName){const ha=_e(Pe.nodeName);if(!M[ha]||D[ha])throw Vo("root node is forbidden and cannot be sanitized in-place")}}else if(Pe instanceof l)me=Pv("<!---->"),ke=me.ownerDocument.importNode(Pe,!0),ke.nodeType===Qo.element&&ke.nodeName==="BODY"||ke.nodeName==="HTML"?me=ke:me.appendChild(ke);else{if(!ve&&!se&&!ie&&Pe.indexOf("<")===-1)return w&&ge?w.createHTML(Pe):Pe;if(me=Pv(Pe),!me)return ve?null:ge?k:""}me&&ue&&Ln(me.firstChild);const At=Ev(ut?Pe:me);for(;xt=At.nextNode();)Dv(xt),Rv(xt),xt.content instanceof i&&xP(xt.content);if(ut)return Pe;if(ve){if(Q)for(mr=_.call(me.ownerDocument);me.firstChild;)mr.appendChild(me.firstChild);else mr=me;return(U.shadowroot||U.shadowrootmode)&&(mr=I.call(n,mr,!0)),mr}let Rr=ie?me.outerHTML:me.innerHTML;return ie&&M["!doctype"]&&me.ownerDocument&&me.ownerDocument.doctype&&me.ownerDocument.doctype.name&&wr(Ck,me.ownerDocument.doctype.name)&&(Rr="<!DOCTYPE "+me.ownerDocument.doctype.name+`>
557
- `+Rr),se&&Hc([O,L,F],ha=>{Rr=Go(Rr,ha," ")}),w&&ge?w.createHTML(Rr):Rr},t.setConfig=function(){let Pe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};nt(Pe),pe=!0},t.clearConfig=function(){Te=null,pe=!1},t.isValidAttribute=function(Pe,q,me){Te||nt({});const ke=_e(Pe),xt=_e(q);return Tv(ke,xt,me)},t.addHook=function(Pe,q){typeof q=="function"&&Yo(A[Pe],q)},t.removeHook=function(Pe,q){if(q!==void 0){const me=W$(A[Pe],q);return me===-1?void 0:U$(A[Pe],me,1)[0]}return My(A[Pe])},t.removeHooks=function(Pe){A[Pe]=[]},t.removeAllHooks=function(){A=Ty()},t}var i6=_k();function o6({onClick:e,active:t,disabled:r,title:n,children:s}){return a.jsx("button",{type:"button",title:n,disabled:r,onMouseDown:i=>{i.preventDefault(),e()},className:z("flex h-[26px] w-[26px] items-center justify-center rounded transition-colors shrink-0","text-muted-foreground hover:text-foreground hover:bg-muted","disabled:opacity-30 disabled:cursor-not-allowed",t&&"bg-muted text-foreground"),children:s})}function Yc(){return a.jsx("span",{className:"mx-0.5 h-4 w-px shrink-0 bg-border"})}function Tx({content:e="",onChange:t,placeholder:r="Add a description…",className:n,toolbarClassName:s,editorClassName:i}){const o=u1({extensions:[f1.configure({heading:{levels:[1,2,3]}}),m1,ME,OE.configure({nested:!0}),h1.configure({placeholder:r})],content:e||"",editorProps:{attributes:{class:"meridian-editor"}},onUpdate({editor:d}){t&&t(d.isEmpty?"":d.getHTML())}});if(!o)return null;const l=(d,u,f,m,p)=>a.jsx(o6,{title:d,onClick:f,active:m,disabled:p,children:u},d),c="h-3.5 w-3.5";return a.jsxs("div",{className:z("flex flex-col overflow-hidden",n),children:[a.jsxs("div",{className:z("flex flex-wrap items-center gap-0.5 px-3 py-1.5 border-b border-border bg-muted/30",s),children:[l("Undo",a.jsx(R5,{className:c}),()=>o.chain().focus().undo().run(),!1,!o.can().undo()),l("Redo",a.jsx(S5,{className:c}),()=>o.chain().focus().redo().run(),!1,!o.can().redo()),a.jsx(Yc,{}),l("Bold (⌘B)",a.jsx(A1,{className:c}),()=>o.chain().focus().toggleBold().run(),o.isActive("bold")),l("Italic (⌘I)",a.jsx(F1,{className:c}),()=>o.chain().focus().toggleItalic().run(),o.isActive("italic")),l("Underline (⌘U)",a.jsx(I5,{className:c}),()=>o.chain().focus().toggleUnderline().run(),o.isActive("underline")),l("Strikethrough",a.jsx(H1,{className:c}),()=>o.chain().focus().toggleStrike().run(),o.isActive("strike")),l("Inline code",a.jsx(z1,{className:c}),()=>o.chain().focus().toggleCode().run(),o.isActive("code")),a.jsx(Yc,{}),l("Heading 1",a.jsx(h5,{className:c}),()=>o.chain().focus().toggleHeading({level:1}).run(),o.isActive("heading",{level:1})),l("Heading 2",a.jsx(p5,{className:c}),()=>o.chain().focus().toggleHeading({level:2}).run(),o.isActive("heading",{level:2})),l("Heading 3",a.jsx(x5,{className:c}),()=>o.chain().focus().toggleHeading({level:3}).run(),o.isActive("heading",{level:3})),a.jsx(Yc,{}),l("Bullet list",a.jsx(ax,{className:c}),()=>o.chain().focus().toggleBulletList().run(),o.isActive("bulletList")),l("Ordered list",a.jsx(W1,{className:c}),()=>o.chain().focus().toggleOrderedList().run(),o.isActive("orderedList")),l("Task list",a.jsx(y5,{className:c}),()=>o.chain().focus().toggleTaskList().run(),o.isActive("taskList")),a.jsx(Yc,{}),l("Blockquote",a.jsx(k5,{className:c}),()=>o.chain().focus().toggleBlockquote().run(),o.isActive("blockquote")),l("Code block",a.jsx($1,{className:c}),()=>o.chain().focus().toggleCodeBlock().run(),o.isActive("codeBlock")),l("Divider line",a.jsx(Ba,{className:c}),()=>o.chain().focus().setHorizontalRule().run())]}),a.jsx(p1,{editor:o,className:z("flex-1 px-5 py-4",i)})]})}function Ix({html:e,className:t}){return e?a.jsx("div",{className:z("meridian-editor",t),dangerouslySetInnerHTML:{__html:i6.sanitize(e,{ADD_ATTR:["data-type","data-id","data-label"]})}}):null}const Iy=[{bg:"bg-indigo-100 dark:bg-indigo-900/50",text:"text-indigo-700 dark:text-indigo-300"},{bg:"bg-violet-100 dark:bg-violet-900/50",text:"text-violet-700 dark:text-violet-300"},{bg:"bg-emerald-100 dark:bg-emerald-900/50",text:"text-emerald-700 dark:text-emerald-300"},{bg:"bg-amber-100 dark:bg-amber-900/50",text:"text-amber-700 dark:text-amber-300"},{bg:"bg-rose-100 dark:bg-rose-900/50",text:"text-rose-700 dark:text-rose-300"},{bg:"bg-sky-100 dark:bg-sky-900/50",text:"text-sky-700 dark:text-sky-300"},{bg:"bg-teal-100 dark:bg-teal-900/50",text:"text-teal-700 dark:text-teal-300"},{bg:"bg-orange-100 dark:bg-orange-900/50",text:"text-orange-700 dark:text-orange-300"}];function Rx(e){let t=0;for(let r=0;r<e.length;r++)t=t*31+e.charCodeAt(r)&65535;return Iy[t%Iy.length]}function l6({body:e}){const t=e.trim();return t?/^<[a-z][\s\S]*>/i.test(t)?a.jsx(Ix,{html:t,className:"text-xs"}):a.jsx("p",{className:"text-xs text-foreground leading-relaxed whitespace-pre-wrap",children:t}):null}const Ry={created:{icon:dt,color:"text-emerald-600",bg:"bg-emerald-50 dark:bg-emerald-950/40"},status_changed:{icon:Qp,color:"text-indigo-500",bg:"bg-indigo-50 dark:bg-indigo-950/40"},assigned:{icon:po,color:"text-blue-500",bg:"bg-blue-50 dark:bg-blue-950/40"},unassigned:{icon:K1,color:"text-zinc-500",bg:"bg-zinc-100 dark:bg-zinc-800"},updated:{icon:si,color:"text-amber-500",bg:"bg-amber-50 dark:bg-amber-950/40"}};function c6(e,t){var s,i,o,l;const{action:r,changes:n}=e;if(r==="created")return"created this issue";if(r==="status_changed"){const c=(s=n==null?void 0:n.status)==null?void 0:s.from,d=(i=n==null?void 0:n.status)==null?void 0:i.to;return a.jsxs(a.Fragment,{children:["changed status",c&&a.jsxs(a.Fragment,{children:[" from ",a.jsx("strong",{className:"font-medium text-foreground",children:ci[c]??c})]}),d&&a.jsxs(a.Fragment,{children:[" to ",a.jsx("strong",{className:"font-medium text-foreground",children:ci[d]??d})]})]})}if(r==="assigned"||r==="unassigned"){const c=((o=n==null?void 0:n.assignee_ids)==null?void 0:o.to)??[],d=((l=n==null?void 0:n.assignee_ids)==null?void 0:l.from)??[],u=c.filter(p=>!d.includes(p)),f=d.filter(p=>!c.includes(p)),m=p=>{var x;return((x=t==null?void 0:t.get(p))==null?void 0:x.name)??p.slice(0,8)+"…"};return u.length>0&&f.length>0?a.jsx(a.Fragment,{children:"updated assignees"}):u.length>0?a.jsxs(a.Fragment,{children:["assigned ",a.jsx("strong",{className:"font-medium text-foreground",children:u.map(m).join(", ")})]}):f.length>0?a.jsxs(a.Fragment,{children:["unassigned ",a.jsx("strong",{className:"font-medium text-foreground",children:f.map(m).join(", ")})]}):"updated assignees"}if(r==="updated"&&n){const c=[];for(const[d,u]of Object.entries(n)){const{from:f,to:m}=u;d==="title"||d==="description"?c.push(a.jsxs("span",{children:["updated ",a.jsx("strong",{className:"font-medium text-foreground",children:d})]},d)):d==="priority"?c.push(a.jsxs("span",{children:["changed ",a.jsx("strong",{className:"font-medium text-foreground",children:"priority"}),f!=null&&a.jsxs(a.Fragment,{children:[" from ",a.jsx("strong",{className:"font-medium text-foreground",children:rn[f]??String(f)})]}),m!=null&&a.jsxs(a.Fragment,{children:[" to ",a.jsx("strong",{className:"font-medium text-foreground",children:rn[m]??String(m)})]})]},d)):d==="type"?c.push(a.jsxs("span",{children:["changed ",a.jsx("strong",{className:"font-medium text-foreground",children:"type"}),f!=null&&a.jsxs(a.Fragment,{children:[" from ",a.jsx("strong",{className:"font-medium text-foreground",children:Pa[f]??String(f)})]}),m!=null&&a.jsxs(a.Fragment,{children:[" to ",a.jsx("strong",{className:"font-medium text-foreground",children:Pa[m]??String(m)})]})]},d)):c.push(a.jsxs("span",{children:["updated ",a.jsx("strong",{className:"font-medium text-foreground",children:d.replace(/_/g," ")})]},d))}return c.length===0?"made changes":a.jsx(a.Fragment,{children:c.reduce((d,u,f)=>f===0?[u]:[...d,a.jsx("span",{children:" and "},`sep-${f}`),u],[])})}return r.replace(/_/g," ")}function Mk({issueId:e,projectId:t,className:r,compact:n,onViewMore:s,onTabChange:i,hideCommentInput:o}){const[l,c]=h.useState("comments"),d=w=>{c(w),i==null||i(w)},u=h.useRef(null),f=h.useRef(null),{user:m}=Ie(),{data:p}=ks(),{data:x,isLoading:g}=e5(e),{data:v,isLoading:y}=t5(e),{data:j}=yk(e);h.useEffect(()=>{var k;const w=x==null?void 0:x.length;w!==void 0&&(f.current!==null&&w>f.current&&((k=u.current)==null||k.scrollIntoView({behavior:"smooth",block:"nearest"})),f.current=w)},[x==null?void 0:x.length]);const N=w=>{var k;if(m&&w===m.id){const b=m.first_name??"",C=m.last_name??"",_=`${b} ${C}`.trim()||m.email,S=(b[0]??C[0]??((k=m.email)==null?void 0:k[0])??"U").toUpperCase();return{name:_,initials:S}}return(p==null?void 0:p.get(w))??{name:"Unknown",initials:"?"}};return a.jsxs("div",{className:r,children:[a.jsx("div",{className:"flex items-center gap-0 px-6 pt-3 border-b border-zinc-100 dark:border-zinc-800",children:["comments","activity","attachments","time"].map(w=>{const k=w==="comments"?(x==null?void 0:x.length)??0:w==="activity"?(v==null?void 0:v.length)??0:void 0,b=w==="comments"?"Comments":w==="activity"?"Activity":w==="attachments"?"Attachments":"Time",C=l===w;return a.jsxs("button",{onClick:()=>d(w),className:z("pb-2.5 mr-5 text-xs font-medium transition-colors border-b-2 -mb-px",C?"text-indigo-700 dark:text-indigo-300 border-indigo-500 dark:border-indigo-400":"border-transparent text-zinc-500 dark:text-zinc-400 hover:text-zinc-800 dark:hover:text-zinc-200"),children:[b,k!=null&&k>0&&a.jsx("span",{className:z("ml-1.5 text-[10px] tabular-nums font-normal",C?"text-indigo-700 dark:text-indigo-500":"text-zinc-400"),children:k})]},w)})}),l==="comments"&&a.jsxs("div",{className:"px-6 pb-5 pt-4",children:[a.jsx("div",{className:"space-y-5 mb-5",children:g?a.jsxs("div",{className:"flex gap-3",children:[a.jsx(le,{className:"h-7 w-7 rounded-full shrink-0"}),a.jsx(le,{className:"h-16 flex-1"})]}):x&&x.length>0?(n?x.slice(-5):x).map(w=>{const k=N(w.author_id),b=Rx(k.name),C=(j??[]).filter(_=>_.comment_id===w.id);return a.jsxs("div",{className:"flex gap-3",children:[a.jsx(Rt,{className:"h-7 w-7 mt-0.5 shrink-0",children:a.jsx($t,{className:z("text-[11px] font-semibold",b.bg,b.text),children:k.initials})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-baseline gap-2 mb-1.5",children:[a.jsx("span",{className:"text-xs font-semibold text-zinc-900 dark:text-zinc-100",children:k.name}),a.jsx("span",{className:"text-[11px] text-zinc-400 dark:text-zinc-500",children:fe(new Date(w.created_at),"MMM d, h:mm a")})]}),a.jsx("div",{className:"rounded-lg bg-zinc-50 dark:bg-zinc-900 border border-zinc-100 dark:border-zinc-800 px-3 py-2.5",children:a.jsx(l6,{body:w.body})}),C.length>0&&a.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:C.map(_=>a.jsx(g$,{attachment:_},_.id))})]})]},w.id)}):a.jsxs("div",{className:"flex flex-col items-center py-6 gap-2",children:[a.jsx("div",{className:"h-9 w-9 rounded-full bg-zinc-100 dark:bg-zinc-800 flex items-center justify-center",children:a.jsx(U1,{className:"h-4 w-4 text-zinc-400 dark:text-zinc-500"})}),a.jsx("p",{className:"text-xs text-zinc-400 dark:text-zinc-500",children:"No comments yet"})]})}),n&&x&&x.length>5&&s&&a.jsxs("button",{onClick:s,className:"text-xs text-indigo-700 hover:text-indigo-900 dark:text-indigo-300 dark:hover:text-indigo-100 mb-4 font-medium transition-colors",children:["View all ",x.length," comments →"]}),a.jsx("div",{ref:u}),!o&&a.jsx(Nk,{issueId:e,projectId:t})]}),l==="activity"&&a.jsx("div",{className:"px-6 pb-6 pt-4",children:y?a.jsx("div",{className:"space-y-4",children:[1,2,3].map(w=>a.jsxs("div",{className:"flex gap-3",children:[a.jsx(le,{className:"h-6 w-6 rounded-full shrink-0 mt-0.5"}),a.jsx(le,{className:"h-4 flex-1 mt-1"})]},w))}):v&&v.length>0?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute left-[11px] top-2 bottom-2 w-px bg-zinc-100 dark:bg-zinc-800"}),a.jsx("div",{className:"space-y-0",children:(n?v.slice(-5):v).map((w,k,b)=>{var A;const C=Ry[w.action]??Ry.updated,_=C.icon,S=((A=p==null?void 0:p.get(w.actor_id))==null?void 0:A.name)??"System",I=k===b.length-1;return a.jsxs("div",{className:z("relative flex gap-3",I?"pb-0":"pb-4"),children:[a.jsx("div",{className:z("relative z-10 flex h-6 w-6 shrink-0 items-center justify-center rounded-full mt-0.5",C.bg),children:a.jsx(_,{className:z("h-3 w-3",C.color)})}),a.jsxs("div",{className:"flex-1 min-w-0 pt-0.5",children:[a.jsxs("p",{className:"text-xs text-foreground leading-relaxed",children:[a.jsx("span",{className:"font-semibold text-zinc-900 dark:text-zinc-100",children:S})," ",a.jsx("span",{className:"text-zinc-500 dark:text-zinc-400",children:c6(w,p)})]}),a.jsx("p",{className:"text-[11px] text-zinc-400 dark:text-zinc-500 mt-0.5",children:fe(new Date(w.created_at),"MMM d, yyyy · h:mm a")})]})]},w.id)})})]}),n&&v.length>5&&s&&a.jsxs("button",{onClick:s,className:"text-xs text-indigo-700 hover:text-indigo-900 dark:text-indigo-300 dark:hover:text-indigo-100 mt-3 font-medium transition-colors",children:["View all ",v.length," events →"]})]}):a.jsx("p",{className:"text-xs text-zinc-400 dark:text-zinc-500 py-4",children:"No activity yet."})}),l==="attachments"&&a.jsx(b$,{issueId:e}),l==="time"&&a.jsx(E$,{issueId:e})]})}const Ok=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(r1,{ref:n,className:z("relative overflow-hidden",e),...r,children:[a.jsx(KP,{className:"h-full w-full rounded-[inherit]",children:t}),a.jsx(Pk,{}),a.jsx(YP,{})]}));Ok.displayName=r1.displayName;const Pk=h.forwardRef(({className:e,orientation:t="vertical",...r},n)=>a.jsx(n1,{ref:n,orientation:t,className:z("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-1.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-1.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:a.jsx(GP,{className:"relative flex-1 rounded-full bg-border"})}));Pk.displayName=n1.displayName;function d6(e,t){let r=0,n=e;for(;n!=null&&n.parent_id;)n=t.find(s=>s.id===n.parent_id),r++;return r}function u6(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}`}const f6={urgent:"bg-red-500",high:"bg-orange-500",medium:"bg-amber-500",low:"bg-sky-500",no_priority:"bg-zinc-400"};function m6(e,t){return e==="completed"?"bg-emerald-500":e==="in_progress"?"bg-indigo-500":e==="cancelled"?"bg-red-400":t!=null&&t.includes("block")?"bg-red-500":"bg-zinc-400"}const Fn=({children:e})=>a.jsx("p",{className:"text-[10px] font-semibold tracking-[0.08em] uppercase text-zinc-900 dark:text-zinc-100 mb-1.5",children:e}),Zo=()=>a.jsx("div",{className:"border-t border-zinc-100 dark:border-zinc-800"});function Ek({issue:e,projectId:t,open:r,onClose:n}){const s=pt(),{workspace:i,projectKey:o}=zt(),{data:l}=O1((e==null?void 0:e.id)??""),c=l??e,[d,u]=h.useState(!1),[f,m]=h.useState(""),[p,x]=h.useState(""),[g,v]=h.useState("comments"),[y,j]=h.useState(!1),[N,w]=h.useState(new Set),k=Ru((c==null?void 0:c.id)??"",t),{data:b}=la(t),C=h.useMemo(()=>b?b.members.filter(Q=>Q.user).map(Q=>Q.user):void 0,[b]),{data:_}=ko(t),{data:S}=So(t||void 0),{data:I}=fc(t||void 0),{data:A}=Ql(t||void 0),{data:O}=kx(),{data:L=[]}=Sx(new Date().getFullYear()),F=(S??[]).filter(Q=>Q.status!=="completed"),{data:X}=g4(),T=(X==null?void 0:X.maxChildIssueDepth)??1,re=(c?d6(c,A??[]):0)<T,J=c!=null&&c.parent_id?A==null?void 0:A.find(Q=>Q.id===c.parent_id):null,P=(A==null?void 0:A.filter(Q=>Q.parent_id===(c==null?void 0:c.id)))??[],M=c!=null&&c.task_list_id?I==null?void 0:I.find(Q=>Q.id===c.task_list_id):null,R=_&&_.length>0?Object.fromEntries(_.map(Q=>[Q.key,Q.name])):ci;if(h.useEffect(()=>{c&&(m(c.title),x(c.description??"")),u(!1)},[c==null?void 0:c.id]),!c)return null;const U=()=>{f.trim()&&k.mutate({title:f.trim(),description:p.trim()||void 0},{onSuccess:()=>{u(!1),H.success("Issue updated")},onError:()=>H.error("Failed to update issue")})},$=()=>{m(c.title),x(c.description??""),u(!1)},K=Q=>{k.mutate({status:Q},{onSuccess:()=>H.success("Status updated"),onError:()=>H.error("Failed to update status")})},D=Q=>{k.mutate({priority:Q},{onSuccess:()=>H.success("Priority updated"),onError:()=>H.error("Failed to update priority")})},E=Q=>{k.mutate({type:Q},{onSuccess:()=>H.success("Type updated"),onError:()=>H.error("Failed to update type")})},Z=Q=>{k.mutate({assignee_ids:Q},{onSuccess:()=>H.success("Assignees updated"),onError:()=>H.error("Failed to update assignees")})},B=Q=>{k.mutate({sprint_id:Q},{onSuccess:()=>H.success(Q?"Sprint assigned":"Removed from sprint"),onError:()=>H.error("Failed to update sprint")})},Y=Q=>{k.mutate({task_list_id:Q},{onSuccess:()=>H.success(Q?"Moved to list":"Removed from list"),onError:()=>H.error("Failed to update list")})},ae=Q=>{k.mutate({start_date:Q?fe(Q,"yyyy-MM-dd"):null},{onSuccess:()=>H.success(Q?"Start date set":"Start date cleared"),onError:()=>H.error("Failed to update start date")})},ee=Q=>{k.mutate({due_date:Q?fe(Q,"yyyy-MM-dd"):null},{onSuccess:()=>H.success(Q?"Due date set":"Due date cleared"),onError:()=>H.error("Failed to update due date")})},se=Q=>{if(Q){const ge=c.start_date?new Date(c.start_date):new Date,De=new Date(ge);De.setDate(De.getDate()+7),k.mutate({recurrence_frequency:"weekly",next_occurrence_date:fe(De,"yyyy-MM-dd"),recurrence_end_date:null},{onSuccess:()=>H.success("Recurrence enabled"),onError:()=>H.error("Failed to enable recurrence")})}else k.mutate({recurrence_frequency:null,next_occurrence_date:null,recurrence_end_date:null},{onSuccess:()=>H.success("Recurrence stopped"),onError:()=>H.error("Failed to stop recurrence")})},V=Q=>{const ge=c.start_date?new Date(c.start_date):new Date,De=new Date(ge);Q==="weekly"?De.setDate(De.getDate()+7):De.setMonth(De.getMonth()+1),k.mutate({recurrence_frequency:Q,next_occurrence_date:fe(De,"yyyy-MM-dd")},{onSuccess:()=>H.success("Frequency updated"),onError:()=>H.error("Failed to update frequency")})},ie=Q=>{k.mutate({recurrence_end_date:Q?fe(Q,"yyyy-MM-dd"):null},{onSuccess:()=>H.success(Q?"End date set":"End date cleared"),onError:()=>H.error("Failed to update end date")})},pe=_==null?void 0:_.find(Q=>Q.category==="completed"),ue=!!pe&&c.status===pe.key,ve=(Q,ge,De)=>{const Ue=Q;return a.jsx("button",{title:ge,onClick:De,className:"h-8 w-8 flex items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:a.jsx(Ue,{className:"h-4 w-4"})},ge)};return a.jsxs(a.Fragment,{children:[a.jsx(Ni,{open:r,onOpenChange:Q=>!Q&&n(),children:a.jsxs(ki,{className:"flex flex-col p-0 w-full max-w-2xl overflow-hidden bg-white dark:bg-zinc-950",children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border shrink-0",children:[a.jsxs("button",{onClick:()=>{var Q;pe&&K(ue?((Q=_==null?void 0:_.find(ge=>ge.category==="unstarted"||ge.category==="backlog"))==null?void 0:Q.key)??c.status:pe.key)},className:z("flex items-center gap-1.5 px-3 py-1.5 rounded-md border text-xs font-medium transition-colors",ue?"border-emerald-500/40 text-emerald-600 dark:text-emerald-400 bg-emerald-50 dark:bg-emerald-950/30":"border-border text-muted-foreground hover:text-foreground hover:border-foreground/40"),children:[a.jsx(dr,{className:"h-3.5 w-3.5"}),ue?"Completed":"Mark complete"]}),a.jsxs("div",{className:"flex items-center",children:[ve(A5,"Upvote"),ve(sx,"Attachments"),re&&ve(Jn,"Add sub-issue",()=>j(!0)),ve(ai,"Copy link",()=>{navigator.clipboard.writeText(`${window.location.origin}/${i}/projects/${o}/issues/${c.id}`),H.success("Link copied")}),ve(b5,"Open full page",()=>{n(),s(`/${i}/projects/${o}/issues/${c.id}`)}),d?a.jsxs("div",{className:"flex items-center gap-1 ml-1",children:[a.jsx(ne,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:$,children:"Cancel"}),a.jsxs(ne,{size:"sm",className:"h-7 text-xs",onClick:U,disabled:!f.trim()||k.isPending,children:[a.jsx(dr,{className:"h-3.5 w-3.5 mr-1"}),"Save"]})]}):a.jsxs(Kr,{children:[a.jsx(Yr,{asChild:!0,children:ve(Ma,"More options")}),a.jsx(Or,{align:"end",className:"w-40",children:a.jsxs(at,{onClick:()=>u(!0),children:[a.jsx(si,{className:"h-3.5 w-3.5 mr-2"}),"Edit"]})})]}),ve(N5,"Open in full page",()=>{n(),s(`/${i}/projects/${o}/issues/${c.id}`)})]})]}),a.jsx("div",{className:"px-6 pt-5 pb-4 shrink-0",children:d?a.jsx(Ee,{value:f,onChange:Q=>m(Q.target.value),className:"text-sm font-medium h-8",autoFocus:!0}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[a.jsx("span",{className:"text-[11px] font-mono font-medium text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/60 px-1.5 py-0.5 rounded",children:c.identifier}),a.jsx("span",{className:"text-[10px] font-semibold tracking-widest uppercase text-violet-500 dark:text-violet-400",children:Pa[c.type]??c.type}),c.recurrence_frequency&&a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-emerald-700 dark:text-emerald-400 bg-emerald-50 dark:bg-emerald-950/50 border border-emerald-200 dark:border-emerald-800 px-1.5 py-0.5 rounded",children:[a.jsx(Vi,{className:"h-2.5 w-2.5"}),"Repeats ",c.recurrence_frequency==="weekly"?"Weekly":"Monthly"]}),c.recurrence_source_id&&a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-zinc-500 dark:text-zinc-400 bg-zinc-100 dark:bg-zinc-800 px-1.5 py-0.5 rounded",children:[a.jsx(Vi,{className:"h-2.5 w-2.5"}),"Recurring instance"]})]}),a.jsx("h2",{className:"text-[17px] font-semibold leading-snug text-zinc-900 dark:text-zinc-50",children:c.title})]})}),a.jsxs(Ok,{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"px-6 pb-4 space-y-5 min-w-0",children:[a.jsx(Cr,{zone:"issue.details.before",props:{issue:c}}),a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx(Fn,{children:"Status"}),a.jsxs(Le,{value:c.status,onValueChange:K,children:[a.jsx($e,{className:"h-8 text-xs min-w-0",children:a.jsx(qe,{})}),a.jsx(ze,{children:Object.entries(R).map(([Q,ge])=>{const De=_==null?void 0:_.find(Ue=>Ue.key===Q);return a.jsx(we,{value:Q,className:"text-xs",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:z("h-2 w-2 rounded-full shrink-0 flex-none",m6(De==null?void 0:De.category,Q))}),a.jsx("span",{children:ge})]})},Q)})})]})]}),a.jsxs("div",{className:"min-w-0",children:[a.jsx(Fn,{children:"Priority"}),a.jsxs(Le,{value:c.priority,onValueChange:D,children:[a.jsx($e,{className:"h-8 text-xs min-w-0",children:a.jsx(qe,{})}),a.jsx(ze,{children:Object.entries(rn).map(([Q,ge])=>a.jsx(we,{value:Q,className:"text-xs",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:z("h-2 w-2 rounded-full shrink-0 flex-none",f6[Q]??"bg-zinc-400")}),a.jsx("span",{children:ge})]})},Q))})]})]}),a.jsxs("div",{className:"min-w-0",children:[a.jsx(Fn,{children:"Type"}),a.jsxs(Le,{value:c.type,onValueChange:E,children:[a.jsx($e,{className:"h-8 text-xs min-w-0",children:a.jsx(qe,{})}),a.jsx(ze,{children:Object.entries(Pa).map(([Q,ge])=>a.jsx(we,{value:Q,className:"text-xs",children:ge},Q))})]})]})]}),a.jsx(Zo,{}),a.jsxs("div",{children:[a.jsx(Fn,{children:"Assignees"}),a.jsx(mc,{value:c.assignee_ids??[],onChange:Z,disabled:k.isPending,users:C})]}),a.jsx(Zo,{}),a.jsxs("div",{className:"flex gap-3 items-start min-w-0",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx(Fn,{children:"Sprint"}),a.jsxs(Le,{value:c.sprint_id??"none",onValueChange:Q=>B(Q==="none"?null:Q),children:[a.jsx($e,{className:"h-8 text-xs min-w-0",children:a.jsxs("div",{className:"flex items-center gap-1 min-w-0 overflow-hidden",children:[a.jsx(Hr,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),a.jsx(qe,{placeholder:"No sprint"})]})}),a.jsxs(ze,{children:[a.jsx(we,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),F.map(Q=>{const ge=u6(Q);return a.jsx(we,{value:Q.id,className:"text-xs",children:a.jsxs("div",{className:"flex items-baseline gap-1.5",children:[a.jsx("span",{children:Q.name}),ge&&a.jsx("span",{className:"text-[10px] text-muted-foreground font-normal",children:ge})]})},Q.id)})]})]})]}),(I??[]).length>0&&a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx(Fn,{children:"List"}),a.jsxs(Le,{value:c.task_list_id??"none",onValueChange:Q=>Y(Q==="none"?null:Q),children:[a.jsx($e,{className:"h-8 text-xs min-w-0",children:a.jsxs("div",{className:"flex items-center gap-1 min-w-0 overflow-hidden",children:[a.jsx(nx,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),a.jsx(qe,{placeholder:"No list",children:M?M.name:"No list"})]})}),a.jsxs(ze,{children:[a.jsx(we,{value:"none",className:"text-xs text-muted-foreground",children:"No list"}),(I??[]).map(Q=>a.jsx(we,{value:Q.id,className:"text-xs",children:Q.name},Q.id))]})]})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx(Fn,{children:"Start Date"}),a.jsxs(Ot,{children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{className:"flex items-center gap-1 h-8 w-full min-w-0 px-2 rounded border border-input text-xs hover:bg-accent transition-colors overflow-hidden",children:[a.jsx(Wt,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),a.jsx("span",{className:`truncate ${c.start_date?"text-foreground":"text-muted-foreground"}`,children:c.start_date?fe(new Date(c.start_date),"MMM d, yyyy"):"No date"})]})}),a.jsxs(_t,{className:"w-auto p-0",align:"start",children:[a.jsx(gr,{mode:"single",selected:c.start_date?new Date(c.start_date):void 0,onSelect:ae,initialFocus:!0}),c.start_date&&a.jsx("div",{className:"border-t px-3 py-2",children:a.jsxs("button",{onClick:()=>ae(void 0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[a.jsx(tt,{className:"h-3 w-3"}),"Clear date"]})})]})]})]}),(c==null?void 0:c.start_date)&&(c==null?void 0:c.due_date)&&(O==null?void 0:O.working_days)&&(()=>{const Q=Mh(new Date(c.start_date),new Date(c.due_date),O.working_days,L);return a.jsxs("div",{className:"shrink-0 self-end pb-1 text-[11px] text-muted-foreground whitespace-nowrap",children:[Q," biz day",Q!==1?"s":""]})})(),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx(Fn,{children:"Due Date"}),a.jsxs(Ot,{children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{className:"flex items-center gap-1 h-8 w-full min-w-0 px-2 rounded border border-input text-xs hover:bg-accent transition-colors overflow-hidden",children:[a.jsx(Wt,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),a.jsx("span",{className:`truncate ${c.due_date?"text-foreground":"text-muted-foreground"}`,children:c.due_date?fe(new Date(c.due_date),"MMM d, yyyy"):"No date"})]})}),a.jsxs(_t,{className:"w-auto p-0",align:"start",children:[a.jsx(gr,{mode:"single",selected:c.due_date?new Date(c.due_date):void 0,onSelect:ee,initialFocus:!0}),c.due_date&&a.jsx("div",{className:"border-t px-3 py-2",children:a.jsxs("button",{onClick:()=>ee(void 0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[a.jsx(tt,{className:"h-3 w-3"}),"Clear date"]})})]})]})]})]}),a.jsx(Zo,{}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(Fn,{children:"Recurring"}),a.jsx(Co,{checked:!!c.recurrence_frequency,onCheckedChange:se,disabled:k.isPending})]}),c.recurrence_frequency&&a.jsxs("div",{className:"space-y-2 pl-3 border-l-2 border-indigo-200 dark:border-indigo-800",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-[10px] font-medium text-muted-foreground mb-1",children:"Frequency"}),a.jsxs(Le,{value:c.recurrence_frequency,onValueChange:Q=>V(Q),children:[a.jsx($e,{className:"h-7 text-xs",children:a.jsx(qe,{})}),a.jsxs(ze,{children:[a.jsx(we,{value:"weekly",className:"text-xs",children:"Weekly"}),a.jsx(we,{value:"monthly",className:"text-xs",children:"Monthly"})]})]})]}),a.jsxs("div",{children:[a.jsxs("p",{className:"text-[10px] font-medium text-muted-foreground mb-1",children:["Until ",a.jsx("span",{className:"font-normal",children:"(optional)"})]}),a.jsxs(Ot,{children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{className:"flex items-center gap-1 h-7 w-full px-2 rounded border border-input text-xs hover:bg-accent transition-colors text-left",children:[a.jsx(Wt,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),a.jsx("span",{className:c.recurrence_end_date?"text-foreground":"text-muted-foreground",children:c.recurrence_end_date?fe(new Date(c.recurrence_end_date),"MMM d, yyyy"):"No end date"})]})}),a.jsxs(_t,{className:"w-auto p-0",align:"start",children:[a.jsx(gr,{mode:"single",selected:c.recurrence_end_date?new Date(c.recurrence_end_date):void 0,onSelect:ie,initialFocus:!0}),c.recurrence_end_date&&a.jsx("div",{className:"border-t px-3 py-2",children:a.jsxs("button",{onClick:()=>ie(void 0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[a.jsx(tt,{className:"h-3 w-3"}),"Clear end date"]})})]})]})]})]})]}),a.jsx(Zo,{}),re&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[10px] font-semibold tracking-[0.08em] uppercase text-zinc-900 dark:text-zinc-100",children:"Child Issues"}),a.jsxs("button",{onClick:()=>j(!0),className:"flex items-center gap-1 px-2 py-0.5 rounded-md bg-indigo-50 dark:bg-indigo-950/50 text-indigo-700 dark:text-indigo-300 text-[11px] font-medium hover:bg-indigo-100 dark:hover:bg-indigo-900/60 transition-colors",children:[a.jsx(dt,{className:"h-3 w-3"}),"Add"]})]}),J&&a.jsxs("button",{onClick:()=>s(`/${i}/projects/${o}/issues/${J.id}`),className:"flex items-center gap-2 w-full px-3 py-1.5 rounded-md bg-zinc-100 dark:bg-zinc-800/60 border border-zinc-200 dark:border-zinc-700 hover:border-indigo-300 dark:hover:border-indigo-700 transition-colors text-left",children:[a.jsx(Zp,{className:"h-3.5 w-3.5 text-zinc-400 shrink-0"}),a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-400 shrink-0",children:"Parent:"}),a.jsx("span",{className:"font-mono text-[11px] font-medium text-indigo-700 dark:text-indigo-300 shrink-0",children:J.identifier}),a.jsx("span",{className:"text-xs text-zinc-600 dark:text-zinc-300 truncate",children:J.title})]}),P.length===0?a.jsxs("button",{onClick:()=>j(!0),className:"w-full flex items-center justify-center gap-2 py-3.5 rounded-lg border-2 border-dashed border-zinc-200 dark:border-zinc-800 text-xs text-zinc-400 dark:text-zinc-500 hover:border-indigo-300 hover:text-indigo-500 dark:hover:border-indigo-700 dark:hover:text-indigo-400 transition-all",children:[a.jsx(dt,{className:"h-3.5 w-3.5"}),"Create child issue"]}):a.jsx("div",{className:"space-y-1",children:P.map(Q=>{const ge=(A??[]).filter(Be=>Be.parent_id===Q.id),De=ge.length>0,Ue=N.has(Q.id);return a.jsxs("div",{children:[a.jsxs("div",{className:"w-full flex items-center gap-2.5 px-3 py-2 rounded-lg bg-indigo-50/40 dark:bg-indigo-950/30 border border-indigo-200 dark:border-indigo-800 hover:bg-indigo-100/70 hover:border-indigo-400 dark:hover:bg-indigo-950/50 dark:hover:border-indigo-600 hover:shadow-sm transition-all group",children:[De?a.jsx("button",{onClick:()=>w(Be=>{const Ve=new Set(Be);return Ve.has(Q.id)?Ve.delete(Q.id):Ve.add(Q.id),Ve}),className:"shrink-0 text-indigo-400 dark:text-indigo-500 hover:text-indigo-600 dark:hover:text-indigo-300 transition-colors",children:Ue?a.jsx(ia,{className:"h-3.5 w-3.5"}):a.jsx(vr,{className:"h-3.5 w-3.5"})}):a.jsx(Mn,{className:"h-3.5 w-3.5 text-indigo-400 dark:text-indigo-500 shrink-0"}),a.jsxs("button",{onClick:()=>{n(),s(`/${i}/projects/${o}/issues/${Q.id}`)},className:"flex items-center gap-2.5 flex-1 min-w-0 text-left",children:[a.jsx("span",{className:"font-mono text-[11px] font-medium text-indigo-700 dark:text-indigo-300 shrink-0",children:Q.identifier}),a.jsx("span",{className:"text-xs text-zinc-700 dark:text-zinc-300 truncate group-hover:text-zinc-900 dark:group-hover:text-zinc-100 transition-colors",children:Q.title}),De&&a.jsxs("span",{className:"ml-auto shrink-0 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",children:[a.jsx(Mn,{className:"h-2.5 w-2.5"}),ge.length]})]})]}),De&&Ue&&a.jsx("div",{className:"mt-1 ml-6 space-y-1",children:ge.map(Be=>a.jsxs("button",{onClick:()=>{n(),s(`/${i}/projects/${o}/issues/${Be.id}`)},className:"w-full flex items-center gap-2.5 px-3 py-2 rounded-lg bg-indigo-50/20 dark:bg-indigo-950/20 border border-indigo-100 dark:border-indigo-900 hover:bg-indigo-100/70 hover:border-indigo-400 dark:hover:bg-indigo-950/50 dark:hover:border-indigo-600 hover:shadow-sm transition-all text-left group",children:[a.jsx(Mn,{className:"h-3.5 w-3.5 text-indigo-300 dark:text-indigo-600 shrink-0"}),a.jsx("span",{className:"font-mono text-[11px] font-medium text-indigo-600 dark:text-indigo-400 shrink-0",children:Be.identifier}),a.jsx("span",{className:"text-xs text-zinc-600 dark:text-zinc-400 truncate group-hover:text-zinc-900 dark:group-hover:text-zinc-100 transition-colors",children:Be.title})]},Be.id))})]},Q.id)})})]}),a.jsx(Zo,{}),a.jsxs("div",{children:[a.jsx(Fn,{children:"Description"}),d?a.jsx(Tx,{content:p,onChange:x,placeholder:"Add a description…",className:"min-h-[160px] rounded-md border border-input"},`${c.id}-edit`):c.description?a.jsx("div",{className:"rounded-lg bg-zinc-50 dark:bg-zinc-900/60 border border-zinc-100 dark:border-zinc-800 px-3.5 py-3",children:a.jsx(Ix,{html:c.description,className:"text-sm"})}):a.jsxs("button",{onClick:()=>u(!0),className:"w-full flex items-center justify-center gap-2 py-3.5 rounded-lg border-2 border-dashed border-zinc-200 dark:border-zinc-800 text-xs text-zinc-400 dark:text-zinc-500 hover:border-indigo-300 hover:text-indigo-500 dark:hover:border-indigo-700 dark:hover:text-indigo-400 transition-all",children:[a.jsx(si,{className:"h-3.5 w-3.5"}),"Add description"]})]})]}),a.jsx("div",{className:"px-6 py-4",children:a.jsx(Cr,{zone:"issue.details.after",props:{issue:c}})}),a.jsx(Mk,{issueId:c.id,projectId:t,className:"border-t border-border",compact:!0,hideCommentInput:!0,onTabChange:v,onViewMore:()=>{n(),s(`/${i}/projects/${o}/issues/${c.id}`)}})]}),g==="comments"&&a.jsx("div",{className:"border-t border-border px-6 py-3 shrink-0",children:a.jsx(Nk,{issueId:c.id,projectId:t,compact:!0})})]})}),a.jsx(of,{open:y,onClose:()=>j(!1),projectId:t,defaultParentId:c.id,defaultTaskListId:c.task_list_id})]})}function h6(){const{projectKey:e,workspace:t}=zt(),r=iN(),[n,s]=h.useState(null),[i,o]=h.useState(!1),[l,c]=h.useState({}),{data:d}=Wa(e??""),u=(d==null?void 0:d.id)??"",{data:f,isLoading:m}=Ql(u||void 0,l),{data:p,isLoading:x}=ko(u||void 0),{data:g}=la(u),{data:v}=ks(),y=KI(u),j=h.useMemo(()=>!(g!=null&&g.members)||!v?[]:g.members.map(k=>{const b=v.get(k.user_id);return b?{userId:k.user_id,name:b.name,initials:b.initials}:null}).filter(k=>k!==null),[g,v]);if(r&&e&&t)return a.jsx(Xn,{to:`/${t}/projects/${e}/issues`,replace:!0});if(!e)return null;const N=m||x||!d,w=k=>{y.mutate(k)};return a.jsxs("div",{className:"flex flex-col h-full gap-0",children:[a.jsxs("div",{className:"flex flex-col flex-1 min-h-0 bg-white dark:bg-card",children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-border shrink-0",children:[a.jsx(u4,{statuses:p??[],members:j,filters:l,onChange:c}),a.jsxs(ne,{size:"sm",onClick:()=>o(!0),children:[a.jsx(dt,{className:"h-4 w-4"}),"Create"]})]}),a.jsx(Cr,{zone:"project.board.before",props:{projectId:u}}),a.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:N?a.jsx("div",{className:"flex gap-4 px-6 py-6",children:[1,2,3,4].map(k=>a.jsxs("div",{className:"min-w-[260px]",children:[a.jsx(le,{className:"h-5 w-24 mb-3 rounded"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(le,{className:"h-[82px] w-full rounded-lg"}),a.jsx(le,{className:"h-[82px] w-full rounded-lg"})]})]},k))}):a.jsx(KN,{issues:f??[],projectId:u,statuses:p??[],onIssueClick:s,onColumnsReorder:w,filters:l})})]}),a.jsx(Cr,{zone:"project.board.after",props:{projectId:u}}),a.jsx(Ek,{issue:n,projectId:u,open:!!n,onClose:()=>s(null)}),a.jsx(of,{open:i,onClose:()=>o(!1),projectId:u})]})}const Th=({priority:e,className:t})=>{const r=z("h-3.5 w-3.5 shrink-0",uc[e],t);switch(e){case"urgent":return a.jsx(oa,{className:r});case"high":return a.jsx(bi,{className:r});case"medium":return a.jsx(Ba,{className:r});case"low":return a.jsx(yi,{className:r});default:return a.jsx(_r,{className:z("h-3.5 w-3.5 shrink-0 text-zinc-300",t)})}},Ih="grid-cols-[70px_250px_150px_120px_130px_140px_130px_32px]";function Ak({issue:e,projectId:t,statuses:r,statusLabels:n,statusColorMap:s,sprints:i,workspace:o,projectKey:l,onOpen:c,isChild:d=!1,children:u=[],childrenMap:f,onAddChild:m}){const p=pt(),[x,g]=h.useState(null),[v,y]=h.useState(!1),j=Ru(e.id,t),{data:N}=la(t),w=h.useMemo(()=>N?N.members.filter(S=>S.user).map(S=>S.user):void 0,[N]);function k(S){j.mutate(S),g(null)}const b=(s==null?void 0:s[e.status])??"#94a3b8",C=i.find(S=>S.id===e.sprint_id),_=u.length>0;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{onClick:()=>c(e),className:z(`group grid ${Ih} items-center py-3`,"hover:bg-[#f9fafb] dark:hover:bg-muted/30 cursor-pointer transition-colors",d&&"bg-muted/10",j.isPending&&"opacity-70"),children:[a.jsx("span",{className:z("text-xs font-mono text-muted-foreground truncate","sticky left-0 z-10 pl-6 transition-colors","bg-white dark:bg-card group-hover:bg-[#f9fafb] dark:group-hover:bg-muted/30",d&&"text-muted-foreground"),children:e.identifier}),a.jsxs("div",{className:z("flex items-center gap-1 min-w-0 pr-3","sticky left-[70px] z-10 transition-colors","bg-white dark:bg-card group-hover:bg-[#f9fafb] dark:group-hover:bg-muted/30",d&&"bg-white dark:bg-muted/20"),children:[_?a.jsxs(Qn,{children:[a.jsx(Zn,{asChild:!0,children:a.jsx("button",{onClick:S=>{S.stopPropagation(),y(!v)},className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors p-0.5 rounded",children:v?a.jsx(ia,{className:"h-3.5 w-3.5"}):a.jsx(vr,{className:"h-3.5 w-3.5"})})}),a.jsx(_n,{side:"top",children:v?"Collapse":"Expand"})]}):d?a.jsx(Mn,{className:"h-3 w-3 text-muted-foreground shrink-0"}):a.jsx("span",{className:"w-4 shrink-0"}),a.jsx("span",{className:z("text-sm text-foreground truncate",d&&"text-primary"),children:e.title}),_&&a.jsxs("span",{className:"shrink-0 flex items-center gap-0.5 ml-1 text-[10px] font-medium text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/50 px-1 py-0.5 rounded",children:[a.jsx(Mn,{className:"h-2.5 w-2.5"}),u.length]})]}),a.jsx("div",{onClick:S=>S.stopPropagation(),children:a.jsxs(Ot,{open:x==="status",onOpenChange:S=>g(S?"status":null),children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex items-center gap-1.5 max-w-full px-1.5 py-1 rounded hover:bg-accent transition-colors focus:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[a.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:b}}),a.jsx("span",{className:"text-xs text-primary truncate",children:n[e.status]??e.status})]})}),a.jsx(_t,{className:"w-52 p-1",align:"start",onClick:S=>S.stopPropagation(),children:a.jsx(Xs,{children:a.jsx(Qs,{children:a.jsx(cs,{children:r.map(S=>a.jsxs(un,{value:S.name,onSelect:()=>k({status:S.key}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[a.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:S.color}}),a.jsx("span",{className:"text-xs flex-1",children:S.name}),e.status===S.key&&a.jsx(dr,{className:"h-3.5 w-3.5 text-indigo-500"})]},S.key))})})})})]})}),a.jsx("div",{onClick:S=>S.stopPropagation(),children:a.jsxs(Ot,{open:x==="priority",onOpenChange:S=>g(S?"priority":null),children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-1.5 py-1 rounded hover:bg-accent transition-colors focus:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[a.jsx(Th,{priority:e.priority}),a.jsx("span",{className:"text-xs text-primary",children:rn[e.priority]??e.priority})]})}),a.jsx(_t,{className:"w-44 p-1",align:"start",onClick:S=>S.stopPropagation(),children:a.jsx(Xs,{children:a.jsx(Qs,{children:a.jsx(cs,{children:Object.entries(rn).map(([S,I])=>a.jsxs(un,{value:I,onSelect:()=>k({priority:S}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[a.jsx(Th,{priority:S}),a.jsx("span",{className:"text-xs flex-1",children:I}),e.priority===S&&a.jsx(dr,{className:"h-3.5 w-3.5 text-indigo-500"})]},S))})})})})]})}),a.jsx("div",{onClick:S=>S.stopPropagation(),children:a.jsxs(Ot,{open:x==="sprint",onOpenChange:S=>g(S?"sprint":null),children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-1.5 py-1 rounded hover:bg-accent transition-colors focus:outline-none focus-visible:ring-1 focus-visible:ring-ring max-w-full",children:[a.jsx(Hr,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),a.jsx("span",{className:z("text-xs truncate",C?"text-foreground":"text-muted-foreground"),children:(C==null?void 0:C.name)??"No sprint"})]})}),a.jsx(_t,{className:"w-56 p-1",align:"start",onClick:S=>S.stopPropagation(),children:a.jsx(Xs,{children:a.jsx(Qs,{children:a.jsxs(cs,{children:[a.jsxs(un,{value:"no-sprint",onSelect:()=>k({sprint_id:null}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[a.jsx(tt,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("span",{className:"text-xs flex-1 text-muted-foreground",children:"No sprint"}),!e.sprint_id&&a.jsx(dr,{className:"h-3.5 w-3.5 text-indigo-500"})]}),i.filter(S=>S.status!=="completed").map(S=>a.jsxs(un,{value:S.name,onSelect:()=>k({sprint_id:S.id}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[a.jsx(Hr,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-xs truncate",children:S.name}),(S.start_date||S.end_date)&&a.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[S.start_date?fe(new Date(S.start_date),"MMM d"):"—"," → ",S.end_date?fe(new Date(S.end_date),"MMM d"):"—"]})]}),e.sprint_id===S.id&&a.jsx(dr,{className:"h-3.5 w-3.5 text-indigo-500 shrink-0"})]},S.id))]})})})})]})}),a.jsx("div",{onClick:S=>S.stopPropagation(),children:a.jsxs(Ot,{open:x==="due",onOpenChange:S=>g(S?"due":null),children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-1.5 py-1 rounded hover:bg-accent transition-colors focus:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[a.jsx(Wt,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),a.jsx("span",{className:z("text-xs",e.due_date?"text-foreground":"text-muted-foreground"),children:e.due_date?fe(new Date(e.due_date),"MMM d, yyyy"):"No due date"})]})}),a.jsxs(_t,{className:"w-auto p-0",align:"start",onClick:S=>S.stopPropagation(),children:[a.jsx(gr,{mode:"single",selected:e.due_date?new Date(e.due_date):void 0,onSelect:S=>k({due_date:S?fe(S,"yyyy-MM-dd"):null}),initialFocus:!0}),e.due_date&&a.jsx("div",{className:"border-t px-3 py-2",children:a.jsxs("button",{onClick:()=>k({due_date:null}),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[a.jsx(tt,{className:"h-3 w-3"}),"Clear date"]})})]})]})}),a.jsx("div",{onClick:S=>S.stopPropagation(),children:a.jsx(mc,{value:e.assignee_ids??[],onChange:S=>j.mutate({assignee_ids:S}),users:w})}),a.jsxs("div",{className:"flex items-center gap-1 pr-6",onClick:S=>S.stopPropagation(),children:[!d&&m&&a.jsxs(Qn,{children:[a.jsx(Zn,{asChild:!0,children:a.jsx("button",{onClick:()=>m(e.id),className:"p-1 rounded hover:bg-border text-muted-foreground hover:text-foreground",children:a.jsx(Mn,{className:"h-3.5 w-3.5"})})}),a.jsx(_n,{side:"top",children:"Add child issue"})]}),a.jsxs(Qn,{children:[a.jsx(Zn,{asChild:!0,children:a.jsx("button",{onClick:()=>p(`/${o}/projects/${l}/issues/${e.id}`),className:"p-1 rounded hover:bg-border text-muted-foreground hover:text-foreground",children:a.jsx(rx,{className:"h-3.5 w-3.5"})})}),a.jsx(_n,{side:"top",children:"Open full page"})]})]})]}),v&&u.map(S=>a.jsx(Ak,{issue:S,projectId:t,statuses:r,statusLabels:n,statusColorMap:s,sprints:i,workspace:o,projectKey:l,onOpen:c,isChild:!0,children:(f==null?void 0:f[S.id])??[],childrenMap:f,onAddChild:m},S.id))]})}function $y({taskList:e,issues:t,childrenMap:r,projectId:n,statuses:s,statusLabels:i,statusColorMap:o,sprints:l,workspace:c,projectKey:d,onOpen:u,onAddIssue:f,onAddChild:m,onRenameList:p,onDeleteList:x}){const[g,v]=h.useState(!1),[y,j]=h.useState(!1),[N,w]=h.useState((e==null?void 0:e.name)??""),k=t.reduce((_,S)=>{var I;return _+(((I=r[S.id])==null?void 0:I.length)??0)},0),b=t.length+k,C=()=>{e&&N.trim()&&p&&p(e.id,N.trim()),j(!1)};return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 px-6 py-2 bg-muted/20 border-b border-border group/header",children:[a.jsxs(Qn,{children:[a.jsx(Zn,{asChild:!0,children:a.jsx("button",{onClick:()=>v(!g),className:"text-muted-foreground hover:text-foreground transition-colors",children:g?a.jsx(vr,{className:"h-3.5 w-3.5"}):a.jsx(ia,{className:"h-3.5 w-3.5"})})}),a.jsx(_n,{side:"right",children:g?"Expand":"Collapse"})]}),e?y?a.jsx("input",{autoFocus:!0,value:N,onChange:_=>w(_.target.value),onBlur:C,onKeyDown:_=>{_.key==="Enter"&&C(),_.key==="Escape"&&(j(!1),w(e.name))},className:"text-xs font-semibold text-foreground bg-transparent border-b border-indigo-400 outline-none px-0.5"}):a.jsx("span",{className:"text-xs font-semibold text-foreground",children:e.name}):a.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"No List"}),a.jsx("span",{className:"text-[11px] text-muted-foreground/60 font-mono",children:b}),a.jsxs("div",{className:"flex items-center gap-1 ml-auto",children:[a.jsxs("button",{onClick:()=>f((e==null?void 0:e.id)??null),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors px-1.5 py-0.5 rounded hover:bg-muted",children:[a.jsx(dt,{className:"h-3 w-3"}),"Add issue"]}),e&&a.jsxs(Kr,{children:[a.jsxs(Qn,{children:[a.jsx(Zn,{asChild:!0,children:a.jsx(Yr,{asChild:!0,children:a.jsx("button",{className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:a.jsx(Ma,{className:"h-3.5 w-3.5"})})})}),a.jsx(_n,{side:"top",children:"More options"})]}),a.jsxs(Or,{align:"end",className:"w-36",children:[a.jsxs(at,{className:"text-xs gap-2 cursor-pointer",onClick:()=>{j(!0),w(e.name)},children:[a.jsx(si,{className:"h-3.5 w-3.5"}),"Rename"]}),a.jsxs(at,{className:"text-xs gap-2 cursor-pointer text-destructive focus:text-destructive",onClick:()=>x==null?void 0:x(e.id),children:[a.jsx(Mr,{className:"h-3.5 w-3.5"}),"Delete list"]})]})]})]})]}),!g&&a.jsx("div",{className:"divide-y divide-border/60",children:t.length===0?a.jsx("div",{className:"px-14 py-3 text-xs text-muted-foreground/50 italic",children:"No issues in this list"}):t.map(_=>a.jsx(Ak,{issue:_,projectId:n,statuses:s,statusLabels:i,statusColorMap:o,sprints:l,workspace:c,projectKey:d,onOpen:u,children:r[_.id]??[],childrenMap:r,onAddChild:m},_.id))})]})}function p6(){var D;const e=pt(),{workspace:t,projectKey:r}=zt(),[n,s]=h.useState(null),[i,o]=h.useState({open:!1}),[l,c]=h.useState(""),[d,u]=h.useState(!1),[f,m]=h.useState(""),[p,x]=h.useState("all"),[g,v]=h.useState("all"),[y,j]=h.useState("all"),{data:N}=Wa(r??""),w=(N==null?void 0:N.id)??"",{data:k,isLoading:b}=Ql(w||void 0),{data:C}=ko(w||void 0),{data:_}=So(w||void 0),{data:S}=fc(w||void 0),I=N4(w),A=k4(w),O=S4(w),L=C&&C.length>0?C:Object.entries(ci).map(([E,Z],B)=>({id:E,project_id:w,key:E,name:Z,color:{backlog:"#94a3b8",todo:"#64748b",in_progress:"#6366f1",in_review:"#f59e0b",done:"#10b981",cancelled:"#9ca3af"}[E]??"#94a3b8",category:{backlog:"backlog",todo:"unstarted",in_progress:"started",in_review:"started",done:"completed",cancelled:"cancelled"}[E]??"backlog",position:B})),F=Object.fromEntries(L.map(E=>[E.key,E.name])),X=Object.fromEntries(L.map(E=>[E.key,E.color])),T=_??[];if(!r||!t)return null;const G=(k??[]).filter(E=>{const Z=!f||E.title.toLowerCase().includes(f.toLowerCase())||E.identifier.toLowerCase().includes(f.toLowerCase()),B=p==="all"||E.status===p,Y=g==="all"||E.priority===g,ae=y==="all"||(y==="none"?!E.sprint_id:E.sprint_id===y);return Z&&B&&Y&&ae}).sort((E,Z)=>{const B=parseInt(E.identifier.split("-")[1]??"0",10),Y=parseInt(Z.identifier.split("-")[1]??"0",10);return B-Y}),re={};for(const E of k??[])E.parent_id&&(re[E.parent_id]||(re[E.parent_id]=[]),re[E.parent_id].push(E));const J=G.filter(E=>!E.parent_id),P=G.length,M=new Set((S??[]).map(E=>E.id)),R={__none__:[]};for(const E of S??[])R[E.id]=[];for(const E of J){const Z=E.task_list_id&&M.has(E.task_list_id)?E.task_list_id:"__none__";R[Z].push(E)}function U(){l.trim()&&I.mutate({name:l.trim()},{onSuccess:()=>{c(""),u(!1),H.success("List created")},onError:()=>H.error("Failed to create list")})}function $(E,Z){A.mutate({id:E,name:Z},{onError:()=>H.error("Failed to rename list")})}function K(E){const Z=S==null?void 0:S.find(B=>B.id===E);confirm(`Delete list "${Z==null?void 0:Z.name}"? Issues in this list will be moved to No List.`)&&O.mutate(E,{onSuccess:()=>H.success("List deleted"),onError:()=>H.error("Failed to delete list")})}return a.jsxs("div",{className:"p-2 pb-24 md:pb-2",children:[a.jsx(Cr,{zone:"project.issues.before",props:{projectId:w}}),a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[a.jsx("div",{className:"flex items-center justify-end px-6 py-3 border-b border-border",children:a.jsxs("div",{className:"flex items-center gap-2",children:[d?a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(Ee,{autoFocus:!0,placeholder:"List name...",value:l,onChange:E=>c(E.target.value),onKeyDown:E=>{E.key==="Enter"&&U(),E.key==="Escape"&&(u(!1),c(""))},className:"h-8 text-xs w-36"}),a.jsx(ne,{size:"sm",variant:"outline",className:"h-8 text-xs",onClick:U,disabled:!l.trim()||I.isPending,children:"Add"}),a.jsx(ne,{size:"sm",variant:"ghost",className:"h-8 text-xs",onClick:()=>{u(!1),c("")},children:"Cancel"})]}):a.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>u(!0),children:[a.jsx(dt,{className:"h-4 w-4"}),"New List"]}),a.jsxs(ne,{size:"sm",onClick:()=>o({open:!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 border-b border-border md:flex-row md:items-center md:justify-between md:gap-3",children:[a.jsxs("div",{className:"flex items-center gap-2 md:overflow-x-auto md:scrollbar-none",children:[a.jsxs(Le,{value:y,onValueChange:j,children:[a.jsx($e,{className:"h-8 text-xs flex-1 md:flex-none md:w-[140px] md:shrink-0 bg-transparent",children:a.jsx(qe,{placeholder:"Sprint"})}),a.jsxs(ze,{children:[a.jsx(we,{value:"all",className:"text-xs",children:"All sprints"}),a.jsx(we,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),T.map(E=>a.jsx(we,{value:E.id,className:"text-xs",children:E.name},E.id))]})]}),a.jsxs(Le,{value:p,onValueChange:x,children:[a.jsx($e,{className:"h-8 text-xs flex-1 md:flex-none md:w-[130px] md:shrink-0 bg-transparent",children:a.jsx(qe,{placeholder:"Status"})}),a.jsxs(ze,{children:[a.jsx(we,{value:"all",className:"text-xs",children:"All statuses"}),L.map(({key:E,name:Z})=>a.jsx(we,{value:E,className:"text-xs",children:Z},E))]})]}),a.jsxs(Le,{value:g,onValueChange:v,children:[a.jsx($e,{className:"h-8 text-xs flex-1 md:flex-none md:w-[130px] md:shrink-0 bg-transparent",children:a.jsx(qe,{placeholder:"Priority"})}),a.jsxs(ze,{children:[a.jsx(we,{value:"all",className:"text-xs",children:"All priorities"}),Object.entries(rn).map(([E,Z])=>a.jsx(we,{value:E,className:"text-xs",children:Z},E))]})]})]}),a.jsxs("div",{className:"relative",children:[a.jsx(ji,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),a.jsx(Ee,{placeholder:"Search...",value:f,onChange:E=>m(E.target.value),className:"pl-8 h-8 w-full md:w-[200px] text-xs bg-transparent"})]})]}),a.jsx("div",{className:"hidden md:block overflow-x-auto",children:a.jsxs("div",{className:"min-w-[1025px]",children:[a.jsxs("div",{className:z("grid items-center py-2.5 border-b border-border",Ih),children:[a.jsx("span",{className:"text-xs font-medium text-[#6b7280] sticky left-0 z-10 bg-white dark:bg-card pl-6",children:"ID"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280] sticky left-[70px] z-10 bg-white dark:bg-card",children:"Title"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Status"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Priority"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Sprint"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Due Date"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Assignees"}),a.jsx("span",{className:"pr-6"})]}),b?a.jsx("div",{className:"divide-y divide-border",children:[1,2,3,4].map(E=>a.jsxs("div",{className:z("grid items-center px-6 py-3 gap-4",Ih),children:[a.jsx(le,{className:"h-4 w-14"}),a.jsx(le,{className:"h-4 w-56"}),a.jsx(le,{className:"h-5 w-20"}),a.jsx(le,{className:"h-4 w-16"}),a.jsx(le,{className:"h-4 w-20"}),a.jsx(le,{className:"h-4 w-24"}),a.jsx(le,{className:"h-6 w-16"}),a.jsx("span",{})]},E))}):P===0&&(k??[]).length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[a.jsx("p",{className:"text-sm font-medium mb-1",children:"No issues yet"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Create your first issue to start tracking work."}),a.jsxs(ne,{size:"sm",onClick:()=>o({open:!0}),children:[a.jsx(dt,{className:"h-4 w-4"}),"Create issue"]})]}):J.length===0&&(k??[]).length>0?a.jsx("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"No issues match your filters."})}):a.jsx(Iu,{delayDuration:200,children:a.jsxs("div",{className:"divide-y divide-border",children:[(S??[]).map(E=>a.jsx($y,{taskList:E,issues:R[E.id]??[],childrenMap:re,projectId:w,statuses:L,statusLabels:F,statusColorMap:X,sprints:T,workspace:t,projectKey:r,onOpen:s,onAddIssue:Z=>o({open:!0,defaultTaskListId:Z}),onAddChild:Z=>o({open:!0,defaultParentId:Z}),onRenameList:$,onDeleteList:K},E.id)),(((D=R.__none__)==null?void 0:D.length)>0||(S??[]).length===0)&&a.jsx($y,{taskList:null,issues:R.__none__??[],childrenMap:re,projectId:w,statuses:L,statusLabels:F,statusColorMap:X,sprints:T,workspace:t,projectKey:r,onOpen:s,onAddIssue:E=>o({open:!0,defaultTaskListId:E}),onAddChild:E=>o({open:!0,defaultParentId:E})})]})})]})}),a.jsx("div",{className:"md:hidden divide-y divide-border/60",children:b?[1,2,3,4].map(E=>a.jsx("div",{className:"flex items-start gap-3 px-4 py-3",children:a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"h-3 w-10 bg-muted rounded animate-pulse"}),a.jsx("div",{className:"h-4 w-48 bg-muted rounded animate-pulse"})]}),a.jsx("div",{className:"h-3 w-32 bg-muted rounded animate-pulse"})]})},E)):J.length===0?null:J.map(E=>{const Z=(X==null?void 0:X[E.status])??"#94a3b8",B=T.find(Y=>Y.id===E.sprint_id);return a.jsx("div",{onClick:()=>e(`/${t}/projects/${r}/issues/${E.id}`),className:"flex items-start gap-3 px-4 py-3 hover:bg-[#f9fafb] dark:hover:bg-muted/30 cursor-pointer transition-colors",children:a.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx("span",{className:"text-[10px] font-mono text-muted-foreground shrink-0",children:E.identifier}),a.jsx("span",{className:"text-sm text-foreground truncate font-medium",children:E.title})]}),a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx(Th,{priority:E.priority}),a.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-muted-foreground",children:[a.jsx("span",{className:"h-1.5 w-1.5 rounded-full shrink-0",style:{backgroundColor:Z}}),F[E.status]??E.status]}),B&&a.jsx("span",{className:"text-[11px] text-muted-foreground truncate max-w-[120px]",children:B.name}),E.due_date&&a.jsx("span",{className:"text-[11px] text-muted-foreground",children:fe(new Date(E.due_date),"MMM d")})]})]})},E.id)})}),!b&&P>0&&a.jsx("div",{className:"flex items-center px-6 py-3 border-t border-border",children:a.jsxs("span",{className:"text-xs text-muted-foreground",children:[P," issue",P!==1?"s":""]})})]}),a.jsx(Cr,{zone:"project.issues.after",props:{projectId:w}}),a.jsx(Ek,{issue:n,projectId:w,open:!!n,onClose:()=>s(null)}),a.jsx(of,{open:i.open,onClose:()=>o({open:!1}),projectId:w,defaultTaskListId:i.defaultTaskListId,defaultParentId:i.defaultParentId})]})}function x6(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,g6(s,...t)]}function g6(...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 v6=Symbol("radix.slottable");function y6(e){const t=({children:r})=>a.jsx(a.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=v6,t}var Dk="AlertDialog",[b6]=x6(Dk,[a1]),Ya=a1(),Tk=e=>{const{__scopeAlertDialog:t,...r}=e,n=Ya(t);return a.jsx(Xl,{...n,...r,modal:!0})};Tk.displayName=Dk;var w6="AlertDialogTrigger",j6=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Ya(r);return a.jsx(XP,{...s,...n,ref:t})});j6.displayName=w6;var N6="AlertDialogPortal",Ik=e=>{const{__scopeAlertDialog:t,...r}=e,n=Ya(t);return a.jsx(Vl,{...n,...r})};Ik.displayName=N6;var k6="AlertDialogOverlay",Rk=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Ya(r);return a.jsx(gi,{...s,...n,ref:t})});Rk.displayName=k6;var Hi="AlertDialogContent",[S6,C6]=b6(Hi),_6=y6("AlertDialogContent"),$k=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:n,...s}=e,i=Ya(r),o=h.useRef(null),l=Tu(t,o),c=h.useRef(null);return a.jsx(VP,{contentName:Hi,titleName:zk,docsSlug:"alert-dialog",children:a.jsx(S6,{scope:r,cancelRef:c,children:a.jsxs(vi,{role:"alertdialog",...i,...s,ref:l,onOpenAutoFocus:Fs(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(_6,{children:n}),a.jsx(O6,{contentRef:o})]})})})});$k.displayName=Hi;var zk="AlertDialogTitle",Lk=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Ya(r);return a.jsx(uo,{...s,...n,ref:t})});Lk.displayName=zk;var Fk="AlertDialogDescription",Bk=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Ya(r);return a.jsx(fo,{...s,...n,ref:t})});Bk.displayName=Fk;var M6="AlertDialogAction",Wk=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Ya(r);return a.jsx(Du,{...s,...n,ref:t})});Wk.displayName=M6;var Uk="AlertDialogCancel",qk=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,{cancelRef:s}=C6(Uk,r),i=Ya(r),o=Tu(t,s);return a.jsx(Du,{...i,...n,ref:o})});qk.displayName=Uk;var O6=({contentRef:e})=>{const t=`\`${Hi}\` requires a description for the component to be accessible for screen reader users.
557
+ `+Rr),se&&Hc([O,L,F],ha=>{Rr=Go(Rr,ha," ")}),w&&ge?w.createHTML(Rr):Rr},t.setConfig=function(){let Pe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};nt(Pe),pe=!0},t.clearConfig=function(){Te=null,pe=!1},t.isValidAttribute=function(Pe,q,me){Te||nt({});const ke=_e(Pe),xt=_e(q);return Tv(ke,xt,me)},t.addHook=function(Pe,q){typeof q=="function"&&Yo(A[Pe],q)},t.removeHook=function(Pe,q){if(q!==void 0){const me=W$(A[Pe],q);return me===-1?void 0:U$(A[Pe],me,1)[0]}return My(A[Pe])},t.removeHooks=function(Pe){A[Pe]=[]},t.removeAllHooks=function(){A=Ty()},t}var i6=_k();function o6({onClick:e,active:t,disabled:r,title:n,children:s}){return a.jsx("button",{type:"button",title:n,disabled:r,onMouseDown:i=>{i.preventDefault(),e()},className:z("flex h-[26px] w-[26px] items-center justify-center rounded transition-colors shrink-0","text-muted-foreground hover:text-foreground hover:bg-muted","disabled:opacity-30 disabled:cursor-not-allowed",t&&"bg-muted text-foreground"),children:s})}function Yc(){return a.jsx("span",{className:"mx-0.5 h-4 w-px shrink-0 bg-border"})}function Tx({content:e="",onChange:t,placeholder:r="Add a description…",className:n,toolbarClassName:s,editorClassName:i}){const o=u1({extensions:[f1.configure({heading:{levels:[1,2,3]}}),m1,ME,OE.configure({nested:!0}),h1.configure({placeholder:r})],content:e||"",editorProps:{attributes:{class:"meridian-editor"}},onUpdate({editor:d}){t&&t(d.isEmpty?"":d.getHTML())}});if(!o)return null;const l=(d,u,f,m,p)=>a.jsx(o6,{title:d,onClick:f,active:m,disabled:p,children:u},d),c="h-3.5 w-3.5";return a.jsxs("div",{className:z("flex flex-col overflow-hidden",n),children:[a.jsxs("div",{className:z("flex flex-wrap items-center gap-0.5 px-3 py-1.5 border-b border-border bg-muted/30",s),children:[l("Undo",a.jsx(R5,{className:c}),()=>o.chain().focus().undo().run(),!1,!o.can().undo()),l("Redo",a.jsx(S5,{className:c}),()=>o.chain().focus().redo().run(),!1,!o.can().redo()),a.jsx(Yc,{}),l("Bold (⌘B)",a.jsx(A1,{className:c}),()=>o.chain().focus().toggleBold().run(),o.isActive("bold")),l("Italic (⌘I)",a.jsx(F1,{className:c}),()=>o.chain().focus().toggleItalic().run(),o.isActive("italic")),l("Underline (⌘U)",a.jsx(I5,{className:c}),()=>o.chain().focus().toggleUnderline().run(),o.isActive("underline")),l("Strikethrough",a.jsx(H1,{className:c}),()=>o.chain().focus().toggleStrike().run(),o.isActive("strike")),l("Inline code",a.jsx(z1,{className:c}),()=>o.chain().focus().toggleCode().run(),o.isActive("code")),a.jsx(Yc,{}),l("Heading 1",a.jsx(h5,{className:c}),()=>o.chain().focus().toggleHeading({level:1}).run(),o.isActive("heading",{level:1})),l("Heading 2",a.jsx(p5,{className:c}),()=>o.chain().focus().toggleHeading({level:2}).run(),o.isActive("heading",{level:2})),l("Heading 3",a.jsx(x5,{className:c}),()=>o.chain().focus().toggleHeading({level:3}).run(),o.isActive("heading",{level:3})),a.jsx(Yc,{}),l("Bullet list",a.jsx(ax,{className:c}),()=>o.chain().focus().toggleBulletList().run(),o.isActive("bulletList")),l("Ordered list",a.jsx(W1,{className:c}),()=>o.chain().focus().toggleOrderedList().run(),o.isActive("orderedList")),l("Task list",a.jsx(y5,{className:c}),()=>o.chain().focus().toggleTaskList().run(),o.isActive("taskList")),a.jsx(Yc,{}),l("Blockquote",a.jsx(k5,{className:c}),()=>o.chain().focus().toggleBlockquote().run(),o.isActive("blockquote")),l("Code block",a.jsx($1,{className:c}),()=>o.chain().focus().toggleCodeBlock().run(),o.isActive("codeBlock")),l("Divider line",a.jsx(Ba,{className:c}),()=>o.chain().focus().setHorizontalRule().run())]}),a.jsx(p1,{editor:o,className:z("flex-1 px-5 py-4",i)})]})}function Ix({html:e,className:t}){return e?a.jsx("div",{className:z("meridian-editor",t),dangerouslySetInnerHTML:{__html:i6.sanitize(e,{ADD_ATTR:["data-type","data-id","data-label"]})}}):null}const Iy=[{bg:"bg-indigo-100 dark:bg-indigo-900/50",text:"text-indigo-700 dark:text-indigo-300"},{bg:"bg-violet-100 dark:bg-violet-900/50",text:"text-violet-700 dark:text-violet-300"},{bg:"bg-emerald-100 dark:bg-emerald-900/50",text:"text-emerald-700 dark:text-emerald-300"},{bg:"bg-amber-100 dark:bg-amber-900/50",text:"text-amber-700 dark:text-amber-300"},{bg:"bg-rose-100 dark:bg-rose-900/50",text:"text-rose-700 dark:text-rose-300"},{bg:"bg-sky-100 dark:bg-sky-900/50",text:"text-sky-700 dark:text-sky-300"},{bg:"bg-teal-100 dark:bg-teal-900/50",text:"text-teal-700 dark:text-teal-300"},{bg:"bg-orange-100 dark:bg-orange-900/50",text:"text-orange-700 dark:text-orange-300"}];function Rx(e){let t=0;for(let r=0;r<e.length;r++)t=t*31+e.charCodeAt(r)&65535;return Iy[t%Iy.length]}function l6({body:e}){const t=e.trim();return t?/^<[a-z][\s\S]*>/i.test(t)?a.jsx(Ix,{html:t,className:"text-xs"}):a.jsx("p",{className:"text-xs text-foreground leading-relaxed whitespace-pre-wrap",children:t}):null}const Ry={created:{icon:dt,color:"text-emerald-600",bg:"bg-emerald-50 dark:bg-emerald-950/40"},status_changed:{icon:Qp,color:"text-indigo-500",bg:"bg-indigo-50 dark:bg-indigo-950/40"},assigned:{icon:po,color:"text-blue-500",bg:"bg-blue-50 dark:bg-blue-950/40"},unassigned:{icon:K1,color:"text-zinc-500",bg:"bg-zinc-100 dark:bg-zinc-800"},updated:{icon:si,color:"text-amber-500",bg:"bg-amber-50 dark:bg-amber-950/40"}};function c6(e,t){var s,i,o,l;const{action:r,changes:n}=e;if(r==="created")return"created this issue";if(r==="status_changed"){const c=(s=n==null?void 0:n.status)==null?void 0:s.from,d=(i=n==null?void 0:n.status)==null?void 0:i.to;return a.jsxs(a.Fragment,{children:["changed status",c&&a.jsxs(a.Fragment,{children:[" from ",a.jsx("strong",{className:"font-medium text-foreground",children:ci[c]??c})]}),d&&a.jsxs(a.Fragment,{children:[" to ",a.jsx("strong",{className:"font-medium text-foreground",children:ci[d]??d})]})]})}if(r==="assigned"||r==="unassigned"){const c=((o=n==null?void 0:n.assignee_ids)==null?void 0:o.to)??[],d=((l=n==null?void 0:n.assignee_ids)==null?void 0:l.from)??[],u=c.filter(p=>!d.includes(p)),f=d.filter(p=>!c.includes(p)),m=p=>{var x;return((x=t==null?void 0:t.get(p))==null?void 0:x.name)??p.slice(0,8)+"…"};return u.length>0&&f.length>0?a.jsx(a.Fragment,{children:"updated assignees"}):u.length>0?a.jsxs(a.Fragment,{children:["assigned ",a.jsx("strong",{className:"font-medium text-foreground",children:u.map(m).join(", ")})]}):f.length>0?a.jsxs(a.Fragment,{children:["unassigned ",a.jsx("strong",{className:"font-medium text-foreground",children:f.map(m).join(", ")})]}):"updated assignees"}if(r==="updated"&&n){const c=[];for(const[d,u]of Object.entries(n)){const{from:f,to:m}=u;d==="title"||d==="description"?c.push(a.jsxs("span",{children:["updated ",a.jsx("strong",{className:"font-medium text-foreground",children:d})]},d)):d==="priority"?c.push(a.jsxs("span",{children:["changed ",a.jsx("strong",{className:"font-medium text-foreground",children:"priority"}),f!=null&&a.jsxs(a.Fragment,{children:[" from ",a.jsx("strong",{className:"font-medium text-foreground",children:rn[f]??String(f)})]}),m!=null&&a.jsxs(a.Fragment,{children:[" to ",a.jsx("strong",{className:"font-medium text-foreground",children:rn[m]??String(m)})]})]},d)):d==="type"?c.push(a.jsxs("span",{children:["changed ",a.jsx("strong",{className:"font-medium text-foreground",children:"type"}),f!=null&&a.jsxs(a.Fragment,{children:[" from ",a.jsx("strong",{className:"font-medium text-foreground",children:Pa[f]??String(f)})]}),m!=null&&a.jsxs(a.Fragment,{children:[" to ",a.jsx("strong",{className:"font-medium text-foreground",children:Pa[m]??String(m)})]})]},d)):c.push(a.jsxs("span",{children:["updated ",a.jsx("strong",{className:"font-medium text-foreground",children:d.replace(/_/g," ")})]},d))}return c.length===0?"made changes":a.jsx(a.Fragment,{children:c.reduce((d,u,f)=>f===0?[u]:[...d,a.jsx("span",{children:" and "},`sep-${f}`),u],[])})}return r.replace(/_/g," ")}function Mk({issueId:e,projectId:t,className:r,compact:n,onViewMore:s,onTabChange:i,hideCommentInput:o}){const[l,c]=h.useState("comments"),d=w=>{c(w),i==null||i(w)},u=h.useRef(null),f=h.useRef(null),{user:m}=Ie(),{data:p}=ks(),{data:x,isLoading:g}=e5(e),{data:v,isLoading:y}=t5(e),{data:j}=yk(e);h.useEffect(()=>{var k;const w=x==null?void 0:x.length;w!==void 0&&(f.current!==null&&w>f.current&&((k=u.current)==null||k.scrollIntoView({behavior:"smooth",block:"nearest"})),f.current=w)},[x==null?void 0:x.length]);const N=w=>{var k;if(m&&w===m.id){const b=m.first_name??"",C=m.last_name??"",_=`${b} ${C}`.trim()||m.email,S=(b[0]??C[0]??((k=m.email)==null?void 0:k[0])??"U").toUpperCase();return{name:_,initials:S}}return(p==null?void 0:p.get(w))??{name:"Unknown",initials:"?"}};return a.jsxs("div",{className:r,children:[a.jsx("div",{className:"flex items-center gap-0 px-6 pt-3 border-b border-zinc-100 dark:border-zinc-800",children:["comments","activity","attachments","time"].map(w=>{const k=w==="comments"?(x==null?void 0:x.length)??0:w==="activity"?(v==null?void 0:v.length)??0:w==="attachments"?(j==null?void 0:j.length)??0:void 0,b=w==="comments"?"Comments":w==="activity"?"Activity":w==="attachments"?"Attachments":"Time",C=l===w;return a.jsxs("button",{onClick:()=>d(w),className:z("pb-2.5 mr-5 text-xs font-medium transition-colors border-b-2 -mb-px",C?"text-indigo-700 dark:text-indigo-300 border-indigo-500 dark:border-indigo-400":"border-transparent text-zinc-500 dark:text-zinc-400 hover:text-zinc-800 dark:hover:text-zinc-200"),children:[b,k!=null&&k>0&&a.jsx("span",{className:z("ml-1.5 text-[10px] tabular-nums font-normal",C?"text-indigo-700 dark:text-indigo-500":"text-zinc-400"),children:k})]},w)})}),l==="comments"&&a.jsxs("div",{className:"px-6 pb-5 pt-4",children:[a.jsx("div",{className:"space-y-5 mb-5",children:g?a.jsxs("div",{className:"flex gap-3",children:[a.jsx(le,{className:"h-7 w-7 rounded-full shrink-0"}),a.jsx(le,{className:"h-16 flex-1"})]}):x&&x.length>0?(n?x.slice(-5):x).map(w=>{const k=N(w.author_id),b=Rx(k.name),C=(j??[]).filter(_=>_.comment_id===w.id);return a.jsxs("div",{className:"flex gap-3",children:[a.jsx(Rt,{className:"h-7 w-7 mt-0.5 shrink-0",children:a.jsx($t,{className:z("text-[11px] font-semibold",b.bg,b.text),children:k.initials})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-baseline gap-2 mb-1.5",children:[a.jsx("span",{className:"text-xs font-semibold text-zinc-900 dark:text-zinc-100",children:k.name}),a.jsx("span",{className:"text-[11px] text-zinc-400 dark:text-zinc-500",children:fe(new Date(w.created_at),"MMM d, h:mm a")})]}),a.jsxs("div",{className:"rounded-lg bg-zinc-50 dark:bg-zinc-900 border border-zinc-100 dark:border-zinc-800 px-3 py-2.5",children:[a.jsx(l6,{body:w.body}),C.length>0&&a.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:C.map(_=>a.jsx(g$,{attachment:_},_.id))})]})]})]},w.id)}):a.jsxs("div",{className:"flex flex-col items-center py-6 gap-2",children:[a.jsx("div",{className:"h-9 w-9 rounded-full bg-zinc-100 dark:bg-zinc-800 flex items-center justify-center",children:a.jsx(U1,{className:"h-4 w-4 text-zinc-400 dark:text-zinc-500"})}),a.jsx("p",{className:"text-xs text-zinc-400 dark:text-zinc-500",children:"No comments yet"})]})}),n&&x&&x.length>5&&s&&a.jsxs("button",{onClick:s,className:"text-xs text-indigo-700 hover:text-indigo-900 dark:text-indigo-300 dark:hover:text-indigo-100 mb-4 font-medium transition-colors",children:["View all ",x.length," comments →"]}),a.jsx("div",{ref:u}),!o&&a.jsx(Nk,{issueId:e,projectId:t})]}),l==="activity"&&a.jsx("div",{className:"px-6 pb-6 pt-4",children:y?a.jsx("div",{className:"space-y-4",children:[1,2,3].map(w=>a.jsxs("div",{className:"flex gap-3",children:[a.jsx(le,{className:"h-6 w-6 rounded-full shrink-0 mt-0.5"}),a.jsx(le,{className:"h-4 flex-1 mt-1"})]},w))}):v&&v.length>0?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute left-[11px] top-2 bottom-2 w-px bg-zinc-100 dark:bg-zinc-800"}),a.jsx("div",{className:"space-y-0",children:(n?v.slice(-5):v).map((w,k,b)=>{var A;const C=Ry[w.action]??Ry.updated,_=C.icon,S=((A=p==null?void 0:p.get(w.actor_id))==null?void 0:A.name)??"System",I=k===b.length-1;return a.jsxs("div",{className:z("relative flex gap-3",I?"pb-0":"pb-4"),children:[a.jsx("div",{className:z("relative z-10 flex h-6 w-6 shrink-0 items-center justify-center rounded-full mt-0.5",C.bg),children:a.jsx(_,{className:z("h-3 w-3",C.color)})}),a.jsxs("div",{className:"flex-1 min-w-0 pt-0.5",children:[a.jsxs("p",{className:"text-xs text-foreground leading-relaxed",children:[a.jsx("span",{className:"font-semibold text-zinc-900 dark:text-zinc-100",children:S})," ",a.jsx("span",{className:"text-zinc-500 dark:text-zinc-400",children:c6(w,p)})]}),a.jsx("p",{className:"text-[11px] text-zinc-400 dark:text-zinc-500 mt-0.5",children:fe(new Date(w.created_at),"MMM d, yyyy · h:mm a")})]})]},w.id)})})]}),n&&v.length>5&&s&&a.jsxs("button",{onClick:s,className:"text-xs text-indigo-700 hover:text-indigo-900 dark:text-indigo-300 dark:hover:text-indigo-100 mt-3 font-medium transition-colors",children:["View all ",v.length," events →"]})]}):a.jsx("p",{className:"text-xs text-zinc-400 dark:text-zinc-500 py-4",children:"No activity yet."})}),l==="attachments"&&a.jsx(b$,{issueId:e}),l==="time"&&a.jsx(E$,{issueId:e})]})}const Ok=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(r1,{ref:n,className:z("relative overflow-hidden",e),...r,children:[a.jsx(KP,{className:"h-full w-full rounded-[inherit]",children:t}),a.jsx(Pk,{}),a.jsx(YP,{})]}));Ok.displayName=r1.displayName;const Pk=h.forwardRef(({className:e,orientation:t="vertical",...r},n)=>a.jsx(n1,{ref:n,orientation:t,className:z("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-1.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-1.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:a.jsx(GP,{className:"relative flex-1 rounded-full bg-border"})}));Pk.displayName=n1.displayName;function d6(e,t){let r=0,n=e;for(;n!=null&&n.parent_id;)n=t.find(s=>s.id===n.parent_id),r++;return r}function u6(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}`}const f6={urgent:"bg-red-500",high:"bg-orange-500",medium:"bg-amber-500",low:"bg-sky-500",no_priority:"bg-zinc-400"};function m6(e,t){return e==="completed"?"bg-emerald-500":e==="in_progress"?"bg-indigo-500":e==="cancelled"?"bg-red-400":t!=null&&t.includes("block")?"bg-red-500":"bg-zinc-400"}const Fn=({children:e})=>a.jsx("p",{className:"text-[10px] font-semibold tracking-[0.08em] uppercase text-zinc-900 dark:text-zinc-100 mb-1.5",children:e}),Zo=()=>a.jsx("div",{className:"border-t border-zinc-100 dark:border-zinc-800"});function Ek({issue:e,projectId:t,open:r,onClose:n}){const s=pt(),{workspace:i,projectKey:o}=zt(),{data:l}=O1((e==null?void 0:e.id)??""),c=l??e,[d,u]=h.useState(!1),[f,m]=h.useState(""),[p,x]=h.useState(""),[g,v]=h.useState("comments"),[y,j]=h.useState(!1),[N,w]=h.useState(new Set),k=Ru((c==null?void 0:c.id)??"",t),{data:b}=la(t),C=h.useMemo(()=>b?b.members.filter(Q=>Q.user).map(Q=>Q.user):void 0,[b]),{data:_}=ko(t),{data:S}=So(t||void 0),{data:I}=fc(t||void 0),{data:A}=Ql(t||void 0),{data:O}=kx(),{data:L=[]}=Sx(new Date().getFullYear()),F=(S??[]).filter(Q=>Q.status!=="completed"),{data:X}=g4(),T=(X==null?void 0:X.maxChildIssueDepth)??1,re=(c?d6(c,A??[]):0)<T,J=c!=null&&c.parent_id?A==null?void 0:A.find(Q=>Q.id===c.parent_id):null,P=(A==null?void 0:A.filter(Q=>Q.parent_id===(c==null?void 0:c.id)))??[],M=c!=null&&c.task_list_id?I==null?void 0:I.find(Q=>Q.id===c.task_list_id):null,R=_&&_.length>0?Object.fromEntries(_.map(Q=>[Q.key,Q.name])):ci;if(h.useEffect(()=>{c&&(m(c.title),x(c.description??"")),u(!1)},[c==null?void 0:c.id]),!c)return null;const U=()=>{f.trim()&&k.mutate({title:f.trim(),description:p.trim()||void 0},{onSuccess:()=>{u(!1),H.success("Issue updated")},onError:()=>H.error("Failed to update issue")})},$=()=>{m(c.title),x(c.description??""),u(!1)},K=Q=>{k.mutate({status:Q},{onSuccess:()=>H.success("Status updated"),onError:()=>H.error("Failed to update status")})},D=Q=>{k.mutate({priority:Q},{onSuccess:()=>H.success("Priority updated"),onError:()=>H.error("Failed to update priority")})},E=Q=>{k.mutate({type:Q},{onSuccess:()=>H.success("Type updated"),onError:()=>H.error("Failed to update type")})},Z=Q=>{k.mutate({assignee_ids:Q},{onSuccess:()=>H.success("Assignees updated"),onError:()=>H.error("Failed to update assignees")})},B=Q=>{k.mutate({sprint_id:Q},{onSuccess:()=>H.success(Q?"Sprint assigned":"Removed from sprint"),onError:()=>H.error("Failed to update sprint")})},Y=Q=>{k.mutate({task_list_id:Q},{onSuccess:()=>H.success(Q?"Moved to list":"Removed from list"),onError:()=>H.error("Failed to update list")})},ae=Q=>{k.mutate({start_date:Q?fe(Q,"yyyy-MM-dd"):null},{onSuccess:()=>H.success(Q?"Start date set":"Start date cleared"),onError:()=>H.error("Failed to update start date")})},ee=Q=>{k.mutate({due_date:Q?fe(Q,"yyyy-MM-dd"):null},{onSuccess:()=>H.success(Q?"Due date set":"Due date cleared"),onError:()=>H.error("Failed to update due date")})},se=Q=>{if(Q){const ge=c.start_date?new Date(c.start_date):new Date,De=new Date(ge);De.setDate(De.getDate()+7),k.mutate({recurrence_frequency:"weekly",next_occurrence_date:fe(De,"yyyy-MM-dd"),recurrence_end_date:null},{onSuccess:()=>H.success("Recurrence enabled"),onError:()=>H.error("Failed to enable recurrence")})}else k.mutate({recurrence_frequency:null,next_occurrence_date:null,recurrence_end_date:null},{onSuccess:()=>H.success("Recurrence stopped"),onError:()=>H.error("Failed to stop recurrence")})},V=Q=>{const ge=c.start_date?new Date(c.start_date):new Date,De=new Date(ge);Q==="weekly"?De.setDate(De.getDate()+7):De.setMonth(De.getMonth()+1),k.mutate({recurrence_frequency:Q,next_occurrence_date:fe(De,"yyyy-MM-dd")},{onSuccess:()=>H.success("Frequency updated"),onError:()=>H.error("Failed to update frequency")})},ie=Q=>{k.mutate({recurrence_end_date:Q?fe(Q,"yyyy-MM-dd"):null},{onSuccess:()=>H.success(Q?"End date set":"End date cleared"),onError:()=>H.error("Failed to update end date")})},pe=_==null?void 0:_.find(Q=>Q.category==="completed"),ue=!!pe&&c.status===pe.key,ve=(Q,ge,De)=>{const Ue=Q;return a.jsx("button",{title:ge,onClick:De,className:"h-8 w-8 flex items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:a.jsx(Ue,{className:"h-4 w-4"})},ge)};return a.jsxs(a.Fragment,{children:[a.jsx(Ni,{open:r,onOpenChange:Q=>!Q&&n(),children:a.jsxs(ki,{className:"flex flex-col p-0 w-full max-w-2xl overflow-hidden bg-white dark:bg-zinc-950",children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border shrink-0",children:[a.jsxs("button",{onClick:()=>{var Q;pe&&K(ue?((Q=_==null?void 0:_.find(ge=>ge.category==="unstarted"||ge.category==="backlog"))==null?void 0:Q.key)??c.status:pe.key)},className:z("flex items-center gap-1.5 px-3 py-1.5 rounded-md border text-xs font-medium transition-colors",ue?"border-emerald-500/40 text-emerald-600 dark:text-emerald-400 bg-emerald-50 dark:bg-emerald-950/30":"border-border text-muted-foreground hover:text-foreground hover:border-foreground/40"),children:[a.jsx(dr,{className:"h-3.5 w-3.5"}),ue?"Completed":"Mark complete"]}),a.jsxs("div",{className:"flex items-center",children:[ve(A5,"Upvote"),ve(sx,"Attachments"),re&&ve(Jn,"Add sub-issue",()=>j(!0)),ve(ai,"Copy link",()=>{navigator.clipboard.writeText(`${window.location.origin}/${i}/projects/${o}/issues/${c.id}`),H.success("Link copied")}),ve(b5,"Open full page",()=>{n(),s(`/${i}/projects/${o}/issues/${c.id}`)}),d?a.jsxs("div",{className:"flex items-center gap-1 ml-1",children:[a.jsx(ne,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:$,children:"Cancel"}),a.jsxs(ne,{size:"sm",className:"h-7 text-xs",onClick:U,disabled:!f.trim()||k.isPending,children:[a.jsx(dr,{className:"h-3.5 w-3.5 mr-1"}),"Save"]})]}):a.jsxs(Kr,{children:[a.jsx(Yr,{asChild:!0,children:ve(Ma,"More options")}),a.jsx(Or,{align:"end",className:"w-40",children:a.jsxs(at,{onClick:()=>u(!0),children:[a.jsx(si,{className:"h-3.5 w-3.5 mr-2"}),"Edit"]})})]}),ve(N5,"Open in full page",()=>{n(),s(`/${i}/projects/${o}/issues/${c.id}`)})]})]}),a.jsx("div",{className:"px-6 pt-5 pb-4 shrink-0",children:d?a.jsx(Ee,{value:f,onChange:Q=>m(Q.target.value),className:"text-sm font-medium h-8",autoFocus:!0}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[a.jsx("span",{className:"text-[11px] font-mono font-medium text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/60 px-1.5 py-0.5 rounded",children:c.identifier}),a.jsx("span",{className:"text-[10px] font-semibold tracking-widest uppercase text-violet-500 dark:text-violet-400",children:Pa[c.type]??c.type}),c.recurrence_frequency&&a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-emerald-700 dark:text-emerald-400 bg-emerald-50 dark:bg-emerald-950/50 border border-emerald-200 dark:border-emerald-800 px-1.5 py-0.5 rounded",children:[a.jsx(Vi,{className:"h-2.5 w-2.5"}),"Repeats ",c.recurrence_frequency==="weekly"?"Weekly":"Monthly"]}),c.recurrence_source_id&&a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-zinc-500 dark:text-zinc-400 bg-zinc-100 dark:bg-zinc-800 px-1.5 py-0.5 rounded",children:[a.jsx(Vi,{className:"h-2.5 w-2.5"}),"Recurring instance"]})]}),a.jsx("h2",{className:"text-[17px] font-semibold leading-snug text-zinc-900 dark:text-zinc-50",children:c.title})]})}),a.jsxs(Ok,{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"px-6 pb-4 space-y-5 min-w-0",children:[a.jsx(Cr,{zone:"issue.details.before",props:{issue:c}}),a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx(Fn,{children:"Status"}),a.jsxs(Le,{value:c.status,onValueChange:K,children:[a.jsx($e,{className:"h-8 text-xs min-w-0",children:a.jsx(qe,{})}),a.jsx(ze,{children:Object.entries(R).map(([Q,ge])=>{const De=_==null?void 0:_.find(Ue=>Ue.key===Q);return a.jsx(we,{value:Q,className:"text-xs",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:z("h-2 w-2 rounded-full shrink-0 flex-none",m6(De==null?void 0:De.category,Q))}),a.jsx("span",{children:ge})]})},Q)})})]})]}),a.jsxs("div",{className:"min-w-0",children:[a.jsx(Fn,{children:"Priority"}),a.jsxs(Le,{value:c.priority,onValueChange:D,children:[a.jsx($e,{className:"h-8 text-xs min-w-0",children:a.jsx(qe,{})}),a.jsx(ze,{children:Object.entries(rn).map(([Q,ge])=>a.jsx(we,{value:Q,className:"text-xs",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:z("h-2 w-2 rounded-full shrink-0 flex-none",f6[Q]??"bg-zinc-400")}),a.jsx("span",{children:ge})]})},Q))})]})]}),a.jsxs("div",{className:"min-w-0",children:[a.jsx(Fn,{children:"Type"}),a.jsxs(Le,{value:c.type,onValueChange:E,children:[a.jsx($e,{className:"h-8 text-xs min-w-0",children:a.jsx(qe,{})}),a.jsx(ze,{children:Object.entries(Pa).map(([Q,ge])=>a.jsx(we,{value:Q,className:"text-xs",children:ge},Q))})]})]})]}),a.jsx(Zo,{}),a.jsxs("div",{children:[a.jsx(Fn,{children:"Assignees"}),a.jsx(mc,{value:c.assignee_ids??[],onChange:Z,disabled:k.isPending,users:C})]}),a.jsx(Zo,{}),a.jsxs("div",{className:"flex gap-3 items-start min-w-0",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx(Fn,{children:"Sprint"}),a.jsxs(Le,{value:c.sprint_id??"none",onValueChange:Q=>B(Q==="none"?null:Q),children:[a.jsx($e,{className:"h-8 text-xs min-w-0",children:a.jsxs("div",{className:"flex items-center gap-1 min-w-0 overflow-hidden",children:[a.jsx(Hr,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),a.jsx(qe,{placeholder:"No sprint"})]})}),a.jsxs(ze,{children:[a.jsx(we,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),F.map(Q=>{const ge=u6(Q);return a.jsx(we,{value:Q.id,className:"text-xs",children:a.jsxs("div",{className:"flex items-baseline gap-1.5",children:[a.jsx("span",{children:Q.name}),ge&&a.jsx("span",{className:"text-[10px] text-muted-foreground font-normal",children:ge})]})},Q.id)})]})]})]}),(I??[]).length>0&&a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx(Fn,{children:"List"}),a.jsxs(Le,{value:c.task_list_id??"none",onValueChange:Q=>Y(Q==="none"?null:Q),children:[a.jsx($e,{className:"h-8 text-xs min-w-0",children:a.jsxs("div",{className:"flex items-center gap-1 min-w-0 overflow-hidden",children:[a.jsx(nx,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),a.jsx(qe,{placeholder:"No list",children:M?M.name:"No list"})]})}),a.jsxs(ze,{children:[a.jsx(we,{value:"none",className:"text-xs text-muted-foreground",children:"No list"}),(I??[]).map(Q=>a.jsx(we,{value:Q.id,className:"text-xs",children:Q.name},Q.id))]})]})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx(Fn,{children:"Start Date"}),a.jsxs(Ot,{children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{className:"flex items-center gap-1 h-8 w-full min-w-0 px-2 rounded border border-input text-xs hover:bg-accent transition-colors overflow-hidden",children:[a.jsx(Wt,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),a.jsx("span",{className:`truncate ${c.start_date?"text-foreground":"text-muted-foreground"}`,children:c.start_date?fe(new Date(c.start_date),"MMM d, yyyy"):"No date"})]})}),a.jsxs(_t,{className:"w-auto p-0",align:"start",children:[a.jsx(gr,{mode:"single",selected:c.start_date?new Date(c.start_date):void 0,onSelect:ae,initialFocus:!0}),c.start_date&&a.jsx("div",{className:"border-t px-3 py-2",children:a.jsxs("button",{onClick:()=>ae(void 0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[a.jsx(tt,{className:"h-3 w-3"}),"Clear date"]})})]})]})]}),(c==null?void 0:c.start_date)&&(c==null?void 0:c.due_date)&&(O==null?void 0:O.working_days)&&(()=>{const Q=Mh(new Date(c.start_date),new Date(c.due_date),O.working_days,L);return a.jsxs("div",{className:"shrink-0 self-end pb-1 text-[11px] text-muted-foreground whitespace-nowrap",children:[Q," biz day",Q!==1?"s":""]})})(),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx(Fn,{children:"Due Date"}),a.jsxs(Ot,{children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{className:"flex items-center gap-1 h-8 w-full min-w-0 px-2 rounded border border-input text-xs hover:bg-accent transition-colors overflow-hidden",children:[a.jsx(Wt,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),a.jsx("span",{className:`truncate ${c.due_date?"text-foreground":"text-muted-foreground"}`,children:c.due_date?fe(new Date(c.due_date),"MMM d, yyyy"):"No date"})]})}),a.jsxs(_t,{className:"w-auto p-0",align:"start",children:[a.jsx(gr,{mode:"single",selected:c.due_date?new Date(c.due_date):void 0,onSelect:ee,initialFocus:!0}),c.due_date&&a.jsx("div",{className:"border-t px-3 py-2",children:a.jsxs("button",{onClick:()=>ee(void 0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[a.jsx(tt,{className:"h-3 w-3"}),"Clear date"]})})]})]})]})]}),a.jsx(Zo,{}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(Fn,{children:"Recurring"}),a.jsx(Co,{checked:!!c.recurrence_frequency,onCheckedChange:se,disabled:k.isPending})]}),c.recurrence_frequency&&a.jsxs("div",{className:"space-y-2 pl-3 border-l-2 border-indigo-200 dark:border-indigo-800",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-[10px] font-medium text-muted-foreground mb-1",children:"Frequency"}),a.jsxs(Le,{value:c.recurrence_frequency,onValueChange:Q=>V(Q),children:[a.jsx($e,{className:"h-7 text-xs",children:a.jsx(qe,{})}),a.jsxs(ze,{children:[a.jsx(we,{value:"weekly",className:"text-xs",children:"Weekly"}),a.jsx(we,{value:"monthly",className:"text-xs",children:"Monthly"})]})]})]}),a.jsxs("div",{children:[a.jsxs("p",{className:"text-[10px] font-medium text-muted-foreground mb-1",children:["Until ",a.jsx("span",{className:"font-normal",children:"(optional)"})]}),a.jsxs(Ot,{children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{className:"flex items-center gap-1 h-7 w-full px-2 rounded border border-input text-xs hover:bg-accent transition-colors text-left",children:[a.jsx(Wt,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),a.jsx("span",{className:c.recurrence_end_date?"text-foreground":"text-muted-foreground",children:c.recurrence_end_date?fe(new Date(c.recurrence_end_date),"MMM d, yyyy"):"No end date"})]})}),a.jsxs(_t,{className:"w-auto p-0",align:"start",children:[a.jsx(gr,{mode:"single",selected:c.recurrence_end_date?new Date(c.recurrence_end_date):void 0,onSelect:ie,initialFocus:!0}),c.recurrence_end_date&&a.jsx("div",{className:"border-t px-3 py-2",children:a.jsxs("button",{onClick:()=>ie(void 0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[a.jsx(tt,{className:"h-3 w-3"}),"Clear end date"]})})]})]})]})]})]}),a.jsx(Zo,{}),re&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[10px] font-semibold tracking-[0.08em] uppercase text-zinc-900 dark:text-zinc-100",children:"Child Issues"}),a.jsxs("button",{onClick:()=>j(!0),className:"flex items-center gap-1 px-2 py-0.5 rounded-md bg-indigo-50 dark:bg-indigo-950/50 text-indigo-700 dark:text-indigo-300 text-[11px] font-medium hover:bg-indigo-100 dark:hover:bg-indigo-900/60 transition-colors",children:[a.jsx(dt,{className:"h-3 w-3"}),"Add"]})]}),J&&a.jsxs("button",{onClick:()=>s(`/${i}/projects/${o}/issues/${J.id}`),className:"flex items-center gap-2 w-full px-3 py-1.5 rounded-md bg-zinc-100 dark:bg-zinc-800/60 border border-zinc-200 dark:border-zinc-700 hover:border-indigo-300 dark:hover:border-indigo-700 transition-colors text-left",children:[a.jsx(Zp,{className:"h-3.5 w-3.5 text-zinc-400 shrink-0"}),a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-400 shrink-0",children:"Parent:"}),a.jsx("span",{className:"font-mono text-[11px] font-medium text-indigo-700 dark:text-indigo-300 shrink-0",children:J.identifier}),a.jsx("span",{className:"text-xs text-zinc-600 dark:text-zinc-300 truncate",children:J.title})]}),P.length===0?a.jsxs("button",{onClick:()=>j(!0),className:"w-full flex items-center justify-center gap-2 py-3.5 rounded-lg border-2 border-dashed border-zinc-200 dark:border-zinc-800 text-xs text-zinc-400 dark:text-zinc-500 hover:border-indigo-300 hover:text-indigo-500 dark:hover:border-indigo-700 dark:hover:text-indigo-400 transition-all",children:[a.jsx(dt,{className:"h-3.5 w-3.5"}),"Create child issue"]}):a.jsx("div",{className:"space-y-1",children:P.map(Q=>{const ge=(A??[]).filter(Be=>Be.parent_id===Q.id),De=ge.length>0,Ue=N.has(Q.id);return a.jsxs("div",{children:[a.jsxs("div",{className:"w-full flex items-center gap-2.5 px-3 py-2 rounded-lg bg-indigo-50/40 dark:bg-indigo-950/30 border border-indigo-200 dark:border-indigo-800 hover:bg-indigo-100/70 hover:border-indigo-400 dark:hover:bg-indigo-950/50 dark:hover:border-indigo-600 hover:shadow-sm transition-all group",children:[De?a.jsx("button",{onClick:()=>w(Be=>{const Ve=new Set(Be);return Ve.has(Q.id)?Ve.delete(Q.id):Ve.add(Q.id),Ve}),className:"shrink-0 text-indigo-400 dark:text-indigo-500 hover:text-indigo-600 dark:hover:text-indigo-300 transition-colors",children:Ue?a.jsx(ia,{className:"h-3.5 w-3.5"}):a.jsx(vr,{className:"h-3.5 w-3.5"})}):a.jsx(Mn,{className:"h-3.5 w-3.5 text-indigo-400 dark:text-indigo-500 shrink-0"}),a.jsxs("button",{onClick:()=>{n(),s(`/${i}/projects/${o}/issues/${Q.id}`)},className:"flex items-center gap-2.5 flex-1 min-w-0 text-left",children:[a.jsx("span",{className:"font-mono text-[11px] font-medium text-indigo-700 dark:text-indigo-300 shrink-0",children:Q.identifier}),a.jsx("span",{className:"text-xs text-zinc-700 dark:text-zinc-300 truncate group-hover:text-zinc-900 dark:group-hover:text-zinc-100 transition-colors",children:Q.title}),De&&a.jsxs("span",{className:"ml-auto shrink-0 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",children:[a.jsx(Mn,{className:"h-2.5 w-2.5"}),ge.length]})]})]}),De&&Ue&&a.jsx("div",{className:"mt-1 ml-6 space-y-1",children:ge.map(Be=>a.jsxs("button",{onClick:()=>{n(),s(`/${i}/projects/${o}/issues/${Be.id}`)},className:"w-full flex items-center gap-2.5 px-3 py-2 rounded-lg bg-indigo-50/20 dark:bg-indigo-950/20 border border-indigo-100 dark:border-indigo-900 hover:bg-indigo-100/70 hover:border-indigo-400 dark:hover:bg-indigo-950/50 dark:hover:border-indigo-600 hover:shadow-sm transition-all text-left group",children:[a.jsx(Mn,{className:"h-3.5 w-3.5 text-indigo-300 dark:text-indigo-600 shrink-0"}),a.jsx("span",{className:"font-mono text-[11px] font-medium text-indigo-600 dark:text-indigo-400 shrink-0",children:Be.identifier}),a.jsx("span",{className:"text-xs text-zinc-600 dark:text-zinc-400 truncate group-hover:text-zinc-900 dark:group-hover:text-zinc-100 transition-colors",children:Be.title})]},Be.id))})]},Q.id)})})]}),a.jsx(Zo,{}),a.jsxs("div",{children:[a.jsx(Fn,{children:"Description"}),d?a.jsx(Tx,{content:p,onChange:x,placeholder:"Add a description…",className:"min-h-[160px] rounded-md border border-input"},`${c.id}-edit`):c.description?a.jsx("div",{className:"rounded-lg bg-zinc-50 dark:bg-zinc-900/60 border border-zinc-100 dark:border-zinc-800 px-3.5 py-3",children:a.jsx(Ix,{html:c.description,className:"text-sm"})}):a.jsxs("button",{onClick:()=>u(!0),className:"w-full flex items-center justify-center gap-2 py-3.5 rounded-lg border-2 border-dashed border-zinc-200 dark:border-zinc-800 text-xs text-zinc-400 dark:text-zinc-500 hover:border-indigo-300 hover:text-indigo-500 dark:hover:border-indigo-700 dark:hover:text-indigo-400 transition-all",children:[a.jsx(si,{className:"h-3.5 w-3.5"}),"Add description"]})]})]}),a.jsx("div",{className:"px-6 py-4",children:a.jsx(Cr,{zone:"issue.details.after",props:{issue:c}})}),a.jsx(Mk,{issueId:c.id,projectId:t,className:"border-t border-border",compact:!0,hideCommentInput:!0,onTabChange:v,onViewMore:()=>{n(),s(`/${i}/projects/${o}/issues/${c.id}`)}})]}),g==="comments"&&a.jsx("div",{className:"border-t border-border px-6 py-3 shrink-0",children:a.jsx(Nk,{issueId:c.id,projectId:t,compact:!0})})]})}),a.jsx(of,{open:y,onClose:()=>j(!1),projectId:t,defaultParentId:c.id,defaultTaskListId:c.task_list_id})]})}function h6(){const{projectKey:e,workspace:t}=zt(),r=iN(),[n,s]=h.useState(null),[i,o]=h.useState(!1),[l,c]=h.useState({}),{data:d}=Wa(e??""),u=(d==null?void 0:d.id)??"",{data:f,isLoading:m}=Ql(u||void 0,l),{data:p,isLoading:x}=ko(u||void 0),{data:g}=la(u),{data:v}=ks(),y=KI(u),j=h.useMemo(()=>!(g!=null&&g.members)||!v?[]:g.members.map(k=>{const b=v.get(k.user_id);return b?{userId:k.user_id,name:b.name,initials:b.initials}:null}).filter(k=>k!==null),[g,v]);if(r&&e&&t)return a.jsx(Xn,{to:`/${t}/projects/${e}/issues`,replace:!0});if(!e)return null;const N=m||x||!d,w=k=>{y.mutate(k)};return a.jsxs("div",{className:"flex flex-col h-full gap-0",children:[a.jsxs("div",{className:"flex flex-col flex-1 min-h-0 bg-white dark:bg-card",children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-border shrink-0",children:[a.jsx(u4,{statuses:p??[],members:j,filters:l,onChange:c}),a.jsxs(ne,{size:"sm",onClick:()=>o(!0),children:[a.jsx(dt,{className:"h-4 w-4"}),"Create"]})]}),a.jsx(Cr,{zone:"project.board.before",props:{projectId:u}}),a.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:N?a.jsx("div",{className:"flex gap-4 px-6 py-6",children:[1,2,3,4].map(k=>a.jsxs("div",{className:"min-w-[260px]",children:[a.jsx(le,{className:"h-5 w-24 mb-3 rounded"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(le,{className:"h-[82px] w-full rounded-lg"}),a.jsx(le,{className:"h-[82px] w-full rounded-lg"})]})]},k))}):a.jsx(KN,{issues:f??[],projectId:u,statuses:p??[],onIssueClick:s,onColumnsReorder:w,filters:l})})]}),a.jsx(Cr,{zone:"project.board.after",props:{projectId:u}}),a.jsx(Ek,{issue:n,projectId:u,open:!!n,onClose:()=>s(null)}),a.jsx(of,{open:i,onClose:()=>o(!1),projectId:u})]})}const Th=({priority:e,className:t})=>{const r=z("h-3.5 w-3.5 shrink-0",uc[e],t);switch(e){case"urgent":return a.jsx(oa,{className:r});case"high":return a.jsx(bi,{className:r});case"medium":return a.jsx(Ba,{className:r});case"low":return a.jsx(yi,{className:r});default:return a.jsx(_r,{className:z("h-3.5 w-3.5 shrink-0 text-zinc-300",t)})}},Ih="grid-cols-[70px_250px_150px_120px_130px_140px_130px_32px]";function Ak({issue:e,projectId:t,statuses:r,statusLabels:n,statusColorMap:s,sprints:i,workspace:o,projectKey:l,onOpen:c,isChild:d=!1,children:u=[],childrenMap:f,onAddChild:m}){const p=pt(),[x,g]=h.useState(null),[v,y]=h.useState(!1),j=Ru(e.id,t),{data:N}=la(t),w=h.useMemo(()=>N?N.members.filter(S=>S.user).map(S=>S.user):void 0,[N]);function k(S){j.mutate(S),g(null)}const b=(s==null?void 0:s[e.status])??"#94a3b8",C=i.find(S=>S.id===e.sprint_id),_=u.length>0;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{onClick:()=>c(e),className:z(`group grid ${Ih} items-center py-3`,"hover:bg-[#f9fafb] dark:hover:bg-muted/30 cursor-pointer transition-colors",d&&"bg-muted/10",j.isPending&&"opacity-70"),children:[a.jsx("span",{className:z("text-xs font-mono text-muted-foreground truncate","sticky left-0 z-10 pl-6 transition-colors","bg-white dark:bg-card group-hover:bg-[#f9fafb] dark:group-hover:bg-muted/30",d&&"text-muted-foreground"),children:e.identifier}),a.jsxs("div",{className:z("flex items-center gap-1 min-w-0 pr-3","sticky left-[70px] z-10 transition-colors","bg-white dark:bg-card group-hover:bg-[#f9fafb] dark:group-hover:bg-muted/30",d&&"bg-white dark:bg-muted/20"),children:[_?a.jsxs(Qn,{children:[a.jsx(Zn,{asChild:!0,children:a.jsx("button",{onClick:S=>{S.stopPropagation(),y(!v)},className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors p-0.5 rounded",children:v?a.jsx(ia,{className:"h-3.5 w-3.5"}):a.jsx(vr,{className:"h-3.5 w-3.5"})})}),a.jsx(_n,{side:"top",children:v?"Collapse":"Expand"})]}):d?a.jsx(Mn,{className:"h-3 w-3 text-muted-foreground shrink-0"}):a.jsx("span",{className:"w-4 shrink-0"}),a.jsx("span",{className:z("text-sm text-foreground truncate",d&&"text-primary"),children:e.title}),_&&a.jsxs("span",{className:"shrink-0 flex items-center gap-0.5 ml-1 text-[10px] font-medium text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/50 px-1 py-0.5 rounded",children:[a.jsx(Mn,{className:"h-2.5 w-2.5"}),u.length]})]}),a.jsx("div",{onClick:S=>S.stopPropagation(),children:a.jsxs(Ot,{open:x==="status",onOpenChange:S=>g(S?"status":null),children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex items-center gap-1.5 max-w-full px-1.5 py-1 rounded hover:bg-accent transition-colors focus:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[a.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:b}}),a.jsx("span",{className:"text-xs text-primary truncate",children:n[e.status]??e.status})]})}),a.jsx(_t,{className:"w-52 p-1",align:"start",onClick:S=>S.stopPropagation(),children:a.jsx(Xs,{children:a.jsx(Qs,{children:a.jsx(cs,{children:r.map(S=>a.jsxs(un,{value:S.name,onSelect:()=>k({status:S.key}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[a.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:S.color}}),a.jsx("span",{className:"text-xs flex-1",children:S.name}),e.status===S.key&&a.jsx(dr,{className:"h-3.5 w-3.5 text-indigo-500"})]},S.key))})})})})]})}),a.jsx("div",{onClick:S=>S.stopPropagation(),children:a.jsxs(Ot,{open:x==="priority",onOpenChange:S=>g(S?"priority":null),children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-1.5 py-1 rounded hover:bg-accent transition-colors focus:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[a.jsx(Th,{priority:e.priority}),a.jsx("span",{className:"text-xs text-primary",children:rn[e.priority]??e.priority})]})}),a.jsx(_t,{className:"w-44 p-1",align:"start",onClick:S=>S.stopPropagation(),children:a.jsx(Xs,{children:a.jsx(Qs,{children:a.jsx(cs,{children:Object.entries(rn).map(([S,I])=>a.jsxs(un,{value:I,onSelect:()=>k({priority:S}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[a.jsx(Th,{priority:S}),a.jsx("span",{className:"text-xs flex-1",children:I}),e.priority===S&&a.jsx(dr,{className:"h-3.5 w-3.5 text-indigo-500"})]},S))})})})})]})}),a.jsx("div",{onClick:S=>S.stopPropagation(),children:a.jsxs(Ot,{open:x==="sprint",onOpenChange:S=>g(S?"sprint":null),children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-1.5 py-1 rounded hover:bg-accent transition-colors focus:outline-none focus-visible:ring-1 focus-visible:ring-ring max-w-full",children:[a.jsx(Hr,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),a.jsx("span",{className:z("text-xs truncate",C?"text-foreground":"text-muted-foreground"),children:(C==null?void 0:C.name)??"No sprint"})]})}),a.jsx(_t,{className:"w-56 p-1",align:"start",onClick:S=>S.stopPropagation(),children:a.jsx(Xs,{children:a.jsx(Qs,{children:a.jsxs(cs,{children:[a.jsxs(un,{value:"no-sprint",onSelect:()=>k({sprint_id:null}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[a.jsx(tt,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("span",{className:"text-xs flex-1 text-muted-foreground",children:"No sprint"}),!e.sprint_id&&a.jsx(dr,{className:"h-3.5 w-3.5 text-indigo-500"})]}),i.filter(S=>S.status!=="completed").map(S=>a.jsxs(un,{value:S.name,onSelect:()=>k({sprint_id:S.id}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[a.jsx(Hr,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-xs truncate",children:S.name}),(S.start_date||S.end_date)&&a.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[S.start_date?fe(new Date(S.start_date),"MMM d"):"—"," → ",S.end_date?fe(new Date(S.end_date),"MMM d"):"—"]})]}),e.sprint_id===S.id&&a.jsx(dr,{className:"h-3.5 w-3.5 text-indigo-500 shrink-0"})]},S.id))]})})})})]})}),a.jsx("div",{onClick:S=>S.stopPropagation(),children:a.jsxs(Ot,{open:x==="due",onOpenChange:S=>g(S?"due":null),children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-1.5 py-1 rounded hover:bg-accent transition-colors focus:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[a.jsx(Wt,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),a.jsx("span",{className:z("text-xs",e.due_date?"text-foreground":"text-muted-foreground"),children:e.due_date?fe(new Date(e.due_date),"MMM d, yyyy"):"No due date"})]})}),a.jsxs(_t,{className:"w-auto p-0",align:"start",onClick:S=>S.stopPropagation(),children:[a.jsx(gr,{mode:"single",selected:e.due_date?new Date(e.due_date):void 0,onSelect:S=>k({due_date:S?fe(S,"yyyy-MM-dd"):null}),initialFocus:!0}),e.due_date&&a.jsx("div",{className:"border-t px-3 py-2",children:a.jsxs("button",{onClick:()=>k({due_date:null}),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[a.jsx(tt,{className:"h-3 w-3"}),"Clear date"]})})]})]})}),a.jsx("div",{onClick:S=>S.stopPropagation(),children:a.jsx(mc,{value:e.assignee_ids??[],onChange:S=>j.mutate({assignee_ids:S}),users:w})}),a.jsxs("div",{className:"flex items-center gap-1 pr-6",onClick:S=>S.stopPropagation(),children:[!d&&m&&a.jsxs(Qn,{children:[a.jsx(Zn,{asChild:!0,children:a.jsx("button",{onClick:()=>m(e.id),className:"p-1 rounded hover:bg-border text-muted-foreground hover:text-foreground",children:a.jsx(Mn,{className:"h-3.5 w-3.5"})})}),a.jsx(_n,{side:"top",children:"Add child issue"})]}),a.jsxs(Qn,{children:[a.jsx(Zn,{asChild:!0,children:a.jsx("button",{onClick:()=>p(`/${o}/projects/${l}/issues/${e.id}`),className:"p-1 rounded hover:bg-border text-muted-foreground hover:text-foreground",children:a.jsx(rx,{className:"h-3.5 w-3.5"})})}),a.jsx(_n,{side:"top",children:"Open full page"})]})]})]}),v&&u.map(S=>a.jsx(Ak,{issue:S,projectId:t,statuses:r,statusLabels:n,statusColorMap:s,sprints:i,workspace:o,projectKey:l,onOpen:c,isChild:!0,children:(f==null?void 0:f[S.id])??[],childrenMap:f,onAddChild:m},S.id))]})}function $y({taskList:e,issues:t,childrenMap:r,projectId:n,statuses:s,statusLabels:i,statusColorMap:o,sprints:l,workspace:c,projectKey:d,onOpen:u,onAddIssue:f,onAddChild:m,onRenameList:p,onDeleteList:x}){const[g,v]=h.useState(!1),[y,j]=h.useState(!1),[N,w]=h.useState((e==null?void 0:e.name)??""),k=t.reduce((_,S)=>{var I;return _+(((I=r[S.id])==null?void 0:I.length)??0)},0),b=t.length+k,C=()=>{e&&N.trim()&&p&&p(e.id,N.trim()),j(!1)};return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 px-6 py-2 bg-muted/20 border-b border-border group/header",children:[a.jsxs(Qn,{children:[a.jsx(Zn,{asChild:!0,children:a.jsx("button",{onClick:()=>v(!g),className:"text-muted-foreground hover:text-foreground transition-colors",children:g?a.jsx(vr,{className:"h-3.5 w-3.5"}):a.jsx(ia,{className:"h-3.5 w-3.5"})})}),a.jsx(_n,{side:"right",children:g?"Expand":"Collapse"})]}),e?y?a.jsx("input",{autoFocus:!0,value:N,onChange:_=>w(_.target.value),onBlur:C,onKeyDown:_=>{_.key==="Enter"&&C(),_.key==="Escape"&&(j(!1),w(e.name))},className:"text-xs font-semibold text-foreground bg-transparent border-b border-indigo-400 outline-none px-0.5"}):a.jsx("span",{className:"text-xs font-semibold text-foreground",children:e.name}):a.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"No List"}),a.jsx("span",{className:"text-[11px] text-muted-foreground/60 font-mono",children:b}),a.jsxs("div",{className:"flex items-center gap-1 ml-auto",children:[a.jsxs("button",{onClick:()=>f((e==null?void 0:e.id)??null),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors px-1.5 py-0.5 rounded hover:bg-muted",children:[a.jsx(dt,{className:"h-3 w-3"}),"Add issue"]}),e&&a.jsxs(Kr,{children:[a.jsxs(Qn,{children:[a.jsx(Zn,{asChild:!0,children:a.jsx(Yr,{asChild:!0,children:a.jsx("button",{className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:a.jsx(Ma,{className:"h-3.5 w-3.5"})})})}),a.jsx(_n,{side:"top",children:"More options"})]}),a.jsxs(Or,{align:"end",className:"w-36",children:[a.jsxs(at,{className:"text-xs gap-2 cursor-pointer",onClick:()=>{j(!0),w(e.name)},children:[a.jsx(si,{className:"h-3.5 w-3.5"}),"Rename"]}),a.jsxs(at,{className:"text-xs gap-2 cursor-pointer text-destructive focus:text-destructive",onClick:()=>x==null?void 0:x(e.id),children:[a.jsx(Mr,{className:"h-3.5 w-3.5"}),"Delete list"]})]})]})]})]}),!g&&a.jsx("div",{className:"divide-y divide-border/60",children:t.length===0?a.jsx("div",{className:"px-14 py-3 text-xs text-muted-foreground/50 italic",children:"No issues in this list"}):t.map(_=>a.jsx(Ak,{issue:_,projectId:n,statuses:s,statusLabels:i,statusColorMap:o,sprints:l,workspace:c,projectKey:d,onOpen:u,children:r[_.id]??[],childrenMap:r,onAddChild:m},_.id))})]})}function p6(){var D;const e=pt(),{workspace:t,projectKey:r}=zt(),[n,s]=h.useState(null),[i,o]=h.useState({open:!1}),[l,c]=h.useState(""),[d,u]=h.useState(!1),[f,m]=h.useState(""),[p,x]=h.useState("all"),[g,v]=h.useState("all"),[y,j]=h.useState("all"),{data:N}=Wa(r??""),w=(N==null?void 0:N.id)??"",{data:k,isLoading:b}=Ql(w||void 0),{data:C}=ko(w||void 0),{data:_}=So(w||void 0),{data:S}=fc(w||void 0),I=N4(w),A=k4(w),O=S4(w),L=C&&C.length>0?C:Object.entries(ci).map(([E,Z],B)=>({id:E,project_id:w,key:E,name:Z,color:{backlog:"#94a3b8",todo:"#64748b",in_progress:"#6366f1",in_review:"#f59e0b",done:"#10b981",cancelled:"#9ca3af"}[E]??"#94a3b8",category:{backlog:"backlog",todo:"unstarted",in_progress:"started",in_review:"started",done:"completed",cancelled:"cancelled"}[E]??"backlog",position:B})),F=Object.fromEntries(L.map(E=>[E.key,E.name])),X=Object.fromEntries(L.map(E=>[E.key,E.color])),T=_??[];if(!r||!t)return null;const G=(k??[]).filter(E=>{const Z=!f||E.title.toLowerCase().includes(f.toLowerCase())||E.identifier.toLowerCase().includes(f.toLowerCase()),B=p==="all"||E.status===p,Y=g==="all"||E.priority===g,ae=y==="all"||(y==="none"?!E.sprint_id:E.sprint_id===y);return Z&&B&&Y&&ae}).sort((E,Z)=>{const B=parseInt(E.identifier.split("-")[1]??"0",10),Y=parseInt(Z.identifier.split("-")[1]??"0",10);return B-Y}),re={};for(const E of k??[])E.parent_id&&(re[E.parent_id]||(re[E.parent_id]=[]),re[E.parent_id].push(E));const J=G.filter(E=>!E.parent_id),P=G.length,M=new Set((S??[]).map(E=>E.id)),R={__none__:[]};for(const E of S??[])R[E.id]=[];for(const E of J){const Z=E.task_list_id&&M.has(E.task_list_id)?E.task_list_id:"__none__";R[Z].push(E)}function U(){l.trim()&&I.mutate({name:l.trim()},{onSuccess:()=>{c(""),u(!1),H.success("List created")},onError:()=>H.error("Failed to create list")})}function $(E,Z){A.mutate({id:E,name:Z},{onError:()=>H.error("Failed to rename list")})}function K(E){const Z=S==null?void 0:S.find(B=>B.id===E);confirm(`Delete list "${Z==null?void 0:Z.name}"? Issues in this list will be moved to No List.`)&&O.mutate(E,{onSuccess:()=>H.success("List deleted"),onError:()=>H.error("Failed to delete list")})}return a.jsxs("div",{className:"p-2 pb-24 md:pb-2",children:[a.jsx(Cr,{zone:"project.issues.before",props:{projectId:w}}),a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[a.jsx("div",{className:"flex items-center justify-end px-6 py-3 border-b border-border",children:a.jsxs("div",{className:"flex items-center gap-2",children:[d?a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(Ee,{autoFocus:!0,placeholder:"List name...",value:l,onChange:E=>c(E.target.value),onKeyDown:E=>{E.key==="Enter"&&U(),E.key==="Escape"&&(u(!1),c(""))},className:"h-8 text-xs w-36"}),a.jsx(ne,{size:"sm",variant:"outline",className:"h-8 text-xs",onClick:U,disabled:!l.trim()||I.isPending,children:"Add"}),a.jsx(ne,{size:"sm",variant:"ghost",className:"h-8 text-xs",onClick:()=>{u(!1),c("")},children:"Cancel"})]}):a.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>u(!0),children:[a.jsx(dt,{className:"h-4 w-4"}),"New List"]}),a.jsxs(ne,{size:"sm",onClick:()=>o({open:!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 border-b border-border md:flex-row md:items-center md:justify-between md:gap-3",children:[a.jsxs("div",{className:"flex items-center gap-2 md:overflow-x-auto md:scrollbar-none",children:[a.jsxs(Le,{value:y,onValueChange:j,children:[a.jsx($e,{className:"h-8 text-xs flex-1 md:flex-none md:w-[140px] md:shrink-0 bg-transparent",children:a.jsx(qe,{placeholder:"Sprint"})}),a.jsxs(ze,{children:[a.jsx(we,{value:"all",className:"text-xs",children:"All sprints"}),a.jsx(we,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),T.map(E=>a.jsx(we,{value:E.id,className:"text-xs",children:E.name},E.id))]})]}),a.jsxs(Le,{value:p,onValueChange:x,children:[a.jsx($e,{className:"h-8 text-xs flex-1 md:flex-none md:w-[130px] md:shrink-0 bg-transparent",children:a.jsx(qe,{placeholder:"Status"})}),a.jsxs(ze,{children:[a.jsx(we,{value:"all",className:"text-xs",children:"All statuses"}),L.map(({key:E,name:Z})=>a.jsx(we,{value:E,className:"text-xs",children:Z},E))]})]}),a.jsxs(Le,{value:g,onValueChange:v,children:[a.jsx($e,{className:"h-8 text-xs flex-1 md:flex-none md:w-[130px] md:shrink-0 bg-transparent",children:a.jsx(qe,{placeholder:"Priority"})}),a.jsxs(ze,{children:[a.jsx(we,{value:"all",className:"text-xs",children:"All priorities"}),Object.entries(rn).map(([E,Z])=>a.jsx(we,{value:E,className:"text-xs",children:Z},E))]})]})]}),a.jsxs("div",{className:"relative",children:[a.jsx(ji,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),a.jsx(Ee,{placeholder:"Search...",value:f,onChange:E=>m(E.target.value),className:"pl-8 h-8 w-full md:w-[200px] text-xs bg-transparent"})]})]}),a.jsx("div",{className:"hidden md:block overflow-x-auto",children:a.jsxs("div",{className:"min-w-[1025px]",children:[a.jsxs("div",{className:z("grid items-center py-2.5 border-b border-border",Ih),children:[a.jsx("span",{className:"text-xs font-medium text-[#6b7280] sticky left-0 z-10 bg-white dark:bg-card pl-6",children:"ID"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280] sticky left-[70px] z-10 bg-white dark:bg-card",children:"Title"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Status"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Priority"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Sprint"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Due Date"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Assignees"}),a.jsx("span",{className:"pr-6"})]}),b?a.jsx("div",{className:"divide-y divide-border",children:[1,2,3,4].map(E=>a.jsxs("div",{className:z("grid items-center px-6 py-3 gap-4",Ih),children:[a.jsx(le,{className:"h-4 w-14"}),a.jsx(le,{className:"h-4 w-56"}),a.jsx(le,{className:"h-5 w-20"}),a.jsx(le,{className:"h-4 w-16"}),a.jsx(le,{className:"h-4 w-20"}),a.jsx(le,{className:"h-4 w-24"}),a.jsx(le,{className:"h-6 w-16"}),a.jsx("span",{})]},E))}):P===0&&(k??[]).length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[a.jsx("p",{className:"text-sm font-medium mb-1",children:"No issues yet"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Create your first issue to start tracking work."}),a.jsxs(ne,{size:"sm",onClick:()=>o({open:!0}),children:[a.jsx(dt,{className:"h-4 w-4"}),"Create issue"]})]}):J.length===0&&(k??[]).length>0?a.jsx("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"No issues match your filters."})}):a.jsx(Iu,{delayDuration:200,children:a.jsxs("div",{className:"divide-y divide-border",children:[(S??[]).map(E=>a.jsx($y,{taskList:E,issues:R[E.id]??[],childrenMap:re,projectId:w,statuses:L,statusLabels:F,statusColorMap:X,sprints:T,workspace:t,projectKey:r,onOpen:s,onAddIssue:Z=>o({open:!0,defaultTaskListId:Z}),onAddChild:Z=>o({open:!0,defaultParentId:Z}),onRenameList:$,onDeleteList:K},E.id)),(((D=R.__none__)==null?void 0:D.length)>0||(S??[]).length===0)&&a.jsx($y,{taskList:null,issues:R.__none__??[],childrenMap:re,projectId:w,statuses:L,statusLabels:F,statusColorMap:X,sprints:T,workspace:t,projectKey:r,onOpen:s,onAddIssue:E=>o({open:!0,defaultTaskListId:E}),onAddChild:E=>o({open:!0,defaultParentId:E})})]})})]})}),a.jsx("div",{className:"md:hidden divide-y divide-border/60",children:b?[1,2,3,4].map(E=>a.jsx("div",{className:"flex items-start gap-3 px-4 py-3",children:a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"h-3 w-10 bg-muted rounded animate-pulse"}),a.jsx("div",{className:"h-4 w-48 bg-muted rounded animate-pulse"})]}),a.jsx("div",{className:"h-3 w-32 bg-muted rounded animate-pulse"})]})},E)):J.length===0?null:J.map(E=>{const Z=(X==null?void 0:X[E.status])??"#94a3b8",B=T.find(Y=>Y.id===E.sprint_id);return a.jsx("div",{onClick:()=>e(`/${t}/projects/${r}/issues/${E.id}`),className:"flex items-start gap-3 px-4 py-3 hover:bg-[#f9fafb] dark:hover:bg-muted/30 cursor-pointer transition-colors",children:a.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx("span",{className:"text-[10px] font-mono text-muted-foreground shrink-0",children:E.identifier}),a.jsx("span",{className:"text-sm text-foreground truncate font-medium",children:E.title})]}),a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx(Th,{priority:E.priority}),a.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-muted-foreground",children:[a.jsx("span",{className:"h-1.5 w-1.5 rounded-full shrink-0",style:{backgroundColor:Z}}),F[E.status]??E.status]}),B&&a.jsx("span",{className:"text-[11px] text-muted-foreground truncate max-w-[120px]",children:B.name}),E.due_date&&a.jsx("span",{className:"text-[11px] text-muted-foreground",children:fe(new Date(E.due_date),"MMM d")})]})]})},E.id)})}),!b&&P>0&&a.jsx("div",{className:"flex items-center px-6 py-3 border-t border-border",children:a.jsxs("span",{className:"text-xs text-muted-foreground",children:[P," issue",P!==1?"s":""]})})]}),a.jsx(Cr,{zone:"project.issues.after",props:{projectId:w}}),a.jsx(Ek,{issue:n,projectId:w,open:!!n,onClose:()=>s(null)}),a.jsx(of,{open:i.open,onClose:()=>o({open:!1}),projectId:w,defaultTaskListId:i.defaultTaskListId,defaultParentId:i.defaultParentId})]})}function x6(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,g6(s,...t)]}function g6(...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 v6=Symbol("radix.slottable");function y6(e){const t=({children:r})=>a.jsx(a.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=v6,t}var Dk="AlertDialog",[b6]=x6(Dk,[a1]),Ya=a1(),Tk=e=>{const{__scopeAlertDialog:t,...r}=e,n=Ya(t);return a.jsx(Xl,{...n,...r,modal:!0})};Tk.displayName=Dk;var w6="AlertDialogTrigger",j6=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Ya(r);return a.jsx(XP,{...s,...n,ref:t})});j6.displayName=w6;var N6="AlertDialogPortal",Ik=e=>{const{__scopeAlertDialog:t,...r}=e,n=Ya(t);return a.jsx(Vl,{...n,...r})};Ik.displayName=N6;var k6="AlertDialogOverlay",Rk=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Ya(r);return a.jsx(gi,{...s,...n,ref:t})});Rk.displayName=k6;var Hi="AlertDialogContent",[S6,C6]=b6(Hi),_6=y6("AlertDialogContent"),$k=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:n,...s}=e,i=Ya(r),o=h.useRef(null),l=Tu(t,o),c=h.useRef(null);return a.jsx(VP,{contentName:Hi,titleName:zk,docsSlug:"alert-dialog",children:a.jsx(S6,{scope:r,cancelRef:c,children:a.jsxs(vi,{role:"alertdialog",...i,...s,ref:l,onOpenAutoFocus:Fs(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(_6,{children:n}),a.jsx(O6,{contentRef:o})]})})})});$k.displayName=Hi;var zk="AlertDialogTitle",Lk=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Ya(r);return a.jsx(uo,{...s,...n,ref:t})});Lk.displayName=zk;var Fk="AlertDialogDescription",Bk=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Ya(r);return a.jsx(fo,{...s,...n,ref:t})});Bk.displayName=Fk;var M6="AlertDialogAction",Wk=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Ya(r);return a.jsx(Du,{...s,...n,ref:t})});Wk.displayName=M6;var Uk="AlertDialogCancel",qk=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,{cancelRef:s}=C6(Uk,r),i=Ya(r),o=Tu(t,s);return a.jsx(Du,{...i,...n,ref:o})});qk.displayName=Uk;var O6=({contentRef:e})=>{const t=`\`${Hi}\` requires a description for the component to be accessible for screen reader users.
558
558
 
559
559
  You can add a description to the \`${Hi}\` by passing a \`${Fk}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
560
560
 
@@ -627,4 +627,4 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
627
627
  --nojs-bg: black !important;
628
628
  --nojs-fg: white !important;
629
629
  }
630
- }`;const hP=h.forwardRef(({className:e,containerClassName:t,...r},n)=>a.jsx(mP,{ref:n,containerClassName:z("flex items-center gap-2 has-[:disabled]:opacity-50",t),className:z("disabled:cursor-not-allowed",e),...r}));hP.displayName="InputOTP";const Fp=h.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:z("flex items-center",e),...t}));Fp.displayName="InputOTPGroup";const Ls=h.forwardRef(({index:e,className:t,...r},n)=>{const s=h.useContext(fP),{char:i,hasFakeCaret:o,isActive:l}=s.slots[e];return a.jsxs("div",{ref:n,className:z("relative flex h-10 w-10 items-center justify-center border-y border-r border-input text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md",l&&"z-10 ring-2 ring-ring ring-offset-background",t),...r,children:[i,o&&a.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:a.jsx("div",{className:"h-4 w-px animate-caret-blink bg-foreground duration-1000"})})]})});Ls.displayName="InputOTPSlot";const pP=h.forwardRef(({...e},t)=>a.jsx("div",{ref:t,role:"separator",...e,children:a.jsx(Ba,{})}));pP.displayName="InputOTPSeparator";function Mj({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 dte(){var B,Y,ae,ee;const[e,t]=Gl(),{user:r}=Ie(),{data:n,isLoading:s}=bO(),i=jZ(),o=NZ(),l=kZ(),c=_Z(),d=SZ(),u=CZ(),f=h.useRef(null),[m,p]=h.useState(""),[x,g]=h.useState(""),[v,y]=h.useState(""),[j,N]=h.useState(""),[w,k]=h.useState(!1),[b,C]=h.useState(!1),[_,S]=h.useState(""),[I,A]=h.useState(""),[O,L]=h.useState(""),[F,X]=h.useState(!1),[T,G]=h.useState(0),re=h.useRef(null);h.useEffect(()=>{n&&(p(n.first_name??""),g(n.last_name??""),y(n.designation??""),N(n.phone_number??""))},[n]),h.useEffect(()=>{e.get("linked")==="true"&&(H.success("Google account connected successfully"),t(se=>(se.delete("linked"),se),{replace:!0}))},[e,t]);const J=r&&(`${((B=r.first_name)==null?void 0:B[0])??""}${((Y=r.last_name)==null?void 0:Y[0])??""}`.toUpperCase()||((ee=(ae=r.email)==null?void 0:ae[0])==null?void 0:ee.toUpperCase()))||"?",P=se=>{var ie;const V=(ie=se.target.files)==null?void 0:ie[0];V&&(o.mutate(V,{onSuccess:()=>H.success("Avatar updated"),onError:pe=>H.error(pe.message??"Failed to upload avatar")}),se.target.value="")},M=()=>{l.mutate(void 0,{onSuccess:()=>H.success("Avatar removed"),onError:se=>H.error(se.message??"Failed to remove avatar")})},R=()=>{i.mutate({first_name:m,last_name:x,designation:v||null,phone_number:j||null},{onSuccess:()=>H.success("Profile updated"),onError:se=>H.error(se.message??"Failed to update profile")})},U=()=>{const se=localStorage.getItem("meridian_token");if(!se){H.error("You must be logged in to connect Google");return}window.location.href=`${Gi}/auth/google/link?token=${encodeURIComponent(se)}`},$=()=>{c.mutate(void 0,{onSuccess:()=>H.success("Google account disconnected"),onError:se=>H.error(se.message??"Failed to unlink Google account")})},K=h.useCallback(()=>{G(30),re.current&&clearInterval(re.current),re.current=setInterval(()=>{G(se=>se<=1?(re.current&&clearInterval(re.current),0):se-1)},1e3)},[]);h.useEffect(()=>()=>{re.current&&clearInterval(re.current)},[]);const D=()=>{d.mutate(void 0,{onSuccess:()=>{C(!0),K(),H.success("Verification code sent to your email")},onError:se=>H.error(se.message??"Failed to send verification code")})},E=()=>{if(I.length<8){H.error("New password must be at least 8 characters");return}if(I!==O){H.error("Passwords do not match");return}u.mutate({otp:_,new_password:I},{onSuccess:()=>{H.success("Password updated"),Z()},onError:se=>H.error(se.message??"Failed to set password")})},Z=()=>{k(!1),C(!1),S(""),A(""),L(""),X(!1),G(0),re.current&&clearInterval(re.current)};return a.jsx("div",{className:"p-2 md:h-full",children:a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden flex flex-col md:h-full",children:[a.jsx("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border shrink-0",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(tc,{className:"h-5 w-5 text-muted-foreground"}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-base font-semibold",children:"Profile"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Manage your personal details and account connections."})]})]})}),a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between px-4 md:px-6 py-4 border-b border-border gap-3",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Profile photo"}),a.jsxs("div",{className:"flex flex-1 items-center gap-4",children:[a.jsxs("div",{className:"relative",children:[a.jsxs(Rt,{className:"h-14 w-14 rounded-xl",children:[n!=null&&n.avatar_url?a.jsx(wl,{src:n.avatar_url,alt:"Avatar",className:"object-cover"}):null,a.jsx($t,{className:"rounded-xl bg-foreground text-background text-base font-medium",children:J})]}),o.isPending&&a.jsx("div",{className:"absolute inset-0 rounded-xl bg-black/40 flex items-center justify-center",children:a.jsx("span",{className:"text-white text-[10px]",children:"…"})})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ne,{variant:"outline",size:"sm",className:"h-8 gap-1.5",onClick:()=>{var se;return(se=f.current)==null?void 0:se.click()},disabled:o.isPending,children:[a.jsx(i5,{className:"size-3.5"}),"Change photo"]}),(n==null?void 0:n.avatar_url)&&a.jsxs(ne,{variant:"ghost",size:"sm",className:"h-8 gap-1.5 text-muted-foreground hover:text-destructive",onClick:M,disabled:l.isPending,children:[a.jsx(Mr,{className:"size-3.5"}),"Remove"]})]}),a.jsx("input",{ref:f,type:"file",accept:"image/*",className:"hidden",onChange:P})]})]}),a.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/10",children:a.jsx("p",{className:"text-xs text-muted-foreground",children:"Personal information"})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"First name"}),s?a.jsx(le,{className:"h-8 w-56"}):a.jsx(Ee,{value:m,onChange:se=>p(se.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"First name"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Last name"}),s?a.jsx(le,{className:"h-8 w-56"}):a.jsx(Ee,{value:x,onChange:se=>g(se.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"Last name"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Email"}),s?a.jsx(le,{className:"h-4 w-48"}):a.jsx("span",{className:"text-sm text-muted-foreground",children:(n==null?void 0:n.email)??"—"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Designation"}),s?a.jsx(le,{className:"h-8 w-56"}):a.jsx(Ee,{value:v,onChange:se=>y(se.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"e.g. Software Engineer"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Phone number"}),s?a.jsx(le,{className:"h-8 w-56"}):a.jsx(Ee,{value:j,onChange:se=>N(se.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"+1 555 000 0000"})]}),a.jsx("div",{className:"flex justify-end px-6 py-4 border-b border-border",children:a.jsx(ne,{size:"sm",onClick:R,disabled:i.isPending,children:i.isPending?"Saving…":"Save changes"})}),a.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/10",children:a.jsx("p",{className:"text-xs text-muted-foreground",children:"Connections"})}),a.jsx("div",{className:"px-4 md:px-6 py-3.5 border-b border-border",children:s?a.jsx(le,{className:"h-8 w-48"}):n!=null&&n.google_id?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(Mj,{className:"size-3.5 shrink-0"}),a.jsx("span",{className:"text-foreground font-medium",children:"Google"}),a.jsx(ta,{className:"size-3.5 text-emerald-500 shrink-0"}),a.jsx("span",{className:"text-foreground font-medium",children:"Connected"})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-sm text-muted-foreground truncate flex-1",children:n.email}),a.jsxs(ne,{size:"sm",className:"h-7 gap-1.5 bg-red-600 hover:bg-red-700 text-white shrink-0",onClick:$,disabled:c.isPending,children:[a.jsx(Jp,{className:"size-3.5"}),"Disconnect"]})]})]}):a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Mj,{className:"size-3.5 shrink-0"}),a.jsx("span",{className:"text-sm font-medium",children:"Google"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"Not connected"}),a.jsx(ne,{variant:"outline",size:"sm",className:"h-7 gap-1.5",onClick:U,children:"Connect"})]})}),a.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/10",children:a.jsx("p",{className:"text-xs text-muted-foreground",children:"Security"})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-4 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Password"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:(n==null?void 0:n.has_password)===!1?"No password set":"••••••••"}),a.jsxs(ne,{variant:"outline",size:"sm",className:"h-7 gap-1.5",onClick:()=>k(!0),children:[a.jsx(g5,{className:"size-3.5"}),(n==null?void 0:n.has_password)===!1?"Create password":"Change password"]})]})]}),a.jsx(Ua,{open:w,onOpenChange:se=>{se||Z()},children:a.jsxs(ca,{className:"sm:max-w-md",children:[a.jsxs(qa,{children:[a.jsx(Ha,{children:(n==null?void 0:n.has_password)===!1?"Create password":"Change password"}),a.jsxs(yo,{children:["We'll send a 6-digit verification code to ",a.jsx("span",{className:"font-medium text-foreground",children:n==null?void 0:n.email})]})]}),a.jsxs("div",{className:"space-y-4 py-2",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(mt,{className:"text-sm",children:"Verification code"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs(hP,{maxLength:6,value:_,onChange:S,children:[a.jsxs(Fp,{children:[a.jsx(Ls,{index:0}),a.jsx(Ls,{index:1}),a.jsx(Ls,{index:2})]}),a.jsx(pP,{}),a.jsxs(Fp,{children:[a.jsx(Ls,{index:3}),a.jsx(Ls,{index:4}),a.jsx(Ls,{index:5})]})]}),b?T>0?a.jsxs("span",{className:"text-xs text-muted-foreground shrink-0 tabular-nums w-16 text-center",children:["Resend in ",T,"s"]}):a.jsx(ne,{variant:"ghost",size:"sm",className:"h-8 shrink-0 text-indigo-500 hover:text-indigo-600",onClick:D,disabled:d.isPending,children:d.isPending?"Sending…":"Resend"}):a.jsx(ne,{variant:"outline",size:"sm",className:"h-8 shrink-0",onClick:D,disabled:d.isPending,children:d.isPending?"Sending…":"Send code"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(mt,{className:"text-sm",children:"New password"}),a.jsxs("div",{className:"relative",children:[a.jsx(Ee,{type:F?"text":"password",value:I,onChange:se=>A(se.target.value),className:"h-9 text-sm pr-9",placeholder:"At least 8 characters",autoComplete:"new-password"}),a.jsx("button",{type:"button",onClick:()=>X(!F),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,children:F?a.jsx(ec,{className:"size-3.5"}):a.jsx(wi,{className:"size-3.5"})})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(mt,{className:"text-sm",children:"Confirm password"}),a.jsx(Ee,{type:"password",value:O,onChange:se=>L(se.target.value),className:"h-9 text-sm",placeholder:"Re-enter new password",autoComplete:"new-password"})]})]}),a.jsxs(fx,{children:[a.jsx(ne,{variant:"ghost",size:"sm",onClick:Z,children:"Cancel"}),a.jsx(ne,{size:"sm",onClick:E,disabled:u.isPending||_.length!==6||!I||!O,children:u.isPending?"Saving…":(n==null?void 0:n.has_password)===!1?"Create password":"Update password"})]})]})})]})]})})}function ute(){const[e,t]=h.useState(""),[r,n]=h.useState(!1),s=sD(),i=o=>{o.preventDefault(),s.mutate({email:e},{onSuccess:()=>n(!0),onError:l=>H.error(l.message??"Something went wrong")})};return a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[360px]",children:[a.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[a.jsx("div",{className:"relative h-16 w-16 rounded-2xl bg-white dark:bg-card border border-border shadow-sm flex items-center justify-center",children:a.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:a.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:a.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})}),a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"text-lg font-semibold text-foreground",children:r?"Check your email":"Forgot password?"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:r?"If an account exists with that email, we've sent a reset link.":"Enter your email and we'll send you a reset link."})]})]}),r?a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-center text-muted-foreground",children:"Didn't receive an email? Check your spam folder or try again."}),a.jsx(ne,{variant:"outline",className:"w-full h-10",onClick:()=>{n(!1),t("")},children:"Try again"})]}):a.jsxs("form",{onSubmit:i,className:"space-y-2",children:[a.jsx(Ee,{type:"email",placeholder:"Email",value:e,onChange:o=>t(o.target.value),autoComplete:"email",required:!0,className:"bg-white dark:bg-card h-10",autoFocus:!0}),a.jsx("div",{className:"pt-1",children:a.jsx(ne,{type:"submit",className:"w-full h-10 font-medium",disabled:s.isPending,children:s.isPending?"Sending...":"Send reset link"})})]}),a.jsx("div",{className:"mt-6 text-center",children:a.jsxs(qr,{to:"/login",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(Jl,{className:"size-3.5"}),"Back to login"]})})]})})}function fte(){const[e]=Gl(),t=e.get("token")??"",r=pt(),n=iD(),[s,i]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState(!1),u=f=>{if(f.preventDefault(),s.length<8){H.error("Password must be at least 8 characters");return}if(s!==o){H.error("Passwords do not match");return}n.mutate({token:t,password:s},{onSuccess:()=>{H.success("Password has been reset. Please sign in."),r("/login",{replace:!0})},onError:m=>H.error(m.message??"Failed to reset password")})};return t?a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[360px]",children:[a.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[a.jsx("div",{className:"relative h-16 w-16 rounded-2xl bg-white dark:bg-card border border-border shadow-sm flex items-center justify-center",children:a.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:a.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:a.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})}),a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Set new password"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Enter your new password below."})]})]}),a.jsxs("form",{onSubmit:u,className:"space-y-2",children:[a.jsxs("div",{className:"relative",children:[a.jsx(Ee,{type:c?"text":"password",placeholder:"New password",value:s,onChange:f=>i(f.target.value),autoComplete:"new-password",required:!0,className:"bg-white dark:bg-card h-10 pr-10",autoFocus:!0}),a.jsx("button",{type:"button",onClick:()=>d(!c),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:c?a.jsx(ec,{className:"h-4 w-4"}):a.jsx(wi,{className:"h-4 w-4"})})]}),a.jsx(Ee,{type:"password",placeholder:"Confirm password",value:o,onChange:f=>l(f.target.value),autoComplete:"new-password",required:!0,className:"bg-white dark:bg-card h-10"}),a.jsx("div",{className:"pt-1",children:a.jsx(ne,{type:"submit",className:"w-full h-10 font-medium",disabled:n.isPending,children:n.isPending?"Resetting...":"Reset password"})})]}),a.jsx("div",{className:"mt-6 text-center",children:a.jsxs(qr,{to:"/login",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(Jl,{className:"size-3.5"}),"Back to login"]})})]})}):a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[360px] text-center space-y-4",children:[a.jsx("p",{className:"text-sm font-medium",children:"Invalid reset link"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"This link is missing or expired."}),a.jsx(qr,{to:"/forgot-password",children:a.jsx(ne,{variant:"outline",size:"sm",children:"Request a new link"})})]})})}const mte=h.lazy(()=>g1(()=>import("./ProjectTimelinePage-DkPzfr3R.js"),__vite__mapDeps([0,1,2,3,4,5])).then(e=>({default:e.ProjectTimelinePage}))),hte=h.lazy(()=>g1(()=>import("./WorkspaceReportingPage-_2-92Ufq.js"),__vite__mapDeps([6,1,2,3,4,5])).then(e=>({default:e.WorkspaceReportingPage})));function Ts({children:e}){const{isAuthenticated:t}=Ie();return t?a.jsx(a.Fragment,{children:e}):a.jsx(Xn,{to:"/login",replace:!0})}function pte({children:e}){var r;const{user:t}=Ie();return(r=t==null?void 0:t.roles)!=null&&r.includes("super-admin")?a.jsx(a.Fragment,{children:e}):a.jsx(Xn,{to:"/",replace:!0})}function Oj({children:e}){var s,i,o;const{user:t}=Ie(),r=((s=t==null?void 0:t.roles)==null?void 0:s.includes("super-admin"))||((i=t==null?void 0:t.roles)==null?void 0:i.includes("admin")),n=(o=t==null?void 0:t.permissions)==null?void 0:o.includes("workspace:admin");return r||n?a.jsx(a.Fragment,{children:e}):a.jsx(Xn,{to:"/",replace:!0})}function hd({children:e}){const{isAuthenticated:t}=Ie(),{data:r}=Bu(),n=Kl();return t?a.jsx(Xn,{to:"/",replace:!0}):r!=null&&r.needsSetup&&n.pathname==="/login"?a.jsx(Xn,{to:"/register",replace:!0}):r&&!r.needsSetup&&n.pathname==="/register"?a.jsx(Xn,{to:"/login",replace:!0}):a.jsx(a.Fragment,{children:e})}function xte(){const{workspace:e,setWorkspace:t,user:r}=Ie(),n=pt(),{data:s,isLoading:i}=xo();return h.useEffect(()=>{var o,l;if(!i&&s!==void 0){if(e){if(s.some(d=>d.id===e.id)){n(`/${e.slug}/projects`,{replace:!0});return}t(null)}if(s.length>0){const c=s[0];t({id:c.id,name:c.name,slug:c.slug}),n(`/${c.slug}/projects`,{replace:!0})}else{const c=((o=r==null?void 0:r.roles)==null?void 0:o.includes("super-admin"))||((l=r==null?void 0:r.roles)==null?void 0:l.includes("admin"));n(c?"/setup":"/awaiting-access",{replace:!0})}}},[s,i,n,t,r,e]),a.jsx("div",{className:"min-h-screen flex items-center justify-center",children:a.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})})}function gte(){const{workspace:e}=zt(),{workspace:t,setWorkspace:r,user:n}=Ie();dD();const s=pt(),{data:i,isLoading:o,isFetching:l}=xo();return h.useEffect(()=>{var d,u;if(o||!i)return;const c=i.find(f=>f.slug===e);if(c)c.id!==(t==null?void 0:t.id)&&r({id:c.id,name:c.name,slug:c.slug});else{if(l)return;if(i.length>0)r({id:i[0].id,name:i[0].name,slug:i[0].slug}),s(`/${i[0].slug}/projects`,{replace:!0});else{r(null);const f=((d=n==null?void 0:n.roles)==null?void 0:d.includes("super-admin"))||((u=n==null?void 0:n.roles)==null?void 0:u.includes("admin"));s(f?"/setup":"/awaiting-access",{replace:!0})}}},[i,e,o,l,t==null?void 0:t.id,s,r,n]),o||!t||t.slug!==e?a.jsx("div",{className:"min-h-screen flex items-center justify-center",children:a.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})}):a.jsxs(a.Fragment,{children:[a.jsx(HD,{}),a.jsx(OT,{})]})}function vte(){return a.jsxs(kP,{children:[a.jsx(Ye,{path:"/login",element:a.jsx(hd,{children:a.jsx(ET,{})})}),a.jsx(Ye,{path:"/register",element:a.jsx(hd,{children:a.jsx(AT,{})})}),a.jsx(Ye,{path:"/forgot-password",element:a.jsx(hd,{children:a.jsx(ute,{})})}),a.jsx(Ye,{path:"/reset-password",element:a.jsx(hd,{children:a.jsx(fte,{})})}),a.jsx(Ye,{path:"/invite/:token",element:a.jsx(bz,{})}),a.jsx(Ye,{path:"/oauth/google/callback",element:a.jsx(Xee,{})}),a.jsx(Ye,{path:"/share/:token",element:a.jsx(Gee,{})}),a.jsx(Ye,{path:"/reporting",element:a.jsx(Ts,{children:a.jsx(Oj,{children:a.jsx(QD,{})})}),children:a.jsx(Ye,{index:!0,element:a.jsx(xZ,{})})}),a.jsx(Ye,{path:"/org/settings",element:a.jsx(Ts,{children:a.jsx(Oj,{children:a.jsx(eT,{})})}),children:a.jsx(Ye,{index:!0,element:a.jsx(IZ,{})})}),a.jsx(Ye,{path:"/profile",element:a.jsx(Ts,{children:a.jsx(nT,{})}),children:a.jsx(Ye,{index:!0,element:a.jsx(dte,{})})}),a.jsx(Ye,{path:"/setup",element:a.jsx(Ts,{children:a.jsx(DT,{})})}),a.jsx(Ye,{path:"/awaiting-access",element:a.jsx(Ts,{children:a.jsx(TT,{})})}),a.jsx(Ye,{index:!0,element:a.jsx(Ts,{children:a.jsx(xte,{})})}),a.jsxs(Ye,{path:"/:workspace",element:a.jsx(Ts,{children:a.jsx(gte,{})}),children:[a.jsx(Ye,{index:!0,element:a.jsx(Xn,{to:"projects",replace:!0})}),a.jsx(Ye,{path:"projects",element:a.jsx(WI,{})}),a.jsxs(Ye,{path:"projects/:projectKey",element:a.jsx(GD,{}),children:[a.jsx(Ye,{path:"board",element:a.jsx(h6,{})}),a.jsx(Ye,{path:"issues",element:a.jsx(p6,{})}),a.jsx(Ye,{path:"issues/new",element:a.jsx(q6,{})}),a.jsx(Ye,{path:"issues/:issueId",element:a.jsx(L6,{})}),a.jsx(Ye,{path:"sprints",element:a.jsx(az,{})}),a.jsx(Ye,{path:"timeline",element:a.jsx(h.Suspense,{fallback:a.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading…"}),children:a.jsx(mte,{})})}),a.jsx(Ye,{path:"access",element:a.jsx(I6,{})}),a.jsx(Ye,{path:"reports",element:a.jsx(gZ,{})}),a.jsx(Ye,{path:"activity",element:a.jsx(wZ,{})})]}),a.jsx(Ye,{path:"my-tasks",element:a.jsx(Z6,{})}),a.jsx(Ye,{path:"notifications",element:a.jsx(ez,{})}),a.jsx(Ye,{path:"reporting",element:a.jsx(h.Suspense,{fallback:a.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading…"}),children:a.jsx(hte,{})})}),a.jsx(Ye,{path:"settings",element:a.jsx(pz,{})}),a.jsx(Ye,{path:"roles",element:a.jsx(pte,{children:a.jsx(vz,{})})})]}),a.jsx(Ye,{path:"*",element:a.jsx(Xn,{to:"/",replace:!0})})]})}window.__React=W;window.__ReactJsxRuntime=yP;const yte=new bP({defaultOptions:{queries:{staleTime:1e3*30,retry:1}}});(async()=>{let e=[];try{const r=await import("/admin-extensions.js");Array.isArray(r==null?void 0:r.default)&&(e=r.default)}catch{}x1(document.getElementById("root")).render(a.jsx(h.StrictMode,{children:a.jsx(ZA,{widgets:[...B5,...e],children:a.jsx(gA,{children:a.jsxs(wP,{client:yte,children:[a.jsx(vA,{children:a.jsx(yA,{children:a.jsx(SP,{children:a.jsxs(Iu,{delayDuration:300,children:[a.jsx(vte,{}),a.jsx(iA,{position:"bottom-right",toastOptions:{classNames:{toast:"bg-white dark:bg-card border border-border text-foreground text-sm rounded-lg shadow-sm",description:"text-muted-foreground"}}})]})})})}),a.jsx(DE,{initialIsOpen:!1})]})})})}))})();export{Ie as A,ne as B,of as C,tx as D,Fee as G,Ek as I,dt as P,xZ as R,Cr as W,g1 as _,Ur as a,Wa as b,Mh as c,Ql as d,ko as e,fe as f,So as g,kx as h,y4 as i,Sx as j,ks as k,Iee as l,gh as m,xh as n,Bee as o,Dee as p,Lee as q,vh as r,WN as s,Cj as t,iN as u,iP as v,Wee as w,H as x,Tt as y,oe as z};
630
+ }`;const hP=h.forwardRef(({className:e,containerClassName:t,...r},n)=>a.jsx(mP,{ref:n,containerClassName:z("flex items-center gap-2 has-[:disabled]:opacity-50",t),className:z("disabled:cursor-not-allowed",e),...r}));hP.displayName="InputOTP";const Fp=h.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:z("flex items-center",e),...t}));Fp.displayName="InputOTPGroup";const Ls=h.forwardRef(({index:e,className:t,...r},n)=>{const s=h.useContext(fP),{char:i,hasFakeCaret:o,isActive:l}=s.slots[e];return a.jsxs("div",{ref:n,className:z("relative flex h-10 w-10 items-center justify-center border-y border-r border-input text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md",l&&"z-10 ring-2 ring-ring ring-offset-background",t),...r,children:[i,o&&a.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:a.jsx("div",{className:"h-4 w-px animate-caret-blink bg-foreground duration-1000"})})]})});Ls.displayName="InputOTPSlot";const pP=h.forwardRef(({...e},t)=>a.jsx("div",{ref:t,role:"separator",...e,children:a.jsx(Ba,{})}));pP.displayName="InputOTPSeparator";function Mj({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 dte(){var B,Y,ae,ee;const[e,t]=Gl(),{user:r}=Ie(),{data:n,isLoading:s}=bO(),i=jZ(),o=NZ(),l=kZ(),c=_Z(),d=SZ(),u=CZ(),f=h.useRef(null),[m,p]=h.useState(""),[x,g]=h.useState(""),[v,y]=h.useState(""),[j,N]=h.useState(""),[w,k]=h.useState(!1),[b,C]=h.useState(!1),[_,S]=h.useState(""),[I,A]=h.useState(""),[O,L]=h.useState(""),[F,X]=h.useState(!1),[T,G]=h.useState(0),re=h.useRef(null);h.useEffect(()=>{n&&(p(n.first_name??""),g(n.last_name??""),y(n.designation??""),N(n.phone_number??""))},[n]),h.useEffect(()=>{e.get("linked")==="true"&&(H.success("Google account connected successfully"),t(se=>(se.delete("linked"),se),{replace:!0}))},[e,t]);const J=r&&(`${((B=r.first_name)==null?void 0:B[0])??""}${((Y=r.last_name)==null?void 0:Y[0])??""}`.toUpperCase()||((ee=(ae=r.email)==null?void 0:ae[0])==null?void 0:ee.toUpperCase()))||"?",P=se=>{var ie;const V=(ie=se.target.files)==null?void 0:ie[0];V&&(o.mutate(V,{onSuccess:()=>H.success("Avatar updated"),onError:pe=>H.error(pe.message??"Failed to upload avatar")}),se.target.value="")},M=()=>{l.mutate(void 0,{onSuccess:()=>H.success("Avatar removed"),onError:se=>H.error(se.message??"Failed to remove avatar")})},R=()=>{i.mutate({first_name:m,last_name:x,designation:v||null,phone_number:j||null},{onSuccess:()=>H.success("Profile updated"),onError:se=>H.error(se.message??"Failed to update profile")})},U=()=>{const se=localStorage.getItem("meridian_token");if(!se){H.error("You must be logged in to connect Google");return}window.location.href=`${Gi}/auth/google/link?token=${encodeURIComponent(se)}`},$=()=>{c.mutate(void 0,{onSuccess:()=>H.success("Google account disconnected"),onError:se=>H.error(se.message??"Failed to unlink Google account")})},K=h.useCallback(()=>{G(30),re.current&&clearInterval(re.current),re.current=setInterval(()=>{G(se=>se<=1?(re.current&&clearInterval(re.current),0):se-1)},1e3)},[]);h.useEffect(()=>()=>{re.current&&clearInterval(re.current)},[]);const D=()=>{d.mutate(void 0,{onSuccess:()=>{C(!0),K(),H.success("Verification code sent to your email")},onError:se=>H.error(se.message??"Failed to send verification code")})},E=()=>{if(I.length<8){H.error("New password must be at least 8 characters");return}if(I!==O){H.error("Passwords do not match");return}u.mutate({otp:_,new_password:I},{onSuccess:()=>{H.success("Password updated"),Z()},onError:se=>H.error(se.message??"Failed to set password")})},Z=()=>{k(!1),C(!1),S(""),A(""),L(""),X(!1),G(0),re.current&&clearInterval(re.current)};return a.jsx("div",{className:"p-2 md:h-full",children:a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden flex flex-col md:h-full",children:[a.jsx("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border shrink-0",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(tc,{className:"h-5 w-5 text-muted-foreground"}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-base font-semibold",children:"Profile"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Manage your personal details and account connections."})]})]})}),a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between px-4 md:px-6 py-4 border-b border-border gap-3",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Profile photo"}),a.jsxs("div",{className:"flex flex-1 items-center gap-4",children:[a.jsxs("div",{className:"relative",children:[a.jsxs(Rt,{className:"h-14 w-14 rounded-xl",children:[n!=null&&n.avatar_url?a.jsx(wl,{src:n.avatar_url,alt:"Avatar",className:"object-cover"}):null,a.jsx($t,{className:"rounded-xl bg-foreground text-background text-base font-medium",children:J})]}),o.isPending&&a.jsx("div",{className:"absolute inset-0 rounded-xl bg-black/40 flex items-center justify-center",children:a.jsx("span",{className:"text-white text-[10px]",children:"…"})})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ne,{variant:"outline",size:"sm",className:"h-8 gap-1.5",onClick:()=>{var se;return(se=f.current)==null?void 0:se.click()},disabled:o.isPending,children:[a.jsx(i5,{className:"size-3.5"}),"Change photo"]}),(n==null?void 0:n.avatar_url)&&a.jsxs(ne,{variant:"ghost",size:"sm",className:"h-8 gap-1.5 text-muted-foreground hover:text-destructive",onClick:M,disabled:l.isPending,children:[a.jsx(Mr,{className:"size-3.5"}),"Remove"]})]}),a.jsx("input",{ref:f,type:"file",accept:"image/*",className:"hidden",onChange:P})]})]}),a.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/10",children:a.jsx("p",{className:"text-xs text-muted-foreground",children:"Personal information"})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"First name"}),s?a.jsx(le,{className:"h-8 w-56"}):a.jsx(Ee,{value:m,onChange:se=>p(se.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"First name"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Last name"}),s?a.jsx(le,{className:"h-8 w-56"}):a.jsx(Ee,{value:x,onChange:se=>g(se.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"Last name"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Email"}),s?a.jsx(le,{className:"h-4 w-48"}):a.jsx("span",{className:"text-sm text-muted-foreground",children:(n==null?void 0:n.email)??"—"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Designation"}),s?a.jsx(le,{className:"h-8 w-56"}):a.jsx(Ee,{value:v,onChange:se=>y(se.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"e.g. Software Engineer"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Phone number"}),s?a.jsx(le,{className:"h-8 w-56"}):a.jsx(Ee,{value:j,onChange:se=>N(se.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"+1 555 000 0000"})]}),a.jsx("div",{className:"flex justify-end px-6 py-4 border-b border-border",children:a.jsx(ne,{size:"sm",onClick:R,disabled:i.isPending,children:i.isPending?"Saving…":"Save changes"})}),a.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/10",children:a.jsx("p",{className:"text-xs text-muted-foreground",children:"Connections"})}),a.jsx("div",{className:"px-4 md:px-6 py-3.5 border-b border-border",children:s?a.jsx(le,{className:"h-8 w-48"}):n!=null&&n.google_id?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(Mj,{className:"size-3.5 shrink-0"}),a.jsx("span",{className:"text-foreground font-medium",children:"Google"}),a.jsx(ta,{className:"size-3.5 text-emerald-500 shrink-0"}),a.jsx("span",{className:"text-foreground font-medium",children:"Connected"})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-sm text-muted-foreground truncate flex-1",children:n.email}),a.jsxs(ne,{size:"sm",className:"h-7 gap-1.5 bg-red-600 hover:bg-red-700 text-white shrink-0",onClick:$,disabled:c.isPending,children:[a.jsx(Jp,{className:"size-3.5"}),"Disconnect"]})]})]}):a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Mj,{className:"size-3.5 shrink-0"}),a.jsx("span",{className:"text-sm font-medium",children:"Google"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"Not connected"}),a.jsx(ne,{variant:"outline",size:"sm",className:"h-7 gap-1.5",onClick:U,children:"Connect"})]})}),a.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/10",children:a.jsx("p",{className:"text-xs text-muted-foreground",children:"Security"})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-4 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Password"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:(n==null?void 0:n.has_password)===!1?"No password set":"••••••••"}),a.jsxs(ne,{variant:"outline",size:"sm",className:"h-7 gap-1.5",onClick:()=>k(!0),children:[a.jsx(g5,{className:"size-3.5"}),(n==null?void 0:n.has_password)===!1?"Create password":"Change password"]})]})]}),a.jsx(Ua,{open:w,onOpenChange:se=>{se||Z()},children:a.jsxs(ca,{className:"sm:max-w-md",children:[a.jsxs(qa,{children:[a.jsx(Ha,{children:(n==null?void 0:n.has_password)===!1?"Create password":"Change password"}),a.jsxs(yo,{children:["We'll send a 6-digit verification code to ",a.jsx("span",{className:"font-medium text-foreground",children:n==null?void 0:n.email})]})]}),a.jsxs("div",{className:"space-y-4 py-2",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(mt,{className:"text-sm",children:"Verification code"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs(hP,{maxLength:6,value:_,onChange:S,children:[a.jsxs(Fp,{children:[a.jsx(Ls,{index:0}),a.jsx(Ls,{index:1}),a.jsx(Ls,{index:2})]}),a.jsx(pP,{}),a.jsxs(Fp,{children:[a.jsx(Ls,{index:3}),a.jsx(Ls,{index:4}),a.jsx(Ls,{index:5})]})]}),b?T>0?a.jsxs("span",{className:"text-xs text-muted-foreground shrink-0 tabular-nums w-16 text-center",children:["Resend in ",T,"s"]}):a.jsx(ne,{variant:"ghost",size:"sm",className:"h-8 shrink-0 text-indigo-500 hover:text-indigo-600",onClick:D,disabled:d.isPending,children:d.isPending?"Sending…":"Resend"}):a.jsx(ne,{variant:"outline",size:"sm",className:"h-8 shrink-0",onClick:D,disabled:d.isPending,children:d.isPending?"Sending…":"Send code"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(mt,{className:"text-sm",children:"New password"}),a.jsxs("div",{className:"relative",children:[a.jsx(Ee,{type:F?"text":"password",value:I,onChange:se=>A(se.target.value),className:"h-9 text-sm pr-9",placeholder:"At least 8 characters",autoComplete:"new-password"}),a.jsx("button",{type:"button",onClick:()=>X(!F),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,children:F?a.jsx(ec,{className:"size-3.5"}):a.jsx(wi,{className:"size-3.5"})})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(mt,{className:"text-sm",children:"Confirm password"}),a.jsx(Ee,{type:"password",value:O,onChange:se=>L(se.target.value),className:"h-9 text-sm",placeholder:"Re-enter new password",autoComplete:"new-password"})]})]}),a.jsxs(fx,{children:[a.jsx(ne,{variant:"ghost",size:"sm",onClick:Z,children:"Cancel"}),a.jsx(ne,{size:"sm",onClick:E,disabled:u.isPending||_.length!==6||!I||!O,children:u.isPending?"Saving…":(n==null?void 0:n.has_password)===!1?"Create password":"Update password"})]})]})})]})]})})}function ute(){const[e,t]=h.useState(""),[r,n]=h.useState(!1),s=sD(),i=o=>{o.preventDefault(),s.mutate({email:e},{onSuccess:()=>n(!0),onError:l=>H.error(l.message??"Something went wrong")})};return a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[360px]",children:[a.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[a.jsx("div",{className:"relative h-16 w-16 rounded-2xl bg-white dark:bg-card border border-border shadow-sm flex items-center justify-center",children:a.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:a.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:a.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})}),a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"text-lg font-semibold text-foreground",children:r?"Check your email":"Forgot password?"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:r?"If an account exists with that email, we've sent a reset link.":"Enter your email and we'll send you a reset link."})]})]}),r?a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-center text-muted-foreground",children:"Didn't receive an email? Check your spam folder or try again."}),a.jsx(ne,{variant:"outline",className:"w-full h-10",onClick:()=>{n(!1),t("")},children:"Try again"})]}):a.jsxs("form",{onSubmit:i,className:"space-y-2",children:[a.jsx(Ee,{type:"email",placeholder:"Email",value:e,onChange:o=>t(o.target.value),autoComplete:"email",required:!0,className:"bg-white dark:bg-card h-10",autoFocus:!0}),a.jsx("div",{className:"pt-1",children:a.jsx(ne,{type:"submit",className:"w-full h-10 font-medium",disabled:s.isPending,children:s.isPending?"Sending...":"Send reset link"})})]}),a.jsx("div",{className:"mt-6 text-center",children:a.jsxs(qr,{to:"/login",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(Jl,{className:"size-3.5"}),"Back to login"]})})]})})}function fte(){const[e]=Gl(),t=e.get("token")??"",r=pt(),n=iD(),[s,i]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState(!1),u=f=>{if(f.preventDefault(),s.length<8){H.error("Password must be at least 8 characters");return}if(s!==o){H.error("Passwords do not match");return}n.mutate({token:t,password:s},{onSuccess:()=>{H.success("Password has been reset. Please sign in."),r("/login",{replace:!0})},onError:m=>H.error(m.message??"Failed to reset password")})};return t?a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[360px]",children:[a.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[a.jsx("div",{className:"relative h-16 w-16 rounded-2xl bg-white dark:bg-card border border-border shadow-sm flex items-center justify-center",children:a.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:a.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:a.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})}),a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Set new password"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Enter your new password below."})]})]}),a.jsxs("form",{onSubmit:u,className:"space-y-2",children:[a.jsxs("div",{className:"relative",children:[a.jsx(Ee,{type:c?"text":"password",placeholder:"New password",value:s,onChange:f=>i(f.target.value),autoComplete:"new-password",required:!0,className:"bg-white dark:bg-card h-10 pr-10",autoFocus:!0}),a.jsx("button",{type:"button",onClick:()=>d(!c),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:c?a.jsx(ec,{className:"h-4 w-4"}):a.jsx(wi,{className:"h-4 w-4"})})]}),a.jsx(Ee,{type:"password",placeholder:"Confirm password",value:o,onChange:f=>l(f.target.value),autoComplete:"new-password",required:!0,className:"bg-white dark:bg-card h-10"}),a.jsx("div",{className:"pt-1",children:a.jsx(ne,{type:"submit",className:"w-full h-10 font-medium",disabled:n.isPending,children:n.isPending?"Resetting...":"Reset password"})})]}),a.jsx("div",{className:"mt-6 text-center",children:a.jsxs(qr,{to:"/login",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(Jl,{className:"size-3.5"}),"Back to login"]})})]})}):a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[360px] text-center space-y-4",children:[a.jsx("p",{className:"text-sm font-medium",children:"Invalid reset link"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"This link is missing or expired."}),a.jsx(qr,{to:"/forgot-password",children:a.jsx(ne,{variant:"outline",size:"sm",children:"Request a new link"})})]})})}const mte=h.lazy(()=>g1(()=>import("./ProjectTimelinePage-DXUS6oUP.js"),__vite__mapDeps([0,1,2,3,4,5])).then(e=>({default:e.ProjectTimelinePage}))),hte=h.lazy(()=>g1(()=>import("./WorkspaceReportingPage-6VlVrdNu.js"),__vite__mapDeps([6,1,2,3,4,5])).then(e=>({default:e.WorkspaceReportingPage})));function Ts({children:e}){const{isAuthenticated:t}=Ie();return t?a.jsx(a.Fragment,{children:e}):a.jsx(Xn,{to:"/login",replace:!0})}function pte({children:e}){var r;const{user:t}=Ie();return(r=t==null?void 0:t.roles)!=null&&r.includes("super-admin")?a.jsx(a.Fragment,{children:e}):a.jsx(Xn,{to:"/",replace:!0})}function Oj({children:e}){var s,i,o;const{user:t}=Ie(),r=((s=t==null?void 0:t.roles)==null?void 0:s.includes("super-admin"))||((i=t==null?void 0:t.roles)==null?void 0:i.includes("admin")),n=(o=t==null?void 0:t.permissions)==null?void 0:o.includes("workspace:admin");return r||n?a.jsx(a.Fragment,{children:e}):a.jsx(Xn,{to:"/",replace:!0})}function hd({children:e}){const{isAuthenticated:t}=Ie(),{data:r}=Bu(),n=Kl();return t?a.jsx(Xn,{to:"/",replace:!0}):r!=null&&r.needsSetup&&n.pathname==="/login"?a.jsx(Xn,{to:"/register",replace:!0}):r&&!r.needsSetup&&n.pathname==="/register"?a.jsx(Xn,{to:"/login",replace:!0}):a.jsx(a.Fragment,{children:e})}function xte(){const{workspace:e,setWorkspace:t,user:r}=Ie(),n=pt(),{data:s,isLoading:i}=xo();return h.useEffect(()=>{var o,l;if(!i&&s!==void 0){if(e){if(s.some(d=>d.id===e.id)){n(`/${e.slug}/projects`,{replace:!0});return}t(null)}if(s.length>0){const c=s[0];t({id:c.id,name:c.name,slug:c.slug}),n(`/${c.slug}/projects`,{replace:!0})}else{const c=((o=r==null?void 0:r.roles)==null?void 0:o.includes("super-admin"))||((l=r==null?void 0:r.roles)==null?void 0:l.includes("admin"));n(c?"/setup":"/awaiting-access",{replace:!0})}}},[s,i,n,t,r,e]),a.jsx("div",{className:"min-h-screen flex items-center justify-center",children:a.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})})}function gte(){const{workspace:e}=zt(),{workspace:t,setWorkspace:r,user:n}=Ie();dD();const s=pt(),{data:i,isLoading:o,isFetching:l}=xo();return h.useEffect(()=>{var d,u;if(o||!i)return;const c=i.find(f=>f.slug===e);if(c)c.id!==(t==null?void 0:t.id)&&r({id:c.id,name:c.name,slug:c.slug});else{if(l)return;if(i.length>0)r({id:i[0].id,name:i[0].name,slug:i[0].slug}),s(`/${i[0].slug}/projects`,{replace:!0});else{r(null);const f=((d=n==null?void 0:n.roles)==null?void 0:d.includes("super-admin"))||((u=n==null?void 0:n.roles)==null?void 0:u.includes("admin"));s(f?"/setup":"/awaiting-access",{replace:!0})}}},[i,e,o,l,t==null?void 0:t.id,s,r,n]),o||!t||t.slug!==e?a.jsx("div",{className:"min-h-screen flex items-center justify-center",children:a.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})}):a.jsxs(a.Fragment,{children:[a.jsx(HD,{}),a.jsx(OT,{})]})}function vte(){return a.jsxs(kP,{children:[a.jsx(Ye,{path:"/login",element:a.jsx(hd,{children:a.jsx(ET,{})})}),a.jsx(Ye,{path:"/register",element:a.jsx(hd,{children:a.jsx(AT,{})})}),a.jsx(Ye,{path:"/forgot-password",element:a.jsx(hd,{children:a.jsx(ute,{})})}),a.jsx(Ye,{path:"/reset-password",element:a.jsx(hd,{children:a.jsx(fte,{})})}),a.jsx(Ye,{path:"/invite/:token",element:a.jsx(bz,{})}),a.jsx(Ye,{path:"/oauth/google/callback",element:a.jsx(Xee,{})}),a.jsx(Ye,{path:"/share/:token",element:a.jsx(Gee,{})}),a.jsx(Ye,{path:"/reporting",element:a.jsx(Ts,{children:a.jsx(Oj,{children:a.jsx(QD,{})})}),children:a.jsx(Ye,{index:!0,element:a.jsx(xZ,{})})}),a.jsx(Ye,{path:"/org/settings",element:a.jsx(Ts,{children:a.jsx(Oj,{children:a.jsx(eT,{})})}),children:a.jsx(Ye,{index:!0,element:a.jsx(IZ,{})})}),a.jsx(Ye,{path:"/profile",element:a.jsx(Ts,{children:a.jsx(nT,{})}),children:a.jsx(Ye,{index:!0,element:a.jsx(dte,{})})}),a.jsx(Ye,{path:"/setup",element:a.jsx(Ts,{children:a.jsx(DT,{})})}),a.jsx(Ye,{path:"/awaiting-access",element:a.jsx(Ts,{children:a.jsx(TT,{})})}),a.jsx(Ye,{index:!0,element:a.jsx(Ts,{children:a.jsx(xte,{})})}),a.jsxs(Ye,{path:"/:workspace",element:a.jsx(Ts,{children:a.jsx(gte,{})}),children:[a.jsx(Ye,{index:!0,element:a.jsx(Xn,{to:"projects",replace:!0})}),a.jsx(Ye,{path:"projects",element:a.jsx(WI,{})}),a.jsxs(Ye,{path:"projects/:projectKey",element:a.jsx(GD,{}),children:[a.jsx(Ye,{path:"board",element:a.jsx(h6,{})}),a.jsx(Ye,{path:"issues",element:a.jsx(p6,{})}),a.jsx(Ye,{path:"issues/new",element:a.jsx(q6,{})}),a.jsx(Ye,{path:"issues/:issueId",element:a.jsx(L6,{})}),a.jsx(Ye,{path:"sprints",element:a.jsx(az,{})}),a.jsx(Ye,{path:"timeline",element:a.jsx(h.Suspense,{fallback:a.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading…"}),children:a.jsx(mte,{})})}),a.jsx(Ye,{path:"access",element:a.jsx(I6,{})}),a.jsx(Ye,{path:"reports",element:a.jsx(gZ,{})}),a.jsx(Ye,{path:"activity",element:a.jsx(wZ,{})})]}),a.jsx(Ye,{path:"my-tasks",element:a.jsx(Z6,{})}),a.jsx(Ye,{path:"notifications",element:a.jsx(ez,{})}),a.jsx(Ye,{path:"reporting",element:a.jsx(h.Suspense,{fallback:a.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading…"}),children:a.jsx(hte,{})})}),a.jsx(Ye,{path:"settings",element:a.jsx(pz,{})}),a.jsx(Ye,{path:"roles",element:a.jsx(pte,{children:a.jsx(vz,{})})})]}),a.jsx(Ye,{path:"*",element:a.jsx(Xn,{to:"/",replace:!0})})]})}window.__React=W;window.__ReactJsxRuntime=yP;const yte=new bP({defaultOptions:{queries:{staleTime:1e3*30,retry:1}}});(async()=>{let e=[];try{const r=await import("/admin-extensions.js");Array.isArray(r==null?void 0:r.default)&&(e=r.default)}catch{}x1(document.getElementById("root")).render(a.jsx(h.StrictMode,{children:a.jsx(ZA,{widgets:[...B5,...e],children:a.jsx(gA,{children:a.jsxs(wP,{client:yte,children:[a.jsx(vA,{children:a.jsx(yA,{children:a.jsx(SP,{children:a.jsxs(Iu,{delayDuration:300,children:[a.jsx(vte,{}),a.jsx(iA,{position:"bottom-right",toastOptions:{classNames:{toast:"bg-white dark:bg-card border border-border text-foreground text-sm rounded-lg shadow-sm",description:"text-muted-foreground"}}})]})})})}),a.jsx(DE,{initialIsOpen:!1})]})})})}))})();export{Ie as A,ne as B,of as C,tx as D,Fee as G,Ek as I,dt as P,xZ as R,Cr as W,g1 as _,Ur as a,Wa as b,Mh as c,Ql as d,ko as e,fe as f,So as g,kx as h,y4 as i,Sx as j,ks as k,Iee as l,gh as m,xh as n,Bee as o,Dee as p,Lee as q,vh as r,WN as s,Cj as t,iN as u,iP as v,Wee as w,H as x,Tt as y,oe as z};