@meridianjs/admin-dashboard 0.1.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.
@@ -0,0 +1,399 @@
1
+ import{j as t,u as ke,a as ye,b as Ie,Q as Ll,c as Vl}from"./vendor-query-BxDNdxq_.js";import{a as Ul,c as y,r as h,b as Kl,u as et,d as oo,N as Qn,e as Ge,L as $r,O as io,f as Gl,g as qe,h as Es,B as Ql}from"./vendor-react-CfHM_tz4.js";import{C as lo,R as Xl,T as Jl,P as Zl,S as Rr,a as co,O as En,b as Ts,c as _n,d as Ar,e as ss,D as rs,f as Ps,g as uo,h as mo,i as ed,j as fo,I as ho,k as xo,l as po,m as go,L as bo,n as yo,o as td,p as nd,q as vo,r as wo,F as jo,u as kn,t as qt,s as sd,v as No,w as ko,x as rd,y as So,z as Co,A as ad,B as Mo,V as od,E as Do,G as Oo,H as id,J as ld,K as Eo,M as dd,N as cd,Q as ud,U as _o,W as md,X as fd,Y as To,Z as hd,_ as xd,$ as Po,a0 as pd}from"./vendor-radix-DmippTD7.js";import{u as Io,a as $o,D as Ro,S as Wr,h as Ao,b as Ds,P as Wo,c as zr,C as Fr,d as gd,v as bd,e as yd,f as vd}from"./vendor-dnd-dQurpOJF.js";import{E as wd,u as zo,i as Fo,a as Bo,b as qo,c as Yo,d as jd,e as Nd}from"./vendor-editor-DYN2JaBa.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function s(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(a){if(a.ep)return;a.ep=!0;const o=s(a);fetch(a.href,o)}})();var Ho,ja=Ul;Ho=ja.createRoot,ja.hydrateRoot;var kd=function(){return null},Sd=e=>{switch(e){case"success":return Dd;case"info":return Ed;case"warning":return Od;case"error":return _d;default:return null}},Cd=Array(12).fill(0),Md=({visible:e,className:n})=>y.createElement("div",{className:["sonner-loading-wrapper",n].filter(Boolean).join(" "),"data-visible":e},y.createElement("div",{className:"sonner-spinner"},Cd.map((s,r)=>y.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),Dd=y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},y.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"})),Od=y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},y.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"})),Ed=y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},y.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"})),_d=y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},y.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"})),Td=y.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"},y.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),y.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Pd=()=>{let[e,n]=y.useState(document.hidden);return y.useEffect(()=>{let s=()=>{n(document.hidden)};return document.addEventListener("visibilitychange",s),()=>window.removeEventListener("visibilitychange",s)},[]),e},Mr=1,Id=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let n=this.subscribers.indexOf(e);this.subscribers.splice(n,1)}),this.publish=e=>{this.subscribers.forEach(n=>n(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var n;let{message:s,...r}=e,a=typeof(e==null?void 0:e.id)=="number"||((n=e.id)==null?void 0:n.length)>0?e.id:Mr++,o=this.toasts.find(l=>l.id===a),i=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),o?this.toasts=this.toasts.map(l=>l.id===a?(this.publish({...l,...e,id:a,title:s}),{...l,...e,id:a,dismissible:i,title:s}):l):this.addToast({title:s,...r,dismissible:i,id:a}),a},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(n=>{this.subscribers.forEach(s=>s({id:n.id,dismiss:!0}))}),this.subscribers.forEach(n=>n({id:e,dismiss:!0})),e),this.message=(e,n)=>this.create({...n,message:e}),this.error=(e,n)=>this.create({...n,message:e,type:"error"}),this.success=(e,n)=>this.create({...n,type:"success",message:e}),this.info=(e,n)=>this.create({...n,type:"info",message:e}),this.warning=(e,n)=>this.create({...n,type:"warning",message:e}),this.loading=(e,n)=>this.create({...n,type:"loading",message:e}),this.promise=(e,n)=>{if(!n)return;let s;n.loading!==void 0&&(s=this.create({...n,promise:e,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));let r=e instanceof Promise?e:e(),a=s!==void 0,o,i=r.then(async d=>{if(o=["resolve",d],y.isValidElement(d))a=!1,this.create({id:s,type:"default",message:d});else if(Rd(d)&&!d.ok){a=!1;let c=typeof n.error=="function"?await n.error(`HTTP error! status: ${d.status}`):n.error,u=typeof n.description=="function"?await n.description(`HTTP error! status: ${d.status}`):n.description;this.create({id:s,type:"error",message:c,description:u})}else if(n.success!==void 0){a=!1;let c=typeof n.success=="function"?await n.success(d):n.success,u=typeof n.description=="function"?await n.description(d):n.description;this.create({id:s,type:"success",message:c,description:u})}}).catch(async d=>{if(o=["reject",d],n.error!==void 0){a=!1;let c=typeof n.error=="function"?await n.error(d):n.error,u=typeof n.description=="function"?await n.description(d):n.description;this.create({id:s,type:"error",message:c,description:u})}}).finally(()=>{var d;a&&(this.dismiss(s),s=void 0),(d=n.finally)==null||d.call(n)}),l=()=>new Promise((d,c)=>i.then(()=>o[0]==="reject"?c(o[1]):d(o[1])).catch(c));return typeof s!="string"&&typeof s!="number"?{unwrap:l}:Object.assign(s,{unwrap:l})},this.custom=(e,n)=>{let s=(n==null?void 0:n.id)||Mr++;return this.create({jsx:e(s),id:s,...n}),s},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Le=new Id,$d=(e,n)=>{let s=(n==null?void 0:n.id)||Mr++;return Le.addToast({title:e,...n,id:s}),s},Rd=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Ad=$d,Wd=()=>Le.toasts,zd=()=>Le.getActiveToasts(),Q=Object.assign(Ad,{success:Le.success,info:Le.info,warning:Le.warning,error:Le.error,custom:Le.custom,message:Le.message,promise:Le.promise,dismiss:Le.dismiss,loading:Le.loading},{getHistory:Wd,getToasts:zd});function Fd(e,{insertAt:n}={}){if(typeof document>"u")return;let s=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",n==="top"&&s.firstChild?s.insertBefore(r,s.firstChild):s.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}Fd(`: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%)}
2
+ `);function Ns(e){return e.label!==void 0}var Bd=3,qd="32px",Yd="16px",Na=4e3,Hd=356,Ld=14,Vd=20,Ud=200;function nt(...e){return e.filter(Boolean).join(" ")}function Kd(e){let[n,s]=e.split("-"),r=[];return n&&r.push(n),s&&r.push(s),r}var Gd=e=>{var n,s,r,a,o,i,l,d,c,u,m;let{invert:x,toast:f,unstyled:b,interacting:w,setHeights:S,visibleToasts:g,heights:v,index:N,toasts:k,expanded:O,removeToast:p,defaultRichColors:C,closeButton:M,style:E,cancelButtonStyle:R,actionButtonStyle:B,className:$="",descriptionClassName:W="",duration:P,position:U,gap:_,loadingIcon:Y,expandByDefault:X,classNames:A,icons:j,closeButtonAriaLabel:G="Close toast",pauseWhenPageIsHidden:D}=e,[z,L]=y.useState(null),[H,se]=y.useState(null),[T,re]=y.useState(!1),[xe,Se]=y.useState(!1),[Ae,Ct]=y.useState(!1),[Ht,ae]=y.useState(!1),[Lt,Vt]=y.useState(!1),[Ut,Kt]=y.useState(0),[Wn,tt]=y.useState(0),lt=y.useRef(f.duration||P||Na),gn=y.useRef(null),We=y.useRef(null),Gt=N===0,Mt=N+1<=g,ze=f.type,dt=f.dismissible!==!1,Dt=f.className||"",zn=f.descriptionClassName||"",yt=y.useMemo(()=>v.findIndex(F=>F.toastId===f.id)||0,[v,f.id]),Fn=y.useMemo(()=>{var F;return(F=f.closeButton)!=null?F:M},[f.closeButton,M]),ct=y.useMemo(()=>f.duration||P||Na,[f.duration,P]),Ot=y.useRef(0),ut=y.useRef(0),bn=y.useRef(0),mt=y.useRef(null),[yn,Bn]=U.split("-"),ne=y.useMemo(()=>v.reduce((F,de,ce)=>ce>=yt?F:F+de.height,0),[v,yt]),K=Pd(),Z=f.invert||x,q=ze==="loading";ut.current=y.useMemo(()=>yt*_+ne,[yt,ne]),y.useEffect(()=>{lt.current=ct},[ct]),y.useEffect(()=>{re(!0)},[]),y.useEffect(()=>{let F=We.current;if(F){let de=F.getBoundingClientRect().height;return tt(de),S(ce=>[{toastId:f.id,height:de,position:f.position},...ce]),()=>S(ce=>ce.filter(Me=>Me.toastId!==f.id))}},[S,f.id]),y.useLayoutEffect(()=>{if(!T)return;let F=We.current,de=F.style.height;F.style.height="auto";let ce=F.getBoundingClientRect().height;F.style.height=de,tt(ce),S(Me=>Me.find(be=>be.toastId===f.id)?Me.map(be=>be.toastId===f.id?{...be,height:ce}:be):[{toastId:f.id,height:ce,position:f.position},...Me])},[T,f.title,f.description,S,f.id]);let J=y.useCallback(()=>{Se(!0),Kt(ut.current),S(F=>F.filter(de=>de.toastId!==f.id)),setTimeout(()=>{p(f)},Ud)},[f,p,S,ut]);y.useEffect(()=>{if(f.promise&&ze==="loading"||f.duration===1/0||f.type==="loading")return;let F;return O||w||D&&K?(()=>{if(bn.current<Ot.current){let de=new Date().getTime()-Ot.current;lt.current=lt.current-de}bn.current=new Date().getTime()})():lt.current!==1/0&&(Ot.current=new Date().getTime(),F=setTimeout(()=>{var de;(de=f.onAutoClose)==null||de.call(f,f),J()},lt.current)),()=>clearTimeout(F)},[O,w,f,ze,D,K,J]),y.useEffect(()=>{f.delete&&J()},[J,f.delete]);function fe(){var F,de,ce;return j!=null&&j.loading?y.createElement("div",{className:nt(A==null?void 0:A.loader,(F=f==null?void 0:f.classNames)==null?void 0:F.loader,"sonner-loader"),"data-visible":ze==="loading"},j.loading):Y?y.createElement("div",{className:nt(A==null?void 0:A.loader,(de=f==null?void 0:f.classNames)==null?void 0:de.loader,"sonner-loader"),"data-visible":ze==="loading"},Y):y.createElement(Md,{className:nt(A==null?void 0:A.loader,(ce=f==null?void 0:f.classNames)==null?void 0:ce.loader),visible:ze==="loading"})}return y.createElement("li",{tabIndex:0,ref:We,className:nt($,Dt,A==null?void 0:A.toast,(n=f==null?void 0:f.classNames)==null?void 0:n.toast,A==null?void 0:A.default,A==null?void 0:A[ze],(s=f==null?void 0:f.classNames)==null?void 0:s[ze]),"data-sonner-toast":"","data-rich-colors":(r=f.richColors)!=null?r:C,"data-styled":!(f.jsx||f.unstyled||b),"data-mounted":T,"data-promise":!!f.promise,"data-swiped":Lt,"data-removed":xe,"data-visible":Mt,"data-y-position":yn,"data-x-position":Bn,"data-index":N,"data-front":Gt,"data-swiping":Ae,"data-dismissible":dt,"data-type":ze,"data-invert":Z,"data-swipe-out":Ht,"data-swipe-direction":H,"data-expanded":!!(O||X&&T),style:{"--index":N,"--toasts-before":N,"--z-index":k.length-N,"--offset":`${xe?Ut:ut.current}px`,"--initial-height":X?"auto":`${Wn}px`,...E,...f.style},onDragEnd:()=>{Ct(!1),L(null),mt.current=null},onPointerDown:F=>{q||!dt||(gn.current=new Date,Kt(ut.current),F.target.setPointerCapture(F.pointerId),F.target.tagName!=="BUTTON"&&(Ct(!0),mt.current={x:F.clientX,y:F.clientY}))},onPointerUp:()=>{var F,de,ce,Me;if(Ht||!dt)return;mt.current=null;let be=Number(((F=We.current)==null?void 0:F.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),ve=Number(((de=We.current)==null?void 0:de.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Qe=new Date().getTime()-((ce=gn.current)==null?void 0:ce.getTime()),He=z==="x"?be:ve,Et=Math.abs(He)/Qe;if(Math.abs(He)>=Vd||Et>.11){Kt(ut.current),(Me=f.onDismiss)==null||Me.call(f,f),se(z==="x"?be>0?"right":"left":ve>0?"down":"up"),J(),ae(!0),Vt(!1);return}Ct(!1),L(null)},onPointerMove:F=>{var de,ce,Me,be;if(!mt.current||!dt||((de=window.getSelection())==null?void 0:de.toString().length)>0)return;let ve=F.clientY-mt.current.y,Qe=F.clientX-mt.current.x,He=(ce=e.swipeDirections)!=null?ce:Kd(U);!z&&(Math.abs(Qe)>1||Math.abs(ve)>1)&&L(Math.abs(Qe)>Math.abs(ve)?"x":"y");let Et={x:0,y:0};z==="y"?(He.includes("top")||He.includes("bottom"))&&(He.includes("top")&&ve<0||He.includes("bottom")&&ve>0)&&(Et.y=ve):z==="x"&&(He.includes("left")||He.includes("right"))&&(He.includes("left")&&Qe<0||He.includes("right")&&Qe>0)&&(Et.x=Qe),(Math.abs(Et.x)>0||Math.abs(Et.y)>0)&&Vt(!0),(Me=We.current)==null||Me.style.setProperty("--swipe-amount-x",`${Et.x}px`),(be=We.current)==null||be.style.setProperty("--swipe-amount-y",`${Et.y}px`)}},Fn&&!f.jsx?y.createElement("button",{"aria-label":G,"data-disabled":q,"data-close-button":!0,onClick:q||!dt?()=>{}:()=>{var F;J(),(F=f.onDismiss)==null||F.call(f,f)},className:nt(A==null?void 0:A.closeButton,(a=f==null?void 0:f.classNames)==null?void 0:a.closeButton)},(o=j==null?void 0:j.close)!=null?o:Td):null,f.jsx||h.isValidElement(f.title)?f.jsx?f.jsx:typeof f.title=="function"?f.title():f.title:y.createElement(y.Fragment,null,ze||f.icon||f.promise?y.createElement("div",{"data-icon":"",className:nt(A==null?void 0:A.icon,(i=f==null?void 0:f.classNames)==null?void 0:i.icon)},f.promise||f.type==="loading"&&!f.icon?f.icon||fe():null,f.type!=="loading"?f.icon||(j==null?void 0:j[ze])||Sd(ze):null):null,y.createElement("div",{"data-content":"",className:nt(A==null?void 0:A.content,(l=f==null?void 0:f.classNames)==null?void 0:l.content)},y.createElement("div",{"data-title":"",className:nt(A==null?void 0:A.title,(d=f==null?void 0:f.classNames)==null?void 0:d.title)},typeof f.title=="function"?f.title():f.title),f.description?y.createElement("div",{"data-description":"",className:nt(W,zn,A==null?void 0:A.description,(c=f==null?void 0:f.classNames)==null?void 0:c.description)},typeof f.description=="function"?f.description():f.description):null),h.isValidElement(f.cancel)?f.cancel:f.cancel&&Ns(f.cancel)?y.createElement("button",{"data-button":!0,"data-cancel":!0,style:f.cancelButtonStyle||R,onClick:F=>{var de,ce;Ns(f.cancel)&&dt&&((ce=(de=f.cancel).onClick)==null||ce.call(de,F),J())},className:nt(A==null?void 0:A.cancelButton,(u=f==null?void 0:f.classNames)==null?void 0:u.cancelButton)},f.cancel.label):null,h.isValidElement(f.action)?f.action:f.action&&Ns(f.action)?y.createElement("button",{"data-button":!0,"data-action":!0,style:f.actionButtonStyle||B,onClick:F=>{var de,ce;Ns(f.action)&&((ce=(de=f.action).onClick)==null||ce.call(de,F),!F.defaultPrevented&&J())},className:nt(A==null?void 0:A.actionButton,(m=f==null?void 0:f.classNames)==null?void 0:m.actionButton)},f.action.label):null))};function ka(){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 Qd(e,n){let s={};return[e,n].forEach((r,a)=>{let o=a===1,i=o?"--mobile-offset":"--offset",l=o?Yd:qd;function d(c){["top","right","bottom","left"].forEach(u=>{s[`${i}-${u}`]=typeof c=="number"?`${c}px`:c})}typeof r=="number"||typeof r=="string"?d(r):typeof r=="object"?["top","right","bottom","left"].forEach(c=>{r[c]===void 0?s[`${i}-${c}`]=l:s[`${i}-${c}`]=typeof r[c]=="number"?`${r[c]}px`:r[c]}):d(l)}),s}var Xd=h.forwardRef(function(e,n){let{invert:s,position:r="bottom-right",hotkey:a=["altKey","KeyT"],expand:o,closeButton:i,className:l,offset:d,mobileOffset:c,theme:u="light",richColors:m,duration:x,style:f,visibleToasts:b=Bd,toastOptions:w,dir:S=ka(),gap:g=Ld,loadingIcon:v,icons:N,containerAriaLabel:k="Notifications",pauseWhenPageIsHidden:O}=e,[p,C]=y.useState([]),M=y.useMemo(()=>Array.from(new Set([r].concat(p.filter(D=>D.position).map(D=>D.position)))),[p,r]),[E,R]=y.useState([]),[B,$]=y.useState(!1),[W,P]=y.useState(!1),[U,_]=y.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Y=y.useRef(null),X=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),A=y.useRef(null),j=y.useRef(!1),G=y.useCallback(D=>{C(z=>{var L;return(L=z.find(H=>H.id===D.id))!=null&&L.delete||Le.dismiss(D.id),z.filter(({id:H})=>H!==D.id)})},[]);return y.useEffect(()=>Le.subscribe(D=>{if(D.dismiss){C(z=>z.map(L=>L.id===D.id?{...L,delete:!0}:L));return}setTimeout(()=>{Kl.flushSync(()=>{C(z=>{let L=z.findIndex(H=>H.id===D.id);return L!==-1?[...z.slice(0,L),{...z[L],...D},...z.slice(L+1)]:[D,...z]})})})}),[]),y.useEffect(()=>{if(u!=="system"){_(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?_("dark"):_("light")),typeof window>"u")return;let D=window.matchMedia("(prefers-color-scheme: dark)");try{D.addEventListener("change",({matches:z})=>{_(z?"dark":"light")})}catch{D.addListener(({matches:L})=>{try{_(L?"dark":"light")}catch(H){console.error(H)}})}},[u]),y.useEffect(()=>{p.length<=1&&$(!1)},[p]),y.useEffect(()=>{let D=z=>{var L,H;a.every(se=>z[se]||z.code===se)&&($(!0),(L=Y.current)==null||L.focus()),z.code==="Escape"&&(document.activeElement===Y.current||(H=Y.current)!=null&&H.contains(document.activeElement))&&$(!1)};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[a]),y.useEffect(()=>{if(Y.current)return()=>{A.current&&(A.current.focus({preventScroll:!0}),A.current=null,j.current=!1)}},[Y.current]),y.createElement("section",{ref:n,"aria-label":`${k} ${X}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},M.map((D,z)=>{var L;let[H,se]=D.split("-");return p.length?y.createElement("ol",{key:D,dir:S==="auto"?ka():S,tabIndex:-1,ref:Y,className:l,"data-sonner-toaster":!0,"data-theme":U,"data-y-position":H,"data-lifted":B&&p.length>1&&!o,"data-x-position":se,style:{"--front-toast-height":`${((L=E[0])==null?void 0:L.height)||0}px`,"--width":`${Hd}px`,"--gap":`${g}px`,...f,...Qd(d,c)},onBlur:T=>{j.current&&!T.currentTarget.contains(T.relatedTarget)&&(j.current=!1,A.current&&(A.current.focus({preventScroll:!0}),A.current=null))},onFocus:T=>{T.target instanceof HTMLElement&&T.target.dataset.dismissible==="false"||j.current||(j.current=!0,A.current=T.relatedTarget)},onMouseEnter:()=>$(!0),onMouseMove:()=>$(!0),onMouseLeave:()=>{W||$(!1)},onDragEnd:()=>$(!1),onPointerDown:T=>{T.target instanceof HTMLElement&&T.target.dataset.dismissible==="false"||P(!0)},onPointerUp:()=>P(!1)},p.filter(T=>!T.position&&z===0||T.position===D).map((T,re)=>{var xe,Se;return y.createElement(Gd,{key:T.id,icons:N,index:re,toast:T,defaultRichColors:m,duration:(xe=w==null?void 0:w.duration)!=null?xe:x,className:w==null?void 0:w.className,descriptionClassName:w==null?void 0:w.descriptionClassName,invert:s,visibleToasts:b,closeButton:(Se=w==null?void 0:w.closeButton)!=null?Se:i,interacting:W,position:D,style:w==null?void 0:w.style,unstyled:w==null?void 0:w.unstyled,classNames:w==null?void 0:w.classNames,cancelButtonStyle:w==null?void 0:w.cancelButtonStyle,actionButtonStyle:w==null?void 0:w.actionButtonStyle,removeToast:G,toasts:p.filter(Ae=>Ae.position==T.position),heights:E.filter(Ae=>Ae.position==T.position),setHeights:R,expandByDefault:o,gap:g,loadingIcon:v,expanded:B,pauseWhenPageIsHidden:O,swipeDirections:e.swipeDirections})})):null}))}),Jd=(e,n,s,r,a,o,i,l)=>{let d=document.documentElement,c=["light","dark"];function u(f){(Array.isArray(e)?e:[e]).forEach(b=>{let w=b==="class",S=w&&o?a.map(g=>o[g]||g):a;w?(d.classList.remove(...S),d.classList.add(o&&o[f]?o[f]:f)):d.setAttribute(b,f)}),m(f)}function m(f){l&&c.includes(f)&&(d.style.colorScheme=f)}function x(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(r)u(r);else try{let f=localStorage.getItem(n)||s,b=i&&f==="system"?x():f;u(b)}catch{}},Sa=["light","dark"],Lo="(prefers-color-scheme: dark)",Zd=typeof window>"u",Br=h.createContext(void 0),ec={setTheme:e=>{},themes:[]},tc=()=>{var e;return(e=h.useContext(Br))!=null?e:ec},nc=e=>h.useContext(Br)?h.createElement(h.Fragment,null,e.children):h.createElement(rc,{...e}),sc=["light","dark"],rc=({forcedTheme:e,disableTransitionOnChange:n=!1,enableSystem:s=!0,enableColorScheme:r=!0,storageKey:a="theme",themes:o=sc,defaultTheme:i=s?"system":"light",attribute:l="data-theme",value:d,children:c,nonce:u,scriptProps:m})=>{let[x,f]=h.useState(()=>oc(a,i)),[b,w]=h.useState(()=>x==="system"?er():x),S=d?Object.values(d):o,g=h.useCallback(O=>{let p=O;if(!p)return;O==="system"&&s&&(p=er());let C=d?d[p]:p,M=n?ic(u):null,E=document.documentElement,R=B=>{B==="class"?(E.classList.remove(...S),C&&E.classList.add(C)):B.startsWith("data-")&&(C?E.setAttribute(B,C):E.removeAttribute(B))};if(Array.isArray(l)?l.forEach(R):R(l),r){let B=Sa.includes(i)?i:null,$=Sa.includes(p)?p:B;E.style.colorScheme=$}M==null||M()},[u]),v=h.useCallback(O=>{let p=typeof O=="function"?O(x):O;f(p);try{localStorage.setItem(a,p)}catch{}},[x]),N=h.useCallback(O=>{let p=er(O);w(p),x==="system"&&s&&!e&&g("system")},[x,e]);h.useEffect(()=>{let O=window.matchMedia(Lo);return O.addListener(N),N(O),()=>O.removeListener(N)},[N]),h.useEffect(()=>{let O=p=>{p.key===a&&(p.newValue?f(p.newValue):v(i))};return window.addEventListener("storage",O),()=>window.removeEventListener("storage",O)},[v]),h.useEffect(()=>{g(e??x)},[e,x]);let k=h.useMemo(()=>({theme:x,setTheme:v,forcedTheme:e,resolvedTheme:x==="system"?b:x,themes:s?[...o,"system"]:o,systemTheme:s?b:void 0}),[x,v,e,b,s,o]);return h.createElement(Br.Provider,{value:k},h.createElement(ac,{forcedTheme:e,storageKey:a,attribute:l,enableSystem:s,enableColorScheme:r,defaultTheme:i,value:d,themes:o,nonce:u,scriptProps:m}),c)},ac=h.memo(({forcedTheme:e,storageKey:n,attribute:s,enableSystem:r,enableColorScheme:a,defaultTheme:o,value:i,themes:l,nonce:d,scriptProps:c})=>{let u=JSON.stringify([s,n,o,e,l,i,r,a]).slice(1,-1);return h.createElement("script",{...c,suppressHydrationWarning:!0,nonce:typeof window>"u"?d:"",dangerouslySetInnerHTML:{__html:`(${Jd.toString()})(${u})`}})}),oc=(e,n)=>{if(Zd)return;let s;try{s=localStorage.getItem(e)||void 0}catch{}return s||n},ic=e=>{let n=document.createElement("style");return e&&n.setAttribute("nonce",e),n.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(n),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(n)},1)}},er=e=>(e||(e=window.matchMedia(Lo)),e.matches?"dark":"light");function lc({children:e}){return t.jsx(nc,{attribute:"class",defaultTheme:"system",enableSystem:!0,disableTransitionOnChange:!0,children:e})}const Vo=h.createContext(null),tr="meridian_token",nr="meridian_user",ks="meridian_workspace";function dc({children:e}){const[n,s]=h.useState(()=>{try{const u=localStorage.getItem(nr);return u?JSON.parse(u):null}catch{return null}}),[r,a]=h.useState(()=>localStorage.getItem(tr)),[o,i]=h.useState(()=>{try{const u=localStorage.getItem(ks);return u?JSON.parse(u):null}catch{return null}}),l=(u,m)=>{s(u),a(m),localStorage.setItem(tr,m),localStorage.setItem(nr,JSON.stringify(u))},d=()=>{s(null),a(null),i(null),localStorage.removeItem(tr),localStorage.removeItem(nr),localStorage.removeItem(ks)},c=u=>{i(u),u?localStorage.setItem(ks,JSON.stringify(u)):localStorage.removeItem(ks)};return h.useEffect(()=>{r&&!n&&d()},[]),t.jsx(Vo.Provider,{value:{user:n,token:r,workspace:o,isAuthenticated:!!r&&!!n,login:l,logout:d,setWorkspace:c},children:e})}function Re(){const e=h.useContext(Vo);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const Uo=h.createContext(null);function cc({children:e}){const[n,s]=h.useState(!1);return h.useEffect(()=>{const r=a=>{(a.metaKey||a.ctrlKey)&&a.key==="k"&&(a.preventDefault(),s(o=>!o))};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[]),t.jsx(Uo.Provider,{value:{open:n,setOpen:s,toggle:()=>s(r=>!r)},children:e})}function Ko(){const e=h.useContext(Uo);if(!e)throw new Error("useCommandPalette must be used within CommandPaletteProvider");return e}function Go(e){var n,s,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(n=0;n<a;n++)e[n]&&(s=Go(e[n]))&&(r&&(r+=" "),r+=s)}else for(s in e)e[s]&&(r&&(r+=" "),r+=s);return r}function Qo(){for(var e,n,s=0,r="",a=arguments.length;s<a;s++)(e=arguments[s])&&(n=Go(e))&&(r&&(r+=" "),r+=n);return r}const qr="-",uc=e=>{const n=fc(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const l=i.split(qr);return l[0]===""&&l.length!==1&&l.shift(),Xo(l,n)||mc(i)},getConflictingClassGroupIds:(i,l)=>{const d=s[i]||[];return l&&r[i]?[...d,...r[i]]:d}}},Xo=(e,n)=>{var i;if(e.length===0)return n.classGroupId;const s=e[0],r=n.nextPart.get(s),a=r?Xo(e.slice(1),r):void 0;if(a)return a;if(n.validators.length===0)return;const o=e.join(qr);return(i=n.validators.find(({validator:l})=>l(o)))==null?void 0:i.classGroupId},Ca=/^\[(.+)\]$/,mc=e=>{if(Ca.test(e)){const n=Ca.exec(e)[1],s=n==null?void 0:n.substring(0,n.indexOf(":"));if(s)return"arbitrary.."+s}},fc=e=>{const{theme:n,prefix:s}=e,r={nextPart:new Map,validators:[]};return xc(Object.entries(e.classGroups),s).forEach(([o,i])=>{Dr(i,r,o,n)}),r},Dr=(e,n,s,r)=>{e.forEach(a=>{if(typeof a=="string"){const o=a===""?n:Ma(n,a);o.classGroupId=s;return}if(typeof a=="function"){if(hc(a)){Dr(a(r),n,s,r);return}n.validators.push({validator:a,classGroupId:s});return}Object.entries(a).forEach(([o,i])=>{Dr(i,Ma(n,o),s,r)})})},Ma=(e,n)=>{let s=e;return n.split(qr).forEach(r=>{s.nextPart.has(r)||s.nextPart.set(r,{nextPart:new Map,validators:[]}),s=s.nextPart.get(r)}),s},hc=e=>e.isThemeGetter,xc=(e,n)=>n?e.map(([s,r])=>{const a=r.map(o=>typeof o=="string"?n+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([i,l])=>[n+i,l])):o);return[s,a]}):e,pc=e=>{if(e<1)return{get:()=>{},set:()=>{}};let n=0,s=new Map,r=new Map;const a=(o,i)=>{s.set(o,i),n++,n>e&&(n=0,r=s,s=new Map)};return{get(o){let i=s.get(o);if(i!==void 0)return i;if((i=r.get(o))!==void 0)return a(o,i),i},set(o,i){s.has(o)?s.set(o,i):a(o,i)}}},Jo="!",gc=e=>{const{separator:n,experimentalParseClassName:s}=e,r=n.length===1,a=n[0],o=n.length,i=l=>{const d=[];let c=0,u=0,m;for(let S=0;S<l.length;S++){let g=l[S];if(c===0){if(g===a&&(r||l.slice(S,S+o)===n)){d.push(l.slice(u,S)),u=S+o;continue}if(g==="/"){m=S;continue}}g==="["?c++:g==="]"&&c--}const x=d.length===0?l:l.substring(u),f=x.startsWith(Jo),b=f?x.substring(1):x,w=m&&m>u?m-u:void 0;return{modifiers:d,hasImportantModifier:f,baseClassName:b,maybePostfixModifierPosition:w}};return s?l=>s({className:l,parseClassName:i}):i},bc=e=>{if(e.length<=1)return e;const n=[];let s=[];return e.forEach(r=>{r[0]==="["?(n.push(...s.sort(),r),s=[]):s.push(r)}),n.push(...s.sort()),n},yc=e=>({cache:pc(e.cacheSize),parseClassName:gc(e),...uc(e)}),vc=/\s+/,wc=(e,n)=>{const{parseClassName:s,getClassGroupId:r,getConflictingClassGroupIds:a}=n,o=[],i=e.trim().split(vc);let l="";for(let d=i.length-1;d>=0;d-=1){const c=i[d],{modifiers:u,hasImportantModifier:m,baseClassName:x,maybePostfixModifierPosition:f}=s(c);let b=!!f,w=r(b?x.substring(0,f):x);if(!w){if(!b){l=c+(l.length>0?" "+l:l);continue}if(w=r(x),!w){l=c+(l.length>0?" "+l:l);continue}b=!1}const S=bc(u).join(":"),g=m?S+Jo:S,v=g+w;if(o.includes(v))continue;o.push(v);const N=a(w,b);for(let k=0;k<N.length;++k){const O=N[k];o.push(g+O)}l=c+(l.length>0?" "+l:l)}return l};function jc(){let e=0,n,s,r="";for(;e<arguments.length;)(n=arguments[e++])&&(s=Zo(n))&&(r&&(r+=" "),r+=s);return r}const Zo=e=>{if(typeof e=="string")return e;let n,s="";for(let r=0;r<e.length;r++)e[r]&&(n=Zo(e[r]))&&(s&&(s+=" "),s+=n);return s};function Nc(e,...n){let s,r,a,o=i;function i(d){const c=n.reduce((u,m)=>m(u),e());return s=yc(c),r=s.cache.get,a=s.cache.set,o=l,l(d)}function l(d){const c=r(d);if(c)return c;const u=wc(d,s);return a(d,u),u}return function(){return o(jc.apply(null,arguments))}}const ge=e=>{const n=s=>s[e]||[];return n.isThemeGetter=!0,n},ei=/^\[(?:([a-z-]+):)?(.+)\]$/i,kc=/^\d+\/\d+$/,Sc=new Set(["px","full","screen"]),Cc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Mc=/\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$/,Dc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Oc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ec=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,vt=e=>Sn(e)||Sc.has(e)||kc.test(e),_t=e=>Tn(e,"length",Wc),Sn=e=>!!e&&!Number.isNaN(Number(e)),sr=e=>Tn(e,"number",Sn),qn=e=>!!e&&Number.isInteger(Number(e)),_c=e=>e.endsWith("%")&&Sn(e.slice(0,-1)),ie=e=>ei.test(e),Tt=e=>Cc.test(e),Tc=new Set(["length","size","percentage"]),Pc=e=>Tn(e,Tc,ti),Ic=e=>Tn(e,"position",ti),$c=new Set(["image","url"]),Rc=e=>Tn(e,$c,Fc),Ac=e=>Tn(e,"",zc),Yn=()=>!0,Tn=(e,n,s)=>{const r=ei.exec(e);return r?r[1]?typeof n=="string"?r[1]===n:n.has(r[1]):s(r[2]):!1},Wc=e=>Mc.test(e)&&!Dc.test(e),ti=()=>!1,zc=e=>Oc.test(e),Fc=e=>Ec.test(e),Bc=()=>{const e=ge("colors"),n=ge("spacing"),s=ge("blur"),r=ge("brightness"),a=ge("borderColor"),o=ge("borderRadius"),i=ge("borderSpacing"),l=ge("borderWidth"),d=ge("contrast"),c=ge("grayscale"),u=ge("hueRotate"),m=ge("invert"),x=ge("gap"),f=ge("gradientColorStops"),b=ge("gradientColorStopPositions"),w=ge("inset"),S=ge("margin"),g=ge("opacity"),v=ge("padding"),N=ge("saturate"),k=ge("scale"),O=ge("sepia"),p=ge("skew"),C=ge("space"),M=ge("translate"),E=()=>["auto","contain","none"],R=()=>["auto","hidden","clip","visible","scroll"],B=()=>["auto",ie,n],$=()=>[ie,n],W=()=>["",vt,_t],P=()=>["auto",Sn,ie],U=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],_=()=>["solid","dashed","dotted","double","none"],Y=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>["start","end","center","between","around","evenly","stretch"],A=()=>["","0",ie],j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],G=()=>[Sn,ie];return{cacheSize:500,separator:":",theme:{colors:[Yn],spacing:[vt,_t],blur:["none","",Tt,ie],brightness:G(),borderColor:[e],borderRadius:["none","","full",Tt,ie],borderSpacing:$(),borderWidth:W(),contrast:G(),grayscale:A(),hueRotate:G(),invert:A(),gap:$(),gradientColorStops:[e],gradientColorStopPositions:[_c,_t],inset:B(),margin:B(),opacity:G(),padding:$(),saturate:G(),scale:G(),sepia:A(),skew:G(),space:$(),translate:$()},classGroups:{aspect:[{aspect:["auto","square","video",ie]}],container:["container"],columns:[{columns:[Tt]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"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:[...U(),ie]}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[w]}],"inset-x":[{"inset-x":[w]}],"inset-y":[{"inset-y":[w]}],start:[{start:[w]}],end:[{end:[w]}],top:[{top:[w]}],right:[{right:[w]}],bottom:[{bottom:[w]}],left:[{left:[w]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",qn,ie]}],basis:[{basis:B()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ie]}],grow:[{grow:A()}],shrink:[{shrink:A()}],order:[{order:["first","last","none",qn,ie]}],"grid-cols":[{"grid-cols":[Yn]}],"col-start-end":[{col:["auto",{span:["full",qn,ie]},ie]}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":[Yn]}],"row-start-end":[{row:["auto",{span:[qn,ie]},ie]}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ie]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ie]}],gap:[{gap:[x]}],"gap-x":[{"gap-x":[x]}],"gap-y":[{"gap-y":[x]}],"justify-content":[{justify:["normal",...X()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...X(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...X(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[S]}],mx:[{mx:[S]}],my:[{my:[S]}],ms:[{ms:[S]}],me:[{me:[S]}],mt:[{mt:[S]}],mr:[{mr:[S]}],mb:[{mb:[S]}],ml:[{ml:[S]}],"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",ie,n]}],"min-w":[{"min-w":[ie,n,"min","max","fit"]}],"max-w":[{"max-w":[ie,n,"none","full","min","max","fit","prose",{screen:[Tt]},Tt]}],h:[{h:[ie,n,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ie,n,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ie,n,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ie,n,"auto","min","max","fit"]}],"font-size":[{text:["base",Tt,_t]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",sr]}],"font-family":[{font:[Yn]}],"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",ie]}],"line-clamp":[{"line-clamp":["none",Sn,sr]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",vt,ie]}],"list-image":[{"list-image":["none",ie]}],"list-style-type":[{list:["none","disc","decimal",ie]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[..._(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",vt,_t]}],"underline-offset":[{"underline-offset":["auto",vt,ie]}],"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:$()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ie]}],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",ie]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[g]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...U(),Ic]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Pc]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Rc]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[f]}],"gradient-via":[{via:[f]}],"gradient-to":[{to:[f]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"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":[g]}],"border-style":[{border:[..._(),"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":[g]}],"divide-style":[{divide:_()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",..._()]}],"outline-offset":[{"outline-offset":[vt,ie]}],"outline-w":[{outline:[vt,_t]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[vt,_t]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Tt,Ac]}],"shadow-color":[{shadow:[Yn]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":[...Y(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Y()}],filter:[{filter:["","none"]}],blur:[{blur:[s]}],brightness:[{brightness:[r]}],contrast:[{contrast:[d]}],"drop-shadow":[{"drop-shadow":["","none",Tt,ie]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[m]}],saturate:[{saturate:[N]}],sepia:[{sepia:[O]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[s]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[d]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[m]}],"backdrop-opacity":[{"backdrop-opacity":[g]}],"backdrop-saturate":[{"backdrop-saturate":[N]}],"backdrop-sepia":[{"backdrop-sepia":[O]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ie]}],duration:[{duration:G()}],ease:[{ease:["linear","in","out","in-out",ie]}],delay:[{delay:G()}],animate:[{animate:["none","spin","ping","pulse","bounce",ie]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[k]}],"scale-x":[{"scale-x":[k]}],"scale-y":[{"scale-y":[k]}],rotate:[{rotate:[qn,ie]}],"translate-x":[{"translate-x":[M]}],"translate-y":[{"translate-y":[M]}],"skew-x":[{"skew-x":[p]}],"skew-y":[{"skew-y":[p]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ie]}],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",ie]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":$()}],"scroll-mx":[{"scroll-mx":$()}],"scroll-my":[{"scroll-my":$()}],"scroll-ms":[{"scroll-ms":$()}],"scroll-me":[{"scroll-me":$()}],"scroll-mt":[{"scroll-mt":$()}],"scroll-mr":[{"scroll-mr":$()}],"scroll-mb":[{"scroll-mb":$()}],"scroll-ml":[{"scroll-ml":$()}],"scroll-p":[{"scroll-p":$()}],"scroll-px":[{"scroll-px":$()}],"scroll-py":[{"scroll-py":$()}],"scroll-ps":[{"scroll-ps":$()}],"scroll-pe":[{"scroll-pe":$()}],"scroll-pt":[{"scroll-pt":$()}],"scroll-pr":[{"scroll-pr":$()}],"scroll-pb":[{"scroll-pb":$()}],"scroll-pl":[{"scroll-pl":$()}],"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",ie]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[vt,_t,sr]}],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"]}}},qc=Nc(Bc);function I(...e){return qc(Qo(e))}const Yr=Zl,sn=Xl,rn=Jl,Rt=h.forwardRef(({className:e,sideOffset:n=4,...s},r)=>t.jsx(lo,{ref:r,sideOffset:n,className:I("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),...s}));Rt.displayName=lo.displayName;const ni="";class si extends Error{constructor(n,s,r){super(s),this.status=n,this.data=r,this.name="ApiError"}}function ri(){return localStorage.getItem("meridian_token")}async function Hn(e,n={}){var o;const s=ri(),r={"Content-Type":"application/json",...n.headers};s&&(r.Authorization=`Bearer ${s}`);const a=await fetch(`${ni}${e}`,{...n,headers:r});if(!a.ok){let i;try{i=await a.json()}catch{i=null}const l=((o=i==null?void 0:i.error)==null?void 0:o.message)??`HTTP ${a.status}`;throw new si(a.status,l,i)}if(a.status!==204)return a.json()}const oe={get:e=>Hn(e,{method:"GET"}),post:(e,n)=>Hn(e,{method:"POST",body:JSON.stringify(n)}),put:(e,n)=>Hn(e,{method:"PUT",body:JSON.stringify(n)}),patch:(e,n)=>Hn(e,{method:"PATCH",body:JSON.stringify(n)}),delete:e=>Hn(e,{method:"DELETE"}),upload:async(e,n)=>{var o;const s=ri(),r={};s&&(r.Authorization=`Bearer ${s}`);const a=await fetch(`${ni}${e}`,{method:"POST",headers:r,body:n});if(!a.ok){let i;try{i=await a.json()}catch{i=null}const l=((o=i==null?void 0:i.error)==null?void 0:o.message)??`HTTP ${a.status}`;throw new si(a.status,l,i)}if(a.status!==204)return a.json()}};function Hr(e=!0){return Ie({queryKey:["workspaces"],queryFn:()=>oe.get("/admin/workspaces"),select:n=>n.workspaces,enabled:e})}function Yc(){const e=ke();return ye({mutationFn:n=>oe.post("/admin/workspaces",n),onSuccess:()=>{e.invalidateQueries({queryKey:["workspaces"]})}})}const Da=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Oa=Qo,as=(e,n)=>s=>{var r;if((n==null?void 0:n.variants)==null)return Oa(e,s==null?void 0:s.class,s==null?void 0:s.className);const{variants:a,defaultVariants:o}=n,i=Object.keys(a).map(c=>{const u=s==null?void 0:s[c],m=o==null?void 0:o[c];if(u===null)return null;const x=Da(u)||Da(m);return a[c][x]}),l=s&&Object.entries(s).reduce((c,u)=>{let[m,x]=u;return x===void 0||(c[m]=x),c},{}),d=n==null||(r=n.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:m,className:x,...f}=u;return Object.entries(f).every(b=>{let[w,S]=b;return Array.isArray(S)?S.includes({...o,...l}[w]):{...o,...l}[w]===S})?[...c,m,x]:c},[]);return Oa(e,i,d,s==null?void 0:s.class,s==null?void 0:s.className)};/**
3
+ * @license lucide-react v0.468.0 - ISC
4
+ *
5
+ * This source code is licensed under the ISC license.
6
+ * See the LICENSE file in the root directory of this source tree.
7
+ */const Hc=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ai=(...e)=>e.filter((n,s,r)=>!!n&&n.trim()!==""&&r.indexOf(n)===s).join(" ").trim();/**
8
+ * @license lucide-react v0.468.0 - ISC
9
+ *
10
+ * This source code is licensed under the ISC license.
11
+ * See the LICENSE file in the root directory of this source tree.
12
+ */var Lc={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
13
+ * @license lucide-react v0.468.0 - ISC
14
+ *
15
+ * This source code is licensed under the ISC license.
16
+ * See the LICENSE file in the root directory of this source tree.
17
+ */const Vc=h.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:s=2,absoluteStrokeWidth:r,className:a="",children:o,iconNode:i,...l},d)=>h.createElement("svg",{ref:d,...Lc,width:n,height:n,stroke:e,strokeWidth:r?Number(s)*24/Number(n):s,className:ai("lucide",a),...l},[...i.map(([c,u])=>h.createElement(c,u)),...Array.isArray(o)?o:[o]]));/**
18
+ * @license lucide-react v0.468.0 - ISC
19
+ *
20
+ * This source code is licensed under the ISC license.
21
+ * See the LICENSE file in the root directory of this source tree.
22
+ */const V=(e,n)=>{const s=h.forwardRef(({className:r,...a},o)=>h.createElement(Vc,{ref:o,iconNode:n,className:ai(`lucide-${Hc(e)}`,r),...a}));return s.displayName=`${e}`,s};/**
23
+ * @license lucide-react v0.468.0 - ISC
24
+ *
25
+ * This source code is licensed under the ISC license.
26
+ * See the LICENSE file in the root directory of this source tree.
27
+ */const Is=V("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
28
+ * @license lucide-react v0.468.0 - ISC
29
+ *
30
+ * This source code is licensed under the ISC license.
31
+ * See the LICENSE file in the root directory of this source tree.
32
+ */const Lr=V("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
33
+ * @license lucide-react v0.468.0 - ISC
34
+ *
35
+ * This source code is licensed under the ISC license.
36
+ * See the LICENSE file in the root directory of this source tree.
37
+ */const $s=V("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
38
+ * @license lucide-react v0.468.0 - ISC
39
+ *
40
+ * This source code is licensed under the ISC license.
41
+ * See the LICENSE file in the root directory of this source tree.
42
+ */const os=V("Bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);/**
43
+ * @license lucide-react v0.468.0 - ISC
44
+ *
45
+ * This source code is licensed under the ISC license.
46
+ * See the LICENSE file in the root directory of this source tree.
47
+ */const oi=V("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);/**
48
+ * @license lucide-react v0.468.0 - ISC
49
+ *
50
+ * This source code is licensed under the ISC license.
51
+ * See the LICENSE file in the root directory of this source tree.
52
+ */const ii=V("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);/**
53
+ * @license lucide-react v0.468.0 - ISC
54
+ *
55
+ * This source code is licensed under the ISC license.
56
+ * See the LICENSE file in the root directory of this source tree.
57
+ */const li=V("CalendarRange",[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M17 14h-6",key:"bkmgh3"}],["path",{d:"M13 18H7",key:"bb0bb7"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 18h.01",key:"1bdyru"}]]);/**
58
+ * @license lucide-react v0.468.0 - ISC
59
+ *
60
+ * This source code is licensed under the ISC license.
61
+ * See the LICENSE file in the root directory of this source tree.
62
+ */const ln=V("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
63
+ * @license lucide-react v0.468.0 - ISC
64
+ *
65
+ * This source code is licensed under the ISC license.
66
+ * See the LICENSE file in the root directory of this source tree.
67
+ */const Uc=V("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);/**
68
+ * @license lucide-react v0.468.0 - ISC
69
+ *
70
+ * This source code is licensed under the ISC license.
71
+ * See the LICENSE file in the root directory of this source tree.
72
+ */const wt=V("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
73
+ * @license lucide-react v0.468.0 - ISC
74
+ *
75
+ * This source code is licensed under the ISC license.
76
+ * See the LICENSE file in the root directory of this source tree.
77
+ */const is=V("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
78
+ * @license lucide-react v0.468.0 - ISC
79
+ *
80
+ * This source code is licensed under the ISC license.
81
+ * See the LICENSE file in the root directory of this source tree.
82
+ */const Vr=V("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
83
+ * @license lucide-react v0.468.0 - ISC
84
+ *
85
+ * This source code is licensed under the ISC license.
86
+ * See the LICENSE file in the root directory of this source tree.
87
+ */const ls=V("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
88
+ * @license lucide-react v0.468.0 - ISC
89
+ *
90
+ * This source code is licensed under the ISC license.
91
+ * See the LICENSE file in the root directory of this source tree.
92
+ */const Ur=V("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
93
+ * @license lucide-react v0.468.0 - ISC
94
+ *
95
+ * This source code is licensed under the ISC license.
96
+ * See the LICENSE file in the root directory of this source tree.
97
+ */const di=V("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/**
98
+ * @license lucide-react v0.468.0 - ISC
99
+ *
100
+ * This source code is licensed under the ISC license.
101
+ * See the LICENSE file in the root directory of this source tree.
102
+ */const mn=V("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
103
+ * @license lucide-react v0.468.0 - ISC
104
+ *
105
+ * This source code is licensed under the ISC license.
106
+ * See the LICENSE file in the root directory of this source tree.
107
+ */const ci=V("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
108
+ * @license lucide-react v0.468.0 - ISC
109
+ *
110
+ * This source code is licensed under the ISC license.
111
+ * See the LICENSE file in the root directory of this source tree.
112
+ */const ui=V("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
113
+ * @license lucide-react v0.468.0 - ISC
114
+ *
115
+ * This source code is licensed under the ISC license.
116
+ * See the LICENSE file in the root directory of this source tree.
117
+ */const xt=V("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
118
+ * @license lucide-react v0.468.0 - ISC
119
+ *
120
+ * This source code is licensed under the ISC license.
121
+ * See the LICENSE file in the root directory of this source tree.
122
+ */const Kc=V("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
123
+ * @license lucide-react v0.468.0 - ISC
124
+ *
125
+ * This source code is licensed under the ISC license.
126
+ * See the LICENSE file in the root directory of this source tree.
127
+ */const Yt=V("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
128
+ * @license lucide-react v0.468.0 - ISC
129
+ *
130
+ * This source code is licensed under the ISC license.
131
+ * See the LICENSE file in the root directory of this source tree.
132
+ */const mi=V("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
133
+ * @license lucide-react v0.468.0 - ISC
134
+ *
135
+ * This source code is licensed under the ISC license.
136
+ * See the LICENSE file in the root directory of this source tree.
137
+ */const fi=V("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
138
+ * @license lucide-react v0.468.0 - ISC
139
+ *
140
+ * This source code is licensed under the ISC license.
141
+ * See the LICENSE file in the root directory of this source tree.
142
+ */const hi=V("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/**
143
+ * @license lucide-react v0.468.0 - ISC
144
+ *
145
+ * This source code is licensed under the ISC license.
146
+ * See the LICENSE file in the root directory of this source tree.
147
+ */const Kr=V("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
148
+ * @license lucide-react v0.468.0 - ISC
149
+ *
150
+ * This source code is licensed under the ISC license.
151
+ * See the LICENSE file in the root directory of this source tree.
152
+ */const xi=V("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/**
153
+ * @license lucide-react v0.468.0 - ISC
154
+ *
155
+ * This source code is licensed under the ISC license.
156
+ * See the LICENSE file in the root directory of this source tree.
157
+ */const Gr=V("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
158
+ * @license lucide-react v0.468.0 - ISC
159
+ *
160
+ * This source code is licensed under the ISC license.
161
+ * See the LICENSE file in the root directory of this source tree.
162
+ */const pi=V("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
163
+ * @license lucide-react v0.468.0 - ISC
164
+ *
165
+ * This source code is licensed under the ISC license.
166
+ * See the LICENSE file in the root directory of this source tree.
167
+ */const Rs=V("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
168
+ * @license lucide-react v0.468.0 - ISC
169
+ *
170
+ * This source code is licensed under the ISC license.
171
+ * See the LICENSE file in the root directory of this source tree.
172
+ */const Gc=V("FileArchive",[["path",{d:"M10 12v-1",key:"v7bkov"}],["path",{d:"M10 18v-2",key:"1cjy8d"}],["path",{d:"M10 7V6",key:"dljcrl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01",key:"gkbcor"}],["circle",{cx:"10",cy:"20",r:"2",key:"1xzdoj"}]]);/**
173
+ * @license lucide-react v0.468.0 - ISC
174
+ *
175
+ * This source code is licensed under the ISC license.
176
+ * See the LICENSE file in the root directory of this source tree.
177
+ */const Qc=V("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);/**
178
+ * @license lucide-react v0.468.0 - ISC
179
+ *
180
+ * This source code is licensed under the ISC license.
181
+ * See the LICENSE file in the root directory of this source tree.
182
+ */const Xc=V("FileImage",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]);/**
183
+ * @license lucide-react v0.468.0 - ISC
184
+ *
185
+ * This source code is licensed under the ISC license.
186
+ * See the LICENSE file in the root directory of this source tree.
187
+ */const Jc=V("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
188
+ * @license lucide-react v0.468.0 - ISC
189
+ *
190
+ * This source code is licensed under the ISC license.
191
+ * See the LICENSE file in the root directory of this source tree.
192
+ */const Zc=V("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/**
193
+ * @license lucide-react v0.468.0 - ISC
194
+ *
195
+ * This source code is licensed under the ISC license.
196
+ * See the LICENSE file in the root directory of this source tree.
197
+ */const Qr=V("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
198
+ * @license lucide-react v0.468.0 - ISC
199
+ *
200
+ * This source code is licensed under the ISC license.
201
+ * See the LICENSE file in the root directory of this source tree.
202
+ */const As=V("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
203
+ * @license lucide-react v0.468.0 - ISC
204
+ *
205
+ * This source code is licensed under the ISC license.
206
+ * See the LICENSE file in the root directory of this source tree.
207
+ */const gi=V("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
208
+ * @license lucide-react v0.468.0 - ISC
209
+ *
210
+ * This source code is licensed under the ISC license.
211
+ * See the LICENSE file in the root directory of this source tree.
212
+ */const eu=V("Heading1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]);/**
213
+ * @license lucide-react v0.468.0 - ISC
214
+ *
215
+ * This source code is licensed under the ISC license.
216
+ * See the LICENSE file in the root directory of this source tree.
217
+ */const tu=V("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);/**
218
+ * @license lucide-react v0.468.0 - ISC
219
+ *
220
+ * This source code is licensed under the ISC license.
221
+ * See the LICENSE file in the root directory of this source tree.
222
+ */const nu=V("Heading3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);/**
223
+ * @license lucide-react v0.468.0 - ISC
224
+ *
225
+ * This source code is licensed under the ISC license.
226
+ * See the LICENSE file in the root directory of this source tree.
227
+ */const bi=V("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);/**
228
+ * @license lucide-react v0.468.0 - ISC
229
+ *
230
+ * This source code is licensed under the ISC license.
231
+ * See the LICENSE file in the root directory of this source tree.
232
+ */const pt=V("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);/**
233
+ * @license lucide-react v0.468.0 - ISC
234
+ *
235
+ * This source code is licensed under the ISC license.
236
+ * See the LICENSE file in the root directory of this source tree.
237
+ */const _s=V("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
238
+ * @license lucide-react v0.468.0 - ISC
239
+ *
240
+ * This source code is licensed under the ISC license.
241
+ * See the LICENSE file in the root directory of this source tree.
242
+ */const su=V("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
243
+ * @license lucide-react v0.468.0 - ISC
244
+ *
245
+ * This source code is licensed under the ISC license.
246
+ * See the LICENSE file in the root directory of this source tree.
247
+ */const yi=V("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
248
+ * @license lucide-react v0.468.0 - ISC
249
+ *
250
+ * This source code is licensed under the ISC license.
251
+ * See the LICENSE file in the root directory of this source tree.
252
+ */const ru=V("ListTree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]);/**
253
+ * @license lucide-react v0.468.0 - ISC
254
+ *
255
+ * This source code is licensed under the ISC license.
256
+ * See the LICENSE file in the root directory of this source tree.
257
+ */const vi=V("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
258
+ * @license lucide-react v0.468.0 - ISC
259
+ *
260
+ * This source code is licensed under the ISC license.
261
+ * See the LICENSE file in the root directory of this source tree.
262
+ */const au=V("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
263
+ * @license lucide-react v0.468.0 - ISC
264
+ *
265
+ * This source code is licensed under the ISC license.
266
+ * See the LICENSE file in the root directory of this source tree.
267
+ */const ds=V("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
268
+ * @license lucide-react v0.468.0 - ISC
269
+ *
270
+ * This source code is licensed under the ISC license.
271
+ * See the LICENSE file in the root directory of this source tree.
272
+ */const ou=V("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
273
+ * @license lucide-react v0.468.0 - ISC
274
+ *
275
+ * This source code is licensed under the ISC license.
276
+ * See the LICENSE file in the root directory of this source tree.
277
+ */const iu=V("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
278
+ * @license lucide-react v0.468.0 - ISC
279
+ *
280
+ * This source code is licensed under the ISC license.
281
+ * See the LICENSE file in the root directory of this source tree.
282
+ */const wi=V("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]);/**
283
+ * @license lucide-react v0.468.0 - ISC
284
+ *
285
+ * This source code is licensed under the ISC license.
286
+ * See the LICENSE file in the root directory of this source tree.
287
+ */const Ws=V("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
288
+ * @license lucide-react v0.468.0 - ISC
289
+ *
290
+ * This source code is licensed under the ISC license.
291
+ * See the LICENSE file in the root directory of this source tree.
292
+ */const zs=V("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
293
+ * @license lucide-react v0.468.0 - ISC
294
+ *
295
+ * This source code is licensed under the ISC license.
296
+ * See the LICENSE file in the root directory of this source tree.
297
+ */const Ye=V("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
298
+ * @license lucide-react v0.468.0 - ISC
299
+ *
300
+ * This source code is licensed under the ISC license.
301
+ * See the LICENSE file in the root directory of this source tree.
302
+ */const lu=V("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/**
303
+ * @license lucide-react v0.468.0 - ISC
304
+ *
305
+ * This source code is licensed under the ISC license.
306
+ * See the LICENSE file in the root directory of this source tree.
307
+ */const du=V("Redo2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]);/**
308
+ * @license lucide-react v0.468.0 - ISC
309
+ *
310
+ * This source code is licensed under the ISC license.
311
+ * See the LICENSE file in the root directory of this source tree.
312
+ */const Fs=V("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
313
+ * @license lucide-react v0.468.0 - ISC
314
+ *
315
+ * This source code is licensed under the ISC license.
316
+ * See the LICENSE file in the root directory of this source tree.
317
+ */const cu=V("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
318
+ * @license lucide-react v0.468.0 - ISC
319
+ *
320
+ * This source code is licensed under the ISC license.
321
+ * See the LICENSE file in the root directory of this source tree.
322
+ */const Xr=V("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
323
+ * @license lucide-react v0.468.0 - ISC
324
+ *
325
+ * This source code is licensed under the ISC license.
326
+ * See the LICENSE file in the root directory of this source tree.
327
+ */const ji=V("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
328
+ * @license lucide-react v0.468.0 - ISC
329
+ *
330
+ * This source code is licensed under the ISC license.
331
+ * See the LICENSE file in the root directory of this source tree.
332
+ */const Ni=V("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
333
+ * @license lucide-react v0.468.0 - ISC
334
+ *
335
+ * This source code is licensed under the ISC license.
336
+ * See the LICENSE file in the root directory of this source tree.
337
+ */const uu=V("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
338
+ * @license lucide-react v0.468.0 - ISC
339
+ *
340
+ * This source code is licensed under the ISC license.
341
+ * See the LICENSE file in the root directory of this source tree.
342
+ */const ki=V("Strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);/**
343
+ * @license lucide-react v0.468.0 - ISC
344
+ *
345
+ * This source code is licensed under the ISC license.
346
+ * See the LICENSE file in the root directory of this source tree.
347
+ */const mu=V("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
348
+ * @license lucide-react v0.468.0 - ISC
349
+ *
350
+ * This source code is licensed under the ISC license.
351
+ * See the LICENSE file in the root directory of this source tree.
352
+ */const fu=V("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
353
+ * @license lucide-react v0.468.0 - ISC
354
+ *
355
+ * This source code is licensed under the ISC license.
356
+ * See the LICENSE file in the root directory of this source tree.
357
+ */const hu=V("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/**
358
+ * @license lucide-react v0.468.0 - ISC
359
+ *
360
+ * This source code is licensed under the ISC license.
361
+ * See the LICENSE file in the root directory of this source tree.
362
+ */const cs=V("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
363
+ * @license lucide-react v0.468.0 - ISC
364
+ *
365
+ * This source code is licensed under the ISC license.
366
+ * See the LICENSE file in the root directory of this source tree.
367
+ */const xu=V("Underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]);/**
368
+ * @license lucide-react v0.468.0 - ISC
369
+ *
370
+ * This source code is licensed under the ISC license.
371
+ * See the LICENSE file in the root directory of this source tree.
372
+ */const pu=V("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/**
373
+ * @license lucide-react v0.468.0 - ISC
374
+ *
375
+ * This source code is licensed under the ISC license.
376
+ * See the LICENSE file in the root directory of this source tree.
377
+ */const gu=V("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
378
+ * @license lucide-react v0.468.0 - ISC
379
+ *
380
+ * This source code is licensed under the ISC license.
381
+ * See the LICENSE file in the root directory of this source tree.
382
+ */const bu=V("UserMinus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
383
+ * @license lucide-react v0.468.0 - ISC
384
+ *
385
+ * This source code is licensed under the ISC license.
386
+ * See the LICENSE file in the root directory of this source tree.
387
+ */const Si=V("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
388
+ * @license lucide-react v0.468.0 - ISC
389
+ *
390
+ * This source code is licensed under the ISC license.
391
+ * See the LICENSE file in the root directory of this source tree.
392
+ */const Ze=V("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
393
+ * @license lucide-react v0.468.0 - ISC
394
+ *
395
+ * This source code is licensed under the ISC license.
396
+ * See the LICENSE file in the root directory of this source tree.
397
+ */const us=V("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),rr=768;function yu(){const[e,n]=h.useState(void 0);return h.useEffect(()=>{const s=window.matchMedia(`(max-width: ${rr-1}px)`),r=()=>{n(window.innerWidth<rr)};return s.addEventListener("change",r),n(window.innerWidth<rr),()=>s.removeEventListener("change",r)},[]),!!e}const Os=as("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"}}),ee=h.forwardRef(({className:e,variant:n,size:s,asChild:r=!1,...a},o)=>{const i=r?Rr:"button";return t.jsx(i,{className:I(Os({variant:n,size:s,className:e})),ref:o,...a})});ee.displayName="Button";const Ne=h.forwardRef(({className:e,type:n,...s},r)=>t.jsx("input",{type:n,className:I("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:r,...s}));Ne.displayName="Input";const Jr=h.forwardRef(({className:e,orientation:n="horizontal",decorative:s=!0,...r},a)=>t.jsx(co,{ref:a,decorative:s,orientation:n,className:I("shrink-0 bg-border",n==="horizontal"?"h-px w-full":"h-full w-px",e),...r}));Jr.displayName=co.displayName;const vu=Ps,wu=Ts,Ci=h.forwardRef(({className:e,...n},s)=>t.jsx(En,{className:I("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),...n,ref:s}));Ci.displayName=En.displayName;const ju=as("fixed z-50 gap-4 bg-background border-border transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-200 data-[state=open]:duration-300",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-xl"}},defaultVariants:{side:"right"}}),Mi=h.forwardRef(({side:e="right",className:n,children:s,...r},a)=>t.jsxs(wu,{children:[t.jsx(Ci,{}),t.jsxs(_n,{ref:a,className:I(ju({side:e}),n),...r,children:[s,t.jsxs(Ar,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[t.jsx(Ze,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Mi.displayName=_n.displayName;const Di=({className:e,...n})=>t.jsx("div",{className:I("flex flex-col space-y-1.5 px-6 pt-6 pb-4 border-b border-border",e),...n});Di.displayName="SheetHeader";const Oi=h.forwardRef(({className:e,...n},s)=>t.jsx(ss,{ref:s,className:I("text-base font-semibold text-foreground",e),...n}));Oi.displayName=ss.displayName;const Ei=h.forwardRef(({className:e,...n},s)=>t.jsx(rs,{ref:s,className:I("text-sm text-muted-foreground",e),...n}));Ei.displayName=rs.displayName;function ue({className:e,...n}){return t.jsx("div",{className:I("animate-pulse rounded-md bg-muted",e),...n})}const Nu="sidebar_state",ku=60*60*24*7,Su="16rem",Cu="18rem",Mu="3rem",Du="b",_i=h.createContext(null);function Zr(){const e=h.useContext(_i);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function Ou({defaultOpen:e=!0,open:n,onOpenChange:s,className:r,style:a,children:o,...i}){const l=yu(),[d,c]=h.useState(!1),[u,m]=h.useState(e),x=n??u,f=h.useCallback(g=>{const v=typeof g=="function"?g(x):g;s?s(v):m(v),document.cookie=`${Nu}=${v}; path=/; max-age=${ku}`},[s,x]),b=h.useCallback(()=>l?c(g=>!g):f(g=>!g),[l,f,c]);h.useEffect(()=>{const g=v=>{v.key===Du&&(v.metaKey||v.ctrlKey)&&(v.preventDefault(),b())};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[b]);const w=x?"expanded":"collapsed",S=h.useMemo(()=>({state:w,open:x,setOpen:f,isMobile:l,openMobile:d,setOpenMobile:c,toggleSidebar:b}),[w,x,f,l,d,c,b]);return t.jsx(_i.Provider,{value:S,children:t.jsx(Yr,{delayDuration:0,children:t.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":Su,"--sidebar-width-icon":Mu,...a},className:I("group/sidebar-wrapper has-[[data-variant=inset]]:bg-sidebar flex h-svh w-full",r),...i,children:o})})})}function Eu({side:e="left",variant:n="sidebar",collapsible:s="offcanvas",className:r,children:a,...o}){const{isMobile:i,state:l,openMobile:d,setOpenMobile:c}=Zr();return s==="none"?t.jsx("div",{"data-slot":"sidebar",className:I("bg-sidebar text-sidebar-foreground flex h-full w-[var(--sidebar-width)] flex-col",r),...o,children:a}):i?t.jsx(vu,{open:d,onOpenChange:c,...o,children:t.jsxs(Mi,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-[var(--sidebar-width)] p-0 [&>button]:hidden",style:{"--sidebar-width":Cu},side:e,children:[t.jsxs(Di,{className:"sr-only",children:[t.jsx(Oi,{children:"Sidebar"}),t.jsx(Ei,{children:"Displays the mobile sidebar."})]}),t.jsx("div",{className:"flex h-full w-full flex-col",children:a})]})}):t.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":l,"data-collapsible":l==="collapsed"?s:"","data-variant":n,"data-side":e,"data-slot":"sidebar",children:[t.jsx("div",{"data-slot":"sidebar-gap",className:I("relative w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",n==="floating"||n==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem)]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)]")}),t.jsx("div",{"data-slot":"sidebar-container",className:I("fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200 ease-linear md:flex",e==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",n==="floating"||n==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem+2px)]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)] group-data-[side=left]:border-r group-data-[side=right]:border-l",r),...o,children:t.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:a})})]})}function _u({className:e,onClick:n,...s}){const{toggleSidebar:r}=Zr();return t.jsxs(ee,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:I("size-7",e),onClick:a=>{n==null||n(a),r()},...s,children:[t.jsx(iu,{}),t.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function Tu({className:e,...n}){return t.jsx("main",{"data-slot":"sidebar-inset",className:I("bg-background relative flex w-full flex-1 flex-col","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",e),...n})}function Pu({className:e,...n}){return t.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:I("flex flex-col gap-2 p-2",e),...n})}function Iu({className:e,...n}){return t.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:I("flex flex-col gap-2 p-2",e),...n})}function $u({className:e,...n}){return t.jsx(Jr,{"data-slot":"sidebar-separator","data-sidebar":"separator",className:I("bg-sidebar-border mx-2 w-auto",e),...n})}function Ru({className:e,...n}){return t.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:I("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...n})}function ar({className:e,...n}){return t.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:I("relative flex w-full min-w-0 flex-col p-2",e),...n})}function Au({className:e,asChild:n=!1,...s}){const r=n?Rr:"div";return t.jsx(r,{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:I("text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-none transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...s})}function or({className:e,...n}){return t.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:I("w-full text-sm",e),...n})}function Jn({className:e,...n}){return t.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:I("flex w-full min-w-0 flex-col gap-1",e),...n})}function en({className:e,...n}){return t.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:I("group/menu-item relative",e),...n})}const Wu=as("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}}),$t=h.forwardRef(function({asChild:n=!1,isActive:s=!1,variant:r="default",size:a="default",tooltip:o,className:i,...l},d){const c=n?Rr:"button",{isMobile:u,state:m}=Zr(),x=t.jsx(c,{ref:d,"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":a,"data-active":s,className:I(Wu({variant:r,size:a}),i),...l});return o?(typeof o=="string"&&(o={children:o}),t.jsxs(sn,{children:[t.jsx(rn,{asChild:!0,children:x}),t.jsx(Rt,{side:"right",align:"center",hidden:m!=="collapsed"||u,...o})]})):x});$t.displayName="SidebarMenuButton";const zu=250,Fu=300,an={all:["projects"],list:()=>[...an.all,"list"],detail:e=>[...an.all,e],byKey:e=>[...an.all,"key",e]};function Bs(){const{workspace:e}=Re();return Ie({queryKey:[...an.list(),e==null?void 0:e.id],queryFn:()=>{const n=e!=null&&e.id?`?workspace_id=${e.id}`:"";return oe.get(`/admin/projects${n}`)},select:n=>n.projects,enabled:!!(e!=null&&e.id)})}function Pn(e){return Ie({queryKey:an.byKey(e),queryFn:()=>oe.get(`/admin/projects/by-identifier/${encodeURIComponent(e)}`),select:n=>n.project,enabled:!!e})}function Bu(e,n={}){const[s,r]=h.useState(e),a=n.enabled!==!1;return h.useEffect(()=>{if(!a)return;const l=setTimeout(()=>r(e),zu);return()=>clearTimeout(l)},[e,a]),{...Ie({queryKey:["projects","suggest-identifier",s],queryFn:()=>oe.get(`/admin/projects/suggest-identifier?name=${encodeURIComponent(s)}`),select:l=>l.identifier,enabled:a&&s.trim().length>0}),flush:()=>r(e)}}function qu(e,n={}){const s=e.toUpperCase().replace(/[^A-Z0-9]/g,""),[r,a]=h.useState(s),o=n.enabled!==!1&&s.length>=3;h.useEffect(()=>{if(!s){a("");return}const l=setTimeout(()=>a(s),Fu);return()=>clearTimeout(l)},[s]);const i=Ie({queryKey:["projects","check-identifier",r],queryFn:()=>oe.get(`/admin/projects/check-identifier/${encodeURIComponent(r)}`),select:l=>l.available,enabled:o&&r.length>=3});return{available:i.data,isLoading:i.isLoading,isFetching:i.isFetching}}function Yu(){const e=ke();return ye({mutationFn:n=>oe.post("/admin/projects",n),onSuccess:()=>{e.invalidateQueries({queryKey:an.list()})}})}function Hu(){const e=ke();return ye({mutationFn:n=>oe.delete(`/admin/projects/${n}`),onSuccess:()=>{e.invalidateQueries({queryKey:an.list()})}})}const qs=td,Ys=nd,Lu=h.forwardRef(({className:e,inset:n,children:s,...r},a)=>t.jsxs(uo,{ref:a,className:I("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",n&&"pl-8",e),...r,children:[s,t.jsx(ls,{className:"ml-auto"})]}));Lu.displayName=uo.displayName;const Vu=h.forwardRef(({className:e,...n},s)=>t.jsx(mo,{ref:s,className:I("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}));Vu.displayName=mo.displayName;const ms=h.forwardRef(({className:e,sideOffset:n=4,...s},r)=>t.jsx(ed,{children:t.jsx(fo,{ref:r,sideOffset:n,className:I("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s})}));ms.displayName=fo.displayName;const kt=h.forwardRef(({className:e,inset:n,...s},r)=>t.jsx(ho,{ref:r,className:I("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",n&&"pl-8",e),...s}));kt.displayName=ho.displayName;const Uu=h.forwardRef(({className:e,children:n,checked:s,...r},a)=>t.jsxs(xo,{ref:a,className:I("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:s,...r,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(po,{children:t.jsx(wt,{className:"h-4 w-4"})})}),n]}));Uu.displayName=xo.displayName;const Ku=h.forwardRef(({className:e,children:n,...s},r)=>t.jsxs(go,{ref:r,className:I("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(po,{children:t.jsx(xt,{className:"h-2 w-2 fill-current"})})}),n]}));Ku.displayName=go.displayName;const ea=h.forwardRef(({className:e,inset:n,...s},r)=>t.jsx(bo,{ref:r,className:I("px-2 py-1.5 text-xs font-medium text-muted-foreground",n&&"pl-8",e),...s}));ea.displayName=bo.displayName;const Hs=h.forwardRef(({className:e,...n},s)=>t.jsx(yo,{ref:s,className:I("-mx-1 my-1 h-px bg-border",e),...n}));Hs.displayName=yo.displayName;const At=h.forwardRef(({className:e,...n},s)=>t.jsx(vo,{ref:s,className:I("relative flex h-8 w-8 shrink-0 overflow-hidden rounded-full",e),...n}));At.displayName=vo.displayName;const Gu=h.forwardRef(({className:e,...n},s)=>t.jsx(wo,{ref:s,className:I("aspect-square h-full w-full",e),...n}));Gu.displayName=wo.displayName;const Wt=h.forwardRef(({className:e,...n},s)=>t.jsx(jo,{ref:s,className:I("flex h-full w-full items-center justify-center rounded-full bg-muted text-xs font-medium text-muted-foreground",e),...n}));Wt.displayName=jo.displayName;function Qu(){var a;const{workspace:e,setWorkspace:n}=Re(),{data:s}=Hr(),r=Ge();return t.jsx(Jn,{children:t.jsx(en,{children:t.jsxs(qs,{children:[t.jsx(Ys,{asChild:!0,children:t.jsxs($t,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[t.jsx("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg bg-foreground text-background shrink-0",children:t.jsx("span",{className:"text-[13px] font-bold",children:(((a=e==null?void 0:e.name)==null?void 0:a[0])??"M").toUpperCase()})}),t.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[t.jsx("span",{className:"truncate font-semibold",children:(e==null?void 0:e.name)??"Meridian"}),t.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(e==null?void 0:e.slug)??""})]}),t.jsx(di,{className:"ml-auto size-4 shrink-0"})]})}),t.jsxs(ms,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"bottom",align:"start",sideOffset:4,children:[t.jsx(ea,{className:"text-xs text-muted-foreground font-normal",children:"Workspaces"}),s==null?void 0:s.map(o=>t.jsxs(kt,{className:"cursor-pointer gap-2 p-2",onClick:()=>{n({id:o.id,name:o.name,slug:o.slug}),r(`/${o.slug}/projects`)},children:[t.jsx("div",{className:"flex size-6 items-center justify-center rounded-sm bg-foreground text-background shrink-0",children:t.jsx("span",{className:"text-[10px] font-bold",children:o.name[0].toUpperCase()})}),t.jsx("span",{className:"flex-1 truncate",children:o.name}),o.id===(e==null?void 0:e.id)&&t.jsx(wt,{className:"size-3.5 text-muted-foreground shrink-0"})]},o.id)),t.jsx(Hs,{}),t.jsxs(kt,{className:"cursor-pointer gap-2 p-2 text-muted-foreground",onClick:()=>r("/setup"),children:[t.jsx("div",{className:"flex size-6 items-center justify-center rounded-md border bg-background",children:t.jsx("span",{className:"text-xs font-semibold",children:"+"})}),t.jsx("span",{children:"Create workspace"})]})]})]})})})}function Xu(){var a,o;const{user:e,logout:n}=Re(),s=e?`${((a=e.first_name)==null?void 0:a[0])??""}${((o=e.last_name)==null?void 0:o[0])??""}`.toUpperCase()||e.email[0].toUpperCase():"?",r=e?[e.first_name,e.last_name].filter(Boolean).join(" ")||e.email:"User";return t.jsx(Jn,{children:t.jsx(en,{children:t.jsxs(qs,{children:[t.jsx(Ys,{asChild:!0,children:t.jsxs($t,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[t.jsx(At,{className:"h-8 w-8 rounded-lg shrink-0",children:t.jsx(Wt,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:s})}),t.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[t.jsx("span",{className:"truncate font-semibold",children:r}),t.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(e==null?void 0:e.email)??""})]}),t.jsx(di,{className:"ml-auto size-4 shrink-0"})]})}),t.jsxs(ms,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[t.jsx(ea,{className:"p-0 font-normal",children:t.jsxs("div",{className:"flex items-center gap-2 px-1 py-1.5 text-left text-sm",children:[t.jsx(At,{className:"h-8 w-8 rounded-lg",children:t.jsx(Wt,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:s})}),t.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[t.jsx("span",{className:"truncate font-semibold",children:r}),t.jsx("span",{className:"truncate text-xs text-muted-foreground",children:(e==null?void 0:e.email)??""})]})]})}),t.jsx(Hs,{}),t.jsxs(kt,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:n,children:[t.jsx(au,{className:"size-4"}),"Sign out"]})]})]})})})}function Ju({...e}){const{workspace:n,projectKey:s}=et(),{data:r}=Bs(),{toggle:a}=Ko(),o=oo(),i=n??"",l=o.pathname===`/${i}/projects`,d=o.pathname.includes("/notifications"),c=o.pathname.includes("/settings");return t.jsxs(Eu,{collapsible:"offcanvas",...e,children:[t.jsx(Pu,{children:t.jsx(Qu,{})}),t.jsxs(Ru,{children:[t.jsx(ar,{children:t.jsx(or,{children:t.jsxs(Jn,{children:[t.jsx(en,{children:t.jsxs($t,{onClick:a,tooltip:"Search",children:[t.jsx(Fs,{}),t.jsx("span",{children:"Search"}),t.jsx("kbd",{className:"ml-auto hidden text-[10px] text-sidebar-foreground/40 font-mono sm:inline-flex",children:"⌘K"})]})}),t.jsx(en,{children:t.jsx($t,{asChild:!0,isActive:l,tooltip:"Projects",children:t.jsxs(Qn,{to:`/${i}/projects`,end:!0,children:[t.jsx(pt,{}),t.jsx("span",{children:"Projects"})]})})}),t.jsx(en,{children:t.jsx($t,{asChild:!0,isActive:d,tooltip:"Notifications",children:t.jsxs(Qn,{to:`/${i}/notifications`,children:[t.jsx(os,{}),t.jsx("span",{children:"Notifications"})]})})})]})})}),r&&r.length>0&&t.jsxs(t.Fragment,{children:[t.jsx($u,{}),t.jsxs(ar,{children:[t.jsx(Au,{children:"Recent"}),t.jsx(or,{children:t.jsx(Jn,{children:r.slice(0,5).map(u=>t.jsx(en,{children:t.jsx($t,{asChild:!0,isActive:u.identifier===s,tooltip:u.name,children:t.jsxs(Qn,{to:`/${i}/projects/${u.identifier}/board`,children:[t.jsx("span",{className:"font-mono text-[11px] text-sidebar-foreground/50 shrink-0",children:u.identifier}),t.jsx("span",{className:"truncate",children:u.name})]})})},u.id))})})]})]}),t.jsx(ar,{className:"mt-auto",children:t.jsx(or,{children:t.jsx(Jn,{children:t.jsx(en,{children:t.jsx($t,{asChild:!0,isActive:c,tooltip:"Settings",children:t.jsxs(Qn,{to:`/${i}/settings`,children:[t.jsx(Xr,{}),t.jsx("span",{children:"Settings"})]})})})})})})]}),t.jsx(Iu,{children:t.jsx(Xu,{})})]})}function Zu(){const{theme:e,setTheme:n}=tc();return t.jsxs(sn,{children:[t.jsx(rn,{asChild:!0,children:t.jsxs(ee,{variant:"ghost",size:"icon-sm",onClick:()=>n(e==="dark"?"light":"dark"),className:"text-muted-foreground hover:text-foreground",children:[t.jsx(mu,{className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),t.jsx(ou,{className:"absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),t.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),t.jsx(Rt,{children:"Toggle theme"})]})}const fs={all:["notifications"],list:()=>[...fs.all,"list"]};function em(){return Ie({queryKey:fs.list(),queryFn:()=>oe.get("/admin/notifications"),select:e=>e.notifications})}function tm(){return Ie({queryKey:[...fs.list(),"unread"],queryFn:()=>oe.get("/admin/notifications?read=false"),select:e=>e.count})}function nm(){const e=ke();return ye({mutationFn:n=>oe.post(`/admin/notifications/${n}/read`),onSuccess:()=>{e.invalidateQueries({queryKey:fs.list()})}})}function sm(){const e=ke();return ye({mutationFn:()=>oe.post("/admin/notifications/read-all"),onSuccess:()=>{e.invalidateQueries({queryKey:fs.list()})}})}function rm(){const e=oo(),{projectKey:n}=et(),{data:s}=Bs(),r=s==null?void 0:s.find(o=>o.identifier===n),a=e.pathname;return a.includes("/board")?{icon:pt,label:r?`${r.name} / Board`:"Board"}:a.includes("/issues")?{icon:As,label:r?`${r.name} / Issues`:"Issues"}:a.endsWith("/projects")?{icon:_s,label:"Projects"}:a.includes("/notifications")?{icon:os,label:"Notifications"}:a.includes("/settings")?{icon:Xr,label:"Settings"}:{icon:_s,label:"Meridian"}}function am(){const{data:e=0}=tm(),{icon:n,label:s}=rm(),{workspace:r}=Re(),a=(r==null?void 0:r.slug)??"";return t.jsx("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b transition-[width,height] ease-linear w-full",children:t.jsxs("div",{className:"flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6",children:[t.jsx(_u,{className:"-ml-1"}),t.jsx(Jr,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx(n,{className:"h-4 w-4 text-muted-foreground",strokeWidth:1.5}),t.jsx("span",{className:"font-medium",children:s})]}),t.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[t.jsx(Zu,{}),t.jsx(ee,{variant:"ghost",size:"icon",asChild:!0,className:"relative size-8 text-muted-foreground hover:text-foreground",children:t.jsxs($r,{to:`/${a}/notifications`,children:[t.jsx(os,{className:"h-4 w-4",strokeWidth:1.5}),e>0&&t.jsx("span",{className:"absolute -top-0.5 -right-0.5 h-3.5 w-3.5 rounded-full bg-indigo text-[9px] font-bold text-white flex items-center justify-center leading-none",children:e>9?"9+":e})]})})]})]})})}function om(){return t.jsxs(Ou,{children:[t.jsx(Ju,{variant:"inset"}),t.jsxs(Tu,{className:"flex flex-col min-w-0",children:[t.jsx(am,{}),t.jsx("div",{className:"flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden",children:t.jsx(io,{})})]})]})}function im(){const{projectKey:e,workspace:n}=et(),{data:s}=Pn(e??""),r=`/${n}/projects/${e}`,a=[{to:`${r}/board`,label:"Board",icon:_s,end:!0},{to:`${r}/issues`,label:"Issues",icon:As,end:!1},{to:`${r}/sprints`,label:"Sprints",icon:us,end:!0}];return t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsxs("div",{className:"px-6 pt-5 border-b border-border bg-white dark:bg-card shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-2.5 mb-4",children:[s&&t.jsx("span",{className:"text-xs font-mono text-muted-foreground bg-muted border border-border px-2 py-0.5 rounded",children:s.identifier}),t.jsx("h1",{className:"text-sm font-semibold",children:(s==null?void 0:s.name)??""})]}),t.jsx("div",{className:"flex -mb-px",children:a.map(({to:o,label:i,icon:l,end:d})=>t.jsxs(Qn,{to:o,end:d,className:({isActive:c})=>`flex items-center gap-1.5 px-3 py-2 text-sm border-b-2 transition-colors ${c?"border-foreground text-foreground font-medium":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[t.jsx(l,{className:"h-3.5 w-3.5",strokeWidth:1.5}),i]},o))})]}),t.jsx("div",{className:"flex flex-col flex-1 min-h-0",children:t.jsx(io,{})})]})}var Ea=1,lm=.9,dm=.8,cm=.17,ir=.1,lr=.999,um=.9999,mm=.99,fm=/[\\\/_+.#"@\[\(\{&]/,hm=/[\\\/_+.#"@\[\(\{&]/g,xm=/[\s-]/,Ti=/[\s-]/g;function Or(e,n,s,r,a,o,i){if(o===n.length)return a===e.length?Ea:mm;var l=`${a},${o}`;if(i[l]!==void 0)return i[l];for(var d=r.charAt(o),c=s.indexOf(d,a),u=0,m,x,f,b;c>=0;)m=Or(e,n,s,r,c+1,o+1,i),m>u&&(c===a?m*=Ea:fm.test(e.charAt(c-1))?(m*=dm,f=e.slice(a,c-1).match(hm),f&&a>0&&(m*=Math.pow(lr,f.length))):xm.test(e.charAt(c-1))?(m*=lm,b=e.slice(a,c-1).match(Ti),b&&a>0&&(m*=Math.pow(lr,b.length))):(m*=cm,a>0&&(m*=Math.pow(lr,c-a))),e.charAt(c)!==n.charAt(o)&&(m*=um)),(m<ir&&s.charAt(c-1)===r.charAt(o+1)||r.charAt(o+1)===r.charAt(o)&&s.charAt(c-1)!==r.charAt(o))&&(x=Or(e,n,s,r,c+1,o+2,i),x*ir>m&&(m=x*ir)),m>u&&(u=m),c=s.indexOf(d,c+1);return i[l]=u,u}function _a(e){return e.toLowerCase().replace(Ti," ")}function pm(e,n,s){return e=s&&s.length>0?`${e+" "+s.join(" ")}`:e,Or(e,n,_a(e),_a(n),0,0,{})}var Ln='[cmdk-group=""]',dr='[cmdk-group-items=""]',gm='[cmdk-group-heading=""]',ta='[cmdk-item=""]',Ta=`${ta}:not([aria-disabled="true"])`,Er="cmdk-item-select",tn="data-value",bm=(e,n,s)=>pm(e,n,s),Pi=h.createContext(void 0),hs=()=>h.useContext(Pi),Ii=h.createContext(void 0),na=()=>h.useContext(Ii),$i=h.createContext(void 0),Ri=h.forwardRef((e,n)=>{let s=jn(()=>{var D,z;return{search:"",value:(z=(D=e.value)!=null?D:e.defaultValue)!=null?z:"",filtered:{count:0,items:new Map,groups:new Set}}}),r=jn(()=>new Set),a=jn(()=>new Map),o=jn(()=>new Map),i=jn(()=>new Set),l=Ai(e),{label:d,children:c,value:u,onValueChange:m,filter:x,shouldFilter:f,loop:b,disablePointerSelection:w=!1,vimBindings:S=!0,...g}=e,v=kn(),N=kn(),k=kn(),O=h.useRef(null),p=Om();dn(()=>{if(u!==void 0){let D=u.trim();s.current.value=D,C.emit()}},[u]),dn(()=>{p(6,W)},[]);let C=h.useMemo(()=>({subscribe:D=>(i.current.add(D),()=>i.current.delete(D)),snapshot:()=>s.current,setState:(D,z,L)=>{var H,se,T;if(!Object.is(s.current[D],z)){if(s.current[D]=z,D==="search")$(),R(),p(1,B);else if(D==="value"&&(L||p(5,W),((H=l.current)==null?void 0:H.value)!==void 0)){let re=z??"";(T=(se=l.current).onValueChange)==null||T.call(se,re);return}C.emit()}},emit:()=>{i.current.forEach(D=>D())}}),[]),M=h.useMemo(()=>({value:(D,z,L)=>{var H;z!==((H=o.current.get(D))==null?void 0:H.value)&&(o.current.set(D,{value:z,keywords:L}),s.current.filtered.items.set(D,E(z,L)),p(2,()=>{R(),C.emit()}))},item:(D,z)=>(r.current.add(D),z&&(a.current.has(z)?a.current.get(z).add(D):a.current.set(z,new Set([D]))),p(3,()=>{$(),R(),s.current.value||B(),C.emit()}),()=>{o.current.delete(D),r.current.delete(D),s.current.filtered.items.delete(D);let L=P();p(4,()=>{$(),(L==null?void 0:L.getAttribute("id"))===D&&B(),C.emit()})}),group:D=>(a.current.has(D)||a.current.set(D,new Set),()=>{o.current.delete(D),a.current.delete(D)}),filter:()=>l.current.shouldFilter,label:d||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:v,inputId:k,labelId:N,listInnerRef:O}),[]);function E(D,z){var L,H;let se=(H=(L=l.current)==null?void 0:L.filter)!=null?H:bm;return D?se(D,s.current.search,z):0}function R(){if(!s.current.search||l.current.shouldFilter===!1)return;let D=s.current.filtered.items,z=[];s.current.filtered.groups.forEach(H=>{let se=a.current.get(H),T=0;se.forEach(re=>{let xe=D.get(re);T=Math.max(xe,T)}),z.push([H,T])});let L=O.current;U().sort((H,se)=>{var T,re;let xe=H.getAttribute("id"),Se=se.getAttribute("id");return((T=D.get(Se))!=null?T:0)-((re=D.get(xe))!=null?re:0)}).forEach(H=>{let se=H.closest(dr);se?se.appendChild(H.parentElement===se?H:H.closest(`${dr} > *`)):L.appendChild(H.parentElement===L?H:H.closest(`${dr} > *`))}),z.sort((H,se)=>se[1]-H[1]).forEach(H=>{var se;let T=(se=O.current)==null?void 0:se.querySelector(`${Ln}[${tn}="${encodeURIComponent(H[0])}"]`);T==null||T.parentElement.appendChild(T)})}function B(){let D=U().find(L=>L.getAttribute("aria-disabled")!=="true"),z=D==null?void 0:D.getAttribute(tn);C.setState("value",z||void 0)}function $(){var D,z,L,H;if(!s.current.search||l.current.shouldFilter===!1){s.current.filtered.count=r.current.size;return}s.current.filtered.groups=new Set;let se=0;for(let T of r.current){let re=(z=(D=o.current.get(T))==null?void 0:D.value)!=null?z:"",xe=(H=(L=o.current.get(T))==null?void 0:L.keywords)!=null?H:[],Se=E(re,xe);s.current.filtered.items.set(T,Se),Se>0&&se++}for(let[T,re]of a.current)for(let xe of re)if(s.current.filtered.items.get(xe)>0){s.current.filtered.groups.add(T);break}s.current.filtered.count=se}function W(){var D,z,L;let H=P();H&&(((D=H.parentElement)==null?void 0:D.firstChild)===H&&((L=(z=H.closest(Ln))==null?void 0:z.querySelector(gm))==null||L.scrollIntoView({block:"nearest"})),H.scrollIntoView({block:"nearest"}))}function P(){var D;return(D=O.current)==null?void 0:D.querySelector(`${ta}[aria-selected="true"]`)}function U(){var D;return Array.from(((D=O.current)==null?void 0:D.querySelectorAll(Ta))||[])}function _(D){let z=U()[D];z&&C.setState("value",z.getAttribute(tn))}function Y(D){var z;let L=P(),H=U(),se=H.findIndex(re=>re===L),T=H[se+D];(z=l.current)!=null&&z.loop&&(T=se+D<0?H[H.length-1]:se+D===H.length?H[0]:H[se+D]),T&&C.setState("value",T.getAttribute(tn))}function X(D){let z=P(),L=z==null?void 0:z.closest(Ln),H;for(;L&&!H;)L=D>0?Mm(L,Ln):Dm(L,Ln),H=L==null?void 0:L.querySelector(Ta);H?C.setState("value",H.getAttribute(tn)):Y(D)}let A=()=>_(U().length-1),j=D=>{D.preventDefault(),D.metaKey?A():D.altKey?X(1):Y(1)},G=D=>{D.preventDefault(),D.metaKey?_(0):D.altKey?X(-1):Y(-1)};return h.createElement(qt.div,{ref:n,tabIndex:-1,...g,"cmdk-root":"",onKeyDown:D=>{var z;if((z=g.onKeyDown)==null||z.call(g,D),!D.defaultPrevented)switch(D.key){case"n":case"j":{S&&D.ctrlKey&&j(D);break}case"ArrowDown":{j(D);break}case"p":case"k":{S&&D.ctrlKey&&G(D);break}case"ArrowUp":{G(D);break}case"Home":{D.preventDefault(),_(0);break}case"End":{D.preventDefault(),A();break}case"Enter":if(!D.nativeEvent.isComposing&&D.keyCode!==229){D.preventDefault();let L=P();if(L){let H=new Event(Er);L.dispatchEvent(H)}}}}},h.createElement("label",{"cmdk-label":"",htmlFor:M.inputId,id:M.labelId,style:_m},d),Ls(e,D=>h.createElement(Ii.Provider,{value:C},h.createElement(Pi.Provider,{value:M},D))))}),ym=h.forwardRef((e,n)=>{var s,r;let a=kn(),o=h.useRef(null),i=h.useContext($i),l=hs(),d=Ai(e),c=(r=(s=d.current)==null?void 0:s.forceMount)!=null?r:i==null?void 0:i.forceMount;dn(()=>{if(!c)return l.item(a,i==null?void 0:i.id)},[c]);let u=Wi(a,o,[e.value,e.children,o],e.keywords),m=na(),x=cn(p=>p.value&&p.value===u.current),f=cn(p=>c||l.filter()===!1?!0:p.search?p.filtered.items.get(a)>0:!0);h.useEffect(()=>{let p=o.current;if(!(!p||e.disabled))return p.addEventListener(Er,b),()=>p.removeEventListener(Er,b)},[f,e.onSelect,e.disabled]);function b(){var p,C;w(),(C=(p=d.current).onSelect)==null||C.call(p,u.current)}function w(){m.setState("value",u.current,!0)}if(!f)return null;let{disabled:S,value:g,onSelect:v,forceMount:N,keywords:k,...O}=e;return h.createElement(qt.div,{ref:Zn([o,n]),...O,id:a,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!x,"data-disabled":!!S,"data-selected":!!x,onPointerMove:S||l.getDisablePointerSelection()?void 0:w,onClick:S?void 0:b},e.children)}),vm=h.forwardRef((e,n)=>{let{heading:s,children:r,forceMount:a,...o}=e,i=kn(),l=h.useRef(null),d=h.useRef(null),c=kn(),u=hs(),m=cn(f=>a||u.filter()===!1?!0:f.search?f.filtered.groups.has(i):!0);dn(()=>u.group(i),[]),Wi(i,l,[e.value,e.heading,d]);let x=h.useMemo(()=>({id:i,forceMount:a}),[a]);return h.createElement(qt.div,{ref:Zn([l,n]),...o,"cmdk-group":"",role:"presentation",hidden:m?void 0:!0},s&&h.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:c},s),Ls(e,f=>h.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":s?c:void 0},h.createElement($i.Provider,{value:x},f))))}),wm=h.forwardRef((e,n)=>{let{alwaysRender:s,...r}=e,a=h.useRef(null),o=cn(i=>!i.search);return!s&&!o?null:h.createElement(qt.div,{ref:Zn([a,n]),...r,"cmdk-separator":"",role:"separator"})}),jm=h.forwardRef((e,n)=>{let{onValueChange:s,...r}=e,a=e.value!=null,o=na(),i=cn(u=>u.search),l=cn(u=>u.value),d=hs(),c=h.useMemo(()=>{var u;let m=(u=d.listInnerRef.current)==null?void 0:u.querySelector(`${ta}[${tn}="${encodeURIComponent(l)}"]`);return m==null?void 0:m.getAttribute("id")},[]);return h.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),h.createElement(qt.input,{ref:n,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":c,id:d.inputId,type:"text",value:a?e.value:i,onChange:u=>{a||o.setState("search",u.target.value),s==null||s(u.target.value)}})}),Nm=h.forwardRef((e,n)=>{let{children:s,label:r="Suggestions",...a}=e,o=h.useRef(null),i=h.useRef(null),l=hs();return h.useEffect(()=>{if(i.current&&o.current){let d=i.current,c=o.current,u,m=new ResizeObserver(()=>{u=requestAnimationFrame(()=>{let x=d.offsetHeight;c.style.setProperty("--cmdk-list-height",x.toFixed(1)+"px")})});return m.observe(d),()=>{cancelAnimationFrame(u),m.unobserve(d)}}},[]),h.createElement(qt.div,{ref:Zn([o,n]),...a,"cmdk-list":"",role:"listbox","aria-label":r,id:l.listId},Ls(e,d=>h.createElement("div",{ref:Zn([i,l.listInnerRef]),"cmdk-list-sizer":""},d)))}),km=h.forwardRef((e,n)=>{let{open:s,onOpenChange:r,overlayClassName:a,contentClassName:o,container:i,...l}=e;return h.createElement(Ps,{open:s,onOpenChange:r},h.createElement(Ts,{container:i},h.createElement(En,{"cmdk-overlay":"",className:a}),h.createElement(_n,{"aria-label":e.label,"cmdk-dialog":"",className:o},h.createElement(Ri,{ref:n,...l}))))}),Sm=h.forwardRef((e,n)=>cn(s=>s.filtered.count===0)?h.createElement(qt.div,{ref:n,...e,"cmdk-empty":"",role:"presentation"}):null),Cm=h.forwardRef((e,n)=>{let{progress:s,children:r,label:a="Loading...",...o}=e;return h.createElement(qt.div,{ref:n,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":s,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},Ls(e,i=>h.createElement("div",{"aria-hidden":!0},i)))}),Ve=Object.assign(Ri,{List:Nm,Item:ym,Input:jm,Group:vm,Separator:wm,Dialog:km,Empty:Sm,Loading:Cm});function Mm(e,n){let s=e.nextElementSibling;for(;s;){if(s.matches(n))return s;s=s.nextElementSibling}}function Dm(e,n){let s=e.previousElementSibling;for(;s;){if(s.matches(n))return s;s=s.previousElementSibling}}function Ai(e){let n=h.useRef(e);return dn(()=>{n.current=e}),n}var dn=typeof window>"u"?h.useEffect:h.useLayoutEffect;function jn(e){let n=h.useRef();return n.current===void 0&&(n.current=e()),n}function Zn(e){return n=>{e.forEach(s=>{typeof s=="function"?s(n):s!=null&&(s.current=n)})}}function cn(e){let n=na(),s=()=>e(n.snapshot());return sd.useSyncExternalStore(n.subscribe,s,s)}function Wi(e,n,s,r=[]){let a=h.useRef(),o=hs();return dn(()=>{var i;let l=(()=>{var c;for(let u of s){if(typeof u=="string")return u.trim();if(typeof u=="object"&&"current"in u)return u.current?(c=u.current.textContent)==null?void 0:c.trim():a.current}})(),d=r.map(c=>c.trim());o.value(e,l,d),(i=n.current)==null||i.setAttribute(tn,l),a.current=l}),a}var Om=()=>{let[e,n]=h.useState(),s=jn(()=>new Map);return dn(()=>{s.current.forEach(r=>r()),s.current=new Map},[e]),(r,a)=>{s.current.set(r,a),n({})}};function Em(e){let n=e.type;return typeof n=="function"?n(e.props):"render"in n?n.render(e.props):e}function Ls({asChild:e,children:n},s){return e&&h.isValidElement(n)?h.cloneElement(Em(n),{ref:n.ref},s(n.props.children)):s(n)}var _m={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Tm=Ps,Pm=Ts,zi=h.forwardRef(({className:e,...n},s)=>t.jsx(En,{ref:s,className:I("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),...n}));zi.displayName=En.displayName;const Fi=h.forwardRef(({className:e,children:n,...s},r)=>t.jsxs(Pm,{children:[t.jsx(zi,{}),t.jsxs(_n,{ref:r,className:I("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 bg-background border border-border p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",e),...s,children:[n,t.jsxs(Ar,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[t.jsx(Ze,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Fi.displayName=_n.displayName;const Im=h.forwardRef(({className:e,...n},s)=>t.jsx(ss,{ref:s,className:I("text-base font-semibold leading-none tracking-tight",e),...n}));Im.displayName=ss.displayName;const $m=h.forwardRef(({className:e,...n},s)=>t.jsx(rs,{ref:s,className:I("text-sm text-muted-foreground",e),...n}));$m.displayName=rs.displayName;const Cn=h.forwardRef(({className:e,...n},s)=>t.jsx(Ve,{ref:s,className:I("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...n}));Cn.displayName=Ve.displayName;const Rm=({children:e,open:n,onOpenChange:s})=>t.jsx(Tm,{open:n,onOpenChange:s,children:t.jsx(Fi,{className:"overflow-hidden p-0 shadow-lg max-w-[560px]",children:t.jsx(Cn,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})})}),sa=h.forwardRef(({className:e,...n},s)=>t.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[t.jsx(Fs,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),t.jsx(Ve.Input,{ref:s,className:I("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...n})]}));sa.displayName=Ve.Input.displayName;const Mn=h.forwardRef(({className:e,...n},s)=>t.jsx(Ve.List,{ref:s,className:I("max-h-[320px] overflow-y-auto overflow-x-hidden",e),...n}));Mn.displayName=Ve.List.displayName;const ra=h.forwardRef((e,n)=>t.jsx(Ve.Empty,{ref:n,className:"py-6 text-center text-sm text-muted-foreground",...e}));ra.displayName=Ve.Empty.displayName;const on=h.forwardRef(({className:e,...n},s)=>t.jsx(Ve.Group,{ref:s,className:I("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...n}));on.displayName=Ve.Group.displayName;const Bi=h.forwardRef(({className:e,...n},s)=>t.jsx(Ve.Separator,{ref:s,className:I("-mx-1 h-px bg-border",e),...n}));Bi.displayName=Ve.Separator.displayName;const rt=h.forwardRef(({className:e,...n},s)=>t.jsx(Ve.Item,{ref:s,className:I("relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none","data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground","data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50","[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...n}));rt.displayName=Ve.Item.displayName;function Am(){const{open:e,setOpen:n}=Ko(),s=Ge(),{data:r}=Bs(),{workspace:a}=Re(),o=(a==null?void 0:a.slug)??"",i=l=>{n(!1),l()};return t.jsxs(Rm,{open:e,onOpenChange:n,children:[t.jsx(sa,{placeholder:"Search or jump to..."}),t.jsxs(Mn,{children:[t.jsx(ra,{children:"No results found."}),t.jsxs(on,{heading:"Navigation",children:[t.jsxs(rt,{onSelect:()=>i(()=>s(`/${o}/projects`)),children:[t.jsx(_s,{className:"text-muted-foreground"}),t.jsx("span",{children:"Projects"})]}),t.jsxs(rt,{onSelect:()=>i(()=>s(`/${o}/notifications`)),children:[t.jsx(os,{className:"text-muted-foreground"}),t.jsx("span",{children:"Notifications"})]}),t.jsxs(rt,{onSelect:()=>i(()=>s(`/${o}/settings`)),children:[t.jsx(Xr,{className:"text-muted-foreground"}),t.jsx("span",{children:"Settings"})]})]}),r&&r.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(Bi,{}),t.jsxs(on,{heading:"Projects",children:[r.map(l=>t.jsxs(rt,{value:`${l.name} board`,onSelect:()=>i(()=>s(`/${o}/projects/${l.identifier}/board`)),children:[t.jsx(pt,{className:"text-muted-foreground"}),t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("span",{className:"font-mono text-[11px] text-muted-foreground shrink-0",children:l.identifier}),t.jsx("span",{className:"truncate",children:l.name}),t.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Board"})]})]},`${l.id}-board`)),r.map(l=>t.jsxs(rt,{value:`${l.name} issues`,onSelect:()=>i(()=>s(`/${o}/projects/${l.identifier}/issues`)),children:[t.jsx(As,{className:"text-muted-foreground"}),t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("span",{className:"font-mono text-[11px] text-muted-foreground shrink-0",children:l.identifier}),t.jsx("span",{className:"truncate",children:l.name}),t.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Issues"})]})]},`${l.id}-issues`))]})]})]})]})}function Wm(){const{login:e}=Re();return ye({mutationFn:n=>oe.post("/auth/login",n),onSuccess:n=>{e(n.user,n.token)}})}function zm(){const{login:e}=Re();return ye({mutationFn:n=>oe.post("/auth/register",n),onSuccess:n=>{e(n.user,n.token)}})}function Fm(){const[e,n]=h.useState(""),[s,r]=h.useState(""),[a,o]=h.useState(!1),i=Ge(),l=Wm(),d=c=>{c.preventDefault(),l.mutate({email:e,password:s},{onSuccess:()=>i("/"),onError:u=>Q.error(u.message??"Invalid email or password")})};return t.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:t.jsxs("div",{className:"w-full max-w-[360px]",children:[t.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[t.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:t.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:t.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:t.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})}),t.jsxs("div",{className:"text-center",children:[t.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Welcome to Meridian"}),t.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Sign in to access the admin area"})]})]}),t.jsxs("form",{onSubmit:d,className:"space-y-2",children:[t.jsx(Ne,{type:"email",placeholder:"Email",value:e,onChange:c=>n(c.target.value),autoComplete:"email",required:!0,className:"bg-white dark:bg-card h-10"}),t.jsxs("div",{className:"relative",children:[t.jsx(Ne,{type:a?"text":"password",placeholder:"Password",value:s,onChange:c=>r(c.target.value),autoComplete:"current-password",required:!0,className:"bg-white dark:bg-card h-10 pr-10"}),t.jsx("button",{type:"button",onClick:()=>o(!a),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:a?t.jsx(pi,{className:"h-4 w-4"}):t.jsx(Rs,{className:"h-4 w-4"})})]}),t.jsx("div",{className:"pt-1",children:t.jsx(ee,{type:"submit",className:"w-full h-10 font-medium",disabled:l.isPending,children:l.isPending?"Signing in...":"Continue with Email"})})]}),t.jsxs("p",{className:"text-sm text-center text-muted-foreground mt-6",children:["Don't have an account?"," ",t.jsx($r,{to:"/register",className:"text-indigo hover:opacity-80 transition-opacity",children:"Create one"})]})]})})}function Bm(){const[e,n]=h.useState(""),[s,r]=h.useState(""),[a,o]=h.useState(""),[i,l]=h.useState(""),[d,c]=h.useState(!1),u=Ge(),m=zm(),x=f=>{f.preventDefault(),m.mutate({email:a,password:i,first_name:e,last_name:s},{onSuccess:()=>u("/"),onError:b=>Q.error(b.message??"Registration failed")})};return t.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:t.jsxs("div",{className:"w-full max-w-[360px]",children:[t.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[t.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:t.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:t.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:t.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})}),t.jsxs("div",{className:"text-center",children:[t.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Create your account"}),t.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Get started with Meridian"})]})]}),t.jsxs("form",{onSubmit:x,className:"space-y-2",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[t.jsx(Ne,{placeholder:"First name",value:e,onChange:f=>n(f.target.value),required:!0,className:"bg-white dark:bg-card h-10"}),t.jsx(Ne,{placeholder:"Last name",value:s,onChange:f=>r(f.target.value),required:!0,className:"bg-white dark:bg-card h-10"})]}),t.jsx(Ne,{type:"email",placeholder:"Email",value:a,onChange:f=>o(f.target.value),autoComplete:"email",required:!0,className:"bg-white dark:bg-card h-10"}),t.jsxs("div",{className:"relative",children:[t.jsx(Ne,{type:d?"text":"password",placeholder:"Password",value:i,onChange:f=>l(f.target.value),autoComplete:"new-password",required:!0,className:"bg-white dark:bg-card h-10 pr-10"}),t.jsx("button",{type:"button",onClick:()=>c(!d),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:d?t.jsx(pi,{className:"h-4 w-4"}):t.jsx(Rs,{className:"h-4 w-4"})})]}),t.jsx("div",{className:"pt-1",children:t.jsx(ee,{type:"submit",className:"w-full h-10 font-medium",disabled:m.isPending,children:m.isPending?"Creating account...":"Create Account"})})]}),t.jsxs("p",{className:"text-sm text-center text-muted-foreground mt-6",children:["Already have an account?"," ",t.jsx($r,{to:"/login",className:"text-indigo hover:opacity-80 transition-opacity",children:"Sign in"})]})]})})}function qm(){const[e,n]=h.useState(""),s=Ge(),{setWorkspace:r}=Re(),a=Yc(),o=i=>{i.preventDefault(),e.trim()&&a.mutate({name:e.trim()},{onSuccess:l=>{const d={id:l.workspace.id,name:l.workspace.name,slug:l.workspace.slug};r(d),s(`/${d.slug}/projects`,{replace:!0})},onError:l=>Q.error(l.message??"Failed to create workspace")})};return t.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:t.jsxs("div",{className:"w-full max-w-[380px]",children:[t.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[t.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:t.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:t.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:t.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})}),t.jsxs("div",{className:"text-center",children:[t.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Create your workspace"}),t.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"A workspace is where your team's projects and issues live."})]})]}),t.jsxs("form",{onSubmit:o,className:"space-y-3",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Ne,{placeholder:"Workspace name (e.g. Acme Corp)",value:e,onChange:i=>n(i.target.value),autoFocus:!0,required:!0,className:"bg-white dark:bg-card h-10"}),t.jsx("p",{className:"text-xs text-muted-foreground px-0.5",children:"You can rename it later from settings."})]}),t.jsx(ee,{type:"submit",className:"w-full h-10 font-medium",disabled:!e.trim()||a.isPending,children:a.isPending?"Creating workspace...":"Create workspace"})]})]})})}function Ym(e){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",n.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}const qi=y.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),xs=()=>{const e=y.useContext(qi);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};Ym(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
398
+ [data-state=closed]
399
+ ){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 Hm(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function Lm(){return aa(/^Mac/)}function Vm(){return aa(/^iPhone/)}function Pa(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Um(){return aa(/^iPad/)||Lm()&&navigator.maxTouchPoints>1}function Yi(){return Vm()||Um()}function aa(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const Km=24,Gm=typeof window<"u"?h.useLayoutEffect:h.useEffect;function Ia(...e){return(...n)=>{for(let s of e)typeof s=="function"&&s(...n)}}const cr=typeof document<"u"&&window.visualViewport;function $a(e){let n=window.getComputedStyle(e);return/(auto|scroll)/.test(n.overflow+n.overflowX+n.overflowY)}function Hi(e){for($a(e)&&(e=e.parentElement);e&&!$a(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const Qm=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let Ss=0,ur;function Xm(e={}){let{isDisabled:n}=e;Gm(()=>{if(!n)return Ss++,Ss===1&&Yi()&&(ur=Jm()),()=>{Ss--,Ss===0&&(ur==null||ur())}},[n])}function Jm(){let e,n=0,s=m=>{e=Hi(m.target),!(e===document.documentElement&&e===document.body)&&(n=m.changedTouches[0].pageY)},r=m=>{if(!e||e===document.documentElement||e===document.body){m.preventDefault();return}let x=m.changedTouches[0].pageY,f=e.scrollTop,b=e.scrollHeight-e.clientHeight;b!==0&&((f<=0&&x>n||f>=b&&x<n)&&m.preventDefault(),n=x)},a=m=>{let x=m.target;_r(x)&&x!==document.activeElement&&(m.preventDefault(),x.style.transform="translateY(-2000px)",x.focus(),requestAnimationFrame(()=>{x.style.transform=""}))},o=m=>{let x=m.target;_r(x)&&(x.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{x.style.transform="",cr&&(cr.height<window.innerHeight?requestAnimationFrame(()=>{Ra(x)}):cr.addEventListener("resize",()=>Ra(x),{once:!0}))}))},i=()=>{window.scrollTo(0,0)},l=window.pageXOffset,d=window.pageYOffset,c=Ia(Zm(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let u=Ia(Vn(document,"touchstart",s,{passive:!1,capture:!0}),Vn(document,"touchmove",r,{passive:!1,capture:!0}),Vn(document,"touchend",a,{passive:!1,capture:!0}),Vn(document,"focus",o,!0),Vn(window,"scroll",i));return()=>{c(),u(),window.scrollTo(l,d)}}function Zm(e,n,s){let r=e.style[n];return e.style[n]=s,()=>{e.style[n]=r}}function Vn(e,n,s,r){return e.addEventListener(n,s,r),()=>{e.removeEventListener(n,s,r)}}function Ra(e){let n=document.scrollingElement||document.documentElement;for(;e&&e!==n;){let s=Hi(e);if(s!==document.documentElement&&s!==document.body&&s!==e){let r=s.getBoundingClientRect().top,a=e.getBoundingClientRect().top,o=e.getBoundingClientRect().bottom;const i=s.getBoundingClientRect().bottom+Km;o>i&&(s.scrollTop+=a-r)}e=s.parentElement}}function _r(e){return e instanceof HTMLInputElement&&!Qm.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function ef(e,n){typeof e=="function"?e(n):e!=null&&(e.current=n)}function tf(...e){return n=>e.forEach(s=>ef(s,n))}function Li(...e){return h.useCallback(tf(...e),e)}const Vi=new WeakMap;function Pe(e,n,s=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(n).forEach(([a,o])=>{if(a.startsWith("--")){e.style.setProperty(a,o);return}r[a]=e.style[a],e.style[a]=o}),!s&&Vi.set(e,r)}function nf(e,n){if(!e||!(e instanceof HTMLElement))return;let s=Vi.get(e);s&&(e.style[n]=s[n])}const Ee=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function Cs(e,n){if(!e)return null;const s=window.getComputedStyle(e),r=s.transform||s.webkitTransform||s.mozTransform;let a=r.match(/^matrix3d\((.+)\)$/);return a?parseFloat(a[1].split(", ")[Ee(n)?13:12]):(a=r.match(/^matrix\((.+)\)$/),a?parseFloat(a[1].split(", ")[Ee(n)?5:4]):null)}function sf(e){return 8*(Math.log(e+1)-2)}function mr(e,n){if(!e)return()=>{};const s=e.style.cssText;return Object.assign(e.style,n),()=>{e.style.cssText=s}}function rf(...e){return(...n)=>{for(const s of e)typeof s=="function"&&s(...n)}}const we={DURATION:.5,EASE:[.32,.72,0,1]},Ui=.4,af=.25,of=100,Ki=8,Qt=16,Tr=26,fr="vaul-dragging";function Gi(e){const n=y.useRef(e);return y.useEffect(()=>{n.current=e}),y.useMemo(()=>(...s)=>n.current==null?void 0:n.current.call(n,...s),[])}function lf({defaultProp:e,onChange:n}){const s=y.useState(e),[r]=s,a=y.useRef(r),o=Gi(n);return y.useEffect(()=>{a.current!==r&&(o(r),a.current=r)},[r,a,o]),s}function Qi({prop:e,defaultProp:n,onChange:s=()=>{}}){const[r,a]=lf({defaultProp:n,onChange:s}),o=e!==void 0,i=o?e:r,l=Gi(s),d=y.useCallback(c=>{if(o){const m=typeof c=="function"?c(e):c;m!==e&&l(m)}else a(c)},[o,e,a,l]);return[i,d]}function df({activeSnapPointProp:e,setActiveSnapPointProp:n,snapPoints:s,drawerRef:r,overlayRef:a,fadeFromIndex:o,onSnapPointChange:i,direction:l="bottom",container:d,snapToSequentialPoint:c}){const[u,m]=Qi({prop:e,defaultProp:s==null?void 0:s[0],onChange:n}),[x,f]=y.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);y.useEffect(()=>{function C(){f({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[]);const b=y.useMemo(()=>u===(s==null?void 0:s[s.length-1])||null,[s,u]),w=y.useMemo(()=>{var C;return(C=s==null?void 0:s.findIndex(M=>M===u))!=null?C:null},[s,u]),S=s&&s.length>0&&(o||o===0)&&!Number.isNaN(o)&&s[o]===u||!s,g=y.useMemo(()=>{const C=d?{width:d.getBoundingClientRect().width,height:d.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var M;return(M=s==null?void 0:s.map(E=>{const R=typeof E=="string";let B=0;if(R&&(B=parseInt(E,10)),Ee(l)){const W=R?B:x?E*C.height:0;return x?l==="bottom"?C.height-W:-C.height+W:W}const $=R?B:x?E*C.width:0;return x?l==="right"?C.width-$:-C.width+$:$}))!=null?M:[]},[s,x,d]),v=y.useMemo(()=>w!==null?g==null?void 0:g[w]:null,[g,w]),N=y.useCallback(C=>{var M;const E=(M=g==null?void 0:g.findIndex(R=>R===C))!=null?M:null;i(E),Pe(r.current,{transition:`transform ${we.DURATION}s cubic-bezier(${we.EASE.join(",")})`,transform:Ee(l)?`translate3d(0, ${C}px, 0)`:`translate3d(${C}px, 0, 0)`}),g&&E!==g.length-1&&o!==void 0&&E!==o&&E<o?Pe(a.current,{transition:`opacity ${we.DURATION}s cubic-bezier(${we.EASE.join(",")})`,opacity:"0"}):Pe(a.current,{transition:`opacity ${we.DURATION}s cubic-bezier(${we.EASE.join(",")})`,opacity:"1"}),m(s==null?void 0:s[Math.max(E,0)])},[r.current,s,g,o,a,m]);y.useEffect(()=>{if(u||e){var C;const M=(C=s==null?void 0:s.findIndex(E=>E===e||E===u))!=null?C:-1;g&&M!==-1&&typeof g[M]=="number"&&N(g[M])}},[u,e,s,g,N]);function k({draggedDistance:C,closeDrawer:M,velocity:E,dismissible:R}){if(o===void 0)return;const B=l==="bottom"||l==="right"?(v??0)-C:(v??0)+C,$=w===o-1,W=w===0,P=C>0;if($&&Pe(a.current,{transition:`opacity ${we.DURATION}s cubic-bezier(${we.EASE.join(",")})`}),!c&&E>2&&!P){R?M():N(g[0]);return}if(!c&&E>2&&P&&g&&s){N(g[s.length-1]);return}const U=g==null?void 0:g.reduce((Y,X)=>typeof Y!="number"||typeof X!="number"?Y:Math.abs(X-B)<Math.abs(Y-B)?X:Y),_=Ee(l)?window.innerHeight:window.innerWidth;if(E>Ui&&Math.abs(C)<_*.4){const Y=P?1:-1;if(Y>0&&b&&s){N(g[s.length-1]);return}if(W&&Y<0&&R&&M(),w===null)return;N(g[w+Y]);return}N(U)}function O({draggedDistance:C}){if(v===null)return;const M=l==="bottom"||l==="right"?v-C:v+C;(l==="bottom"||l==="right")&&M<g[g.length-1]||(l==="top"||l==="left")&&M>g[g.length-1]||Pe(r.current,{transform:Ee(l)?`translate3d(0, ${M}px, 0)`:`translate3d(${M}px, 0, 0)`})}function p(C,M){if(!s||typeof w!="number"||!g||o===void 0)return null;const E=w===o-1;if(w>=o&&M)return 0;if(E&&!M)return 1;if(!S&&!E)return null;const B=E?w+1:w-1,$=E?g[B]-g[B-1]:g[B+1]-g[B],W=C/Math.abs($);return E?1-W:W}return{isLastSnapPoint:b,activeSnapPoint:u,shouldFade:S,getPercentageDragged:p,setActiveSnapPoint:m,activeSnapPointIndex:w,onRelease:k,onDrag:O,snapPointsOffset:g}}const cf=()=>()=>{};function uf(){const{direction:e,isOpen:n,shouldScaleBackground:s,setBackgroundColorOnScale:r,noBodyStyles:a}=xs(),o=y.useRef(null),i=h.useMemo(()=>document.body.style.backgroundColor,[]);function l(){return(window.innerWidth-Tr)/window.innerWidth}y.useEffect(()=>{if(n&&s){o.current&&clearTimeout(o.current);const d=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!d)return;rf(r&&!a?mr(document.body,{background:"black"}):cf,mr(d,{transformOrigin:Ee(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${we.DURATION}s`,transitionTimingFunction:`cubic-bezier(${we.EASE.join(",")})`}));const c=mr(d,{borderRadius:`${Ki}px`,overflow:"hidden",...Ee(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()=>{c(),o.current=window.setTimeout(()=>{i?document.body.style.background=i:document.body.style.removeProperty("background")},we.DURATION*1e3)}}},[n,s,i])}let Un=null;function mf({isOpen:e,modal:n,nested:s,hasBeenOpened:r,preventScrollRestoration:a,noBodyStyles:o}){const[i,l]=y.useState(()=>typeof window<"u"?window.location.href:""),d=y.useRef(0),c=y.useCallback(()=>{if(Pa()&&Un===null&&e&&!o){Un={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:m,innerHeight:x}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-d.current}px`,left:`${-m}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const f=x-window.innerHeight;f&&d.current>=x&&(document.body.style.top=`${-(d.current+f)}px`)}),300)}},[e]),u=y.useCallback(()=>{if(Pa()&&Un!==null&&!o){const m=-parseInt(document.body.style.top,10),x=-parseInt(document.body.style.left,10);Object.assign(document.body.style,Un),window.requestAnimationFrame(()=>{if(a&&i!==window.location.href){l(window.location.href);return}window.scrollTo(x,m)}),Un=null}},[i]);return y.useEffect(()=>{function m(){d.current=window.scrollY}return m(),window.addEventListener("scroll",m),()=>{window.removeEventListener("scroll",m)}},[]),y.useEffect(()=>{if(n)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||u()}},[n,u]),y.useEffect(()=>{s||!r||(e?(!window.matchMedia("(display-mode: standalone)").matches&&c(),n||window.setTimeout(()=>{u()},500)):u())},[e,r,i,n,s,c,u]),{restorePositionSetting:u}}function ff({open:e,onOpenChange:n,children:s,onDrag:r,onRelease:a,snapPoints:o,shouldScaleBackground:i=!1,setBackgroundColorOnScale:l=!0,closeThreshold:d=af,scrollLockTimeout:c=of,dismissible:u=!0,handleOnly:m=!1,fadeFromIndex:x=o&&o.length-1,activeSnapPoint:f,setActiveSnapPoint:b,fixed:w,modal:S=!0,onClose:g,nested:v,noBodyStyles:N=!1,direction:k="bottom",defaultOpen:O=!1,disablePreventScroll:p=!0,snapToSequentialPoint:C=!1,preventScrollRestoration:M=!1,repositionInputs:E=!0,onAnimationEnd:R,container:B,autoFocus:$=!1}){var W,P;const[U=!1,_]=Qi({defaultProp:O,prop:e,onChange:ne=>{n==null||n(ne),!ne&&!v&&dt(),setTimeout(()=>{R==null||R(ne)},we.DURATION*1e3),ne&&!S&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),ne||(document.body.style.pointerEvents="auto")}}),[Y,X]=y.useState(!1),[A,j]=y.useState(!1),[G,D]=y.useState(!1),z=y.useRef(null),L=y.useRef(null),H=y.useRef(null),se=y.useRef(null),T=y.useRef(null),re=y.useRef(!1),xe=y.useRef(null),Se=y.useRef(0),Ae=y.useRef(!1),Ct=y.useRef(!O),Ht=y.useRef(0),ae=y.useRef(null),Lt=y.useRef(((W=ae.current)==null?void 0:W.getBoundingClientRect().height)||0),Vt=y.useRef(((P=ae.current)==null?void 0:P.getBoundingClientRect().width)||0),Ut=y.useRef(0),Kt=y.useCallback(ne=>{o&&ne===We.length-1&&(L.current=new Date)},[]),{activeSnapPoint:Wn,activeSnapPointIndex:tt,setActiveSnapPoint:lt,onRelease:gn,snapPointsOffset:We,onDrag:Gt,shouldFade:Mt,getPercentageDragged:ze}=df({snapPoints:o,activeSnapPointProp:f,setActiveSnapPointProp:b,drawerRef:ae,fadeFromIndex:x,overlayRef:z,onSnapPointChange:Kt,direction:k,container:B,snapToSequentialPoint:C});Xm({isDisabled:!U||A||!S||G||!Y||!E||!p});const{restorePositionSetting:dt}=mf({isOpen:U,modal:S,nested:v??!1,hasBeenOpened:Y,preventScrollRestoration:M,noBodyStyles:N});function Dt(){return(window.innerWidth-Tr)/window.innerWidth}function zn(ne){var K,Z;!u&&!o||ae.current&&!ae.current.contains(ne.target)||(Lt.current=((K=ae.current)==null?void 0:K.getBoundingClientRect().height)||0,Vt.current=((Z=ae.current)==null?void 0:Z.getBoundingClientRect().width)||0,j(!0),H.current=new Date,Yi()&&window.addEventListener("touchend",()=>re.current=!1,{once:!0}),ne.target.setPointerCapture(ne.pointerId),Se.current=Ee(k)?ne.pageY:ne.pageX)}function yt(ne,K){var Z;let q=ne;const J=(Z=window.getSelection())==null?void 0:Z.toString(),fe=ae.current?Cs(ae.current,k):null,F=new Date;if(q.tagName==="SELECT"||q.hasAttribute("data-vaul-no-drag")||q.closest("[data-vaul-no-drag]"))return!1;if(k==="right"||k==="left")return!0;if(L.current&&F.getTime()-L.current.getTime()<500)return!1;if(fe!==null&&(k==="bottom"?fe>0:fe<0))return!0;if(J&&J.length>0)return!1;if(T.current&&F.getTime()-T.current.getTime()<c&&fe===0||K)return T.current=F,!1;for(;q;){if(q.scrollHeight>q.clientHeight){if(q.scrollTop!==0)return T.current=new Date,!1;if(q.getAttribute("role")==="dialog")return!0}q=q.parentNode}return!0}function Fn(ne){if(ae.current&&A){const K=k==="bottom"||k==="right"?1:-1,Z=(Se.current-(Ee(k)?ne.pageY:ne.pageX))*K,q=Z>0,J=o&&!u&&!q;if(J&&tt===0)return;const fe=Math.abs(Z),F=document.querySelector("[data-vaul-drawer-wrapper]"),de=k==="bottom"||k==="top"?Lt.current:Vt.current;let ce=fe/de;const Me=ze(fe,q);if(Me!==null&&(ce=Me),J&&ce>=1||!re.current&&!yt(ne.target,q))return;if(ae.current.classList.add(fr),re.current=!0,Pe(ae.current,{transition:"none"}),Pe(z.current,{transition:"none"}),o&&Gt({draggedDistance:Z}),q&&!o){const ve=sf(Z),Qe=Math.min(ve*-1,0)*K;Pe(ae.current,{transform:Ee(k)?`translate3d(0, ${Qe}px, 0)`:`translate3d(${Qe}px, 0, 0)`});return}const be=1-ce;if((Mt||x&&tt===x-1)&&(r==null||r(ne,ce),Pe(z.current,{opacity:`${be}`,transition:"none"},!0)),F&&z.current&&i){const ve=Math.min(Dt()+ce*(1-Dt()),1),Qe=8-ce*8,He=Math.max(0,14-ce*14);Pe(F,{borderRadius:`${Qe}px`,transform:Ee(k)?`scale(${ve}) translate3d(0, ${He}px, 0)`:`scale(${ve}) translate3d(${He}px, 0, 0)`,transition:"none"},!0)}if(!o){const ve=fe*K;Pe(ae.current,{transform:Ee(k)?`translate3d(0, ${ve}px, 0)`:`translate3d(${ve}px, 0, 0)`})}}}y.useEffect(()=>{window.requestAnimationFrame(()=>{Ct.current=!0})},[]),y.useEffect(()=>{var ne;function K(){if(!ae.current||!E)return;const Z=document.activeElement;if(_r(Z)||Ae.current){var q;const J=((q=window.visualViewport)==null?void 0:q.height)||0,fe=window.innerHeight;let F=fe-J;const de=ae.current.getBoundingClientRect().height||0,ce=de>fe*.8;Ut.current||(Ut.current=de);const Me=ae.current.getBoundingClientRect().top;if(Math.abs(Ht.current-F)>60&&(Ae.current=!Ae.current),o&&o.length>0&&We&&tt){const be=We[tt]||0;F+=be}if(Ht.current=F,de>J||Ae.current){const be=ae.current.getBoundingClientRect().height;let ve=be;be>J&&(ve=J-(ce?Me:Tr)),w?ae.current.style.height=`${be-Math.max(F,0)}px`:ae.current.style.height=`${Math.max(ve,J-Me)}px`}else Hm()||(ae.current.style.height=`${Ut.current}px`);o&&o.length>0&&!Ae.current?ae.current.style.bottom="0px":ae.current.style.bottom=`${Math.max(F,0)}px`}}return(ne=window.visualViewport)==null||ne.addEventListener("resize",K),()=>{var Z;return(Z=window.visualViewport)==null?void 0:Z.removeEventListener("resize",K)}},[tt,o,We]);function ct(ne){ut(),g==null||g(),ne||_(!1),setTimeout(()=>{o&&lt(o[0])},we.DURATION*1e3)}function Ot(){if(!ae.current)return;const ne=document.querySelector("[data-vaul-drawer-wrapper]"),K=Cs(ae.current,k);Pe(ae.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${we.DURATION}s cubic-bezier(${we.EASE.join(",")})`}),Pe(z.current,{transition:`opacity ${we.DURATION}s cubic-bezier(${we.EASE.join(",")})`,opacity:"1"}),i&&K&&K>0&&U&&Pe(ne,{borderRadius:`${Ki}px`,overflow:"hidden",...Ee(k)?{transform:`scale(${Dt()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${Dt()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${we.DURATION}s`,transitionTimingFunction:`cubic-bezier(${we.EASE.join(",")})`},!0)}function ut(){!A||!ae.current||(ae.current.classList.remove(fr),re.current=!1,j(!1),se.current=new Date)}function bn(ne){if(!A||!ae.current)return;ae.current.classList.remove(fr),re.current=!1,j(!1),se.current=new Date;const K=Cs(ae.current,k);if(!ne||!yt(ne.target,!1)||!K||Number.isNaN(K)||H.current===null)return;const Z=se.current.getTime()-H.current.getTime(),q=Se.current-(Ee(k)?ne.pageY:ne.pageX),J=Math.abs(q)/Z;if(J>.05&&(D(!0),setTimeout(()=>{D(!1)},200)),o){gn({draggedDistance:q*(k==="bottom"||k==="right"?1:-1),closeDrawer:ct,velocity:J,dismissible:u}),a==null||a(ne,!0);return}if(k==="bottom"||k==="right"?q>0:q<0){Ot(),a==null||a(ne,!0);return}if(J>Ui){ct(),a==null||a(ne,!1);return}var fe;const F=Math.min((fe=ae.current.getBoundingClientRect().height)!=null?fe:0,window.innerHeight);var de;const ce=Math.min((de=ae.current.getBoundingClientRect().width)!=null?de:0,window.innerWidth),Me=k==="left"||k==="right";if(Math.abs(K)>=(Me?ce:F)*d){ct(),a==null||a(ne,!1);return}a==null||a(ne,!0),Ot()}y.useEffect(()=>(U&&(Pe(document.documentElement,{scrollBehavior:"auto"}),L.current=new Date),()=>{nf(document.documentElement,"scrollBehavior")}),[U]);function mt(ne){const K=ne?(window.innerWidth-Qt)/window.innerWidth:1,Z=ne?-Qt:0;xe.current&&window.clearTimeout(xe.current),Pe(ae.current,{transition:`transform ${we.DURATION}s cubic-bezier(${we.EASE.join(",")})`,transform:Ee(k)?`scale(${K}) translate3d(0, ${Z}px, 0)`:`scale(${K}) translate3d(${Z}px, 0, 0)`}),!ne&&ae.current&&(xe.current=setTimeout(()=>{const q=Cs(ae.current,k);Pe(ae.current,{transition:"none",transform:Ee(k)?`translate3d(0, ${q}px, 0)`:`translate3d(${q}px, 0, 0)`})},500))}function yn(ne,K){if(K<0)return;const Z=(window.innerWidth-Qt)/window.innerWidth,q=Z+K*(1-Z),J=-Qt+K*Qt;Pe(ae.current,{transform:Ee(k)?`scale(${q}) translate3d(0, ${J}px, 0)`:`scale(${q}) translate3d(${J}px, 0, 0)`,transition:"none"})}function Bn(ne,K){const Z=Ee(k)?window.innerHeight:window.innerWidth,q=K?(Z-Qt)/Z:1,J=K?-Qt:0;K&&Pe(ae.current,{transition:`transform ${we.DURATION}s cubic-bezier(${we.EASE.join(",")})`,transform:Ee(k)?`scale(${q}) translate3d(0, ${J}px, 0)`:`scale(${q}) translate3d(${J}px, 0, 0)`})}return y.useEffect(()=>{S||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[S]),y.createElement(Ps,{defaultOpen:O,onOpenChange:ne=>{!u&&!ne||(ne?X(!0):ct(!0),_(ne))},open:U},y.createElement(qi.Provider,{value:{activeSnapPoint:Wn,snapPoints:o,setActiveSnapPoint:lt,drawerRef:ae,overlayRef:z,onOpenChange:n,onPress:zn,onRelease:bn,onDrag:Fn,dismissible:u,shouldAnimate:Ct,handleOnly:m,isOpen:U,isDragging:A,shouldFade:Mt,closeDrawer:ct,onNestedDrag:yn,onNestedOpenChange:mt,onNestedRelease:Bn,keyboardIsOpen:Ae,modal:S,snapPointsOffset:We,activeSnapPointIndex:tt,direction:k,shouldScaleBackground:i,setBackgroundColorOnScale:l,noBodyStyles:N,container:B,autoFocus:$}},s))}const Xi=y.forwardRef(function({...e},n){const{overlayRef:s,snapPoints:r,onRelease:a,shouldFade:o,isOpen:i,modal:l,shouldAnimate:d}=xs(),c=Li(n,s),u=r&&r.length>0;if(!l)return null;const m=y.useCallback(x=>a(x),[a]);return y.createElement(En,{onMouseUp:m,ref:c,"data-vaul-overlay":"","data-vaul-snap-points":i&&u?"true":"false","data-vaul-snap-points-overlay":i&&o?"true":"false","data-vaul-animate":d!=null&&d.current?"true":"false",...e})});Xi.displayName="Drawer.Overlay";const Ji=y.forwardRef(function({onPointerDownOutside:e,style:n,onOpenAutoFocus:s,...r},a){const{drawerRef:o,onPress:i,onRelease:l,onDrag:d,keyboardIsOpen:c,snapPointsOffset:u,activeSnapPointIndex:m,modal:x,isOpen:f,direction:b,snapPoints:w,container:S,handleOnly:g,shouldAnimate:v,autoFocus:N}=xs(),[k,O]=y.useState(!1),p=Li(a,o),C=y.useRef(null),M=y.useRef(null),E=y.useRef(!1),R=w&&w.length>0;uf();const B=(W,P,U=0)=>{if(E.current)return!0;const _=Math.abs(W.y),Y=Math.abs(W.x),X=Y>_,A=["bottom","right"].includes(P)?1:-1;if(P==="left"||P==="right"){if(!(W.x*A<0)&&Y>=0&&Y<=U)return X}else if(!(W.y*A<0)&&_>=0&&_<=U)return!X;return E.current=!0,!0};y.useEffect(()=>{R&&window.requestAnimationFrame(()=>{O(!0)})},[]);function $(W){C.current=null,E.current=!1,l(W)}return y.createElement(_n,{"data-vaul-drawer-direction":b,"data-vaul-drawer":"","data-vaul-delayed-snap-points":k?"true":"false","data-vaul-snap-points":f&&R?"true":"false","data-vaul-custom-container":S?"true":"false","data-vaul-animate":v!=null&&v.current?"true":"false",...r,ref:p,style:u&&u.length>0?{"--snap-point-height":`${u[m??0]}px`,...n}:n,onPointerDown:W=>{g||(r.onPointerDown==null||r.onPointerDown.call(r,W),C.current={x:W.pageX,y:W.pageY},i(W))},onOpenAutoFocus:W=>{s==null||s(W),N||W.preventDefault()},onPointerDownOutside:W=>{if(e==null||e(W),!x||W.defaultPrevented){W.preventDefault();return}c.current&&(c.current=!1)},onFocusOutside:W=>{if(!x){W.preventDefault();return}},onPointerMove:W=>{if(M.current=W,g||(r.onPointerMove==null||r.onPointerMove.call(r,W),!C.current))return;const P=W.pageY-C.current.y,U=W.pageX-C.current.x,_=W.pointerType==="touch"?10:2;B({x:U,y:P},b,_)?d(W):(Math.abs(U)>_||Math.abs(P)>_)&&(C.current=null)},onPointerUp:W=>{r.onPointerUp==null||r.onPointerUp.call(r,W),C.current=null,E.current=!1,l(W)},onPointerOut:W=>{r.onPointerOut==null||r.onPointerOut.call(r,W),$(M.current)},onContextMenu:W=>{r.onContextMenu==null||r.onContextMenu.call(r,W),M.current&&$(M.current)}})});Ji.displayName="Drawer.Content";const hf=250,xf=120,pf=y.forwardRef(function({preventCycle:e=!1,children:n,...s},r){const{closeDrawer:a,isDragging:o,snapPoints:i,activeSnapPoint:l,setActiveSnapPoint:d,dismissible:c,handleOnly:u,isOpen:m,onPress:x,onDrag:f}=xs(),b=y.useRef(null),w=y.useRef(!1);function S(){if(w.current){N();return}window.setTimeout(()=>{g()},xf)}function g(){if(o||e||w.current){N();return}if(N(),!i||i.length===0){c||a();return}if(l===i[i.length-1]&&c){a();return}const O=i.findIndex(C=>C===l);if(O===-1)return;const p=i[O+1];d(p)}function v(){b.current=window.setTimeout(()=>{w.current=!0},hf)}function N(){b.current&&window.clearTimeout(b.current),w.current=!1}return y.createElement("div",{onClick:S,onPointerCancel:N,onPointerDown:k=>{u&&x(k),v()},onPointerMove:k=>{u&&f(k)},ref:r,"data-vaul-drawer-visible":m?"true":"false","data-vaul-handle":"","aria-hidden":"true",...s},y.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},n))});pf.displayName="Drawer.Handle";function gf(e){const n=xs(),{container:s=n.container,...r}=e;return y.createElement(Ts,{container:s,...r})}const gt={Root:ff,Content:Ji,Overlay:Xi,Portal:gf,Close:Ar,Title:ss,Description:rs},fn=({shouldScaleBackground:e=!1,direction:n="right",...s})=>t.jsx(gt.Root,{shouldScaleBackground:e,direction:n,...s});fn.displayName="Drawer";const bf=gt.Portal,Zi=h.forwardRef(({className:e,...n},s)=>t.jsx(gt.Overlay,{ref:s,className:I("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),...n}));Zi.displayName=gt.Overlay.displayName;const hn=h.forwardRef(({className:e,children:n,...s},r)=>t.jsxs(bf,{children:[t.jsx(Zi,{}),t.jsxs(gt.Content,{ref:r,className:I("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),...s,children:[n,t.jsxs(gt.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[t.jsx(Ze,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));hn.displayName="DrawerContent";const xn=({className:e,...n})=>t.jsx("div",{className:I("flex flex-col space-y-1.5 px-6 pt-6 pb-4 border-b border-border shrink-0",e),...n});xn.displayName="DrawerHeader";const In=({className:e,...n})=>t.jsx("div",{className:I("flex-1 overflow-y-auto px-6 py-4",e),...n});In.displayName="DrawerBody";const ps=({className:e,...n})=>t.jsx("div",{className:I("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),...n});ps.displayName="DrawerFooter";const pn=h.forwardRef(({className:e,...n},s)=>t.jsx(gt.Title,{ref:s,className:I("text-base font-semibold text-foreground",e),...n}));pn.displayName=gt.Title.displayName;const yf=h.forwardRef(({className:e,...n},s)=>t.jsx(gt.Description,{ref:s,className:I("text-sm text-muted-foreground",e),...n}));yf.displayName=gt.Description.displayName;const vf=as("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),$e=h.forwardRef(({className:e,...n},s)=>t.jsx(No,{ref:s,className:I(vf(),e),...n}));$e.displayName=No.displayName;const Vs=h.forwardRef(({className:e,...n},s)=>t.jsx("textarea",{className:I("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:s,...n}));Vs.displayName="Textarea";const Aa=[{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}],hr=["#94a3b8","#64748b","#6366f1","#f59e0b","#10b981","#ef4444","#3b82f6","#8b5cf6"];function wf(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function jf({chip:e,onRemove:n}){const{attributes:s,listeners:r,setNodeRef:a,transform:o,transition:i,isDragging:l}=zr({id:e.key});return t.jsxs("div",{ref:a,style:{transform:Fr.Transform.toString(o),transition:i},className:I("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:[t.jsx("span",{...s,...r,className:"text-muted-foreground/50 hover:text-muted-foreground cursor-grab touch-none",children:t.jsx(gi,{className:"h-3 w-3"})}),t.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:e.color}}),t.jsx("span",{className:"text-[11px]",children:e.name}),t.jsx("button",{type:"button",onClick:n,className:"ml-0.5 text-muted-foreground/50 hover:text-muted-foreground transition-colors",children:t.jsx(Ze,{className:"h-3 w-3"})})]})}const Nf=3;function kf({open:e,onClose:n}){var U;const[s,r]=h.useState(""),[a,o]=h.useState(""),[i,l]=h.useState(""),[d,c]=h.useState(!1),[u,m]=h.useState(!1),[x,f]=h.useState(Aa),[b,w]=h.useState(""),[S,g]=h.useState(hr[2]),{workspace:v}=Re(),N=Yu(),k=Bu(s,{enabled:e}),O=qu(a,{enabled:e});h.useEffect(()=>{e&&k.data&&!d&&o(k.data)},[e,k.data,d]);const p=O.available===!1||N.isError&&((U=N.error)==null?void 0:U.status)===409,C=a.trim().length>=Nf&&/^[A-Z0-9]+$/i.test(a.trim()),M=Io($o(Wo,{activationConstraint:{distance:5}})),E=_=>{r(_)},R=()=>{s.trim()&&!d&&k.flush()},B=()=>{r(""),o(""),l(""),c(!1),m(!1),f(Aa),w(""),g(hr[2]),N.reset(),n()},$=()=>{if(!b.trim())return;const _=wf(b.trim());if(x.some(Y=>Y.key===_)){Q.error("A status with this name already exists");return}f(Y=>[...Y,{name:b.trim(),key:_,color:S,category:"started",position:Y.length}]),w("")},W=_=>{const{active:Y,over:X}=_;!X||Y.id===X.id||f(A=>{const j=A.findIndex(D=>D.key===Y.id),G=A.findIndex(D=>D.key===X.id);return Ds(A,j,G).map((D,z)=>({...D,position:z}))})},P=_=>{_.preventDefault(),!(!s.trim()||!a.trim()||!C||p)&&N.mutate({name:s.trim(),identifier:a.trim().toUpperCase(),description:i.trim()||void 0,workspace_id:v.id,initial_statuses:x},{onSuccess:()=>{Q.success("Project created"),B()},onError:Y=>{(Y==null?void 0:Y.status)===409?Q.error("This project key is already in use."):Q.error(Y.message??"Failed to create project")}})};return t.jsx(fn,{open:e,onOpenChange:_=>!_&&B(),children:t.jsxs(hn,{className:"max-w-md",children:[t.jsx(xn,{children:t.jsx(pn,{children:"New project"})}),t.jsxs("form",{onSubmit:P,className:"flex flex-col flex-1 overflow-hidden",children:[t.jsxs(In,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx($e,{htmlFor:"project-name",children:"Name"}),t.jsx(Ne,{id:"project-name",placeholder:"My Project",value:s,onChange:_=>E(_.target.value),onBlur:R,autoFocus:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Project key below will auto-fill when you finish typing; you can change it."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs($e,{htmlFor:"project-id",children:["Identifier",t.jsx("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:"Used as issue prefix (e.g. PROJ-1)"})]}),t.jsx(Ne,{id:"project-id",placeholder:"PROJ",value:a,onChange:_=>{o(_.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"")),c(!0)},maxLength:5,className:I("font-mono",p&&"border-destructive"),"aria-invalid":p}),p&&t.jsx("p",{className:"text-xs text-destructive",children:"This project key is already in use."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs($e,{htmlFor:"project-desc",children:["Description",t.jsx("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:"Optional"})]}),t.jsx(Vs,{id:"project-desc",placeholder:"What is this project about?",value:i,onChange:_=>l(_.target.value),className:"min-h-[80px]"})]}),t.jsxs("div",{className:"border border-border rounded-lg overflow-hidden",children:[t.jsx("button",{type:"button",onClick:()=>m(!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:t.jsxs("span",{className:"flex items-center gap-1.5",children:[u?t.jsx(is,{className:"h-3.5 w-3.5"}):t.jsx(ls,{className:"h-3.5 w-3.5"}),"Statuses",t.jsxs("span",{className:"text-muted-foreground font-normal",children:["(",x.length,")"]})]})}),u&&t.jsxs("div",{className:"px-3 pb-3 border-t border-border space-y-3 pt-3",children:[t.jsx(Ro,{sensors:M,onDragEnd:W,children:t.jsx(Wr,{items:x.map(_=>_.key),strategy:Ao,children:t.jsx("div",{className:"flex flex-wrap gap-1.5",children:x.map(_=>t.jsx(jf,{chip:_,onRemove:()=>f(Y=>Y.filter(X=>X.key!==_.key).map((X,A)=>({...X,position:A})))},_.key))})})}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:hr.map(_=>t.jsx("button",{type:"button",onClick:()=>g(_),className:I("h-4 w-4 rounded-full border-2 transition-transform hover:scale-110",S===_?"border-foreground scale-110":"border-transparent"),style:{backgroundColor:_}},_))}),t.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[t.jsx(Ne,{placeholder:"Status name…",value:b,onChange:_=>w(_.target.value),onKeyDown:_=>{_.key==="Enter"&&(_.preventDefault(),$())},className:"h-7 text-xs flex-1"}),t.jsx(ee,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7 shrink-0",onClick:$,disabled:!b.trim(),children:t.jsx(Ye,{className:"h-3.5 w-3.5"})})]})]})]})]})]}),t.jsxs(ps,{children:[t.jsx(ee,{type:"button",variant:"ghost",onClick:B,children:"Cancel"}),t.jsx(ee,{type:"submit",disabled:!s.trim()||!a.trim()||!C||p||N.isPending,children:N.isPending?"Creating...":"Create project"})]})]})]})})}const el=6048e5,Sf=864e5,Wa=Symbol.for("constructDateFrom");function Te(e,n){return typeof e=="function"?e(n):e&&typeof e=="object"&&Wa in e?e[Wa](n):e instanceof Date?new e.constructor(n):new Date(n)}function pe(e,n){return Te(n||e,e)}function tl(e,n,s){const r=pe(e,s==null?void 0:s.in);return isNaN(n)?Te(e,NaN):(n&&r.setDate(r.getDate()+n),r)}function nl(e,n,s){const r=pe(e,s==null?void 0:s.in);if(isNaN(n))return Te(e,NaN);if(!n)return r;const a=r.getDate(),o=Te(e,r.getTime());o.setMonth(r.getMonth()+n+1,0);const i=o.getDate();return a>=i?o:(r.setFullYear(o.getFullYear(),o.getMonth(),a),r)}let Cf={};function gs(){return Cf}function Dn(e,n){var l,d,c,u;const s=gs(),r=(n==null?void 0:n.weekStartsOn)??((d=(l=n==null?void 0:n.locale)==null?void 0:l.options)==null?void 0:d.weekStartsOn)??s.weekStartsOn??((u=(c=s.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,a=pe(e,n==null?void 0:n.in),o=a.getDay(),i=(o<r?7:0)+o-r;return a.setDate(a.getDate()-i),a.setHours(0,0,0,0),a}function es(e,n){return Dn(e,{...n,weekStartsOn:1})}function sl(e,n){const s=pe(e,n==null?void 0:n.in),r=s.getFullYear(),a=Te(s,0);a.setFullYear(r+1,0,4),a.setHours(0,0,0,0);const o=es(a),i=Te(s,0);i.setFullYear(r,0,4),i.setHours(0,0,0,0);const l=es(i);return s.getTime()>=o.getTime()?r+1:s.getTime()>=l.getTime()?r:r-1}function za(e){const n=pe(e),s=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return s.setUTCFullYear(n.getFullYear()),+e-+s}function $n(e,...n){const s=Te.bind(null,n.find(r=>typeof r=="object"));return n.map(s)}function ts(e,n){const s=pe(e,n==null?void 0:n.in);return s.setHours(0,0,0,0),s}function oa(e,n,s){const[r,a]=$n(s==null?void 0:s.in,e,n),o=ts(r),i=ts(a),l=+o-za(o),d=+i-za(i);return Math.round((l-d)/Sf)}function Mf(e,n){const s=sl(e,n),r=Te(e,0);return r.setFullYear(s,0,4),r.setHours(0,0,0,0),es(r)}function Df(e,n,s){return tl(e,n*7,s)}function Of(e,n,s){return nl(e,n*12,s)}function Ef(e,n){let s,r=n==null?void 0:n.in;return e.forEach(a=>{!r&&typeof a=="object"&&(r=Te.bind(null,a));const o=pe(a,r);(!s||s<o||isNaN(+o))&&(s=o)}),Te(r,s||NaN)}function _f(e,n){let s,r=n==null?void 0:n.in;return e.forEach(a=>{!r&&typeof a=="object"&&(r=Te.bind(null,a));const o=pe(a,r);(!s||s>o||isNaN(+o))&&(s=o)}),Te(r,s||NaN)}function Tf(e,n,s){const[r,a]=$n(s==null?void 0:s.in,e,n);return+ts(r)==+ts(a)}function rl(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Pf(e){return!(!rl(e)&&typeof e!="number"||isNaN(+pe(e)))}function al(e,n,s){const[r,a]=$n(s==null?void 0:s.in,e,n),o=r.getFullYear()-a.getFullYear(),i=r.getMonth()-a.getMonth();return o*12+i}function If(e,n){const s=pe(e,n==null?void 0:n.in),r=s.getMonth();return s.setFullYear(s.getFullYear(),r+1,0),s.setHours(23,59,59,999),s}function ol(e,n){const[s,r]=$n(e,n.start,n.end);return{start:s,end:r}}function $f(e,n){const{start:s,end:r}=ol(n==null?void 0:n.in,e);let a=+s>+r;const o=a?+s:+r,i=a?r:s;i.setHours(0,0,0,0),i.setDate(1);let l=1;const d=[];for(;+i<=o;)d.push(Te(s,i)),i.setMonth(i.getMonth()+l);return a?d.reverse():d}function Rf(e,n){const s=pe(e,n==null?void 0:n.in);return s.setDate(1),s.setHours(0,0,0,0),s}function Af(e,n){const s=pe(e,n==null?void 0:n.in),r=s.getFullYear();return s.setFullYear(r+1,0,0),s.setHours(23,59,59,999),s}function il(e,n){const s=pe(e,n==null?void 0:n.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}function Wf(e,n){const{start:s,end:r}=ol(n==null?void 0:n.in,e);let a=+s>+r;const o=a?+s:+r,i=a?r:s;i.setHours(0,0,0,0),i.setMonth(0,1);let l=1;const d=[];for(;+i<=o;)d.push(Te(s,i)),i.setFullYear(i.getFullYear()+l);return a?d.reverse():d}function ll(e,n){var l,d,c,u;const s=gs(),r=(n==null?void 0:n.weekStartsOn)??((d=(l=n==null?void 0:n.locale)==null?void 0:l.options)==null?void 0:d.weekStartsOn)??s.weekStartsOn??((u=(c=s.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,a=pe(e,n==null?void 0:n.in),o=a.getDay(),i=(o<r?-7:0)+6-(o-r);return a.setDate(a.getDate()+i),a.setHours(23,59,59,999),a}function zf(e,n){return ll(e,{...n,weekStartsOn:1})}const Ff={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"}},Bf=(e,n,s)=>{let r;const a=Ff[e];return typeof a=="string"?r=a:n===1?r=a.one:r=a.other.replace("{{count}}",n.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+r:r+" ago":r};function xr(e){return(n={})=>{const s=n.width?String(n.width):e.defaultWidth;return e.formats[s]||e.formats[e.defaultWidth]}}const qf={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Yf={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Hf={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Lf={date:xr({formats:qf,defaultWidth:"full"}),time:xr({formats:Yf,defaultWidth:"full"}),dateTime:xr({formats:Hf,defaultWidth:"full"})},Vf={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Uf=(e,n,s,r)=>Vf[e];function Kn(e){return(n,s)=>{const r=s!=null&&s.context?String(s.context):"standalone";let a;if(r==="formatting"&&e.formattingValues){const i=e.defaultFormattingWidth||e.defaultWidth,l=s!=null&&s.width?String(s.width):i;a=e.formattingValues[l]||e.formattingValues[i]}else{const i=e.defaultWidth,l=s!=null&&s.width?String(s.width):e.defaultWidth;a=e.values[l]||e.values[i]}const o=e.argumentCallback?e.argumentCallback(n):n;return a[o]}}const Kf={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Gf={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Qf={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"]},Xf={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"]},Jf={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"}},Zf={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"}},eh=(e,n)=>{const s=Number(e),r=s%100;if(r>20||r<10)switch(r%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},th={ordinalNumber:eh,era:Kn({values:Kf,defaultWidth:"wide"}),quarter:Kn({values:Gf,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Kn({values:Qf,defaultWidth:"wide"}),day:Kn({values:Xf,defaultWidth:"wide"}),dayPeriod:Kn({values:Jf,defaultWidth:"wide",formattingValues:Zf,defaultFormattingWidth:"wide"})};function Gn(e){return(n,s={})=>{const r=s.width,a=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],o=n.match(a);if(!o)return null;const i=o[0],l=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],d=Array.isArray(l)?sh(l,m=>m.test(i)):nh(l,m=>m.test(i));let c;c=e.valueCallback?e.valueCallback(d):d,c=s.valueCallback?s.valueCallback(c):c;const u=n.slice(i.length);return{value:c,rest:u}}}function nh(e,n){for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&n(e[s]))return s}function sh(e,n){for(let s=0;s<e.length;s++)if(n(e[s]))return s}function rh(e){return(n,s={})=>{const r=n.match(e.matchPattern);if(!r)return null;const a=r[0],o=n.match(e.parsePattern);if(!o)return null;let i=e.valueCallback?e.valueCallback(o[0]):o[0];i=s.valueCallback?s.valueCallback(i):i;const l=n.slice(a.length);return{value:i,rest:l}}}const ah=/^(\d+)(th|st|nd|rd)?/i,oh=/\d+/i,ih={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},lh={any:[/^b/i,/^(a|c)/i]},dh={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},ch={any:[/1/i,/2/i,/3/i,/4/i]},uh={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},mh={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]},fh={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},hh={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]},xh={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},ph={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}},gh={ordinalNumber:rh({matchPattern:ah,parsePattern:oh,valueCallback:e=>parseInt(e,10)}),era:Gn({matchPatterns:ih,defaultMatchWidth:"wide",parsePatterns:lh,defaultParseWidth:"any"}),quarter:Gn({matchPatterns:dh,defaultMatchWidth:"wide",parsePatterns:ch,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Gn({matchPatterns:uh,defaultMatchWidth:"wide",parsePatterns:mh,defaultParseWidth:"any"}),day:Gn({matchPatterns:fh,defaultMatchWidth:"wide",parsePatterns:hh,defaultParseWidth:"any"}),dayPeriod:Gn({matchPatterns:xh,defaultMatchWidth:"any",parsePatterns:ph,defaultParseWidth:"any"})},Nn={code:"en-US",formatDistance:Bf,formatLong:Lf,formatRelative:Uf,localize:th,match:gh,options:{weekStartsOn:0,firstWeekContainsDate:1}};function bh(e,n){const s=pe(e,n==null?void 0:n.in);return oa(s,il(s))+1}function ia(e,n){const s=pe(e,n==null?void 0:n.in),r=+es(s)-+Mf(s);return Math.round(r/el)+1}function dl(e,n){var u,m,x,f;const s=pe(e,n==null?void 0:n.in),r=s.getFullYear(),a=gs(),o=(n==null?void 0:n.firstWeekContainsDate)??((m=(u=n==null?void 0:n.locale)==null?void 0:u.options)==null?void 0:m.firstWeekContainsDate)??a.firstWeekContainsDate??((f=(x=a.locale)==null?void 0:x.options)==null?void 0:f.firstWeekContainsDate)??1,i=Te((n==null?void 0:n.in)||e,0);i.setFullYear(r+1,0,o),i.setHours(0,0,0,0);const l=Dn(i,n),d=Te((n==null?void 0:n.in)||e,0);d.setFullYear(r,0,o),d.setHours(0,0,0,0);const c=Dn(d,n);return+s>=+l?r+1:+s>=+c?r:r-1}function yh(e,n){var l,d,c,u;const s=gs(),r=(n==null?void 0:n.firstWeekContainsDate)??((d=(l=n==null?void 0:n.locale)==null?void 0:l.options)==null?void 0:d.firstWeekContainsDate)??s.firstWeekContainsDate??((u=(c=s.locale)==null?void 0:c.options)==null?void 0:u.firstWeekContainsDate)??1,a=dl(e,n),o=Te((n==null?void 0:n.in)||e,0);return o.setFullYear(a,0,r),o.setHours(0,0,0,0),Dn(o,n)}function la(e,n){const s=pe(e,n==null?void 0:n.in),r=+Dn(s,n)-+yh(s,n);return Math.round(r/el)+1}function he(e,n){const s=e<0?"-":"",r=Math.abs(e).toString().padStart(n,"0");return s+r}const Pt={y(e,n){const s=e.getFullYear(),r=s>0?s:1-s;return he(n==="yy"?r%100:r,n.length)},M(e,n){const s=e.getMonth();return n==="M"?String(s+1):he(s+1,2)},d(e,n){return he(e.getDate(),n.length)},a(e,n){const s=e.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];case"aaaa":default:return s==="am"?"a.m.":"p.m."}},h(e,n){return he(e.getHours()%12||12,n.length)},H(e,n){return he(e.getHours(),n.length)},m(e,n){return he(e.getMinutes(),n.length)},s(e,n){return he(e.getSeconds(),n.length)},S(e,n){const s=n.length,r=e.getMilliseconds(),a=Math.trunc(r*Math.pow(10,s-3));return he(a,n.length)}},vn={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Fa={G:function(e,n,s){const r=e.getFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return s.era(r,{width:"abbreviated"});case"GGGGG":return s.era(r,{width:"narrow"});case"GGGG":default:return s.era(r,{width:"wide"})}},y:function(e,n,s){if(n==="yo"){const r=e.getFullYear(),a=r>0?r:1-r;return s.ordinalNumber(a,{unit:"year"})}return Pt.y(e,n)},Y:function(e,n,s,r){const a=dl(e,r),o=a>0?a:1-a;if(n==="YY"){const i=o%100;return he(i,2)}return n==="Yo"?s.ordinalNumber(o,{unit:"year"}):he(o,n.length)},R:function(e,n){const s=sl(e);return he(s,n.length)},u:function(e,n){const s=e.getFullYear();return he(s,n.length)},Q:function(e,n,s){const r=Math.ceil((e.getMonth()+1)/3);switch(n){case"Q":return String(r);case"QQ":return he(r,2);case"Qo":return s.ordinalNumber(r,{unit:"quarter"});case"QQQ":return s.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,n,s){const r=Math.ceil((e.getMonth()+1)/3);switch(n){case"q":return String(r);case"qq":return he(r,2);case"qo":return s.ordinalNumber(r,{unit:"quarter"});case"qqq":return s.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,n,s){const r=e.getMonth();switch(n){case"M":case"MM":return Pt.M(e,n);case"Mo":return s.ordinalNumber(r+1,{unit:"month"});case"MMM":return s.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(r,{width:"wide",context:"formatting"})}},L:function(e,n,s){const r=e.getMonth();switch(n){case"L":return String(r+1);case"LL":return he(r+1,2);case"Lo":return s.ordinalNumber(r+1,{unit:"month"});case"LLL":return s.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(r,{width:"wide",context:"standalone"})}},w:function(e,n,s,r){const a=la(e,r);return n==="wo"?s.ordinalNumber(a,{unit:"week"}):he(a,n.length)},I:function(e,n,s){const r=ia(e);return n==="Io"?s.ordinalNumber(r,{unit:"week"}):he(r,n.length)},d:function(e,n,s){return n==="do"?s.ordinalNumber(e.getDate(),{unit:"date"}):Pt.d(e,n)},D:function(e,n,s){const r=bh(e);return n==="Do"?s.ordinalNumber(r,{unit:"dayOfYear"}):he(r,n.length)},E:function(e,n,s){const r=e.getDay();switch(n){case"E":case"EE":case"EEE":return s.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(r,{width:"short",context:"formatting"});case"EEEE":default:return s.day(r,{width:"wide",context:"formatting"})}},e:function(e,n,s,r){const a=e.getDay(),o=(a-r.weekStartsOn+8)%7||7;switch(n){case"e":return String(o);case"ee":return he(o,2);case"eo":return s.ordinalNumber(o,{unit:"day"});case"eee":return s.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(a,{width:"short",context:"formatting"});case"eeee":default:return s.day(a,{width:"wide",context:"formatting"})}},c:function(e,n,s,r){const a=e.getDay(),o=(a-r.weekStartsOn+8)%7||7;switch(n){case"c":return String(o);case"cc":return he(o,n.length);case"co":return s.ordinalNumber(o,{unit:"day"});case"ccc":return s.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(a,{width:"narrow",context:"standalone"});case"cccccc":return s.day(a,{width:"short",context:"standalone"});case"cccc":default:return s.day(a,{width:"wide",context:"standalone"})}},i:function(e,n,s){const r=e.getDay(),a=r===0?7:r;switch(n){case"i":return String(a);case"ii":return he(a,n.length);case"io":return s.ordinalNumber(a,{unit:"day"});case"iii":return s.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(r,{width:"short",context:"formatting"});case"iiii":default:return s.day(r,{width:"wide",context:"formatting"})}},a:function(e,n,s){const a=e.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,n,s){const r=e.getHours();let a;switch(r===12?a=vn.noon:r===0?a=vn.midnight:a=r/12>=1?"pm":"am",n){case"b":case"bb":return s.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,n,s){const r=e.getHours();let a;switch(r>=17?a=vn.evening:r>=12?a=vn.afternoon:r>=4?a=vn.morning:a=vn.night,n){case"B":case"BB":case"BBB":return s.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,n,s){if(n==="ho"){let r=e.getHours()%12;return r===0&&(r=12),s.ordinalNumber(r,{unit:"hour"})}return Pt.h(e,n)},H:function(e,n,s){return n==="Ho"?s.ordinalNumber(e.getHours(),{unit:"hour"}):Pt.H(e,n)},K:function(e,n,s){const r=e.getHours()%12;return n==="Ko"?s.ordinalNumber(r,{unit:"hour"}):he(r,n.length)},k:function(e,n,s){let r=e.getHours();return r===0&&(r=24),n==="ko"?s.ordinalNumber(r,{unit:"hour"}):he(r,n.length)},m:function(e,n,s){return n==="mo"?s.ordinalNumber(e.getMinutes(),{unit:"minute"}):Pt.m(e,n)},s:function(e,n,s){return n==="so"?s.ordinalNumber(e.getSeconds(),{unit:"second"}):Pt.s(e,n)},S:function(e,n){return Pt.S(e,n)},X:function(e,n,s){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(n){case"X":return qa(r);case"XXXX":case"XX":return Zt(r);case"XXXXX":case"XXX":default:return Zt(r,":")}},x:function(e,n,s){const r=e.getTimezoneOffset();switch(n){case"x":return qa(r);case"xxxx":case"xx":return Zt(r);case"xxxxx":case"xxx":default:return Zt(r,":")}},O:function(e,n,s){const r=e.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+Ba(r,":");case"OOOO":default:return"GMT"+Zt(r,":")}},z:function(e,n,s){const r=e.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+Ba(r,":");case"zzzz":default:return"GMT"+Zt(r,":")}},t:function(e,n,s){const r=Math.trunc(+e/1e3);return he(r,n.length)},T:function(e,n,s){return he(+e,n.length)}};function Ba(e,n=""){const s=e>0?"-":"+",r=Math.abs(e),a=Math.trunc(r/60),o=r%60;return o===0?s+String(a):s+String(a)+n+he(o,2)}function qa(e,n){return e%60===0?(e>0?"-":"+")+he(Math.abs(e)/60,2):Zt(e,n)}function Zt(e,n=""){const s=e>0?"-":"+",r=Math.abs(e),a=he(Math.trunc(r/60),2),o=he(r%60,2);return s+a+n+o}const Ya=(e,n)=>{switch(e){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},cl=(e,n)=>{switch(e){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},vh=(e,n)=>{const s=e.match(/(P+)(p+)?/)||[],r=s[1],a=s[2];if(!a)return Ya(e,n);let o;switch(r){case"P":o=n.dateTime({width:"short"});break;case"PP":o=n.dateTime({width:"medium"});break;case"PPP":o=n.dateTime({width:"long"});break;case"PPPP":default:o=n.dateTime({width:"full"});break}return o.replace("{{date}}",Ya(r,n)).replace("{{time}}",cl(a,n))},wh={p:cl,P:vh},jh=/^D+$/,Nh=/^Y+$/,kh=["D","DD","YY","YYYY"];function Sh(e){return jh.test(e)}function Ch(e){return Nh.test(e)}function Mh(e,n,s){const r=Dh(e,n,s);if(console.warn(r),kh.includes(e))throw new RangeError(r)}function Dh(e,n,s){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${n}\`) for formatting ${r} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Oh=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Eh=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,_h=/^'([^]*?)'?$/,Th=/''/g,Ph=/[a-zA-Z]/;function le(e,n,s){var u,m,x,f,b,w,S,g;const r=gs(),a=(s==null?void 0:s.locale)??r.locale??Nn,o=(s==null?void 0:s.firstWeekContainsDate)??((m=(u=s==null?void 0:s.locale)==null?void 0:u.options)==null?void 0:m.firstWeekContainsDate)??r.firstWeekContainsDate??((f=(x=r.locale)==null?void 0:x.options)==null?void 0:f.firstWeekContainsDate)??1,i=(s==null?void 0:s.weekStartsOn)??((w=(b=s==null?void 0:s.locale)==null?void 0:b.options)==null?void 0:w.weekStartsOn)??r.weekStartsOn??((g=(S=r.locale)==null?void 0:S.options)==null?void 0:g.weekStartsOn)??0,l=pe(e,s==null?void 0:s.in);if(!Pf(l))throw new RangeError("Invalid time value");let d=n.match(Eh).map(v=>{const N=v[0];if(N==="p"||N==="P"){const k=wh[N];return k(v,a.formatLong)}return v}).join("").match(Oh).map(v=>{if(v==="''")return{isToken:!1,value:"'"};const N=v[0];if(N==="'")return{isToken:!1,value:Ih(v)};if(Fa[N])return{isToken:!0,value:v};if(N.match(Ph))throw new RangeError("Format string contains an unescaped latin alphabet character `"+N+"`");return{isToken:!1,value:v}});a.localize.preprocessor&&(d=a.localize.preprocessor(l,d));const c={firstWeekContainsDate:o,weekStartsOn:i,locale:a};return d.map(v=>{if(!v.isToken)return v.value;const N=v.value;(!(s!=null&&s.useAdditionalWeekYearTokens)&&Ch(N)||!(s!=null&&s.useAdditionalDayOfYearTokens)&&Sh(N))&&Mh(N,n,String(e));const k=Fa[N[0]];return k(l,N,a.localize,c)}).join("")}function Ih(e){const n=e.match(_h);return n?n[1].replace(Th,"'"):e}function $h(e,n){const s=pe(e,n==null?void 0:n.in),r=s.getFullYear(),a=s.getMonth(),o=Te(s,0);return o.setFullYear(r,a+1,0),o.setHours(0,0,0,0),o.getDate()}function Rh(e,n){return pe(e,n==null?void 0:n.in).getMonth()}function Ah(e,n){return pe(e,n==null?void 0:n.in).getFullYear()}function Wh(e,n){return+pe(e)>+pe(n)}function zh(e,n){return+pe(e)<+pe(n)}function Fh(e,n,s){const[r,a]=$n(s==null?void 0:s.in,e,n);return r.getFullYear()===a.getFullYear()&&r.getMonth()===a.getMonth()}function Bh(e,n,s){const[r,a]=$n(s==null?void 0:s.in,e,n);return r.getFullYear()===a.getFullYear()}function qh(e,n,s){const r=pe(e,s==null?void 0:s.in),a=r.getFullYear(),o=r.getDate(),i=Te(e,0);i.setFullYear(a,n,15),i.setHours(0,0,0,0);const l=$h(i);return r.setMonth(n,Math.min(o,l)),r}function Yh(e,n,s){const r=pe(e,s==null?void 0:s.in);return isNaN(+r)?Te(e,NaN):(r.setFullYear(n),r)}function Hh(){const[e,n]=h.useState(!1),[s,r]=h.useState(""),{workspace:a}=et(),{data:o,isLoading:i}=Bs(),l=Hu(),d=Ge(),c=(o??[]).filter(u=>!s||u.name.toLowerCase().includes(s.toLowerCase())||u.identifier.toLowerCase().includes(s.toLowerCase()));return t.jsxs("div",{className:"p-2",children:[t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[t.jsx("h1",{className:"text-base font-semibold",children:"Projects"}),t.jsxs(ee,{size:"sm",onClick:()=>n(!0),children:[t.jsx(Ye,{className:"h-4 w-4"}),"Create"]})]}),t.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[t.jsx("div",{className:"flex items-center gap-2",children:t.jsx(ee,{variant:"outline",size:"sm",className:"text-xs h-8",children:"Add filter"})}),t.jsxs("div",{className:"relative",children:[t.jsx(Fs,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),t.jsx(Ne,{placeholder:"Search...",value:s,onChange:u=>r(u.target.value),className:"pl-8 h-8 w-[200px] text-xs bg-transparent"})]})]}),t.jsxs("div",{className:"grid grid-cols-[2fr_1fr_1fr_1fr_40px] items-center px-6 py-2.5 border-b border-border",children:[t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Project"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Identifier"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Status"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Created"}),t.jsx("span",{})]}),i?t.jsx("div",{className:"divide-y divide-border",children:[1,2,3].map(u=>t.jsxs("div",{className:"grid grid-cols-[2fr_1fr_1fr_1fr_40px] items-center px-6 py-3",children:[t.jsx(ue,{className:"h-4 w-48"}),t.jsx(ue,{className:"h-4 w-12"}),t.jsx(ue,{className:"h-5 w-16 rounded-full"}),t.jsx(ue,{className:"h-4 w-24"}),t.jsx("div",{})]},u))}):c.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[t.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:t.jsx(pt,{className:"h-5 w-5 text-muted-foreground"})}),t.jsx("p",{className:"text-sm font-medium mb-1",children:s?"No projects match":"No projects yet"}),t.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:s?"Try a different search term.":"Create your first project to get started."}),!s&&t.jsxs(ee,{size:"sm",onClick:()=>n(!0),children:[t.jsx(Ye,{className:"h-4 w-4"}),"Create project"]})]}):t.jsx("div",{className:"divide-y divide-border",children:c.map(u=>t.jsxs("div",{className:"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:()=>d(`/${a}/projects/${u.identifier}/board`),children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:u.name}),u.description&&t.jsx("span",{className:"text-xs text-muted-foreground truncate hidden xl:block",children:u.description})]}),t.jsx("span",{className:"text-sm text-muted-foreground font-mono",children:u.identifier}),t.jsx("div",{children:t.jsxs("span",{className:I("inline-flex items-center gap-1.5 text-xs",u.status==="active"&&"text-emerald-600",u.status==="paused"&&"text-amber-600",u.status==="archived"&&"text-muted-foreground"),children:[t.jsx("span",{className:I("h-1.5 w-1.5 rounded-full shrink-0",u.status==="active"&&"bg-emerald-500",u.status==="paused"&&"bg-amber-500",u.status==="archived"&&"bg-zinc-400")}),u.status.charAt(0).toUpperCase()+u.status.slice(1)]})}),t.jsx("span",{className:"text-sm text-muted-foreground",children:le(new Date(u.created_at),"MMM d, yyyy")}),t.jsx("div",{className:"flex justify-end",onClick:m=>m.stopPropagation(),children:t.jsxs(qs,{children:[t.jsx(Ys,{asChild:!0,children:t.jsx(ee,{variant:"ghost",size:"icon-sm",className:"h-7 w-7 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(xi,{className:"h-4 w-4"})})}),t.jsxs(ms,{align:"end",children:[t.jsxs(kt,{onClick:()=>d(`/${a}/projects/${u.identifier}/board`),children:[t.jsx(pt,{className:"h-4 w-4"}),"Open board"]}),t.jsxs(kt,{onClick:()=>d(`/${a}/projects/${u.identifier}/issues`),children:[t.jsx(As,{className:"h-4 w-4"}),"View issues"]}),t.jsx(Hs,{}),t.jsxs(kt,{className:"text-destructive focus:text-destructive",onClick:()=>{confirm(`Delete "${u.name}"? This cannot be undone.`)&&l.mutate(u.id,{onSuccess:()=>Q.success("Project deleted"),onError:()=>Q.error("Failed to delete project")})},children:[t.jsx(cs,{className:"h-4 w-4"}),"Delete"]})]})]})})]},u.id))}),!i&&c.length>0&&t.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-t border-border",children:[t.jsxs("span",{className:"text-xs text-muted-foreground",children:["1 — ",c.length," of ",c.length," result",c.length!==1?"s":""]}),t.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.jsx("span",{children:"1 of 1 pages"}),t.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 text-xs",disabled:!0,children:"Prev"}),t.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 text-xs",disabled:!0,children:"Next"})]})]})]}),t.jsx(kf,{open:e,onClose:()=>n(!1)})]})}const Ce={all:["issues"],byProject:e=>[...Ce.all,"project",e],detail:e=>[...Ce.all,e],comments:e=>[...Ce.all,e,"comments"],activities:e=>[...Ce.all,e,"activities"]};function bs(e){return Ie({queryKey:e?Ce.byProject(e):Ce.all,queryFn:()=>{const n=e?`/admin/issues?project_id=${e}`:"/admin/issues";return oe.get(n)},select:n=>n.issues})}function Lh(e){return Ie({queryKey:Ce.detail(e),queryFn:()=>oe.get(`/admin/issues/${e}`),select:n=>n.issue,enabled:!!e})}function Vh(e){return Ie({queryKey:Ce.comments(e),queryFn:()=>oe.get(`/admin/issues/${e}/comments`),select:n=>n.comments,enabled:!!e})}function ul(){const e=ke();return ye({mutationFn:n=>oe.post("/admin/issues",n),onSuccess:(n,s)=>{e.invalidateQueries({queryKey:Ce.byProject(s.project_id)})}})}function da(e,n){const s=ke();return ye({mutationFn:r=>oe.put(`/admin/issues/${e}`,r),onMutate:async r=>{await s.cancelQueries({queryKey:Ce.byProject(n)});const a=s.getQueryData(Ce.byProject(n));return s.setQueryData(Ce.byProject(n),o=>o&&{...o,issues:o.issues.map(i=>i.id===e?{...i,...r}:i)}),{previous:a}},onError:(r,a,o)=>{o!=null&&o.previous&&s.setQueryData(Ce.byProject(n),o.previous)},onSettled:()=>{s.invalidateQueries({queryKey:Ce.byProject(n)}),s.invalidateQueries({queryKey:Ce.detail(e)})}})}function Uh(e){return Ie({queryKey:Ce.activities(e),queryFn:()=>oe.get(`/admin/issues/${e}/activities`),select:n=>n.activities,enabled:!!e})}function Kh(e){const n=ke();return ye({mutationFn:s=>oe.post(`/admin/issues/${e}/comments`,{body:s}),onSuccess:()=>{n.invalidateQueries({queryKey:Ce.comments(e)})}})}const ca={byProject:e=>["projects",e,"statuses"]};function Rn(e){return Ie({queryKey:ca.byProject(e??""),queryFn:()=>oe.get(`/admin/projects/${e}/statuses`),select:n=>n.statuses,enabled:!!e})}function Gh(e){const n=ke();return ye({mutationFn:s=>oe.post(`/admin/projects/${e}/statuses`,s),onSuccess:()=>{n.invalidateQueries({queryKey:ca.byProject(e)})}})}function Qh(e){const n=ke();return ye({mutationFn:s=>oe.post(`/admin/projects/${e}/statuses/reorder`,{orderedIds:s}),onSuccess:()=>{n.invalidateQueries({queryKey:ca.byProject(e)})}})}const ua={all:["users"],list:()=>[...ua.all,"list"]};function Xh(){return Ie({queryKey:ua.list(),queryFn:()=>oe.get("/admin/users"),select:e=>e.users,staleTime:1e3*60*5})}function ml(){return Ie({queryKey:[...ua.list(),"map"],queryFn:()=>oe.get("/admin/users"),select:e=>new Map(e.users.map(n=>{var i;const s=n.first_name??"",r=n.last_name??"",a=`${s} ${r}`.trim()||n.email,o=(s[0]??r[0]??((i=n.email)==null?void 0:i[0])??"U").toUpperCase();return[n.id,{name:a,initials:o}]})),staleTime:1e3*60*5})}const un={backlog:"Backlog",todo:"Todo",in_progress:"In Progress",in_review:"In Review",done:"Done",cancelled:"Cancelled"},St={urgent:"Urgent",high:"High",medium:"Medium",low:"Low",none:"None"},fl={urgent:"text-red-500",high:"text-orange-500",medium:"text-yellow-500",low:"text-blue-400",none:"text-zinc-400"},zt={task:"Task",bug:"Bug",feature:"Feature",improvement:"Improvement",epic:"Epic"},Jh=({priority:e})=>{const n=I("h-3 w-3 shrink-0",fl[e]);switch(e){case"urgent":return t.jsx(us,{className:n});case"high":return t.jsx($s,{className:n});case"medium":return t.jsx(ds,{className:n});case"low":return t.jsx(Is,{className:n});default:return t.jsx(xt,{className:"h-3 w-3 shrink-0 text-zinc-300"})}};function hl({issue:e,onClick:n}){var u,m;const{data:s}=ml(),{attributes:r,listeners:a,setNodeRef:o,transform:i,transition:l,isDragging:d}=zr({id:e.id}),c={transform:Fr.Transform.toString(i),transition:l};return t.jsxs("div",{ref:o,style:c,...r,...a,onClick:n,className:I("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:[t.jsx("p",{className:"text-[13px] text-foreground leading-snug line-clamp-2 mb-2",children:e.title}),t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("span",{className:"text-[11px] font-mono text-muted-foreground",children:e.identifier}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[(e.assignee_ids??[]).length>0&&t.jsxs("div",{className:"flex -space-x-1",children:[(e.assignee_ids??[]).slice(0,2).map(x=>{const f=s==null?void 0:s.get(x);return t.jsx(At,{className:"h-4 w-4 border border-background",children:t.jsx(Wt,{className:"text-[8px] bg-indigo-100 text-indigo-700 dark:bg-indigo-900/50 dark:text-indigo-300",children:(f==null?void 0:f.initials)??"?"})},x)}),(((u=e.assignee_ids)==null?void 0:u.length)??0)>2&&t.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]})]}),t.jsx(Jh,{priority:e.priority})]})]})]})}function pr(e,n){const s=e.replace("#",""),r=parseInt(s.substring(0,2),16),a=parseInt(s.substring(2,4),16),o=parseInt(s.substring(4,6),16);return isNaN(r)||isNaN(a)||isNaN(o)?`rgba(148,163,184,${n})`:`rgba(${r},${a},${o},${n})`}const Zh=({category:e,color:n})=>{const s="h-3.5 w-3.5 shrink-0",r={color:n};switch(e){case"completed":return t.jsx(mn,{className:s,style:r});case"started":return t.jsx(Yt,{className:s,style:r});default:return t.jsx(xt,{className:s,style:r})}};function ex({id:e,label:n,color:s,category:r,issues:a,sortable:o,onIssueClick:i}){const{setNodeRef:l,isOver:d}=gd({id:e}),{attributes:c,listeners:u,setNodeRef:m,transform:x,transition:f,isDragging:b}=zr({id:e,disabled:!o}),w=o?{transform:Fr.Transform.toString(x),transition:f}:void 0,S=pr(s,.08),g=pr(s,.16),v=pr(s,.35);return t.jsxs("div",{ref:m,style:w,className:I("flex flex-col min-w-[260px] max-w-[280px] w-full",b&&"opacity-50"),children:[t.jsxs("div",{className:I("flex items-center gap-2 mb-2 px-1",o&&"cursor-grab"),children:[o&&t.jsx("span",{...c,...u,className:"text-muted-foreground/40 hover:text-muted-foreground touch-none",children:t.jsx(gi,{className:"h-3.5 w-3.5"})}),t.jsx(Zh,{category:r,color:s}),t.jsx("span",{className:"text-xs font-medium text-foreground",children:n}),t.jsx("span",{className:"ml-1 text-[11px] text-muted-foreground bg-muted rounded-full px-1.5 py-0.5 tabular-nums min-w-[18px] text-center",children:a.length})]}),t.jsxs("div",{ref:l,className:I("flex-1 flex flex-col gap-2 min-h-[200px] p-2 rounded-xl transition-colors"),style:{backgroundColor:d?g:S,boxShadow:d?`inset 0 0 0 1px ${v}`:void 0},children:[t.jsx(Wr,{items:a.map(N=>N.id),strategy:bd,children:a.map(N=>t.jsx(hl,{issue:N,onClick:()=>i==null?void 0:i(N)},N.id))}),a.length===0&&t.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[120px]",children:t.jsx("p",{className:"text-xs text-muted-foreground/40",children:"Drop here"})})]})]})}const _e=dd,Be=cd,De=h.forwardRef(({className:e,children:n,...s},r)=>t.jsxs(ko,{ref:r,className:I("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),...s,children:[n,t.jsx(rd,{asChild:!0,children:t.jsx(is,{className:"h-4 w-4 opacity-50"})})]}));De.displayName=ko.displayName;const xl=h.forwardRef(({className:e,...n},s)=>t.jsx(So,{ref:s,className:I("flex cursor-default items-center justify-center py-1",e),...n,children:t.jsx(Ur,{className:"h-4 w-4"})}));xl.displayName=So.displayName;const pl=h.forwardRef(({className:e,...n},s)=>t.jsx(Co,{ref:s,className:I("flex cursor-default items-center justify-center py-1",e),...n,children:t.jsx(is,{className:"h-4 w-4"})}));pl.displayName=Co.displayName;const Oe=h.forwardRef(({className:e,children:n,position:s="popper",...r},a)=>t.jsx(ad,{children:t.jsxs(Mo,{ref:a,className:I("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",s==="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:s,...r,children:[t.jsx(xl,{}),t.jsx(od,{className:I("p-1",s==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),t.jsx(pl,{})]})}));Oe.displayName=Mo.displayName;const tx=h.forwardRef(({className:e,...n},s)=>t.jsx(Do,{ref:s,className:I("px-2 py-1.5 text-xs font-medium text-muted-foreground",e),...n}));tx.displayName=Do.displayName;const me=h.forwardRef(({className:e,children:n,...s},r)=>t.jsxs(Oo,{ref:r,className:I("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),...s,children:[t.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(id,{children:t.jsx(wt,{className:"h-4 w-4"})})}),t.jsx(ld,{children:n})]}));me.displayName=Oo.displayName;const nx=h.forwardRef(({className:e,...n},s)=>t.jsx(Eo,{ref:s,className:I("-mx-1 my-1 h-px bg-border",e),...n}));nx.displayName=Eo.displayName;const gr=["#94a3b8","#64748b","#6366f1","#f59e0b","#10b981","#ef4444","#3b82f6","#8b5cf6"],sx=[{value:"backlog",label:"Backlog"},{value:"unstarted",label:"Not Started"},{value:"started",label:"In Progress"},{value:"completed",label:"Done"},{value:"cancelled",label:"Cancelled"}];function rx({open:e,onClose:n,projectId:s}){const[r,a]=h.useState(""),[o,i]=h.useState(gr[0]),[l,d]=h.useState(""),[c,u]=h.useState("started"),m=Gh(s),x=l||o,f=()=>{r.trim()&&m.mutate({name:r.trim(),color:x,category:c},{onSuccess:()=>{Q.success("Status created"),a(""),i(gr[0]),d(""),u("started"),n()},onError:()=>Q.error("Failed to create status")})};return t.jsx(fn,{open:e,onOpenChange:b=>!b&&n(),children:t.jsxs(hn,{className:"sm:max-w-sm",children:[t.jsx(xn,{children:t.jsx(pn,{className:"text-sm font-medium",children:"New Status"})}),t.jsx(In,{children:t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Name"}),t.jsx(Ne,{placeholder:"e.g. In Review",value:r,onChange:b=>a(b.target.value),onKeyDown:b=>b.key==="Enter"&&f(),autoFocus:!0,className:"h-8 text-sm"})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Color"}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[gr.map(b=>t.jsx("button",{onClick:()=>{i(b),d("")},className:I("h-6 w-6 rounded-full border-2 transition-transform hover:scale-110",o===b&&!l?"border-foreground scale-110":"border-transparent"),style:{backgroundColor:b}},b)),t.jsxs("div",{className:"flex items-center gap-1.5 ml-1",children:[t.jsx("div",{className:"h-6 w-6 rounded-full border border-border shrink-0",style:{backgroundColor:l||"#e5e7eb"}}),t.jsx(Ne,{placeholder:"#hex",value:l,onChange:b=>d(b.target.value),className:"h-6 w-20 text-xs px-1.5"})]})]})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Category"}),t.jsxs(_e,{value:c,onValueChange:b=>u(b),children:[t.jsx(De,{className:"h-8 text-xs",children:t.jsx(Be,{})}),t.jsx(Oe,{children:sx.map(b=>t.jsx(me,{value:b.value,className:"text-xs",children:b.label},b.value))})]})]})]})}),t.jsxs(ps,{className:"mt-2",children:[t.jsx(ee,{variant:"ghost",size:"sm",onClick:n,className:"text-xs",children:"Cancel"}),t.jsx(ee,{size:"sm",onClick:f,disabled:!r.trim()||m.isPending,className:"text-xs",children:"Create"})]})]})})}function ax({projectId:e}){const[n,s]=h.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex flex-col min-w-[260px] max-w-[280px] w-full",children:t.jsxs("button",{onClick:()=>s(!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:[t.jsx(Ye,{className:"h-3.5 w-3.5"}),"Add status"]})}),t.jsx(rx,{open:n,onClose:()=>s(!1),projectId:e})]})}function br(e,n){var r;const s={};for(const a of n)s[a.key]=[];for(const a of e)if(s[a.status]!==void 0)s[a.status].push(a);else{const o=((r=n[0])==null?void 0:r.key)??"backlog";s[o]=[...s[o]??[],a]}return s}function ox(e,n,s){var o;const r=new Map(n.map(i=>[i.id,i])),a={};for(const i of s)a[i.key]=[];for(const i of s)for(const l of e[i.key]??[]){const d=r.get(l.id);d&&d.status===i.key&&(a[i.key].push(d),r.delete(l.id))}for(const i of r.values()){const l=a[i.status];if(l)l.push(i);else{const d=(o=s[0])==null?void 0:o.key;d&&a[d].push(i)}}return a}function ix({issues:e,projectId:n,statuses:s,onIssueClick:r,onColumnsReorder:a}){const[o,i]=h.useState(()=>s.map(M=>M.id)),[l,d]=h.useState(()=>br(e,s)),[c,u]=h.useState(null),[m,x]=h.useState(null),f=h.useRef(null),b=h.useRef(!1),w=ke();h.useEffect(()=>{b.current||d(M=>ox(M,e,s))},[e,s]);const S=[...s].sort((M,E)=>{const R=o.indexOf(M.id),B=o.indexOf(E.id);return R===-1&&B===-1?M.position-E.position:R===-1?1:B===-1?-1:R-B}),g=Io($o(Wo,{activationConstraint:{distance:5}})),v=h.useCallback(M=>{for(const[E,R]of Object.entries(l))if(R.some(B=>B.id===M))return E;return null},[l]),N=h.useCallback(M=>s.some(E=>E.id===M),[s]),k=M=>{const E=M.active.id;if(b.current=!0,N(E)){x(E);return}for(const[R,B]of Object.entries(l)){const $=B.find(W=>W.id===E);if($){u($),f.current=R;return}}},O=M=>{const{active:E,over:R}=M;if(!R||m)return;const B=E.id,$=R.id;if(N(B))return;const W=v(B),P=s.find(_=>_.key===$||_.id===$),U=(P==null?void 0:P.key)??v($);!W||!U||W===U||d(_=>{const Y=[..._[W]??[]],X=[..._[U]??[]],A=Y.findIndex(D=>D.id===B);if(A===-1)return _;const[j]=Y.splice(A,1),G={...j,status:U};if(P)X.push(G);else{const D=X.findIndex(z=>z.id===$);if(D===-1)X.push(G);else{const z=E.rect.current.translated!=null&&E.rect.current.translated.top>R.rect.top+R.rect.height/2;X.splice(z?D+1:D,0,G)}}return{..._,[W]:Y,[U]:X}})},p=M=>{var _;const{active:E,over:R}=M;if(u(null),b.current=!1,m){if(x(null),!R||E.id===R.id)return;const Y=o.indexOf(E.id),X=o.indexOf(R.id);if(Y===-1||X===-1||Y===X)return;const A=Ds(o,Y,X);i(A),a==null||a(A);return}if(!R){const Y=f.current;f.current=null,Y&&d(br(e,s));return}const B=E.id,$=R.id,W=f.current;f.current=null;const P=s.find(Y=>Y.key===$||Y.id===$),U=(P==null?void 0:P.key)??v($);if(!(!W||!U))if(W===U)d(Y=>{const X=Y[W]??[],A=X.findIndex(G=>G.id===B),j=X.findIndex(G=>G.id===$);return A===-1||j===-1||A===j?Y:{...Y,[W]:Ds(X,A,j)}});else{if(!s.find(A=>A.key===$||A.id===$))d(A=>{const j=[...A[U]??[]],G=j.findIndex(se=>se.id===B);if(G===-1)return A;const D=M.active.rect.current.translated!=null&&M.active.rect.current.translated.top>M.over.rect.top+M.over.rect.height/2,[z]=j.splice(G,1),L=j.findIndex(se=>se.id===$);if(L===-1)return j.splice(G,0,z),A;const H=D?L+1:L;return j.splice(H,0,z),{...A,[U]:j}});else{const A=((_=M.active.rect.current.translated)==null?void 0:_.top)??1/0,j=M.over.rect.top+M.over.rect.height/2;A<j&&d(G=>{const D=G[U]??[],z=D.findIndex(L=>L.id===B);return z<=0?G:{...G,[U]:Ds(D,z,0)}})}const X=w.getQueryData(Ce.byProject(n));w.setQueryData(Ce.byProject(n),A=>A&&{...A,issues:A.issues.map(j=>j.id===B?{...j,status:U}:j)}),oe.put(`/admin/issues/${B}`,{status:U}).then(()=>{w.invalidateQueries({queryKey:Ce.byProject(n)})}).catch(()=>{X&&w.setQueryData(Ce.byProject(n),X),d(br((X==null?void 0:X.issues)??e,s)),Q.error("Failed to update issue status")})}},C=m?s.find(M=>M.id===m):null;return t.jsxs(Ro,{sensors:g,collisionDetection:yd,onDragStart:k,onDragOver:O,onDragEnd:p,children:[t.jsxs("div",{className:"flex gap-4 h-full overflow-x-auto px-6 py-4 pb-6",children:[t.jsx(Wr,{items:o,strategy:Ao,children:S.map(M=>t.jsx(ex,{id:M.id,label:M.name,color:M.color,category:M.category,issues:l[M.key]??[],sortable:!0,onIssueClick:r},M.id))}),t.jsx(ax,{projectId:n})]}),t.jsxs(vd,{children:[c&&t.jsx(hl,{issue:c}),C&&t.jsx("div",{className:"opacity-80 min-w-[260px] max-w-[280px]",children:t.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:[t.jsx("div",{className:"h-3 w-3 rounded-full shrink-0",style:{backgroundColor:C.color}}),C.name]})})]})]})}const On={all:["sprints"],byProject:e=>["sprints","project",e],detail:e=>["sprints",e]};function An(e){return Ie({queryKey:e?On.byProject(e):On.all,queryFn:()=>{const n=e?`/admin/sprints?project_id=${e}`:"/admin/sprints";return oe.get(n)},select:n=>n.sprints,enabled:!!e})}function lx(e){const n=ke();return ye({mutationFn:s=>oe.post("/admin/sprints",{...s,project_id:e}),onSuccess:()=>{n.invalidateQueries({queryKey:On.byProject(e)})}})}function dx(e,n){const s=ke();return ye({mutationFn:r=>oe.put(`/admin/sprints/${e}`,r),onSuccess:()=>{s.invalidateQueries({queryKey:On.byProject(n)}),s.invalidateQueries({queryKey:On.detail(e)})}})}function cx(e){const n=ke();return ye({mutationFn:s=>oe.delete(`/admin/sprints/${s}`),onSuccess:()=>{n.invalidateQueries({queryKey:On.byProject(e)})}})}const Us={byProject:e=>["task-lists","project",e]};function ys(e){return Ie({queryKey:e?Us.byProject(e):["task-lists"],queryFn:()=>oe.get(`/admin/projects/${e}/task-lists`),select:n=>n.task_lists,enabled:!!e})}function ux(e){const n=ke();return ye({mutationFn:s=>oe.post(`/admin/projects/${e}/task-lists`,s),onSuccess:()=>{n.invalidateQueries({queryKey:Us.byProject(e)})}})}function mx(e){const n=ke();return ye({mutationFn:({id:s,...r})=>oe.put(`/admin/task-lists/${s}`,r),onSuccess:()=>{n.invalidateQueries({queryKey:Us.byProject(e)})}})}function fx(e){const n=ke();return ye({mutationFn:s=>oe.delete(`/admin/task-lists/${s}`),onSuccess:()=>{n.invalidateQueries({queryKey:Us.byProject(e)}),n.invalidateQueries({queryKey:Ce.byProject(e)})}})}const at=md,ot=fd,Je=h.forwardRef(({className:e,align:n="center",sideOffset:s=4,...r},a)=>t.jsx(ud,{children:t.jsx(_o,{ref:a,align:n,sideOffset:s,className:I("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),...r})}));Je.displayName=_o.displayName;function Ha(e,n,s){const r=(e==null?void 0:e[0])??"",a=(n==null?void 0:n[0])??"";return(r+a).toUpperCase()||((s==null?void 0:s[0])??"U").toUpperCase()}function La(e,n,s){return`${e??""} ${n??""}`.trim()||s}function vs({value:e,onChange:n,disabled:s}){const[r,a]=h.useState(!1),[o,i]=h.useState(e),{data:l}=Xh(),d=e.slice().sort().join(",");h.useEffect(()=>{i(e)},[d]);const c=m=>{const x=o.includes(m)?o.filter(f=>f!==m):[...o,m];i(x),n(x)},u=(l??[]).filter(m=>o.includes(m.id));return t.jsxs(at,{open:r,onOpenChange:a,children:[t.jsx(ot,{asChild:!0,disabled:s,children:t.jsx("button",{type:"button",className:I("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",s&&"pointer-events-none opacity-50"),children:u.length===0?t.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[t.jsx(Si,{className:"h-3.5 w-3.5"}),"Assign"]}):t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("div",{className:"flex -space-x-1.5",children:u.slice(0,3).map(m=>t.jsx(At,{className:"h-5 w-5 border border-background ring-0",children:t.jsx(Wt,{className:"text-[9px] bg-indigo-100 text-indigo-700 dark:bg-indigo-900/50 dark:text-indigo-300",children:Ha(m.first_name,m.last_name,m.email)})},m.id))}),u.length>3&&t.jsxs("span",{className:"text-[10px] text-muted-foreground ml-1",children:["+",u.length-3]}),t.jsx("span",{className:"text-xs text-foreground ml-1 hidden sm:inline",children:u.length===1?La(u[0].first_name,u[0].last_name,u[0].email):`${u.length} assignees`})]})})}),t.jsx(Je,{className:"w-60 p-0",align:"start",children:t.jsxs(Cn,{children:[t.jsx(sa,{placeholder:"Search users...",className:"h-8 text-xs"}),t.jsxs(Mn,{children:[t.jsx(ra,{className:"text-xs py-4",children:"No users found."}),t.jsx(on,{children:(l??[]).map(m=>{const x=o.includes(m.id),f=La(m.first_name,m.last_name,m.email),b=Ha(m.first_name,m.last_name,m.email);return t.jsxs(rt,{value:f,onSelect:()=>c(m.id),className:"gap-2 py-1.5",children:[t.jsx(At,{className:"h-5 w-5 shrink-0",children:t.jsx(Wt,{className:"text-[9px] bg-muted text-muted-foreground",children:b})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-xs font-medium truncate",children:f}),t.jsx("p",{className:"text-[10px] text-muted-foreground truncate",children:m.email})]}),t.jsx(wt,{className:I("h-3.5 w-3.5 shrink-0",x?"opacity-100 text-indigo-500":"opacity-0")})]},m.id)})})]})]})})]})}function hx(e,n,s="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:s}).format(n).split(/\s/g).slice(2).join(" ")}const yr={},Xn={};function nn(e,n){try{const r=(yr[e]||(yr[e]=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format))(n).split("GMT")[1];return r in Xn?Xn[r]:Va(r,r.split(":"))}catch{if(e in Xn)return Xn[e];const s=e==null?void 0:e.match(xx);return s?Va(e,s.slice(1)):NaN}}const xx=/([+-]\d\d):?(\d\d)?/;function Va(e,n){const s=+(n[0]||0),r=+(n[1]||0),a=+(n[2]||0)/60;return Xn[e]=s*60+r>0?s*60+r+a:s*60-r-a}class ht extends Date{constructor(...n){super(),n.length>1&&typeof n[n.length-1]=="string"&&(this.timeZone=n.pop()),this.internal=new Date,isNaN(nn(this.timeZone,this))?this.setTime(NaN):n.length?typeof n[0]=="number"&&(n.length===1||n.length===2&&typeof n[1]!="number")?this.setTime(n[0]):typeof n[0]=="string"?this.setTime(+new Date(n[0])):n[0]instanceof Date?this.setTime(+n[0]):(this.setTime(+new Date(...n)),gl(this),Pr(this)):this.setTime(Date.now())}static tz(n,...s){return s.length?new ht(...s,n):new ht(Date.now(),n)}withTimeZone(n){return new ht(+this,n)}getTimezoneOffset(){const n=-nn(this.timeZone,this);return n>0?Math.floor(n):Math.ceil(n)}setTime(n){return Date.prototype.setTime.apply(this,arguments),Pr(this),+this}[Symbol.for("constructDateFrom")](n){return new ht(+new Date(n),this.timeZone)}}const Ua=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!Ua.test(e))return;const n=e.replace(Ua,"$1UTC");ht.prototype[n]&&(e.startsWith("get")?ht.prototype[e]=function(){return this.internal[n]()}:(ht.prototype[e]=function(){return Date.prototype[n].apply(this.internal,arguments),px(this),+this},ht.prototype[n]=function(){return Date.prototype[n].apply(this,arguments),Pr(this),+this}))});function Pr(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-nn(e.timeZone,e)*60))}function px(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()),gl(e)}function gl(e){const n=nn(e.timeZone,e),s=n>0?Math.floor(n):Math.ceil(n),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);const a=-new Date(+e).getTimezoneOffset(),o=-new Date(+r).getTimezoneOffset(),i=a-o,l=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();i&&l&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+i);const d=a-s;d&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+d);const c=new Date(+e);c.setUTCSeconds(0);const u=a>0?c.getSeconds():(c.getSeconds()-60)%60,m=Math.round(-(nn(e.timeZone,e)*60))%60;(m||u)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+m),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+m+u));const x=nn(e.timeZone,e),f=x>0?Math.floor(x):Math.ceil(x),w=-new Date(+e).getTimezoneOffset()-f,S=f!==s,g=w-d;if(S&&g){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+g);const v=nn(e.timeZone,e),N=v>0?Math.floor(v):Math.ceil(v),k=f-N;k&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+k),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+k))}}class Fe extends ht{static tz(n,...s){return s.length?new Fe(...s,n):new Fe(Date.now(),n)}toISOString(){const[n,s,r]=this.tzComponents(),a=`${n}${s}:${r}`;return this.internal.toISOString().slice(0,-1)+a}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[n,s,r,a]=this.internal.toUTCString().split(" ");return`${n==null?void 0:n.slice(0,-1)} ${r} ${s} ${a}`}toTimeString(){const n=this.internal.toUTCString().split(" ")[4],[s,r,a]=this.tzComponents();return`${n} GMT${s}${r}${a} (${hx(this.timeZone,this)})`}toLocaleString(n,s){return Date.prototype.toLocaleString.call(this,n,{...s,timeZone:(s==null?void 0:s.timeZone)||this.timeZone})}toLocaleDateString(n,s){return Date.prototype.toLocaleDateString.call(this,n,{...s,timeZone:(s==null?void 0:s.timeZone)||this.timeZone})}toLocaleTimeString(n,s){return Date.prototype.toLocaleTimeString.call(this,n,{...s,timeZone:(s==null?void 0:s.timeZone)||this.timeZone})}tzComponents(){const n=this.getTimezoneOffset(),s=n>0?"-":"+",r=String(Math.floor(Math.abs(n)/60)).padStart(2,"0"),a=String(Math.abs(n)%60).padStart(2,"0");return[s,r,a]}withTimeZone(n){return new Fe(+this,n)}[Symbol.for("constructDateFrom")](n){return new Fe(+new Date(n),this.timeZone)}}const Ka=5,gx=4;function bx(e,n){const s=n.startOfMonth(e),r=s.getDay()>0?s.getDay():7,a=n.addDays(e,-r+1),o=n.addDays(a,Ka*7-1);return n.getMonth(e)===n.getMonth(o)?Ka:gx}function bl(e,n){const s=n.startOfMonth(e),r=s.getDay();return r===1?s:r===0?n.addDays(s,-1*6):n.addDays(s,-1*(r-1))}function yx(e,n){const s=bl(e,n),r=bx(e,n);return n.addDays(s,r*7-1)}const yl={...Nn,labels:{labelDayButton:(e,n,s,r)=>{let a;r&&typeof r.format=="function"?a=r.format.bind(r):a=(i,l)=>le(i,l,{locale:Nn,...s});let o=a(e,"PPPP");return n.today&&(o=`Today, ${o}`),n.selected&&(o=`${o}, selected`),o},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,n,s)=>{let r;return s&&typeof s.format=="function"?r=s.format.bind(s):r=(a,o)=>le(a,o,{locale:Nn,...n}),r(e,"LLLL yyyy")},labelGridcell:(e,n,s,r)=>{let a;r&&typeof r.format=="function"?a=r.format.bind(r):a=(i,l)=>le(i,l,{locale:Nn,...s});let o=a(e,"PPPP");return n!=null&&n.today&&(o=`Today, ${o}`),o},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(e,n,s)=>{let r;return s&&typeof s.format=="function"?r=s.format.bind(s):r=(a,o)=>le(a,o,{locale:Nn,...n}),r(e,"cccc")}}};class Ke{constructor(n,s){this.Date=Date,this.today=()=>{var r;return(r=this.overrides)!=null&&r.today?this.overrides.today():this.options.timeZone?Fe.tz(this.options.timeZone):new this.Date},this.newDate=(r,a,o)=>{var i;return(i=this.overrides)!=null&&i.newDate?this.overrides.newDate(r,a,o):this.options.timeZone?new Fe(r,a,o,this.options.timeZone):new Date(r,a,o)},this.addDays=(r,a)=>{var o;return(o=this.overrides)!=null&&o.addDays?this.overrides.addDays(r,a):tl(r,a)},this.addMonths=(r,a)=>{var o;return(o=this.overrides)!=null&&o.addMonths?this.overrides.addMonths(r,a):nl(r,a)},this.addWeeks=(r,a)=>{var o;return(o=this.overrides)!=null&&o.addWeeks?this.overrides.addWeeks(r,a):Df(r,a)},this.addYears=(r,a)=>{var o;return(o=this.overrides)!=null&&o.addYears?this.overrides.addYears(r,a):Of(r,a)},this.differenceInCalendarDays=(r,a)=>{var o;return(o=this.overrides)!=null&&o.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,a):oa(r,a)},this.differenceInCalendarMonths=(r,a)=>{var o;return(o=this.overrides)!=null&&o.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,a):al(r,a)},this.eachMonthOfInterval=r=>{var a;return(a=this.overrides)!=null&&a.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):$f(r)},this.eachYearOfInterval=r=>{var l;const a=(l=this.overrides)!=null&&l.eachYearOfInterval?this.overrides.eachYearOfInterval(r):Wf(r),o=new Set(a.map(d=>this.getYear(d)));if(o.size===a.length)return a;const i=[];return o.forEach(d=>{i.push(new Date(d,0,1))}),i},this.endOfBroadcastWeek=r=>{var a;return(a=this.overrides)!=null&&a.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):yx(r,this)},this.endOfISOWeek=r=>{var a;return(a=this.overrides)!=null&&a.endOfISOWeek?this.overrides.endOfISOWeek(r):zf(r)},this.endOfMonth=r=>{var a;return(a=this.overrides)!=null&&a.endOfMonth?this.overrides.endOfMonth(r):If(r)},this.endOfWeek=(r,a)=>{var o;return(o=this.overrides)!=null&&o.endOfWeek?this.overrides.endOfWeek(r,a):ll(r,this.options)},this.endOfYear=r=>{var a;return(a=this.overrides)!=null&&a.endOfYear?this.overrides.endOfYear(r):Af(r)},this.format=(r,a,o)=>{var l;const i=(l=this.overrides)!=null&&l.format?this.overrides.format(r,a,this.options):le(r,a,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(i):i},this.getISOWeek=r=>{var a;return(a=this.overrides)!=null&&a.getISOWeek?this.overrides.getISOWeek(r):ia(r)},this.getMonth=(r,a)=>{var o;return(o=this.overrides)!=null&&o.getMonth?this.overrides.getMonth(r,this.options):Rh(r,this.options)},this.getYear=(r,a)=>{var o;return(o=this.overrides)!=null&&o.getYear?this.overrides.getYear(r,this.options):Ah(r,this.options)},this.getWeek=(r,a)=>{var o;return(o=this.overrides)!=null&&o.getWeek?this.overrides.getWeek(r,this.options):la(r,this.options)},this.isAfter=(r,a)=>{var o;return(o=this.overrides)!=null&&o.isAfter?this.overrides.isAfter(r,a):Wh(r,a)},this.isBefore=(r,a)=>{var o;return(o=this.overrides)!=null&&o.isBefore?this.overrides.isBefore(r,a):zh(r,a)},this.isDate=r=>{var a;return(a=this.overrides)!=null&&a.isDate?this.overrides.isDate(r):rl(r)},this.isSameDay=(r,a)=>{var o;return(o=this.overrides)!=null&&o.isSameDay?this.overrides.isSameDay(r,a):Tf(r,a)},this.isSameMonth=(r,a)=>{var o;return(o=this.overrides)!=null&&o.isSameMonth?this.overrides.isSameMonth(r,a):Fh(r,a)},this.isSameYear=(r,a)=>{var o;return(o=this.overrides)!=null&&o.isSameYear?this.overrides.isSameYear(r,a):Bh(r,a)},this.max=r=>{var a;return(a=this.overrides)!=null&&a.max?this.overrides.max(r):Ef(r)},this.min=r=>{var a;return(a=this.overrides)!=null&&a.min?this.overrides.min(r):_f(r)},this.setMonth=(r,a)=>{var o;return(o=this.overrides)!=null&&o.setMonth?this.overrides.setMonth(r,a):qh(r,a)},this.setYear=(r,a)=>{var o;return(o=this.overrides)!=null&&o.setYear?this.overrides.setYear(r,a):Yh(r,a)},this.startOfBroadcastWeek=(r,a)=>{var o;return(o=this.overrides)!=null&&o.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):bl(r,this)},this.startOfDay=r=>{var a;return(a=this.overrides)!=null&&a.startOfDay?this.overrides.startOfDay(r):ts(r)},this.startOfISOWeek=r=>{var a;return(a=this.overrides)!=null&&a.startOfISOWeek?this.overrides.startOfISOWeek(r):es(r)},this.startOfMonth=r=>{var a;return(a=this.overrides)!=null&&a.startOfMonth?this.overrides.startOfMonth(r):Rf(r)},this.startOfWeek=(r,a)=>{var o;return(o=this.overrides)!=null&&o.startOfWeek?this.overrides.startOfWeek(r,this.options):Dn(r,this.options)},this.startOfYear=r=>{var a;return(a=this.overrides)!=null&&a.startOfYear?this.overrides.startOfYear(r):il(r)},this.options={locale:yl,...n},this.overrides=s}getDigitMap(){const{numerals:n="latn"}=this.options,s=new Intl.NumberFormat("en-US",{numberingSystem:n}),r={};for(let a=0;a<10;a++)r[a.toString()]=s.format(a);return r}replaceDigits(n){const s=this.getDigitMap();return n.replace(/\d/g,r=>s[r]||r)}formatNumber(n){return this.replaceDigits(n.toString())}getMonthYearOrder(){var s;const n=(s=this.options.locale)==null?void 0:s.code;return n&&Ke.yearFirstLocales.has(n)?"year-first":"month-first"}formatMonthYear(n){const{locale:s,timeZone:r,numerals:a}=this.options,o=s==null?void 0:s.code;if(o&&Ke.yearFirstLocales.has(o))try{return new Intl.DateTimeFormat(o,{month:"long",year:"numeric",timeZone:r,numberingSystem:a}).format(n)}catch{}const i=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(n,i)}}Ke.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 bt=new Ke;class vl{constructor(n,s,r=bt){this.date=n,this.displayMonth=s,this.outside=!!(s&&!r.isSameMonth(n,s)),this.dateLib=r,this.isoDate=r.format(n,"yyyy-MM-dd"),this.displayMonthId=r.format(s,"yyyy-MM"),this.dateMonthId=r.format(n,"yyyy-MM")}isEqualTo(n){return this.dateLib.isSameDay(n.date,this.date)&&this.dateLib.isSameMonth(n.displayMonth,this.displayMonth)}}class vx{constructor(n,s){this.date=n,this.weeks=s}}class wx{constructor(n,s){this.days=s,this.weekNumber=n}}function jx(e){return y.createElement("button",{...e})}function Nx(e){return y.createElement("span",{...e})}function kx(e){const{size:n=24,orientation:s="left",className:r}=e;return y.createElement("svg",{className:r,width:n,height:n,viewBox:"0 0 24 24"},s==="up"&&y.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),s==="down"&&y.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),s==="left"&&y.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),s==="right"&&y.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function Sx(e){const{day:n,modifiers:s,...r}=e;return y.createElement("td",{...r})}function Cx(e){const{day:n,modifiers:s,...r}=e,a=y.useRef(null);return y.useEffect(()=>{var o;s.focused&&((o=a.current)==null||o.focus())},[s.focused]),y.createElement("button",{ref:a,...r})}var te;(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"})(te||(te={}));var je;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(je||(je={}));var it;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(it||(it={}));var Ue;(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"})(Ue||(Ue={}));function Mx(e){const{options:n,className:s,components:r,classNames:a,...o}=e,i=[a[te.Dropdown],s].join(" "),l=n==null?void 0:n.find(({value:d})=>d===o.value);return y.createElement("span",{"data-disabled":o.disabled,className:a[te.DropdownRoot]},y.createElement(r.Select,{className:i,...o},n==null?void 0:n.map(({value:d,label:c,disabled:u})=>y.createElement(r.Option,{key:d,value:d,disabled:u},c))),y.createElement("span",{className:a[te.CaptionLabel],"aria-hidden":!0},l==null?void 0:l.label,y.createElement(r.Chevron,{orientation:"down",size:18,className:a[te.Chevron]})))}function Dx(e){return y.createElement("div",{...e})}function Ox(e){return y.createElement("div",{...e})}function Ex(e){const{calendarMonth:n,displayIndex:s,...r}=e;return y.createElement("div",{...r},e.children)}function _x(e){const{calendarMonth:n,displayIndex:s,...r}=e;return y.createElement("div",{...r})}function Tx(e){return y.createElement("table",{...e})}function Px(e){return y.createElement("div",{...e})}const wl=h.createContext(void 0);function ws(){const e=h.useContext(wl);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function Ix(e){const{components:n}=ws();return y.createElement(n.Dropdown,{...e})}function $x(e){const{onPreviousClick:n,onNextClick:s,previousMonth:r,nextMonth:a,...o}=e,{components:i,classNames:l,labels:{labelPrevious:d,labelNext:c}}=ws(),u=h.useCallback(x=>{a&&(s==null||s(x))},[a,s]),m=h.useCallback(x=>{r&&(n==null||n(x))},[r,n]);return y.createElement("nav",{...o},y.createElement(i.PreviousMonthButton,{type:"button",className:l[te.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":d(r),onClick:m},y.createElement(i.Chevron,{disabled:r?void 0:!0,className:l[te.Chevron],orientation:"left"})),y.createElement(i.NextMonthButton,{type:"button",className:l[te.NextMonthButton],tabIndex:a?void 0:-1,"aria-disabled":a?void 0:!0,"aria-label":c(a),onClick:u},y.createElement(i.Chevron,{disabled:a?void 0:!0,orientation:"right",className:l[te.Chevron]})))}function Rx(e){const{components:n}=ws();return y.createElement(n.Button,{...e})}function Ax(e){return y.createElement("option",{...e})}function Wx(e){const{components:n}=ws();return y.createElement(n.Button,{...e})}function zx(e){const{rootRef:n,...s}=e;return y.createElement("div",{...s,ref:n})}function Fx(e){return y.createElement("select",{...e})}function Bx(e){const{week:n,...s}=e;return y.createElement("tr",{...s})}function qx(e){return y.createElement("th",{...e})}function Yx(e){return y.createElement("thead",{"aria-hidden":!0},y.createElement("tr",{...e}))}function Hx(e){const{week:n,...s}=e;return y.createElement("th",{...s})}function Lx(e){return y.createElement("th",{...e})}function Vx(e){return y.createElement("tbody",{...e})}function Ux(e){const{components:n}=ws();return y.createElement(n.Dropdown,{...e})}const Kx=Object.freeze(Object.defineProperty({__proto__:null,Button:jx,CaptionLabel:Nx,Chevron:kx,Day:Sx,DayButton:Cx,Dropdown:Mx,DropdownNav:Dx,Footer:Ox,Month:Ex,MonthCaption:_x,MonthGrid:Tx,Months:Px,MonthsDropdown:Ix,Nav:$x,NextMonthButton:Rx,Option:Ax,PreviousMonthButton:Wx,Root:zx,Select:Fx,Week:Bx,WeekNumber:Hx,WeekNumberHeader:Lx,Weekday:qx,Weekdays:Yx,Weeks:Vx,YearsDropdown:Ux},Symbol.toStringTag,{value:"Module"}));function jt(e,n,s=!1,r=bt){let{from:a,to:o}=e;const{differenceInCalendarDays:i,isSameDay:l}=r;return a&&o?(i(o,a)<0&&([a,o]=[o,a]),i(n,a)>=(s?1:0)&&i(o,n)>=(s?1:0)):!s&&o?l(o,n):!s&&a?l(a,n):!1}function ma(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function Ks(e){return!!(e&&typeof e=="object"&&"from"in e)}function fa(e){return!!(e&&typeof e=="object"&&"after"in e)}function ha(e){return!!(e&&typeof e=="object"&&"before"in e)}function jl(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function Nl(e,n){return Array.isArray(e)&&e.every(n.isDate)}function Nt(e,n,s=bt){const r=Array.isArray(n)?n:[n],{isSameDay:a,differenceInCalendarDays:o,isAfter:i}=s;return r.some(l=>{if(typeof l=="boolean")return l;if(s.isDate(l))return a(e,l);if(Nl(l,s))return l.some(d=>a(e,d));if(Ks(l))return jt(l,e,!1,s);if(jl(l))return Array.isArray(l.dayOfWeek)?l.dayOfWeek.includes(e.getDay()):l.dayOfWeek===e.getDay();if(ma(l)){const d=o(l.before,e),c=o(l.after,e),u=d>0,m=c<0;return i(l.before,l.after)?m&&u:u||m}return fa(l)?o(e,l.after)>0:ha(l)?o(l.before,e)>0:typeof l=="function"?l(e):!1})}function Gx(e,n,s,r,a){const{disabled:o,hidden:i,modifiers:l,showOutsideDays:d,broadcastCalendar:c,today:u=a.today()}=n,{isSameDay:m,isSameMonth:x,startOfMonth:f,isBefore:b,endOfMonth:w,isAfter:S}=a,g=s&&f(s),v=r&&w(r),N={[je.focused]:[],[je.outside]:[],[je.disabled]:[],[je.hidden]:[],[je.today]:[]},k={};for(const O of e){const{date:p,displayMonth:C}=O,M=!!(C&&!x(p,C)),E=!!(g&&b(p,g)),R=!!(v&&S(p,v)),B=!!(o&&Nt(p,o,a)),$=!!(i&&Nt(p,i,a))||E||R||!c&&!d&&M||c&&d===!1&&M,W=m(p,u);M&&N.outside.push(O),B&&N.disabled.push(O),$&&N.hidden.push(O),W&&N.today.push(O),l&&Object.keys(l).forEach(P=>{const U=l==null?void 0:l[P];U&&Nt(p,U,a)&&(k[P]?k[P].push(O):k[P]=[O])})}return O=>{const p={[je.focused]:!1,[je.disabled]:!1,[je.hidden]:!1,[je.outside]:!1,[je.today]:!1},C={};for(const M in N){const E=N[M];p[M]=E.some(R=>R===O)}for(const M in k)C[M]=k[M].some(E=>E===O);return{...p,...C}}}function Qx(e,n,s={}){return Object.entries(e).filter(([,a])=>a===!0).reduce((a,[o])=>(s[o]?a.push(s[o]):n[je[o]]?a.push(n[je[o]]):n[it[o]]&&a.push(n[it[o]]),a),[n[te.Day]])}function Xx(e){return{...Kx,...e}}function Jx(e){const n={"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(([s,r])=>{s.startsWith("data-")&&(n[s]=r)}),n}function Zx(){const e={};for(const n in te)e[te[n]]=`rdp-${te[n]}`;for(const n in je)e[je[n]]=`rdp-${je[n]}`;for(const n in it)e[it[n]]=`rdp-${it[n]}`;for(const n in Ue)e[Ue[n]]=`rdp-${Ue[n]}`;return e}function kl(e,n,s){return(s??new Ke(n)).formatMonthYear(e)}const ep=kl;function tp(e,n,s){return(s??new Ke(n)).format(e,"d")}function np(e,n=bt){return n.format(e,"LLLL")}function sp(e,n,s){return(s??new Ke(n)).format(e,"cccccc")}function rp(e,n=bt){return e<10?n.formatNumber(`0${e.toLocaleString()}`):n.formatNumber(`${e.toLocaleString()}`)}function ap(){return""}function Sl(e,n=bt){return n.format(e,"yyyy")}const op=Sl,ip=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:kl,formatDay:tp,formatMonthCaption:ep,formatMonthDropdown:np,formatWeekNumber:rp,formatWeekNumberHeader:ap,formatWeekdayName:sp,formatYearCaption:op,formatYearDropdown:Sl},Symbol.toStringTag,{value:"Module"}));function lp(e){return e!=null&&e.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e!=null&&e.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...ip,...e}}function xa(e,n,s,r){let a=(r??new Ke(s)).format(e,"PPPP");return n.today&&(a=`Today, ${a}`),n.selected&&(a=`${a}, selected`),a}const dp=xa;function pa(e,n,s){return(s??new Ke(n)).formatMonthYear(e)}const cp=pa;function Cl(e,n,s,r){let a=(r??new Ke(s)).format(e,"PPPP");return n!=null&&n.today&&(a=`Today, ${a}`),a}function Ml(e){return"Choose the Month"}function Dl(){return""}const up="Go to the Next Month";function Ol(e,n){return up}function El(e){return"Go to the Previous Month"}function _l(e,n,s){return(s??new Ke(n)).format(e,"cccc")}function Tl(e,n){return`Week ${e}`}function Pl(e){return"Week Number"}function Il(e){return"Choose the Year"}const mp=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:cp,labelDay:dp,labelDayButton:xa,labelGrid:pa,labelGridcell:Cl,labelMonthDropdown:Ml,labelNav:Dl,labelNext:Ol,labelPrevious:El,labelWeekNumber:Tl,labelWeekNumberHeader:Pl,labelWeekday:_l,labelYearDropdown:Il},Symbol.toStringTag,{value:"Module"})),st=(e,n,s)=>n||(s?typeof s=="function"?s:(...r)=>s:e);function fp(e,n){var r;const s=((r=n.locale)==null?void 0:r.labels)??{};return{...mp,...e??{},labelDayButton:st(xa,e==null?void 0:e.labelDayButton,s.labelDayButton),labelMonthDropdown:st(Ml,e==null?void 0:e.labelMonthDropdown,s.labelMonthDropdown),labelNext:st(Ol,e==null?void 0:e.labelNext,s.labelNext),labelPrevious:st(El,e==null?void 0:e.labelPrevious,s.labelPrevious),labelWeekNumber:st(Tl,e==null?void 0:e.labelWeekNumber,s.labelWeekNumber),labelYearDropdown:st(Il,e==null?void 0:e.labelYearDropdown,s.labelYearDropdown),labelGrid:st(pa,e==null?void 0:e.labelGrid,s.labelGrid),labelGridcell:st(Cl,e==null?void 0:e.labelGridcell,s.labelGridcell),labelNav:st(Dl,e==null?void 0:e.labelNav,s.labelNav),labelWeekNumberHeader:st(Pl,e==null?void 0:e.labelWeekNumberHeader,s.labelWeekNumberHeader),labelWeekday:st(_l,e==null?void 0:e.labelWeekday,s.labelWeekday)}}function hp(e,n,s,r,a){const{startOfMonth:o,startOfYear:i,endOfYear:l,eachMonthOfInterval:d,getMonth:c}=a;return d({start:i(e),end:l(e)}).map(x=>{const f=r.formatMonthDropdown(x,a),b=c(x),w=n&&x<o(n)||s&&x>o(s)||!1;return{value:b,label:f,disabled:w}})}function xp(e,n={},s={}){let r={...n==null?void 0:n[te.Day]};return Object.entries(e).filter(([,a])=>a===!0).forEach(([a])=>{r={...r,...s==null?void 0:s[a]}}),r}function pp(e,n,s,r){const a=r??e.today(),o=s?e.startOfBroadcastWeek(a,e):n?e.startOfISOWeek(a):e.startOfWeek(a),i=[];for(let l=0;l<7;l++){const d=e.addDays(o,l);i.push(d)}return i}function gp(e,n,s,r,a=!1){if(!e||!n)return;const{startOfYear:o,endOfYear:i,eachYearOfInterval:l,getYear:d}=r,c=o(e),u=i(n),m=l({start:c,end:u});return a&&m.reverse(),m.map(x=>{const f=s.formatYearDropdown(x,r);return{value:d(x),label:f,disabled:!1}})}function bp(e,n={}){var l;const{weekStartsOn:s,locale:r}=n,a=s??((l=r==null?void 0:r.options)==null?void 0:l.weekStartsOn)??0,o=d=>{const c=typeof d=="number"||typeof d=="string"?new Date(d):d;return new Fe(c.getFullYear(),c.getMonth(),c.getDate(),12,0,0,e)},i=d=>{const c=o(d);return new Date(c.getFullYear(),c.getMonth(),c.getDate(),0,0,0,0)};return{today:()=>o(Fe.tz(e)),newDate:(d,c,u)=>new Fe(d,c,u,12,0,0,e),startOfDay:d=>o(d),startOfWeek:(d,c)=>{const u=o(d),m=(c==null?void 0:c.weekStartsOn)??a,x=(u.getDay()-m+7)%7;return u.setDate(u.getDate()-x),u},startOfISOWeek:d=>{const c=o(d),u=(c.getDay()-1+7)%7;return c.setDate(c.getDate()-u),c},startOfMonth:d=>{const c=o(d);return c.setDate(1),c},startOfYear:d=>{const c=o(d);return c.setMonth(0,1),c},endOfWeek:(d,c)=>{const u=o(d),f=((((c==null?void 0:c.weekStartsOn)??a)+6)%7-u.getDay()+7)%7;return u.setDate(u.getDate()+f),u},endOfISOWeek:d=>{const c=o(d),u=(7-c.getDay())%7;return c.setDate(c.getDate()+u),c},endOfMonth:d=>{const c=o(d);return c.setMonth(c.getMonth()+1,0),c},endOfYear:d=>{const c=o(d);return c.setMonth(11,31),c},eachMonthOfInterval:d=>{const c=o(d.start),u=o(d.end),m=[],x=new Fe(c.getFullYear(),c.getMonth(),1,12,0,0,e),f=u.getFullYear()*12+u.getMonth();for(;x.getFullYear()*12+x.getMonth()<=f;)m.push(new Fe(x,e)),x.setMonth(x.getMonth()+1,1);return m},addDays:(d,c)=>{const u=o(d);return u.setDate(u.getDate()+c),u},addWeeks:(d,c)=>{const u=o(d);return u.setDate(u.getDate()+c*7),u},addMonths:(d,c)=>{const u=o(d);return u.setMonth(u.getMonth()+c),u},addYears:(d,c)=>{const u=o(d);return u.setFullYear(u.getFullYear()+c),u},eachYearOfInterval:d=>{const c=o(d.start),u=o(d.end),m=[],x=new Fe(c.getFullYear(),0,1,12,0,0,e);for(;x.getFullYear()<=u.getFullYear();)m.push(new Fe(x,e)),x.setFullYear(x.getFullYear()+1,0,1);return m},getWeek:(d,c)=>{var m;const u=i(d);return la(u,{weekStartsOn:(c==null?void 0:c.weekStartsOn)??a,firstWeekContainsDate:(c==null?void 0:c.firstWeekContainsDate)??((m=r==null?void 0:r.options)==null?void 0:m.firstWeekContainsDate)??1})},getISOWeek:d=>{const c=i(d);return ia(c)},differenceInCalendarDays:(d,c)=>{const u=i(d),m=i(c);return oa(u,m)},differenceInCalendarMonths:(d,c)=>{const u=i(d),m=i(c);return al(u,m)}}}const js=e=>e instanceof HTMLElement?e:null,vr=e=>[...e.querySelectorAll("[data-animated-month]")??[]],yp=e=>js(e.querySelector("[data-animated-month]")),wr=e=>js(e.querySelector("[data-animated-caption]")),jr=e=>js(e.querySelector("[data-animated-weeks]")),vp=e=>js(e.querySelector("[data-animated-nav]")),wp=e=>js(e.querySelector("[data-animated-weekdays]"));function jp(e,n,{classNames:s,months:r,focused:a,dateLib:o}){const i=h.useRef(null),l=h.useRef(r),d=h.useRef(!1);h.useLayoutEffect(()=>{const c=l.current;if(l.current=r,!n||!e.current||!(e.current instanceof HTMLElement)||r.length===0||c.length===0||r.length!==c.length)return;const u=o.isSameMonth(r[0].date,c[0].date),m=o.isAfter(r[0].date,c[0].date),x=m?s[Ue.caption_after_enter]:s[Ue.caption_before_enter],f=m?s[Ue.weeks_after_enter]:s[Ue.weeks_before_enter],b=i.current,w=e.current.cloneNode(!0);if(w instanceof HTMLElement?(vr(w).forEach(N=>{if(!(N instanceof HTMLElement))return;const k=yp(N);k&&N.contains(k)&&N.removeChild(k);const O=wr(N);O&&O.classList.remove(x);const p=jr(N);p&&p.classList.remove(f)}),i.current=w):i.current=null,d.current||u||a)return;const S=b instanceof HTMLElement?vr(b):[],g=vr(e.current);if(g!=null&&g.every(v=>v instanceof HTMLElement)&&S&&S.every(v=>v instanceof HTMLElement)){d.current=!0,e.current.style.isolation="isolate";const v=vp(e.current);v&&(v.style.zIndex="1"),g.forEach((N,k)=>{const O=S[k];if(!O)return;N.style.position="relative",N.style.overflow="hidden";const p=wr(N);p&&p.classList.add(x);const C=jr(N);C&&C.classList.add(f);const M=()=>{d.current=!1,e.current&&(e.current.style.isolation=""),v&&(v.style.zIndex=""),p&&p.classList.remove(x),C&&C.classList.remove(f),N.style.position="",N.style.overflow="",N.contains(O)&&N.removeChild(O)};O.style.pointerEvents="none",O.style.position="absolute",O.style.overflow="hidden",O.setAttribute("aria-hidden","true");const E=wp(O);E&&(E.style.opacity="0");const R=wr(O);R&&(R.classList.add(m?s[Ue.caption_before_exit]:s[Ue.caption_after_exit]),R.addEventListener("animationend",M));const B=jr(O);B&&B.classList.add(m?s[Ue.weeks_before_exit]:s[Ue.weeks_after_exit]),N.insertBefore(O,N.firstChild)})}})}function Np(e,n,s,r){const a=e[0],o=e[e.length-1],{ISOWeek:i,fixedWeeks:l,broadcastCalendar:d}=s??{},{addDays:c,differenceInCalendarDays:u,differenceInCalendarMonths:m,endOfBroadcastWeek:x,endOfISOWeek:f,endOfMonth:b,endOfWeek:w,isAfter:S,startOfBroadcastWeek:g,startOfISOWeek:v,startOfWeek:N}=r,k=d?g(a,r):i?v(a):N(a),O=d?x(o):i?f(b(o)):w(b(o)),p=n&&(d?x(n):i?f(n):w(n)),C=p&&S(O,p)?p:O,M=u(C,k),E=m(o,a)+1,R=[];for(let W=0;W<=M;W++){const P=c(k,W);R.push(P)}const $=(d?35:42)*E;if(l&&R.length<$){const W=$-R.length;for(let P=0;P<W;P++){const U=c(R[R.length-1],1);R.push(U)}}return R}function kp(e){const n=[];return e.reduce((s,r)=>{const a=r.weeks.reduce((o,i)=>o.concat(i.days.slice()),n.slice());return s.concat(a.slice())},n.slice())}function Sp(e,n,s,r){const{numberOfMonths:a=1}=s,o=[];for(let i=0;i<a;i++){const l=r.addMonths(e,i);if(n&&l>n)break;o.push(l)}return o}function Ga(e,n,s,r){const{month:a,defaultMonth:o,today:i=r.today(),numberOfMonths:l=1}=e;let d=a||o||i;const{differenceInCalendarMonths:c,addMonths:u,startOfMonth:m}=r;if(s&&c(s,d)<l-1){const x=-1*(l-1);d=u(s,x)}return n&&c(d,n)<0&&(d=n),m(d)}function Cp(e,n,s,r){const{addDays:a,endOfBroadcastWeek:o,endOfISOWeek:i,endOfMonth:l,endOfWeek:d,getISOWeek:c,getWeek:u,startOfBroadcastWeek:m,startOfISOWeek:x,startOfWeek:f}=r,b=e.reduce((w,S)=>{const g=s.broadcastCalendar?m(S,r):s.ISOWeek?x(S):f(S),v=s.broadcastCalendar?o(S):s.ISOWeek?i(l(S)):d(l(S)),N=n.filter(C=>C>=g&&C<=v),k=s.broadcastCalendar?35:42;if(s.fixedWeeks&&N.length<k){const C=n.filter(M=>{const E=k-N.length;return M>v&&M<=a(v,E)});N.push(...C)}const O=N.reduce((C,M)=>{const E=s.ISOWeek?c(M):u(M),R=C.find($=>$.weekNumber===E),B=new vl(M,S,r);return R?R.days.push(B):C.push(new wx(E,[B])),C},[]),p=new vx(S,O);return w.push(p),w},[]);return s.reverseMonths?b.reverse():b}function Mp(e,n){let{startMonth:s,endMonth:r}=e;const{startOfYear:a,startOfDay:o,startOfMonth:i,endOfMonth:l,addYears:d,endOfYear:c,newDate:u,today:m}=n,{fromYear:x,toYear:f,fromMonth:b,toMonth:w}=e;!s&&b&&(s=b),!s&&x&&(s=n.newDate(x,0,1)),!r&&w&&(r=w),!r&&f&&(r=u(f,11,31));const S=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return s?s=i(s):x?s=u(x,0,1):!s&&S&&(s=a(d(e.today??m(),-100))),r?r=l(r):f?r=u(f,11,31):!r&&S&&(r=c(e.today??m())),[s&&o(s),r&&o(r)]}function Dp(e,n,s,r){if(s.disableNavigation)return;const{pagedNavigation:a,numberOfMonths:o=1}=s,{startOfMonth:i,addMonths:l,differenceInCalendarMonths:d}=r,c=a?o:1,u=i(e);if(!n)return l(u,c);if(!(d(n,e)<o))return l(u,c)}function Op(e,n,s,r){if(s.disableNavigation)return;const{pagedNavigation:a,numberOfMonths:o}=s,{startOfMonth:i,addMonths:l,differenceInCalendarMonths:d}=r,c=a?o??1:1,u=i(e);if(!n)return l(u,-c);if(!(d(u,n)<=0))return l(u,-c)}function Ep(e){const n=[];return e.reduce((s,r)=>s.concat(r.weeks.slice()),n.slice())}function Gs(e,n){const[s,r]=h.useState(e);return[n===void 0?s:n,r]}function _p(e,n){var k;const[s,r]=Mp(e,n),{startOfMonth:a,endOfMonth:o}=n,i=Ga(e,s,r,n),[l,d]=Gs(i,e.month?i:void 0);h.useEffect(()=>{const O=Ga(e,s,r,n);d(O)},[e.timeZone]);const{months:c,weeks:u,days:m,previousMonth:x,nextMonth:f}=h.useMemo(()=>{const O=Sp(l,r,{numberOfMonths:e.numberOfMonths},n),p=Np(O,e.endMonth?o(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},n),C=Cp(O,p,{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},n),M=Ep(C),E=kp(C),R=Op(l,s,e,n),B=Dp(l,r,e,n);return{months:C,weeks:M,days:E,previousMonth:R,nextMonth:B}},[n,l.getTime(),r==null?void 0:r.getTime(),s==null?void 0:s.getTime(),e.disableNavigation,e.broadcastCalendar,(k=e.endMonth)==null?void 0:k.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:b,onMonthChange:w}=e,S=O=>u.some(p=>p.days.some(C=>C.isEqualTo(O))),g=O=>{if(b)return;let p=a(O);s&&p<a(s)&&(p=a(s)),r&&p>a(r)&&(p=a(r)),d(p),w==null||w(p)};return{months:c,weeks:u,days:m,navStart:s,navEnd:r,previousMonth:x,nextMonth:f,goToMonth:g,goToDay:O=>{S(O)||g(O.date)}}}var ft;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(ft||(ft={}));function Qa(e){return!e[je.disabled]&&!e[je.hidden]&&!e[je.outside]}function Tp(e,n,s,r){let a,o=-1;for(const i of e){const l=n(i);Qa(l)&&(l[je.focused]&&o<ft.FocusedModifier?(a=i,o=ft.FocusedModifier):r!=null&&r.isEqualTo(i)&&o<ft.LastFocused?(a=i,o=ft.LastFocused):s(i.date)&&o<ft.Selected?(a=i,o=ft.Selected):l[je.today]&&o<ft.Today&&(a=i,o=ft.Today))}return a||(a=e.find(i=>Qa(n(i)))),a}function Pp(e,n,s,r,a,o,i){const{ISOWeek:l,broadcastCalendar:d}=o,{addDays:c,addMonths:u,addWeeks:m,addYears:x,endOfBroadcastWeek:f,endOfISOWeek:b,endOfWeek:w,max:S,min:g,startOfBroadcastWeek:v,startOfISOWeek:N,startOfWeek:k}=i;let p={day:c,week:m,month:u,year:x,startOfWeek:C=>d?v(C,i):l?N(C):k(C),endOfWeek:C=>d?f(C):l?b(C):w(C)}[e](s,n==="after"?1:-1);return n==="before"&&r?p=S([r,p]):n==="after"&&a&&(p=g([a,p])),p}function $l(e,n,s,r,a,o,i,l=0){if(l>365)return;const d=Pp(e,n,s.date,r,a,o,i),c=!!(o.disabled&&Nt(d,o.disabled,i)),u=!!(o.hidden&&Nt(d,o.hidden,i)),m=d,x=new vl(d,m,i);return!c&&!u?x:$l(e,n,x,r,a,o,i,l+1)}function Ip(e,n,s,r,a){const{autoFocus:o}=e,[i,l]=h.useState(),d=Tp(n.days,s,r||(()=>!1),i),[c,u]=h.useState(o?d:void 0);return{isFocusTarget:w=>!!(d!=null&&d.isEqualTo(w)),setFocused:u,focused:c,blur:()=>{l(c),u(void 0)},moveFocus:(w,S)=>{if(!c)return;const g=$l(w,S,c,n.navStart,n.navEnd,e,a);g&&(e.disableNavigation&&!n.days.some(N=>N.isEqualTo(g))||(n.goToDay(g),u(g)))}}}function $p(e,n){const{selected:s,required:r,onSelect:a}=e,[o,i]=Gs(s,a?s:void 0),l=a?s:o,{isSameDay:d}=n,c=f=>(l==null?void 0:l.some(b=>d(b,f)))??!1,{min:u,max:m}=e;return{selected:l,select:(f,b,w)=>{let S=[...l??[]];if(c(f)){if((l==null?void 0:l.length)===u||r&&(l==null?void 0:l.length)===1)return;S=l==null?void 0:l.filter(g=>!d(g,f))}else(l==null?void 0:l.length)===m?S=[f]:S=[...S,f];return a||i(S),a==null||a(S,f,b,w),S},isSelected:c}}function Rp(e,n,s=0,r=0,a=!1,o=bt){const{from:i,to:l}=n||{},{isSameDay:d,isAfter:c,isBefore:u}=o;let m;if(!i&&!l)m={from:e,to:s>0?void 0:e};else if(i&&!l)d(i,e)?s===0?m={from:i,to:e}:a?m={from:i,to:void 0}:m=void 0:u(e,i)?m={from:e,to:i}:m={from:i,to:e};else if(i&&l)if(d(i,e)&&d(l,e))a?m={from:i,to:l}:m=void 0;else if(d(i,e))m={from:i,to:s>0?void 0:e};else if(d(l,e))m={from:e,to:s>0?void 0:e};else if(u(e,i))m={from:e,to:l};else if(c(e,i))m={from:i,to:e};else if(c(e,l))m={from:i,to:e};else throw new Error("Invalid range");if(m!=null&&m.from&&(m!=null&&m.to)){const x=o.differenceInCalendarDays(m.to,m.from);r>0&&x>r?m={from:e,to:void 0}:s>1&&x<s&&(m={from:e,to:void 0})}return m}function Ap(e,n,s=bt){const r=Array.isArray(n)?n:[n];let a=e.from;const o=s.differenceInCalendarDays(e.to,e.from),i=Math.min(o,6);for(let l=0;l<=i;l++){if(r.includes(a.getDay()))return!0;a=s.addDays(a,1)}return!1}function Xa(e,n,s=bt){return jt(e,n.from,!1,s)||jt(e,n.to,!1,s)||jt(n,e.from,!1,s)||jt(n,e.to,!1,s)}function Wp(e,n,s=bt){const r=Array.isArray(n)?n:[n];if(r.filter(l=>typeof l!="function").some(l=>typeof l=="boolean"?l:s.isDate(l)?jt(e,l,!1,s):Nl(l,s)?l.some(d=>jt(e,d,!1,s)):Ks(l)?l.from&&l.to?Xa(e,{from:l.from,to:l.to},s):!1:jl(l)?Ap(e,l.dayOfWeek,s):ma(l)?s.isAfter(l.before,l.after)?Xa(e,{from:s.addDays(l.after,1),to:s.addDays(l.before,-1)},s):Nt(e.from,l,s)||Nt(e.to,l,s):fa(l)||ha(l)?Nt(e.from,l,s)||Nt(e.to,l,s):!1))return!0;const i=r.filter(l=>typeof l=="function");if(i.length){let l=e.from;const d=s.differenceInCalendarDays(e.to,e.from);for(let c=0;c<=d;c++){if(i.some(u=>u(l)))return!0;l=s.addDays(l,1)}}return!1}function zp(e,n){const{disabled:s,excludeDisabled:r,selected:a,required:o,onSelect:i}=e,[l,d]=Gs(a,i?a:void 0),c=i?a:l;return{selected:c,select:(x,f,b)=>{const{min:w,max:S}=e,g=x?Rp(x,c,w,S,o,n):void 0;return r&&s&&(g!=null&&g.from)&&g.to&&Wp({from:g.from,to:g.to},s,n)&&(g.from=x,g.to=void 0),i||d(g),i==null||i(g,x,f,b),g},isSelected:x=>c&&jt(c,x,!1,n)}}function Fp(e,n){const{selected:s,required:r,onSelect:a}=e,[o,i]=Gs(s,a?s:void 0),l=a?s:o,{isSameDay:d}=n;return{selected:l,select:(m,x,f)=>{let b=m;return!r&&l&&l&&d(m,l)&&(b=void 0),a||i(b),a==null||a(b,m,x,f),b},isSelected:m=>l?d(l,m):!1}}function Bp(e,n){const s=Fp(e,n),r=$p(e,n),a=zp(e,n);switch(e.mode){case"single":return s;case"multiple":return r;case"range":return a;default:return}}function Xe(e,n){return e instanceof Fe&&e.timeZone===n?e:new Fe(e,n)}function wn(e,n,s){return Xe(e,n)}function Ja(e,n,s){return typeof e=="boolean"||typeof e=="function"?e:e instanceof Date?wn(e,n):Array.isArray(e)?e.map(r=>r instanceof Date?wn(r,n):r):Ks(e)?{...e,from:e.from?Xe(e.from,n):e.from,to:e.to?Xe(e.to,n):e.to}:ma(e)?{before:wn(e.before,n),after:wn(e.after,n)}:fa(e)?{after:wn(e.after,n)}:ha(e)?{before:wn(e.before,n)}:e}function Nr(e,n,s){return e&&(Array.isArray(e)?e.map(r=>Ja(r,n)):Ja(e,n))}function qp(e){var ne;let n=e;const s=n.timeZone;if(s&&(n={...e,timeZone:s},n.today&&(n.today=Xe(n.today,s)),n.month&&(n.month=Xe(n.month,s)),n.defaultMonth&&(n.defaultMonth=Xe(n.defaultMonth,s)),n.startMonth&&(n.startMonth=Xe(n.startMonth,s)),n.endMonth&&(n.endMonth=Xe(n.endMonth,s)),n.mode==="single"&&n.selected?n.selected=Xe(n.selected,s):n.mode==="multiple"&&n.selected?n.selected=(ne=n.selected)==null?void 0:ne.map(K=>Xe(K,s)):n.mode==="range"&&n.selected&&(n.selected={from:n.selected.from?Xe(n.selected.from,s):n.selected.from,to:n.selected.to?Xe(n.selected.to,s):n.selected.to}),n.disabled!==void 0&&(n.disabled=Nr(n.disabled,s)),n.hidden!==void 0&&(n.hidden=Nr(n.hidden,s)),n.modifiers)){const K={};Object.keys(n.modifiers).forEach(Z=>{var q;K[Z]=Nr((q=n.modifiers)==null?void 0:q[Z],s)}),n.modifiers=K}const{components:r,formatters:a,labels:o,dateLib:i,locale:l,classNames:d}=h.useMemo(()=>{const K={...yl,...n.locale},Z=n.broadcastCalendar?1:n.weekStartsOn,q=n.noonSafe&&n.timeZone?bp(n.timeZone,{weekStartsOn:Z,locale:K}):void 0,J=n.dateLib&&q?{...q,...n.dateLib}:n.dateLib??q,fe=new Ke({locale:K,weekStartsOn:Z,firstWeekContainsDate:n.firstWeekContainsDate,useAdditionalWeekYearTokens:n.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:n.useAdditionalDayOfYearTokens,timeZone:n.timeZone,numerals:n.numerals},J);return{dateLib:fe,components:Xx(n.components),formatters:lp(n.formatters),labels:fp(n.labels,fe.options),locale:K,classNames:{...Zx(),...n.classNames}}},[n.locale,n.broadcastCalendar,n.weekStartsOn,n.firstWeekContainsDate,n.useAdditionalWeekYearTokens,n.useAdditionalDayOfYearTokens,n.timeZone,n.numerals,n.dateLib,n.noonSafe,n.components,n.formatters,n.labels,n.classNames]);n.today||(n={...n,today:i.today()});const{captionLayout:c,mode:u,navLayout:m,numberOfMonths:x=1,onDayBlur:f,onDayClick:b,onDayFocus:w,onDayKeyDown:S,onDayMouseEnter:g,onDayMouseLeave:v,onNextClick:N,onPrevClick:k,showWeekNumber:O,styles:p}=n,{formatCaption:C,formatDay:M,formatMonthDropdown:E,formatWeekNumber:R,formatWeekNumberHeader:B,formatWeekdayName:$,formatYearDropdown:W}=a,P=_p(n,i),{days:U,months:_,navStart:Y,navEnd:X,previousMonth:A,nextMonth:j,goToMonth:G}=P,D=Gx(U,n,Y,X,i),{isSelected:z,select:L,selected:H}=Bp(n,i)??{},{blur:se,focused:T,isFocusTarget:re,moveFocus:xe,setFocused:Se}=Ip(n,P,D,z??(()=>!1),i),{labelDayButton:Ae,labelGridcell:Ct,labelGrid:Ht,labelMonthDropdown:ae,labelNav:Lt,labelPrevious:Vt,labelNext:Ut,labelWeekday:Kt,labelWeekNumber:Wn,labelWeekNumberHeader:tt,labelYearDropdown:lt}=o,gn=h.useMemo(()=>pp(i,n.ISOWeek,n.broadcastCalendar,n.today),[i,n.ISOWeek,n.broadcastCalendar,n.today]),We=u!==void 0||b!==void 0,Gt=h.useCallback(()=>{A&&(G(A),k==null||k(A))},[A,G,k]),Mt=h.useCallback(()=>{j&&(G(j),N==null||N(j))},[G,j,N]),ze=h.useCallback((K,Z)=>q=>{q.preventDefault(),q.stopPropagation(),Se(K),!Z.disabled&&(L==null||L(K.date,Z,q),b==null||b(K.date,Z,q))},[L,b,Se]),dt=h.useCallback((K,Z)=>q=>{Se(K),w==null||w(K.date,Z,q)},[w,Se]),Dt=h.useCallback((K,Z)=>q=>{se(),f==null||f(K.date,Z,q)},[se,f]),zn=h.useCallback((K,Z)=>q=>{const J={ArrowLeft:[q.shiftKey?"month":"day",n.dir==="rtl"?"after":"before"],ArrowRight:[q.shiftKey?"month":"day",n.dir==="rtl"?"before":"after"],ArrowDown:[q.shiftKey?"year":"week","after"],ArrowUp:[q.shiftKey?"year":"week","before"],PageUp:[q.shiftKey?"year":"month","before"],PageDown:[q.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(J[q.key]){q.preventDefault(),q.stopPropagation();const[fe,F]=J[q.key];xe(fe,F)}S==null||S(K.date,Z,q)},[xe,S,n.dir]),yt=h.useCallback((K,Z)=>q=>{g==null||g(K.date,Z,q)},[g]),Fn=h.useCallback((K,Z)=>q=>{v==null||v(K.date,Z,q)},[v]),ct=h.useCallback(K=>Z=>{const q=Number(Z.target.value),J=i.setMonth(i.startOfMonth(K),q);G(J)},[i,G]),Ot=h.useCallback(K=>Z=>{const q=Number(Z.target.value),J=i.setYear(i.startOfMonth(K),q);G(J)},[i,G]),{className:ut,style:bn}=h.useMemo(()=>({className:[d[te.Root],n.className].filter(Boolean).join(" "),style:{...p==null?void 0:p[te.Root],...n.style}}),[d,n.className,n.style,p]),mt=Jx(n),yn=h.useRef(null);jp(yn,!!n.animate,{classNames:d,months:_,focused:T,dateLib:i});const Bn={dayPickerProps:n,selected:H,select:L,isSelected:z,months:_,nextMonth:j,previousMonth:A,goToMonth:G,getModifiers:D,components:r,classNames:d,styles:p,labels:o,formatters:a};return y.createElement(wl.Provider,{value:Bn},y.createElement(r.Root,{rootRef:n.animate?yn:void 0,className:ut,style:bn,dir:n.dir,id:n.id,lang:n.lang,nonce:n.nonce,title:n.title,role:n.role,"aria-label":n["aria-label"],"aria-labelledby":n["aria-labelledby"],...mt},y.createElement(r.Months,{className:d[te.Months],style:p==null?void 0:p[te.Months]},!n.hideNavigation&&!m&&y.createElement(r.Nav,{"data-animated-nav":n.animate?"true":void 0,className:d[te.Nav],style:p==null?void 0:p[te.Nav],"aria-label":Lt(),onPreviousClick:Gt,onNextClick:Mt,previousMonth:A,nextMonth:j}),_.map((K,Z)=>y.createElement(r.Month,{"data-animated-month":n.animate?"true":void 0,className:d[te.Month],style:p==null?void 0:p[te.Month],key:Z,displayIndex:Z,calendarMonth:K},m==="around"&&!n.hideNavigation&&Z===0&&y.createElement(r.PreviousMonthButton,{type:"button",className:d[te.PreviousMonthButton],tabIndex:A?void 0:-1,"aria-disabled":A?void 0:!0,"aria-label":Vt(A),onClick:Gt,"data-animated-button":n.animate?"true":void 0},y.createElement(r.Chevron,{disabled:A?void 0:!0,className:d[te.Chevron],orientation:n.dir==="rtl"?"right":"left"})),y.createElement(r.MonthCaption,{"data-animated-caption":n.animate?"true":void 0,className:d[te.MonthCaption],style:p==null?void 0:p[te.MonthCaption],calendarMonth:K,displayIndex:Z},c!=null&&c.startsWith("dropdown")?y.createElement(r.DropdownNav,{className:d[te.Dropdowns],style:p==null?void 0:p[te.Dropdowns]},(()=>{const q=c==="dropdown"||c==="dropdown-months"?y.createElement(r.MonthsDropdown,{key:"month",className:d[te.MonthsDropdown],"aria-label":ae(),classNames:d,components:r,disabled:!!n.disableNavigation,onChange:ct(K.date),options:hp(K.date,Y,X,a,i),style:p==null?void 0:p[te.Dropdown],value:i.getMonth(K.date)}):y.createElement("span",{key:"month"},E(K.date,i)),J=c==="dropdown"||c==="dropdown-years"?y.createElement(r.YearsDropdown,{key:"year",className:d[te.YearsDropdown],"aria-label":lt(i.options),classNames:d,components:r,disabled:!!n.disableNavigation,onChange:Ot(K.date),options:gp(Y,X,a,i,!!n.reverseYears),style:p==null?void 0:p[te.Dropdown],value:i.getYear(K.date)}):y.createElement("span",{key:"year"},W(K.date,i));return i.getMonthYearOrder()==="year-first"?[J,q]:[q,J]})(),y.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(K.date,i.options,i))):y.createElement(r.CaptionLabel,{className:d[te.CaptionLabel],role:"status","aria-live":"polite"},C(K.date,i.options,i))),m==="around"&&!n.hideNavigation&&Z===x-1&&y.createElement(r.NextMonthButton,{type:"button",className:d[te.NextMonthButton],tabIndex:j?void 0:-1,"aria-disabled":j?void 0:!0,"aria-label":Ut(j),onClick:Mt,"data-animated-button":n.animate?"true":void 0},y.createElement(r.Chevron,{disabled:j?void 0:!0,className:d[te.Chevron],orientation:n.dir==="rtl"?"left":"right"})),Z===x-1&&m==="after"&&!n.hideNavigation&&y.createElement(r.Nav,{"data-animated-nav":n.animate?"true":void 0,className:d[te.Nav],style:p==null?void 0:p[te.Nav],"aria-label":Lt(),onPreviousClick:Gt,onNextClick:Mt,previousMonth:A,nextMonth:j}),y.createElement(r.MonthGrid,{role:"grid","aria-multiselectable":u==="multiple"||u==="range","aria-label":Ht(K.date,i.options,i)||void 0,className:d[te.MonthGrid],style:p==null?void 0:p[te.MonthGrid]},!n.hideWeekdays&&y.createElement(r.Weekdays,{"data-animated-weekdays":n.animate?"true":void 0,className:d[te.Weekdays],style:p==null?void 0:p[te.Weekdays]},O&&y.createElement(r.WeekNumberHeader,{"aria-label":tt(i.options),className:d[te.WeekNumberHeader],style:p==null?void 0:p[te.WeekNumberHeader],scope:"col"},B()),gn.map(q=>y.createElement(r.Weekday,{"aria-label":Kt(q,i.options,i),className:d[te.Weekday],key:String(q),style:p==null?void 0:p[te.Weekday],scope:"col"},$(q,i.options,i)))),y.createElement(r.Weeks,{"data-animated-weeks":n.animate?"true":void 0,className:d[te.Weeks],style:p==null?void 0:p[te.Weeks]},K.weeks.map(q=>y.createElement(r.Week,{className:d[te.Week],key:q.weekNumber,style:p==null?void 0:p[te.Week],week:q},O&&y.createElement(r.WeekNumber,{week:q,style:p==null?void 0:p[te.WeekNumber],"aria-label":Wn(q.weekNumber,{locale:l}),className:d[te.WeekNumber],scope:"row",role:"rowheader"},R(q.weekNumber,i)),q.days.map(J=>{const{date:fe}=J,F=D(J);if(F[je.focused]=!F.hidden&&!!(T!=null&&T.isEqualTo(J)),F[it.selected]=(z==null?void 0:z(fe))||F.selected,Ks(H)){const{from:be,to:ve}=H;F[it.range_start]=!!(be&&ve&&i.isSameDay(fe,be)),F[it.range_end]=!!(be&&ve&&i.isSameDay(fe,ve)),F[it.range_middle]=jt(H,fe,!0,i)}const de=xp(F,p,n.modifiersStyles),ce=Qx(F,d,n.modifiersClassNames),Me=!We&&!F.hidden?Ct(fe,F,i.options,i):void 0;return y.createElement(r.Day,{key:`${J.isoDate}_${J.displayMonthId}`,day:J,modifiers:F,className:ce.join(" "),style:de,role:"gridcell","aria-selected":F.selected||void 0,"aria-label":Me,"data-day":J.isoDate,"data-month":J.outside?J.dateMonthId:void 0,"data-selected":F.selected||void 0,"data-disabled":F.disabled||void 0,"data-hidden":F.hidden||void 0,"data-outside":J.outside||void 0,"data-focused":F.focused||void 0,"data-today":F.today||void 0},!F.hidden&&We?y.createElement(r.DayButton,{className:d[te.DayButton],style:p==null?void 0:p[te.DayButton],type:"button",day:J,modifiers:F,disabled:!F.focused&&F.disabled||void 0,"aria-disabled":F.focused&&F.disabled||void 0,tabIndex:re(J)?0:-1,"aria-label":Ae(fe,F,i.options,i),onClick:ze(J,F),onBlur:Dt(J,F),onFocus:dt(J,F),onKeyDown:zn(J,F),onMouseEnter:yt(J,F),onMouseLeave:Fn(J,F)},M(fe,i.options,i)):!F.hidden&&M(J.date,i.options,i))})))))))),n.footer&&y.createElement(r.Footer,{className:d[te.Footer],style:p==null?void 0:p[te.Footer],role:"status","aria-live":"polite"},n.footer)))}function Ft({className:e,classNames:n,showOutsideDays:s=!0,...r}){return t.jsx(qp,{showOutsideDays:s,className:I("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",nav:"flex items-center gap-1",button_previous:I(Os({variant:"outline"}),"absolute left-1 top-0 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),button_next:I(Os({variant:"outline"}),"absolute right-1 top-0 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),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:I(Os({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",...n},components:{Chevron:({orientation:a})=>a==="left"?t.jsx(Vr,{className:"h-4 w-4"}):t.jsx(ls,{className:"h-4 w-4"})},...r})}Ft.displayName="Calendar";function Yp(e){if(!e.start_date&&!e.end_date)return null;const n=e.start_date?le(new Date(e.start_date),"MMM d"):"—",s=e.end_date?le(new Date(e.end_date),"MMM d"):"—";return`${n} – ${s}`}function Qs({open:e,onClose:n,projectId:s,defaultStatus:r="backlog",defaultTaskListId:a,defaultParentId:o}){const i=Ge(),{workspace:l,projectKey:d}=et(),{workspace:c}=Re(),[u,m]=h.useState(""),[x,f]=h.useState(""),[b,w]=h.useState(r),[S,g]=h.useState("medium"),[v,N]=h.useState("task"),[k,O]=h.useState([]),[p,C]=h.useState(""),[M,E]=h.useState(a??""),[R,B]=h.useState(void 0),$=ul(),{data:W}=Rn(s),{data:P}=An(s||void 0),{data:U}=ys(s||void 0),_=(P??[]).filter(j=>j.status!=="completed"),Y=W&&W.length>0?Object.fromEntries(W.map(j=>[j.key,j.name])):un,X=()=>{m(""),f(""),w(r),g("medium"),N("task"),O([]),C(""),E(a??""),B(void 0),n()},A=j=>{j.preventDefault(),u.trim()&&$.mutate({title:u.trim(),description:x.trim()||void 0,status:b,priority:S,type:v,project_id:s,workspace_id:c.id,assignee_ids:k.length>0?k:void 0,sprint_id:p||null,task_list_id:M||null,parent_id:o||null,due_date:R?le(R,"yyyy-MM-dd"):null},{onSuccess:()=>{Q.success("Issue created"),X()},onError:G=>Q.error(G.message??"Failed to create issue")})};return t.jsx(fn,{open:e,onOpenChange:j=>!j&&X(),children:t.jsxs(hn,{className:"max-w-md",children:[t.jsx(xn,{children:t.jsx(pn,{children:"New issue"})}),t.jsxs("form",{onSubmit:A,className:"flex flex-col flex-1 overflow-hidden",children:[t.jsxs(In,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx($e,{htmlFor:"issue-title",children:"Title"}),t.jsx(Ne,{id:"issue-title",placeholder:"Issue title",value:u,onChange:j=>m(j.target.value),autoFocus:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs($e,{htmlFor:"issue-desc",children:["Description ",t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),t.jsx(Vs,{id:"issue-desc",placeholder:"Add more context...",value:x,onChange:j=>f(j.target.value)})]}),t.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx($e,{children:"Status"}),t.jsxs(_e,{value:b,onValueChange:w,children:[t.jsx(De,{className:"h-8 text-xs",children:t.jsx(Be,{})}),t.jsx(Oe,{children:Object.entries(Y).map(([j,G])=>t.jsx(me,{value:j,className:"text-xs",children:G},j))})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx($e,{children:"Priority"}),t.jsxs(_e,{value:S,onValueChange:g,children:[t.jsx(De,{className:"h-8 text-xs",children:t.jsx(Be,{})}),t.jsx(Oe,{children:Object.entries(St).map(([j,G])=>t.jsx(me,{value:j,className:"text-xs",children:G},j))})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx($e,{children:"Type"}),t.jsxs(_e,{value:v,onValueChange:N,children:[t.jsx(De,{className:"h-8 text-xs",children:t.jsx(Be,{})}),t.jsx(Oe,{children:Object.entries(zt).map(([j,G])=>t.jsx(me,{value:j,className:"text-xs",children:G},j))})]})]})]}),o&&t.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"}),(U??[]).length>0&&!o&&t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs($e,{children:["List ",t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),t.jsxs(_e,{value:M||"none",onValueChange:j=>E(j==="none"?"":j),children:[t.jsx(De,{className:"h-8 text-xs",children:t.jsx(Be,{placeholder:"No list"})}),t.jsxs(Oe,{children:[t.jsx(me,{value:"none",className:"text-xs",children:t.jsx("span",{className:"text-muted-foreground",children:"No list"})}),(U??[]).map(j=>t.jsx(me,{value:j.id,className:"text-xs",children:j.name},j.id))]})]})]}),_.length>0&&t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs($e,{children:["Sprint ",t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),t.jsxs(_e,{value:p||"none",onValueChange:j=>C(j==="none"?"":j),children:[t.jsx(De,{className:"h-8 text-xs",children:t.jsx(Be,{placeholder:"No sprint"})}),t.jsxs(Oe,{children:[t.jsx(me,{value:"none",className:"text-xs",children:t.jsx("span",{className:"text-muted-foreground",children:"No sprint"})}),_.map(j=>{const G=Yp(j);return t.jsx(me,{value:j.id,className:"text-xs",children:t.jsxs("div",{children:[t.jsx("span",{children:j.name}),G&&t.jsx("span",{className:"block text-[10px] text-muted-foreground leading-tight",children:G})]})},j.id)})]})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs($e,{children:["Assignees ",t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),t.jsx(vs,{value:k,onChange:O})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs($e,{children:["Due Date ",t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),t.jsxs(at,{children:[t.jsx(ot,{asChild:!0,children:t.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:[t.jsx(ln,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),t.jsx("span",{className:R?"text-foreground":"text-muted-foreground",children:R?le(R,"MMM d, yyyy"):"No due date"}),R&&t.jsx("button",{type:"button",onClick:j=>{j.stopPropagation(),B(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:t.jsx(Ze,{className:"h-3.5 w-3.5"})})]})}),t.jsx(Je,{className:"w-auto p-0",align:"start",children:t.jsx(Ft,{mode:"single",selected:R,onSelect:B,initialFocus:!0})})]})]})]}),t.jsxs(ps,{className:"flex-col-reverse sm:flex-row sm:items-center sm:justify-between gap-2",children:[t.jsxs(ee,{type:"button",variant:"ghost",size:"sm",className:"text-muted-foreground gap-1.5 justify-start sm:justify-center",onClick:()=>{X(),i(`/${l}/projects/${d}/issues/new`)},children:[t.jsx(Gr,{className:"h-3.5 w-3.5"}),"Open full form"]}),t.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[t.jsx(ee,{type:"button",variant:"ghost",onClick:X,children:"Cancel"}),t.jsx(ee,{type:"submit",disabled:!u.trim()||$.isPending,children:$.isPending?"Creating...":"Create issue"})]})]})]})]})})}const ga={byIssue:e=>["attachments",e]};function Rl(e){return Ie({queryKey:ga.byIssue(e),queryFn:()=>oe.get(`/admin/issues/${e}/attachments`),select:n=>n.attachments,enabled:!!e})}function Al(e){const n=ke();return ye({mutationFn:({file:s,commentId:r})=>{const a=new FormData;return a.append("file",s),r&&a.append("comment_id",r),oe.upload(`/admin/issues/${e}/attachments`,a)},onSuccess:()=>{n.invalidateQueries({queryKey:ga.byIssue(e)})}})}function Hp(e){const n=ke();return ye({mutationFn:s=>oe.delete(`/admin/issues/${e}/attachments/${s}`),onSuccess:()=>{n.invalidateQueries({queryKey:ga.byIssue(e)})}})}function ns(e){return e.startsWith("image/")}function Xs(e){return e.startsWith("video/")}function Js(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function ba(e,n){const s=document.createElement("a");s.href=e,s.download=n,s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s)}function ya({mimeType:e,className:n}){return ns(e)?t.jsx(Xc,{className:n}):Xs(e)?t.jsx(zs,{className:n}):e.startsWith("text/")||e.includes("json")?t.jsx(Qc,{className:n}):e.includes("zip")||e.includes("tar")||e.includes("gz")?t.jsx(Gc,{className:n}):e.includes("pdf")||e.includes("word")||e.includes("document")?t.jsx(Jc,{className:n}):t.jsx(Zc,{className:n})}function Wl({attachment:e,onClose:n}){return e?t.jsx(fn,{open:!0,onOpenChange:s=>!s&&n(),children:t.jsxs(hn,{className:"max-w-2xl w-full p-0 overflow-hidden",children:[t.jsxs(xn,{className:"flex-row items-center justify-between px-4 py-3 border-b border-border shrink-0 pr-10",children:[t.jsx(pn,{className:"text-sm font-medium truncate",children:e.original_name}),t.jsxs(ee,{variant:"ghost",size:"sm",className:"h-7 text-xs gap-1.5 shrink-0",onClick:()=>ba(e.url,e.original_name),children:[t.jsx(Kr,{className:"h-3.5 w-3.5"}),"Download"]})]}),t.jsxs(In,{className:"flex items-center justify-center bg-black/5 dark:bg-black/30 min-h-[320px] max-h-[75vh] overflow-auto p-0",children:[ns(e.mime_type)&&t.jsx("img",{src:e.url,alt:e.original_name,className:"max-w-full max-h-[75vh] object-contain"}),Xs(e.mime_type)&&t.jsx("video",{src:e.url,controls:!0,className:"max-w-full max-h-[75vh]"})]}),t.jsxs("div",{className:"px-4 py-2 border-t border-border text-[11px] text-muted-foreground flex items-center gap-3 shrink-0",children:[t.jsx("span",{children:Js(e.size)}),t.jsx("span",{children:"·"}),t.jsx("span",{children:e.mime_type}),t.jsx("span",{children:"·"}),t.jsxs("span",{children:["Uploaded ",le(new Date(e.created_at),"MMM d, yyyy")]})]})]})}):null}function Lp({attachment:e}){const[n,s]=h.useState(null),r=ns(e.mime_type)||Xs(e.mime_type),a=()=>{r?s(e):ba(e.url,e.original_name)};return t.jsxs(t.Fragment,{children:[ns(e.mime_type)?t.jsx("button",{type:"button",onClick:a,className:"block rounded-md overflow-hidden border border-border hover:opacity-90 transition-opacity",title:e.original_name,children:t.jsx("img",{src:e.url,alt:e.original_name,className:"max-h-48 max-w-xs object-cover"})}):t.jsxs("button",{type:"button",onClick:a,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:r?"View":"Download",children:[t.jsx(ya,{mimeType:e.mime_type,className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),t.jsx("span",{className:"text-xs text-foreground truncate",children:e.original_name}),t.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:Js(e.size)}),!r&&t.jsx(Kr,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]}),n&&t.jsx(Wl,{attachment:n,onClose:()=>s(null)})]})}function Vp({attachment:e,onOpen:n,onDelete:s,isDeleting:r}){const a=ns(e.mime_type)||Xs(e.mime_type),o=()=>{a?n(e):ba(e.url,e.original_name)};return t.jsxs("div",{className:"flex items-center gap-3 py-2.5 px-3 rounded-lg hover:bg-muted/50 group transition-colors",children:[t.jsx("button",{type:"button",onClick:o,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:a?"View":"Download",children:t.jsx(ya,{mimeType:e.mime_type,className:"h-4 w-4"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("button",{type:"button",onClick:o,className:"text-xs font-medium text-foreground truncate block text-left w-full hover:underline",children:e.original_name}),t.jsxs("p",{className:"text-[11px] text-muted-foreground mt-0.5 flex items-center gap-1.5",children:[t.jsx("span",{children:Js(e.size)}),t.jsx("span",{children:"·"}),t.jsx("span",{children:le(new Date(e.created_at),"MMM d, yyyy")}),e.comment_id&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"·"}),t.jsx("span",{className:"italic",children:"from comment"})]}),!a&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"·"}),t.jsxs("span",{className:"flex items-center gap-0.5",children:[t.jsx(Kr,{className:"h-2.5 w-2.5"}),"Click to download"]})]})]})]}),t.jsx(ee,{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:()=>s(e.id),disabled:r,children:t.jsx(cs,{className:"h-3.5 w-3.5"})})]})}function Up({onFiles:e,isUploading:n}){const[s,r]=h.useState(!1),a=h.useRef(null),o=h.useCallback(i=>{i.preventDefault(),r(!1);const l=Array.from(i.dataTransfer.files);l.length>0&&e(l)},[e]);return t.jsxs("div",{onDragOver:i=>{i.preventDefault(),r(!0)},onDragLeave:()=>r(!1),onDrop:o,onClick:()=>{var i;return!n&&((i=a.current)==null?void 0:i.click())},className:I("flex flex-col items-center justify-center gap-1.5 rounded-xl border-2 border-dashed px-4 py-6","cursor-pointer transition-colors",s?"border-primary/60 bg-primary/5":"border-border hover:border-muted-foreground/40 hover:bg-muted/30",n&&"opacity-60 cursor-wait"),children:[t.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-muted",children:t.jsx(gu,{className:"h-4 w-4 text-muted-foreground"})}),t.jsx("p",{className:"text-xs font-medium text-foreground",children:n?"Uploading…":"Drop files or click to browse"}),t.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Up to 50 MB per file"}),t.jsx("input",{ref:a,type:"file",multiple:!0,className:"hidden",onChange:i=>{const l=Array.from(i.target.files??[]);l.length>0&&e(l),i.target.value=""}})]})}function Kp({issueId:e,className:n}){const[s,r]=h.useState(null),{data:a,isLoading:o}=Rl(e),i=Al(e),l=Hp(e),d=u=>{u.forEach(m=>{i.mutate({file:m},{onSuccess:()=>Q.success(`${m.name} uploaded`),onError:()=>Q.error(`Failed to upload ${m.name}`)})})},c=u=>{l.mutate(u,{onSuccess:()=>Q.success("Attachment removed"),onError:()=>Q.error("Failed to remove attachment")})};return t.jsxs("div",{className:I("px-6 py-4 space-y-4",n),children:[t.jsx(Up,{onFiles:d,isUploading:i.isPending}),o?t.jsx("div",{className:"space-y-2",children:[1,2].map(u=>t.jsxs("div",{className:"flex items-center gap-3 px-3",children:[t.jsx(ue,{className:"h-8 w-8 rounded-md shrink-0"}),t.jsxs("div",{className:"flex-1 space-y-1.5",children:[t.jsx(ue,{className:"h-3 w-2/3"}),t.jsx(ue,{className:"h-2.5 w-1/3"})]})]},u))}):a&&a.length>0?t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[t.jsx(wi,{className:"h-3 w-3 text-muted-foreground"}),t.jsxs("span",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:[a.length," ",a.length===1?"file":"files"]})]}),t.jsx("div",{children:a.map(u=>t.jsx(Vp,{attachment:u,onOpen:r,onDelete:c,isDeleting:l.isPending},u.id))})]}):t.jsx("p",{className:"text-sm text-muted-foreground/50 text-center py-1",children:"No attachments yet."}),t.jsx(Wl,{attachment:s,onClose:()=>r(null)})]})}const Bt={byIssue:e=>["time-logs",e],activeTimer:e=>["time-logs",e,"active-timer"]};function Gp(e){return Ie({queryKey:Bt.byIssue(e),queryFn:()=>oe.get(`/admin/issues/${e}/time-logs`),enabled:!!e})}function Qp(e){return Ie({queryKey:Bt.activeTimer(e),queryFn:()=>oe.get(`/admin/issues/${e}/time-logs/timer`),select:n=>n.active_timer,enabled:!!e,refetchInterval:1e4})}function Xp(e){const n=ke();return ye({mutationFn:s=>oe.post(`/admin/issues/${e}/time-logs`,s),onSuccess:()=>{n.invalidateQueries({queryKey:Bt.byIssue(e)})}})}function Jp(e){const n=ke();return ye({mutationFn:()=>oe.post(`/admin/issues/${e}/time-logs/timer`,{action:"start"}),onSuccess:()=>{n.invalidateQueries({queryKey:Bt.activeTimer(e)}),n.invalidateQueries({queryKey:Bt.byIssue(e)})}})}function Zp(e){const n=ke();return ye({mutationFn:()=>oe.post(`/admin/issues/${e}/time-logs/timer`,{action:"stop"}),onSuccess:()=>{n.invalidateQueries({queryKey:Bt.activeTimer(e)}),n.invalidateQueries({queryKey:Bt.byIssue(e)})}})}function eg(e){const n=ke();return ye({mutationFn:s=>oe.delete(`/admin/issues/${e}/time-logs/${s}`),onSuccess:()=>{n.invalidateQueries({queryKey:Bt.byIssue(e)})}})}const tg=as("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 Zs({className:e,variant:n,...s}){return t.jsx("div",{className:I(tg({variant:n}),e),...s})}function Ir(e){const n=Math.floor(e/60),s=e%60;return n===0?`${s}m`:s===0?`${n}h`:`${n}h ${s}m`}function Za(e){const n=Date.now()-new Date(e).getTime(),s=Math.floor(n/1e3),r=Math.floor(s/3600),a=Math.floor(s%3600/60),o=s%60,i=String(a).padStart(2,"0"),l=String(o).padStart(2,"0");return r>0?`${r}:${i}:${l}`:`${i}:${l}`}function ng({startedAt:e}){const[n,s]=h.useState(()=>Za(e));return h.useEffect(()=>{const r=setInterval(()=>s(Za(e)),1e3);return()=>clearInterval(r)},[e]),t.jsx("span",{className:"font-mono tabular-nums text-sm font-semibold text-foreground",children:n})}function sg({onSubmit:e,isPending:n,onCancel:s}){const[r,a]=h.useState(""),[o,i]=h.useState(""),[l,d]=h.useState(""),[c,u]=h.useState(new Date().toISOString().split("T")[0]),m=x=>{x.preventDefault();const f=parseInt(r||"0",10),b=parseInt(o||"0",10),w=f*60+b;if(w<=0){Q.error("Please enter a duration greater than 0.");return}e({duration_minutes:w,description:l.trim()||void 0,logged_date:c||void 0})};return t.jsxs("form",{onSubmit:m,className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[t.jsx("p",{className:"text-xs font-medium text-foreground",children:"Log time manually"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Hours"}),t.jsx(Ne,{type:"number",min:"0",max:"999",placeholder:"0",value:r,onChange:x=>a(x.target.value),className:"h-8 text-sm"})]}),t.jsxs("div",{className:"flex-1",children:[t.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Minutes"}),t.jsx(Ne,{type:"number",min:"0",max:"59",placeholder:"0",value:o,onChange:x=>i(x.target.value),className:"h-8 text-sm"})]}),t.jsxs("div",{className:"flex-1",children:[t.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Date"}),t.jsx(Ne,{type:"date",value:c,onChange:x=>u(x.target.value),className:"h-8 text-sm"})]})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:["Description ",t.jsx("span",{className:"text-muted-foreground/60",children:"(optional)"})]}),t.jsx(Ne,{placeholder:"What did you work on?",value:l,onChange:x=>d(x.target.value),className:"h-8 text-sm"})]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[t.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:s,className:"h-7 text-xs",children:"Cancel"}),t.jsx(ee,{type:"submit",size:"sm",disabled:n,className:"h-7 text-xs",children:n?"Saving…":"Log time"})]})]})}function rg({entry:e,onDelete:n,isDeleting:s}){const r=e.started_at!=null&&e.stopped_at==null;return t.jsxs("div",{className:"flex items-start gap-3 py-2.5 px-3 rounded-lg hover:bg-muted/50 group transition-colors",children:[t.jsx("div",{className:I("flex h-7 w-7 shrink-0 items-center justify-center rounded-full mt-0.5",r?"bg-emerald-50 dark:bg-emerald-950/40":"bg-muted"),children:r?t.jsx(hu,{className:"h-3.5 w-3.5 text-emerald-600"}):e.source==="timer"?t.jsx(Yt,{className:"h-3.5 w-3.5 text-muted-foreground"}):t.jsx(Kc,{className:"h-3.5 w-3.5 text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[r?t.jsx(ng,{startedAt:e.started_at}):t.jsx("span",{className:"text-sm font-semibold text-foreground tabular-nums",children:Ir(e.duration_minutes??0)}),t.jsx(Zs,{variant:"muted",className:I("text-[10px] px-1.5 py-0",r?"bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-400":""),children:r?"Running":e.source==="timer"?"Timer":"Manual"})]}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:e.description}),e.logged_date&&!r&&t.jsx("p",{className:"text-[11px] text-muted-foreground/60 mt-0.5",children:le(new Date(e.logged_date),"MMM d, yyyy")})]}),!r&&t.jsx(ee,{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:()=>n(e.id),disabled:s,children:t.jsx(cs,{className:"h-3.5 w-3.5"})})]})}function ag({issueId:e,className:n}){const[s,r]=h.useState(!1),{data:a,isLoading:o}=Gp(e),{data:i}=Qp(e),l=Xp(e),d=Jp(e),c=Zp(e),u=eg(e),m=(a==null?void 0:a.time_logs)??[],x=(a==null?void 0:a.total_minutes)??0,f=i!=null,b=v=>{l.mutate(v,{onSuccess:()=>{r(!1),Q.success("Time logged")},onError:()=>Q.error("Failed to log time")})},w=()=>{d.mutate(void 0,{onSuccess:()=>Q.success("Timer started"),onError:v=>Q.error(v.message??"Failed to start timer")})},S=()=>{c.mutate(void 0,{onSuccess:v=>{const N=v.time_log.duration_minutes??0;Q.success(`Timer stopped — ${Ir(N)} logged`)},onError:()=>Q.error("Failed to stop timer")})},g=v=>{u.mutate(v,{onSuccess:()=>Q.success("Time entry removed"),onError:()=>Q.error("Failed to remove entry")})};return t.jsxs("div",{className:I("px-6 py-4 space-y-4",n),children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] text-muted-foreground uppercase tracking-wider font-medium mb-0.5",children:"Total logged"}),t.jsx("p",{className:"text-xl font-bold text-foreground tabular-nums",children:x>0?Ir(x):"—"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[!s&&t.jsxs(ee,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5",onClick:()=>r(!0),children:[t.jsx(Ye,{className:"h-3.5 w-3.5"}),"Log time"]}),f?t.jsxs(ee,{size:"sm",variant:"destructive",className:"h-8 text-xs gap-1.5",onClick:S,disabled:c.isPending,children:[t.jsx(uu,{className:"h-3.5 w-3.5 fill-current"}),"Stop"]}):t.jsxs(ee,{size:"sm",className:"h-8 text-xs gap-1.5 bg-emerald-600 hover:bg-emerald-700 text-white",onClick:w,disabled:d.isPending,children:[t.jsx(zs,{className:"h-3.5 w-3.5 fill-current"}),"Start"]})]})]}),s&&t.jsx(sg,{onSubmit:b,isPending:l.isPending,onCancel:()=>r(!1)}),o?t.jsx("div",{className:"space-y-2",children:[1,2].map(v=>t.jsxs("div",{className:"flex items-center gap-3 px-3",children:[t.jsx(ue,{className:"h-7 w-7 rounded-full shrink-0"}),t.jsxs("div",{className:"flex-1 space-y-1.5",children:[t.jsx(ue,{className:"h-3 w-1/3"}),t.jsx(ue,{className:"h-2.5 w-1/4"})]})]},v))}):m.length>0?t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[t.jsx(Yt,{className:"h-3 w-3 text-muted-foreground"}),t.jsxs("span",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:[m.length," ",m.length===1?"entry":"entries"]})]}),t.jsx("div",{children:m.map(v=>t.jsx(rg,{entry:v,onDelete:g,isDeleting:u.isPending},v.id))})]}):t.jsx("p",{className:"text-sm text-muted-foreground/50 text-center py-1",children:"No time logged yet."})]})}function Xt({onClick:e,active:n,title:s,children:r}){return t.jsx("button",{type:"button",title:s,onMouseDown:a=>{a.preventDefault(),e()},className:I("flex h-6 w-6 items-center justify-center rounded transition-colors shrink-0","text-muted-foreground hover:text-foreground hover:bg-muted",n&&"bg-muted text-foreground"),children:r})}function eo(){return t.jsx("span",{className:"mx-0.5 h-3.5 w-px shrink-0 bg-border"})}function zl({issueId:e,compact:n,className:s,onSuccess:r}){var C,M;const[a,o]=h.useState(!0),[i,l]=h.useState([]),[d,c]=h.useState(!1),u=h.useRef(null),m=h.useRef(async()=>{}),{user:x}=Re(),f=Kh(e),b=Al(e),w=x&&`${((C=x.first_name)==null?void 0:C[0])??""}${((M=x.last_name)==null?void 0:M[0])??""}`.toUpperCase()||"?",S=h.useMemo(()=>wd.create({name:"submitShortcut",addKeyboardShortcuts(){return{"Mod-Enter":()=>(m.current(),!0)}}}),[]),g=zo({extensions:[Fo,Bo,qo.configure({placeholder:"Leave a comment…"}),S],editorProps:{attributes:{class:"meridian-editor"}},onUpdate({editor:E}){o(E.isEmpty)}}),v=!a||i.length>0,N=E=>{l(R=>{const B=new Set(R.map($=>`${$.name}-${$.size}`));return[...R,...E.filter($=>!B.has(`${$.name}-${$.size}`))]})},k=E=>{l(R=>R.filter((B,$)=>$!==E))},O=async()=>{if(!(!v||d)){c(!0);try{const E=g!=null&&g.isEmpty?"":(g==null?void 0:g.getHTML())??"",B=(await f.mutateAsync(E||" ")).comment.id;for(const $ of i)await b.mutateAsync({file:$,commentId:B});g==null||g.commands.clearContent(),o(!0),l([]),Q.success("Comment added"),r==null||r()}catch{Q.error("Failed to add comment")}finally{c(!1)}}};m.current=O;const p="h-3 w-3";return t.jsxs("div",{className:I("flex gap-3 items-start",s),children:[t.jsx(At,{className:"h-7 w-7 shrink-0 mt-1",children:t.jsx(Wt,{className:"text-[11px] bg-muted text-muted-foreground",children:w})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:I("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&&t.jsxs("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-border/70 bg-muted/30",children:[t.jsx(Xt,{title:"Bold (⌘B)",active:g.isActive("bold"),onClick:()=>g.chain().focus().toggleBold().run(),children:t.jsx(oi,{className:p})}),t.jsx(Xt,{title:"Italic (⌘I)",active:g.isActive("italic"),onClick:()=>g.chain().focus().toggleItalic().run(),children:t.jsx(bi,{className:p})}),t.jsx(Xt,{title:"Strikethrough",active:g.isActive("strike"),onClick:()=>g.chain().focus().toggleStrike().run(),children:t.jsx(ki,{className:p})}),t.jsx(Xt,{title:"Inline code",active:g.isActive("code"),onClick:()=>g.chain().focus().toggleCode().run(),children:t.jsx(fi,{className:p})}),t.jsx(eo,{}),t.jsx(Xt,{title:"Bullet list",active:g.isActive("bulletList"),onClick:()=>g.chain().focus().toggleBulletList().run(),children:t.jsx(vi,{className:p})}),t.jsx(Xt,{title:"Ordered list",active:g.isActive("orderedList"),onClick:()=>g.chain().focus().toggleOrderedList().run(),children:t.jsx(yi,{className:p})}),t.jsx(eo,{}),t.jsx(Xt,{title:"Code block",active:g.isActive("codeBlock"),onClick:()=>g.chain().focus().toggleCodeBlock().run(),children:t.jsx(mi,{className:p})})]}),t.jsx(Yo,{editor:g,className:I("px-3 py-2.5 text-sm",n?"min-h-[68px]":"min-h-[80px]")})]}),i.length>0&&t.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:i.map((E,R)=>t.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:[t.jsx(ya,{mimeType:E.type,className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx("span",{className:"truncate",children:E.name}),t.jsxs("span",{className:"text-muted-foreground shrink-0",children:["(",Js(E.size),")"]}),t.jsx("button",{type:"button",onClick:()=>k(R),className:"ml-0.5 rounded hover:text-destructive transition-colors shrink-0",children:t.jsx(Ze,{className:"h-3 w-3"})})]},R))}),t.jsxs("div",{className:"flex items-center justify-between mt-2",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>{var E;return(E=u.current)==null?void 0:E.click()},disabled:d,title:"Attach files",children:t.jsx(wi,{className:"h-3.5 w-3.5"})}),t.jsxs("span",{className:"text-[11px] text-muted-foreground/50 hidden sm:block",children:[t.jsx("kbd",{className:"px-1 py-0.5 rounded border border-border bg-muted font-mono text-[10px]",children:"⌘ Enter"})," to submit"]})]}),t.jsx(ee,{size:"icon",className:"h-8 w-8",onClick:O,disabled:!v||d,children:t.jsx(cu,{className:"h-3.5 w-3.5"})})]}),t.jsx("input",{ref:u,type:"file",multiple:!0,className:"hidden",onChange:E=>{const R=Array.from(E.target.files??[]);R.length>0&&N(R),E.target.value=""}})]})]})}function og({onClick:e,active:n,disabled:s,title:r,children:a}){return t.jsx("button",{type:"button",title:r,disabled:s,onMouseDown:o=>{o.preventDefault(),e()},className:I("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",n&&"bg-muted text-foreground"),children:a})}function Ms(){return t.jsx("span",{className:"mx-0.5 h-4 w-px shrink-0 bg-border"})}function va({content:e="",onChange:n,placeholder:s="Add a description…",className:r,toolbarClassName:a,editorClassName:o}){const i=zo({extensions:[Fo.configure({heading:{levels:[1,2,3]}}),Bo,jd,Nd.configure({nested:!0}),qo.configure({placeholder:s})],content:e||"",editorProps:{attributes:{class:"meridian-editor"}},onUpdate({editor:c}){n&&n(c.isEmpty?"":c.getHTML())}});if(!i)return null;const l=(c,u,m,x,f)=>t.jsx(og,{title:c,onClick:m,active:x,disabled:f,children:u},c),d="h-3.5 w-3.5";return t.jsxs("div",{className:I("flex flex-col overflow-hidden",r),children:[t.jsxs("div",{className:I("flex flex-wrap items-center gap-0.5 px-3 py-1.5 border-b border-border bg-muted/30",a),children:[l("Undo",t.jsx(pu,{className:d}),()=>i.chain().focus().undo().run(),!1,!i.can().undo()),l("Redo",t.jsx(du,{className:d}),()=>i.chain().focus().redo().run(),!1,!i.can().redo()),t.jsx(Ms,{}),l("Bold (⌘B)",t.jsx(oi,{className:d}),()=>i.chain().focus().toggleBold().run(),i.isActive("bold")),l("Italic (⌘I)",t.jsx(bi,{className:d}),()=>i.chain().focus().toggleItalic().run(),i.isActive("italic")),l("Underline (⌘U)",t.jsx(xu,{className:d}),()=>i.chain().focus().toggleUnderline().run(),i.isActive("underline")),l("Strikethrough",t.jsx(ki,{className:d}),()=>i.chain().focus().toggleStrike().run(),i.isActive("strike")),l("Inline code",t.jsx(fi,{className:d}),()=>i.chain().focus().toggleCode().run(),i.isActive("code")),t.jsx(Ms,{}),l("Heading 1",t.jsx(eu,{className:d}),()=>i.chain().focus().toggleHeading({level:1}).run(),i.isActive("heading",{level:1})),l("Heading 2",t.jsx(tu,{className:d}),()=>i.chain().focus().toggleHeading({level:2}).run(),i.isActive("heading",{level:2})),l("Heading 3",t.jsx(nu,{className:d}),()=>i.chain().focus().toggleHeading({level:3}).run(),i.isActive("heading",{level:3})),t.jsx(Ms,{}),l("Bullet list",t.jsx(vi,{className:d}),()=>i.chain().focus().toggleBulletList().run(),i.isActive("bulletList")),l("Ordered list",t.jsx(yi,{className:d}),()=>i.chain().focus().toggleOrderedList().run(),i.isActive("orderedList")),l("Task list",t.jsx(su,{className:d}),()=>i.chain().focus().toggleTaskList().run(),i.isActive("taskList")),t.jsx(Ms,{}),l("Blockquote",t.jsx(lu,{className:d}),()=>i.chain().focus().toggleBlockquote().run(),i.isActive("blockquote")),l("Code block",t.jsx(mi,{className:d}),()=>i.chain().focus().toggleCodeBlock().run(),i.isActive("codeBlock")),l("Divider line",t.jsx(ds,{className:d}),()=>i.chain().focus().setHorizontalRule().run())]}),t.jsx(Yo,{editor:i,className:I("flex-1 px-5 py-4",o)})]})}function wa({html:e,className:n}){return e?t.jsx("div",{className:I("meridian-editor",n),dangerouslySetInnerHTML:{__html:e}}):null}function ig({body:e}){const n=e.trim();return n?/^<[a-z][\s\S]*>/i.test(n)?t.jsx(wa,{html:n,className:"text-xs"}):t.jsx("p",{className:"text-xs text-foreground leading-relaxed whitespace-pre-wrap",children:n}):null}const to={created:{icon:Ye,color:"text-emerald-600",bg:"bg-emerald-50 dark:bg-emerald-950/40"},status_changed:{icon:Lr,color:"text-indigo-500",bg:"bg-indigo-50 dark:bg-indigo-950/40"},assigned:{icon:Si,color:"text-blue-500",bg:"bg-blue-50 dark:bg-blue-950/40"},unassigned:{icon:bu,color:"text-zinc-500",bg:"bg-zinc-100 dark:bg-zinc-800"},updated:{icon:Ws,color:"text-amber-500",bg:"bg-amber-50 dark:bg-amber-950/40"}};function lg(e,n){var a,o,i,l;const{action:s,changes:r}=e;if(s==="created")return"created this issue";if(s==="status_changed"){const d=(a=r==null?void 0:r.status)==null?void 0:a.from,c=(o=r==null?void 0:r.status)==null?void 0:o.to;return t.jsxs(t.Fragment,{children:["changed status",d&&t.jsxs(t.Fragment,{children:[" from ",t.jsx("strong",{className:"font-medium text-foreground",children:un[d]??d})]}),c&&t.jsxs(t.Fragment,{children:[" to ",t.jsx("strong",{className:"font-medium text-foreground",children:un[c]??c})]})]})}if(s==="assigned"||s==="unassigned"){const d=((i=r==null?void 0:r.assignee_ids)==null?void 0:i.to)??[],c=((l=r==null?void 0:r.assignee_ids)==null?void 0:l.from)??[],u=d.filter(f=>!c.includes(f)),m=c.filter(f=>!d.includes(f)),x=f=>{var b;return((b=n==null?void 0:n.get(f))==null?void 0:b.name)??f.slice(0,8)+"…"};return u.length>0&&m.length>0?t.jsx(t.Fragment,{children:"updated assignees"}):u.length>0?t.jsxs(t.Fragment,{children:["assigned ",t.jsx("strong",{className:"font-medium text-foreground",children:u.map(x).join(", ")})]}):m.length>0?t.jsxs(t.Fragment,{children:["unassigned ",t.jsx("strong",{className:"font-medium text-foreground",children:m.map(x).join(", ")})]}):"updated assignees"}if(s==="updated"&&r){const d=[];for(const[c,u]of Object.entries(r)){const{from:m,to:x}=u;c==="title"||c==="description"?d.push(t.jsxs("span",{children:["updated ",t.jsx("strong",{className:"font-medium text-foreground",children:c})]},c)):c==="priority"?d.push(t.jsxs("span",{children:["changed ",t.jsx("strong",{className:"font-medium text-foreground",children:"priority"}),m!=null&&t.jsxs(t.Fragment,{children:[" from ",t.jsx("strong",{className:"font-medium text-foreground",children:St[m]??String(m)})]}),x!=null&&t.jsxs(t.Fragment,{children:[" to ",t.jsx("strong",{className:"font-medium text-foreground",children:St[x]??String(x)})]})]},c)):c==="type"?d.push(t.jsxs("span",{children:["changed ",t.jsx("strong",{className:"font-medium text-foreground",children:"type"}),m!=null&&t.jsxs(t.Fragment,{children:[" from ",t.jsx("strong",{className:"font-medium text-foreground",children:zt[m]??String(m)})]}),x!=null&&t.jsxs(t.Fragment,{children:[" to ",t.jsx("strong",{className:"font-medium text-foreground",children:zt[x]??String(x)})]})]},c)):d.push(t.jsxs("span",{children:["updated ",t.jsx("strong",{className:"font-medium text-foreground",children:c.replace(/_/g," ")})]},c))}return d.length===0?"made changes":t.jsx(t.Fragment,{children:d.reduce((c,u,m)=>m===0?[u]:[...c,t.jsx("span",{children:" and "},`sep-${m}`),u],[])})}return s.replace(/_/g," ")}function Fl({issueId:e,className:n,compact:s,onViewMore:r,onTabChange:a,hideCommentInput:o}){const[i,l]=h.useState("comments"),d=g=>{l(g),a==null||a(g)},{user:c}=Re(),{data:u}=ml(),{data:m,isLoading:x}=Vh(e),{data:f,isLoading:b}=Uh(e),{data:w}=Rl(e),S=g=>{var v;if(c&&g===c.id){const N=c.first_name??"",k=c.last_name??"",O=`${N} ${k}`.trim()||c.email,p=(N[0]??k[0]??((v=c.email)==null?void 0:v[0])??"U").toUpperCase();return{name:O,initials:p}}return(u==null?void 0:u.get(g))??{name:"Unknown",initials:"?"}};return t.jsxs("div",{className:n,children:[t.jsx("div",{className:"flex items-center gap-0.5 px-6 pt-4 pb-2 flex-wrap",children:["comments","activity","attachments","time"].map(g=>{const v=g==="comments"?(m==null?void 0:m.length)??0:g==="activity"?(f==null?void 0:f.length)??0:void 0,N=g==="comments"?"Comments":g==="activity"?"Activity":g==="attachments"?"Attachments":"Time";return t.jsxs("button",{onClick:()=>d(g),className:I("px-3 py-1.5 text-xs font-medium rounded-md transition-colors",i===g?"bg-foreground/5 text-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted/50"),children:[N,v!=null&&v>0&&t.jsx("span",{className:"ml-1.5 text-[10px] tabular-nums text-muted-foreground",children:v})]},g)})}),i==="comments"&&t.jsxs("div",{className:"px-6 pb-5",children:[t.jsx("div",{className:"space-y-5 mb-5",children:x?t.jsxs("div",{className:"flex gap-3",children:[t.jsx(ue,{className:"h-7 w-7 rounded-full shrink-0"}),t.jsx(ue,{className:"h-16 flex-1"})]}):m&&m.length>0?(s?m.slice(-5):m).map(g=>{const v=S(g.author_id),N=(w??[]).filter(k=>k.comment_id===g.id);return t.jsxs("div",{className:"flex gap-3",children:[t.jsx(At,{className:"h-7 w-7 mt-0.5 shrink-0",children:t.jsx(Wt,{className:"text-[11px] bg-muted text-muted-foreground",children:v.initials})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-baseline gap-2 mb-1",children:[t.jsx("span",{className:"text-xs font-medium text-foreground",children:v.name}),t.jsx("span",{className:"text-[11px] text-muted-foreground",children:le(new Date(g.created_at),"MMM d, h:mm a")})]}),t.jsx(ig,{body:g.body}),N.length>0&&t.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:N.map(k=>t.jsx(Lp,{attachment:k},k.id))})]})]},g.id)}):t.jsx("p",{className:"text-sm text-muted-foreground/50 py-2",children:"No comments yet."})}),s&&m&&m.length>5&&r&&t.jsxs("button",{onClick:r,className:"text-xs text-muted-foreground hover:text-foreground mb-4 underline underline-offset-2",children:["View all ",m.length," comments"]}),!o&&t.jsx(zl,{issueId:e})]}),i==="activity"&&t.jsx("div",{className:"px-6 pb-6",children:b?t.jsx("div",{className:"space-y-4 pt-1",children:[1,2,3].map(g=>t.jsxs("div",{className:"flex gap-3",children:[t.jsx(ue,{className:"h-6 w-6 rounded-full shrink-0 mt-0.5"}),t.jsx(ue,{className:"h-4 flex-1 mt-1"})]},g))}):f&&f.length>0?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{className:"absolute left-[11px] top-2 bottom-2 w-px bg-border"}),t.jsx("div",{className:"space-y-0",children:(s?f.slice(-5):f).map((g,v,N)=>{var M;const k=to[g.action]??to.updated,O=k.icon,p=((M=u==null?void 0:u.get(g.actor_id))==null?void 0:M.name)??"System",C=v===N.length-1;return t.jsxs("div",{className:I("relative flex gap-3",C?"pb-0":"pb-4"),children:[t.jsx("div",{className:I("relative z-10 flex h-6 w-6 shrink-0 items-center justify-center rounded-full mt-0.5",k.bg),children:t.jsx(O,{className:I("h-3 w-3",k.color)})}),t.jsxs("div",{className:"flex-1 min-w-0 pt-0.5",children:[t.jsxs("p",{className:"text-xs text-foreground leading-relaxed",children:[t.jsx("span",{className:"font-medium",children:p})," ",t.jsx("span",{className:"text-muted-foreground",children:lg(g,u)})]}),t.jsx("p",{className:"text-[11px] text-muted-foreground/60 mt-0.5",children:le(new Date(g.created_at),"MMM d, yyyy · h:mm a")})]})]},g.id)})})]}),s&&f.length>5&&r&&t.jsxs("button",{onClick:r,className:"text-xs text-muted-foreground hover:text-foreground mt-3 underline underline-offset-2",children:["View all ",f.length," events"]})]}):t.jsx("p",{className:"text-sm text-muted-foreground/50 py-2",children:"No activity yet."})}),i==="attachments"&&t.jsx(Kp,{issueId:e}),i==="time"&&t.jsx(ag,{issueId:e})]})}const Bl=h.forwardRef(({className:e,children:n,...s},r)=>t.jsxs(To,{ref:r,className:I("relative overflow-hidden",e),...s,children:[t.jsx(hd,{className:"h-full w-full rounded-[inherit]",children:n}),t.jsx(ql,{}),t.jsx(xd,{})]}));Bl.displayName=To.displayName;const ql=h.forwardRef(({className:e,orientation:n="vertical",...s},r)=>t.jsx(Po,{ref:r,orientation:n,className:I("flex touch-none select-none transition-colors",n==="vertical"&&"h-full w-1.5 border-l border-l-transparent p-[1px]",n==="horizontal"&&"h-1.5 flex-col border-t border-t-transparent p-[1px]",e),...s,children:t.jsx(pd,{className:"relative flex-1 rounded-full bg-border"})}));ql.displayName=Po.displayName;function dg(e){if(!e.start_date&&!e.end_date)return null;const n=e.start_date?le(new Date(e.start_date),"MMM d"):"—",s=e.end_date?le(new Date(e.end_date),"MMM d"):"—";return`${n} – ${s}`}function Yl({issue:e,projectId:n,open:s,onClose:r}){const a=Ge(),{workspace:o,projectKey:i}=et(),[l,d]=h.useState(!1),[c,u]=h.useState(""),[m,x]=h.useState(""),[f,b]=h.useState("comments"),[w,S]=h.useState(!1),g=da((e==null?void 0:e.id)??"",n),{data:v}=Rn(n),{data:N}=An(n||void 0),{data:k}=ys(n||void 0),{data:O}=bs(n||void 0),p=(N??[]).filter(j=>j.status!=="completed"),C=e!=null&&e.parent_id?O==null?void 0:O.find(j=>j.id===e.parent_id):null,M=(O==null?void 0:O.filter(j=>j.parent_id===(e==null?void 0:e.id)))??[],E=e!=null&&e.task_list_id?k==null?void 0:k.find(j=>j.id===e.task_list_id):null,R=v&&v.length>0?Object.fromEntries(v.map(j=>[j.key,j.name])):un;if(h.useEffect(()=>{e&&(u(e.title),x(e.description??"")),d(!1)},[e==null?void 0:e.id]),!e)return null;const B=()=>{c.trim()&&g.mutate({title:c.trim(),description:m.trim()||void 0},{onSuccess:()=>{d(!1),Q.success("Issue updated")},onError:()=>Q.error("Failed to update issue")})},$=()=>{u(e.title),x(e.description??""),d(!1)},W=j=>{g.mutate({status:j},{onSuccess:()=>Q.success("Status updated"),onError:()=>Q.error("Failed to update status")})},P=j=>{g.mutate({priority:j},{onSuccess:()=>Q.success("Priority updated"),onError:()=>Q.error("Failed to update priority")})},U=j=>{g.mutate({type:j},{onSuccess:()=>Q.success("Type updated"),onError:()=>Q.error("Failed to update type")})},_=j=>{g.mutate({assignee_ids:j},{onSuccess:()=>Q.success("Assignees updated"),onError:()=>Q.error("Failed to update assignees")})},Y=j=>{g.mutate({sprint_id:j},{onSuccess:()=>Q.success(j?"Sprint assigned":"Removed from sprint"),onError:()=>Q.error("Failed to update sprint")})},X=j=>{g.mutate({task_list_id:j},{onSuccess:()=>Q.success(j?"Moved to list":"Removed from list"),onError:()=>Q.error("Failed to update list")})},A=j=>{g.mutate({due_date:j?le(j,"yyyy-MM-dd"):null},{onSuccess:()=>Q.success(j?"Due date set":"Due date cleared"),onError:()=>Q.error("Failed to update due date")})};return t.jsxs(t.Fragment,{children:[t.jsx(fn,{open:s,onOpenChange:j=>!j&&r(),children:t.jsxs(hn,{className:"flex flex-col p-0 w-full max-w-2xl overflow-hidden [&>button]:right-4",children:[t.jsxs(xn,{className:"pr-10",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-xs font-mono text-muted-foreground",children:e.identifier}),t.jsx(Zs,{variant:"muted",className:"text-[10px]",children:zt[e.type]??e.type})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsxs(ee,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-foreground gap-1.5",onClick:()=>{r(),a(`/${o}/projects/${i}/issues/${e.id}`)},children:[t.jsx(Gr,{className:"h-3.5 w-3.5"}),"Open"]}),l?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsxs(ee,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground",onClick:$,children:[t.jsx(Ze,{className:"h-3.5 w-3.5"}),"Cancel"]}),t.jsxs(ee,{size:"sm",className:"h-7 text-xs gap-1.5",onClick:B,disabled:!c.trim()||g.isPending,children:[t.jsx(wt,{className:"h-3.5 w-3.5"}),"Save"]})]}):t.jsxs(ee,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-foreground gap-1.5",onClick:()=>d(!0),children:[t.jsx(Ws,{className:"h-3.5 w-3.5"}),"Edit"]})]})]}),l?t.jsx(Ne,{value:c,onChange:j=>u(j.target.value),className:"text-sm font-medium h-8",autoFocus:!0}):t.jsx(pn,{className:"text-base font-medium leading-snug text-left",children:e.title})]}),t.jsxs(Bl,{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"px-6 py-4 space-y-5 min-w-0",children:[t.jsxs("div",{className:"grid grid-cols-3 gap-3 mb-1",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Status"}),t.jsxs(_e,{value:e.status,onValueChange:W,children:[t.jsx(De,{className:"h-8 text-xs bg-transparent min-w-0",children:t.jsx(Be,{})}),t.jsx(Oe,{children:Object.entries(R).map(([j,G])=>t.jsx(me,{value:j,className:"text-xs",children:G},j))})]})]}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Priority"}),t.jsxs(_e,{value:e.priority,onValueChange:P,children:[t.jsx(De,{className:"h-8 text-xs bg-transparent min-w-0",children:t.jsx(Be,{})}),t.jsx(Oe,{children:Object.entries(St).map(([j,G])=>t.jsx(me,{value:j,className:"text-xs",children:G},j))})]})]}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Type"}),t.jsxs(_e,{value:e.type,onValueChange:U,children:[t.jsx(De,{className:"h-8 text-xs bg-transparent min-w-0",children:t.jsx(Be,{})}),t.jsx(Oe,{children:Object.entries(zt).map(([j,G])=>t.jsx(me,{value:j,className:"text-xs",children:G},j))})]})]})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Assignees"}),t.jsx(vs,{value:e.assignee_ids??[],onChange:_,disabled:g.isPending})]}),t.jsxs("div",{className:"flex gap-3 items-start min-w-0",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Sprint"}),t.jsxs(_e,{value:e.sprint_id??"none",onValueChange:j=>Y(j==="none"?null:j),children:[t.jsx(De,{className:"h-8 text-xs bg-transparent min-w-0",children:t.jsxs("div",{className:"flex items-center gap-1 min-w-0 overflow-hidden",children:[t.jsx(pt,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx(Be,{placeholder:"No sprint"})]})}),t.jsxs(Oe,{children:[t.jsx(me,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),p.map(j=>{const G=dg(j);return t.jsx(me,{value:j.id,className:"text-xs",children:t.jsxs("div",{className:"flex items-baseline gap-1.5",children:[t.jsx("span",{children:j.name}),G&&t.jsx("span",{className:"text-[10px] text-muted-foreground font-normal",children:G})]})},j.id)})]})]})]}),(k??[]).length>0&&t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"List"}),t.jsxs(_e,{value:e.task_list_id??"none",onValueChange:j=>X(j==="none"?null:j),children:[t.jsx(De,{className:"h-8 text-xs bg-transparent min-w-0",children:t.jsxs("div",{className:"flex items-center gap-1 min-w-0 overflow-hidden",children:[t.jsx(Qr,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx(Be,{placeholder:"No list",children:E?E.name:"No list"})]})}),t.jsxs(Oe,{children:[t.jsx(me,{value:"none",className:"text-xs text-muted-foreground",children:"No list"}),(k??[]).map(j=>t.jsx(me,{value:j.id,className:"text-xs",children:j.name},j.id))]})]})]}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Due Date"}),t.jsxs(at,{children:[t.jsx(ot,{asChild:!0,children:t.jsxs("button",{className:"flex items-center gap-1 h-8 w-full min-w-0 px-2 rounded border border-input text-xs bg-transparent hover:bg-accent transition-colors overflow-hidden",children:[t.jsx(ln,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx("span",{className:`truncate ${e.due_date?"text-foreground":"text-muted-foreground"}`,children:e.due_date?le(new Date(e.due_date),"MMM d, yyyy"):"No date"})]})}),t.jsxs(Je,{className:"w-auto p-0",align:"start",children:[t.jsx(Ft,{mode:"single",selected:e.due_date?new Date(e.due_date):void 0,onSelect:A,initialFocus:!0}),e.due_date&&t.jsx("div",{className:"border-t px-3 py-2",children:t.jsxs("button",{onClick:()=>A(void 0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[t.jsx(Ze,{className:"h-3 w-3"}),"Clear date"]})})]})]})]})]}),!e.parent_id&&t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("p",{className:"text-xs text-muted-foreground",children:"Child Issues"}),t.jsxs("button",{onClick:()=>S(!0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Ye,{className:"h-3 w-3"}),"Add"]})]}),C&&t.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[t.jsx(Ur,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),t.jsx("span",{className:"text-muted-foreground shrink-0",children:"Parent:"}),t.jsx("button",{onClick:()=>a(`/${o}/projects/${i}/issues/${C.id}`),className:"font-mono text-muted-foreground hover:text-foreground transition-colors shrink-0",children:C.identifier}),t.jsx("span",{className:"text-foreground truncate",children:C.title})]}),M.length===0&&!C?t.jsx("p",{className:"text-xs text-muted-foreground/40 italic",children:"No child issues yet"}):t.jsx("div",{className:"space-y-1",children:M.map(j=>t.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[t.jsx(hi,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),t.jsx("button",{onClick:()=>{r(),a(`/${o}/projects/${i}/issues/${j.id}`)},className:"font-mono text-muted-foreground hover:text-foreground transition-colors shrink-0",children:j.identifier}),t.jsx("button",{onClick:()=>{r(),a(`/${o}/projects/${i}/issues/${j.id}`)},className:"text-muted-foreground truncate hover:text-foreground transition-colors text-left",children:j.title})]},j.id))})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Description"}),l?t.jsx(va,{content:m,onChange:x,placeholder:"Add a description…",className:"min-h-[160px] rounded-md border border-input"},`${e.id}-edit`):e.description?t.jsx(wa,{html:e.description,className:"text-sm"}):t.jsx("p",{className:"text-sm text-muted-foreground/50 italic",children:"No description"})]})]}),t.jsx(Fl,{issueId:e.id,className:"border-t border-border",compact:!0,hideCommentInput:!0,onTabChange:b,onViewMore:()=>{r(),a(`/${o}/projects/${i}/issues/${e.id}`)}})]}),f==="comments"&&t.jsx("div",{className:"border-t border-border px-6 py-3 shrink-0",children:t.jsx(zl,{issueId:e.id,compact:!0})})]})}),t.jsx(Qs,{open:w,onClose:()=>S(!1),projectId:n,defaultParentId:e.id,defaultTaskListId:e.task_list_id})]})}function cg(){const{projectKey:e}=et(),[n,s]=h.useState(null),[r,a]=h.useState(!1),{data:o}=Pn(e??""),i=(o==null?void 0:o.id)??"",{data:l,isLoading:d}=bs(i||void 0),{data:c,isLoading:u}=Rn(i||void 0),m=Qh(i);if(!e)return null;const x=d||u||!o,f=b=>{m.mutate(b)};return t.jsxs("div",{className:"flex flex-col h-full gap-0",children:[t.jsxs("div",{className:"flex flex-col flex-1 min-h-0 bg-white dark:bg-card",children:[t.jsx("div",{className:"flex items-center justify-end px-6 py-3 border-b border-border shrink-0",children:t.jsxs(ee,{size:"sm",onClick:()=>a(!0),children:[t.jsx(Ye,{className:"h-4 w-4"}),"Create"]})}),t.jsx("div",{className:"flex-1 min-h-0",children:x?t.jsx("div",{className:"flex gap-4 px-6 py-6",children:[1,2,3,4].map(b=>t.jsxs("div",{className:"min-w-[260px]",children:[t.jsx(ue,{className:"h-5 w-24 mb-3 rounded"}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ue,{className:"h-[82px] w-full rounded-lg"}),t.jsx(ue,{className:"h-[82px] w-full rounded-lg"})]})]},b))}):t.jsx(ix,{issues:l??[],projectId:i,statuses:c??[],onIssueClick:s,onColumnsReorder:f})})]}),t.jsx(Yl,{issue:n,projectId:i,open:!!n,onClose:()=>s(null)}),t.jsx(Qs,{open:r,onClose:()=>a(!1),projectId:i})]})}const no=({priority:e,className:n})=>{const s=I("h-3.5 w-3.5 shrink-0",fl[e],n);switch(e){case"urgent":return t.jsx(us,{className:s});case"high":return t.jsx($s,{className:s});case"medium":return t.jsx(ds,{className:s});case"low":return t.jsx(Is,{className:s});default:return t.jsx(xt,{className:I("h-3.5 w-3.5 shrink-0 text-zinc-300",n)})}};function Hl({issue:e,projectId:n,statuses:s,statusLabels:r,statusColorMap:a,sprints:o,workspace:i,projectKey:l,onOpen:d,isChild:c=!1,children:u=[],onAddChild:m}){const x=Ge(),[f,b]=h.useState(null),[w,S]=h.useState(!1),g=da(e.id,n);function v(p){g.mutate(p),b(null)}const N=(a==null?void 0:a[e.status])??"#94a3b8",k=o.find(p=>p.id===e.sprint_id),O=u.length>0;return t.jsxs(t.Fragment,{children:[t.jsxs("div",{onClick:()=>d(e),className:I("group grid grid-cols-[70px_1fr_150px_120px_130px_140px_130px_32px] items-center px-6 py-3","hover:bg-[#f9fafb] dark:hover:bg-muted/30 cursor-pointer transition-colors",c&&"pl-14 bg-muted/10",g.isPending&&"opacity-70"),children:[t.jsx("span",{className:I("text-xs font-mono text-muted-foreground truncate",c&&"text-muted-foreground/60"),children:e.identifier}),t.jsxs("div",{className:"flex items-center gap-1 min-w-0 pr-3",children:[!c&&O&&t.jsxs(sn,{children:[t.jsx(rn,{asChild:!0,children:t.jsx("button",{onClick:p=>{p.stopPropagation(),S(!w)},className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors p-0.5 rounded",children:w?t.jsx(is,{className:"h-3.5 w-3.5"}):t.jsx(ls,{className:"h-3.5 w-3.5"})})}),t.jsx(Rt,{side:"top",children:w?"Collapse":"Expand"})]}),!c&&!O&&t.jsx("span",{className:"w-4 shrink-0"}),c&&t.jsx("span",{className:"text-muted-foreground/40 shrink-0 text-xs",children:"↳"}),t.jsx("span",{className:I("text-sm text-foreground truncate",c&&"text-muted-foreground"),children:e.title}),!c&&O&&t.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground/60 ml-1 font-mono",children:u.length})]}),t.jsx("div",{onClick:p=>p.stopPropagation(),children:t.jsxs(at,{open:f==="status",onOpenChange:p=>b(p?"status":null),children:[t.jsx(ot,{asChild:!0,children:t.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:[t.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:N}}),t.jsx("span",{className:"text-xs text-muted-foreground truncate",children:r[e.status]??e.status})]})}),t.jsx(Je,{className:"w-52 p-1",align:"start",onClick:p=>p.stopPropagation(),children:t.jsx(Cn,{children:t.jsx(Mn,{children:t.jsx(on,{children:s.map(p=>t.jsxs(rt,{value:p.name,onSelect:()=>v({status:p.key}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[t.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:p.color}}),t.jsx("span",{className:"text-xs flex-1",children:p.name}),e.status===p.key&&t.jsx(wt,{className:"h-3.5 w-3.5 text-indigo-500"})]},p.key))})})})})]})}),t.jsx("div",{onClick:p=>p.stopPropagation(),children:t.jsxs(at,{open:f==="priority",onOpenChange:p=>b(p?"priority":null),children:[t.jsx(ot,{asChild:!0,children:t.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:[t.jsx(no,{priority:e.priority}),t.jsx("span",{className:"text-xs text-muted-foreground",children:St[e.priority]??e.priority})]})}),t.jsx(Je,{className:"w-44 p-1",align:"start",onClick:p=>p.stopPropagation(),children:t.jsx(Cn,{children:t.jsx(Mn,{children:t.jsx(on,{children:Object.entries(St).map(([p,C])=>t.jsxs(rt,{value:C,onSelect:()=>v({priority:p}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[t.jsx(no,{priority:p}),t.jsx("span",{className:"text-xs flex-1",children:C}),e.priority===p&&t.jsx(wt,{className:"h-3.5 w-3.5 text-indigo-500"})]},p))})})})})]})}),t.jsx("div",{onClick:p=>p.stopPropagation(),children:t.jsxs(at,{open:f==="sprint",onOpenChange:p=>b(p?"sprint":null),children:[t.jsx(ot,{asChild:!0,children:t.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:[t.jsx(pt,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),t.jsx("span",{className:I("text-xs truncate",k?"text-foreground":"text-muted-foreground"),children:(k==null?void 0:k.name)??"No sprint"})]})}),t.jsx(Je,{className:"w-56 p-1",align:"start",onClick:p=>p.stopPropagation(),children:t.jsx(Cn,{children:t.jsx(Mn,{children:t.jsxs(on,{children:[t.jsxs(rt,{value:"no-sprint",onSelect:()=>v({sprint_id:null}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[t.jsx(Ze,{className:"h-3.5 w-3.5 text-muted-foreground"}),t.jsx("span",{className:"text-xs flex-1 text-muted-foreground",children:"No sprint"}),!e.sprint_id&&t.jsx(wt,{className:"h-3.5 w-3.5 text-indigo-500"})]}),o.filter(p=>p.status!=="completed").map(p=>t.jsxs(rt,{value:p.name,onSelect:()=>v({sprint_id:p.id}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[t.jsx(pt,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-xs truncate",children:p.name}),(p.start_date||p.end_date)&&t.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[p.start_date?le(new Date(p.start_date),"MMM d"):"—"," → ",p.end_date?le(new Date(p.end_date),"MMM d"):"—"]})]}),e.sprint_id===p.id&&t.jsx(wt,{className:"h-3.5 w-3.5 text-indigo-500 shrink-0"})]},p.id))]})})})})]})}),t.jsx("div",{onClick:p=>p.stopPropagation(),children:t.jsxs(at,{open:f==="due",onOpenChange:p=>b(p?"due":null),children:[t.jsx(ot,{asChild:!0,children:t.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:[t.jsx(ln,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),t.jsx("span",{className:I("text-xs",e.due_date?"text-foreground":"text-muted-foreground"),children:e.due_date?le(new Date(e.due_date),"MMM d, yyyy"):"No due date"})]})}),t.jsxs(Je,{className:"w-auto p-0",align:"start",onClick:p=>p.stopPropagation(),children:[t.jsx(Ft,{mode:"single",selected:e.due_date?new Date(e.due_date):void 0,onSelect:p=>v({due_date:p?le(p,"yyyy-MM-dd"):null}),initialFocus:!0}),e.due_date&&t.jsx("div",{className:"border-t px-3 py-2",children:t.jsxs("button",{onClick:()=>v({due_date:null}),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[t.jsx(Ze,{className:"h-3 w-3"}),"Clear date"]})})]})]})}),t.jsx("div",{onClick:p=>p.stopPropagation(),children:t.jsx(vs,{value:e.assignee_ids??[],onChange:p=>g.mutate({assignee_ids:p})})}),t.jsxs("div",{className:"flex items-center gap-1",onClick:p=>p.stopPropagation(),children:[!c&&m&&t.jsxs(sn,{children:[t.jsx(rn,{asChild:!0,children:t.jsx("button",{onClick:()=>m(e.id),className:"p-1 rounded hover:bg-border text-muted-foreground hover:text-foreground",children:t.jsx(ru,{className:"h-3.5 w-3.5"})})}),t.jsx(Rt,{side:"top",children:"Add child issue"})]}),t.jsxs(sn,{children:[t.jsx(rn,{asChild:!0,children:t.jsx("button",{onClick:()=>x(`/${i}/projects/${l}/issues/${e.id}`),className:"p-1 rounded hover:bg-border text-muted-foreground hover:text-foreground",children:t.jsx(Gr,{className:"h-3.5 w-3.5"})})}),t.jsx(Rt,{side:"top",children:"Open full page"})]})]})]}),!c&&w&&u.map(p=>t.jsx(Hl,{issue:p,projectId:n,statuses:s,statusLabels:r,statusColorMap:a,sprints:o,workspace:i,projectKey:l,onOpen:d,isChild:!0},p.id))]})}function so({taskList:e,issues:n,childrenMap:s,projectId:r,statuses:a,statusLabels:o,statusColorMap:i,sprints:l,workspace:d,projectKey:c,onOpen:u,onAddIssue:m,onAddChild:x,onRenameList:f,onDeleteList:b}){const[w,S]=h.useState(!1),[g,v]=h.useState(!1),[N,k]=h.useState((e==null?void 0:e.name)??""),O=n.reduce((M,E)=>{var R;return M+(((R=s[E.id])==null?void 0:R.length)??0)},0),p=n.length+O,C=()=>{e&&N.trim()&&f&&f(e.id,N.trim()),v(!1)};return t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2 px-6 py-2 bg-muted/20 border-b border-border group/header",children:[t.jsxs(sn,{children:[t.jsx(rn,{asChild:!0,children:t.jsx("button",{onClick:()=>S(!w),className:"text-muted-foreground hover:text-foreground transition-colors",children:w?t.jsx(ls,{className:"h-3.5 w-3.5"}):t.jsx(is,{className:"h-3.5 w-3.5"})})}),t.jsx(Rt,{side:"right",children:w?"Expand":"Collapse"})]}),e?g?t.jsx("input",{autoFocus:!0,value:N,onChange:M=>k(M.target.value),onBlur:C,onKeyDown:M=>{M.key==="Enter"&&C(),M.key==="Escape"&&(v(!1),k(e.name))},className:"text-xs font-semibold text-foreground bg-transparent border-b border-indigo-400 outline-none px-0.5"}):t.jsx("span",{className:"text-xs font-semibold text-foreground",children:e.name}):t.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"No List"}),t.jsx("span",{className:"text-[11px] text-muted-foreground/60 font-mono",children:p}),t.jsxs("div",{className:"flex items-center gap-1 ml-auto",children:[t.jsxs("button",{onClick:()=>m((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:[t.jsx(Ye,{className:"h-3 w-3"}),"Add issue"]}),e&&t.jsxs(qs,{children:[t.jsxs(sn,{children:[t.jsx(rn,{asChild:!0,children:t.jsx(Ys,{asChild:!0,children:t.jsx("button",{className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:t.jsx(xi,{className:"h-3.5 w-3.5"})})})}),t.jsx(Rt,{side:"top",children:"More options"})]}),t.jsxs(ms,{align:"end",className:"w-36",children:[t.jsxs(kt,{className:"text-xs gap-2 cursor-pointer",onClick:()=>{v(!0),k(e.name)},children:[t.jsx(Ws,{className:"h-3.5 w-3.5"}),"Rename"]}),t.jsxs(kt,{className:"text-xs gap-2 cursor-pointer text-destructive focus:text-destructive",onClick:()=>b==null?void 0:b(e.id),children:[t.jsx(cs,{className:"h-3.5 w-3.5"}),"Delete list"]})]})]})]})]}),!w&&t.jsx("div",{className:"divide-y divide-border/60",children:n.length===0?t.jsx("div",{className:"px-14 py-3 text-xs text-muted-foreground/50 italic",children:"No issues in this list"}):n.map(M=>t.jsx(Hl,{issue:M,projectId:r,statuses:a,statusLabels:o,statusColorMap:i,sprints:l,workspace:d,projectKey:c,onOpen:u,children:s[M.id]??[],onAddChild:x},M.id))})]})}function ug(){var se;const{workspace:e,projectKey:n}=et(),[s,r]=h.useState(null),[a,o]=h.useState({open:!1}),[i,l]=h.useState(""),[d,c]=h.useState(!1),[u,m]=h.useState(""),[x,f]=h.useState("all"),[b,w]=h.useState("all"),[S,g]=h.useState("all"),{data:v}=Pn(n??""),N=(v==null?void 0:v.id)??"",{data:k,isLoading:O}=bs(N||void 0),{data:p}=Rn(N||void 0),{data:C}=An(N||void 0),{data:M}=ys(N||void 0),E=ux(N),R=mx(N),B=fx(N),$=p&&p.length>0?p:Object.entries(un).map(([T,re],xe)=>({id:T,project_id:N,key:T,name:re,color:{backlog:"#94a3b8",todo:"#64748b",in_progress:"#6366f1",in_review:"#f59e0b",done:"#10b981",cancelled:"#9ca3af"}[T]??"#94a3b8",category:{backlog:"backlog",todo:"unstarted",in_progress:"started",in_review:"started",done:"completed",cancelled:"cancelled"}[T]??"backlog",position:xe})),W=Object.fromEntries($.map(T=>[T.key,T.name])),P=Object.fromEntries($.map(T=>[T.key,T.color])),U=C??[];if(!n||!e)return null;const _=(k??[]).filter(T=>{const re=!u||T.title.toLowerCase().includes(u.toLowerCase())||T.identifier.toLowerCase().includes(u.toLowerCase()),xe=x==="all"||T.status===x,Se=b==="all"||T.priority===b,Ae=S==="all"||(S==="none"?!T.sprint_id:T.sprint_id===S);return re&&xe&&Se&&Ae}).sort((T,re)=>{const xe=parseInt(T.identifier.split("-")[1]??"0",10),Se=parseInt(re.identifier.split("-")[1]??"0",10);return xe-Se}),Y={};for(const T of k??[])T.parent_id&&(Y[T.parent_id]||(Y[T.parent_id]=[]),Y[T.parent_id].push(T));const X=_.filter(T=>!T.parent_id),A=_.length,j=new Set((M??[]).map(T=>T.id)),G={__none__:[]};for(const T of M??[])G[T.id]=[];for(const T of X){const re=T.task_list_id&&j.has(T.task_list_id)?T.task_list_id:"__none__";G[re].push(T)}function D(){i.trim()&&E.mutate({name:i.trim()},{onSuccess:()=>{l(""),c(!1),Q.success("List created")},onError:()=>Q.error("Failed to create list")})}function z(T,re){R.mutate({id:T,name:re},{onError:()=>Q.error("Failed to rename list")})}function L(T){const re=M==null?void 0:M.find(xe=>xe.id===T);confirm(`Delete list "${re==null?void 0:re.name}"? Issues in this list will be moved to No List.`)&&B.mutate(T,{onSuccess:()=>Q.success("List deleted"),onError:()=>Q.error("Failed to delete list")})}const H="grid-cols-[70px_1fr_150px_120px_130px_140px_130px_32px]";return t.jsxs("div",{className:"p-2",children:[t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[t.jsx("div",{className:"flex items-center justify-end px-6 py-3 border-b border-border",children:t.jsxs("div",{className:"flex items-center gap-2",children:[d?t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(Ne,{autoFocus:!0,placeholder:"List name...",value:i,onChange:T=>l(T.target.value),onKeyDown:T=>{T.key==="Enter"&&D(),T.key==="Escape"&&(c(!1),l(""))},className:"h-8 text-xs w-36"}),t.jsx(ee,{size:"sm",variant:"outline",className:"h-8 text-xs",onClick:D,disabled:!i.trim()||E.isPending,children:"Add"}),t.jsx(ee,{size:"sm",variant:"ghost",className:"h-8 text-xs",onClick:()=>{c(!1),l("")},children:"Cancel"})]}):t.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>c(!0),children:[t.jsx(Ye,{className:"h-4 w-4"}),"New List"]}),t.jsxs(ee,{size:"sm",onClick:()=>o({open:!0}),children:[t.jsx(Ye,{className:"h-4 w-4"}),"Create"]})]})}),t.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-border gap-3 flex-wrap",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(_e,{value:S,onValueChange:g,children:[t.jsx(De,{className:"h-8 text-xs w-[140px] bg-transparent",children:t.jsx(Be,{placeholder:"Sprint"})}),t.jsxs(Oe,{children:[t.jsx(me,{value:"all",className:"text-xs",children:"All sprints"}),t.jsx(me,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),U.map(T=>t.jsx(me,{value:T.id,className:"text-xs",children:T.name},T.id))]})]}),t.jsxs(_e,{value:x,onValueChange:f,children:[t.jsx(De,{className:"h-8 text-xs w-[130px] bg-transparent",children:t.jsx(Be,{placeholder:"Status"})}),t.jsxs(Oe,{children:[t.jsx(me,{value:"all",className:"text-xs",children:"All statuses"}),$.map(({key:T,name:re})=>t.jsx(me,{value:T,className:"text-xs",children:re},T))]})]}),t.jsxs(_e,{value:b,onValueChange:w,children:[t.jsx(De,{className:"h-8 text-xs w-[130px] bg-transparent",children:t.jsx(Be,{placeholder:"Priority"})}),t.jsxs(Oe,{children:[t.jsx(me,{value:"all",className:"text-xs",children:"All priorities"}),Object.entries(St).map(([T,re])=>t.jsx(me,{value:T,className:"text-xs",children:re},T))]})]})]}),t.jsxs("div",{className:"relative",children:[t.jsx(Fs,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),t.jsx(Ne,{placeholder:"Search...",value:u,onChange:T=>m(T.target.value),className:"pl-8 h-8 w-[200px] text-xs bg-transparent"})]})]}),t.jsxs("div",{className:I("grid items-center px-6 py-2.5 border-b border-border",H),children:[t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"ID"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Title"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Status"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Priority"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Sprint"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Due Date"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Assignees"}),t.jsx("span",{})]}),O?t.jsx("div",{className:"divide-y divide-border",children:[1,2,3,4].map(T=>t.jsxs("div",{className:I("grid items-center px-6 py-3 gap-4",H),children:[t.jsx(ue,{className:"h-4 w-14"}),t.jsx(ue,{className:"h-4 w-56"}),t.jsx(ue,{className:"h-5 w-20"}),t.jsx(ue,{className:"h-4 w-16"}),t.jsx(ue,{className:"h-4 w-20"}),t.jsx(ue,{className:"h-4 w-24"}),t.jsx(ue,{className:"h-6 w-16"}),t.jsx("span",{})]},T))}):A===0&&(k??[]).length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[t.jsx("p",{className:"text-sm font-medium mb-1",children:"No issues yet"}),t.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Create your first issue to start tracking work."}),t.jsxs(ee,{size:"sm",onClick:()=>o({open:!0}),children:[t.jsx(Ye,{className:"h-4 w-4"}),"Create issue"]})]}):X.length===0&&(k??[]).length>0?t.jsx("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"No issues match your filters."})}):t.jsx(Yr,{delayDuration:200,children:t.jsxs("div",{className:"divide-y divide-border",children:[(M??[]).map(T=>t.jsx(so,{taskList:T,issues:G[T.id]??[],childrenMap:Y,projectId:N,statuses:$,statusLabels:W,statusColorMap:P,sprints:U,workspace:e,projectKey:n,onOpen:r,onAddIssue:re=>o({open:!0,defaultTaskListId:re}),onAddChild:re=>o({open:!0,defaultParentId:re}),onRenameList:z,onDeleteList:L},T.id)),(((se=G.__none__)==null?void 0:se.length)>0||(M??[]).length===0)&&t.jsx(so,{taskList:null,issues:G.__none__??[],childrenMap:Y,projectId:N,statuses:$,statusLabels:W,statusColorMap:P,sprints:U,workspace:e,projectKey:n,onOpen:r,onAddIssue:T=>o({open:!0,defaultTaskListId:T}),onAddChild:T=>o({open:!0,defaultParentId:T})})]})}),!O&&A>0&&t.jsx("div",{className:"flex items-center px-6 py-3 border-t border-border",children:t.jsxs("span",{className:"text-xs text-muted-foreground",children:[A," issue",A!==1?"s":""]})})]}),t.jsx(Yl,{issue:s,projectId:N,open:!!s,onClose:()=>r(null)}),t.jsx(Qs,{open:a.open,onClose:()=>o({open:!1}),projectId:N,defaultTaskListId:a.defaultTaskListId,defaultParentId:a.defaultParentId})]})}function ro(e){if(!e.start_date&&!e.end_date)return null;const n=e.start_date?le(new Date(e.start_date),"MMM d"):"—",s=e.end_date?le(new Date(e.end_date),"MMM d"):"—";return`${n} – ${s}`}function It({label:e,children:n}){return t.jsxs("div",{className:"flex items-center justify-between gap-3 py-2.5 border-b border-border/60 last:border-0",children:[t.jsx("span",{className:"text-xs text-muted-foreground shrink-0 w-20",children:e}),t.jsx("div",{className:"flex-1 min-w-0",children:n})]})}const mg={backlog:t.jsx(xt,{className:"h-3 w-3 text-zinc-400"}),todo:t.jsx(xt,{className:"h-3 w-3 text-zinc-500",strokeWidth:2.5}),in_progress:t.jsx(Yt,{className:"h-3 w-3 text-indigo-500"}),in_review:t.jsx(Rs,{className:"h-3 w-3 text-amber-500"}),done:t.jsx(mn,{className:"h-3 w-3 text-emerald-500"}),cancelled:t.jsx(ui,{className:"h-3 w-3 text-zinc-400"})},fg={urgent:t.jsx(us,{className:"h-3 w-3 text-red-500"}),high:t.jsx($s,{className:"h-3 w-3 text-orange-500"}),medium:t.jsx(ds,{className:"h-3 w-3 text-yellow-500"}),low:t.jsx(Is,{className:"h-3 w-3 text-blue-400"})},hg={bug:t.jsx(ii,{className:"h-3 w-3 text-red-500"}),feature:t.jsx(ji,{className:"h-3 w-3 text-purple-500"}),task:t.jsx(Ni,{className:"h-3 w-3 text-blue-500"}),chore:t.jsx(Lr,{className:"h-3 w-3 text-zinc-500"})};function kr({value:e,onValueChange:n,options:s,icons:r,placeholder:a}){return t.jsxs(_e,{value:e,onValueChange:n,children:[t.jsx(De,{className:"h-7 text-xs border-0 bg-transparent px-0 gap-1.5 focus:ring-0 hover:bg-accent rounded-md pl-1",children:t.jsxs("div",{className:"flex items-center gap-1.5",children:[r[e]??t.jsx(ci,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{children:s[e]??a??""})]})}),t.jsx(Oe,{children:Object.entries(s).map(([o,i])=>t.jsx(me,{value:o,className:"text-xs",children:t.jsxs("div",{className:"flex items-center gap-2",children:[r[o],i]})},o))})]})}function xg(){const{workspace:e,projectKey:n,issueId:s}=et(),r=Ge(),[a,o]=h.useState(!1),[i,l]=h.useState(""),[d,c]=h.useState(""),[u,m]=h.useState(!1),{data:x}=Pn(n??""),f=(x==null?void 0:x.id)??"",{data:b,isLoading:w}=Lh(s??""),S=da(s??"",f),{data:g}=Rn(f||void 0),{data:v}=An(f||void 0),{data:N}=ys(f||void 0),{data:k}=bs(f||void 0),O=(v??[]).filter(P=>P.status!=="completed"),p=b!=null&&b.parent_id?k==null?void 0:k.find(P=>P.id===b.parent_id):null,C=(k==null?void 0:k.filter(P=>P.parent_id===s))??[],M=b!=null&&b.task_list_id?N==null?void 0:N.find(P=>P.id===b.task_list_id):null,E=g&&g.length>0?Object.fromEntries(g.map(P=>[P.key,P.name])):un,R=g&&g.length>0?Object.fromEntries(g.map(P=>[P.key,P.category==="completed"?t.jsx(mn,{className:"h-3 w-3",style:{color:P.color}}):P.category==="started"?t.jsx(Yt,{className:"h-3 w-3",style:{color:P.color}}):t.jsx(xt,{className:"h-3 w-3",style:{color:P.color}})])):mg;if(h.useEffect(()=>{b&&(l(b.title),c(b.description??"")),o(!1)},[b==null?void 0:b.id]),!n||!s)return null;const B=()=>{i.trim()&&S.mutate({title:i.trim(),description:d.trim()||void 0},{onSuccess:()=>{o(!1),Q.success("Issue updated")},onError:()=>Q.error("Failed to update issue")})},$=()=>{b&&(l(b.title),c(b.description??"")),o(!1)},W=(P,U)=>{S.mutate(P,{onSuccess:()=>Q.success(`${U} updated`),onError:()=>Q.error(`Failed to update ${U.toLowerCase()}`)})};return w||!b?t.jsxs("div",{className:"min-h-full bg-[hsl(60_5%_96%)] dark:bg-background",children:[t.jsx("div",{className:"sticky top-0 z-10 h-[57px] bg-white dark:bg-card border-b border-border"}),t.jsx("div",{className:"px-2 py-2",children:t.jsxs("div",{className:"grid grid-cols-[1fr_256px] gap-5",children:[t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl p-6 space-y-4 shadow-sm",children:[t.jsx(ue,{className:"h-7 w-3/4"}),t.jsx(ue,{className:"h-32 w-full"})]}),t.jsx(ue,{className:"h-24 w-full rounded-xl"}),t.jsx(ue,{className:"h-48 w-full rounded-xl"})]}),t.jsx(ue,{className:"h-[280px] w-full rounded-xl"})]})})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"min-h-full bg-[hsl(60_5%_96%)] dark:bg-background",children:[t.jsxs("div",{className:"sticky top-0 z-10 flex items-center justify-between px-6 h-[57px] bg-white dark:bg-card border-b border-border",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsxs(ee,{variant:"ghost",size:"sm",className:"h-7 gap-1 text-muted-foreground hover:text-foreground px-2",onClick:()=>r(`/${e}/projects/${n}/issues`),children:[t.jsx(Vr,{className:"h-3.5 w-3.5"}),(x==null?void 0:x.name)??"Issues"]}),t.jsx("span",{className:"text-border",children:"/"}),t.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:b.identifier}),t.jsx(Zs,{variant:"muted",className:"text-[10px] ml-1",children:zt[b.type]??b.type})]}),t.jsx("div",{className:"flex items-center gap-2",children:a?t.jsxs(t.Fragment,{children:[t.jsx(ee,{variant:"ghost",size:"sm",onClick:$,children:"Discard"}),t.jsx(ee,{size:"sm",onClick:B,disabled:!i.trim()||S.isPending,className:"px-4",children:S.isPending?"Saving…":"Save changes"})]}):t.jsxs(ee,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-muted-foreground hover:text-foreground",onClick:()=>o(!0),children:[t.jsx(Ws,{className:"h-3.5 w-3.5"}),"Edit"]})})]}),t.jsx("div",{className:"px-2 py-2",children:t.jsxs("div",{className:"grid grid-cols-[1fr_256px] gap-5 items-start",children:[t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:[t.jsx("div",{className:"px-6 pt-6 pb-3",children:a?t.jsx("input",{autoFocus:!0,value:i,onChange:P=>l(P.target.value),onKeyDown:P=>{P.key==="Enter"&&P.preventDefault()},className:I("w-full text-xl font-semibold leading-snug text-foreground","bg-transparent border-0 outline-none resize-none","placeholder:text-muted-foreground/40")}):t.jsx("h1",{className:"text-xl font-semibold text-foreground leading-snug",children:b.title})}),t.jsx("div",{className:"flex items-center gap-2 px-6 pb-2",children:t.jsx("span",{className:"text-[11px] font-medium text-muted-foreground/60 uppercase tracking-widest",children:"Description"})}),a?t.jsx(va,{content:d,onChange:c,placeholder:"Add a description…",className:"border-t border-border/50 min-h-[280px]"}):b.description?t.jsx("div",{className:"border-t border-border/50",children:t.jsx(wa,{html:b.description,className:"px-5 py-4"})}):t.jsx("div",{className:"border-t border-border/50 px-6 py-4",children:t.jsx("p",{className:"text-sm text-muted-foreground/50 italic",children:"No description"})})]}),!b.parent_id&&t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:[t.jsxs("div",{className:"px-5 py-3 border-b border-border/60 flex items-center justify-between",children:[t.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Child Issues"}),t.jsxs("button",{onClick:()=>m(!0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Ye,{className:"h-3.5 w-3.5"}),"Add child issue"]})]}),C.length===0?t.jsx("div",{className:"px-5 py-4 text-xs text-muted-foreground/50 italic",children:"No child issues yet"}):t.jsx("div",{className:"px-5 py-2 divide-y divide-border/40",children:C.map(P=>t.jsxs("div",{className:"flex items-center gap-2 py-2 text-xs",children:[t.jsx(hi,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),t.jsx("button",{onClick:()=>r(`/${e}/projects/${n}/issues/${P.id}`),className:"font-mono text-muted-foreground hover:text-foreground transition-colors shrink-0",children:P.identifier}),t.jsx("button",{onClick:()=>r(`/${e}/projects/${n}/issues/${P.id}`),className:"text-foreground hover:text-foreground/70 truncate text-left transition-colors",children:P.title})]},P.id))})]}),t.jsx("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:t.jsx(Fl,{issueId:s})})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl shadow-sm overflow-hidden",children:[t.jsx("div",{className:"px-4 py-3 border-b border-border/60",children:t.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Properties"})}),t.jsxs("div",{className:"px-4 py-1",children:[t.jsx(It,{label:"Status",children:t.jsx(kr,{value:b.status,onValueChange:P=>W({status:P},"Status"),options:E,icons:R})}),t.jsx(It,{label:"Priority",children:t.jsx(kr,{value:b.priority,onValueChange:P=>W({priority:P},"Priority"),options:St,icons:fg})}),t.jsx(It,{label:"Type",children:t.jsx(kr,{value:b.type,onValueChange:P=>W({type:P},"Type"),options:zt,icons:hg})}),t.jsx(It,{label:"Assignees",children:t.jsx(vs,{value:b.assignee_ids??[],onChange:P=>W({assignee_ids:P},"Assignees"),disabled:S.isPending})}),t.jsx(It,{label:"Sprint",children:t.jsxs(_e,{value:b.sprint_id??"none",onValueChange:P=>W({sprint_id:P==="none"?null:P},"Sprint"),children:[t.jsx(De,{className:"h-7 text-xs border-0 bg-transparent px-0 gap-1.5 focus:ring-0 hover:bg-accent rounded-md pl-1",children:t.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[t.jsx(pt,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),b.sprint_id?(()=>{const P=O.find(_=>_.id===b.sprint_id)??(v==null?void 0:v.find(_=>_.id===b.sprint_id));if(!P)return t.jsxs("span",{className:"truncate",children:[b.sprint_id.slice(0,8),"…"]});const U=ro(P);return t.jsxs("span",{className:"truncate",children:[P.name,U&&t.jsxs("span",{className:"text-muted-foreground ml-1",children:["· ",U]})]})})():t.jsx("span",{className:"text-muted-foreground",children:"No sprint"})]})}),t.jsxs(Oe,{children:[t.jsx(me,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),O.map(P=>{const U=ro(P);return t.jsx(me,{value:P.id,className:"text-xs",children:t.jsxs("div",{className:"flex items-baseline gap-1.5",children:[t.jsx("span",{children:P.name}),U&&t.jsx("span",{className:"text-[10px] text-muted-foreground font-normal",children:U})]})},P.id)})]})]})}),(N??[]).length>0&&t.jsx(It,{label:"List",children:t.jsxs(_e,{value:b.task_list_id??"none",onValueChange:P=>W({task_list_id:P==="none"?null:P},"List"),children:[t.jsx(De,{className:"h-7 text-xs border-0 bg-transparent px-0 gap-1.5 focus:ring-0 hover:bg-accent rounded-md pl-1",children:t.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[t.jsx(Qr,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx("span",{className:M?"truncate":"text-muted-foreground",children:(M==null?void 0:M.name)??"No list"})]})}),t.jsxs(Oe,{children:[t.jsx(me,{value:"none",className:"text-xs text-muted-foreground",children:"No list"}),(N??[]).map(P=>t.jsx(me,{value:P.id,className:"text-xs",children:P.name},P.id))]})]})}),t.jsx(It,{label:"Due Date",children:t.jsxs(at,{children:[t.jsx(ot,{asChild:!0,children:t.jsxs("button",{className:"flex items-center gap-1.5 h-7 px-1 rounded text-xs bg-transparent hover:bg-accent transition-colors focus:outline-none w-full text-left",children:[t.jsx(ln,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx("span",{className:b.due_date?"text-foreground":"text-muted-foreground",children:b.due_date?le(new Date(b.due_date),"MMM d, yyyy"):"No due date"})]})}),t.jsxs(Je,{className:"w-auto p-0",align:"start",children:[t.jsx(Ft,{mode:"single",selected:b.due_date?new Date(b.due_date):void 0,onSelect:P=>W({due_date:P?le(P,"yyyy-MM-dd"):null},"Due date"),initialFocus:!0}),b.due_date&&t.jsx("div",{className:"border-t px-3 py-2",children:t.jsxs("button",{onClick:()=>W({due_date:null},"Due date"),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[t.jsx(Ze,{className:"h-3 w-3"}),"Clear date"]})})]})]})}),p&&t.jsx(It,{label:"Parent",children:t.jsxs("button",{onClick:()=>r(`/${e}/projects/${n}/issues/${p.id}`),className:"flex items-center gap-1.5 text-xs hover:text-foreground transition-colors text-left w-full min-w-0",children:[t.jsx(Ur,{className:"h-3 w-3 text-muted-foreground shrink-0"}),t.jsx("span",{className:"font-mono text-muted-foreground shrink-0",children:p.identifier}),t.jsx("span",{className:"text-foreground truncate",children:p.title})]})})]})]}),t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl shadow-sm overflow-hidden",children:[t.jsx("div",{className:"px-4 py-3 border-b border-border/60",children:t.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Details"})}),t.jsxs("div",{className:"px-4 pt-3 pb-4 space-y-2.5",children:[t.jsxs("div",{className:"flex items-center justify-between text-xs",children:[t.jsx("span",{className:"text-muted-foreground",children:"Created"}),t.jsx("span",{className:"text-foreground",children:le(new Date(b.created_at),"MMM d, yyyy")})]}),t.jsxs("div",{className:"flex items-center justify-between text-xs",children:[t.jsx("span",{className:"text-muted-foreground",children:"Updated"}),t.jsx("span",{className:"text-foreground",children:le(new Date(b.updated_at),"MMM d, yyyy")})]})]})]})]})]})})]}),t.jsx(Qs,{open:u,onClose:()=>m(!1),projectId:f,defaultParentId:s,defaultTaskListId:b.task_list_id})]})}function Jt({label:e,children:n}){return t.jsxs("div",{className:"flex items-center justify-between gap-3 py-2.5 border-b border-border/60 last:border-0",children:[t.jsx("span",{className:"text-xs text-muted-foreground shrink-0 w-20",children:e}),t.jsx("div",{className:"flex-1 min-w-0",children:n})]})}const pg={backlog:t.jsx(xt,{className:"h-3 w-3 text-zinc-400"}),todo:t.jsx(xt,{className:"h-3 w-3 text-zinc-500",strokeWidth:2.5}),in_progress:t.jsx(Yt,{className:"h-3 w-3 text-indigo-500"}),in_review:t.jsx(Rs,{className:"h-3 w-3 text-amber-500"}),done:t.jsx(mn,{className:"h-3 w-3 text-emerald-500"}),cancelled:t.jsx(ui,{className:"h-3 w-3 text-zinc-400"})},gg={urgent:t.jsx(us,{className:"h-3 w-3 text-red-500"}),high:t.jsx($s,{className:"h-3 w-3 text-orange-500"}),medium:t.jsx(ds,{className:"h-3 w-3 text-yellow-500"}),low:t.jsx(Is,{className:"h-3 w-3 text-blue-400"})},bg={bug:t.jsx(ii,{className:"h-3 w-3 text-red-500"}),feature:t.jsx(ji,{className:"h-3 w-3 text-purple-500"}),task:t.jsx(Ni,{className:"h-3 w-3 text-blue-500"}),chore:t.jsx(Lr,{className:"h-3 w-3 text-zinc-500"})};function Sr({value:e,onValueChange:n,options:s,icons:r,placeholder:a}){return t.jsxs(_e,{value:e,onValueChange:n,children:[t.jsx(De,{className:"h-7 text-xs border-0 bg-transparent px-0 gap-1.5 focus:ring-0 hover:bg-accent rounded-md pl-1",children:t.jsxs("div",{className:"flex items-center gap-1.5",children:[r[e]??t.jsx(ci,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{children:s[e]??a??""})]})}),t.jsx(Oe,{children:Object.entries(s).map(([o,i])=>t.jsx(me,{value:o,className:"text-xs",children:t.jsxs("div",{className:"flex items-center gap-2",children:[r[o],i]})},o))})]})}function yg(e){if(!e.start_date&&!e.end_date)return null;const n=e.start_date?le(new Date(e.start_date),"MMM d"):"—",s=e.end_date?le(new Date(e.end_date),"MMM d"):"—";return`${n} – ${s}`}function vg(){const{workspace:e,projectKey:n}=et(),s=Ge(),{workspace:r}=Re(),[a,o]=h.useState(""),[i,l]=h.useState(""),[d,c]=h.useState("backlog"),[u,m]=h.useState("medium"),[x,f]=h.useState("task"),[b,w]=h.useState([]),[S,g]=h.useState(""),[v,N]=h.useState(""),[k,O]=h.useState(void 0),{data:p}=Pn(n??""),C=(p==null?void 0:p.id)??"",M=ul(),{data:E}=Rn(C||void 0),{data:R}=An(C||void 0),{data:B}=ys(C||void 0),$=(R??[]).filter(_=>_.status!=="completed"),W=E&&E.length>0?Object.fromEntries(E.map(_=>[_.key,_.name])):un,P=E&&E.length>0?Object.fromEntries(E.map(_=>[_.key,_.category==="completed"?t.jsx(mn,{className:"h-3 w-3",style:{color:_.color}}):_.category==="started"?t.jsx(Yt,{className:"h-3 w-3",style:{color:_.color}}):t.jsx(xt,{className:"h-3 w-3",style:{color:_.color}})])):pg;if(!n||!C)return null;const U=()=>{if(!a.trim()){Q.error("Title is required");return}M.mutate({title:a.trim(),description:i||void 0,status:d,priority:u,type:x,project_id:C,workspace_id:r.id,assignee_ids:b.length>0?b:void 0,sprint_id:S||null,task_list_id:v||null,due_date:k?le(k,"yyyy-MM-dd"):null},{onSuccess:_=>{Q.success("Issue created"),s(`/${e}/projects/${n}/issues/${_.issue.id}`,{replace:!0})},onError:_=>Q.error(_.message??"Failed to create issue")})};return t.jsxs("div",{className:"min-h-full bg-[hsl(60_5%_96%)] dark:bg-background",children:[t.jsxs("div",{className:"sticky top-0 z-10 flex items-center justify-between px-6 h-[57px] bg-white dark:bg-card border-b border-border",children:[t.jsxs(ee,{variant:"ghost",size:"sm",className:"h-7 gap-1 text-muted-foreground hover:text-foreground px-2",onClick:()=>s(`/${e}/projects/${n}/issues`),children:[t.jsx(Vr,{className:"h-3.5 w-3.5"}),(p==null?void 0:p.name)??"Issues"]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>s(`/${e}/projects/${n}/issues`),children:"Discard"}),t.jsx(ee,{size:"sm",onClick:U,disabled:!a.trim()||M.isPending,className:"px-4",children:M.isPending?"Creating…":"Create issue"})]})]}),t.jsx("div",{className:"px-2 py-2",children:t.jsxs("div",{className:"grid grid-cols-[1fr_256px] gap-5 items-start",children:[t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:[t.jsx("div",{className:"px-6 pt-6 pb-3",children:t.jsx("input",{autoFocus:!0,value:a,onChange:_=>o(_.target.value),onKeyDown:_=>{_.key==="Enter"&&_.preventDefault()},placeholder:"Issue title…",className:I("w-full text-xl font-semibold leading-snug text-foreground","bg-transparent border-0 outline-none resize-none","placeholder:text-muted-foreground/40")})}),t.jsx("div",{className:"flex items-center gap-2 px-6 pb-2",children:t.jsx("span",{className:"text-[11px] font-medium text-muted-foreground/60 uppercase tracking-widest",children:"Description"})}),t.jsx(va,{content:"",onChange:l,placeholder:"Add steps to reproduce, acceptance criteria, or context…",className:"border-t border-border/50 min-h-[320px]"})]}),t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl shadow-sm overflow-hidden",children:[t.jsx("div",{className:"px-4 py-3 border-b border-border/60",children:t.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Properties"})}),t.jsxs("div",{className:"px-4 py-1",children:[t.jsx(Jt,{label:"Status",children:t.jsx(Sr,{value:d,onValueChange:c,options:W,icons:P})}),t.jsx(Jt,{label:"Priority",children:t.jsx(Sr,{value:u,onValueChange:m,options:St,icons:gg})}),t.jsx(Jt,{label:"Type",children:t.jsx(Sr,{value:x,onValueChange:f,options:zt,icons:bg})}),t.jsx(Jt,{label:"Assignees",children:t.jsx(vs,{value:b,onChange:w})}),$.length>0&&t.jsx(Jt,{label:"Sprint",children:t.jsxs(_e,{value:S||"none",onValueChange:_=>g(_==="none"?"":_),children:[t.jsx(De,{className:"h-7 text-xs border-0 bg-transparent px-0 gap-1.5 focus:ring-0 hover:bg-accent rounded-md pl-1",children:t.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[t.jsx(pt,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx(Be,{placeholder:"No sprint"})]})}),t.jsxs(Oe,{children:[t.jsx(me,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),$.map(_=>{const Y=yg(_);return t.jsx(me,{value:_.id,className:"text-xs",children:t.jsxs("div",{className:"flex items-baseline gap-1.5",children:[t.jsx("span",{children:_.name}),Y&&t.jsx("span",{className:"text-[10px] text-muted-foreground font-normal",children:Y})]})},_.id)})]})]})}),(B??[]).length>0&&t.jsx(Jt,{label:"List",children:t.jsxs(_e,{value:v||"none",onValueChange:_=>N(_==="none"?"":_),children:[t.jsx(De,{className:"h-7 text-xs border-0 bg-transparent px-0 gap-1.5 focus:ring-0 hover:bg-accent rounded-md pl-1",children:t.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[t.jsx(Qr,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx(Be,{placeholder:"No list"})]})}),t.jsxs(Oe,{children:[t.jsx(me,{value:"none",className:"text-xs text-muted-foreground",children:"No list"}),(B??[]).map(_=>t.jsx(me,{value:_.id,className:"text-xs",children:_.name},_.id))]})]})}),t.jsx(Jt,{label:"Due Date",children:t.jsxs(at,{children:[t.jsx(ot,{asChild:!0,children:t.jsxs("button",{type:"button",className:"flex items-center gap-1.5 h-7 px-1 rounded text-xs bg-transparent hover:bg-accent transition-colors focus:outline-none w-full text-left",children:[t.jsx(ln,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx("span",{className:k?"text-foreground":"text-muted-foreground",children:k?le(k,"MMM d, yyyy"):"No due date"}),k&&t.jsx("button",{type:"button",onClick:_=>{_.stopPropagation(),O(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:t.jsx(Ze,{className:"h-3 w-3"})})]})}),t.jsx(Je,{className:"w-auto p-0",align:"start",children:t.jsx(Ft,{mode:"single",selected:k,onSelect:O,initialFocus:!0})})]})})]}),t.jsx("div",{className:"px-4 pt-2 pb-3 mt-1 border-t border-border/60",children:t.jsxs("p",{className:"text-[11px] text-muted-foreground/50 leading-relaxed",children:["Press ",t.jsx("kbd",{className:"px-1 py-0.5 rounded border border-border bg-muted font-mono text-[10px]",children:"⌘ Enter"})," to submit"]})})]})]})})]})}function wg(){const{data:e,isLoading:n}=em(),s=nm(),r=sm(),a=(e==null?void 0:e.filter(o=>!o.read).length)??0;return t.jsxs("div",{className:"p-6 max-w-[800px]",children:[t.jsxs("div",{className:"flex items-center justify-between mb-6",children:[t.jsx("h1",{className:"text-xl font-semibold",children:"Notifications"}),a>0&&t.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>r.mutate(void 0,{onSuccess:()=>Q.success("All marked as read"),onError:()=>Q.error("Failed")}),disabled:r.isPending,children:[t.jsx(Uc,{className:"h-4 w-4"}),"Mark all read"]})]}),t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[n?t.jsx("div",{className:"divide-y divide-border",children:[1,2,3,4].map(o=>t.jsxs("div",{className:"flex items-start gap-4 px-6 py-4",children:[t.jsx(ue,{className:"h-4 w-4 rounded-full mt-0.5 shrink-0"}),t.jsxs("div",{className:"flex-1 space-y-2",children:[t.jsx(ue,{className:"h-4 w-3/4"}),t.jsx(ue,{className:"h-3 w-24"})]})]},o))}):e!=null&&e.length?t.jsx("div",{className:"divide-y divide-border",children:e.map(o=>t.jsxs("div",{className:I("flex items-start gap-4 px-6 py-4 transition-colors",!o.read&&"bg-[#eff6ff] dark:bg-[hsl(var(--indigo-subtle))]","hover:bg-[#f9fafb] dark:hover:bg-muted/30"),children:[t.jsx("div",{className:"mt-1.5 shrink-0 w-4 flex justify-center",children:!o.read&&t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-indigo"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:I("text-sm",!o.read&&"font-medium"),children:o.message}),t.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[t.jsx("span",{className:"text-[11px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded",children:o.entity_type}),t.jsx("span",{className:"text-[11px] text-muted-foreground",children:le(new Date(o.created_at),"MMM d, h:mm a")})]})]}),!o.read&&t.jsx(ee,{variant:"ghost",size:"sm",className:"shrink-0 h-7 text-xs text-muted-foreground",onClick:()=>s.mutate(o.id,{onError:()=>Q.error("Failed")}),children:"Mark read"})]},o.id))}):t.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[t.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:t.jsx(os,{className:"h-5 w-5 text-muted-foreground"})}),t.jsx("p",{className:"text-sm font-medium mb-1",children:"No notifications"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"You're all caught up."})]}),!n&&e&&e.length>0&&t.jsx("div",{className:"px-6 py-3 border-t border-border",children:t.jsxs("span",{className:"text-xs text-muted-foreground",children:[e.length," notification",e.length!==1?"s":"",a>0?` · ${a} unread`:""]})})]})]})}function jg({open:e,onClose:n,projectId:s}){const[r,a]=h.useState(""),[o,i]=h.useState(""),[l,d]=h.useState(),[c,u]=h.useState(),[m,x]=h.useState(!1),[f,b]=h.useState(!1),w=lx(s);function S(){a(""),i(""),d(void 0),u(void 0),n()}async function g(v){v.preventDefault(),r.trim()&&w.mutate({name:r.trim(),goal:o.trim()||void 0,start_date:l?le(l,"yyyy-MM-dd"):null,end_date:c?le(c,"yyyy-MM-dd"):null},{onSuccess:()=>{Q.success("Sprint created"),S()},onError:()=>Q.error("Failed to create sprint")})}return t.jsx(fn,{open:e,onOpenChange:v=>!v&&S(),children:t.jsxs(hn,{className:"sm:max-w-md",children:[t.jsx(xn,{children:t.jsx(pn,{children:"New Sprint"})}),t.jsxs("form",{onSubmit:g,className:"flex flex-col flex-1 overflow-hidden",children:[t.jsxs(In,{className:"space-y-4 py-1",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs($e,{htmlFor:"sprint-name",children:["Name ",t.jsx("span",{className:"text-destructive",children:"*"})]}),t.jsx(Ne,{id:"sprint-name",placeholder:"e.g. Sprint 1",value:r,onChange:v=>a(v.target.value),autoFocus:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs($e,{htmlFor:"sprint-goal",children:["Goal ",t.jsx("span",{className:"text-muted-foreground text-xs",children:"(optional)"})]}),t.jsx(Vs,{id:"sprint-goal",placeholder:"What do you want to achieve in this sprint?",value:o,onChange:v=>i(v.target.value),className:"resize-none text-sm",rows:2})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx($e,{children:"Start Date"}),t.jsxs(at,{open:m,onOpenChange:x,children:[t.jsx(ot,{asChild:!0,children:t.jsxs(ee,{variant:"outline",className:I("w-full justify-start text-left font-normal text-sm h-9",!l&&"text-muted-foreground"),children:[t.jsx(ln,{className:"mr-2 h-3.5 w-3.5 shrink-0"}),l?le(l,"MMM d, yyyy"):"Pick date"]})}),t.jsx(Je,{className:"w-auto p-0",align:"start",children:t.jsx(Ft,{mode:"single",selected:l,onSelect:v=>{d(v),x(!1)},disabled:v=>c?v>c:!1,initialFocus:!0})})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx($e,{children:"End Date"}),t.jsxs(at,{open:f,onOpenChange:b,children:[t.jsx(ot,{asChild:!0,children:t.jsxs(ee,{variant:"outline",className:I("w-full justify-start text-left font-normal text-sm h-9",!c&&"text-muted-foreground"),children:[t.jsx(ln,{className:"mr-2 h-3.5 w-3.5 shrink-0"}),c?le(c,"MMM d, yyyy"):"Pick date"]})}),t.jsx(Je,{className:"w-auto p-0",align:"start",children:t.jsx(Ft,{mode:"single",selected:c,onSelect:v=>{u(v),b(!1)},disabled:v=>l?v<l:!1,initialFocus:!0})})]})]})]})]}),t.jsxs(ps,{children:[t.jsx(ee,{type:"button",variant:"ghost",onClick:S,children:"Cancel"}),t.jsx(ee,{type:"submit",disabled:!r.trim()||w.isPending,children:w.isPending?"Creating…":"Create Sprint"})]})]})]})})}const Ng={active:{label:"Active",icon:zs,badge:"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400",section:"Active Sprint"},planned:{label:"Planned",icon:Yt,badge:"bg-zinc-100 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-400",section:"Planned"},completed:{label:"Completed",icon:mn,badge:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",section:"Completed"}};function kg({sprint:e,projectId:n,issueCount:s}){const r=dx(e.id,n),a=cx(n),o=Ng[e.status],i=o.icon;function l(){r.mutate({status:"active"},{onSuccess:()=>Q.success(`"${e.name}" started`),onError:()=>Q.error("Failed to start sprint")})}function d(){r.mutate({status:"completed"},{onSuccess:()=>Q.success(`"${e.name}" completed`),onError:x=>Q.error((x==null?void 0:x.message)??"Failed to complete sprint")})}function c(){confirm(`Delete sprint "${e.name}"? This cannot be undone.`)&&a.mutate(e.id,{onSuccess:()=>Q.success("Sprint deleted"),onError:()=>Q.error("Failed to delete sprint")})}const u=!!e.start_date,m=!!e.end_date;return t.jsxs("div",{className:"flex items-center gap-4 px-6 py-4 hover:bg-muted/30 transition-colors group",children:[t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[t.jsx("div",{className:I("flex h-7 w-7 items-center justify-center rounded-full shrink-0",e.status==="active"?"bg-emerald-100 dark:bg-emerald-900/30":e.status==="completed"?"bg-blue-100 dark:bg-blue-900/30":"bg-zinc-100 dark:bg-zinc-800"),children:t.jsx(i,{className:I("h-3.5 w-3.5",e.status==="active"?"text-emerald-600 dark:text-emerald-400":e.status==="completed"?"text-blue-600 dark:text-blue-400":"text-zinc-500")})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:e.name}),e.goal&&t.jsxs("p",{className:"text-xs text-muted-foreground truncate mt-0.5 flex items-center gap-1",children:[t.jsx(fu,{className:"h-3 w-3 shrink-0"}),e.goal]})]})]}),t.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0 w-52",children:[t.jsx(li,{className:"h-3.5 w-3.5 shrink-0"}),u||m?t.jsxs("span",{children:[u?le(new Date(e.start_date),"MMM d"):"—"," → ",m?le(new Date(e.end_date),"MMM d, yyyy"):"—"]}):t.jsx("span",{className:"italic",children:"No dates set"})]}),t.jsxs("div",{className:"text-xs text-muted-foreground shrink-0 w-20 text-right",children:[s," issue",s!==1?"s":""]}),t.jsx(Zs,{className:I("shrink-0 text-[11px] border-0 w-20 justify-center",o.badge),children:o.label}),t.jsxs("div",{className:"flex items-center gap-1.5 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:[e.status==="planned"&&t.jsxs(ee,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:l,disabled:r.isPending,children:[t.jsx(zs,{className:"h-3 w-3"}),"Start"]}),e.status==="active"&&t.jsxs(ee,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:d,disabled:r.isPending,children:[t.jsx(mn,{className:"h-3 w-3"}),"Complete"]}),t.jsx(ee,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-muted-foreground hover:text-destructive",onClick:c,disabled:a.isPending,children:t.jsx(cs,{className:"h-3.5 w-3.5"})})]})]})}function Sg(){const{projectKey:e}=et(),[n,s]=h.useState(!1),{data:r}=Pn(e??""),a=(r==null?void 0:r.id)??"",{data:o,isLoading:i}=An(a||void 0),{data:l}=bs(a||void 0),d=(l??[]).reduce((m,x)=>(x.sprint_id&&(m[x.sprint_id]=(m[x.sprint_id]??0)+1),m),{}),c={active:(o??[]).filter(m=>m.status==="active"),planned:(o??[]).filter(m=>m.status==="planned"),completed:(o??[]).filter(m=>m.status==="completed")},u=[{key:"active",label:"Active Sprint",items:c.active},{key:"planned",label:"Planned",items:c.planned},{key:"completed",label:"Completed",items:c.completed}];return t.jsxs("div",{className:"p-2",children:[t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[t.jsx("div",{className:"flex items-center justify-end px-6 py-3 border-b border-border",children:t.jsxs(ee,{size:"sm",onClick:()=>s(!0),children:[t.jsx(Ye,{className:"h-4 w-4"}),"New Sprint"]})}),i?t.jsx("div",{className:"divide-y divide-border",children:[1,2,3].map(m=>t.jsxs("div",{className:"flex items-center gap-4 px-6 py-4",children:[t.jsx(ue,{className:"h-7 w-7 rounded-full"}),t.jsx(ue,{className:"h-4 w-40"}),t.jsx("div",{className:"flex-1"}),t.jsx(ue,{className:"h-4 w-32"}),t.jsx(ue,{className:"h-5 w-20"})]},m))}):(o??[]).length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[t.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:t.jsx(li,{className:"h-5 w-5 text-muted-foreground"})}),t.jsx("p",{className:"text-sm font-medium mb-1",children:"No sprints yet"}),t.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Create a sprint to start planning your work in time-boxed iterations."}),t.jsxs(ee,{size:"sm",onClick:()=>s(!0),children:[t.jsx(Ye,{className:"h-4 w-4"}),"New Sprint"]})]}):t.jsx("div",{children:u.map(({key:m,label:x,items:f})=>f.length===0?null:t.jsxs("div",{children:[t.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/20",children:t.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:x})}),t.jsx("div",{className:"divide-y divide-border",children:f.map(b=>t.jsx(kg,{sprint:b,projectId:a,issueCount:d[b.id]??0},b.id))})]},m))})]}),t.jsx(jg,{open:n,onClose:()=>s(!1),projectId:a})]})}function Cr({children:e}){const{isAuthenticated:n}=Re();return n?t.jsx(t.Fragment,{children:e}):t.jsx(Es,{to:"/login",replace:!0})}function ao({children:e}){const{isAuthenticated:n}=Re();return n?t.jsx(Es,{to:"/",replace:!0}):t.jsx(t.Fragment,{children:e})}function Cg(){const{workspace:e,setWorkspace:n}=Re(),s=Ge(),{data:r,isLoading:a}=Hr(!e);return h.useEffect(()=>{if(e){s(`/${e.slug}/projects`,{replace:!0});return}if(!a&&r!==void 0)if(r.length>0){const o=r[0];n({id:o.id,name:o.name,slug:o.slug}),s(`/${o.slug}/projects`,{replace:!0})}else s("/setup",{replace:!0})},[e,r,a,s,n]),t.jsx("div",{className:"min-h-screen flex items-center justify-center",children:t.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})})}function Mg(){const{workspace:e}=et(),{workspace:n,setWorkspace:s}=Re(),r=Ge(),{data:a,isLoading:o}=Hr();return h.useEffect(()=>{if(o||!a)return;const i=a.find(l=>l.slug===e);i?i.id!==(n==null?void 0:n.id)&&s({id:i.id,name:i.name,slug:i.slug}):a.length>0?r(`/${a[0].slug}/projects`,{replace:!0}):r("/setup",{replace:!0})},[a,e,o,n==null?void 0:n.id,r,s]),o||!n||n.slug!==e?t.jsx("div",{className:"min-h-screen flex items-center justify-center",children:t.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})}):t.jsxs(t.Fragment,{children:[t.jsx(om,{}),t.jsx(Am,{})]})}function Dg(){return t.jsxs(Gl,{children:[t.jsx(qe,{path:"/login",element:t.jsx(ao,{children:t.jsx(Fm,{})})}),t.jsx(qe,{path:"/register",element:t.jsx(ao,{children:t.jsx(Bm,{})})}),t.jsx(qe,{path:"/setup",element:t.jsx(Cr,{children:t.jsx(qm,{})})}),t.jsx(qe,{index:!0,element:t.jsx(Cr,{children:t.jsx(Cg,{})})}),t.jsxs(qe,{path:"/:workspace",element:t.jsx(Cr,{children:t.jsx(Mg,{})}),children:[t.jsx(qe,{index:!0,element:t.jsx(Es,{to:"projects",replace:!0})}),t.jsx(qe,{path:"projects",element:t.jsx(Hh,{})}),t.jsxs(qe,{path:"projects/:projectKey",element:t.jsx(im,{}),children:[t.jsx(qe,{path:"board",element:t.jsx(cg,{})}),t.jsx(qe,{path:"issues",element:t.jsx(ug,{})}),t.jsx(qe,{path:"issues/new",element:t.jsx(vg,{})}),t.jsx(qe,{path:"issues/:issueId",element:t.jsx(xg,{})}),t.jsx(qe,{path:"sprints",element:t.jsx(Sg,{})})]}),t.jsx(qe,{path:"notifications",element:t.jsx(wg,{})})]}),t.jsx(qe,{path:"*",element:t.jsx(Es,{to:"/",replace:!0})})]})}const Og=new Ll({defaultOptions:{queries:{staleTime:1e3*30,retry:1}}});Ho(document.getElementById("root")).render(t.jsx(h.StrictMode,{children:t.jsx(lc,{children:t.jsxs(Vl,{client:Og,children:[t.jsx(dc,{children:t.jsx(cc,{children:t.jsx(Ql,{children:t.jsxs(Yr,{delayDuration:300,children:[t.jsx(Dg,{}),t.jsx(Xd,{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"}}})]})})})}),t.jsx(kd,{initialIsOpen:!1})]})})}));