@meridianjs/admin-dashboard 0.1.9 → 0.1.11

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,6 @@
1
+ import{j as a,u as Ct,a as Mt}from"./vendor-query-Calp8wfL.js";import{r as l,c as Ie,g as jt,k as Y,u as St}from"./vendor-react-GAVzOgi0.js";import{c as _t,n as ke,d as Nt,g as Dt,m as It,t as kt,a as j,C as At,b as Et,e as Rt,f as H,i as ie,h as $,j as ye,s as Ae,k as G,l as Ot,o as Pt,P as Ee,p as Tt,q as Bt,r as Lt,u as Wt,v as $t,w as Gt,x as Ht,y as Ft,W as be,B as zt,I as Ut,z as Kt,A as Vt,D as Yt,E as qt}from"./index-BgL6m0sV.js";import{a as Xt,D as ee,M as Jt,g as Re}from"./vendor-dnd-DY2LDzZ0.js";import{a6 as Qt,a7 as Zt,a8 as en,a9 as tn,a3 as F,aa as Oe,ab as nn,ac as on,ad as sn,ae as rn,af as an,ag as cn,ah as ln,ai as dn,aj as un,ak as fn,al as mn,am as hn,an as pn}from"./vendor-radix-CvCz4fuY.js";import"./vendor-editor-D14KexPR.js";/**
2
+ * @license lucide-react v0.468.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const gn=_t("Trash",[["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"}]]);function Pe(e,t,o){const[n,s]=ke(o==null?void 0:o.in,e,t),r=we(n,s),c=Math.abs(Nt(n,s));n.setDate(n.getDate()-r*c);const i=+(we(n,s)===-r),d=r*(c-i);return d===0?0:d}function we(e,t){const o=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return o<0?-1:o>0?1:o}function xn(e,t,o){const[n,s]=ke(o==null?void 0:o.in,e,t),r=(+n-+s)/It;return Dt(o==null?void 0:o.roundingMethod)(r)}function Ce(e,t){return kt(e,t==null?void 0:t.in).getDate()}const te=e=>{let{transform:t}=e;return{...t,y:0}};function fe(){const[e,t]=l.useState({x:0,y:0,elementX:0,elementY:0,elementPositionX:0,elementPositionY:0}),o=l.useRef(null);return l.useLayoutEffect(()=>{const n=s=>{var c;let r={x:s.pageX,y:s.pageY};if(((c=o.current)==null?void 0:c.nodeType)===Node.ELEMENT_NODE){const{left:i,top:d}=o.current.getBoundingClientRect(),u=i+window.scrollX,m=d+window.scrollY,h=s.pageX-u,p=s.pageY-m;r.elementX=h,r.elementY=p,r.elementPositionX=u,r.elementPositionY=m}t(i=>({...i,...r}))};return document.addEventListener("mousemove",n),()=>{document.removeEventListener("mousemove",n)}},[]),[e,o]}function vn(e,t=500){const[o,n]=l.useState(e),s=l.useRef(null);return l.useEffect(()=>{const r=Date.now();if(s.current&&r>=s.current+t)s.current=r,n(e);else{const c=window.setTimeout(()=>{s.current=r,n(e)},t);return()=>window.clearTimeout(c)}},[e,t]),o}function yn(){const[e,t]=l.useState({x:null,y:null}),o=l.useCallback((...n)=>{if(typeof n[0]=="object")window.scrollTo(n[0]);else if(typeof n[0]=="number"&&typeof n[1]=="number")window.scrollTo(n[0],n[1]);else throw new Error("Invalid arguments passed to scrollTo. See here for more info. https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo")},[]);return l.useLayoutEffect(()=>{const n=()=>{t({x:window.scrollX,y:window.scrollY})};return n(),window.addEventListener("scroll",n),()=>{window.removeEventListener("scroll",n)}},[]),[e,o]}const W={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};function Te(e){return"init"in e}function ce(e){return!!e.write}function Me(e){return"v"in e||"e"in e}function J(e){if("e"in e)throw e.e;if((W?"production":void 0)!=="production"&&!("v"in e))throw new Error("[Bug] atom state is not initialized");return e.v}function Q(e){return typeof(e==null?void 0:e.then)=="function"}function Be(e,t,o){if(!o.p.has(e)){o.p.add(e);const n=()=>o.p.delete(e);t.then(n,n)}}function Le(e,t,o){var n;const s=new Set;for(const r of((n=o.get(e))==null?void 0:n.t)||[])s.add(r);for(const r of t.p)s.add(r);return s}const bn=(e,t,...o)=>t.read(...o),wn=(e,t,...o)=>t.write(...o),Cn=(e,t)=>{var o;return(o=t.INTERNAL_onInit)==null?void 0:o.call(t,e)},Mn=(e,t,o)=>{var n;return(n=t.onMount)==null?void 0:n.call(t,o)},jn=(e,t)=>{var o;const n=I(e),s=n[0],r=n[6],c=n[9];if((W?"production":void 0)!=="production"&&!t)throw new Error("Atom is undefined or null");let i=s.get(t);return i||(i={d:new Map,p:new Set,n:0},s.set(t,i),(o=r.i)==null||o.call(r,t),c==null||c(e,t)),i},Sn=e=>{const t=I(e),o=t[1],n=t[3],s=t[4],r=t[5],c=t[6],i=t[13],d=[],u=m=>{try{m()}catch(h){d.push(h)}};do{c.f&&u(c.f);const m=new Set,h=m.add.bind(m);n.forEach(p=>{var g;return(g=o.get(p))==null?void 0:g.l.forEach(h)}),n.clear(),r.forEach(h),r.clear(),s.forEach(h),s.clear(),m.forEach(u),n.size&&i(e)}while(n.size||r.size||s.size);if(d.length)throw new AggregateError(d)},_n=e=>{const t=I(e),o=t[1],n=t[2],s=t[3],r=t[11],c=t[14],i=t[17],d=[],u=new WeakSet,m=new WeakSet,h=Array.from(s);for(;h.length;){const p=h[h.length-1],g=r(e,p);if(m.has(p)){h.pop();continue}if(u.has(p)){if(n.get(p)===g.n)d.push([p,g]);else if((W?"production":void 0)!=="production"&&n.has(p))throw new Error("[Bug] invalidated atom exists");m.add(p),h.pop();continue}u.add(p);for(const y of Le(p,g,o))u.has(y)||h.push(y)}for(let p=d.length-1;p>=0;--p){const[g,y]=d[p];let M=!1;for(const N of y.d.keys())if(N!==g&&s.has(N)){M=!0;break}M&&(c(e,g),i(e,g)),n.delete(g)}},le=new WeakSet,Nn=(e,t)=>{var o,n;const s=I(e),r=s[1],c=s[2],i=s[3],d=s[6],u=s[7],m=s[11],h=s[12],p=s[13],g=s[14],y=s[16],M=s[17],N=s[20],v=s[26],x=m(e,t);if(Me(x)){if(r.has(t)&&c.get(t)!==x.n)return x;let w=!1;for(const[k,E]of x.d)if(g(e,k).n!==E){w=!0;break}if(!w)return x}let S=!0;const A=new Set(x.d.keys()),_=new Map,f=()=>{for(const w of A)_.has(w)||x.d.delete(w)},C=()=>{if(r.has(t)){const w=!i.size;M(e,t),w&&(p(e),h(e))}},b=w=>{var k;if(w===t){const L=m(e,w);if(!Me(L))if(Te(w))N(e,w,w.init);else throw new Error("no atom init");return J(L)}const E=g(e,w);try{return J(E)}finally{_.set(w,E.n),x.d.set(w,E.n),Q(x.v)&&Be(t,x.v,E),r.has(t)&&((k=r.get(w))==null||k.t.add(t)),S||C()}};let R,T;const D={get signal(){return R||(R=new AbortController),R.signal},get setSelf(){return(W?"production":void 0)!=="production"&&console.warn("[DEPRECATED] setSelf is deprecated and will be removed in v3."),(W?"production":void 0)!=="production"&&!ce(t)&&console.warn("setSelf function cannot be used with read-only atom"),!T&&ce(t)&&(T=(...w)=>{if((W?"production":void 0)!=="production"&&S&&console.warn("setSelf function cannot be called in sync"),!S)try{return y(e,t,...w)}finally{p(e),h(e)}}),T}},O=x.n;try{(W?"production":void 0)!=="production"&&le.delete(e);const w=u(e,t,b,D);if((W?"production":void 0)!=="production"&&le.has(e)&&console.warn("Detected store mutation during atom read. This is not supported."),N(e,t,w),Q(w)){v(e,w,()=>R==null?void 0:R.abort());const k=()=>{f(),C()};w.then(k,k)}else f();return(o=d.r)==null||o.call(d,t),x}catch(w){return delete x.v,x.e=w,++x.n,x}finally{S=!1,O!==x.n&&c.get(t)===O&&(c.set(t,x.n),i.add(t),(n=d.c)==null||n.call(d,t))}},Dn=(e,t)=>{const o=I(e),n=o[1],s=o[2],r=o[11],c=[t];for(;c.length;){const i=c.pop(),d=r(e,i);for(const u of Le(i,d,n)){const m=r(e,u);s.get(u)!==m.n&&(s.set(u,m.n),c.push(u))}}},In=(e,t,...o)=>{const n=I(e),s=n[3],r=n[6],c=n[8],i=n[11],d=n[12],u=n[13],m=n[14],h=n[15],p=n[16],g=n[17],y=n[20];let M=!0;const N=x=>J(m(e,x)),v=(x,...S)=>{var A;const _=i(e,x);try{if(x===t){if(!Te(x))throw new Error("atom not writable");(W?"production":void 0)!=="production"&&le.add(e);const f=_.n,C=S[0];y(e,x,C),g(e,x),f!==_.n&&(s.add(x),h(e,x),(A=r.c)==null||A.call(r,x));return}else return p(e,x,...S)}finally{M||(u(e),d(e))}};try{return c(e,t,N,v,...o)}finally{M=!1}},kn=(e,t)=>{var o;const n=I(e),s=n[1],r=n[3],c=n[6],i=n[11],d=n[15],u=n[18],m=n[19],h=i(e,t),p=s.get(t);if(p){for(const[g,y]of h.d)if(!p.d.has(g)){const M=i(e,g);u(e,g).t.add(t),p.d.add(g),y!==M.n&&(r.add(g),d(e,g),(o=c.c)==null||o.call(c,g))}for(const g of p.d)if(!h.d.has(g)){p.d.delete(g);const y=m(e,g);y==null||y.t.delete(t)}}},An=(e,t)=>{var o;const n=I(e),s=n[1],r=n[4],c=n[6],i=n[10],d=n[11],u=n[12],m=n[13],h=n[14],p=n[16],g=n[18],y=d(e,t);let M=s.get(t);if(!M){h(e,t);for(const N of y.d.keys())g(e,N).t.add(t);if(M={l:new Set,d:new Set(y.d.keys()),t:new Set},s.set(t,M),ce(t)){const N=()=>{let v=!0;const x=(...S)=>{try{return p(e,t,...S)}finally{v||(m(e),u(e))}};try{const S=i(e,t,x);S&&(M.u=()=>{v=!0;try{S()}finally{v=!1}})}finally{v=!1}};r.add(N)}(o=c.m)==null||o.call(c,t)}return M},En=(e,t)=>{var o,n;const s=I(e),r=s[1],c=s[5],i=s[6],d=s[11],u=s[19],m=d(e,t);let h=r.get(t);if(!h||h.l.size)return h;let p=!1;for(const g of h.t)if((o=r.get(g))!=null&&o.d.has(t)){p=!0;break}if(!p){h.u&&c.add(h.u),h=void 0,r.delete(t);for(const g of m.d.keys()){const y=u(e,g);y==null||y.t.delete(t)}(n=i.u)==null||n.call(i,t);return}return h},Rn=(e,t,o)=>{const n=I(e),s=n[11],r=n[27],c=s(e,t),i="v"in c,d=c.v;if(Q(o))for(const u of c.d.keys())Be(t,o,s(e,u));c.v=o,delete c.e,(!i||!Object.is(d,c.v))&&(++c.n,Q(d)&&r(e,d))},On=(e,t)=>{const o=I(e)[14];return J(o(e,t))},Pn=(e,t,...o)=>{const n=I(e),s=n[12],r=n[13],c=n[16];try{return c(e,t,...o)}finally{r(e),s(e)}},Tn=(e,t,o)=>{const n=I(e),s=n[12],r=n[18],c=n[19],d=r(e,t).l;return d.add(o),s(e),()=>{d.delete(o),c(e,t),s(e)}},Bn=(e,t,o)=>{const s=I(e)[25];let r=s.get(t);if(!r){r=new Set,s.set(t,r);const c=()=>s.delete(t);t.then(c,c)}r.add(o)},Ln=(e,t)=>{const s=I(e)[25].get(t);s==null||s.forEach(r=>r())},We=new WeakMap,I=e=>{const t=We.get(e);if((W?"production":void 0)!=="production"&&!t)throw new Error("Store must be created by buildStore to read its building blocks");return t};function Wn(e){const t=I(e),o=t[24];return o?o(t):t}function $n(...e){const t={get(n){const s=I(t)[21];return s(t,n)},set(n,...s){const r=I(t)[22];return r(t,n,...s)},sub(n,s){const r=I(t)[23];return r(t,n,s)}},o=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},bn,wn,Cn,Mn,jn,Sn,_n,Nn,Dn,In,kn,An,En,Rn,On,Pn,Tn,void 0,new WeakMap,Bn,Ln].map((n,s)=>e[s]||n);return We.set(t,Object.freeze(o)),t}const $e={};let Gn=0;function Ge(e,t){const o=`atom${++Gn}`,n={toString(){return($e?"production":void 0)!=="production"&&this.debugLabel?o+":"+this.debugLabel:o}};return typeof e=="function"?n.read=e:(n.init=e,n.read=Hn,n.write=Fn),n}function Hn(e){return e(this)}function Fn(e,t,o){return t(this,typeof o=="function"?o(e(this)):o)}function zn(){return $n()}let z;function Un(){return z||(z=zn(),($e?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=z),globalThis.__JOTAI_DEFAULT_STORE__!==z&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),z}const Kn={},Vn=l.createContext(void 0);function He(e){return l.useContext(Vn)||Un()}const de=e=>typeof(e==null?void 0:e.then)=="function",ue=e=>{e.status||(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}))},Yn=Ie.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(ue(e),e)}),ne=new WeakMap,je=(e,t,o)=>{const s=Wn(e)[26];let r=ne.get(t);return r||(r=new Promise((c,i)=>{let d=t;const u=p=>g=>{d===p&&c(g)},m=p=>g=>{d===p&&i(g)},h=()=>{try{const p=o();de(p)?(ne.set(p,r),d=p,p.then(u(p),m(p)),s(e,p,h)):c(p)}catch(p){i(p)}};t.then(u(t),m(t)),s(e,t,h)}),ne.set(t,r)),r};function qn(e,t){const{delay:o,unstable_promiseStatus:n=!Ie.use}={},s=He(),[[r,c,i],d]=l.useReducer(m=>{const h=s.get(e);return Object.is(m[0],h)&&m[1]===s&&m[2]===e?m:[h,s,e]},void 0,()=>[s.get(e),s,e]);let u=r;if((c!==s||i!==e)&&(d(),u=s.get(e)),l.useEffect(()=>{const m=s.sub(e,()=>{if(n)try{const h=s.get(e);de(h)&&ue(je(s,h,()=>s.get(e)))}catch{}if(typeof o=="number"){setTimeout(d,o);return}d()});return d(),m},[s,e,o,n]),l.useDebugValue(u),de(u)){const m=je(s,u,()=>s.get(e));return n&&ue(m),Yn(m)}return u}function Xn(e,t){const o=He();return l.useCallback((...s)=>{if((Kn?"production":void 0)!=="production"&&!("write"in e))throw new Error("not writable atom");return o.set(e,...s)},[o,e])}function Fe(e,t){return[qn(e),Xn(e)]}var ze="Expected a function",Se=NaN,Jn="[object Symbol]",Qn=/^\s+|\s+$/g,Zn=/^[-+]0x[0-9a-f]+$/i,eo=/^0b[01]+$/i,to=/^0o[0-7]+$/i,no=parseInt,oo=typeof Y=="object"&&Y&&Y.Object===Object&&Y,so=typeof self=="object"&&self&&self.Object===Object&&self,ro=oo||so||Function("return this")(),ao=Object.prototype,io=ao.toString,co=Math.max,lo=Math.min,oe=function(){return ro.Date.now()};function uo(e,t,o){var n,s,r,c,i,d,u=0,m=!1,h=!1,p=!0;if(typeof e!="function")throw new TypeError(ze);t=_e(t)||0,Z(o)&&(m=!!o.leading,h="maxWait"in o,r=h?co(_e(o.maxWait)||0,t):r,p="trailing"in o?!!o.trailing:p);function g(f){var C=n,b=s;return n=s=void 0,u=f,c=e.apply(b,C),c}function y(f){return u=f,i=setTimeout(v,t),m?g(f):c}function M(f){var C=f-d,b=f-u,R=t-C;return h?lo(R,r-b):R}function N(f){var C=f-d,b=f-u;return d===void 0||C>=t||C<0||h&&b>=r}function v(){var f=oe();if(N(f))return x(f);i=setTimeout(v,M(f))}function x(f){return i=void 0,p&&n?g(f):(n=s=void 0,c)}function S(){i!==void 0&&clearTimeout(i),u=0,n=d=s=i=void 0}function A(){return i===void 0?c:x(oe())}function _(){var f=oe(),C=N(f);if(n=arguments,s=this,d=f,C){if(i===void 0)return y(d);if(h)return i=setTimeout(v,t),g(d)}return i===void 0&&(i=setTimeout(v,t)),c}return _.cancel=S,_.flush=A,_}function fo(e,t,o){var n=!0,s=!0;if(typeof e!="function")throw new TypeError(ze);return Z(o)&&(n="leading"in o?!!o.leading:n,s="trailing"in o?!!o.trailing:s),uo(e,t,{leading:n,maxWait:t,trailing:s})}function Z(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function mo(e){return!!e&&typeof e=="object"}function ho(e){return typeof e=="symbol"||mo(e)&&io.call(e)==Jn}function _e(e){if(typeof e=="number")return e;if(ho(e))return Se;if(Z(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Z(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(Qn,"");var o=eo.test(e);return o||to.test(e)?no(e.slice(2),o?2:8):Zn.test(e)?Se:+e}var po=fo;const go=jt(po),Ue=l.forwardRef(({className:e,...t},o)=>a.jsx("div",{ref:o,className:j("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Ue.displayName="Card";const xo=l.forwardRef(({className:e,...t},o)=>a.jsx("div",{ref:o,className:j("flex flex-col space-y-1.5 p-6",e),...t}));xo.displayName="CardHeader";const vo=l.forwardRef(({className:e,...t},o)=>a.jsx("h3",{ref:o,className:j("text-2xl font-semibold leading-none tracking-tight",e),...t}));vo.displayName="CardTitle";const yo=l.forwardRef(({className:e,...t},o)=>a.jsx("p",{ref:o,className:j("text-sm text-muted-foreground",e),...t}));yo.displayName="CardDescription";const bo=l.forwardRef(({className:e,...t},o)=>a.jsx("div",{ref:o,className:j("p-6 pt-0",e),...t}));bo.displayName="CardContent";const wo=l.forwardRef(({className:e,...t},o)=>a.jsx("div",{ref:o,className:j("flex items-center p-6 pt-0",e),...t}));wo.displayName="CardFooter";function Co(e,t=[]){let o=[];function n(r,c){const i=l.createContext(c),d=o.length;o=[...o,c];const u=h=>{var v;const{scope:p,children:g,...y}=h,M=((v=p==null?void 0:p[e])==null?void 0:v[d])||i,N=l.useMemo(()=>y,Object.values(y));return a.jsx(M.Provider,{value:N,children:g})};u.displayName=r+"Provider";function m(h,p){var M;const g=((M=p==null?void 0:p[e])==null?void 0:M[d])||i,y=l.useContext(g);if(y)return y;if(c!==void 0)return c;throw new Error(`\`${h}\` must be used within \`${r}\``)}return[u,m]}const s=()=>{const r=o.map(c=>l.createContext(c));return function(i){const d=(i==null?void 0:i[e])||r;return l.useMemo(()=>({[`__scope${e}`]:{...i,[e]:d}}),[i,d])}};return s.scopeName=e,[n,Mo(s,...t)]}function Mo(...e){const t=e[0];if(e.length===1)return t;const o=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(r){const c=n.reduce((i,{useScope:d,scopeName:u})=>{const h=d(r)[`__scope${u}`];return{...i,...h}},{});return l.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return o.scopeName=t.scopeName,o}function jo(e){const t=So(e),o=l.forwardRef((n,s)=>{const{children:r,...c}=n,i=l.Children.toArray(r),d=i.find(No);if(d){const u=d.props.children,m=i.map(h=>h===d?l.Children.count(u)>1?l.Children.only(null):l.isValidElement(u)?u.props.children:null:h);return a.jsx(t,{...c,ref:s,children:l.isValidElement(u)?l.cloneElement(u,void 0,m):null})}return a.jsx(t,{...c,ref:s,children:r})});return o.displayName=`${e}.Slot`,o}function So(e){const t=l.forwardRef((o,n)=>{const{children:s,...r}=o;if(l.isValidElement(s)){const c=Io(s),i=Do(r,s.props);return s.type!==l.Fragment&&(i.ref=n?Qt(n,c):c),l.cloneElement(s,i)}return l.Children.count(s)>1?l.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var _o=Symbol("radix.slottable");function No(e){return l.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===_o}function Do(e,t){const o={...t};for(const n in t){const s=e[n],r=t[n];/^on[A-Z]/.test(n)?s&&r?o[n]=(...i)=>{const d=r(...i);return s(...i),d}:s&&(o[n]=s):n==="style"?o[n]={...s,...r}:n==="className"&&(o[n]=[s,r].filter(Boolean).join(" "))}return{...e,...o}}function Io(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,o=t&&"isReactWarning"in t&&t.isReactWarning;return o?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,o=t&&"isReactWarning"in t&&t.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}var ko=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ao=ko.reduce((e,t)=>{const o=jo(`Primitive.${t}`),n=l.forwardRef((s,r)=>{const{asChild:c,...i}=s,d=c?o:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...i,ref:r})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),me="ContextMenu",[Eo]=Co(me,[Oe]),P=Oe(),[Ro,Ke]=Eo(me),Ve=e=>{const{__scopeContextMenu:t,children:o,onOpenChange:n,dir:s,modal:r=!0}=e,[c,i]=l.useState(!1),d=P(t),u=Zt(n),m=l.useCallback(h=>{i(h),u(h)},[u]);return a.jsx(Ro,{scope:t,open:c,onOpenChange:m,modal:r,children:a.jsx(en,{...d,dir:s,open:c,onOpenChange:m,modal:r,children:o})})};Ve.displayName=me;var Ye="ContextMenuTrigger",qe=l.forwardRef((e,t)=>{const{__scopeContextMenu:o,disabled:n=!1,...s}=e,r=Ke(Ye,o),c=P(o),i=l.useRef({x:0,y:0}),d=l.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...i.current})}),u=l.useRef(0),m=l.useCallback(()=>window.clearTimeout(u.current),[]),h=p=>{i.current={x:p.clientX,y:p.clientY},r.onOpenChange(!0)};return l.useEffect(()=>m,[m]),l.useEffect(()=>void(n&&m()),[n,m]),a.jsxs(a.Fragment,{children:[a.jsx(tn,{...c,virtualRef:d}),a.jsx(Ao.span,{"data-state":r.open?"open":"closed","data-disabled":n?"":void 0,...s,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:n?e.onContextMenu:F(e.onContextMenu,p=>{m(),h(p),p.preventDefault()}),onPointerDown:n?e.onPointerDown:F(e.onPointerDown,q(p=>{m(),u.current=window.setTimeout(()=>h(p),700)})),onPointerMove:n?e.onPointerMove:F(e.onPointerMove,q(m)),onPointerCancel:n?e.onPointerCancel:F(e.onPointerCancel,q(m)),onPointerUp:n?e.onPointerUp:F(e.onPointerUp,q(m))})]})});qe.displayName=Ye;var Oo="ContextMenuPortal",Xe=e=>{const{__scopeContextMenu:t,...o}=e,n=P(t);return a.jsx(nn,{...n,...o})};Xe.displayName=Oo;var Je="ContextMenuContent",Qe=l.forwardRef((e,t)=>{const{__scopeContextMenu:o,...n}=e,s=Ke(Je,o),r=P(o),c=l.useRef(!1);return a.jsx(on,{...r,...n,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:i=>{var d;(d=e.onCloseAutoFocus)==null||d.call(e,i),!i.defaultPrevented&&c.current&&i.preventDefault(),c.current=!1},onInteractOutside:i=>{var d;(d=e.onInteractOutside)==null||d.call(e,i),!i.defaultPrevented&&!s.modal&&(c.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Qe.displayName=Je;var Po="ContextMenuGroup",To=l.forwardRef((e,t)=>{const{__scopeContextMenu:o,...n}=e,s=P(o);return a.jsx(rn,{...s,...n,ref:t})});To.displayName=Po;var Bo="ContextMenuLabel",Ze=l.forwardRef((e,t)=>{const{__scopeContextMenu:o,...n}=e,s=P(o);return a.jsx(an,{...s,...n,ref:t})});Ze.displayName=Bo;var Lo="ContextMenuItem",et=l.forwardRef((e,t)=>{const{__scopeContextMenu:o,...n}=e,s=P(o);return a.jsx(sn,{...s,...n,ref:t})});et.displayName=Lo;var Wo="ContextMenuCheckboxItem",tt=l.forwardRef((e,t)=>{const{__scopeContextMenu:o,...n}=e,s=P(o);return a.jsx(cn,{...s,...n,ref:t})});tt.displayName=Wo;var $o="ContextMenuRadioGroup",Go=l.forwardRef((e,t)=>{const{__scopeContextMenu:o,...n}=e,s=P(o);return a.jsx(ln,{...s,...n,ref:t})});Go.displayName=$o;var Ho="ContextMenuRadioItem",nt=l.forwardRef((e,t)=>{const{__scopeContextMenu:o,...n}=e,s=P(o);return a.jsx(dn,{...s,...n,ref:t})});nt.displayName=Ho;var Fo="ContextMenuItemIndicator",ot=l.forwardRef((e,t)=>{const{__scopeContextMenu:o,...n}=e,s=P(o);return a.jsx(un,{...s,...n,ref:t})});ot.displayName=Fo;var zo="ContextMenuSeparator",st=l.forwardRef((e,t)=>{const{__scopeContextMenu:o,...n}=e,s=P(o);return a.jsx(fn,{...s,...n,ref:t})});st.displayName=zo;var Uo="ContextMenuArrow",Ko=l.forwardRef((e,t)=>{const{__scopeContextMenu:o,...n}=e,s=P(o);return a.jsx(mn,{...s,...n,ref:t})});Ko.displayName=Uo;var Vo="ContextMenuSubTrigger",rt=l.forwardRef((e,t)=>{const{__scopeContextMenu:o,...n}=e,s=P(o);return a.jsx(hn,{...s,...n,ref:t})});rt.displayName=Vo;var Yo="ContextMenuSubContent",at=l.forwardRef((e,t)=>{const{__scopeContextMenu:o,...n}=e,s=P(o);return a.jsx(pn,{...s,...n,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});at.displayName=Yo;function q(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var qo=Ve,Xo=qe,Jo=Xe,it=Qe,ct=Ze,lt=et,dt=tt,ut=nt,ft=ot,mt=st,ht=rt,pt=at;const Qo=qo,Zo=Xo,es=l.forwardRef(({className:e,inset:t,children:o,...n},s)=>a.jsxs(ht,{ref:s,className:j("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t&&"pl-8",e),...n,children:[o,a.jsx(At,{className:"ml-auto h-4 w-4"})]}));es.displayName=ht.displayName;const ts=l.forwardRef(({className:e,...t},o)=>a.jsx(pt,{ref:o,className:j("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));ts.displayName=pt.displayName;const gt=l.forwardRef(({className:e,...t},o)=>a.jsx(Jo,{children:a.jsx(it,{ref:o,className:j("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t})}));gt.displayName=it.displayName;const xt=l.forwardRef(({className:e,inset:t,...o},n)=>a.jsx(lt,{ref:n,className:j("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...o}));xt.displayName=lt.displayName;const ns=l.forwardRef(({className:e,children:t,checked:o,...n},s)=>a.jsxs(dt,{ref:s,className:j("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:o,...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(ft,{children:a.jsx(Et,{className:"h-4 w-4"})})}),t]}));ns.displayName=dt.displayName;const os=l.forwardRef(({className:e,children:t,...o},n)=>a.jsxs(ut,{ref:n,className:j("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...o,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(ft,{children:a.jsx(Rt,{className:"h-2 w-2 fill-current"})})}),t]}));os.displayName=ut.displayName;const ss=l.forwardRef(({className:e,inset:t,...o},n)=>a.jsx(ct,{ref:n,className:j("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...o}));ss.displayName=ct.displayName;const rs=l.forwardRef(({className:e,...t},o)=>a.jsx(mt,{ref:o,className:j("-mx-1 my-1 h-px bg-border",e),...t}));rs.displayName=mt.displayName;const as=Ge(!1),is=Ge(0),he=()=>Fe(as),pe=()=>Fe(is),cs=e=>{let t=o=>1;return(e==="monthly"||e==="quarterly")&&(t=H),t},V=e=>{let t=Pe;return(e==="monthly"||e==="quarterly")&&(t=Tt),t},ge=e=>{let t=xn;return(e==="monthly"||e==="quarterly")&&(t=Pe),t},K=e=>{let t=Ot;return(e==="monthly"||e==="quarterly")&&(t=Bt),t},ls=e=>{let t=Pt;return(e==="monthly"||e==="quarterly")&&(t=Lt),t},vt=e=>{let t=$;return(e==="monthly"||e==="quarterly")&&(t=Wt),t},U=(e,t)=>{const o=new Date(e.timelineData[0].year,0,1),n=e.columnWidth*e.zoom/100,s=Math.floor(t/n),r=cs(e.range),i=vt(e.range)(o,s),d=r(i),u=Math.round(n/d),m=Math.floor(t%n/u);return $(i,m)},ds=e=>{const t=[];t.push({year:e.getFullYear()-1,quarters:new Array(4).fill(null)},{year:e.getFullYear(),quarters:new Array(4).fill(null)},{year:e.getFullYear()+1,quarters:new Array(4).fill(null)});for(const o of t)o.quarters=new Array(4).fill(null).map((n,s)=>({months:new Array(3).fill(null).map((r,c)=>{const i=s*3+c;return{days:H(new Date(o.year,i,1))}})}));return t},yt=(e,t,o)=>{const n=o.columnWidth*o.zoom/100,s=V(o.range),r=K(o.range),c=s(r(e),t);if(o.range==="daily")return n*c;const i=e.getDate(),d=H(e),u=n/d;return c*n+i*u},us=(e,t,o)=>{const n=o.columnWidth*o.zoom/100;if(!t)return n*2;const s=V(o.range);if(o.range==="daily"){const y=s(t,e);return n*(y||1)}const r=H(e),c=n/r;if(ie(e,t))return c;const i=ge(o.range),d=K(o.range);if(ie(d(e),d(t)))return i(t,e)*c;const u=r-Ce(e),m=Ce(t),h=s(d(t),d(e)),p=H(t),g=n/p;return(h-1)*n+u*c+m*g},bt=(e,t,o)=>{const n=K(t),s=ls(t),r=ge(t),c=n(e),i=s(e),d=r(i,c);return e.getDate()/d*o},B=l.createContext({zoom:100,range:"monthly",columnWidth:50,headerHeight:60,sidebarWidth:300,rowHeight:36,onAddItem:void 0,placeholderLength:2,timelineData:[],ref:null,scrollToFeature:void 0}),xe=({title:e,columns:t,renderHeaderItem:o})=>{const n=l.useId();return a.jsxs("div",{className:"sticky top-0 z-20 grid w-full shrink-0 bg-backdrop/90 backdrop-blur-sm",style:{height:"var(--gantt-header-height)"},children:[a.jsx("div",{children:a.jsx("div",{className:"sticky inline-flex whitespace-nowrap px-3 py-2 text-muted-foreground text-xs",style:{left:"var(--gantt-sidebar-width)"},children:a.jsx("p",{children:e})})}),a.jsx("div",{className:"grid w-full",style:{gridTemplateColumns:`repeat(${t}, var(--gantt-column-width))`},children:Array.from({length:t}).map((s,r)=>a.jsx("div",{className:"shrink-0 border-border/50 border-b py-1 text-center text-xs",children:o(r)},`${n}-${r}`))})]})},fs=()=>l.useContext(B).timelineData.map(t=>t.quarters.flatMap(o=>o.months).map((o,n)=>a.jsxs("div",{className:"relative flex flex-col",children:[a.jsx(xe,{columns:o.days,renderHeaderItem:s=>a.jsxs("div",{className:"flex items-center justify-center gap-1",children:[a.jsx("p",{children:G($(new Date(t.year,n,1),s),"d")}),a.jsx("p",{className:"text-muted-foreground",children:G($(new Date(t.year,n,1),s),"EEEEE")})]}),title:G(new Date(t.year,n,1),"MMMM yyyy")}),a.jsx(ve,{columns:o.days,isColumnSecondary:s=>[0,6].includes($(new Date(t.year,n,1),s).getDay())})]},`${t.year}-${n}`))),ms=()=>l.useContext(B).timelineData.map(t=>a.jsxs("div",{className:"relative flex flex-col",children:[a.jsx(xe,{columns:t.quarters.flatMap(o=>o.months).length,renderHeaderItem:o=>a.jsx("p",{children:G(new Date(t.year,o,1),"MMM")}),title:`${t.year}`}),a.jsx(ve,{columns:t.quarters.flatMap(o=>o.months).length})]},t.year)),hs=()=>l.useContext(B).timelineData.map(t=>t.quarters.map((o,n)=>a.jsxs("div",{className:"relative flex flex-col",children:[a.jsx(xe,{columns:o.months.length,renderHeaderItem:s=>a.jsx("p",{children:G(new Date(t.year,n*3+s,1),"MMM")}),title:`Q${n+1} ${t.year}`}),a.jsx(ve,{columns:o.months.length})]},`${t.year}-${n}`))),ps={daily:fs,monthly:ms,quarterly:hs},gs=({className:e})=>{const t=l.useContext(B),o=ps[t.range];return a.jsx("div",{className:j("-space-x-px flex h-full w-max divide-x divide-border/50",e),children:a.jsx(o,{})})},se=({feature:e,onSelectItem:t,className:o})=>{const n=l.useContext(B),s=e.endAt&&ie(e.startAt,e.endAt)?$(e.endAt,1):e.endAt,r=s?ye(e.startAt,s):`${ye(e.startAt,new Date)} so far`,c=d=>{var u;d.target===d.currentTarget&&((u=n.scrollToFeature)==null||u.call(n,e),t==null||t(e.id))},i=d=>{var u;d.key==="Enter"&&((u=n.scrollToFeature)==null||u.call(n,e),t==null||t(e.id))};return a.jsxs("div",{className:j("relative flex items-center gap-2.5 p-2.5 text-xs hover:bg-secondary",o),onClick:c,onKeyDown:i,role:"button",style:{height:"var(--gantt-row-height)"},tabIndex:0,children:[a.jsx("div",{className:"pointer-events-none h-2 w-2 shrink-0 rounded-full",style:{backgroundColor:e.status.color}}),a.jsx("p",{className:"pointer-events-none flex-1 truncate text-left font-medium",children:e.name}),a.jsx("p",{className:"pointer-events-none text-muted-foreground",children:r})]},e.id)},xs=()=>a.jsxs("div",{className:"sticky top-0 z-10 flex shrink-0 items-end justify-between gap-2.5 border-border/50 border-b bg-backdrop/90 p-2.5 font-medium text-muted-foreground text-xs backdrop-blur-sm",style:{height:"var(--gantt-header-height)"},children:[a.jsx("p",{className:"flex-1 truncate text-left",children:"Issues"}),a.jsx("p",{className:"shrink-0",children:"Duration"})]}),re=({children:e,name:t,className:o})=>a.jsxs("div",{className:o,children:[a.jsx("p",{className:"w-full truncate p-2.5 text-left font-medium text-muted-foreground text-xs",style:{height:"var(--gantt-row-height)"},children:t}),a.jsx("div",{className:"divide-y divide-border/50",children:e})]}),vs=({children:e,className:t})=>a.jsxs("div",{className:j("sticky left-0 z-30 h-max min-h-full overflow-clip border-border/50 border-r bg-white dark:bg-zinc-950 backdrop-blur-md",t),"data-roadmap-ui":"gantt-sidebar",children:[a.jsx(xs,{}),a.jsx("div",{className:"space-y-4",children:e})]}),ys=({top:e,className:t})=>{const[o]=pe(),n=l.useContext(B),[s,r]=fe(),c=()=>{var m,h,p;const i=(h=(m=n.ref)==null?void 0:m.current)==null?void 0:h.getBoundingClientRect(),d=s.x-((i==null?void 0:i.left)??0)+o-n.sidebarWidth,u=U(n,d);(p=n.onAddItem)==null||p.call(n,u)};return a.jsx("div",{className:j("absolute top-0 w-full px-0.5",t),ref:r,style:{marginTop:-n.rowHeight/2,transform:`translateY(${e}px)`},children:a.jsx("button",{className:"flex h-full w-full items-center justify-center rounded-md border border-dashed p-2",onClick:c,type:"button",children:a.jsx(Ee,{className:"pointer-events-none select-none text-muted-foreground",size:16})})})},bs=({index:e,isColumnSecondary:t})=>{var p;const o=l.useContext(B),[n]=he(),[s,r]=fe(),[c,i]=l.useState(!1),[d]=yn(),u=()=>i(!0),m=()=>i(!1),h=vn(s.y-(((p=r.current)==null?void 0:p.getBoundingClientRect().y)??0)-(d.y??0),10);return a.jsx("div",{className:j("group relative h-full overflow-hidden",t!=null&&t(e)?"bg-[#f59e0b]/5 dark:bg-[#f59e0b]/5":""),onMouseEnter:u,onMouseLeave:m,ref:r,children:!n&&c&&o.onAddItem?a.jsx(ys,{top:h}):null})},ve=({columns:e,isColumnSecondary:t})=>{const o=l.useId();return a.jsx("div",{className:"divide grid h-full w-full divide-x divide-border/50",style:{gridTemplateColumns:`repeat(${e}, var(--gantt-column-width))`},children:Array.from({length:e}).map((n,s)=>a.jsx(bs,{index:s,isColumnSecondary:t},`${o}-${s}`))})},Ne=({direction:e,featureId:t,date:o})=>{const[,n]=he(),{attributes:s,listeners:r,setNodeRef:c}=Re({id:`feature-drag-helper-${t}`}),i=!!s["aria-pressed"];return l.useEffect(()=>n(i),[i,n]),a.jsxs("div",{className:j("group -translate-y-1/2 !cursor-col-resize absolute top-1/2 z-[3] h-full w-6 rounded-md outline-none",e==="left"?"-left-2.5":"-right-2.5"),ref:c,...s,...r,children:[a.jsx("div",{className:j("-translate-y-1/2 absolute top-1/2 h-[80%] w-1 rounded-sm bg-muted-foreground opacity-0 transition-all",e==="left"?"left-2.5":"right-2.5",e==="left"?"group-hover:left-0":"group-hover:right-0",i&&(e==="left"?"left-0":"right-0"),"group-hover:opacity-100",i&&"opacity-100")}),o&&a.jsx("div",{className:j("-translate-x-1/2 absolute top-10 hidden whitespace-nowrap rounded-lg border border-border/50 bg-background/90 px-2 py-1 text-foreground text-xs backdrop-blur-lg group-hover:block",i&&"block"),children:G(o,"MMM dd, yyyy")})]})},ws=({id:e,children:t})=>{const[,o]=he(),{attributes:n,listeners:s,setNodeRef:r}=Re({id:e}),c=!!n["aria-pressed"];return l.useEffect(()=>o(c),[c,o]),a.jsx(Ue,{className:"h-full w-full rounded-md bg-background p-2 text-xs shadow-sm",children:a.jsx("div",{className:j("flex h-full w-full items-center justify-between gap-2 text-left",c&&"cursor-grabbing"),...n,...s,ref:r,children:t})})},De=({onMove:e,children:t,className:o,...n})=>{const[s]=pe(),r=l.useContext(B),c=l.useMemo(()=>{var D;return new Date(((D=r.timelineData.at(0))==null?void 0:D.year)??0,0,1)},[r.timelineData]),[i,d]=l.useState(n.startAt),[u,m]=l.useState(n.endAt),h=l.useMemo(()=>us(i,u,r),[i,u,r]),p=l.useMemo(()=>yt(i,c,r),[i,c,r]),g=l.useMemo(()=>vt(r.range),[r.range]),[y]=fe(),[M,N]=l.useState(0),[v,x]=l.useState(i),[S,A]=l.useState(u),_=Xt(Jt,{activationConstraint:{distance:10}}),f=l.useCallback(()=>{N(y.x),x(i),A(u)},[y.x,i,u]),C=l.useCallback(()=>{const D=U(r,y.x),O=U(r,M),w=r.range==="daily"?V(r.range)(D,O):ge(r.range)(D,O),k=$(v,w),E=S?$(S,w):null;d(k),m(E)},[r,y.x,M,v,S]),b=l.useCallback(()=>e==null?void 0:e(n.id,i,u),[e,n.id,i,u]),R=l.useCallback(()=>{var E,L;const D=(L=(E=r.ref)==null?void 0:E.current)==null?void 0:L.getBoundingClientRect(),O=y.x-((D==null?void 0:D.left)??0)+s-r.sidebarWidth,k=K(r.range)(U(r,O));d(k)},[r,y.x,s]),T=l.useCallback(()=>{var E,L;const D=(L=(E=r.ref)==null?void 0:E.current)==null?void 0:L.getBoundingClientRect(),O=y.x-((D==null?void 0:D.left)??0)+s-r.sidebarWidth,k=K(r.range)(U(r,O));m(k)},[r,y.x,s]);return a.jsx("div",{className:j("relative flex w-max min-w-full py-0.5",o),style:{height:"var(--gantt-row-height)"},children:a.jsxs("div",{className:"pointer-events-auto absolute top-0.5",style:{height:"calc(var(--gantt-row-height) - 4px)",width:Math.round(h),left:Math.round(p)},children:[e&&a.jsx(ee,{modifiers:[te],onDragEnd:b,onDragMove:R,sensors:[_],children:a.jsx(Ne,{date:i,direction:"left",featureId:n.id})}),a.jsx(ee,{modifiers:[te],onDragEnd:b,onDragMove:C,onDragStart:f,sensors:[_],children:a.jsx(ws,{id:n.id,children:t??a.jsx("p",{className:"flex-1 truncate text-xs",children:n.name})})}),e&&a.jsx(ee,{modifiers:[te],onDragEnd:b,onDragMove:T,sensors:[_],children:a.jsx(Ne,{date:u?Ae(u):g(i,1),direction:"right",featureId:n.id})})]})})},ae=({children:e,className:t})=>a.jsx("div",{className:t,style:{paddingTop:"var(--gantt-row-height)"},children:e}),Cs=({className:e,children:t})=>a.jsx("div",{className:j("absolute top-0 left-0 h-full w-max space-y-4",e),style:{marginTop:"var(--gantt-header-height)"},children:t}),wt=l.memo(({label:e,date:t,id:o,onRemove:n,className:s})=>{const r=l.useContext(B),c=l.useMemo(()=>V(r.range),[r.range]),i=l.useMemo(()=>{var h;return new Date(((h=r.timelineData.at(0))==null?void 0:h.year)??0,0,1)},[r.timelineData]),d=l.useMemo(()=>c(t,i),[c,t,i]),u=l.useMemo(()=>bt(t,r.range,r.columnWidth*r.zoom/100),[t,r.range,r.columnWidth,r.zoom]),m=l.useCallback(()=>n==null?void 0:n(o),[n,o]);return a.jsxs("div",{className:"pointer-events-none absolute top-0 left-0 z-20 flex h-full select-none flex-col items-center justify-center overflow-visible",style:{width:0,transform:`translateX(calc(var(--gantt-column-width) * ${d} + ${u}px))`},children:[a.jsxs(Qo,{children:[a.jsx(Zo,{asChild:!0,children:a.jsxs("div",{className:j("group pointer-events-auto sticky top-0 flex select-auto flex-col flex-nowrap items-center justify-center whitespace-nowrap rounded-b-md bg-card px-2 py-1 text-foreground text-xs",s),children:[e,a.jsx("span",{className:"max-h-[0] overflow-hidden opacity-80 transition-all group-hover:max-h-[2rem]",children:G(t,"MMM dd, yyyy")})]})}),a.jsx(gt,{children:n?a.jsxs(xt,{className:"flex items-center gap-2 text-destructive",onClick:m,children:[a.jsx(gn,{size:16}),"Remove marker"]}):null})]}),a.jsx("div",{className:j("h-full w-px bg-card",s)})]})});wt.displayName="GanttMarker";const Ms=({zoom:e=100,range:t="monthly",onAddItem:o,children:n,className:s})=>{const r=l.useRef(null),[c,i]=l.useState(ds(new Date)),[,d]=pe(),[u,m]=l.useState(0),h=60,p=36;let g=50;t==="monthly"?g=150:t==="quarterly"&&(g=100);const y=l.useMemo(()=>({"--gantt-zoom":`${e}`,"--gantt-column-width":`${e/100*g}px`,"--gantt-header-height":`${h}px`,"--gantt-row-height":`${p}px`,"--gantt-sidebar-width":`${u}px`}),[e,g,u]);l.useEffect(()=>{r.current&&(r.current.scrollLeft=r.current.scrollWidth/2-r.current.clientWidth/2,d(r.current.scrollLeft))},[d]),l.useEffect(()=>{const v=()=>{var _;const A=((_=r.current)==null?void 0:_.querySelector('[data-roadmap-ui="gantt-sidebar"]'))?300:0;m(A)};v();const x=new MutationObserver(v);return r.current&&x.observe(r.current,{childList:!0,subtree:!0}),()=>{x.disconnect()}},[]);const M=l.useCallback(go(()=>{var _,f;const v=r.current;if(!v)return;const{scrollLeft:x,scrollWidth:S,clientWidth:A}=v;if(d(x),x===0){const C=(_=c[0])==null?void 0:_.year;if(!C)return;const b=[...c];b.unshift({year:C-1,quarters:new Array(4).fill(null).map((R,T)=>({months:new Array(3).fill(null).map((D,O)=>{const w=T*3+O;return{days:H(new Date(C,w,1))}})}))}),i(b),v.scrollLeft=v.clientWidth,d(v.scrollLeft)}else if(x+A>=S){const C=(f=c.at(-1))==null?void 0:f.year;if(!C)return;const b=[...c];b.push({year:C+1,quarters:new Array(4).fill(null).map((R,T)=>({months:new Array(3).fill(null).map((D,O)=>{const w=T*3+O;return{days:H(new Date(C,w,1))}})}))}),i(b),v.scrollLeft=v.scrollWidth-v.clientWidth,d(v.scrollLeft)}},100),[]);l.useEffect(()=>{const v=r.current;return v&&v.addEventListener("scroll",M),()=>{v&&v.removeEventListener("scroll",M)}},[M]);const N=l.useCallback(v=>{const x=r.current;if(!x)return;const S=new Date(c[0].year,0,1),A=yt(v.startAt,S,{zoom:e,range:t,columnWidth:g}),_=Math.max(0,A);x.scrollTo({left:_,behavior:"smooth"})},[c,e,t,g,u,o]);return a.jsx(B.Provider,{value:{zoom:e,range:t,headerHeight:h,columnWidth:g,sidebarWidth:u,rowHeight:p,onAddItem:o,timelineData:c,placeholderLength:2,ref:r,scrollToFeature:N},children:a.jsx("div",{className:j("gantt relative isolate grid h-full w-full flex-none select-none overflow-auto rounded-sm bg-secondary",t,s),ref:r,style:{...y,gridTemplateColumns:"var(--gantt-sidebar-width) 1fr"},children:n})})},js=({children:e,className:t})=>a.jsx("div",{className:j("relative flex h-full w-max flex-none overflow-clip",t),children:e}),Ss=({className:e})=>{const t="Today",o=l.useMemo(()=>new Date,[]),n=l.useContext(B),s=l.useMemo(()=>V(n.range),[n.range]),r=l.useMemo(()=>{var d;return new Date(((d=n.timelineData.at(0))==null?void 0:d.year)??0,0,1)},[n.timelineData]),c=l.useMemo(()=>s(o,r),[s,o,r]),i=l.useMemo(()=>bt(o,n.range,n.columnWidth*n.zoom/100),[o,n.range,n.columnWidth,n.zoom]);return a.jsxs("div",{className:"pointer-events-none absolute top-0 left-0 z-20 flex h-full select-none flex-col items-center justify-center overflow-visible",style:{width:0,transform:`translateX(calc(var(--gantt-column-width) * ${c} + ${i}px))`},children:[a.jsxs("div",{className:j("group pointer-events-auto sticky top-0 flex select-auto flex-col flex-nowrap items-center justify-center whitespace-nowrap rounded-b-md bg-card px-2 py-1 text-foreground text-xs",e),children:[t,a.jsx("span",{className:"max-h-[0] overflow-hidden opacity-80 transition-all group-hover:max-h-[2rem]",children:G(o,"MMM dd, yyyy")})]}),a.jsx("div",{className:j("h-full w-px bg-card",e)})]})};function X(e,t){const o=e.start_date?new Date(e.start_date):new Date(e.due_date),n=e.due_date?$(new Date(e.due_date),1):$(o,1);return{id:e.id,name:`${e.identifier} ${e.title}`,startAt:o,endAt:n,status:{id:e.status,name:e.status,color:t}}}function Es(){const{projectKey:e}=St(),t=Ct(),[o,n]=l.useState("monthly"),[s,r]=l.useState(null),[c,i]=l.useState(!1),d=l.useRef(null);l.useEffect(()=>{const f=requestAnimationFrame(()=>{var w;const C=(w=d.current)==null?void 0:w.querySelector(".gantt");if(!C)return;const b=new Date,R=b.getFullYear()-1,T=300;let D;if(o==="daily"){const k=new Date(R,0,1);D=Math.floor((b.getTime()-k.getTime())/864e5)*50}else{const k=o==="monthly"?150:100,E=(b.getFullYear()-R)*12+b.getMonth(),L=new Date(b.getFullYear(),b.getMonth()+1,0).getDate();D=E*k+(b.getDate()-1)/L*k}const O=C.clientWidth-T;C.scrollLeft=Math.max(0,D-O/2)});return()=>cancelAnimationFrame(f)},[o]);const{data:u}=$t(e??""),m=(u==null?void 0:u.id)??"",{data:h=[]}=Gt(m||void 0),{data:p=[]}=Ht(m||void 0),{data:g=[]}=Ft(m||void 0),y=Mt({mutationFn:({id:f,start_date:C,due_date:b})=>qt.put(`/admin/issues/${f}`,{start_date:C,due_date:b}),onSuccess:()=>{t.invalidateQueries({queryKey:Yt.byProject(m)})},onError:()=>Vt.error("Failed to update issue dates")}),M=Object.fromEntries(p.map(f=>[f.key,f.color])),N=h.filter(f=>f.due_date),v=h.filter(f=>!f.due_date),x={},S=[];for(const f of N)f.sprint_id?(x[f.sprint_id]||(x[f.sprint_id]=[]),x[f.sprint_id].push(f)):S.push(f);const A=(f,C,b)=>{y.mutate({id:f,start_date:G(C,"yyyy-MM-dd"),due_date:b?G(Ae(b),"yyyy-MM-dd"):null})},_=f=>{const C=h.find(b=>b.id===f)??null;r(C)};return e?a.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[a.jsx(be,{zone:"project.timeline.before",props:{projectId:m}}),a.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-border shrink-0 bg-white dark:bg-zinc-950",children:[a.jsx("div",{className:"flex items-center gap-1 bg-muted rounded-md p-0.5",children:["daily","monthly","quarterly"].map(f=>a.jsx("button",{onClick:()=>n(f),className:`px-3 py-1 rounded text-xs font-medium transition-colors capitalize ${o===f?"bg-white dark:bg-zinc-900 text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:f},f))}),a.jsxs(zt,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:()=>i(!0),children:[a.jsx(Ee,{className:"h-3.5 w-3.5"}),"Issue"]})]}),a.jsx("div",{ref:d,className:"flex-1 min-h-0 overflow-hidden",children:a.jsxs(Ms,{range:o,zoom:100,className:"h-full bg-white dark:bg-zinc-950",children:[a.jsxs(vs,{children:[g.map(f=>{const C=x[f.id]??[];return a.jsx(re,{name:f.name,children:C.map(b=>a.jsx(se,{feature:X(b,M[b.status]??"#94a3b8"),onSelectItem:_},b.id))},f.id)}),S.length>0&&a.jsx(re,{name:"No Sprint",children:S.map(f=>a.jsx(se,{feature:X(f,M[f.status]??"#94a3b8"),onSelectItem:_},f.id))}),v.length>0&&a.jsx(re,{name:"Unscheduled",children:v.map(f=>a.jsx(se,{feature:{id:f.id,name:`${f.identifier} ${f.title}`,startAt:new Date,endAt:new Date,status:{id:f.status,name:f.status,color:M[f.status]??"#94a3b8"}},onSelectItem:_},f.id))})]}),a.jsxs(js,{children:[a.jsx(gs,{}),a.jsxs(Cs,{children:[g.map(f=>{const C=x[f.id]??[];return a.jsx(ae,{children:C.map(b=>a.jsx("div",{className:"flex",children:a.jsx(De,{onMove:A,...X(b,M[b.status]??"#94a3b8")})},b.id))},f.id)}),S.length>0&&a.jsx(ae,{children:S.map(f=>a.jsx("div",{className:"flex",children:a.jsx(De,{onMove:A,...X(f,M[f.status]??"#94a3b8")})},f.id))}),v.length>0&&a.jsx(ae,{children:v.map(f=>a.jsx("div",{style:{height:"var(--gantt-row-height)"}},f.id))})]}),g.filter(f=>f.end_date).map(f=>a.jsx(wt,{id:f.id,date:new Date(f.end_date),label:`${f.name} end`},f.id)),a.jsx(Ss,{})]})]})}),a.jsx(be,{zone:"project.timeline.after",props:{projectId:m}}),a.jsx(Ut,{issue:s,projectId:m,open:!!s,onClose:()=>r(null)}),a.jsx(Kt,{open:c,onClose:()=>i(!1),projectId:m})]}):null}export{Es as ProjectTimelinePage};