react-gantt-svg
Version:
A React Gantt chart component library
48 lines (46 loc) • 100 kB
JavaScript
(function(tt,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],d):(tt=typeof globalThis<"u"?globalThis:tt||self,d(tt.ReactGantt={},tt.React,tt.ReactDOM))})(this,(function(tt,d,Et){"use strict";function jr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $t={exports:{}},Tt={};/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Dn;function Fr(){if(Dn)return Tt;Dn=1;var e=d,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function l(u,c,h){var f,a={},g=null,v=null;h!==void 0&&(g=""+h),c.key!==void 0&&(g=""+c.key),c.ref!==void 0&&(v=c.ref);for(f in c)r.call(c,f)&&!s.hasOwnProperty(f)&&(a[f]=c[f]);if(u&&u.defaultProps)for(f in c=u.defaultProps,c)a[f]===void 0&&(a[f]=c[f]);return{$$typeof:t,type:u,key:g,ref:v,props:a,_owner:o.current}}return Tt.Fragment=n,Tt.jsx=l,Tt.jsxs=l,Tt}var _t={};/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Sn;function Mr(){return Sn||(Sn=1,process.env.NODE_ENV!=="production"&&(function(){var e=d,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),u=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),a=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),v=Symbol.for("react.offscreen"),w=Symbol.iterator,m="@@iterator";function T(i){if(i===null||typeof i!="object")return null;var C=w&&i[w]||i[m];return typeof C=="function"?C:null}var y=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function D(i){{for(var C=arguments.length,j=new Array(C>1?C-1:0),I=1;I<C;I++)j[I-1]=arguments[I];O("error",i,j)}}function O(i,C,j){{var I=y.ReactDebugCurrentFrame,ae=I.getStackAddendum();ae!==""&&(C+="%s",j=j.concat([ae]));var he=j.map(function(ne){return String(ne)});he.unshift("Warning: "+C),Function.prototype.apply.call(console[i],console,he)}}var E=!1,x=!1,M=!1,_=!1,A=!1,Q;Q=Symbol.for("react.module.reference");function se(i){return!!(typeof i=="string"||typeof i=="function"||i===r||i===s||A||i===o||i===h||i===f||_||i===v||E||x||M||typeof i=="object"&&i!==null&&(i.$$typeof===g||i.$$typeof===a||i.$$typeof===l||i.$$typeof===u||i.$$typeof===c||i.$$typeof===Q||i.getModuleId!==void 0))}function ee(i,C,j){var I=i.displayName;if(I)return I;var ae=C.displayName||C.name||"";return ae!==""?j+"("+ae+")":j}function Z(i){return i.displayName||"Context"}function G(i){if(i==null)return null;if(typeof i.tag=="number"&&D("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case r:return"Fragment";case n:return"Portal";case s:return"Profiler";case o:return"StrictMode";case h:return"Suspense";case f:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case u:var C=i;return Z(C)+".Consumer";case l:var j=i;return Z(j._context)+".Provider";case c:return ee(i,i.render,"ForwardRef");case a:var I=i.displayName||null;return I!==null?I:G(i.type)||"Memo";case g:{var ae=i,he=ae._payload,ne=ae._init;try{return G(ne(he))}catch{return null}}}return null}var le=Object.assign,ge=0,re,k,X,N,F,R,L;function B(){}B.__reactDisabledLog=!0;function ie(){{if(ge===0){re=console.log,k=console.info,X=console.warn,N=console.error,F=console.group,R=console.groupCollapsed,L=console.groupEnd;var i={configurable:!0,enumerable:!0,value:B,writable:!0};Object.defineProperties(console,{info:i,log:i,warn:i,error:i,group:i,groupCollapsed:i,groupEnd:i})}ge++}}function U(){{if(ge--,ge===0){var i={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:le({},i,{value:re}),info:le({},i,{value:k}),warn:le({},i,{value:X}),error:le({},i,{value:N}),group:le({},i,{value:F}),groupCollapsed:le({},i,{value:R}),groupEnd:le({},i,{value:L})})}ge<0&&D("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var oe=y.ReactCurrentDispatcher,ke;function Pe(i,C,j){{if(ke===void 0)try{throw Error()}catch(ae){var I=ae.stack.trim().match(/\n( *(at )?)/);ke=I&&I[1]||""}return`
`+ke+i}}var je=!1,pe;{var Fe=typeof WeakMap=="function"?WeakMap:Map;pe=new Fe}function De(i,C){if(!i||je)return"";{var j=pe.get(i);if(j!==void 0)return j}var I;je=!0;var ae=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var he;he=oe.current,oe.current=null,ie();try{if(C){var ne=function(){throw Error()};if(Object.defineProperty(ne.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ne,[])}catch(Ie){I=Ie}Reflect.construct(i,[],ne)}else{try{ne.call()}catch(Ie){I=Ie}i.call(ne.prototype)}}else{try{throw Error()}catch(Ie){I=Ie}i()}}catch(Ie){if(Ie&&I&&typeof Ie.stack=="string"){for(var q=Ie.stack.split(`
`),Re=I.stack.split(`
`),xe=q.length-1,we=Re.length-1;xe>=1&&we>=0&&q[xe]!==Re[we];)we--;for(;xe>=1&&we>=0;xe--,we--)if(q[xe]!==Re[we]){if(xe!==1||we!==1)do if(xe--,we--,we<0||q[xe]!==Re[we]){var Ke=`
`+q[xe].replace(" at new "," at ");return i.displayName&&Ke.includes("<anonymous>")&&(Ke=Ke.replace("<anonymous>",i.displayName)),typeof i=="function"&&pe.set(i,Ke),Ke}while(xe>=1&&we>=0);break}}}finally{je=!1,oe.current=he,U(),Error.prepareStackTrace=ae}var St=i?i.displayName||i.name:"",pt=St?Pe(St):"";return typeof i=="function"&&pe.set(i,pt),pt}function Qe(i,C,j){return De(i,!1)}function We(i){var C=i.prototype;return!!(C&&C.isReactComponent)}function b(i,C,j){if(i==null)return"";if(typeof i=="function")return De(i,We(i));if(typeof i=="string")return Pe(i);switch(i){case h:return Pe("Suspense");case f:return Pe("SuspenseList")}if(typeof i=="object")switch(i.$$typeof){case c:return Qe(i.render);case a:return b(i.type,C,j);case g:{var I=i,ae=I._payload,he=I._init;try{return b(he(ae),C,j)}catch{}}}return""}var $=Object.prototype.hasOwnProperty,J={},K=y.ReactDebugCurrentFrame;function S(i){if(i){var C=i._owner,j=b(i.type,i._source,C?C.type:null);K.setExtraStackFrame(j)}else K.setExtraStackFrame(null)}function z(i,C,j,I,ae){{var he=Function.call.bind($);for(var ne in i)if(he(i,ne)){var q=void 0;try{if(typeof i[ne]!="function"){var Re=Error((I||"React class")+": "+j+" type `"+ne+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[ne]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Re.name="Invariant Violation",Re}q=i[ne](C,ne,I,j,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(xe){q=xe}q&&!(q instanceof Error)&&(S(ae),D("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",I||"React class",j,ne,typeof q),S(null)),q instanceof Error&&!(q.message in J)&&(J[q.message]=!0,S(ae),D("Failed %s type: %s",j,q.message),S(null))}}}var te=Array.isArray;function ce(i){return te(i)}function ye(i){{var C=typeof Symbol=="function"&&Symbol.toStringTag,j=C&&i[Symbol.toStringTag]||i.constructor.name||"Object";return j}}function be(i){try{return ve(i),!1}catch{return!0}}function ve(i){return""+i}function de(i){if(be(i))return D("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ye(i)),ve(i)}var Se=y.ReactCurrentOwner,Ce={key:!0,ref:!0,__self:!0,__source:!0},Be,Me;function Ne(i){if($.call(i,"ref")){var C=Object.getOwnPropertyDescriptor(i,"ref").get;if(C&&C.isReactWarning)return!1}return i.ref!==void 0}function ot(i){if($.call(i,"key")){var C=Object.getOwnPropertyDescriptor(i,"key").get;if(C&&C.isReactWarning)return!1}return i.key!==void 0}function Ye(i,C){typeof i.ref=="string"&&Se.current}function Ue(i,C){{var j=function(){Be||(Be=!0,D("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",C))};j.isReactWarning=!0,Object.defineProperty(i,"key",{get:j,configurable:!0})}}function dt(i,C){{var j=function(){Me||(Me=!0,D("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",C))};j.isReactWarning=!0,Object.defineProperty(i,"ref",{get:j,configurable:!0})}}var Ct=function(i,C,j,I,ae,he,ne){var q={$$typeof:t,type:i,key:C,ref:j,props:ne,_owner:he};return q._store={},Object.defineProperty(q._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(q,"_self",{configurable:!1,enumerable:!1,writable:!1,value:I}),Object.defineProperty(q,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ae}),Object.freeze&&(Object.freeze(q.props),Object.freeze(q)),q};function wt(i,C,j,I,ae){{var he,ne={},q=null,Re=null;j!==void 0&&(de(j),q=""+j),ot(C)&&(de(C.key),q=""+C.key),Ne(C)&&(Re=C.ref,Ye(C,ae));for(he in C)$.call(C,he)&&!Ce.hasOwnProperty(he)&&(ne[he]=C[he]);if(i&&i.defaultProps){var xe=i.defaultProps;for(he in xe)ne[he]===void 0&&(ne[he]=xe[he])}if(q||Re){var we=typeof i=="function"?i.displayName||i.name||"Unknown":i;q&&Ue(ne,we),Re&&dt(ne,we)}return Ct(i,q,Re,ae,I,Se.current,ne)}}var at=y.ReactCurrentOwner,Dt=y.ReactDebugCurrentFrame;function Ze(i){if(i){var C=i._owner,j=b(i.type,i._source,C?C.type:null);Dt.setExtraStackFrame(j)}else Dt.setExtraStackFrame(null)}var ft;ft=!1;function me(i){return typeof i=="object"&&i!==null&&i.$$typeof===t}function P(){{if(at.current){var i=G(at.current.type);if(i)return`
Check the render method of \``+i+"`."}return""}}function W(i){return""}var H={};function Y(i){{var C=P();if(!C){var j=typeof i=="string"?i:i.displayName||i.name;j&&(C=`
Check the top-level render call using <`+j+">.")}return C}}function Ee(i,C){{if(!i._store||i._store.validated||i.key!=null)return;i._store.validated=!0;var j=Y(C);if(H[j])return;H[j]=!0;var I="";i&&i._owner&&i._owner!==at.current&&(I=" It was passed a child from "+G(i._owner.type)+"."),Ze(i),D('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',j,I),Ze(null)}}function Ve(i,C){{if(typeof i!="object")return;if(ce(i))for(var j=0;j<i.length;j++){var I=i[j];me(I)&&Ee(I,C)}else if(me(i))i._store&&(i._store.validated=!0);else if(i){var ae=T(i);if(typeof ae=="function"&&ae!==i.entries)for(var he=ae.call(i),ne;!(ne=he.next()).done;)me(ne.value)&&Ee(ne.value,C)}}}function lt(i){{var C=i.type;if(C==null||typeof C=="string")return;var j;if(typeof C=="function")j=C.propTypes;else if(typeof C=="object"&&(C.$$typeof===c||C.$$typeof===a))j=C.propTypes;else return;if(j){var I=G(C);z(j,i.props,"prop",I,i)}else if(C.PropTypes!==void 0&&!ft){ft=!0;var ae=G(C);D("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ae||"Unknown")}typeof C.getDefaultProps=="function"&&!C.getDefaultProps.isReactClassApproved&&D("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Te(i){{for(var C=Object.keys(i.props),j=0;j<C.length;j++){var I=C[j];if(I!=="children"&&I!=="key"){Ze(i),D("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",I),Ze(null);break}}i.ref!==null&&(Ze(i),D("Invalid attribute `ref` supplied to `React.Fragment`."),Ze(null))}}var Je={};function ze(i,C,j,I,ae,he){{var ne=se(i);if(!ne){var q="";(i===void 0||typeof i=="object"&&i!==null&&Object.keys(i).length===0)&&(q+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Re=W();Re?q+=Re:q+=P();var xe;i===null?xe="null":ce(i)?xe="array":i!==void 0&&i.$$typeof===t?(xe="<"+(G(i.type)||"Unknown")+" />",q=" Did you accidentally export a JSX literal instead of a component?"):xe=typeof i,D("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",xe,q)}var we=wt(i,C,j,ae,he);if(we==null)return we;if(ne){var Ke=C.children;if(Ke!==void 0)if(I)if(ce(Ke)){for(var St=0;St<Ke.length;St++)Ve(Ke[St],i);Object.freeze&&Object.freeze(Ke)}else D("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ve(Ke,i)}if($.call(C,"key")){var pt=G(i),Ie=Object.keys(C).filter(function(Us){return Us!=="key"}),wn=Ie.length>0?"{key: someKey, "+Ie.join(": ..., ")+": ...}":"{key: someKey}";if(!Je[pt+wn]){var Xs=Ie.length>0?"{"+Ie.join(": ..., ")+": ...}":"{}";D(`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`,wn,pt,Xs,pt),Je[pt+wn]=!0}}return i===r?Te(we):lt(we),we}}function qe(i,C,j){return ze(i,C,j,!0)}function ht(i,C,j){return ze(i,C,j,!1)}var gt=ht,et=qe;_t.Fragment=r,_t.jsx=gt,_t.jsxs=et})()),_t}var En;function Nr(){return En||(En=1,process.env.NODE_ENV==="production"?$t.exports=Fr():$t.exports=Mr()),$t.exports}var p=Nr(),V=(e=>(e.Hour="Hour",e.HalfHour="Half Hour",e.QuarterDay="Quarter Day",e.HalfDay="Half Day",e.Day="Day",e.Week="Week",e.Month="Month",e.QuarterYear="QuarterYear",e.Year="Year",e))(V||{});const Lr=(e,t,n,r,o,s,l,u,c,h,f,a,g,v,w=!1,m)=>{let y=Tn(e,w,m).map((D,O)=>kr(D,O,t,n,r,o,s,l,u,c,h,f,a,g,v));return y=y.map(D=>{const O=D.dependencies||[];for(let E=0;E<O.length;E++){const x=y.findIndex(M=>M.id===O[E]);x!==-1&&y[x].barChildren.push(D)}return D}),y};function Tn(e,t=!1,n){const r=[];return e.forEach(o=>{let s={...o};if(!o.start||!o.end)if(n&&n[0]&&n[1])s.start=n[0],s.end=n[1];else return;if(r.push(s),o.children&&o.children.length>0&&o.hideChildren!==!0&&t){const l=Tn(o.children,t,n);r.push(...l)}}),r}const kr=(e,t,n,r,o,s,l,u,c,h,f,a,g,v,w)=>{let m;switch(e.type){case"milestone":m=Ar(e,t,n,r,o,s,l,u,v,w);break;default:m=Pr(e,t,n,r,o,s,l,u,c,h,f,a,g);break}return m},Pr=(e,t,n,r,o,s,l,u,c,h,f,a,g)=>{let v,w;c?(w=_n(e.start,n,r),v=_n(e.end,n,r)):(v=Wt(e.start,n,r),w=Wt(e.end,n,r));let m=e.type;m==="task"&&w-v<u*2&&(m="smalltask",w=v+u*2);const[T,y]=Rr(v,w,e.progress||0,c),D=On(t,o,s),O=e.hideChildren,E={backgroundColor:a,backgroundSelectedColor:g,progressColor:h,progressSelectedColor:f,...e.styles};return{...e,typeInternal:m,x1:v,x2:w,y:D,index:t,progressX:y,progressWidth:T,barCornerRadius:l,handleWidth:u,hideChildren:O,height:s,barChildren:[],styles:E}},Ar=(e,t,n,r,o,s,l,u,c,h)=>{const f=Wt(e.start,n,r),a=On(t,o,s),g=f-s*.5,v=f+s*.5,w=s/1.414,m={backgroundColor:c,backgroundSelectedColor:h,progressColor:"",progressSelectedColor:"",...e.styles};return{...e,end:e.start,x1:g,x2:v,y:a,index:t,progressX:0,progressWidth:0,barCornerRadius:l,handleWidth:u,typeInternal:e.type,progress:0,height:w,hideChildren:void 0,barChildren:[],styles:m}},Wt=(e,t,n)=>{const r=t.findIndex(h=>h>=e);if(r===-1){const h=t.length-1,f=t[h],a=e-f,g=h>0?t[h]-t[h-1]:1800*1e3,v=g>0?a/g:0;return h*n+v*n}const o=Math.max(0,r-1),s=e-t[o],l=t[o+1]-t[o],u=l>0?s/l:0;return o*n+u*n},_n=(e,t,n)=>{let r=Wt(e,t,n);return r+=n,r},On=(e,t,n)=>e*t+(t-n)/2,Rr=(e,t,n,r)=>{const o=(t-e)*n*.01;let s;return r?s=t-o:s=e,[o,s]},jn=(e,t,n)=>[e-5,t+n,e+5,t+n,e,t+n-8.66].join(","),Fn=e=>{if(!e||e.length<=1)return!1;const t=[...e].sort((n,r)=>n.start-r.start);for(let n=0;n<t.length-1;n++){const r=t[n],o=t[n+1];if(r.end>o.start)return!0}for(let n=0;n<t.length;n++)for(let r=n+1;r<t.length;r++){const o=t[n],s=t[r],l=o.start,u=o.end,c=s.start,h=s.end;if(l<h&&u>c)return!0}return!1};function $r(e){return e.key!==void 0}const Wr=e=>{switch(e){case V.Hour:return 3600*1e3;case V.HalfHour:return 1800*1e3;case V.QuarterDay:return 360*60*1e3;case V.HalfDay:return 720*60*1e3;case V.Day:return 1440*60*1e3;case V.Week:return 10080*60*1e3;case V.Month:return 720*60*60*1e3;case V.QuarterYear:return 2160*60*60*1e3;case V.Year:return 365*24*60*60*1e3;default:return 1440*60*1e3}},Mn={},Ot=(e,t={})=>{const n=JSON.stringify([e,t]);let r=Mn[n];return r||(r=new Intl.DateTimeFormat(e,t),Mn[n]=r),r},ue=(e,t,n)=>{const r=new Date(e);return new Date(r.getFullYear()+(n==="year"?t:0),r.getMonth()+(n==="month"?t:0),r.getDate()+(n==="day"?t:0),r.getHours()+(n==="hour"?t:0),r.getMinutes()+(n==="minute"?t:0),r.getSeconds()+(n==="second"?t:0),r.getMilliseconds()+(n==="millisecond"?t:0)).getTime()},_e=(e,t)=>{const n=new Date(e),r=["millisecond","second","minute","hour","day","month","year"],o=l=>{const u=r.indexOf(t);return r.indexOf(l)<=u};return new Date(n.getFullYear(),o("year")?0:n.getMonth(),o("month")?1:n.getDate(),o("day")?0:n.getHours(),o("hour")?0:n.getMinutes(),o("minute")?0:n.getSeconds(),o("second")?0:n.getMilliseconds()).getTime()},Nn=(e,t,n,r)=>{let o,s;if(r&&r[0]&&r[1])[o,s]=r;else{o=e[0].start,s=e[0].start;for(const l of e)l.start<o&&(o=l.start),l.end>s&&(s=l.end)}switch(t){case V.Year:o=ue(o,-1,"year"),o=_e(o,"year"),s=ue(s,1,"year"),s=_e(s,"year");break;case V.QuarterYear:o=ue(o,-3,"month"),o=_e(o,"month"),s=ue(s,3,"year"),s=_e(s,"year");break;case V.Month:o=ue(o,-1*n,"month"),o=_e(o,"month"),s=ue(s,1,"year"),s=_e(s,"year");break;case V.Week:o=_e(o,"day"),o=ue(Ir(o),-7*n,"day"),s=_e(s,"day"),s=ue(s,1.5,"month");break;case V.Day:o=_e(o,"day"),o=ue(o,-1*n,"day"),s=_e(s,"day"),s=ue(s,19,"day");break;case V.QuarterDay:o=_e(o,"day"),o=ue(o,-1*n,"day"),s=_e(s,"day"),s=ue(s,66,"hour");break;case V.HalfDay:o=_e(o,"day"),o=ue(o,-1*n,"day"),s=_e(s,"day"),s=ue(s,108,"hour");break;case V.HalfHour:o=_e(o,"hour"),o=ue(o,-1*n,"hour"),s=_e(s,"day"),s=ue(s,1,"day");break;case V.Hour:o=_e(o,"hour"),o=ue(o,-1*n,"hour"),s=_e(s,"day"),s=ue(s,1,"day");break}return[o,s]},Ln=(e,t,n)=>{let r=e;const o=[r];for(;r<t;){switch(n){case V.Year:r=ue(r,1,"year");break;case V.QuarterYear:r=ue(r,3,"month");break;case V.Month:r=ue(r,1,"month");break;case V.Week:r=ue(r,7,"day");break;case V.Day:r=ue(r,1,"day");break;case V.HalfDay:r=ue(r,12,"hour");break;case V.QuarterDay:r=ue(r,6,"hour");break;case V.HalfHour:r=ue(r,30,"minute");break;case V.Hour:r=ue(r,1,"hour");break}o.push(r)}return o},Qt=(e,t)=>{const n=new Date(e);let r=Ot(t,{month:"long"}).format(n);return r=r.replace(r[0],r[0].toLocaleUpperCase()),r},Br=(e,t,n)=>{const r=new Date(e);let o=Ot(t,{weekday:n}).format(r);return o=o.replace(o[0],o[0].toLocaleUpperCase()),o},Ir=e=>{const t=new Date(e),n=t.getDay(),r=t.getDate()-n+(n===0?-6:1),o=new Date(t);return o.setDate(r),o.getTime()},Hr=e=>{const t=new Date(e),n=(t.getDay()+6)%7;t.setDate(t.getDate()-n+3);const r=t.valueOf();t.setMonth(0,1),t.getDay()!==4&&t.setMonth(0,1+(4-t.getDay()+7)%7);const o=(1+Math.ceil((r-t.valueOf())/6048e5)).toString();return o.length===1?`0${o}`:o},Yr=(e,t)=>new Date(t,e+1,0).getDate(),kn=d.createContext(void 0),Vr=({children:e,value:t})=>p.jsx(kn.Provider,{value:t,children:e}),vt=()=>{const e=d.useContext(kn);if(e===void 0)throw new Error("useGanttContext 必须在 GanttProvider 内部使用");return e},Pn=()=>{const{readonly:e=!1}=vt();return e},Bt={gridRow:"_gridRow_efa8v_3",gridTick:"_gridTick_efa8v_15",gridRowOverlap:"_gridRowOverlap_efa8v_19"},zr=({tasks:e,dates:t,svgWidth:n,rowHeight:r,columnWidth:o,todayColor:s,rtl:l})=>{const{styling:u,display:c}=vt(),{rowHeight:h,columnWidth:f,todayColor:a}=u,{rtl:g}=c,v=r||h,w=o||f,m=s||a,T=l??g;let y=0;const D=[];for(const _ of e){const A=_.children&&_.children.length>0?Fn(_.children):!1;D.push(p.jsx("rect",{x:"0",y,width:n,height:v,className:A?`${Bt.gridRow} ${Bt.gridRowOverlap} `:Bt.gridRow},"Row"+_.id)),y+=v}const O=Date.now();let E=0;const x=[];let M=p.jsx("rect",{});for(let _=0;_<t.length;_++){const A=t[_];x.push(p.jsx("line",{x1:E,y1:0,x2:E,y2:y,className:Bt.gridTick},A)),(_+1!==t.length&&A<O&&t[_+1]>=O||_!==0&&_+1===t.length&&A<O&&ue(A,A-t[_-1],"millisecond")>=O)&&(M=p.jsx("rect",{x:E,y:0,width:w,height:y,fill:m})),T&&_+1!==t.length&&A>=O&&t[_+1]<O&&(M=p.jsx("rect",{x:E+w,y:0,width:w,height:y,fill:m})),E+=w}return p.jsxs("g",{className:"gridBody",children:[p.jsx("g",{className:"rows",children:D}),p.jsx("g",{className:"ticks",children:x}),p.jsx("g",{className:"today",children:M})]})},Xr=e=>p.jsx("g",{className:"grid",children:p.jsx(zr,{...e})}),Zt={ganttTable:"_ganttTable_1fj80_3",ganttTable_Header:"_ganttTable_Header_1fj80_19",ganttTable_HeaderItem:"_ganttTable_HeaderItem_1fj80_30"},An=({headerHeight:e,fontFamily:t,fontSize:n,rowWidth:r,columns:o})=>{const s=o?.filter(l=>l.visible!==!1);return p.jsx("div",{className:Zt.ganttTable,style:{fontFamily:t,fontSize:n},children:p.jsx("div",{className:Zt.ganttTable_Header,style:{height:e-2},children:s?.map(l=>p.jsx("div",{className:Zt.ganttTable_HeaderItem,style:{minWidth:l.width||r,maxWidth:l.width||r,textAlign:l.align||"left"},children:l.title},l.key))})})},st={taskListWrapper:"_taskListWrapper_68p4i_3",taskListTableRow:"_taskListTableRow_68p4i_12",selectedRow:"_selectedRow_68p4i_27",taskListCell:"_taskListCell_68p4i_32",taskListNameWrapper:"_taskListNameWrapper_68p4i_42",taskListExpander:"_taskListExpander_68p4i_47",taskListEmptyExpander:"_taskListEmptyExpander_68p4i_54",taskListRowOverlap:"_taskListRowOverlap_68p4i_61"},Rn={},Ur=e=>(t,n)=>{const r=t.toString();let o=Rn[r];return o||(o=t.toLocaleDateString(e,n),Rn[r]=o),o},$n={weekday:"short",year:"numeric",month:"long",day:"numeric"},Wn=({rowHeight:e,rowWidth:t,tasks:n,fontFamily:r,fontSize:o,locale:s,selectedTaskId:l,setSelectedTask:u,onExpanderClick:c,showSubTask:h=!1,columns:f=[]})=>{const a=d.useMemo(()=>Ur(s),[s]),g=(m,T=0)=>{let y="";h&&(m.hideChildren===!1?y="▼":m.hideChildren===!0&&(y="▶"));const D=T*20,O=l===m.id,E=m.children&&m.children.length>0?Fn(m.children):!1,x=f.filter(M=>M.visible!==!1);return p.jsx("div",{className:`${st.taskListTableRow} ${O?st.selectedRow:""} ${E?st.taskListRowOverlap:""}`,style:{height:e},onClick:()=>u(m.id),children:x.map(M=>p.jsx("div",{className:st.taskListCell,style:{minWidth:M.width||t,maxWidth:M.width||t,textAlign:M.align||"left"},title:M.key==="name"?m.name:void 0,children:M.key==="name"?p.jsxs("div",{className:st.taskListNameWrapper,children:[p.jsx("div",{className:y?st.taskListExpander:st.taskListEmptyExpander,onClick:_=>{_.stopPropagation(),c(m)},style:{marginLeft:`${D}px`},children:y}),p.jsx("div",{children:m.name})]}):p.jsxs("div",{children:[" ",M.render?M.render(m,s):v(m,M.key)]})},M.key))},`${m.id}row`)},v=(m,T)=>{switch(T){case"start":return a(new Date(m.start),$n);case"end":return a(new Date(m.end),$n);case"progress":return m.progress?`${m.progress}%`:"0%";case"type":return m.type||"task";default:return""}},w=(m,T=0)=>{const y=[];return m.forEach(D=>{if(y.push(g(D,T)),D.children&&D.children.length>0&&D.hideChildren!==!0&&h){const O=w(D.children,T+1);y.push(...O)}}),y};return p.jsx("div",{className:st.taskListWrapper,style:{fontFamily:r,fontSize:o},children:w(n)})},jt={tooltipDefaultContainer:"_tooltipDefaultContainer_14a42_1",tooltipDefaultContainerParagraph:"_tooltipDefaultContainerParagraph_14a42_10",tooltipDetailsContainer:"_tooltipDetailsContainer_14a42_16",tooltipDetailsContainerHidden:"_tooltipDetailsContainerHidden_14a42_29"},Kr=({task:e,rowHeight:t,rtl:n,svgContainerHeight:r,svgContainerWidth:o,scrollX:s,scrollY:l,arrowIndent:u,fontSize:c,fontFamily:h,headerHeight:f,taskListWidth:a,TooltipContent:g})=>{const v=d.useRef(null),[w,m]=d.useState(0),[T,y]=d.useState(0);return d.useEffect(()=>{if(v.current){const D=v.current.offsetHeight*1.1,O=v.current.offsetWidth*1.1;let E=e.y-l+f,x;if(n)x=e.x1-u*1.5-O-s+a,x<a&&(x=e.x2+u*1.5-s+a),O+x>a+o&&(x=a+o-O,E+=t);else{x=e.x2+u*1.5+a-s;const _=O+x,A=a+o;_>A&&(x=e.x1+a-u*1.5-s-O),x<a&&(x=a+o-O,E+=t)}D+E-l>r-l&&(E=r-D),m(E),y(x)}},[v,e,u,s,l,f,a,t,r,o,n]),p.jsx("div",{ref:v,className:T?jt.tooltipDetailsContainer:jt.tooltipDetailsContainerHidden,style:{left:T,top:w},children:p.jsx(Gr,{task:e,fontSize:c,fontFamily:h,TooltipContent:g})})},Gr=({task:e,fontSize:t,fontFamily:n,TooltipContent:r})=>{const o={fontSize:t,fontFamily:n};return p.jsxs("div",{className:jt.tooltipDefaultContainer,style:o,children:[p.jsx("b",{style:{fontSize:t+6},children:e.name}),r?p.jsx(r,{task:e,fontSize:t,fontFamily:n}):p.jsxs(p.Fragment,{children:[e.end-e.start!==0&&p.jsx("p",{className:jt.tooltipDefaultContainerParagraph,children:`Duration: ${~~((e.end-e.start)/(1e3*60*60*24))} day(s)`}),p.jsx("p",{className:jt.tooltipDefaultContainerParagraph,children:!!e.progress&&`Progress: ${e.progress} %`})]})]})},Jr={scroll:"_scroll_1xhh3_1"},qr=({scroll:e,ganttHeight:t,ganttFullHeight:n,headerHeight:r,rtl:o,onScroll:s})=>{const l=d.useRef(null);return d.useEffect(()=>{l.current&&(l.current.scrollTop=e)},[e]),p.jsx("div",{style:{height:t,marginTop:r,marginLeft:o?"":"-1rem"},className:Jr.scroll,onScroll:s,ref:l,children:p.jsx("div",{style:{height:n,width:1}})})},Qr=({scrollY:e,selectedTask:t,setSelectedTask:n,onExpanderClick:r,taskListRef:o,horizontalContainerClass:s})=>{const{styling:l,display:u,tasks:c,TaskListHeader:h=An,TaskListTable:f=Wn}=vt(),{columns:a}=l,{headerHeight:g,fontFamily:v,fontSize:w,listCellWidth:m,rowHeight:T,ganttHeight:y,showSubTask:D}=l,{locale:O}=u,E=d.useRef(null);d.useEffect(()=>{E.current&&(E.current.scrollTop=e)},[e]);const x={headerHeight:g,fontFamily:v,fontSize:w,rowWidth:m,columns:a},M=t?t.id:"",_={rowHeight:T,rowWidth:m,fontFamily:v,fontSize:w,tasks:c,locale:O,selectedTaskId:M,setSelectedTask:n,onExpanderClick:r,showSubTask:D,columns:a};return p.jsx("div",{ref:o,children:p.jsx("div",{ref:E,className:s,style:y?{height:y+50}:{},children:p.jsxs("div",{className:"task-list-table-container",children:[p.jsx(h,{...x}),p.jsx(f,{..._})]})})})},He={calendarBottomText:"_calendarBottomText_f5e8p_3",calendarTopTick:"_calendarTopTick_f5e8p_14",calendarTopText:"_calendarTopText_f5e8p_18",calendarHeader:"_calendarHeader_f5e8p_30",calendarContainer:"_calendarContainer_f5e8p_36"},ct=({value:e,x1Line:t,y1Line:n,y2Line:r,xText:o,yText:s})=>p.jsxs("g",{className:"calendarTop",children:[p.jsx("line",{x1:t,y1:n,x2:t,y2:r,className:He.calendarTopTick},e+"line"),p.jsx("text",{y:s,x:o,className:He.calendarTopText,children:e},e+"text")]}),Zr=({dateSetup:e,locale:t,viewMode:n,rtl:r,headerHeight:o,columnWidth:s,fontFamily:l,fontSize:u})=>{const{styling:c,display:h}=vt(),{headerHeight:f,columnWidth:a,fontFamily:g,fontSize:v}=c,{locale:w,viewMode:m,rtl:T}=h,y=t||w,D=n||m,O=r??T,E=o||f,x=s||a,M=l||g,_=u||v,A=()=>{const k=[],X=[],N=E*.5;for(let F=0;F<e.dates.length;F++){const R=e.dates[F],L=new Date(R),B=L.getFullYear();if(X.push(p.jsx("text",{y:E*.8,x:x*F+x*.5,className:He.calendarBottomText,children:B},R)),F===0||L.getFullYear()!==new Date(e.dates[F-1]).getFullYear()){const ie=L.getFullYear().toString();let U;O?U=(6+F+L.getFullYear()+1)*x:U=(6+F-L.getFullYear())*x,k.push(p.jsx(ct,{value:ie,x1Line:x*F,y1Line:0,y2Line:E,xText:U,yText:N*.9},ie))}}return[k,X]},Q=()=>{const k=[],X=[],N=E*.5;for(let F=0;F<e.dates.length;F++){const R=e.dates[F],L=new Date(R),B="Q"+Math.floor((L.getMonth()+3)/3);if(X.push(p.jsx("text",{y:E*.8,x:x*F+x*.5,className:He.calendarBottomText,children:B},R)),F===0||L.getFullYear()!==new Date(e.dates[F-1]).getFullYear()){const ie=L.getFullYear().toString();let U;O?U=(6+F+L.getMonth()+1)*x:U=(6+F-L.getMonth())*x,k.push(p.jsx(ct,{value:ie,x1Line:x*F,y1Line:0,y2Line:N,xText:Math.abs(U),yText:N*.9},ie))}}return[k,X]},se=()=>{const k=[],X=[],N=E*.5;for(let F=0;F<e.dates.length;F++){const R=e.dates[F],L=new Date(R),B=Qt(R,y);if(X.push(p.jsx("text",{y:E*.8,x:x*F+x*.5,className:He.calendarBottomText,children:B},B+L.getFullYear())),F===0||L.getFullYear()!==new Date(e.dates[F-1]).getFullYear()){const ie=L.getFullYear().toString();let U;O?U=(6+F+L.getMonth()+1)*x:U=(6+F-L.getMonth())*x,k.push(p.jsx(ct,{value:ie,x1Line:x*F,y1Line:0,y2Line:N,xText:U,yText:N*.9},ie))}}return[k,X]},ee=()=>{const k=[],X=[];let N=1;const F=E*.5,R=e.dates;for(let L=R.length-1;L>=0;L--){const B=R[L],ie=new Date(B);let U="";(L===0||ie.getMonth()!==new Date(R[L-1]).getMonth())&&(U=`${Qt(B,y)}, ${ie.getFullYear()}`);const oe=`W${Hr(B)}`;X.push(p.jsx("text",{y:E*.8,x:x*(L+ +O),className:He.calendarBottomText,children:oe},B)),U&&(L!==R.length-1&&k.push(p.jsx(ct,{value:U,x1Line:x*L+N*x,y1Line:0,y2Line:F,xText:x*L+x*N*.5,yText:F*.9},U)),N=0),N++}return[k,X]},Z=()=>{const k=[],X=[],N=E*.5,F=e.dates;for(let R=0;R<F.length;R++){const L=F[R],B=new Date(L),ie=`${Br(L,y,"short")}, ${B.getDate().toString()}`;if(X.push(p.jsx("text",{y:E*.8,x:x*R+x*.5,className:He.calendarBottomText,children:ie},L)),R+1!==F.length&&B.getMonth()!==new Date(F[R+1]).getMonth()){const U=Qt(L,y);k.push(p.jsx(ct,{value:U,x1Line:x*(R+1),y1Line:0,y2Line:N,xText:x*(R+1)-Yr(B.getMonth(),B.getFullYear())*x*.5,yText:N*.9},U+B.getFullYear()))}}return[k,X]},G=()=>{const k=[],X=[],N=E*.5,F=e.dates;for(let R=0;R<F.length;R++){const L=F[R],B=new Date(L),ie=D===V.HalfHour?Ot(y,{hour:"numeric",minute:"2-digit",hour12:!1}).format(B):Ot(y,{hour:"numeric"}).format(B),U=O?x*(R+1)-25:x*R+25;if(X.push(p.jsx("text",{y:N+N*.7,x:U,className:He.calendarBottomText,fontFamily:M,children:ie},L)),R===0||B.getDate()!==new Date(F[R-1]).getDate()){const oe=`${B.getFullYear()}-${(B.getMonth()+1).toString().padStart(2,"0")}-${B.getDate().toString().padStart(2,"0")}`,ke=x*R+50;k.push(p.jsx(ct,{value:oe,x1Line:x*R,y1Line:0,y2Line:N,xText:ke,yText:N*.7},oe+B.getFullYear()))}}return[k,X]},le=()=>{const k=[],X=[],N=E*.5,F=e.dates;for(let R=0;R<F.length;R++){const L=F[R],B=new Date(L),ie=Ot(y,{hour:"numeric",minute:"2-digit",hour12:!1}).format(B),U=O?x*(R+1)-25:x*R+25;if(X.push(p.jsx("text",{y:N+N*.7,x:U,className:He.calendarBottomText,fontFamily:M,children:ie},L)),R===0||B.getDate()!==new Date(F[R-1]).getDate()){const oe=`${B.getFullYear()}-${(B.getMonth()+1).toString().padStart(2,"0")}-${B.getDate().toString().padStart(2,"0")}`,ke=x*R+50;k.push(p.jsx(ct,{value:oe,x1Line:x*R,y1Line:0,y2Line:N,xText:ke,yText:N*.6},oe+B.getFullYear()))}}return[k,X]};let ge=[],re=[];switch(e.viewMode){case V.Year:[ge,re]=A();break;case V.QuarterYear:[ge,re]=Q();break;case V.Month:[ge,re]=se();break;case V.Week:[ge,re]=ee();break;case V.Day:[ge,re]=Z();break;case V.QuarterDay:case V.HalfDay:case V.HalfHour:[ge,re]=G();break;case V.Hour:[ge,re]=le();break}return p.jsxs("g",{className:`calendar ${He.calendarContainer}`,fontSize:_,fontFamily:M,children:[p.jsx("rect",{x:0,y:0,width:x*e.dates.length,height:E,className:He.calendarHeader}),e.dates.map((k,X)=>p.jsx("line",{x1:x*X,y1:E*.5,x2:x*X,y2:E,className:He.calendarTopTick},`separator-${X}`)),p.jsx("line",{x1:0,y1:E*.5,x2:x*e.dates.length,y2:E*.5,className:He.calendarTopTick}),re," ",ge]})},eo=({taskFrom:e,taskTo:t,rowHeight:n,taskHeight:r,arrowIndent:o,rtl:s})=>{let l,u;return s?[l,u]=no(e,t,n,r,o):[l,u]=to(e,t,n,r,o),p.jsxs("g",{className:"arrow",children:[p.jsx("path",{strokeWidth:"1.5",d:l,fill:"none"}),p.jsx("polygon",{points:u})]})},to=(e,t,n,r,o)=>{const s=e.index>t.index?-1:1,l=t.y+r/2,u=e.x2+o*2,c=u<t.x1?"":`H ${t.x1-o}`,h=u>t.x1?o:t.x1-e.x2-o,f=`M ${e.x2} ${e.y+r/2}
h ${o}
v ${s*n/2}
${c}
V ${l}
h ${h}`,a=`${t.x1},${l}
${t.x1-5},${l-5}
${t.x1-5},${l+5}`;return[f,a]},no=(e,t,n,r,o)=>{const s=e.index>t.index?-1:1,l=t.y+r/2,u=e.x1-o*2,c=u>t.x2?"":`H ${t.x2+o}`,h=u<t.x2?-o:t.x2-e.x1+o,f=`M ${e.x1} ${e.y+r/2}
h ${-o}
v ${s*n/2}
${c}
V ${l}
h ${h}`,a=`${t.x2},${l}
${t.x2+5},${l+5}
${t.x2+5},${l-5}`;return[f,a]},It=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function yt(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function en(e){return"nodeType"in e}function Ae(e){var t,n;return e?yt(e)?e:en(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function tn(e){const{Document:t}=Ae(e);return e instanceof t}function Ft(e){return yt(e)?!1:e instanceof Ae(e).HTMLElement}function Bn(e){return e instanceof Ae(e).SVGElement}function mt(e){return e?yt(e)?e.document:en(e)?tn(e)?e:Ft(e)||Bn(e)?e.ownerDocument:document:document:document}const nt=It?d.useLayoutEffect:d.useEffect;function Ht(e){const t=d.useRef(e);return nt(()=>{t.current=e}),d.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function ro(){const e=d.useRef(null),t=d.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=d.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function nn(e,t){t===void 0&&(t=[e]);const n=d.useRef(e);return nt(()=>{n.current!==e&&(n.current=e)},t),n}function Mt(e,t){const n=d.useRef();return d.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function rn(e){const t=Ht(e),n=d.useRef(null),r=d.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function Yt(e){const t=d.useRef();return d.useEffect(()=>{t.current=e},[e]),t.current}let on={};function sn(e,t){return d.useMemo(()=>{if(t)return t;const n=on[e]==null?0:on[e]+1;return on[e]=n,e+"-"+n},[e,t])}function In(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((s,l)=>{const u=Object.entries(l);for(const[c,h]of u){const f=s[c];f!=null&&(s[c]=f+e*h)}return s},{...t})}}const bt=In(1),Vt=In(-1);function oo(e){return"clientX"in e&&"clientY"in e}function an(e){if(!e)return!1;const{KeyboardEvent:t}=Ae(e.target);return t&&e instanceof t}function so(e){if(!e)return!1;const{TouchEvent:t}=Ae(e.target);return t&&e instanceof t}function zt(e){if(so(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return oo(e)?{x:e.clientX,y:e.clientY}:null}const Nt=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Nt.Translate.toString(e),Nt.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Hn="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function io(e){return e.matches(Hn)?e:e.querySelector(Hn)}const ao={display:"none"};function lo(e){let{id:t,value:n}=e;return d.createElement("div",{id:t,style:ao},n)}function co(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return d.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function uo(){const[e,t]=d.useState("");return{announce:d.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Yn=d.createContext(null);function fo(e){const t=d.useContext(Yn);d.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function ho(){const[e]=d.useState(()=>new Set),t=d.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[d.useCallback(r=>{let{type:o,event:s}=r;e.forEach(l=>{var u;return(u=l[o])==null?void 0:u.call(l,s)})},[e]),t]}const go={draggable:`
To pick up a draggable item, press the space bar.
While dragging, use the arrow keys to move the item.
Press space again to drop the item in its new position, or press escape to cancel.
`},po={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function vo(e){let{announcements:t=po,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=go}=e;const{announce:s,announcement:l}=uo(),u=sn("DndLiveRegion"),[c,h]=d.useState(!1);if(d.useEffect(()=>{h(!0)},[]),fo(d.useMemo(()=>({onDragStart(a){let{active:g}=a;s(t.onDragStart({active:g}))},onDragMove(a){let{active:g,over:v}=a;t.onDragMove&&s(t.onDragMove({active:g,over:v}))},onDragOver(a){let{active:g,over:v}=a;s(t.onDragOver({active:g,over:v}))},onDragEnd(a){let{active:g,over:v}=a;s(t.onDragEnd({active:g,over:v}))},onDragCancel(a){let{active:g,over:v}=a;s(t.onDragCancel({active:g,over:v}))}}),[s,t])),!c)return null;const f=d.createElement(d.Fragment,null,d.createElement(lo,{id:r,value:o.draggable}),d.createElement(co,{id:u,announcement:l}));return n?Et.createPortal(f,n):f}var Le;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Le||(Le={}));function Xt(){}function yo(e,t){return d.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function mo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const Ge=Object.freeze({x:0,y:0});function bo(e,t){const n=zt(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function xo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Co(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function wo(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),l=o-r,u=s-n;if(r<o&&n<s){const c=t.width*t.height,h=e.width*e.height,f=l*u,a=f/(c+h-f);return Number(a.toFixed(4))}return 0}const Do=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const s of r){const{id:l}=s,u=n.get(l);if(u){const c=wo(u,t);c>0&&o.push({id:l,data:{droppableContainer:s,value:c}})}}return o.sort(xo)};function So(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Vn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ge}function Eo(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];return o.reduce((l,u)=>({...l,top:l.top+e*u.y,bottom:l.bottom+e*u.y,left:l.left+e*u.x,right:l.right+e*u.x}),{...n})}}const To=Eo(1);function zn(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function _o(e,t,n){const r=zn(t);if(!r)return e;const{scaleX:o,scaleY:s,x:l,y:u}=r,c=e.left-l-(1-o)*parseFloat(n),h=e.top-u-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),f=o?e.width/o:e.width,a=s?e.height/s:e.height;return{width:f,height:a,top:h,right:c+f,bottom:h+a,left:c}}const Oo={ignoreTransform:!1};function Lt(e,t){t===void 0&&(t=Oo);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:h,transformOrigin:f}=Ae(e).getComputedStyle(e);h&&(n=_o(n,h,f))}const{top:r,left:o,width:s,height:l,bottom:u,right:c}=n;return{top:r,left:o,width:s,height:l,bottom:u,right:c}}function Xn(e){return Lt(e,{ignoreTransform:!0})}function jo(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Fo(e,t){return t===void 0&&(t=Ae(e).getComputedStyle(e)),t.position==="fixed"}function Mo(e,t){t===void 0&&(t=Ae(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const s=t[o];return typeof s=="string"?n.test(s):!1})}function ln(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(tn(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Ft(o)||Bn(o)||n.includes(o))return n;const s=Ae(e).getComputedStyle(o);return o!==e&&Mo(o,s)&&n.push(o),Fo(o,s)?n:r(o.parentNode)}return e?r(e):n}function Un(e){const[t]=ln(e,1);return t??null}function cn(e){return!It||!e?null:yt(e)?e:en(e)?tn(e)||e===mt(e).scrollingElement?window:Ft(e)?e:null:null}function Kn(e){return yt(e)?e.scrollX:e.scrollLeft}function Gn(e){return yt(e)?e.scrollY:e.scrollTop}function un(e){return{x:Kn(e),y:Gn(e)}}var Oe;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Oe||(Oe={}));function Jn(e){return!It||!e?!1:e===document.scrollingElement}function qn(e){const t={x:0,y:0},n=Jn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,l=e.scrollTop>=r.y,u=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:l,isRight:u,maxScroll:r,minScroll:t}}const No={x:.2,y:.2};function Lo(e,t,n,r,o){let{top:s,left:l,right:u,bottom:c}=n;r===void 0&&(r=10),o===void 0&&(o=No);const{isTop:h,isBottom:f,isLeft:a,isRight:g}=qn(e),v={x:0,y:0},w={x:0,y:0},m={height:t.height*o.y,width:t.width*o.x};return!h&&s<=t.top+m.height?(v.y=Oe.Backward,w.y=r*Math.abs((t.top+m.height-s)/m.height)):!f&&c>=t.bottom-m.height&&(v.y=Oe.Forward,w.y=r*Math.abs((t.bottom-m.height-c)/m.height)),!g&&u>=t.right-m.width?(v.x=Oe.Forward,w.x=r*Math.abs((t.right-m.width-u)/m.width)):!a&&l<=t.left+m.width&&(v.x=Oe.Backward,w.x=r*Math.abs((t.left+m.width-l)/m.width)),{direction:v,speed:w}}function ko(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:l}=window;return{top:0,left:0,right:s,bottom:l,width:s,height:l}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Qn(e){return e.reduce((t,n)=>bt(t,un(n)),Ge)}function Po(e){return e.reduce((t,n)=>t+Kn(n),0)}function Ao(e){return e.reduce((t,n)=>t+Gn(n),0)}function Zn(e,t){if(t===void 0&&(t=Lt),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);Un(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Ro=[["x",["left","right"],Po],["y",["top","bottom"],Ao]];class dn{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=ln(n),o=Qn(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,l,u]of Ro)for(const c of l)Object.defineProperty(this,c,{get:()=>{const h=u(r),f=o[s]-h;return this.rect[c]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class kt{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function $o(e){const{EventTarget:t}=Ae(e);return e instanceof t?e:mt(e)}function fn(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var Xe;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Xe||(Xe={}));function er(e){e.preventDefault()}function Wo(e){e.stopPropagation()}var fe;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(fe||(fe={}));const tr={start:[fe.Space,fe.Enter],cancel:[fe.Esc],end:[fe.Space,fe.Enter,fe.Tab]},Bo=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case fe.Right:return{...n,x:n.x+25};case fe.Left:return{...n,x:n.x-25};case fe.Down:return{...n,y:n.y+25};case fe.Up:return{...n,y:n.y-25}}};class nr{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new kt(mt(n)),this.windowListeners=new kt(Ae(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Xe.Resize,this.handleCancel),this.windowListeners.add(Xe.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Xe.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Zn(r),n(Ge)}handleKeyDown(t){if(an(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=tr,coordinateGetter:l=Bo,scrollBehavior:u="smooth"}=o,{code:c}=t;if(s.end.includes(c)){this.handleEnd(t);return}if(s.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:h}=r.current,f=h?{x:h.left,y:h.top}:Ge;this.referenceCoordinates||(this.referenceCoordinates=f);const a=l(t,{active:n,context:r.current,currentCoordinates:f});if(a){const g=Vt(a,f),v={x:0,y:0},{scrollableAncestors:w}=r.current;for(const m of w){const T=t.code,{isTop:y,isRight:D,isLeft:O,isBottom:E,maxScroll:x,minScroll:M}=qn(m),_=ko(m),A={x:Math.min(T===fe.Right?_.right-_.width/2:_.right,Math.max(T===fe.Right?_.left:_.left+_.width/2,a.x)),y:Math.min(T===fe.Down?_.bottom-_.height/2:_.bottom,Math.max(T===fe.Down?_.top:_.top+_.height/2,a.y))},Q=T===fe.Right&&!D||T===fe.Left&&!O,se=T===fe.Down&&!E||T===fe.Up&&!y;if(Q&&A.x!==a.x){const ee=m.scrollLeft+g.x,Z=T===fe.Right&&ee<=x.x||T===fe.Left&&ee>=M.x;if(Z&&!g.y){m.scrollTo({left:ee,behavior:u});return}Z?v.x=m.scrollLeft-ee:v.x=T===fe.Right?m.scrollLeft-x.x:m.scrollLeft-M.x,v.x&&m.scrollBy({left:-v.x,behavior:u});break}else if(se&&A.y!==a.y){const ee=m.scrollTop+g.y,Z=T===fe.Down&&ee<=x.y||T===fe.Up&&ee>=M.y;if(Z&&!g.x){m.scrollTo({top:ee,behavior:u});return}Z?v.y=m.scrollTop-ee:v.y=T===fe.Down?m.scrollTop-x.y:m.scrollTop-M.y,v.y&&m.scrollBy({top:-v.y,behavior:u});break}}this.handleMove(t,bt(Vt(a,this.referenceCoordinates),v))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}nr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=tr,onActivation:o}=t,{active:s}=n;const{code:l}=e.nativeEvent;if(r.start.includes(l)){const u=s.activatorNode.current;return u&&e.target!==u?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function rr(e){return!!(e&&"distance"in e)}function or(e){return!!(e&&"delay"in e)}class hn{constructor(t,n,r){var o;r===void 0&&(r=$o(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:l}=s;this.props=t,this.events=n,this.document=mt(l),this.documentListeners=new kt(this.document),this.listeners=new kt(r),this.windowListeners=new kt(Ae(l)),this.initialCoordinates=(o=zt(s))!=null?o:Ge,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Xe.Resize,this.handleCancel),this.windowListeners.add(Xe.DragStart,er),this.windowListeners.add(Xe.VisibilityChange,this.handleCancel),this.windowListeners.add(Xe.ContextMenu,er),this.documentListeners.add(Xe.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(or(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(rr(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Xe.Click,Wo,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Xe.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:s}=this,{onMove:l,options:{activation