apexgantt 3.17.1 → 3.17.2
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.
- package/apexgantt.es.min.js +1 -1
- package/apexgantt.min.js +1 -1
- package/package.json +2 -2
package/apexgantt.es.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const t=()=>{};class e{constructor(t,e){this.injectedStyles=new Set,this.trackedTooltips=new Set,this.instanceId=e||Math.random().toString(36).substr(2,9),this.context=this.detectContext(t),this.chartContainer=t}getChartContainer(){return this.chartContainer}getChartScopedContainer(){return this.context===document?document.body||document.getElementsByTagName("body")[0]:this.chartContainer||this.context}detectContext(t){const e=t.getRootNode();return e instanceof ShadowRoot?e:document}getContext(){return this.context}getInstanceId(){return this.instanceId}isShadowDOM(){return this.context instanceof ShadowRoot}createElement(t){return document.createElement(t)}createElementNS(t,e){return document.createElementNS(t,e)}createTextNode(t){return document.createTextNode(t)}getElementById(t){return this.context===document?document.getElementById(t):this.context.querySelector(`#${t}`)}getElementsByClassName(t){if(this.context===document)return document.getElementsByClassName(t);const e=this.context.querySelectorAll(`.${t}`),n=Array.from(e);return{item:t=>n[t]||null,get length(){return n.length},[Symbol.iterator]:()=>n[Symbol.iterator](),...Object.fromEntries(n.map(((t,e)=>[e,t])))}}querySelector(t){return this.context.querySelector(t)}querySelectorAll(t){return this.context.querySelectorAll(t)}getAppendContainer(){return this.context===document?document.body||document.getElementsByTagName("body")[0]:this.context}getChartBounds(){var t;return(null==(t=this.chartContainer)?void 0:t.getBoundingClientRect())||new DOMRect}getBody(){if(this.context===document)return document.body||document.getElementsByTagName("body")[0];return this.context.host}dispatchEvent(t){this.context===document?document.dispatchEvent(t):this.context.dispatchEvent(t)}addEventListener(t,e,n){this.context===document||"mousemove"===t||"mouseup"===t||"keydown"===t?document.addEventListener(t,e,n):this.context.addEventListener(t,e,n)}removeEventListener(t,e,n){this.context===document||"mousemove"===t||"mouseup"===t||"keydown"===t?document.removeEventListener(t,e,n):this.context.removeEventListener(t,e,n)}injectStyles(t,e,n={}){const{force:i=!1,priority:r="normal"}=n;if(!i&&this.injectedStyles.has(e))return;if(i){const t=this.context.querySelector(`#${e}`);t&&(t.remove(),this.injectedStyles.delete(e))}if(this.context.querySelector(`#${e}`)&&!i)return void this.injectedStyles.add(e);const s=document.createElement("style");if(s.id=e,s.textContent=t,"normal"!==r&&s.setAttribute("data-priority",r),this.context===document)document.head.appendChild(s);else{const t=this.context;"high"===r?t.insertBefore(s,t.firstChild):t.appendChild(s)}this.injectedStyles.add(e)}injectStylesheets(t){t.forEach((({content:t,id:e,options:n})=>{this.injectStyles(t,e,n)}))}hasInjectedStyles(t){return this.injectedStyles.has(t)}removeStyles(t){const e=this.context.querySelector(`#${t}`);e&&(e.remove(),this.injectedStyles.delete(t))}removeAllStyles(){this.injectedStyles.forEach((t=>{const e=this.context.querySelector(`#${t}`);e&&e.remove()})),this.injectedStyles.clear()}getInjectedStyleIds(){return Array.from(this.injectedStyles)}getActiveElement(){if(this.context===document)return document.activeElement;return this.context.activeElement||document.activeElement}trackTooltip(t){this.trackedTooltips.add(t)}destroy(){this.removeAllStyles(),this.injectedStyles.clear(),this.trackedTooltips.forEach((t=>t.remove())),this.trackedTooltips.clear()}}class n{constructor(t,n){if(!t)throw new Error("Container element is required");this.element=t,this.chartContext=new e(t,n)}getContext(){return this.chartContext}isShadowDOM(){return this.chartContext.isShadowDOM()}getTooltipContainer(){return this.chartContext.getAppendContainer()}injectStyles(t,e){this.chartContext.injectStyles(t,e)}createElement(t){return this.chartContext.createElement(t)}querySelector(t){return this.chartContext.querySelector(t)}addEventListener(t,e,n){this.chartContext.addEventListener(t,e,n)}removeEventListener(t,e,n){this.chartContext.removeEventListener(t,e,n)}dispatchEvent(t){this.chartContext.dispatchEvent(t)}destroy(){this.chartContext.destroy()}getInstanceId(){return this.chartContext.getInstanceId()}}const i="\n #toolbar {\n display: flex;\n gap: 2px;\n position: absolute;\n /* Logical inset: stays on the right in LTR, mirrors to the left in RTL\n (so it never collides with RTL-flipped chrome such as the search box). */\n inset-inline-end: 12px;\n top: 12px;\n z-index: 100;\n user-select: none;\n background: var(--toolbar-bg-color, rgba(255, 255, 255, 0.92));\n border: 1px solid var(--toolbar-border-color, rgba(0, 0, 0, 0.08));\n border-radius: 10px;\n padding: 4px;\n box-shadow:\n 0 1px 3px rgba(0, 0, 0, 0.08),\n 0 4px 12px rgba(0, 0, 0, 0.06);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n }\n\n .toolbar-item {\n align-items: center;\n background-color: transparent;\n border: none;\n border-radius: 6px;\n color: var(--toolbar-icon-color, #444);\n cursor: pointer;\n display: flex;\n height: 30px;\n justify-content: center;\n width: 30px;\n transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;\n position: relative;\n flex-shrink: 0;\n }\n\n .toolbar-item:hover {\n background-color: var(--toolbar-hover-bg-color, rgba(0, 0, 0, 0.06));\n color: var(--toolbar-icon-hover-color, #111);\n transform: translateY(-1px);\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);\n }\n\n .toolbar-item:active {\n transform: translateY(0);\n box-shadow: none;\n background-color: var(--toolbar-active-bg-color, rgba(0, 0, 0, 0.1));\n }\n\n .toolbar-item:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px var(--button-bg-color, #0066cc);\n }\n\n .toolbar-item svg {\n width: 15px;\n height: 15px;\n pointer-events: none;\n flex-shrink: 0;\n }\n\n .toolbar-item[disabled] {\n opacity: 0.4;\n cursor: not-allowed;\n pointer-events: none;\n }\n\n /* Tooltip */\n .toolbar-item::after {\n content: attr(data-tooltip);\n position: absolute;\n bottom: calc(100% + 8px);\n left: 50%;\n transform: translateX(-50%);\n background: var(--tooltip-bg-color, rgba(30, 30, 30, 0.92));\n color: var(--tooltip-text-color, #fff);\n padding: 5px 9px;\n border-radius: 6px;\n font-size: 11.5px;\n font-weight: 500;\n white-space: nowrap;\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.15s ease;\n z-index: 1000;\n letter-spacing: 0.01em;\n }\n\n .toolbar-item::before {\n content: '';\n position: absolute;\n bottom: calc(100% + 3px);\n left: 50%;\n transform: translateX(-50%);\n border: 4px solid transparent;\n border-top-color: var(--tooltip-bg-color, rgba(30, 30, 30, 0.92));\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.15s ease;\n z-index: 1000;\n }\n\n .toolbar-item:hover::after,\n .toolbar-item:hover::before {\n opacity: 1;\n }\n\n /* Shadow DOM specific adjustments */\n :host #toolbar {\n display: flex;\n gap: 2px;\n position: absolute;\n inset-inline-end: 12px;\n top: 12px;\n z-index: 100;\n }\n";function r(t){const e=t.getRootNode();return e instanceof ShadowRoot?e.host:t.parentElement}function s(t,e){const n=t.getBoundingClientRect(),i=e.getBoundingClientRect(),s=function(t){let e=1,n=1,i=0,s=0,o=t.parentElement;for(;o&&o!==document.body&&o!==document.documentElement;){const t=window.getComputedStyle(o),a=t.scale;if(a&&"none"!==a){const t=a.split(" ").map(parseFloat);1===t.length?(e*=t[0],n*=t[0]):t.length>=2&&(e*=t[0],n*=t[1])}const l=t.transform;if(l&&"none"!==l)try{const t=new DOMMatrix(l);e*=t.a,n*=t.d,i+=t.e,s+=t.f}catch{}o=r(o)}return{scaleX:e,scaleY:n,translateX:i,translateY:s}}(e),o=function(t){const e=window.getComputedStyle(t);let n=1,i=1,r=0,s=0,o=0;const a=e.scale;if(a&&"none"!==a){const t=a.split(" ").map(parseFloat);1===t.length?(n=t[0],i=t[0]):t.length>=2&&(n=t[0],i=t[1])}const l=e.transform;if(l&&"none"!==l)try{const t=new DOMMatrix(l);n*=t.a,i*=t.d,r=t.e,s=t.f,o=Math.atan2(t.b,t.a)}catch{}return{scaleX:n,scaleY:i,translateX:r,translateY:s,rotation:o}}(t),a=s.scaleX||1,l=s.scaleY||1,d=(n.left-i.left)/a,h=(n.top-i.top)/l,c=n.width/a,u=n.height/l;if(Math.abs(o.rotation)>.01){const t=d+c/2,e=h+u/2;return{left:t,right:t,top:e,bottom:e,width:0,height:0}}return{left:d,right:d+c,top:h,bottom:h+u,width:c,height:u}}const o=(t,e="apex-tooltip-container")=>{let n=t.getElementById(e);if(!n){n=t.createElement("div"),n.id=e,n.setAttribute("role","tooltip"),n.setAttribute("aria-hidden","true");t.getAppendContainer().appendChild(n),t.trackTooltip(n)}return n},a=(t={})=>{const e=[];for(const i in t){const r=`${n=i,n.replace(/([A-Z])/g,(t=>`-${t.toLowerCase()}`))}: ${t[i]};`;e.push(r)}var n;return e.join(" ")};function l(t,{className:e="",content:n,style:i={}}={}){const r=d(t,"div",{className:e,innerHTML:n||""});return r.setAttribute("style",a(i)),r}function d(t,e,n={}){const i=t.createElement(e);return Object.assign(i,n)}function h(t,e){if(!t)return"#000000";3===(t=t.replace(/^#/,"")).length&&(t=t.split("").map((t=>t+t)).join(""));const n=parseInt(t,16),i=(n>>16&255)/255,r=(n>>8&255)/255,s=(255&n)/255,o=Math.max(i,r,s),a=Math.min(i,r,s),l=o-a;let d=0,h=0;const c=(o+a)/2;0!==l&&(h=l/(1-Math.abs(2*c-1)),d=o===i?((r-s)/l%6+6)%6:o===r?(s-i)/l+2:(i-r)/l+4,d*=60);const u=((d+(e.h??0))%360+360)%360,p=Math.min(1,Math.max(0,h+(e.s??0)/100)),m=Math.min(1,Math.max(0,c+(e.l??0)/100)),g=(1-Math.abs(2*m-1))*p,f=g*(1-Math.abs(u/60%2-1)),b=m-g/2;let v=0,y=0,x=0;u<60?(v=g,y=f):u<120?(v=f,y=g):u<180?(y=g,x=f):u<240?(y=f,x=g):u<300?(v=f,x=g):(v=g,x=f);const w=t=>Math.round(255*(t+b)).toString(16).padStart(2,"0");return`#${w(v)}${w(y)}${w(x)}`}const c=globalThis.console;function u(t){c.error(t)}const p="APEX-",m=new Date("2027-07-31T00:00:00Z"),g=class{static getLicenseStatus(){return this.licenseKey?this.validationResult??{expired:!1,signatureVerified:!1,valid:!1}:{expired:!1,signatureVerified:!1,valid:!1}}static isLicenseValid(){return this.getLicenseStatus().valid}static onChange(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}static setLicense(t){this.licenseKey=t;const e=this.parseKey(t),n=this.validateStructure(t,e);this.publish(n),n.valid?(null==e?void 0:e.signature)&&this.verifySignature(t,e,n):u(`[Apex] ${n.message}`)}static base64ToBytes(t){const e=t.replace(/-/g,"+").replace(/_/g,"/"),n=e.padEnd(4*Math.ceil(e.length/4),"="),i=globalThis.atob;if("function"!=typeof i)throw new Error("no base64 decoder available");const r=i(n),s=new Uint8Array(r.length);for(let t=0;t<r.length;t++)s[t]=r.charCodeAt(t);return s}static canonicalPayload(t){const e=t.domains&&t.domains.length>0?t.domains.join(","):"";return`v1|${t.issueDate}|${t.expiryDate}|${t.plan}|${e}`}static notify(t){for(const e of this.listeners)try{e(t)}catch{}}static parseKey(t){if("string"!=typeof t||!t.startsWith(p))return null;const e=t.slice(5);if(!e)return null;try{const t=(new TextDecoder).decode(this.base64ToBytes(e)),n=JSON.parse(t);return n.issueDate&&n.expiryDate&&n.plan?{data:{domains:Array.isArray(n.domains)?n.domains:void 0,expiryDate:n.expiryDate,issueDate:n.issueDate,plan:n.plan,valid:!0},signature:"string"==typeof n.sig&&n.sig?n.sig:null}:null}catch{return null}}static publish(t){this.validationResult=t,this.notify(t)}static validateStructure(t,e){const n=t=>({expired:!1,message:t,signatureVerified:!1,valid:!1});if("string"!=typeof t||!t.startsWith(p))return n('Invalid license key format. License key must start with "APEX-".');if(!e)return n("Invalid license key. Unable to decode license data.");const{data:i,signature:r}=e;if(!r&&new Date>=m)return n("This license key is in the old unsigned format, which is no longer accepted. Please request a replacement key.");if(new Date(i.expiryDate)<new Date)return{data:i,expired:!0,message:`License expired on ${i.expiryDate}. Please renew your license.`,signatureVerified:!1,valid:!1};if(i.domains&&i.domains.length>0){const t="undefined"==typeof location?"":location.hostname;if(!i.domains.some((e=>t===e||t.endsWith(`.${e}`))))return{data:i,expired:!1,message:`License is not valid for this domain (${t}). Allowed domains: ${i.domains.join(", ")}.`,signatureVerified:!1,valid:!1}}return{data:i,expired:!1,signatureVerified:!1,valid:!0}}static async verifySignature(t,e,n){var i;const r=null==(i=globalThis.crypto)?void 0:i.subtle;if(!r||0===this.publicKeysSpki.length)return void(this.warnedUnverifiable||(this.warnedUnverifiable=!0,function(t){c.warn(t)}(r?"[Apex] No license signing key is configured in this build, so license signatures cannot be verified.":"[Apex] Web Crypto is unavailable (a secure context is required), so the license signature cannot be verified.")));const s=(new TextEncoder).encode(this.canonicalPayload(e.data));let o=!1;for(const t of this.publicKeysSpki){try{const n=await r.importKey("spki",this.base64ToBytes(t),{name:"ECDSA",namedCurve:"P-256"},!1,["verify"]);o=await r.verify({hash:"SHA-256",name:"ECDSA"},n,this.base64ToBytes(e.signature),s)}catch{o=!1}if(o)break}if(this.licenseKey!==t)return;if(o)return void this.publish({...n,signatureVerified:!0});const a="Invalid license key. The license signature does not verify.";this.publish({expired:!1,message:a,signatureVerified:!0,valid:!1}),u(`[Apex] ${a}`)}};g.licenseKey=null,g.listeners=new Set,g.publicKeysSpki=["MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEQIaK9UMD6n0oR/FIy8QdL0uSzKMQlf1BB+tOrji4/WuHsyRNxeDhVykoSsNURozMi1xhmqWvBH1L//xIfugTPA=="],g.validationResult=null,g.warnedUnverifiable=!1;let f=g;const b=class{static add(t){this.track(t),this.paint(t)}static exists(t){return!!t.querySelector(`[${this.WATERMARK_ATTR}]`)}static remove(t){this.track(t),this.erase(t)}static untrack(t){this.managed.delete(t)}static createWatermarkPattern(){const t=this.WATERMARK_TEXT;return`url("data:image/svg+xml,${encodeURIComponent(`\n <svg xmlns="http://www.w3.org/2000/svg" width="300" height="200">\n <text\n x="50%"\n y="50%"\n dominant-baseline="middle"\n text-anchor="middle"\n font-family="-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Arial, sans-serif"\n font-size="18"\n font-weight="600"\n fill="rgba(134, 134, 134, 0.1)"\n transform="rotate(-35, 100, 60)"\n >${t}</text>\n </svg>\n `.trim())}")`}static erase(t){const e=t.querySelector(`[${this.WATERMARK_ATTR}]`);e&&e.remove()}static paint(t){this.erase(t);const e=document.createElement("div");e.setAttribute(this.WATERMARK_ATTR,""),Object.assign(e.style,{backgroundImage:this.createWatermarkPattern(),backgroundRepeat:"repeat",bottom:"0",left:"0",msUserSelect:"none",pointerEvents:"none",position:"absolute",right:"0",top:"0",userSelect:"none",webkitUserSelect:"none",zIndex:"10000"}),"static"===getComputedStyle(t).position&&(t.style.position="relative"),t.appendChild(e)}static reconcile(){const t=f.isLicenseValid();for(const e of this.managed)e.isConnected?t?this.erase(e):this.paint(e):this.managed.delete(e)}static track(t){this.managed.add(t),this.subscribed||(this.subscribed=!0,f.onChange((()=>{this.reconcile()})))}};b.WATERMARK_ATTR="data-apexcharts-watermark",b.WATERMARK_TEXT="APEXCHARTS",b.managed=new Set,b.subscribed=!1;let v=b;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function y(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var x={exports:{}};x.exports=function(){var t=1e3,e=6e4,n=36e5,i="millisecond",r="second",s="minute",o="hour",a="day",l="week",d="month",h="quarter",c="year",u="date",p="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,g=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,f={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},b=function(t,e,n){var i=String(t);return!i||i.length>=e?t:""+Array(e+1-i.length).join(n)+t},v={s:b,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),i=Math.floor(n/60),r=n%60;return(e<=0?"+":"-")+b(i,2,"0")+":"+b(r,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var i=12*(n.year()-e.year())+(n.month()-e.month()),r=e.clone().add(i,d),s=n-r<0,o=e.clone().add(i+(s?-1:1),d);return+(-(i+(n-r)/(s?r-o:o-r))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:d,y:c,w:l,d:a,D:u,h:o,m:s,s:r,ms:i,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},y="en",x={};x[y]=f;var w="$isDayjsObject",k=function(t){return t instanceof E||!(!t||!t[w])},C=function t(e,n,i){var r;if(!e)return y;if("string"==typeof e){var s=e.toLowerCase();x[s]&&(r=s),n&&(x[s]=n,r=s);var o=e.split("-");if(!r&&o.length>1)return t(o[0])}else{var a=e.name;x[a]=e,r=a}return!i&&r&&(y=r),r||!i&&y},S=function(t,e){if(k(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new E(n)},M=v;M.l=C,M.i=k,M.w=function(t,e){return S(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var E=function(){function f(t){this.$L=C(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[w]=!0}var b=f.prototype;return b.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(M.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var i=e.match(m);if(i){var r=i[2]-1||0,s=(i[7]||"0").substring(0,3);return n?new Date(Date.UTC(i[1],r,i[3]||1,i[4]||0,i[5]||0,i[6]||0,s)):new Date(i[1],r,i[3]||1,i[4]||0,i[5]||0,i[6]||0,s)}}return new Date(e)}(t),this.init()},b.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},b.$utils=function(){return M},b.isValid=function(){return!(this.$d.toString()===p)},b.isSame=function(t,e){var n=S(t);return this.startOf(e)<=n&&n<=this.endOf(e)},b.isAfter=function(t,e){return S(t)<this.startOf(e)},b.isBefore=function(t,e){return this.endOf(e)<S(t)},b.$g=function(t,e,n){return M.u(t)?this[e]:this.set(n,t)},b.unix=function(){return Math.floor(this.valueOf()/1e3)},b.valueOf=function(){return this.$d.getTime()},b.startOf=function(t,e){var n=this,i=!!M.u(e)||e,h=M.p(t),p=function(t,e){var r=M.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return i?r:r.endOf(a)},m=function(t,e){return M.w(n.toDate()[t].apply(n.toDate("s"),(i?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},g=this.$W,f=this.$M,b=this.$D,v="set"+(this.$u?"UTC":"");switch(h){case c:return i?p(1,0):p(31,11);case d:return i?p(1,f):p(0,f+1);case l:var y=this.$locale().weekStart||0,x=(g<y?g+7:g)-y;return p(i?b-x:b+(6-x),f);case a:case u:return m(v+"Hours",0);case o:return m(v+"Minutes",1);case s:return m(v+"Seconds",2);case r:return m(v+"Milliseconds",3);default:return this.clone()}},b.endOf=function(t){return this.startOf(t,!1)},b.$set=function(t,e){var n,l=M.p(t),h="set"+(this.$u?"UTC":""),p=(n={},n[a]=h+"Date",n[u]=h+"Date",n[d]=h+"Month",n[c]=h+"FullYear",n[o]=h+"Hours",n[s]=h+"Minutes",n[r]=h+"Seconds",n[i]=h+"Milliseconds",n)[l],m=l===a?this.$D+(e-this.$W):e;if(l===d||l===c){var g=this.clone().set(u,1);g.$d[p](m),g.init(),this.$d=g.set(u,Math.min(this.$D,g.daysInMonth())).$d}else p&&this.$d[p](m);return this.init(),this},b.set=function(t,e){return this.clone().$set(t,e)},b.get=function(t){return this[M.p(t)]()},b.add=function(i,h){var u,p=this;i=Number(i);var m=M.p(h),g=function(t){var e=S(p);return M.w(e.date(e.date()+Math.round(t*i)),p)};if(m===d)return this.set(d,this.$M+i);if(m===c)return this.set(c,this.$y+i);if(m===a)return g(1);if(m===l)return g(7);var f=(u={},u[s]=e,u[o]=n,u[r]=t,u)[m]||1,b=this.$d.getTime()+i*f;return M.w(b,this)},b.subtract=function(t,e){return this.add(-1*t,e)},b.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var i=t||"YYYY-MM-DDTHH:mm:ssZ",r=M.z(this),s=this.$H,o=this.$m,a=this.$M,l=n.weekdays,d=n.months,h=n.meridiem,c=function(t,n,r,s){return t&&(t[n]||t(e,i))||r[n].slice(0,s)},u=function(t){return M.s(s%12||12,t,"0")},m=h||function(t,e,n){var i=t<12?"AM":"PM";return n?i.toLowerCase():i};return i.replace(g,(function(t,i){return i||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return M.s(e.$y,4,"0");case"M":return a+1;case"MM":return M.s(a+1,2,"0");case"MMM":return c(n.monthsShort,a,d,3);case"MMMM":return c(d,a);case"D":return e.$D;case"DD":return M.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return c(n.weekdaysMin,e.$W,l,2);case"ddd":return c(n.weekdaysShort,e.$W,l,3);case"dddd":return l[e.$W];case"H":return String(s);case"HH":return M.s(s,2,"0");case"h":return u(1);case"hh":return u(2);case"a":return m(s,o,!0);case"A":return m(s,o,!1);case"m":return String(o);case"mm":return M.s(o,2,"0");case"s":return String(e.$s);case"ss":return M.s(e.$s,2,"0");case"SSS":return M.s(e.$ms,3,"0");case"Z":return r}return null}(t)||r.replace(":","")}))},b.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},b.diff=function(i,u,p){var m,g=this,f=M.p(u),b=S(i),v=(b.utcOffset()-this.utcOffset())*e,y=this-b,x=function(){return M.m(g,b)};switch(f){case c:m=x()/12;break;case d:m=x();break;case h:m=x()/3;break;case l:m=(y-v)/6048e5;break;case a:m=(y-v)/864e5;break;case o:m=y/n;break;case s:m=y/e;break;case r:m=y/t;break;default:m=y}return p?m:M.a(m)},b.daysInMonth=function(){return this.endOf(d).$D},b.$locale=function(){return x[this.$L]},b.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),i=C(t,e,!0);return i&&(n.$L=i),n},b.clone=function(){return M.w(this.$d,this)},b.toDate=function(){return new Date(this.valueOf())},b.toJSON=function(){return this.isValid()?this.toISOString():null},b.toISOString=function(){return this.$d.toISOString()},b.toString=function(){return this.$d.toUTCString()},f}(),T=E.prototype;return S.prototype=T,[["$ms",i],["$s",r],["$m",s],["$H",o],["$W",a],["$M",d],["$y",c],["$D",u]].forEach((function(t){T[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),S.extend=function(t,e){return t.$i||(t(e,E,S),t.$i=!0),S},S.locale=C,S.isDayjs=k,S.unix=function(t){return S(1e3*t)},S.en=x[y],S.Ls=x,S.p={},S}();const w=y(x.exports);var k={exports:{}};const C=y(k.exports=function(t,e){e.prototype.isSameOrBefore=function(t,e){return this.isSame(t,e)||this.isBefore(t,e)}});var S={exports:{}};S.exports=function(t,e,n){var i=function(t,e){if(!e||!e.length||1===e.length&&!e[0]||1===e.length&&Array.isArray(e[0])&&!e[0].length)return null;var n;1===e.length&&e[0].length>0&&(e=e[0]),n=(e=e.filter((function(t){return t})))[0];for(var i=1;i<e.length;i+=1)e[i].isValid()&&!e[i][t](n)||(n=e[i]);return n};n.max=function(){var t=[].slice.call(arguments,0);return i("isAfter",t)},n.min=function(){var t=[].slice.call(arguments,0);return i("isBefore",t)}};const M=y(S.exports);var E,T,A={exports:{}};const D=y(A.exports=(E="month",T="quarter",function(t,e){var n=e.prototype;n.quarter=function(t){return this.$utils().u(t)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(t-1))};var i=n.add;n.add=function(t,e){return t=Number(t),this.$utils().p(e)===T?this.add(3*t,E):i.bind(this)(t,e)};var r=n.startOf;n.startOf=function(t,e){var n=this.$utils(),i=!!n.u(e)||e;if(n.p(t)===T){var s=this.quarter()-1;return i?this.month(3*s).startOf(E).startOf("day"):this.month(3*s+2).endOf(E).endOf("day")}return r.bind(this)(t,e)}}));var I={exports:{}};I.exports=function(t,e){e.prototype.weekday=function(t){var e=this.$locale().weekStart||0,n=this.$W,i=(n<e?n+7:n)-e;return this.$utils().u(t)?i:this.subtract(i,"day").add(t,"day")}};const $=y(I.exports);var F={exports:{}};F.exports=function(){var t="week",e="year";return function(n,i,r){var s=i.prototype;s.week=function(n){if(void 0===n&&(n=null),null!==n)return this.add(7*(n-this.week()),"day");var i=this.$locale().yearStart||1;if(11===this.month()&&this.date()>25){var s=r(this).startOf(e).add(1,e).date(i),o=r(this).endOf(t);if(s.isBefore(o))return 1}var a=r(this).startOf(e).date(i).startOf(t).subtract(1,"millisecond"),l=this.diff(a,t,!0);return l<0?r(this).startOf("week").week():Math.ceil(l)},s.weeks=function(t){return void 0===t&&(t=null),this.week(t)}}}();const B=y(F.exports),L=globalThis.console,R={warn(...t){L.warn(...t)},error(...t){L.error(...t)}};class H{constructor(){this.cleanups=new Map,this.observer=null}dispatch(t,e,n){let i;this.cleanupCell(n);try{i=t(e,n)}catch(t){return void R.error("Column renderer threw:",t)}"string"==typeof i?n.innerHTML=i:"function"==typeof i&&this.cleanups.set(n,i)}observe(t){this.disconnect(),"undefined"!=typeof MutationObserver&&(this.observer=new MutationObserver((t=>{for(const e of t)e.removedNodes.forEach((t=>{t instanceof HTMLElement&&this.cleanupSubtree(t)}))})),this.observer.observe(t,{childList:!0,subtree:!0}))}disconnect(){var t;null==(t=this.observer)||t.disconnect(),this.observer=null}flushCleanups(){const t=Array.from(this.cleanups.values());this.cleanups.clear(),t.forEach((t=>this.invokeCleanup(t)))}destroy(){this.disconnect(),this.flushCleanups()}cleanupCell(t){const e=this.cleanups.get(t);e&&(this.cleanups.delete(t),this.invokeCleanup(e))}cleanupSubtree(t){if(0===this.cleanups.size)return;const e=[];this.cleanups.forEach(((n,i)=>{(t===i||t.contains(i))&&e.push(i)})),e.forEach((t=>this.cleanupCell(t)))}invokeCleanup(t){try{t()}catch(t){R.error("Column renderer cleanup threw:",t)}}}function P(t){return"number"==typeof t.leadingPadding&&t.leadingPadding>=0?t.leadingPadding:"left"===t.position?120:0}function z(t,e,n){if(e.render){const i=e.render(n);if(null==i){const i=e.field??"name";return void(t.textContent=String(n[i]??""))}return void("string"==typeof i?t.innerHTML=i:t.replaceChildren(i))}const i=e.field??"name";t.textContent=String(n[i]??"")}function O(t,e){const n=t.getInstanceId(),i=`.bar-container .bar-timeline[data-taskid="${e}"][data-chart-instance="${n}"]`,r=t.querySelector(i);return r||R.warn(`[${n}] Bar element not found for task: ${e}`),r}function W(t,e){const n=t.getInstanceId(),i=`.timeline-body .timeline-data-row[data-taskid="${e}"][data-chart-instance="${n}"]`,r=t.querySelector(i);return r||R.warn(`[${n}] Bar row element not found for task: ${e}`),r}var N={exports:{}};N.exports=function(){var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},e=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,i=/\d\d/,r=/\d\d?/,s=/\d*[^-_:/,()\s\d]+/,o={},a=function(t){return(t=+t)+(t>68?1900:2e3)},l=function(t){return function(e){this[t]=+e}},d=[/[+-]\d\d:?(\d\d)?|Z/,function(t){(this.zone||(this.zone={})).offset=function(t){if(!t)return 0;if("Z"===t)return 0;var e=t.match(/([+-]|\d\d)/g),n=60*e[1]+(+e[2]||0);return 0===n?0:"+"===e[0]?-n:n}(t)}],h=function(t){var e=o[t];return e&&(e.indexOf?e:e.s.concat(e.f))},c=function(t,e){var n,i=o.meridiem;if(i){for(var r=1;r<=24;r+=1)if(t.indexOf(i(r,0,e))>-1){n=r>12;break}}else n=t===(e?"pm":"PM");return n},u={A:[s,function(t){this.afternoon=c(t,!1)}],a:[s,function(t){this.afternoon=c(t,!0)}],Q:[n,function(t){this.month=3*(t-1)+1}],S:[n,function(t){this.milliseconds=100*+t}],SS:[i,function(t){this.milliseconds=10*+t}],SSS:[/\d{3}/,function(t){this.milliseconds=+t}],s:[r,l("seconds")],ss:[r,l("seconds")],m:[r,l("minutes")],mm:[r,l("minutes")],H:[r,l("hours")],h:[r,l("hours")],HH:[r,l("hours")],hh:[r,l("hours")],D:[r,l("day")],DD:[i,l("day")],Do:[s,function(t){var e=o.ordinal,n=t.match(/\d+/);if(this.day=n[0],e)for(var i=1;i<=31;i+=1)e(i).replace(/\[|\]/g,"")===t&&(this.day=i)}],w:[r,l("week")],ww:[i,l("week")],M:[r,l("month")],MM:[i,l("month")],MMM:[s,function(t){var e=h("months"),n=(h("monthsShort")||e.map((function(t){return t.slice(0,3)}))).indexOf(t)+1;if(n<1)throw new Error;this.month=n%12||n}],MMMM:[s,function(t){var e=h("months").indexOf(t)+1;if(e<1)throw new Error;this.month=e%12||e}],Y:[/[+-]?\d+/,l("year")],YY:[i,function(t){this.year=a(t)}],YYYY:[/\d{4}/,l("year")],Z:d,ZZ:d};function p(n){var i,r;i=n,r=o&&o.formats;for(var s=(n=i.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(e,n,i){var s=i&&i.toUpperCase();return n||r[i]||t[i]||r[s].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(t,e,n){return e||n.slice(1)}))}))).match(e),a=s.length,l=0;l<a;l+=1){var d=s[l],h=u[d],c=h&&h[0],p=h&&h[1];s[l]=p?{regex:c,parser:p}:d.replace(/^\[|\]$/g,"")}return function(t){for(var e={},n=0,i=0;n<a;n+=1){var r=s[n];if("string"==typeof r)i+=r.length;else{var o=r.regex,l=r.parser,d=t.slice(i),h=o.exec(d)[0];l.call(e,h),t=t.replace(h,"")}}return function(t){var e=t.afternoon;if(void 0!==e){var n=t.hours;e?n<12&&(t.hours+=12):12===n&&(t.hours=0),delete t.afternoon}}(e),e}}return function(t,e,n){n.p.customParseFormat=!0,t&&t.parseTwoDigitYear&&(a=t.parseTwoDigitYear);var i=e.prototype,r=i.parse;i.parse=function(t){var e=t.date,i=t.utc,s=t.args;this.$u=i;var a=s[1];if("string"==typeof a){var l=!0===s[2],d=!0===s[3],h=l||d,c=s[2];d&&(c=s[2]),o=this.$locale(),!l&&c&&(o=n.Ls[c]),this.$d=function(t,e,n,i){try{if(["x","X"].indexOf(e)>-1)return new Date(("X"===e?1e3:1)*t);var r=p(e)(t),s=r.year,o=r.month,a=r.day,l=r.hours,d=r.minutes,h=r.seconds,c=r.milliseconds,u=r.zone,m=r.week,g=new Date,f=a||(s||o?1:g.getDate()),b=s||g.getFullYear(),v=0;s&&!o||(v=o>0?o-1:g.getMonth());var y,x=l||0,w=d||0,k=h||0,C=c||0;return u?new Date(Date.UTC(b,v,f,x,w,k,C+60*u.offset*1e3)):n?new Date(Date.UTC(b,v,f,x,w,k,C)):(y=new Date(b,v,f,x,w,k,C),m&&(y=i(y).week(m).toDate()),y)}catch(t){return new Date("")}}(e,a,i,n),this.init(),c&&!0!==c&&(this.$L=this.locale(c).$L),h&&e!=this.format(a)&&(this.$d=new Date("")),o={}}else if(a instanceof Array)for(var u=a.length,m=1;m<=u;m+=1){s[1]=a[m-1];var g=n.apply(this,s);if(g.isValid()){this.$d=g.$d,this.$L=g.$L,this.init();break}m===u&&(this.$d=new Date(""))}else r.call(this,t)}}}();const q=y(N.exports);function Y(t){return/[HhmsS]/.test(t)}function U(t,e){if(null==t)return w(NaN);if("string"!=typeof t)return w(t);const n=w(t,e,!0);return n.isValid()?n:w(t)}function j(t){if(null==t?void 0:t.name)return w.locale(t,void 0,!0),t.name}function V(t,e){return e?t.locale(e):t}w.extend(q);const _=[0,1,2,3,4,5,6];class G{constructor(t={}){this.inputDateFormat=t.inputDateFormat??"YYYY-MM-DD";const e=t.workingWeekdays??_;this.workingWeekdaysSet=new Set(e.filter((t=>Number.isInteger(t)&&t>=0&&t<=6)));const n=(t.holidays??[]).map((t=>this.parse(t).format("YYYY-MM-DD")));this.holidaysSet=new Set(n),this.isNoOp=7===this.workingWeekdaysSet.size&&0===this.holidaysSet.size}parse(t){return U(t,this.inputDateFormat)}getInputDateFormat(){return this.inputDateFormat}isWorkingDay(t){if(this.isNoOp)return!0;const e=this.parse(t);return this.workingWeekdaysSet.has(e.day())&&!this.holidaysSet.has(e.format("YYYY-MM-DD"))}nextWorkingDay(t){let e=this.parse(t).startOf("day");if(this.isNoOp)return e.toDate();let n=3660;for(;!this.isWorkingDay(e)&&n-- >0;)e=e.add(1,"day");return e.toDate()}prevWorkingDay(t){let e=this.parse(t).startOf("day");if(this.isNoOp)return e.toDate();let n=3660;for(;!this.isWorkingDay(e)&&n-- >0;)e=e.subtract(1,"day");return e.toDate()}addWorkingDays(t,e){let n=this.parse(t).startOf("day");if(this.isNoOp||0===e)return n.add(e,"day").toDate();const i=e>0?1:-1;let r=Math.abs(e);for(;r>0;)n=n.add(i,"day"),this.isWorkingDay(n)&&r--;return n.toDate()}workingDaysBetween(t,e,n={}){let i=this.parse(t).startOf("day");const r=this.parse(e).startOf("day");if(i.isAfter(r))return 0;if(this.isNoOp){const t=r.diff(i,"day");return n.inclusive?t+1:t}let s=0;for(;i.isBefore(r);)this.isWorkingDay(i)&&s++,i=i.add(1,"day");return n.inclusive&&this.isWorkingDay(r)&&s++,s}iterateWorkingDays(t,e,n){let i=this.parse(t).startOf("day");const r=this.parse(e).startOf("day");for(;!i.isAfter(r);)this.isWorkingDay(i)&&n(i.toDate()),i=i.add(1,"day")}}const K=new G;function X(t,e,n){return"allow"===n||e.isNoOp||e.isWorkingDay(t)?U(t,e.getInputDateFormat()).startOf("day").toDate():"previous"===n?e.prevWorkingDay(t):e.nextWorkingDay(t)}function Z(t=[]){return t.map((t=>{const e="object"==typeof t&&null!==t&&"date"in t?t.date:t,n=w(e);return{key:n.format("YYYY-MM-DD"),date:n.toDate(),label:"object"==typeof t&&"label"in t?t.label:void 0}}))}w.extend(q);const Q=6e4,J=36e5,tt=864e5;function et(t,e){return("minute"===t?Q:"hour"===t?J:tt)*Math.max(1,e)}function nt(t,e,n){return U(t,n).add(e,"millisecond").format(n)}const it={TASK_UPDATE:"taskUpdate",TASK_VALIDATION_ERROR:"taskValidationError",TASK_UPDATE_SUCCESS:"taskUpdateSuccess",TASK_UPDATE_ERROR:"taskUpdateError",TASK_ADDED:"taskAdded",TASK_DELETED:"taskDeleted",TASK_MOVED:"taskMoved",DEPENDENCY_ADDED:"dependencyAdded",DEPENDENCY_REMOVED:"dependencyRemoved",TASK_DRAGGED:"taskDragged",TASK_RESIZED:"taskResized",TASK_PROGRESS_CHANGED:"taskProgressChanged",SELECTION_CHANGE:"selectionChange",DEPENDENCY_ARROW_UPDATE:"dependencyArrowUpdate",HISTORY_CHANGE:"historyChange",SORT_CHANGE:"sortChange",FILTER_CHANGE:"filterChange",GROUP_CHANGE:"groupChange",COLUMN_RESIZE:"columnResize",COLUMN_REORDER:"columnReorder"};class rt{constructor(t,e,n,i,r,s=!1){this.taskId=t,this.options=e,this.chartContext=i,this.dataManager=r,this.rtl=s,this.dragState={childTasks:[],pixelsPerSnap:0,msPerSnap:0,initialLeft:0,initialPosition:0,initialStartTime:"",initialEndTime:"",isDragging:!1,dragSessionId:""},this.task=null,this.activePointerId=null;if(!this.dataManager.getTaskById(t))throw new Error(`BarDragManager: Task with id "${t}" not found`);const o=et(this.options.snapUnit,this.options.snapValue);this.dragState.msPerSnap=o,this.dragState.pixelsPerSnap=n*o}isForeignPointer(t){return null!=this.activePointerId&&null!=t.pointerId&&t.pointerId!==this.activePointerId}calculateFinalPosition(t){const{pixelsPerSnap:e,initialLeft:n,initialPosition:i}=this.dragState,r=t.clientX-i,s=Math.round(r/e);return{calculatedLeft:n+s*e,snapsMoved:s}}shiftTimestamp(t,e){return nt(t,(this.rtl?-1:1)*e*this.dragState.msPerSnap,this.options.inputDateFormat)}snapToWorkingCalendar(t,e,n,i){var r;const s=this.dataManager.getCalendar(),o=(null==(r=this.options.calendar)?void 0:r.dragSnapMode)??"next";if(s.isNoOp||"allow"===o||"day"!==this.options.snapUnit||Y(this.options.inputDateFormat))return{newStart:n,newEnd:i};const a=s.workingDaysBetween(t,e,{inclusive:!0}),l=X(n,s,o),d=Math.max(0,a-1),h=0===d?l:s.addWorkingDays(l,d),c=this.options.inputDateFormat;return{newStart:w(l).format(c),newEnd:w(h).format(c)}}createMouseDownHandler(t){return e=>{var n;if(!(null!=e.button&&e.button>0)&&(this.task=this.dataManager.getTaskById(this.taskId),this.task)){if(this.activePointerId=e.pointerId??null,null!=e.pointerId)try{null==(n=t.setPointerCapture)||n.call(t,e.pointerId)}catch{}this.dragState={...this.dragState,initialLeft:parseInt(t.style.left)||0,initialPosition:e.clientX,initialStartTime:this.task.startTime,initialEndTime:this.task.endTime,isDragging:!0,dragSessionId:`drag-${this.task.id}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`},t.classList.add("dragging"),t.setAttribute("aria-grabbed","true"),this.dragState.childTasks=this.dataManager.getNestedChildTasks(this.task.id).map((t=>{const e=O(this.chartContext,t.id);return e?{...t,element:e,left:parseInt(e.style.left)||0,width:parseInt(e.style.width)||0}:t}))}}}createMouseMoveHandler(t){return e=>{this.dragState.isDragging&&!this.isForeignPointer(e)&&requestAnimationFrame((()=>{const{pixelsPerSnap:n,initialLeft:i,initialPosition:r}=this.dragState,s=Math.round((e.clientX-r)/n)*n;t.style.left=`${i+s}px`,this.task&&this.dataManager.updateDependencyArrows(this.task.id,this.chartContext),this.dragState.childTasks.forEach((t=>{if(!t.element)return;const e=t.left??0;t.element.style.left=`${e+s}px`,this.dataManager.updateDependencyArrows(t.id,this.chartContext)}))}))}}createMouseUpHandler(t,e){return n=>{if(!this.dragState.isDragging||this.isForeignPointer(n))return;if(this.dragState.isDragging=!1,this.releaseCapture(t,n),t.classList.remove("dragging"),t.setAttribute("aria-grabbed","false"),!this.task)return;const{calculatedLeft:i,snapsMoved:r}=this.calculateFinalPosition(n);if(0===r)return void(this.dragState={...this.dragState,isDragging:!1});this.armClickSwallow(t);const s=this.shiftTimestamp(this.task.startTime,r),o=this.shiftTimestamp(this.task.endTime,r),{newStart:a,newEnd:l}=this.snapToWorkingCalendar(this.task.startTime,this.task.endTime,s,o),d=this.dragState.childTasks.map((t=>{if(!t.endTime)return null;const e=this.shiftTimestamp(t.startTime,r),n=this.shiftTimestamp(t.endTime,r),i=this.snapToWorkingCalendar(t.startTime,t.endTime,e,n);return{taskId:t.id,newStartTime:i.newStart,newEndTime:i.newEnd}})).filter((t=>null!==t)),h=(this.rtl?-r:r)*this.dragState.msPerSnap/tt;this.emitTaskDraggedEvent(h,a,l,d),this.updateTaskPosition(t,i,r,e),this.updateChildrenPositions(i,r,e)}}emitTaskDraggedEvent(t,e,n,i){if(!this.task)return;const r={taskId:this.task.id,oldStartTime:this.dragState.initialStartTime,oldEndTime:this.dragState.initialEndTime,newStartTime:e,newEndTime:n,daysMoved:t,affectedChildTasks:i,timestamp:Date.now()},s=new CustomEvent(it.TASK_DRAGGED,{detail:r,bubbles:!0,composed:!0,cancelable:!1}),o=this.chartContext.getChartContainer();o&&o.dispatchEvent(s)}updateChildrenPositions(t,e,n){this.dragState.childTasks.forEach((i=>{const r=O(this.chartContext,i.id);if(r){const s=t-this.dragState.initialLeft;r.style.left=`${(i.left??0)+s}px`;const o=this.shiftTimestamp(i.startTime,e),a=i.endTime?this.shiftTimestamp(i.endTime,e):null,l=null!==a?this.snapToWorkingCalendar(i.startTime,i.endTime,o,a):{newStart:o,newEnd:void 0};this.dataManager.updateDependencyArrows(i.id,this.chartContext),null==n||n(i.id,{endTime:l.newEnd??void 0,startTime:l.newStart},{label:"Move task",mergeKey:this.dragState.dragSessionId})}}))}updateTaskPosition(t,e,n,i){if(!this.task)return;t.style.left=`${e}px`;const r=this.shiftTimestamp(this.task.startTime,n),s=this.shiftTimestamp(this.task.endTime,n),{newStart:o,newEnd:a}=this.snapToWorkingCalendar(this.task.startTime,this.task.endTime,r,s);this.dataManager.updateDependencyArrows(this.task.id,this.chartContext),null==i||i(this.task.id,{endTime:a,startTime:o},{label:"Move task",mergeKey:this.dragState.dragSessionId})}armClickSwallow(t){t.addEventListener("click",(t=>{t.stopPropagation(),t.preventDefault()}),{capture:!0,once:!0})}releaseCapture(t,e){var n;if(this.activePointerId=null,null!=e.pointerId)try{null==(n=t.releasePointerCapture)||n.call(t,e.pointerId)}catch{}}createPointerCancelHandler(t){return e=>{this.dragState.isDragging&&!this.isForeignPointer(e)&&(this.dragState.isDragging=!1,this.releaseCapture(t,e),t.classList.remove("dragging"),t.setAttribute("aria-grabbed","false"),t.style.left=`${this.dragState.initialLeft}px`,this.dragState.childTasks.forEach((t=>{t.element&&(t.element.style.left=`${t.left??0}px`)})),this.task&&this.dataManager.updateDependencyArrows(this.task.id,this.chartContext))}}makeDraggable(t,e){const n=this.createMouseDownHandler(t),i=this.createMouseMoveHandler(t),r=this.createMouseUpHandler(t,e),s=this.createPointerCancelHandler(t);return t.addEventListener("pointerdown",n),this.chartContext.addEventListener("pointermove",i),this.chartContext.addEventListener("pointerup",r),this.chartContext.addEventListener("pointercancel",s),()=>{t.removeEventListener("pointerdown",n),this.chartContext.removeEventListener("pointermove",i),this.chartContext.removeEventListener("pointerup",r),this.chartContext.removeEventListener("pointercancel",s)}}}class st{constructor(t,e,n,i,r=!1){this.taskId=t,this.options=e,this.chartContext=n,this.dataManager=i,this.rtl=r,this.state={initialProgress:0,initialClientX:0,barWidth:0,isDragging:!1,currentProgress:0},this.task=null,this.activePointerId=null;if(!this.dataManager.getTaskById(t))throw new Error(`BarProgressManager: Task with id "${t}" not found`)}isForeignPointer(t){return null!=this.activePointerId&&null!=t.pointerId&&t.pointerId!==this.activePointerId}clamp(t){return t<0?0:t>100?100:t}updateVisuals(t,e){const n=this.rtl?"right":"left",i=t.querySelector(".bar-timeline-progress");i&&(i.style.width=`${e}%`);const r=t.querySelector(".bar-progress-handle");r&&(r.style[n]=`${e}%`,r.setAttribute("aria-valuenow",String(Math.round(e))));const s=t.querySelector(".bar-progress-handle-label");s&&(s.style[n]=`${e}%`,s.textContent=`${Math.round(e)}%`)}createMouseDownHandler(t,e){return n=>{var i;if(null!=n.button&&n.button>0)return;if(n.stopPropagation(),n.preventDefault(),this.task=this.dataManager.getTaskById(this.taskId),!this.task)return;const r=parseInt(t.style.width)||t.offsetWidth||0;if(!(r<=0)){if(this.activePointerId=n.pointerId??null,null!=n.pointerId)try{null==(i=e.setPointerCapture)||i.call(e,n.pointerId)}catch{}this.state={initialProgress:this.task.progress??0,initialClientX:n.clientX,barWidth:r,isDragging:!0,currentProgress:this.task.progress??0},t.classList.add("progress-dragging"),e.classList.add("dragging")}}}createMouseMoveHandler(t){return e=>{this.state.isDragging&&!this.isForeignPointer(e)&&requestAnimationFrame((()=>{const n=e.clientX-this.state.initialClientX,i=(this.rtl?-n:n)/this.state.barWidth*100,r=this.clamp(this.state.initialProgress+i);this.state.currentProgress=r,this.updateVisuals(t,r)}))}}createMouseUpHandler(t,e,n){return i=>{var r;if(!this.state.isDragging||this.isForeignPointer(i))return;if(this.state.isDragging=!1,this.activePointerId=null,null!=i.pointerId)try{null==(r=e.releasePointerCapture)||r.call(e,i.pointerId)}catch{}if(t.classList.remove("progress-dragging"),e.classList.remove("dragging"),!this.task)return;const s=this.state.initialProgress,o=Math.round(this.state.currentProgress);this.updateVisuals(t,o),o!==s&&(null==n||n(this.task.id,{progress:o},{label:"Update progress"}),this.emitTaskProgressChangedEvent(s,o))}}emitTaskProgressChangedEvent(t,e){if(!this.task)return;const n={taskId:this.task.id,oldProgress:t,newProgress:e,timestamp:Date.now()},i=new CustomEvent(it.TASK_PROGRESS_CHANGED,{detail:n,bubbles:!0,composed:!0,cancelable:!1}),r=this.chartContext.getChartContainer();r&&r.dispatchEvent(i)}makeProgressDraggable(t,e,n){const i=this.createMouseDownHandler(t,e),r=this.createMouseMoveHandler(t),s=this.createMouseUpHandler(t,e,n);return e.addEventListener("pointerdown",i),this.chartContext.addEventListener("pointermove",r),this.chartContext.addEventListener("pointerup",s),this.chartContext.addEventListener("pointercancel",s),()=>{e.removeEventListener("pointerdown",i),this.chartContext.removeEventListener("pointermove",r),this.chartContext.removeEventListener("pointerup",s),this.chartContext.removeEventListener("pointercancel",s)}}}class ot{constructor(t,e,n,i,r,s=!1){this.taskId=t,this.options=e,this.chartContext=i,this.dataManager=r,this.rtl=s,this.interactionState={pixelsPerSnap:0,msPerSnap:0,initialLeft:0,initialPosition:0,initialWidth:0,initialStartTime:"",initialEndTime:"",isResizing:!1,resizeHandle:null},this.task=null,this.activePointerId=null;if(!this.dataManager.getTaskById(t))throw new Error(`BarResizeManager: Task with id "${t}" not found`);const o=et(this.options.snapUnit,this.options.snapValue);this.interactionState.msPerSnap=o,this.interactionState.pixelsPerSnap=n*o}isForeignPointer(t){return null!=this.activePointerId&&null!=t.pointerId&&t.pointerId!==this.activePointerId}armClickSwallow(t){t.addEventListener("click",(t=>{t.stopPropagation(),t.preventDefault()}),{capture:!0,once:!0})}shiftTimestamp(t,e){return nt(t,e*this.interactionState.msPerSnap,this.options.inputDateFormat)}snapResizedEndpoint(t){var e;const n=this.dataManager.getCalendar(),i=(null==(e=this.options.calendar)?void 0:e.dragSnapMode)??"next";return n.isNoOp||"allow"===i||"day"!==this.options.snapUnit||Y(this.options.inputDateFormat)?t:w(X(t,n,i)).format(this.options.inputDateFormat)}createMouseMoveHandler(t){return e=>{this.interactionState.isResizing&&!this.isForeignPointer(e)&&requestAnimationFrame((()=>{const{pixelsPerSnap:n,resizeHandle:i,initialLeft:r,initialPosition:s,initialWidth:o}=this.interactionState,a=Math.round((e.clientX-s)/n)*n;if("left"===i){let e=r+a,i=o-a;i<n&&(i=n,e=r+o-n),e<0&&(i+=e,e=0),t.style.left=`${e}px`,t.style.width=`${i}px`}else{const e=Math.max(n,o+a);t.style.width=`${e}px`}this.task&&this.dataManager.updateDependencyArrows(this.task.id,this.chartContext)}))}}createMouseUpHandler(t,e){return n=>{var i;if(!this.interactionState.isResizing||this.isForeignPointer(n))return;if(!this.task)return;if(this.armClickSwallow(t),this.activePointerId=null,null!=n.pointerId)try{null==(i=t.releasePointerCapture)||i.call(t,n.pointerId)}catch{}t.classList.remove("resizing");const{pixelsPerSnap:r,msPerSnap:s,initialLeft:o,initialPosition:a,initialWidth:l,resizeHandle:d}=this.interactionState,h=n.clientX-a,c=this.interactionState.initialStartTime,u=this.interactionState.initialEndTime;let p=c,m=u,g=0;if("left"===d){let n=Math.round(h/r),i=o+n*r,a=l-n*r;if(a<r&&(a=r,i=o+l-r,n=Math.round((i-o)/r)),0===n)return void(this.interactionState={...this.interactionState,isResizing:!1,resizeHandle:null});if(t.style.left=`${i}px`,t.style.width=`${a}px`,g=-n*s/tt,this.rtl){const t=this.shiftTimestamp(this.task.endTime,-n);m=this.snapResizedEndpoint(t),null==e||e(this.task.id,{endTime:m},{label:"Resize task"})}else{const t=this.shiftTimestamp(this.task.startTime,n);p=this.snapResizedEndpoint(t),null==e||e(this.task.id,{startTime:p},{label:"Resize task"})}}else{let n=Math.round(h/r),i=l+n*r;if(i<r&&(i=r,n=Math.round((i-l)/r)),0===n)return void(this.interactionState={...this.interactionState,isResizing:!1,resizeHandle:null});if(t.style.width=`${i}px`,g=n*s/tt,this.rtl){const t=this.shiftTimestamp(this.task.startTime,-n);p=this.snapResizedEndpoint(t),null==e||e(this.task.id,{startTime:p},{label:"Resize task"})}else{const t=this.shiftTimestamp(this.task.endTime,n);m=this.snapResizedEndpoint(t),null==e||e(this.task.id,{endTime:m},{label:"Resize task"})}}null!==d&&this.emitTaskResizedEvent(d,c,u,p,m,g),this.dataManager.updateDependencyArrows(this.task.id,this.chartContext),this.interactionState={...this.interactionState,isResizing:!1,resizeHandle:null}}}emitTaskResizedEvent(t,e,n,i,r,s){if(!this.task)return;const o={taskId:this.task.id,resizeHandle:t,oldStartTime:e,oldEndTime:n,newStartTime:i,newEndTime:r,durationChange:s,timestamp:Date.now()},a=new CustomEvent(it.TASK_RESIZED,{detail:o,bubbles:!0,composed:!0,cancelable:!1}),l=this.chartContext.getChartContainer();l&&l.dispatchEvent(a)}createResizeMouseDownHandler(t){return(e,n)=>{var i;if(!(null!=e.button&&e.button>0)&&(e.stopPropagation(),this.task=this.dataManager.getTaskById(this.taskId),this.task)){if(this.activePointerId=e.pointerId??null,null!=e.pointerId)try{null==(i=t.setPointerCapture)||i.call(t,e.pointerId)}catch{}this.interactionState={...this.interactionState,initialLeft:parseInt(t.style.left)||0,initialPosition:e.clientX,initialWidth:parseInt(t.style.width)||0,initialStartTime:this.task.startTime,initialEndTime:this.task.endTime,isResizing:!0,resizeHandle:n},t.classList.add("resizing")}}}makeResizable(t,e){const n=t.querySelector(".handle-left"),i=t.querySelector(".handle-right"),r=this.createResizeMouseDownHandler(t),s=this.createMouseMoveHandler(t),o=this.createMouseUpHandler(t,e),a=t=>r(t,"left"),l=t=>r(t,"right");return null==n||n.addEventListener("pointerdown",a),null==i||i.addEventListener("pointerdown",l),this.chartContext.addEventListener("pointermove",s),this.chartContext.addEventListener("pointerup",o),this.chartContext.addEventListener("pointercancel",o),()=>{null==n||n.removeEventListener("pointerdown",a),null==i||i.removeEventListener("pointerdown",l),this.chartContext.removeEventListener("pointermove",s),this.chartContext.removeEventListener("pointerup",o),this.chartContext.removeEventListener("pointercancel",o)}}}class at{constructor(t,e){this.chartContext=t,this.options=e,this.overlay=null,this.keydownHandler=null,this.clickOutsideHandler=null,this.createDialog(),this.setupEventListeners()}createDialog(){const t=this.chartContext.getInstanceId(),e=this.chartContext.getElementById(`${this.options.id}-container`);if(e){this.container=e;const t=this.container.querySelector(".gantt-dialog");return void this.updateDialogContent(t)}this.container=this.chartContext.createElement("div"),this.container.id=`${this.options.id}-container`,this.container.className="gantt-dialog-container",this.container.setAttribute("role","dialog"),this.container.setAttribute("aria-modal","true"),this.container.setAttribute("aria-labelledby",`${this.options.id}-title`),this.container.setAttribute("data-chart-instance",t),this.options.modal&&(this.overlay=this.chartContext.createElement("div"),this.overlay.className="dialog-overlay",this.container.appendChild(this.overlay));const n=this.chartContext.createElement("div");n.id=this.options.id,n.className="gantt-dialog",this.createDialogStructure(n),this.options.width&&(n.style.width=this.options.width),this.options.height&&(n.style.height=this.options.height),this.container.appendChild(n),!1!==this.options.positionRelativeToChart&&this.positionRelativeToChart();const i=!1!==this.options.positionRelativeToChart?this.chartContext.getChartContainer():this.chartContext.getAppendContainer();null==i||i.appendChild(this.container)}createDialogStructure(t){t.innerHTML=`\n <div class="dialog-header">\n <h2 id="${this.options.id}-title-${this.chartContext.getInstanceId()}" class="dialog-title">${this.options.title||""}</h2>\n <button class="dialog-close" aria-label="Close dialog" type="button">×</button>\n </div>\n <div class="dialog-content"></div>\n `,this.updateDialogContent(t)}positionRelativeToChart(){const t=this.chartContext.getChartContainer();if(t){"static"===window.getComputedStyle(t).position&&(t.style.position="relative")}this.container.style.position="absolute",this.container.style.top="0",this.container.style.left="0",this.container.style.width="100%",this.container.style.height="100%",this.container.style.zIndex="999"}setupEventListeners(){const t=this.container.querySelector(".dialog-close");null==t||t.addEventListener("click",(()=>this.hide())),this.options.closeOnEscape&&(this.keydownHandler=t=>{"Escape"===t.key&&this.isVisible()&&(t.preventDefault(),this.hide())},this.chartContext.addEventListener("keydown",this.keydownHandler)),this.options.closeOnClickOutside&&this.overlay&&(this.clickOutsideHandler=t=>{t.target===this.overlay&&this.hide()},this.overlay.addEventListener("click",this.clickOutsideHandler)),this.container.addEventListener("keydown",(t=>{"Tab"===t.key&&this.isVisible()&&this.trapFocus(t)}))}trapFocus(t){const e=this.container.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),n=e[0],i=e[e.length-1],r=this.chartContext.getActiveElement();t.shiftKey?r===n&&(t.preventDefault(),null==i||i.focus()):r===i&&(t.preventDefault(),null==n||n.focus())}updateDialogContent(t){const e=t.querySelector(".dialog-content"),n=t.querySelector(".dialog-title");n&&(n.textContent=this.options.title||""),e&&(e.innerHTML="","string"==typeof this.options.content?e.innerHTML=this.options.content:this.options.content instanceof HTMLElement&&e.appendChild(this.options.content))}cleanupEventListeners(){this.keydownHandler&&(this.chartContext.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null),this.clickOutsideHandler&&this.overlay&&(this.overlay.removeEventListener("click",this.clickOutsideHandler),this.clickOutsideHandler=null)}destroy(){this.cleanupEventListeners(),this.container.remove()}hide(){this.container.classList.remove("show","animate");const t=this.chartContext.querySelector("[data-dialog-trigger]");null==t||t.focus()}isVisible(){return this.container.classList.contains("show")}setContent(t){const e=this.container.querySelector(".dialog-content");e&&(e.innerHTML="","string"==typeof t?e.innerHTML=t:e.appendChild(t))}show(){const t=this.chartContext.getActiveElement();null==t||t.setAttribute("data-dialog-trigger","true"),this.container.classList.add("show","animate");const e=this.container.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');null==e||e.focus()}}var lt=(t=>(t.Horizontal="horizontal",t.Vertical="vertical",t))(lt||{});class dt{constructor(t,e,n,i){this.options=t,this.geometry=e,this.chartContext=n,this.totalHeight=i}calculateWidth(t){const e=this.options.inputDateFormat,n=U(t.x1,e).valueOf(),i=U(t.x2,e);return((Y(e)?i.valueOf():i.add(1,"day").valueOf())-n)*this.geometry.pixelsPerMs}calculateX(t){const e=t.x2?this.calculateWidth(t):0;return this.geometry.leftForDate(t.x1,e)}drawAnnotation(t){const e=l(this.chartContext,{className:"annotation"}),n=this.calculateX(t),i=a(this.getAnnotationStyles(t,n));if(e.setAttribute("style",i),t.label){const n=this.renderLabel(t);e.append(n)}return e}getAnnotationStyles(t,e){const{annotationBgColor:n,annotationBorderColor:i,annotationBorderWidth:r}=this.options,{bgColor:s,borderColor:o,borderWidth:a}=t;let l=0;const d=t.x2?a??r:(a??r??0)/2;return t.x2&&(l=this.calculateWidth(t)),{backgroundColor:s||n,borderColor:`${o||i}`,borderStyle:"solid",borderWidth:`${d}px`,height:`${this.totalHeight}px`,left:`${e}px`,position:"absolute",top:"0px",width:l?`${l}px`:"unset",zIndex:"10"}}renderLabel(t){const e=l(this.chartContext,{className:"annotation-label"}),{annotationBgColor:n,annotationBorderColor:i,fontColor:r,fontFamily:s,fontSize:o,fontWeight:d}=this.options,{bgColor:h,borderColor:c}=t,{label:u}=t;if(!u)return e;const p=u.fontColor||r,m=u.fontFamily||s,g=u.fontSize||o,f=u.fontWeight||d,b=a({background:h||n,borderColor:`${c||i}`,borderStyle:"solid",borderWidth:"1px",color:p,fontFamily:m,fontSize:g,fontWeight:f,left:"0px",padding:"2px 5px",position:"absolute",top:"-1px",width:"max-content",zIndex:"1"});return e.setAttribute("style",b),e.innerText=u.text??"",e}render(t=[]){const e=[];return[...this.options.annotations,...t].forEach((t=>{e.push(this.drawAnnotation(t))})),e}}const ht={annotationBorderDashArray:[],annotationBorderWidth:2,annotationOrientation:lt.Horizontal,annotations:[],enableProjectBoundary:!1,projectBoundaryColor:"#7C3AED",barBorderRadius:"5px",barLabel:{position:"right",field:"name"},barMargin:8,baseline:{enabled:!1,striped:!0,stripeColor:"#FFFFFF",stripeWidth:3,stripeAngle:45},canvasStyle:"border: 1px solid #E5E7EB; box-sizing: border-box",calendar:{},dependencies:{},enableCriticalPath:!1,enableCrosshair:!1,cellBorderWidth:"1px",columnLines:!0,enableInlineEdit:!1,enableProgressDrag:!0,enableTaskEditingShortcuts:!1,enableTaskCRUDToolbar:!1,enableContextMenu:!1,enableAddTaskRow:!1,enableDrawTask:!1,enableScrollButtons:!1,scrollToTaskOnRowClick:!1,history:{enabled:!0,maxSize:100},enableRollups:!1,enableSelection:!1,enableExport:!0,exportFormat:"svg",persistState:!1,toolbarItems:[],enableQuickFilter:!1,enableFilterBuilder:!1,enableResize:!0,enableTaskDrag:!0,enableTaskEdit:!1,enableTaskResize:!0,enableTooltip:!0,fontFamily:'system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',fontSize:"14px",fontWeight:"400",height:"500px",inputDateFormat:"MM-DD-YYYY",locale:{direction:"ltr"},rowHeight:40,series:[],showCheckboxColumn:!0,snapUnit:"day",snapValue:1,autoSizeColumns:!0,resizableColumns:!0,reorderableColumns:!0,tasksContainerWidth:425,tooltipId:"apexgantt-tooltip-container",tooltipTemplate(t,e){const n=[`<div>\n <strong>Task:</strong>\n <span>${t.name}</span>\n </div>\n `];if(t.type===Jt.Task?n.push(`\n <div>\n <strong>Start:</strong>\n <span>${Wt(t,It.StartTime,e)}</span>\n </div>\n <div>\n <strong>End:</strong>\n <span>${Wt(t,It.EndTime,e)}</span>\n </div>\n <div>\n <strong>Duration:</strong>\n <span>${Wt(t,It.Duration,e)}</span>\n </div>\n <div>\n <strong>Progress:</strong>\n <span>${t.progress}%</span>\n </div>\n `):t.type===Jt.Milestone&&n.push(`\n <div>\n <strong>Date:</strong>\n <span>${Wt(t,It.StartTime,e)}</span>\n </div>\n `),t.dependency){const e="string"==typeof t.dependency?{taskId:t.dependency,type:"FS",lag:0}:t.dependency,i=e.type??"FS",r=e.lag??0,s=0===r?"":` (${r>0?"+":""}${r}d)`;n.push(`\n <div>\n <strong>Depends on:</strong>\n <span>${e.taskId} · ${i}${s}</span>\n </div>\n `)}return n.join("")},width:"100%"},ct={annotationBgColor:"#DBEAFE",annotationBorderColor:"#60A5FA",arrowColor:"#94A3B8",backgroundColor:"#FFFFFF",barBackgroundColor:"#87B7FE",barTextColor:"#FFFFFF",borderColor:"#E5E7EB",cellBorderColor:"#EDEFF2",criticalArrowColor:"#E53935",criticalBarColor:"#E53935",crosshairColor:"#3B82F6",fontColor:"#1F2933",headerBackground:"#F8F9FB",milestoneColor:"#7C3AED",rowBackgroundColors:["#FFFFFF"],summaryBarColor:"#94A3B8",tooltipBGColor:"#FFFFFF",tooltipBorderColor:"#E5E7EB"},ut={annotationBgColor:"#4A2D4D",annotationBorderColor:"#8B4D8F",arrowColor:"#94A3B8",backgroundColor:"#1E1E1E",barBackgroundColor:"#818CF8",barTextColor:"#FFFFFF",borderColor:"#3A3A3A",cellBorderColor:"#3A3A3A",criticalArrowColor:"#F87171",criticalBarColor:"#F87171",crosshairColor:"#818CF8",fontColor:"#E0E0E0",headerBackground:"#2A2A2A",milestoneColor:"#A78BFA",rowBackgroundColors:["#1E1E1E","#252525"],summaryBarColor:"#8FBCBC",tooltipBGColor:"#2D2D2D",tooltipBorderColor:"#444444"},pt={addTask:"Add task",deleteSelected:"Delete selected",undo:"Undo (Ctrl+Z)",redo:"Redo (Ctrl+Y)",exportAsSvg:"Export as SVG",exportAsPng:"Export as PNG",exportAsPdf:"Export as PDF",quickFilterPlaceholder:"Search tasks…",filterButton:"Filter",filterHeading:"Filter tasks",filterMatchLabel:"Match",filterMatchAll:"All",filterMatchAny:"Any",filterAddCondition:"+ Add condition",filterApply:"Apply",filterClear:"Clear",filterRemoveCondition:"Remove condition",filterNoConditions:"No conditions yet.",filterOperatorLabel:t=>({contains:"contains",notContains:"does not contain",equals:"equals",notEquals:"does not equal",startsWith:"starts with",endsWith:"ends with",gt:"greater than",gte:"greater or equal",lt:"less than",lte:"less or equal",before:"before",after:"after",on:"on",isEmpty:"is empty",notEmpty:"is not empty"}[t]??t),groupNone:"(None)",groupCountLabel:t=>`(${t})`,exportFailedNoChart:"Export failed: Chart not found. Please refresh and try again.",exportFailedGeneric:"Export failed. Please check the console for details.",editTask:"Edit task",addChildTask:"Add child task",addSiblingTask:"Add sibling task",indent:"Indent",outdent:"Outdent",deleteTask:"Delete task",deleteTaskWithChildren:"Delete (with children)",formTaskName:"Task Name",formStartDate:"Start Date",formEndDate:"End Date",formProgress:"Progress (%)",formSubmit:"Update",editTaskTitle:t=>`Edit Task: ${t}`,validationStartRequired:"Start date is required",validationEndRequired:"End date is required",validationEndAfterStart:"End date must be after start date",validationNameRequired:"Task name is required",validationProgressRequired:"Progress is required",validationProgressRange:"Progress must be between 0 and 100",addTaskRowLabel:"+ Add task",baselineLabel:"Baseline:",startLabel:"Start:",endLabel:"End:",summaryAriaLabel:({canToggle:t,collapsed:e,name:n})=>t?`${n} (summary) — ${e?"expand":"collapse"}`:`${n} (summary)`,barAriaLabel:({end:t,name:e,progress:n,start:i})=>void 0===n?`${e}: ${i} to ${t}`:`${e}: ${i} to ${t}, ${n}% complete`,barAriaValueText:({durationDays:t,end:e,start:n})=>`${n} to ${e}, ${t} days`,progressAriaLabel:t=>`${t} progress`};function mt(t){var e;return function(t,e){if(!e)return{...t};const n={...t};for(const t of Object.keys(e)){const i=e[t];void 0!==i&&(n[t]=i)}return n}(pt,null==(e=t.locale)?void 0:e.messages)}function gt(t){return{...ht,..."dark"===t?ut:ct}}const ft=gt("light");class bt{constructor(t,e,n,i,r,s="MM-DD-YYYY",o=pt){this.chartContext=t,this.dataManager=e,this.task=n,this.containerElement=i,this.onSubmit=r,this.dateFormat=s,this.messages=o,this.errors=[],this.submitButton=null,this.form=this.createForm()}emitEvent(t,e){const n=new CustomEvent(t,{detail:e,bubbles:!0,composed:!0,cancelable:!1});this.containerElement.dispatchEvent(n)}clearError(t){var e;const n=this.form.querySelector(`[name="${t}"]`),i=null==(e=n.parentElement)?void 0:e.querySelector(".form-error");null==i||i.remove(),n.classList.remove("invalid"),this.errors=this.errors.filter((e=>e.field!==t)),this.updateSubmitButton()}createForm(){const t=this.chartContext.createElement("form");return t.className="task-form",t.innerHTML=`\n <div class="form-group">\n <label for="name">${this.messages.formTaskName}</label>\n <input type="text" id="name" name="name" value="${this.task.name}">\n </div>\n\n <div class="form-group">\n <label for="startTime">${this.messages.formStartDate}</label>\n <input type="date" id="startTime" name="startTime" value="${this.formatDate(this.task.startTime)}">\n </div>\n\n <div class="form-group">\n <label for="endTime">${this.messages.formEndDate}</label>\n <input type="date" id="endTime" name="endTime" value="${this.formatDate(this.task.endTime)}">\n </div>\n\n <div class="form-group">\n <label for="progress">${this.messages.formProgress}</label>\n <input type="number" id="progress" name="progress" min="0" max="100" value="${this.task.progress}">\n </div>\n\n <div class="form-actions">\n <button type="submit" class="btn-primary">${this.messages.formSubmit}</button>\n </div>\n `,t.addEventListener("submit",this.handleSubmit.bind(this)),this.setupFieldValidation(t),t}formatDate(t){return w(t,this.dateFormat).format("YYYY-MM-DD")}handleSubmit(t){if(t.preventDefault(),this.errors.length>0)this.emitEvent(it.TASK_VALIDATION_ERROR,{taskId:this.task.id,errors:this.errors,timestamp:Date.now()});else try{const t=new FormData(this.form),e={...this.task,endTime:w(t.get("endTime")).format(this.dateFormat),name:t.get("name"),progress:Number(t.get("progress")),startTime:w(t.get("startTime")).format(this.dateFormat)},n=this.dataManager.getTaskById(this.task.id)??this.task;this.emitEvent(it.TASK_UPDATE,{taskId:this.task.id,updates:e,updatedTask:{...n,...e},timestamp:Date.now()}),this.onSubmit(e),this.emitEvent(it.TASK_UPDATE_SUCCESS,{taskId:this.task.id,updatedTask:{...n,...e},timestamp:Date.now()})}catch(t){R.warn(`[TaskForm] Error updating task ${this.task.id}:`,t),this.emitEvent(it.TASK_UPDATE_ERROR,{taskId:this.task.id,error:t instanceof Error?t:new Error(String(t)),timestamp:Date.now()})}}setupFieldValidation(t){const e=t.querySelector('[name="name"]'),n=t.querySelector('[name="startTime"]'),i=t.querySelector('[name="endTime"]'),r=t.querySelector('[name="progress"]');null==e||e.addEventListener("change",(()=>{const t=this.validateName(e.value);t?this.showError("name",t):this.clearError("name")}));const s=()=>{const{endError:t,startError:e}=this.validateDates(n.value,i.value);e?this.showError("startTime",e):this.clearError("startTime"),t?this.showError("endTime",t):this.clearError("endTime")};null==n||n.addEventListener("change",s),null==i||i.addEventListener("change",s),null==r||r.addEventListener("change",(()=>{const t=this.validateProgress(Number(r.value));t?this.showError("progress",t):this.clearError("progress")}))}showError(t,e){var n,i;const r=this.form.querySelector(`[name="${t}"]`),s=this.chartContext.createElement("div");s.className="form-error",s.textContent=e;const o=null==(n=r.parentElement)?void 0:n.querySelector(".form-error");null==o||o.remove(),null==(i=r.parentElement)||i.appendChild(s),r.classList.add("invalid"),this.errors.push({field:t,message:e}),this.updateSubmitButton()}updateSubmitButton(){if(this.submitButton||(this.submitButton=this.form.querySelector(".btn-primary")),this.submitButton){const t=this.errors.length>0;this.submitButton.disabled=t,this.submitButton.classList.toggle("btn-disabled",t)}}validateDates(t,e){const n={endError:null,startError:null},i=w(t),r=w(e);return t||(n.startError=this.messages.validationStartRequired),e||(n.endError=this.messages.validationEndRequired),i.isValid()&&r.isValid()&&r.isBefore(i)&&(n.endError=this.messages.validationEndAfterStart),n}validateName(t){return t.trim()?null:this.messages.validationNameRequired}validateProgress(t){return t||0===t?isNaN(t)||t<0||t>100?this.messages.validationProgressRange:null:this.messages.validationProgressRequired}getElement(){return this.form}}const vt=12,yt=5,xt=14,wt=6;function kt(t,e,n,i,r,s){return`<div class="tooltip-content" style="${`background-color: ${e}; color: ${i};`}">${t}</div><div class="tooltip-arrow ${"above"===s?"arrow-below":"arrow-above"}" style="${`left: ${r}px; background-color: ${e};`}"></div>`}const Ct=new Map;function St(t,e,n,i,r){const s=Ct.get(e);void 0!==s&&(clearTimeout(s),Ct.delete(e));const a=o(t,e);a.classList.add("apexgantt-tooltip"),a.innerHTML=kt(i,r.bgColor,r.borderColor,r.fontColor,0,"above");const l=[r.fontFamily?`font-family: ${r.fontFamily};`:"",r.fontSize?`font-size: ${r.fontSize};`:"",r.fontWeight?`font-weight: ${r.fontWeight};`:""].filter(Boolean).join(" ");a.setAttribute("style",`position: absolute; left: -9999px; top: -9999px; visibility: hidden; opacity: 0; display: block; ${l}`);const d=n.getBoundingClientRect(),h=a.getBoundingClientRect(),c=function(t,e,n,i){const r=t.left+t.width/2,s=t.top>=n+vt+wt?"above":"below";let o=r-e/2;const a=i.width-e-wt;o=Math.min(Math.max(wt,o),Math.max(wt,a));const l="above"===s?t.top-n-vt:t.top+t.height+vt;let d=r-o;return d=Math.min(Math.max(xt,d),e-xt),{left:o+i.scrollX,top:l+i.scrollY,placement:s,arrowLeft:d-yt}}({left:d.left,top:d.top,width:d.width,height:d.height},h.width,h.height,{width:window.innerWidth,height:window.innerHeight,scrollX:window.scrollX||document.documentElement.scrollLeft,scrollY:window.scrollY||document.documentElement.scrollTop});a.innerHTML=kt(i,r.bgColor,r.borderColor,r.fontColor,c.arrowLeft,c.placement),a.setAttribute("style",`position: absolute; left: ${c.left}px; top: ${c.top}px; ${l}`),a.classList.add("visible"),a.setAttribute("aria-hidden","false")}function Mt(t,e,n,i,r,s){const a=Ct.get(e);void 0!==a&&(clearTimeout(a),Ct.delete(e));const l=o(t,e);l.classList.add("apexgantt-tooltip");const d=`background-color: ${s.bgColor}; color: ${s.fontColor};`;l.innerHTML=`<div class="tooltip-content" style="${d}">${r}</div>`;const h=[s.fontFamily?`font-family: ${s.fontFamily};`:"",s.fontSize?`font-size: ${s.fontSize};`:"",s.fontWeight?`font-weight: ${s.fontWeight};`:"",s.maxWidth?`max-width: ${s.maxWidth}px;`:""].filter(Boolean).join(" ");l.setAttribute("style",`position: absolute; left: -9999px; top: -9999px; visibility: hidden; opacity: 0; display: block; ${h}`);const c=l.getBoundingClientRect(),{x:u,y:p}=((t,e,n=300,i=120,r=20,s=20)=>{const o=window.innerWidth,a=window.innerHeight,l=window.scrollX||document.documentElement.scrollLeft,d=window.scrollY||document.documentElement.scrollTop;let h=t+r+l,c=e+s+d;return t+r+n>o&&(h=t-n-r+l),e+s+i>a&&(c=e-i-s+d),h=Math.max(l+5,h),c=Math.max(d+5,c),{x:h,y:c}})(n,i,c.width,c.height,s.cursorOffsetX??12,s.cursorOffsetY??16);l.setAttribute("style",`position: absolute; left: ${u}px; top: ${p}px; ${h}`),l.classList.add("visible"),l.setAttribute("aria-hidden","false")}function Et(t,e){const n=Ct.get(e);void 0!==n&&(clearTimeout(n),Ct.delete(e));const i=t.getElementById(e);i&&(i.removeAttribute("style"),i.classList.remove("visible"),i.setAttribute("aria-hidden","true"),i.innerHTML="")}class Tt{constructor(t,e,n,i,r,s){this.task=t,this.geometry=e,this.options=n,this.index=i,this.chartContext=r,this.dataManager=s,this.tooltipHandler=null}static calculateWidth(t,e,n){const{barMargin:i,rowHeight:r}=n;if(t.type===Jt.Milestone)return(r-i)/2;const s=n.inputDateFormat,o=U(t.showSummaryBar?t.summaryStart:t.startTime,s),a=U(t.showSummaryBar?t.summaryEnd:t.endTime,s),l=o.valueOf();return((Y(s)?a.valueOf():a.add(1,"day").valueOf())-l)*e.pixelsPerMs}static calculateX(t,e,n){const i=t.showSummaryBar?t.summaryStart:t.startTime;if(t.type===Jt.Milestone){const{barMargin:t,rowHeight:r}=n,s=(r-t)/4*-1;return e.leftForDate(i,0)+s}const r=Tt.calculateWidth(t,e,n);return e.leftForDate(i,r)}get messages(){return mt(this.options)}get dateLocaleName(){var t,e;return null==(e=null==(t=this.options.locale)?void 0:t.dateLocale)?void 0:e.name}hasBaseline(){var t;return!(!(null==(t=this.options.baseline)?void 0:t.enabled)||!this.task.baseline)}calculateHeight(){const{barMargin:t,rowHeight:e}=this.options;return this.task.type===Jt.Milestone?(e-t)/2:this.hasBaseline()?e-2*t-6-2:e-2*t}attachHoverTooltip(t,e){if(!this.options.enableTooltip)return;const{tooltipBGColor:n,tooltipBorderColor:i,fontColor:r,fontFamily:s,fontSize:o,fontWeight:a,tooltipId:l}=this.options;t.addEventListener("mouseenter",(()=>{const d=e();d&&St(this.chartContext,l,t,d,{bgColor:n,borderColor:i,fontColor:r,fontFamily:s,fontSize:o,fontWeight:a})})),t.addEventListener("mouseleave",(()=>{!function(t,e,n=100){const i=Ct.get(e);void 0!==i&&clearTimeout(i);const r=setTimeout((()=>{Ct.delete(e),Et(t,e)}),n);Ct.set(e,r)}(this.chartContext,l)}))}setupTooltip(t){const{tooltipTemplate:e,inputDateFormat:n}=this.options;this.attachHoverTooltip(t,(()=>{if(!e)return null;const t=this.dataManager.getTaskById(this.task.id);return t?e(t,n):null}))}setupBaselineTooltip(t){const{inputDateFormat:e}=this.options;this.attachHoverTooltip(t,(()=>{const t=this.dataManager.getTaskById(this.task.id),n=null==t?void 0:t.baseline;if(!t||!n)return null;const i=U(n.start,e).format(e),r=U(n.end,e).format(e),s=this.messages;return`\n <div>\n <strong>${s.baselineLabel}</strong>\n <span>${t.name}</span>\n </div>\n <div>\n <strong>${s.startLabel}</strong>\n <span>${i}</span>\n </div>\n <div>\n <strong>${s.endLabel}</strong>\n <span>${r}</span>\n </div>\n `}))}setupTaskEdit(t,e){if(!this.options.enableTaskEdit)return;const n=this.chartContext.getInstanceId();t.addEventListener("dblclick",(t=>{t.stopPropagation(),t.preventDefault();const i=this.dataManager.getTaskById(this.task.id);if(!i)return void R.error(`[${n}] Task not found in dataManager: ${this.task.id}`);const r=this.chartContext.getChartContainer();if(!r)return;const s=new bt(this.chartContext,this.dataManager,i,r,(t=>{null==e||e(i.id,t,{label:"Edit task"}),a.hide()}),this.options.inputDateFormat,this.messages),o=`taskDialog-${n}-${this.task.id}`,a=new at(this.chartContext,{closeOnClickOutside:!1,closeOnEscape:!0,content:s.getElement(),id:o,modal:!0,title:this.messages.editTaskTitle(this.task.name),width:"400px",positionRelativeToChart:!0});a.show()}))}setupInteractions(t,e){const{enableTaskDrag:n,enableTaskResize:i,enableProgressDrag:r}=this.options;if(n&&this.makeDraggable(t,e),i&&this.task.type===Jt.Task){const n=l(this.chartContext,{className:"bar-handle handle-left"}),i=l(this.chartContext,{className:"bar-handle handle-right"});t.append(n,i),this.makeResizable(t,e)}if(r&&this.task.type===Jt.Task){const n=l(this.chartContext,{className:"bar-progress-handle"}),i=this.task.progress??0;n.setAttribute("style",`${this.geometry.rtl?"right":"left"}: ${i}%;`),n.setAttribute("role","slider"),n.setAttribute("aria-label",this.messages.progressAriaLabel(this.task.name)),n.setAttribute("aria-valuemin","0"),n.setAttribute("aria-valuemax","100"),n.setAttribute("aria-valuenow",String(Math.round(i))),t.append(n);const r=l(this.chartContext,{className:"bar-progress-handle-label"});r.setAttribute("style",`left: ${i}%;`),r.setAttribute("aria-hidden","true"),r.textContent=`${Math.round(i)}%`,t.append(r),this.makeProgressDraggable(t,n,e)}}drawRollups(){if(!this.options.enableRollups||!this.task.showSummaryBar)return[];const{rowHeight:t,barBackgroundColor:e,milestoneColor:n}=this.options,i=Math.round((t-8)/2)+8+2+this.index*t,r=i+2,s=this.dataManager.getNestedChildTasks(this.task.id),o=[];for(const t of s){if(t.showSummaryBar)continue;if(!t.startTime)continue;const s=t.type===Jt.Milestone,d=l(this.chartContext,{className:"bar-rollup"});if(s){const e=this.geometry.leftForDate(t.startTime,0),i=t.barBackgroundColor||n;d.classList.add("bar-rollup-milestone"),d.setAttribute("style",a({backgroundColor:i,borderRadius:"1px",height:"7px",left:e-3.5+"px",opacity:"0.85",pointerEvents:"none",position:"absolute",top:r-3.5+"px",transform:"rotate(45deg)",width:"7px"}))}else{if(!t.endTime)continue;const n=Tt.calculateX(t,this.geometry,this.options),r=Math.max(2,Tt.calculateWidth(t,this.geometry,this.options)),s=t.barBackgroundColor||e;d.setAttribute("style",a({backgroundColor:s,borderRadius:"2px",height:"4px",left:`${n}px`,opacity:"0.7",pointerEvents:"none",position:"absolute",top:`${i}px`,width:`${r}px`}))}d.setAttribute("data-rollup-for",this.task.id),d.setAttribute("aria-hidden","true"),o.push(d)}return o}drawSummaryBar(t){const{summaryBarColor:e,rowHeight:n}=this.options,i=l(this.chartContext,{className:"bar-timeline bar-summary"+(this.geometry.rtl?" bar-rtl":"")}),r=this.task.barBackgroundColor||e,s=h(r,{l:-15}),o=Tt.calculateX(this.task,this.geometry,this.options),d=Tt.calculateWidth(this.task,this.geometry,this.options),c=Math.round((n-8)/2)+this.index*n,u=this.task.progress??0,p=u>0?s:r,m=u>=100?s:r,g=!!t&&this.dataManager.hasChildren(this.task.id),f=a({"--summary-bar-color":r,"--summary-cap-left-color":p,"--summary-cap-right-color":m,left:`${o}px`,top:`${c}px`,width:`${d}px`,...g?{cursor:"pointer"}:{}});if(i.setAttribute("style",f),i.setAttribute("data-taskid",this.task.id),i.setAttribute("data-chart-instance",this.chartContext.getInstanceId()),i.setAttribute("role",g?"button":"group"),i.setAttribute("aria-label",this.messages.summaryAriaLabel({canToggle:g,collapsed:!!this.task.collapsed,name:this.task.name})),i.setAttribute("aria-expanded",this.task.collapsed?"false":"true"),i.setAttribute("tabindex","0"),u>0){const t=l(this.chartContext,{className:"bar-timeline-progress"}),e=a({backgroundColor:s,width:`${u}%`});t.setAttribute("style",e),i.appendChild(t)}if(this.appendDependencyAnchors(i),this.setupTooltip(i),g&&t){const e=()=>{this.dataManager.toggleTask(this.task.id),t()};i.addEventListener("click",(t=>{t.stopPropagation(),e()})),i.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e())}))}return i}drawBar(e=t,n){if(this.task.showSummaryBar)return this.drawSummaryBar(n);const{barBackgroundColor:i,barBorderRadius:r,barLabel:s}=this.options,o=l(this.chartContext,{className:"bar-timeline"+(this.geometry.rtl?" bar-rtl":"")}),d=Tt.calculateWidth(this.task,this.geometry,this.options),c=function(t,e,n,i){const r=t.position??"right";if("auto"!==r)return r;if(t.render)return"right";const s=e[t.field??"name"];if(null==s)return"inside";const o=String(s),a=parseFloat(i),l=.55*(Number.isFinite(a)?a:14);return o.length*l+12>n?"right":"inside"}(s,this.task,d,this.options.fontSize),u=["bar-label"];"inside"!==c&&u.push("bar-label-outside",`bar-label-outside-${c}`),s.className&&u.push(s.className);const p=l(this.chartContext,{className:u.join(" ")});z(p,s,this.task);const m=l(this.chartContext,{className:"bar-timeline-progress"}),g=this.task.barBackgroundColor||i,f=a(this.getBarStyles(g)),b=a({backgroundColor:h(g,{l:-15}),borderRadius:r,width:`${this.task.progress}%`}),v=this.chartContext.getInstanceId();o.setAttribute("data-taskid",this.task.id),o.setAttribute("data-chart-instance",v),m.setAttribute("style",b),o.setAttribute("style",f);const y=U(this.task.startTime,this.options.inputDateFormat),x=U(this.task.endTime,this.options.inputDateFormat),w=this.dateLocaleName,k=V(y,w).format("MMMM D, YYYY"),C=V(x,w).format("MMMM D, YYYY"),S=y.valueOf(),M=x.valueOf(),E=x.diff(y,"day"),{enableTaskDrag:T,enableTaskResize:A,enableTaskEdit:D}=this.options,I=A&&this.task.type===Jt.Task,$=T||I;($||D)&&o.classList.add("bar-interactive"),$?(o.setAttribute("role","slider"),o.setAttribute("aria-label",this.messages.barAriaLabel({end:C,name:this.task.name,start:k})),o.setAttribute("aria-valuenow",S.toString()),o.setAttribute("aria-valuemin",S.toString()),o.setAttribute("aria-valuemax",M.toString()),o.setAttribute("aria-valuetext",this.messages.barAriaValueText({durationDays:E,end:C,start:k})),o.setAttribute("aria-grabbed","false"),T&&o.setAttribute("aria-dropeffect","move")):(o.setAttribute("role","progressbar"),o.setAttribute("aria-label",this.messages.barAriaLabel({end:C,name:this.task.name,progress:this.task.progress,start:k})),o.setAttribute("aria-valuenow",this.task.progress.toString()),o.setAttribute("aria-valuemin","0"),o.setAttribute("aria-valuemax","100")),o.setAttribute("tabindex","0"),this.task.type!==Jt.Milestone&&o.append(p);const F=this.buildSplitSegments(g,d);return F?(o.classList.add("bar-split"),o.append(...F)):o.append(m),this.task.type!==Jt.Milestone&&this.appendDependencyAnchors(o),this.setupTaskEdit(o,e),this.setupTooltip(o),this.setupInteractions(o,e),o.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),o.dispatchEvent(new MouseEvent("dblclick",{bubbles:!0})))})),o}drawBaselineBar(){if(!this.hasBaseline())return null;const{barBorderRadius:t,barMargin:e,rowHeight:n}=this.options,i=this.task.baseline,r={...this.task,startTime:i.start,endTime:i.end,type:Jt.Task},s=Tt.calculateX(r,this.geometry,this.options),o=Tt.calculateWidth(r,this.geometry,this.options),d=e+this.calculateHeight()+2+this.index*n,h=l(this.chartContext,{className:"bar-baseline"});h.setAttribute("aria-hidden","true"),h.setAttribute("data-taskid-baseline",this.task.id);const c=a({borderRadius:t,cursor:"default",height:"6px",left:`${s}px`,top:`${d}px`,width:`${o}px`,...this.getBaselineFillStyles()});return h.setAttribute("style",c),this.setupBaselineTooltip(h),h}getBaselineFillStyles(){const{color:t,striped:e,stripeColor:n,stripeWidth:i,stripeAngle:r}=this.options.baseline,s=t??this.getBarProgressColor();if(!e)return{backgroundColor:s};const o=`${i}px`;return{backgroundColor:n,backgroundImage:`repeating-linear-gradient(${r}deg, ${s} 0, ${s} ${o}, ${n} ${o}, ${n} ${2*i+"px"})`}}getBarProgressColor(){return h(this.task.barBackgroundColor||this.options.barBackgroundColor,{l:-15})}buildSplitSegments(t,e){const{barBorderRadius:n}=this.options,i=this.options.inputDateFormat,r=this.task.segments;if(this.task.type===Jt.Milestone||!r||r.length<2)return null;const s=t=>U(t,i).valueOf(),o=t=>Y(i)?s(t):U(t,i).add(1,"day").valueOf(),d=this.geometry.pixelsPerMs,c=this.geometry.rtl,u=s(r[0].start),p=o(r[r.length-1].end),m=h(t,{l:-15}),g=r.map((t=>({startMs:s(t.start),finishMs:o(t.end)}))),f=g.reduce(((t,e)=>t+(e.finishMs-e.startMs)),0);let b=Math.max(0,Math.min(100,this.task.progress))/100*f;const v=[],y=l(this.chartContext,{className:"bar-split-connector"});y.setAttribute("style",a({width:`${e}px`})),v.push(y);for(const e of g){const i=(e.finishMs-e.startMs)*d,r=c?(p-e.finishMs)*d:(e.startMs-u)*d,s=l(this.chartContext,{className:"bar-segment"});s.setAttribute("style",a({backgroundColor:t,borderRadius:n,left:`${r}px`,width:`${i}px`}));const o=e.finishMs-e.startMs,h=Math.max(0,Math.min(o,b));if(b-=h,h>0&&o>0){const t=l(this.chartContext,{className:"bar-segment-progress"});t.setAttribute("style",a({backgroundColor:m,borderRadius:n,width:h/o*100+"%"})),s.append(t)}v.push(s)}return v}getBarStyles(t){const{barBackgroundColor:e,barBorderRadius:n,barMargin:i,barTextColor:r,milestoneColor:s,rowHeight:o}=this.options,a=Tt.calculateX(this.task,this.geometry,this.options),l=Tt.calculateWidth(this.task,this.geometry,this.options),d=this.calculateHeight(),h=t||e;if(this.task.type===Jt.Milestone){return{backgroundColor:this.task.barBackgroundColor||s,borderRadius:"2px",color:r,height:`${d}px`,left:`${a}px`,top:o/3-i/2+this.index*o+"px",transform:"rotate(45deg)",width:`${l}px`}}return{backgroundColor:h,borderRadius:n,color:r,height:`${d}px`,left:`${a}px`,top:`${i+this.index*o}px`,width:`${l}px`}}appendDependencyAnchors(t){var e;if(!(null==(e=this.options.dependencies)?void 0:e.editable))return;const n="data-taskid",i="aria-hidden",r=l(this.chartContext,{className:"bar-dep-anchor bar-dep-anchor-start"});r.setAttribute("data-bar-anchor","start"),r.setAttribute(n,this.task.id),r.setAttribute(i,"true");const s=l(this.chartContext,{className:"bar-dep-anchor bar-dep-anchor-end"});s.setAttribute("data-bar-anchor","finish"),s.setAttribute(n,this.task.id),s.setAttribute(i,"true"),t.append(r,s)}makeDraggable(t,e){new rt(this.task.id,this.options,this.geometry.pixelsPerMs,this.chartContext,this.dataManager,this.geometry.rtl).makeDraggable(t,e)}makeResizable(t,e){new ot(this.task.id,this.options,this.geometry.pixelsPerMs,this.chartContext,this.dataManager,this.geometry.rtl).makeResizable(t,e)}makeProgressDraggable(t,e,n){new st(this.task.id,this.options,this.chartContext,this.dataManager,this.geometry.rtl).makeProgressDraggable(t,e,n)}cleanup(){this.tooltipHandler&&(this.tooltipHandler.cleanup(),this.tooltipHandler=null)}}function At(t){return null==t?"":String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Dt(t){const{value:e,size:n=28,strokeWidth:i=3,progressColor:r="#3B82F6",trackColor:s="#E5E7EB",showLabel:o=!0,labelColor:a}=t,l=Math.max(0,Math.min(100,Number.isFinite(e)?e:0)),d=(n-i)/2,h=2*Math.PI*d,c=n/2,u=n/2,p=h*(1-l/100),m=o?`<text x="${c}" y="${u}" text-anchor="middle" dominant-baseline="central" font-size="${Math.round(.32*n)}" font-weight="600" fill="${a?At(a):"currentColor"}">${l}</text>`:"";return`<svg class="apexgantt-progress-ring" width="${n}" height="${n}" viewBox="0 0 ${n} ${n}" role="img" aria-label="${l} percent complete" style="vertical-align:middle"><circle cx="${c}" cy="${u}" r="${d}" stroke="${At(s)}" stroke-width="${i}" fill="none" /><circle cx="${c}" cy="${u}" r="${d}" stroke="${At(r)}" stroke-width="${i}" fill="none" stroke-linecap="round" stroke-dasharray="${h}" stroke-dashoffset="${p}" transform="rotate(-90 ${c} ${u})" />`+m+"</svg>"}var It=(t=>(t.Assignees="assignees",t.BaselineEnd="baselineEnd",t.BaselineStart="baselineStart",t.BaselineVariance="baselineVariance",t.Duration="duration",t.EndTime="endTime",t.Name="name",t.Predecessors="predecessors",t.Progress="progress",t.ProgressRing="progressRing",t.StartTime="startTime",t.Successors="successors",t.Wbs="wbs",t))(It||{});const $t=new Set(Object.values(It));function Ft(t){return $t.has(t)}const Bt={assignees:"Assignees",baselineEnd:"Baseline End",baselineStart:"Baseline Start",baselineVariance:"Variance",duration:"Duration",endTime:"End",name:"Task Name",predecessors:"Predecessors",progress:"Progress",progressRing:"Progress",startTime:"Start",successors:"Successors",wbs:"WBS"},Lt=[{key:"name",title:Bt.name,minWidth:"120px",flexGrow:3},{key:"startTime",title:Bt.startTime,minWidth:"70px",flexGrow:1.5},{key:"duration",title:Bt.duration,minWidth:"50px",flexGrow:1},{key:"progress",title:Bt.progress,minWidth:"50px",flexGrow:1}];function Rt(t,e=Lt){if(!t||0===t.length)return e;const n=t.map((t=>{const n=e.find((e=>e.key===t.key));return n?{...n,...t}:t})).filter((t=>!1!==t.visible));return 0===n.length?e:n}function Ht(t,e){if(!e||0===e.length)return t;const n=new Map(e.map(((t,e)=>[t,e]))),i=e.length;return t.map(((t,e)=>({col:t,i:e}))).sort(((t,e)=>(n.get(String(t.col.key))??i)-(n.get(String(e.col.key))??i)||t.i-e.i)).map((t=>t.col))}function Pt(t){return(t.assignees??[]).map((t=>t.name)).join(", ")}function zt(t,e){var n;const i=null==(n=t.baseline)?void 0:n.end,r=t.showSummaryBar?t.summaryEnd:t.endTime;if(!i||!r)return;const s=U(i,e).valueOf(),o=U(r,e).valueOf();return Math.round((o-s)/tt)}function Ot(t,e,n,i,r){const s=i??{unit:"day",value:1},o=function(t,e){return"minute"===t.unit?"m":"hour"===t.unit?"h":e?"wd":"d"}(s,"day"===s.unit&&!r.isNoOp);if(!t||!e)return`0 ${o}`;const a=Math.max(1,s.value),l=!Y(n);if("day"===s.unit){const n=r.workingDaysBetween(t,e,{inclusive:l});return`${Math.max(0,Math.round(n/a))} ${o}`}const d=U(t,n).valueOf(),h=U(e,n).valueOf(),c=("minute"===(u=s.unit)?Q:"hour"===u?J:tt)*a;var u;const p=l?c:0;return`${Math.max(0,Math.round((h-d+p)/c))} ${o}`}function Wt(t,e,n,i,r=K){const s=function(t,e,n){var i,r;switch(e){case"assignees":return At(Pt(t));case"predecessors":return t.predecessors??"";case"successors":return t.successors??"";case"baselineStart":return(null==(i=t.baseline)?void 0:i.start)?U(t.baseline.start,n).format(n):"";case"baselineEnd":return(null==(r=t.baseline)?void 0:r.end)?U(t.baseline.end,n).format(n):"";case"baselineVariance":{const e=zt(t,n);return void 0===e?"":`${e>0?"+":""}${e} d`}default:return}}(t,e,n);if(void 0!==s)return s;const o=t.showSummaryBar?t.summaryStart:t.startTime,a=t.showSummaryBar?t.summaryEnd:t.endTime;switch(e){case"startTime":return o?U(o,n).format(n):"";case"endTime":return a?U(a,n).format(n):"";case"duration":return Ot(o,a,n,i,r);case"progress":return`${t.progress??0}%`;case"progressRing":return Dt({value:t.progress??0});case"wbs":return t.wbs??"";default:return t[e]}}function Nt(t,e,n,i,r=K){const{key:s}=e;if(!Ft(s)&&e.accessor){const n=e.accessor(t);return null==n?"":String(n)}return Wt(t,s,n,i,r)}function qt(t,e){const n=t.getInstanceId(),i=`.tasks-container .tasks-data-row[data-taskid="${e}"][data-chart-instance="${n}"]`,r=t.querySelector(i);return r||R.warn(`[${n}] Task row element not found for task: ${e}`),r}function Yt(t,e){return(null==e?void 0:e.length)?e[t%e.length]:"transparent"}function Ut(t,e,n){const i=qt(t,e),r=W(t,e);i&&(i.style.backgroundColor=n),r&&(r.style.backgroundColor=n)}const jt=(t,e,n,i,r,s,o)=>{const{taskBar:a,taskBarRow:l,taskRow:d}=((t,e)=>{const n=qt(t,e);return{taskBar:O(t,e),taskBarRow:W(t,e),taskRow:n}})(t,n);if(!d||!a)return;const c=e.updateTask(n,i);if(!c)return;if(d.querySelectorAll(".tasks-data-cell").forEach((i=>{const s=i.getAttribute("data-columnid");if(!s)return;const a=null==o?void 0:o.columns.find((t=>t.key===s)),l=null==a?void 0:a.render,d=null==o?void 0:o.dispatcher;if(l&&d){const t=Ft(s);if(d.dispatch(l,{task:c,options:r,rowIndex:0,isSummary:!!c.showSummaryBar&&e.hasChildren(n),isMilestone:c.type===Jt.Milestone},i),!t)return}else{const t={unit:r.snapUnit,value:r.snapValue};i.innerHTML=a?Nt(c,a,r.inputDateFormat,t,e.getCalendar()):Wt(c,s,r.inputDateFormat,t,e.getCalendar())}if("name"===s)if(e.hasChildren(n)){const r=t.createElement("span");r.className="task-toggle-icon "+(c.collapsed?"collapsed":"expanded"),r.addEventListener("click",(()=>{var t;e.toggleTask(n),null==(t=null==o?void 0:o.onToggleCollapse)||t.call(o)})),i.prepend(r)}else{const e=t.createElement("span");e.className="task-toggle-icon-blank",i.prepend(e)}})),i.rowBackgroundColor&&l&&(d.style.backgroundColor=i.rowBackgroundColor,l.style.backgroundColor=i.rowBackgroundColor),i.barBackgroundColor&&(a.style.backgroundColor=i.barBackgroundColor),i.startTime||i.endTime){const t=Tt.calculateX(c,s,r),e=Tt.calculateWidth(c,s,r);a.style.left=`${t}px`,a.style.width=`${e}px`}if(void 0!==i.progress){const t=a.querySelector(".bar-timeline-progress");t&&(t.style.width=`${i.progress}%`),i.barBackgroundColor&&(t.style.backgroundColor=h(i.barBackgroundColor,{l:-15}));const e=a.querySelector(".bar-progress-handle");e&&(e.style.left=`${i.progress}%`,e.setAttribute("aria-valuenow",String(Math.round(i.progress))));const n=a.querySelector(".bar-progress-handle-label");n&&(n.style.left=`${i.progress}%`,n.textContent=`${Math.round(i.progress)}%`)}if(void 0!==i.name){const t=a.querySelector(".bar-label");t&&z(t,r.barLabel,c)}void 0===i.startTime&&void 0===i.endTime&&void 0===i.type||e.updateDependencyArrows(n,t)},Vt=(t,e,n,i,r,s)=>{const o=t.getInstanceId(),a=e.getTaskById(n);if(!a)return;let l=a.parentId?e.getTaskById(a.parentId)??null:null;for(;l;){if(l.showSummaryBar){const n=l,a=`.tasks-container .tasks-data-row[data-taskid="${n.id}"][data-chart-instance="${o}"]`,d=t.querySelector(a);d&&d.querySelectorAll(".tasks-data-cell").forEach((t=>{const r=t.getAttribute("data-columnid");if(!r||"name"===r)return;const o=null==s?void 0:s.columns.find((t=>t.key===r)),a=null==o?void 0:o.render,l=null==s?void 0:s.dispatcher;if(a&&l)return void l.dispatch(a,{task:n,options:i,rowIndex:0,isSummary:!0,isMilestone:!1},t);const d={unit:i.snapUnit,value:i.snapValue};t.innerHTML=o?Nt(n,o,i.inputDateFormat,d,e.getCalendar()):Wt(n,r,i.inputDateFormat,d,e.getCalendar())}));const c=`.bar-container .bar-timeline[data-taskid="${n.id}"][data-chart-instance="${o}"]`,u=t.querySelector(c);if(u){const e=Tt.calculateX(n,r,i),s=Tt.calculateWidth(n,r,i);u.style.left=`${e}px`,u.style.width=`${s}px`;const o=n.progress??0,a=n.barBackgroundColor||i.summaryBarColor,l=h(a,{l:-15}),d=o>0?l:a,c=o>=100?l:a;u.style.setProperty("--summary-bar-color",a),u.style.setProperty("--summary-cap-left-color",d),u.style.setProperty("--summary-cap-right-color",c);let p=u.querySelector(".bar-timeline-progress");o>0?(p||(p=t.createElement("div"),p.className="bar-timeline-progress",u.appendChild(p)),p.style.backgroundColor=l,p.style.width=`${o}%`):p&&p.remove()}}l.showSummaryBar&&e.updateDependencyArrows(l.id,t),l=l.parentId?e.getTaskById(l.parentId)??null:null}};function _t(t,e){const n=null==t||""===t,i=null==e||""===e;return n&&i?0:n?1:i?-1:"number"==typeof t&&"number"==typeof e?t-e:t instanceof Date&&e instanceof Date?t.valueOf()-e.valueOf():String(t).localeCompare(String(e))}function Gt(t,e,n,i){var r,s;const o=t.showSummaryBar?t.summaryStart:t.startTime,a=t.showSummaryBar?t.summaryEnd:t.endTime,l=t=>t?U(t,i.inputDateFormat).valueOf():void 0;if(Ft(e))switch(e){case It.Name:return(t.name??"").toLowerCase();case It.StartTime:return l(o);case It.EndTime:return l(a);case It.Duration:{const t=l(o),e=l(a);return void 0!==t&&void 0!==e?e-t:void 0}case It.Progress:case It.ProgressRing:return t.progress??0;case It.Wbs:return t.wbs??"";case It.Assignees:return Pt(t).toLowerCase();case It.Predecessors:return t.predecessors??"";case It.Successors:return t.successors??"";case It.BaselineStart:return l(null==(r=t.baseline)?void 0:r.start);case It.BaselineEnd:return l(null==(s=t.baseline)?void 0:s.end);case It.BaselineVariance:return zt(t,i.inputDateFormat);default:return}return(null==n?void 0:n.accessor)?n.accessor(t):void 0}function Kt(t){return void 0!==t.sortable?t.sortable:Ft(t.key)?t.key!==It.Wbs:Boolean(t.accessor||t.comparator)}const Xt={zoomIn:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <circle cx="11" cy="11" r="8"/>\n <path d="m21 21-4.35-4.35"/>\n <line x1="11" y1="8" x2="11" y2="14"/>\n <line x1="8" y1="11" x2="14" y2="11"/>\n </svg>',zoomOut:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <circle cx="11" cy="11" r="8"/>\n <path d="m21 21-4.35-4.35"/>\n <line x1="8" y1="11" x2="14" y2="11"/>\n </svg>',calendar:'<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <rect x="3" y="4" width="18" height="18" rx="2" ry="2"/>\n <line x1="16" y1="2" x2="16" y2="6"/>\n <line x1="8" y1="2" x2="8" y2="6"/>\n <line x1="3" y1="10" x2="21" y2="10"/>\n </svg>',chevronDown:'<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <polyline points="6 9 12 15 18 9"/>\n </svg>',download:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>\n <polyline points="7 10 12 15 17 10"/>\n <line x1="12" y1="15" x2="12" y2="3"/>\n </svg>',plus:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <line x1="12" y1="5" x2="12" y2="19"/>\n <line x1="5" y1="12" x2="19" y2="12"/>\n </svg>',filter:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <polygon points="22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"/>\n </svg>',close:'<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <line x1="18" y1="6" x2="6" y2="18"/>\n <line x1="6" y1="6" x2="18" y2="18"/>\n </svg>',trash:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <polyline points="3 6 5 6 21 6"/>\n <path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/>\n <path d="M10 11v6"/>\n <path d="M14 11v6"/>\n <path d="M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"/>\n </svg>',undo:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M3 7v6h6"/>\n <path d="M21 17a9 9 0 0 0-15-6.7L3 13"/>\n </svg>',redo:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M21 7v6h-6"/>\n <path d="M3 17a9 9 0 0 1 15-6.7L21 13"/>\n </svg>'};function Zt(t){return"minute"===t?Q:"hour"===t?J:tt}const Qt="data-chart-instance";var Jt=(t=>(t.Milestone="milestone",t.Task="task",t))(Jt||{});function te(t){return"string"==typeof t?{taskId:t,type:"FS",lag:0}:{taskId:t.taskId,type:t.type??"FS",lag:t.lag??0}}class ee{constructor(t,e,n,i,r,s,o,a,l,d,h,c,u,p,m){this.options=t,this.chartContext=e,this.dataManager=n,this.selectionManager=i,this.commitInlineEdit=r,this.columnRenderManager=s,this.onAddTaskRowClick=o,this.onHeaderSort=a,this.getActiveSort=l,this.columnWidths=d,this.onColumnResize=c,this.columnOrder=u,this.onColumnReorder=p,this.onRowActivate=m,this.activeInlineEditor=null,this.selectionEnabled=t.enableSelection,this.showCheckbox=t.enableSelection&&t.showCheckboxColumn,this.inlineEditEnabled=t.enableInlineEdit&&!!r,this.columnsResizable=t.resizableColumns&&!!c,this.columnsReorderable=t.reorderableColumns&&!!p,this.columnWidthOverrides=new Map(h??[]),this.effectiveColumnList=this.mergeColumnConfig(),this.injectDynamicColumnStyles()}mergeColumnConfig(){return Ht(Rt(this.options.columnConfig),this.columnOrder)}injectDynamicColumnStyles(){const t=(e=this.effectiveColumnList,n=this.columnWidths,i=this.columnWidthOverrides,e.map((t=>{const e=null==i?void 0:i.get(String(t.key));if(void 0!==e)return`${e}px`;const r=null==n?void 0:n.get(String(t.key));if(void 0!==r)return`minmax(${Math.min(r,32)}px, ${r}fr)`;const s=t.flexGrow||1;return`minmax(${t.minWidth||"30px"}, ${s}fr)`})).join(" "));var e,n,i;const r=this.showCheckbox?"28px ":"",s=this.chartContext.getInstanceId(),o=`\n .tasks-container .tasks-header[data-chart-instance="${s}"] .tasks-header-row {\n grid-template-columns: ${r}${t};\n }\n\n .tasks-container .tasks-data-row[data-chart-instance="${s}"] {\n grid-template-columns: ${r}${t};\n }\n `;this.chartContext.injectStyles(o,`tasks-dynamic-columns-${s}`,{priority:"high",force:!0})}generateBody(t,e,n){const i=l(this.chartContext,{className:"tasks-data-container"}),r=n?n.allTasks:t;return i.setAttribute("role","treegrid"),i.setAttribute("aria-label",this.options.taskListAriaLabel??"Gantt task list"),i.setAttribute("aria-rowcount",r.length.toString()),n?this.generateRowsVirtualized(r,i,e,n.range,n.rowHeight):this.generateRows(t,i,e),i}generateHeader(t){var e;const n=l(this.chartContext,{className:"tasks-header"}),i=l(this.chartContext,{className:"tasks-header-row"}),{rowHeight:r}=this.options,s=this.chartContext.getInstanceId();if(n.setAttribute(Qt,s),this.showCheckbox){const t=l(this.chartContext,{className:"tasks-header-cell gantt-checkbox-cell"});t.style.height=2*r+"px";const e=this.chartContext.createElement("input");e.type="checkbox",e.className="gantt-select-all-checkbox",e.setAttribute("aria-label","Select all tasks"),e.addEventListener("change",(()=>{this.selectionManager&&(e.checked?this.selectionManager.selectAll():this.selectionManager.clearSelection())})),t.append(e),i.append(t)}const o=(null==(e=this.getActiveSort)?void 0:e.call(this))??[];return this.effectiveColumnList.forEach(((e,n)=>{const s=l(this.chartContext,{className:"tasks-header-cell"});s.append(l(this.chartContext,{className:"tasks-header-cell-label",content:t[n]??e.title})),s.style.height=2*r+"px",s.style.color="var(--text-color)";if(Boolean(this.onHeaderSort)&&Kt(e)){const t=o.findIndex((t=>t.key===e.key)),n=t>=0?o[t]:null,i=n?n.direction??"asc":null,r=o.length>1&&t>=0;s.classList.add("tasks-header-cell-sortable"),s.style.cursor="pointer",s.style.userSelect="none",s.setAttribute("role","button"),s.setAttribute("tabindex","0");const a="asc"===i?"sorted ascending":"desc"===i?"sorted descending":"not sorted",d=r?`, sort position ${t+1}`:"";s.setAttribute("aria-label",`${e.title}, ${a}${d}`);const h=l(this.chartContext,{className:"gantt-sort-caret"});h.setAttribute("aria-hidden","true"),h.innerHTML=`${function(t){const e=null!==t;return`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${e?"2.5":"2"}" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" opacity="${e?"1":"0.4"}">${"desc"===t?'<path d="M12 5v14"/><path d="m19 12-7 7-7-7"/>':'<path d="M12 19V5"/><path d="m5 12 7-7 7 7"/>'}</svg>`}(i)}${r?`<span class="gantt-sort-order">${t+1}</span>`:""}`,s.append(h);const c=t=>{var n;return null==(n=this.onHeaderSort)?void 0:n.call(this,e.key,{append:t})};s.addEventListener("click",(t=>c(t.shiftKey))),s.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),c(t.shiftKey))}))}this.columnsResizable&&!1!==e.resizable&&this.appendColumnResizeHandle(s,e),this.columnsReorderable&&this.attachColumnReorder(s,String(e.key)),i.append(s)})),n.append(i),n.style.background="var(--header-bg-color)",n}appendColumnResizeHandle(t,e){const n=String(e.key),i=l(this.chartContext,{className:"gantt-column-resize-handle"});i.setAttribute("role","separator"),i.setAttribute("aria-orientation","vertical"),i.setAttribute("aria-label",`Resize ${e.title} column`),i.addEventListener("click",(t=>t.stopPropagation())),i.addEventListener("dblclick",(t=>{var e;t.preventDefault(),t.stopPropagation(),this.columnWidthOverrides.delete(n),this.injectDynamicColumnStyles(),null==(e=this.onColumnResize)||e.call(this,n,null)})),i.addEventListener("pointerdown",(e=>this.startColumnResize(e,t,n))),t.append(i)}startColumnResize(t,e,n){var i,r;if(null!=t.button&&t.button>0)return;t.preventDefault(),t.stopPropagation();const s=t.clientX,o=e.getBoundingClientRect().width,a="rtl"===getComputedStyle(e).direction;if(null!=t.pointerId)try{null==(r=(i=t.target).setPointerCapture)||r.call(i,t.pointerId)}catch{}const l=t=>{const e=t,i=a?s-e.clientX:e.clientX-s,r=Math.max(40,Math.round(o+i));this.columnWidthOverrides.set(n,r),this.injectDynamicColumnStyles()},d=()=>{var t;this.chartContext.removeEventListener("pointermove",l),this.chartContext.removeEventListener("pointerup",d),this.chartContext.removeEventListener("pointercancel",d),null==(t=this.onColumnResize)||t.call(this,n,this.columnWidthOverrides.get(n)??null)};this.chartContext.addEventListener("pointermove",l),this.chartContext.addEventListener("pointerup",d),this.chartContext.addEventListener("pointercancel",d)}attachColumnReorder(t,e){t.addEventListener("pointerdown",(n=>this.startColumnReorder(n,t,e)))}startColumnReorder(t,e,n){if(null!=t.button&&t.button>0)return;const i=e.parentElement;if(!i)return;const r=t.clientX,s="rtl"===getComputedStyle(e).direction,o=Array.from(i.querySelectorAll(".tasks-header-cell:not(.gantt-checkbox-cell)")),a=o.indexOf(e);if(a<0)return;let d=!1,h=a,c=null;const u=()=>{this.chartContext.removeEventListener("pointermove",p),this.chartContext.removeEventListener("pointerup",m),this.chartContext.removeEventListener("pointercancel",m),e.classList.remove("tasks-header-cell-dragging"),null==c||c.remove()},p=t=>{const n=t;if(!d){if(Math.abs(n.clientX-r)<5)return;d=!0,e.classList.add("tasks-header-cell-dragging"),c=l(this.chartContext,{className:"tasks-column-drop-indicator"}),i.append(c)}h=function(t,e,n){let i=0;for(const r of t){const t=r.getBoundingClientRect(),s=t.left+t.width/2;(n?s>e:s<e)&&i++}return i}(o,n.clientX,s),function(t,e,n,i,r){const s=e.getBoundingClientRect().left,o=n.length;let a;a=r?i<o?n[i].getBoundingClientRect().right:n[o-1].getBoundingClientRect().left:i<o?n[i].getBoundingClientRect().left:n[o-1].getBoundingClientRect().right,t.style.left=a-s+"px"}(c,i,o,h,s)},m=()=>{var t;if(u(),!d)return;e.addEventListener("click",(t=>{t.stopPropagation(),t.preventDefault()}),{capture:!0,once:!0});const i=this.effectiveColumnList.map((t=>String(t.key)));let r=h;if(r>a&&r--,r===a)return;const[s]=i.splice(a,1);i.splice(r,0,s),null==(t=this.onColumnReorder)||t.call(this,n,i)};this.chartContext.addEventListener("pointermove",p),this.chartContext.addEventListener("pointerup",m),this.chartContext.addEventListener("pointercancel",m)}isCellEditable(t,e){return!!this.inlineEditEnabled&&(t.showSummaryBar&&this.dataManager.hasChildren(t.id)?e===It.Name:"milestone"===t.type?e===It.Name||e===It.StartTime:e===It.Name||e===It.StartTime||e===It.EndTime||e===It.Duration||e===It.Progress)}attachInlineEditHandler(t,e,n){t.addEventListener("dblclick",(i=>{i.stopPropagation();const r=this.dataManager.getTaskById(e);r&&this.openInlineEditor(t,r,n)}))}openInlineEditor(t,e,n){var i;this.activeInlineEditor&&this.activeInlineEditor.blur();const r=this.chartContext.createElement("input");r.className="inline-edit-input",this.configureEditorInput(r,e,n);const s=t.innerHTML;t.innerHTML="",t.appendChild(r);let o=!1;const a=()=>{o||(o=!0,this.activeInlineEditor=null,t.innerHTML=s)};if(r.addEventListener("keydown",(t=>{"Enter"===t.key?(t.preventDefault(),r.blur()):"Escape"===t.key&&(t.preventDefault(),a()),t.key.startsWith("Arrow")&&t.stopPropagation()})),r.addEventListener("blur",(()=>{var i;if(o)return;o=!0;const a=this.parseEditorValue(r,e,n);this.activeInlineEditor=null,a?null==(i=this.commitInlineEdit)||i.call(this,e.id,a):t.innerHTML=s})),this.activeInlineEditor=r,r.focus(),"text"!==r.type&&"number"!==r.type||r.select(),"date"===r.type||"datetime-local"===r.type)try{null==(i=r.showPicker)||i.call(r)}catch{}}configureEditorInput(t,e,n){const i=this.options.inputDateFormat,r=Y(i),s=r?"datetime-local":"date",o=r?"YYYY-MM-DDTHH:mm":"YYYY-MM-DD";switch(n){case It.Name:t.type="text",t.value=e.name;break;case It.StartTime:t.type=s,t.value=e.startTime?U(e.startTime,i).format(o):"";break;case It.EndTime:t.type=s,t.value=e.endTime?U(e.endTime,i).format(o):"";break;case It.Duration:t.type="number",t.min="1",t.step="1",t.value=String(this.computeDurationInSnapUnits(e));break;case It.Progress:t.type="number",t.min="0",t.max="100",t.step="1",t.value=String(e.progress??0)}}computeDurationInSnapUnits(t){const e=this.options.inputDateFormat,{snapUnit:n,snapValue:i}=this.options,r=t.startTime?U(t.startTime,e):null,s=t.endTime?U(t.endTime,e):null;if(!(r&&s&&r.isValid()&&s.isValid()))return 1;const o=Zt(n)*Math.max(1,i),a=Y(e)?0:o,l=s.valueOf()-r.valueOf()+a;return Math.max(1,Math.round(l/o))}parseEditorValue(t,e,n){const i=this.options.inputDateFormat,r=Y(i),s=r?"YYYY-MM-DDTHH:mm":"YYYY-MM-DD",{snapUnit:o,snapValue:a}=this.options,l=Zt(o)*Math.max(1,a);switch(n){case It.Name:{const n=t.value.trim();return n&&n!==e.name?{name:n}:null}case It.StartTime:{if(!t.value)return null;const n=w(t.value,s);if(!n.isValid())return null;const r=n.format(i);if(r===e.startTime)return null;if("milestone"!==e.type&&e.endTime){const t=U(e.startTime,i),s=U(e.endTime,i);if(t.isValid()&&s.isValid()){const e=s.valueOf()-t.valueOf();return{startTime:r,endTime:n.add(e,"millisecond").format(i)}}}return{startTime:r}}case It.EndTime:{if(!t.value)return null;const n=w(t.value,s);if(!n.isValid())return null;const r=U(e.startTime,i);if(r.isValid()&&n.isBefore(r))return null;const o=n.format(i);return o===e.endTime?null:{endTime:o}}case It.Duration:{const n=parseInt(t.value,10);if(!Number.isFinite(n)||n<1)return null;const s=U(e.startTime,i);if(!s.isValid())return null;const o=(r?n:n-1)*l,a=s.add(o,"millisecond").format(i);return a===e.endTime?null:{endTime:a}}case It.Progress:{const n=parseInt(t.value,10);if(!Number.isFinite(n))return null;const i=Math.max(0,Math.min(100,n));return i===(e.progress??0)?null:{progress:i}}default:return null}}generateRow(t,e,n){var i;if(t.isGroup)return this.generateGroupRow(t,e,n);const r=l(this.chartContext,{className:"tasks-data-row"}),{rowHeight:s}=this.options,o=this.chartContext.getInstanceId();if(r.setAttribute("data-taskid",t.id),r.setAttribute(Qt,o),r.style.height=`${s}px`,r.setAttribute("role","row"),r.setAttribute("aria-rowindex",n.toString()),r.setAttribute("aria-level",(t.level??1).toString()),r.setAttribute("aria-selected","false"),r.setAttribute("tabindex",1===n?"0":"-1"),this.dataManager.hasChildren(t.id)&&r.setAttribute("aria-expanded",t.collapsed?"false":"true"),this.showCheckbox){const e=l(this.chartContext,{className:"tasks-data-cell gantt-checkbox-cell"});e.style.height=`${s}px`;const n=this.chartContext.createElement("input");n.type="checkbox",n.className="gantt-selection-checkbox",n.checked=(null==(i=this.selectionManager)?void 0:i.isSelected(t.id))??!1,n.setAttribute("aria-label",`Select ${t.name}`),n.addEventListener("click",(e=>{e.stopPropagation(),this.selectionManager&&(e.shiftKey?this.selectionManager.handleClick(t.id,{ctrlKey:!1,metaKey:!1,shiftKey:!0}):this.selectionManager.toggleTask(t.id))})),e.append(n),r.append(e)}if(this.selectionEnabled&&this.selectionManager){const e=this.selectionManager;r.addEventListener("click",(n=>{n.target.classList.contains("gantt-selection-checkbox")||n.target.classList.contains("task-toggle-icon")||(e.handleClick(t.id,{ctrlKey:n.ctrlKey,metaKey:n.metaKey,shiftKey:n.shiftKey}),r.focus())})),r.style.cursor="pointer"}if(this.options.scrollToTaskOnRowClick&&this.onRowActivate){const e=this.onRowActivate;r.addEventListener("click",(n=>{const i=n.target;i.classList.contains("gantt-selection-checkbox")||i.classList.contains("task-toggle-icon")||i.closest('input, textarea, select, [contenteditable="true"]')||e(t.id)})),r.style.cursor="pointer"}let a=1;return this.effectiveColumnList.forEach((i=>{const{key:h}=i,c=Ft(h)?h:null,u=l(this.chartContext,{className:"tasks-data-cell",content:!c&&i.render?"":Nt(t,i,this.options.inputDateFormat,{unit:this.options.snapUnit,value:this.options.snapValue},this.dataManager.getCalendar())});u.setAttribute("data-columnid",h),u.setAttribute(Qt,o),u.style.height=`${s}px`,u.style.color="var(--text-color)",u.setAttribute("role","gridcell"),u.setAttribute("aria-colindex",a.toString());const p=!!c&&this.isCellEditable(t,c);if(u.setAttribute("aria-readonly",p?"false":"true"),p&&c&&(u.classList.add("inline-editable"),this.attachInlineEditHandler(u,t.id,c)),a++,!c&&i.render&&this.columnRenderManager){const e={task:t,options:this.options,rowIndex:n-1,isSummary:!!t.showSummaryBar&&this.dataManager.hasChildren(t.id),isMilestone:"milestone"===t.type};this.columnRenderManager.dispatch(i.render,e,u)}if(c===It.Name){if(u.style.paddingLeft=15*(t.level??0)+"px",u.style.textAlign="left",u.innerHTML="",this.dataManager.hasChildren(t.id)){const n=d(this.chartContext,"span",{className:"task-toggle-icon "+(t.collapsed?"collapsed":"expanded")});n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label",t.collapsed?`Expand ${t.name}`:`Collapse ${t.name}`);const i=()=>{this.dataManager.toggleTask(t.id),e()};n.addEventListener("click",i),n.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i())})),u.append(n)}else{const t=d(this.chartContext,"span",{className:"task-toggle-icon-blank"});u.append(t)}const n=d(this.chartContext,"span",{textContent:t.name});u.append(n)}r.append(u)})),r}generateGroupRow(t,e,n){const{rowHeight:i}=this.options,r=mt(this.options),s=this.chartContext.getInstanceId(),o=t.groupKey??"",a=this.dataManager.isGroupCollapsed(o),h=l(this.chartContext,{className:"tasks-data-row tasks-group-row"});h.setAttribute("data-taskid",t.id),h.setAttribute(Qt,s),h.style.height=`${i}px`,h.setAttribute("role","row"),h.setAttribute("aria-rowindex",n.toString()),h.setAttribute("aria-level","1"),h.setAttribute("aria-expanded",a?"false":"true"),h.setAttribute("tabindex",1===n?"0":"-1");const c=l(this.chartContext,{className:"tasks-data-cell tasks-group-cell"});c.setAttribute(Qt,s),c.setAttribute("role","gridcell"),c.setAttribute("aria-colindex","1"),c.style.height=`${i}px`;const u=d(this.chartContext,"span",{className:"task-toggle-icon "+(a?"collapsed":"expanded")});u.setAttribute("role","button"),u.setAttribute("tabindex","0");const p=t.groupLabel??"";u.setAttribute("aria-label",a?`Expand ${p}`:`Collapse ${p}`);const m=()=>{this.dataManager.toggleGroup(o),e()};u.addEventListener("click",m),u.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),m())})),c.append(u);const g=d(this.chartContext,"span",{className:"tasks-group-label",textContent:p});c.append(g);const f=d(this.chartContext,"span",{className:"tasks-group-count",textContent:r.groupCountLabel(t.groupCount??0)});return c.append(f),h.append(c),h}generateRows(t,e,n){return t.forEach(((t,i)=>{const r=this.generateRow(t,n,i+1);e.appendChild(r)})),this.onAddTaskRowClick&&e.appendChild(this.generateAddTaskRow(this.onAddTaskRowClick)),this.fillEmptyRows(e,t.length+(this.onAddTaskRowClick?1:0),n),e}generateAddTaskRow(t){const e=l(this.chartContext,{className:"tasks-data-row tasks-add-row"}),{rowHeight:n}=this.options,i=this.chartContext.getInstanceId(),r=mt(this.options);e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.setAttribute("aria-label",r.addTask),e.setAttribute(Qt,i),e.style.height=`${n}px`;const s=l(this.chartContext,{className:"tasks-data-cell tasks-add-row-cell"});s.setAttribute(Qt,i),s.style.height=`${n}px`,s.textContent=r.addTaskRowLabel,e.append(s);const o=e=>{e.preventDefault(),e.stopPropagation(),t()};return e.addEventListener("click",o),e.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||o(t)})),e}generateRowsVirtualized(t,e,n,i,r){const{startIndex:s,endIndex:o}=i,a=t.length,l=this.chartContext.createElement("div");l.className="virtualizer-top-spacer",l.style.height=s*r+"px",e.appendChild(l);t.slice(s,o+1).forEach(((t,i)=>{const r=s+i,o=this.generateRow(t,n,r+1);e.appendChild(o)}));const d=Math.max(0,(a-1-o)*r),h=this.chartContext.createElement("div");return h.className="virtualizer-bottom-spacer",h.style.height=`${d}px`,e.appendChild(h),e}fillEmptyRows(t,e,n){const i=this.chartContext.querySelector(".gantt-container");if(!i)return;const r=i.clientHeight,s=this.options.rowHeight,o=r-2*s,a=Math.floor(o/s),l=Math.max(0,a-e);for(let e=0;e<l;e++){const n=this.generateEmptyRow(e);t.appendChild(n)}}generateEmptyRow(t){const e=l(this.chartContext,{className:"tasks-data-row tasks-empty-row"}),{rowHeight:n}=this.options,i=this.chartContext.getInstanceId();return e.setAttribute("data-taskid",`empty-${t}`),e.setAttribute(Qt,i),e.style.height=`${n}px`,this.effectiveColumnList.forEach((({key:t})=>{const r=l(this.chartContext,{className:"tasks-data-cell",content:""});r.setAttribute("data-columnid",t),r.setAttribute(Qt,i),r.style.height=`${n}px`,r.style.color="var(--text-color)",e.append(r)})),e}render(t,e){const n=this.generateHeader(this.effectiveColumnList.map((t=>t.title))),i=e?e.allTasks.slice(e.range.startIndex,e.range.endIndex+1):this.dataManager.getFlatVisibleTasks();return[n,this.generateBody(i,t,e)]}}function ne(t,e,n,i){let r;if(r=e.accessor?e.accessor(t):(null==n?void 0:n.accessor)?n.accessor(t):Ft(e.field)?Wt(t,e.field,i.inputDateFormat,void 0,i.calendar):t[e.field],null==r||""===r)return{key:"",label:i.noneLabel};const s=e.label?e.label(r):String(r);return{key:String(r),label:s}}function ie(t){return{id:`__group__:${t.key}`,name:t.label,startTime:"",endTime:"",progress:0,type:Jt.Task,level:0,isGroup:!0,groupKey:t.key,groupLabel:t.label,groupCount:t.members.length}}function re(t,e){return t&&0!==t.length?t.filter((t=>(null==t?void 0:t.start)&&(null==t?void 0:t.end))).map((t=>({start:t.start,end:t.end}))).sort(((t,n)=>U(t.start,e).valueOf()-U(n.start,e).valueOf())):[]}function se(t,e,n){const i=t=>w(U(t,n).valueOf()+e).format(n);return t.map((t=>({start:i(t.start),end:i(t.end)})))}const oe=180/(7*tt);function ae(t,e){return null==t?w().valueOf():"number"==typeof t?t:t instanceof Date?t.getTime():"string"==typeof t?U(t,e).valueOf():t.valueOf()}class le{constructor(t,e,n="YYYY-MM-DD",i=!1,r=0){this.origin=t,this.pixelsPerMs=e,this.inputDateFormat=n,this.rtl=i,this.totalWidth=r}xForDate(t){return(ae(t,this.inputDateFormat)-this.origin.valueOf())*this.pixelsPerMs}leftForDate(t,e=0){const n=this.xForDate(t);return this.rtl?this.totalWidth-n-e:n}widthForRange(t,e){return(ae(e,this.inputDateFormat)-ae(t,this.inputDateFormat))*this.pixelsPerMs}dateForX(t){const e=this.rtl?this.totalWidth-t:t;return w(this.origin.valueOf()+e/this.pixelsPerMs)}get pixelsPerDay(){return this.pixelsPerMs*tt}get msPerPixel(){return 1/this.pixelsPerMs}}function de(t){const e=t.startOf("quarter");return{first:e.format("MMM"),last:e.add(2,"month").format("MMM")}}const he={minute:{id:"minute",unit:"minute",step:15,msPerCell:9e5,parent:"hour",formats:{sub:[{minWidth:60,format:t=>t.format("HH:mm")},{minWidth:0,format:t=>t.format("mm")}],top:[{minWidth:60,format:t=>t.format("HH:mm")},{minWidth:0,format:t=>t.format("mm")}]}},hour:{id:"hour",unit:"hour",step:1,msPerCell:36e5,parent:"day",formats:{sub:[{minWidth:80,format:t=>t.format("h A")},{minWidth:30,format:t=>t.format("HH")},{minWidth:0,format:t=>t.format("h")}],top:[{minWidth:180,format:t=>t.format("ddd DD MMM, h A")},{minWidth:110,format:t=>t.format("DD MMM, h A")},{minWidth:60,format:t=>t.format("h A")},{minWidth:0,format:t=>t.format("HH")}]}},halfday:{id:"halfday",unit:"hour",step:12,msPerCell:432e5,parent:"day",minSubPx:200,formats:{sub:[{minWidth:60,format:t=>t.format("A")},{minWidth:0,format:t=>t.format("A").charAt(0)}],top:[{minWidth:100,format:t=>t.format("DD MMM, A")},{minWidth:0,format:t=>t.format("A")}]}},day:{id:"day",unit:"day",step:1,msPerCell:tt,parent:"week",minSubPx:42,formats:{sub:[{minWidth:100,format:t=>t.format("ddd DD MMM")},{minWidth:60,format:t=>t.format("DD MMM")},{minWidth:0,format:t=>t.format("dd").charAt(0)}],top:[{minWidth:150,format:t=>t.format("ddd DD MMM YYYY")},{minWidth:100,format:t=>t.format("ddd DD MMM")},{minWidth:60,format:t=>t.format("DD MMM")},{minWidth:0,format:t=>t.format("DD/MM")}]}},week:{id:"week",unit:"week",step:1,msPerCell:7*tt,parent:"month",formats:{sub:[{minWidth:220,format:t=>`#${t.week()}, ${t.day(0).format("DD MMM")} - ${t.day(6).format("DD MMM")}`},{minWidth:140,format:t=>`Wk ${t.week()}, ${t.day(0).format("DD MMM")}`},{minWidth:100,format:t=>t.day(0).format("DD MMM")},{minWidth:0,format:t=>`${t.week()}`}],top:[{minWidth:320,format:t=>`${t.day(0).format("DD MMM YYYY")} - ${t.day(6).format("DD MMM YYYY")}`},{minWidth:220,format:t=>`#${t.week()}, ${t.day(0).format("DD MMM YYYY")}`},{minWidth:120,format:t=>`Wk ${t.week()}, ${t.day(0).format("DD MMM")}`},{minWidth:0,format:t=>`Wk ${t.week()}`}]}},month:{id:"month",unit:"month",step:1,msPerCell:30.4375*tt,parent:"year",formats:{sub:[{minWidth:110,format:t=>t.format("MMMM")},{minWidth:60,format:t=>t.format("MMM")},{minWidth:0,format:t=>t.format("M")}],top:[{minWidth:130,format:t=>t.format("MMMM YYYY")},{minWidth:80,format:t=>t.format("MMM YYYY")},{minWidth:50,format:t=>t.format("MMM")},{minWidth:0,format:t=>t.format("MM/YY")}]}},quarter:{id:"quarter",unit:"quarter",step:1,msPerCell:91.3125*tt,parent:"year",formats:{sub:[{minWidth:100,format:t=>{const e=de(t);return`#${t.quarter()} ${e.first}-${e.last}`}},{minWidth:50,format:t=>`#${t.quarter()}`},{minWidth:0,format:t=>`Q${t.quarter()}`}],top:[{minWidth:140,format:t=>{const e=de(t);return`#${t.quarter()} ${e.first}-${e.last} ${t.format("YYYY")}`}},{minWidth:80,format:t=>`#${t.quarter()} ${t.format("YYYY")}`},{minWidth:0,format:t=>`Q${t.quarter()}`}]}},year:{id:"year",unit:"year",step:1,msPerCell:365.25*tt,parent:null,formats:{sub:[{minWidth:80,format:t=>t.format("YYYY")},{minWidth:40,format:t=>`'${t.format("YY")}`},{minWidth:0,format:t=>t.format("YY")}],top:[{minWidth:0,format:t=>t.format("YYYY")}]}}},ce=["minute","hour","halfday","day","week","month","quarter","year"],ue=80,pe=50;function me(t){let e=he.year;for(const n of ce){const i=he[n],r=i.minSubPx??ue;if(i.msPerCell*t>=r){e=i;break}}let n=null;if(e.parent){const i=he[e.parent];i.msPerCell*t>=pe&&(n=i)}return{top:n,sub:e}}function ge(t,e){const n=t.startOf(e.unit);return e.step<=1?n:"minute"===e.unit?n.minute(Math.floor(n.minute()/e.step)*e.step):"hour"===e.unit?n.hour(Math.floor(n.hour()/e.step)*e.step):n}function fe(t,e){for(const n of t)if(e>=n.minWidth)return n.format;return t[t.length-1].format}function be(t,e,n,i,r,s){const o=[],a=t.valueOf(),l=e.valueOf(),d=n.formats[i];let h=ge(t,n);for(;h.valueOf()<l;){const t=h.add(n.step,n.unit),e=Math.max(h.valueOf(),a),i=Math.min(t.valueOf(),l);if(i>e){const t=(i-e)*r.pixelsPerMs,n=fe(d,t);o.push({data:n(V(h,s)),width:t})}h=t}return o}function ve(t,e,n,i,r,s=!1){const o=me(n),a=function(t,e,n){return[ge(t,n),ge(e,n).add(n.step,n.unit)]}(t,e,o.sub),l=(a[1].valueOf()-a[0].valueOf())*n,d=new le(a[0],n,i,s,l),h=be(a[0],a[1],o.sub,"sub",d,r);return{geometry:d,timelineSpan:a,top:o.top?be(a[0],a[1],o.top,"top",d,r):null,sub:h,tiers:o}}w.extend(M);const ye="root";class xe{constructor(t=[]){this.dependencies=[],this.buildingTree=!1,this.taskMap={},this.taskTree={},this.arrowLinkInstanceId=null,this.revision=0,this.flatVisibleIndexCache=null,this.dependencyAdjacencyCache=null,this.userSetSummaryProgress=new Set,this.calendar=K,this.holidaysByKey=new Map,this.inputDateFormat="MM-DD-YYYY",this.naturalSeq=new Map,this.nextSeq=0,this.sortComparator=void 0,this.filterPredicate=null,this.filteredIds=null,this.groupCriterion=null,this.groupColumn=void 0,this.groupNoneLabel="(None)",this.collapsedGroups=new Set,this.startTimeComparator=(t,e)=>{const n=t.startTime||(t.showSummaryBar?t.summaryStart:void 0),i=e.startTime||(e.showSummaryBar?e.summaryStart:void 0);return(n?U(n,this.inputDateFormat).valueOf():1/0)-(i?U(i,this.inputDateFormat).valueOf():1/0)},this.compareTasks=(t,e)=>{const n=void 0===this.sortComparator?this.startTimeComparator:this.sortComparator;if(n){const i=n(t,e);if(0!==i)return i}return(this.naturalSeq.get(t.id)??0)-(this.naturalSeq.get(e.id)??0)},this.setTasks(t)}setInputDateFormat(t){this.inputDateFormat=t}setCalendar(t,e=[]){this.calendar=t,this.holidaysByKey=new Map(e.map((t=>[t.key,t])))}getCalendar(){return this.calendar}getHolidaysByKey(){return this.holidaysByKey}buildTaskTree(t){this.buildingTree=!0;const e={[ye]:[]},n=new Set(t.map((t=>t.id)));t.forEach((t=>{var i;if(this.taskMap[t.id]=t,e[t.id]||(e[t.id]=[]),void 0===t.parentId||e[t.parentId]||(e[t.parentId]=[]),t.dependency){const{taskId:e,type:i,lag:r}=te(t.dependency);n.has(e)&&this.addDependency(e,t.id,i,r)}t.parentId?null==(i=e[t.parentId])||i.push(t.id):e[ye].push(t.id)})),this.taskTree=e,this.buildingTree=!1,this.revision++}computeDependencyFields(){var t,e;const n=new Map,i=new Map;for(const r of this.dependencies)null==(t=n.get(r.toId)??n.set(r.toId,[]).get(r.toId))||t.push(r),null==(e=i.get(r.fromId)??i.set(r.fromId,[]).get(r.fromId))||e.push(r);const r=(t,e,n)=>{if(!t)return"";return`${t}${"FS"!==e?e:""}${n?`${n>0?"+":""}${n}d`:""}`};for(const t of Object.keys(this.taskMap)){const e=this.taskMap[t],s=(n.get(t)??[]).map((t=>{var e;return r(null==(e=this.taskMap[t.fromId])?void 0:e.wbs,t.type,t.lag)})).filter(Boolean).join(", "),o=(i.get(t)??[]).map((t=>{var e;return r(null==(e=this.taskMap[t.toId])?void 0:e.wbs,t.type,t.lag)})).filter(Boolean).join(", ");this.taskMap[t]={...e,predecessors:s,successors:o}}}applyShowSummaryBarDefaults(){Object.keys(this.taskTree).forEach((t=>{var e;if("root"===t)return;const n=this.taskMap[t];if(!n)return;const i=(null==(e=this.taskTree[t])?void 0:e.length)>0;if(!n.startTime&&!n.endTime&&!i)throw new Error(`Task "${t}" has no startTime/endTime and no children. Provide dates or add child tasks.`);!1!==n.showSummaryBar&&i&&(this.taskMap[t]={...n,showSummaryBar:!0})}))}processLevel(){const t=(e,n)=>{e.forEach((e=>{this.taskMap[e.id]={...e,level:n};const i=this.taskTree[e.id].map((t=>this.taskMap[t]));Array.isArray(i)&&t(i,n+1)}))};t(this.getTasks().filter((t=>!t.parentId)),1)}processWbs(){const t=(e,n)=>{(this.taskTree[e]??[]).forEach(((e,i)=>{const r=n?`${n}.${i+1}`:`${i+1}`,s=this.taskMap[e];s&&(this.taskMap[e]={...s,wbs:r},t(e,r))}))};t(ye,"")}applySort(){const t=e=>{const n=this.taskTree[e];if(!n||0===n.length)return;const i=n.map((t=>this.taskMap[t])).filter((t=>null!=t));i.sort(this.compareTasks),this.taskTree[e]=i.map((t=>t.id)),i.forEach((e=>t(e.id)))};t(ye)}setSortComparator(t){this.sortComparator=t,this.applySort(),this.processWbs(),this.computeDependencyFields(),this.revision++}setFilterPredicate(t){this.filterPredicate=t,this.recomputeFilter(),this.revision++}hasActiveFilter(){return null!==this.filterPredicate}recomputeFilter(){if(!this.filterPredicate)return void(this.filteredIds=null);const t=this.filterPredicate,e=new Set,n=i=>{const r=this.taskMap[i];if(!r)return!1;let s=!1;return(this.taskTree[i]??[]).forEach((t=>{n(t)&&(s=!0)})),!(!t(r)&&!s)&&(e.add(i),!0)};(this.taskTree[ye]??[]).forEach(n),this.filteredIds=e}setGroupBy(t,e,n){this.groupCriterion=t,this.groupColumn=e,void 0!==n&&(this.groupNoneLabel=n),this.collapsedGroups.clear(),this.revision++}getGroupBy(){return this.groupCriterion}isGrouping(){return null!==this.groupCriterion}toggleGroup(t){this.collapsedGroups.has(t)?this.collapsedGroups.delete(t):this.collapsedGroups.add(t),this.revision++}isGroupCollapsed(t){return this.collapsedGroups.has(t)}getGroupedFlatTasks(){const t=this.groupCriterion;if(!t)return[];const e={inputDateFormat:this.inputDateFormat,calendar:this.calendar,noneLabel:this.groupNoneLabel},n=function(t,e,n,i){const r=new Map;for(const s of t){const{key:t,label:o}=ne(s,e,n,i);let a=r.get(t);a||(a={key:t,label:o,members:[]},r.set(t,a)),a.members.push(s)}const s="desc"===e.direction?-1:1;return[...r.values()].sort(((t,e)=>""===t.key||""===e.key?""===t.key?1:-1:t.label.localeCompare(e.label)*s))}(Object.values(this.taskMap).filter((t=>!this.filterPredicate||this.filterPredicate(t))).sort(this.compareTasks),t,this.groupColumn,e),i=[];for(const t of n)if(i.push(ie(t)),!this.collapsedGroups.has(t.key))for(const e of t.members)i.push({...e,level:1});return i}validateTask(t){if(!t.id)throw new Error("Task must have an id");const e=re(t.segments,this.inputDateFormat);if(e.length>=1){const i={startTime:(n=e)[0].start,endTime:n[n.length-1].end};t={...t,segments:e,startTime:i.startTime,endTime:i.endTime}}var n;if(t.showSummaryBar||!t.startTime&&!t.endTime)return{...t,startTime:t.startTime??"",endTime:t.endTime??"",progress:t.progress??0,type:t.type??Jt.Task,level:1};if("milestone"===t.type){if(!t.startTime)throw new Error("Milestone must have an id and start date")}else if(!t.startTime||!t.endTime)throw new Error("Task must have an id, start, and end date");return{...t,endTime:t.endTime||t.startTime,progress:t.progress??0,type:t.type??Jt.Task,level:1}}computeSummaryDates(){const t=e=>{const n=this.taskTree[e]||[];if(0===n.length){const t=this.taskMap[e];return(null==t?void 0:t.startTime)&&t.endTime?{starts:[U(t.startTime,this.inputDateFormat)],ends:[U(t.endTime,this.inputDateFormat)]}:{ends:[],starts:[]}}const i=[],r=[];return n.forEach((e=>{const n=this.taskMap[e];if(n)if(n.showSummaryBar){const n=t(e);i.push(...n.starts),r.push(...n.ends)}else{n.startTime&&i.push(U(n.startTime,this.inputDateFormat)),n.endTime&&r.push(U(n.endTime,this.inputDateFormat));const s=t(e);i.push(...s.starts),r.push(...s.ends)}})),{ends:r,starts:i}};Object.values(this.taskMap).forEach((e=>{if(!e.showSummaryBar)return;const{ends:n,starts:i}=t(e.id);if(0===i.length||0===n.length)return;const r=w.min(i),s=w.max(n);this.taskMap[e.id]={...this.taskMap[e.id],summaryStart:r.format("YYYY-MM-DD"),summaryEnd:s.format("YYYY-MM-DD")}}))}computeSummaryProgress(){const t=e=>{const n=this.taskMap[e];if(!n)return{totalDuration:0,weightedProgress:0};const i=this.taskTree[e]||[];if(0===i.length){if(!n.startTime||!n.endTime)return{totalDuration:0,weightedProgress:0};const t=Math.max(1,this.calendar.workingDaysBetween(n.startTime,n.endTime,{inclusive:!0}));return{totalDuration:t,weightedProgress:t*(n.progress??0)}}let r=0,s=0;return i.forEach((e=>{const n=t(e);r+=n.totalDuration,s+=n.weightedProgress})),n.showSummaryBar&&!this.userSetSummaryProgress.has(n.id)&&r>0&&(this.taskMap[n.id]={...n,progress:Math.round(s/r)}),{totalDuration:r,weightedProgress:s}};(this.taskTree[ye]||[]).forEach((e=>t(e)))}addDependency(t,e,n="FS",i=0){this.dependencies.some((n=>n.fromId===t&&n.toId===e))||(this.dependencies.push({fromId:t,toId:e,type:n,lag:i}),this.revision++,this.buildingTree||this.computeDependencyFields())}addTask(t){const e=this.validateTask(t);this.taskMap[e.id]=e,this.naturalSeq.has(e.id)||this.naturalSeq.set(e.id,this.nextSeq++),this.buildTaskTree(this.getTasks()),this.applyShowSummaryBarDefaults(),this.computeSummaryDates(),this.computeSummaryProgress(),this.applySort(),this.processWbs(),this.computeDependencyFields(),this.recomputeFilter()}calculateProgress(){const t=this.getTasks().filter((t=>!!t.startTime&&!!t.endTime)),e=t=>this.calendar.workingDaysBetween(t.startTime,t.endTime),n=t.reduce(((t,n)=>t+e(n)),0),i=t.reduce(((t,n)=>t+n.progress/100*e(n)),0);return n?i/n*100:0}getDateRange(t=0,e,n=0){const i=this.getTasks(),r=me(e).sub,s=r.unit,o=r.step,a=t=>{if(n<=0||e<=0)return t;const i=n/e;return t.subtract(i,"millisecond").startOf(s)};if(0===i.length){const e=w();return[a(e.startOf(s)),e.startOf(s).add((30+t)*o,s)]}const l=i.filter((t=>!!t.startTime)).map((t=>U(t.startTime,this.inputDateFormat))),d=i.filter((t=>!!t.endTime)).map((t=>U(t.endTime,this.inputDateFormat)));return[a(w.min(l)),w.max(d).add(t*o,s)]}getFlatSortedTasks(t,e=!1,n=!1){let i=[];return t.forEach((t=>{if(n&&this.filteredIds&&!this.filteredIds.has(t.id))return;i.push(t);const r=this.taskTree[t.id].map((t=>this.taskMap[t]));!e&&t.collapsed||!Array.isArray(r)||(i=i.concat(this.getFlatSortedTasks(r,e,n)))})),i}getFlatTasks(){return this.getFlatSortedTasks(this.taskTree[ye].map((t=>this.getTaskById(t))).filter((t=>null!==t)),!0)}getFlatVisibleTasks(){return this.groupCriterion?this.getGroupedFlatTasks():this.getFlatSortedTasks(this.taskTree[ye].map((t=>this.getTaskById(t))).filter((t=>null!==t)),!1,!0)}getFlatVisibleIndex(){if(this.flatVisibleIndexCache&&this.flatVisibleIndexCache.revision===this.revision)return{indexMap:this.flatVisibleIndexCache.map,count:this.flatVisibleIndexCache.count};const t=this.getFlatVisibleTasks(),e=new Map;return t.forEach(((t,n)=>e.set(t.id,n))),this.flatVisibleIndexCache={revision:this.revision,map:e,count:t.length},{indexMap:e,count:t.length}}getImmediateChildren(t){return(this.taskTree[t]||[]).map((t=>this.taskMap[t])).filter((t=>null!=t))}getNestedChildTasks(t,e=!1){const n=[],i=t=>{var r;if(e&&(null==(r=this.taskMap[t])?void 0:r.collapsed))return;(this.taskTree[t]||[]).forEach((t=>{const e=this.taskMap[t];e&&(n.push(e),i(t))}))};return i(t),n}getTaskById(t){return this.taskMap[t]}getTaskDependencies(t){return{incoming:this.dependencies.filter((e=>e.toId===t)),outgoing:this.dependencies.filter((e=>e.fromId===t))}}getTasks(){return Object.values(this.taskMap)}getTopParentTasks(){return Object.values(this.taskMap).filter((t=>void 0===t.parentId&&t.type===Jt.Task))}hasChildren(t){var e;return((null==(e=this.taskTree[t])?void 0:e.length)??0)>0}removeDependency(t,e){this.dependencies=this.dependencies.filter((n=>!(n.fromId===t&&n.toId===e))),this.revision++;const n=this.taskMap[e];if(null==n?void 0:n.dependency){if(te(n.dependency).taskId===t){const{dependency:t,...i}=n;this.taskMap[e]=i}}this.buildingTree||this.computeDependencyFields()}removeTask(t){delete this.taskMap[t],this.userSetSummaryProgress.delete(t),this.naturalSeq.delete(t),this.buildTaskTree(Object.values(this.taskMap)),this.applySort(),this.processWbs(),this.computeDependencyFields(),this.recomputeFilter()}setTasks(t){if(!Array.isArray(t))throw new Error("Tasks must be an array");this.userSetSummaryProgress=new Set;const e=t.map((t=>this.validateTask(t)));this.taskMap={},this.dependencies=[],this.naturalSeq=new Map(e.map(((t,e)=>[t.id,e]))),this.nextSeq=e.length,this.buildTaskTree(e),this.applyShowSummaryBarDefaults(),this.computeSummaryDates(),this.computeSummaryProgress(),this.applySort(),this.processLevel(),this.processWbs(),this.computeDependencyFields(),this.recomputeFilter()}toggleTask(t){const e=this.getTaskById(t);e&&(this.taskMap[t]={...e,collapsed:!e.collapsed},this.revision++)}setCollapsedTasks(t){const e=new Set(t);let n=!1;for(const t of Object.keys(this.taskMap)){const i=this.taskMap[t],r=e.has(t);!!i.collapsed!==r&&(this.taskMap[t]={...i,collapsed:r},n=!0)}n&&this.revision++}setArrowLinkInstanceId(t){this.arrowLinkInstanceId=t}updateDependencyArrows(t,e){const n=this.getTaskDependencies(t);[...n.incoming,...n.outgoing].forEach((t=>{const n=this.getTaskById(t.fromId),i=this.getTaskById(t.toId);if(n&&i){const n=(null==e?void 0:e.getInstanceId())||"unknown",i={fromId:t.fromId,toId:t.toId,type:t.type,lag:t.lag,chartInstanceId:n,arrowLinkInstanceId:this.arrowLinkInstanceId??void 0},r=new CustomEvent("dependencyArrowUpdate",{detail:i,bubbles:!1,cancelable:!1});e?e.dispatchEvent(r):(R.warn(`[${n}] No chartContext provided for dependency arrow update`),document.dispatchEvent(r))}}))}getAllDependencies(){return this.dependencies}getDependencyAdjacency(){if(this.dependencyAdjacencyCache&&this.dependencyAdjacencyCache.revision===this.revision)return this.dependencyAdjacencyCache.map;const t=new Map,e=(e,n)=>{const i=t.get(e);i?i.push(n):t.set(e,[n])};for(const t of this.dependencies)e(t.fromId,t),t.toId!==t.fromId&&e(t.toId,t);return this.dependencyAdjacencyCache={revision:this.revision,map:t},t}updateTask(t,e){const n=this.taskMap[t];if(!n)throw new Error(`Task with id "${t}" not found`);"progress"in e&&(void 0===e.progress?this.userSetSummaryProgress.delete(t):this.userSetSummaryProgress.add(t));const i=function(t,e,n){if(i=t.segments,!(i&&i.length>1)||"segments"in e)return e;var i;const r=null!=e.startTime,s=null!=e.endTime;if(!r&&!s)return e;const o=re(t.segments,n),a=t=>U(t,n).valueOf(),l=t=>w(t).format(n);if(r&&s)return{...e,segments:se(o,a(e.startTime)-a(t.startTime),n)};if(r){const t=o[0],n=Math.min(a(e.startTime),a(t.end));return{...e,segments:[{start:l(n),end:t.end},...o.slice(1)]}}const d=o[o.length-1],h=Math.max(a(e.endTime),a(d.start));return{...e,segments:[...o.slice(0,-1),{start:d.start,end:l(h)}]}}(n,e,this.inputDateFormat),r=this.validateTask({...n,...i});return this.taskMap[t]=r,this.buildTaskTree(this.getTasks()),this.applyShowSummaryBarDefaults(),this.computeSummaryDates(),this.computeSummaryProgress(),this.processWbs(),this.computeDependencyFields(),r}}function we(t){return t.classList.contains("gantt-reduced-motion")}function ke(t,e,n){if(we(n))return;if("function"!=typeof t.animate)return;const i=Math.min(30*e,500);t.animate([{transformOrigin:"top",transform:"translateY(-8px) scaleY(0)"},{transformOrigin:"top",transform:"translateY(0) scaleY(1)"}],{duration:200,easing:"ease-out",delay:i,fill:"backwards"})}const Ce="data-chart-instance";class Se{constructor(t,e,n,i,r=!1){this.pixelsPerMs=t,this.options=e,this.chartContext=n,this.dataManager=i,this.rtl=r}generateHeader(t,e){const n=l(this.chartContext,{className:"timeline-header"}),i=l(this.chartContext,{className:"timeline-header-row"}),{rowHeight:r}=this.options,s=this.chartContext.getInstanceId();if(n.setAttribute(Ce,s),n.setAttribute("tabindex","0"),n.setAttribute("aria-label","Timeline header"),t.forEach((t=>{const n=l(this.chartContext,{className:"timeline-header-cell",content:t.data,style:{height:e?`${r}px`:2*r+"px",minWidth:`${t.width}px`||"100%",color:"var(--text-color)"}});i.append(n)})),n.append(i),!e)return n.style.background="var(--header-bg-color)",n;const o=l(this.chartContext,{className:"timeline-header-row"});return e.forEach((t=>{const e=l(this.chartContext,{className:"timeline-header-cell",content:t.data,style:{height:`${r}px`,maxWidth:`${t.width}px`,minWidth:`${t.width}px`,color:"var(--text-color)"}});o.append(e)})),n.append(o),n.style.background="var(--header-bg-color)",n}generateRow(t,e){const n=l(this.chartContext,{className:"timeline-data-row"}),{rowHeight:i}=this.options,r=this.chartContext.getInstanceId();return n.setAttribute("data-taskid",t),n.setAttribute(Ce,r),e.forEach((t=>{const e=l(this.chartContext,{className:"timeline-data-cell",style:{height:`${i}px`,maxWidth:`${t.width}px`,minWidth:`${t.width}px`}});e.setAttribute(Ce,r),n.append(e)})),n}generateRows(t,e){const n=l(this.chartContext,{className:"timeline-body"}),i=this.chartContext.getInstanceId();return n.setAttribute(Ce,i),t.forEach((t=>{const i=this.generateRow(t.id,e);n.append(i)})),this.fillEmptyRows(n,t.length,e),n}generateRowsVirtualized(t,e,n,i){const r=l(this.chartContext,{className:"timeline-body"}),s=this.chartContext.getInstanceId();r.setAttribute(Ce,s);const{startIndex:o,endIndex:a}=n,d=t.length,h=this.chartContext.createElement("div");h.className="virtualizer-top-spacer",h.style.height=o*i+"px",r.appendChild(h);t.slice(o,a+1).forEach((t=>{const n=this.generateRow(t.id,e);r.append(n)}));const c=Math.max(0,(d-1-a)*i),u=this.chartContext.createElement("div");return u.className="virtualizer-bottom-spacer",u.style.height=`${c}px`,r.appendChild(u),r}appendNonWorkingStripes(t,e,n){var i;if(!1===(null==(i=this.options.calendar)?void 0:i.showNonWorkingStripes))return;const r=function(t){const{calendar:e,holidaysByKey:n,timelineStart:i,timelineEnd:r,pixelsPerMs:s,rtl:o,chartContext:a,height:d,onHolidayStripe:h}=t;if(e.isNoOp)return null;const c=s*tt;if(c<4)return null;const u=l(a,{className:"timeline-stripes-layer"});void 0!==d&&(u.style.height=`${d}px`);const p=i.valueOf(),m=r.valueOf(),g=(m-p)*s;let f=w(i).startOf("day");for(;f.valueOf()<m;){if(!e.isWorkingDay(f)){const t=f.format("YYYY-MM-DD"),e=n.get(t),i=(f.valueOf()-p)*s,r=o?g-i-c:i,l=a.createElement("div");l.className=e?"apexgantt-day apexgantt-day--holiday":"apexgantt-day apexgantt-day--weekend",l.style.left=`${r}px`,l.style.width=`${c}px`,l.setAttribute("data-date",t),(null==e?void 0:e.label)&&l.setAttribute("data-holiday-label",e.label),u.append(l),e&&h&&h(l,e)}f=f.add(1,"day")}return u}({calendar:this.dataManager.getCalendar(),holidaysByKey:this.dataManager.getHolidaysByKey(),timelineStart:e,timelineEnd:n,pixelsPerMs:this.pixelsPerMs,rtl:this.rtl,chartContext:this.chartContext,onHolidayStripe:(t,e)=>this.wireHolidayTooltip(t,e)});r&&t.insertBefore(r,t.firstChild)}wireHolidayTooltip(t,e){var n;const i=null==(n=this.options.calendar)?void 0:n.holidayTooltip;if(!i)return;const{tooltipId:r,tooltipBGColor:s,tooltipBorderColor:o,fontColor:a,fontFamily:l,fontSize:d}=this.options;if(!r)return;const h=t=>{const n=i({date:e.date,label:e.label});Mt(this.chartContext,r,t.clientX,t.clientY,n,{bgColor:s||"#FFFFFF",borderColor:o||"#BCBCBC",fontColor:a||"#000000",fontFamily:l||"inherit",fontSize:d||"12px",fontWeight:"400",maxWidth:240})};t.addEventListener("mouseenter",h),t.addEventListener("mousemove",h),t.addEventListener("mouseleave",(()=>Et(this.chartContext,r)))}fillEmptyRows(t,e,n){const i=this.chartContext.querySelector(".gantt-container");if(!i)return;const r=i.clientHeight,s=this.options.rowHeight,o=r-2*s,a=Math.floor(o/s),l=Math.max(0,a-e);for(let e=0;e<l;e++){const i=this.generateRow(`empty-${e}`,n);i.classList.add("timeline-empty-row"),t.append(i)}}render(t,e=new Set,n,i){var r,s;const o=t?t.allTasks:this.dataManager.getFlatVisibleTasks(),a=P(this.options.barLabel),d=this.dataManager.getDateRange(8,this.pixelsPerMs,a),{top:h,sub:c,geometry:u,timelineSpan:p}=ve(d[0],d[1],this.pixelsPerMs,this.options.inputDateFormat,null==(s=null==(r=this.options.locale)?void 0:r.dateLocale)?void 0:s.name,this.rtl),m=this.rtl&&h?[...h].reverse():h,g=this.rtl?[...c].reverse():c,f=m??g,b=m?g:null,v=this.generateHeader(f,b),y=g;let x;x=t?this.generateRowsVirtualized(o,y,t.range,t.rowHeight):this.generateRows(o,y),this.appendNonWorkingStripes(x,p[0],p[1]);const w=l(this.chartContext,{className:"bar-container"}),k=l(this.chartContext,{className:"annotation-container"}),C=this.chartContext.getChartContainer();if(t){const{startIndex:r,endIndex:s}=t.range,a=o.length*t.rowHeight;w.style.height=`${a}px`,w.style.width="100%";o.slice(r,s+1).forEach(((t,s)=>{const o=r+s;if(t.isGroup)return;const a=new Tt(t,u,this.options,o,this.chartContext,this.dataManager),l=i||((t,e)=>{jt(this.chartContext,this.dataManager,t,e,this.options,u),Vt(this.chartContext,this.dataManager,t,this.options,u)}),d=a.drawBar(l,n);w.append(d),!e.has(t.id)&&C&&ke(d,o,C);const h=a.drawBaselineBar();h&&w.append(h);for(const t of a.drawRollups())w.append(t)}))}else o.forEach(((t,r)=>{if(t.isGroup)return;const s=new Tt(t,u,this.options,r,this.chartContext,this.dataManager),o=i||((t,e)=>{jt(this.chartContext,this.dataManager,t,e,this.options,u),Vt(this.chartContext,this.dataManager,t,this.options,u)}),a=s.drawBar(o,n);w.append(a),!e.has(t.id)&&C&&ke(a,r,C);const l=s.drawBaselineBar();l&&w.append(l);for(const t of s.drawRollups())w.append(t)}));const S=o.length*this.options.rowHeight,M=this.computeProjectBoundaryAnnotations(o),E=new dt(this.options,u,this.chartContext,S).render(M);k.append(...E);const T=l(this.chartContext,{className:"timeline-horizontal-scroll"}),A=l(this.chartContext,{className:"timeline-horizontal-scroll-content"}),D=this.chartContext.getInstanceId();T.id=`timeline-horizontal-scroll-${D}`;const I=y.reduce(((t,e)=>t+e.width),0);return A.style.width=`${I}px`,A.style.height="1px",T.appendChild(A),[v,k,x,w,T]}computeProjectBoundaryAnnotations(t){if(!this.options.enableProjectBoundary||0===t.length)return[];let e,n,i=1/0,r=-1/0;const s=this.options.inputDateFormat;for(const o of t){const t=o.showSummaryBar?o.summaryStart??o.startTime:o.startTime,a=o.showSummaryBar?o.summaryEnd??o.endTime:o.endTime;if(t){const n=U(t,s).valueOf();Number.isFinite(n)&&n<i&&(i=n,e=t)}if(a){const t=U(a,s).valueOf();Number.isFinite(t)&&t>r&&(r=t,n=a)}}if(!e||!n)return[];const o=Y(this.options.inputDateFormat)?n:U(n,this.options.inputDateFormat).add(1,"day").format(this.options.inputDateFormat),a={bgColor:"transparent",borderColor:this.options.projectBoundaryColor||this.options.annotationBorderColor,borderWidth:2};return[{...a,x1:e},{...a,x1:o}]}}function Me(t,e){if(!Number.isFinite(e)||e<=0)return t;const n=function(t){const e=t.match(/[ML]\s*-?\d+(?:\.\d+)?[,\s]+-?\d+(?:\.\d+)?/g);if(!e)return[];const n=[];for(const t of e){const e=t.match(/[ML]\s*(-?\d+(?:\.\d+)?)[,\s]+(-?\d+(?:\.\d+)?)/);e&&n.push([parseFloat(e[1]),parseFloat(e[2])])}return n}(t);if(n.length<3)return t;const i=[`M ${n[0][0]},${n[0][1]}`];for(let t=1;t<n.length-1;t++){const[r,s]=n[t-1],[o,a]=n[t],[l,d]=n[t+1],h=o-r,c=a-s,u=l-o,p=d-a,m=Math.abs(h)+Math.abs(c),g=Math.abs(u)+Math.abs(p),f=Math.min(e,m/2,g/2);if(f<=0||0===h&&0===c||0===u&&0===p){i.push(`L ${o},${a}`);continue}const b=0===h?0:Math.sign(h),v=0===c?0:Math.sign(c),y=0===u?0:Math.sign(u),x=0===p?0:Math.sign(p),w=o-b*f,k=a-v*f,C=o+y*f,S=a+x*f,M=b*x-v*y;if(0===M){i.push(`L ${o},${a}`);continue}const E=M>0?1:0;i.push(`L ${w},${k}`),i.push(`A ${f},${f} 0 0 ${E} ${C},${S}`)}const r=n[n.length-1];return i.push(`L ${r[0]},${r[1]}`),i.join(" ")}const Ee="http://www.w3.org/2000/svg",Te="data-from-id",Ae="data-to-id",De={paddingX:20,paddingY:15};class Ie{constructor(t){this.elements=[],this.chartContext=null,this.instanceId=t??"arrow_"+crypto.randomUUID().replace(/-/g,"").substring(0,9)}getInstanceId(){return this.instanceId}static calculateArrowPathFromRects(t,e,n,i="FS"){const{paddingX:r=De.paddingX,paddingY:s=De.paddingY}=n;switch(i){case"SS":return Ie.calculateSSPath(t,e,r,s);case"FF":return Ie.calculateFFPath(t,e,r,s);case"SF":return Ie.calculateSFPath(t,e,r,s);default:return Ie.calculateFSPath(t,e,r,s)}}static calculateArrowPath(t,e,n,i,r="FS"){const o=s(t,n),a=s(e,n),{paddingX:l=De.paddingX,paddingY:d=De.paddingY}=i;switch(r){case"SS":return Ie.calculateSSPath(o,a,l,d);case"FF":return Ie.calculateFFPath(o,a,l,d);case"SF":return Ie.calculateSFPath(o,a,l,d);default:return Ie.calculateFSPath(o,a,l,d)}}static calculateFSPath(t,e,n,i){const r=t.right,s=t.top+t.height/2,o=e.left-2,a=e.top+e.height/2,l=[`M ${r},${s}`];if(o>r){if(a!==s){const t=4,e=Math.max(r,(r+o-t)/2);l.push(`L ${e},${s}`),l.push(`L ${e},${a}`)}}else if(o<r)if(a!==s){const t=r+n,e=s+i*(a<s?-1:1),d=o-n,h=a+i*(a<s?1:-1);l.push(`L ${t},${s}`),l.push(`L ${t},${e}`),l.push(`L ${d},${e}`),h!==e&&l.push(`L ${d},${h}`),l.push(`L ${d},${a}`)}else{const t=r+n,e=s+i,d=o-n,h=a;l.push(`L ${t},${s}`),l.push(`L ${t},${e}`),l.push(`L ${d},${e}`),l.push(`L ${d},${h}`)}return l.push(`L ${o},${a}`),l.join(" ")}static calculateSSPath(t,e,n,i){const r=t.left,s=t.top+t.height/2,o=e.left-2,a=e.top+e.height/2,l=Math.min(r,o+2)-n,d=[`M ${r},${s}`];if(s===a)d.push(`L ${l},${s}`),d.push(`L ${l},${a}`);else{const t=s+i*(a>s?1:-1);d.push(`L ${l},${s}`),d.push(`L ${l},${t}`),d.push(`L ${l},${a}`)}return d.push(`L ${o},${a}`),d.join(" ")}static calculateFFPath(t,e,n,i){const r=t.right,s=t.top+t.height/2,o=e.right+2,a=e.top+e.height/2,l=Math.max(r,o-2)+n,d=[`M ${r},${s}`];if(s===a)d.push(`L ${l},${s}`),d.push(`L ${l},${a}`);else{const t=s+i*(a>s?1:-1);d.push(`L ${l},${s}`),d.push(`L ${l},${t}`),d.push(`L ${l},${a}`)}return d.push(`L ${o},${a}`),d.join(" ")}static calculateSFPath(t,e,n,i){const r=t.left,s=t.top+t.height/2,o=e.right+2,a=e.top+e.height/2,l=r-n,d=e.right+n,h=[`M ${r},${s}`];if(h.push(`L ${l},${s}`),s<=a){const e=t.bottom+i-t.height/2;h.push(`L ${l},${e}`),h.push(`L ${d},${e}`),h.push(`L ${d},${a}`)}else{const t=e.top-i;h.push(`L ${l},${t}`),h.push(`L ${d},${t}`),h.push(`L ${d},${a}`)}return h.push(`L ${o},${a}`),h.join(" ")}static drawArrow(t,e,n,i,r,s,o,a,l="FS",d=0){var h;const c=a?a.createElementNS(Ee,"path"):document.createElementNS(Ee,"path"),u=Me(Ie.calculateArrowPath(t,e,n,i,l),(null==(h=i.dependencies)?void 0:h.cornerRadius)??4);c.setAttribute("d",u);const p=i.arrowColor||"#94A3B8";c.setAttribute("stroke",p),c.setAttribute("stroke-width","1.5"),c.setAttribute("stroke-linejoin","round"),c.setAttribute("fill","transparent");const m=o?`arrowhead-${o}`:"arrowhead";return c.setAttribute("marker-end",`url(#${m})`),c.setAttribute(Te,r),c.setAttribute(Ae,s),c.setAttribute("data-dependency-type",l),c.addEventListener("mouseout",(function(){c.setAttribute("stroke",p)})),0!==d&&c.setAttribute("data-lag-px",String(d)),c}static updateArrow(t,e,n,i,r,s,o="FS"){var a;const l=Me(Ie.calculateArrowPath(t,e,n,i,o),(null==(a=i.dependencies)?void 0:a.cornerRadius)??4),d=`[${Te}="${r}"][${Ae}="${s}"]`,h=n.querySelector(`${d}:not([data-arrow-hit])`);h&&h.setAttribute("d",l);const c=n.querySelector(`${d}[data-arrow-hit]`);return c&&c.setAttribute("d",l),null!==h}createMarker(t){const e=t?t.createElementNS(Ee,"marker"):document.createElementNS(Ee,"marker"),n=`arrowhead-${this.instanceId}`;e.setAttribute("id",n),e.setAttribute("markerWidth","5"),e.setAttribute("markerHeight","5"),e.setAttribute("refX","4"),e.setAttribute("refY","2.5"),e.setAttribute("orient","auto"),e.setAttribute("fill","context-stroke");const i=t?t.createElementNS(Ee,"polygon"):document.createElementNS(Ee,"polygon");return i.setAttribute("points","0,0 5,2.5 0,5 1, 2.5"),e.appendChild(i),e}render(t,e,n,i){this.chartContext=i||null;const r=`timeline-arrows-${this.instanceId}`;let s=t.querySelector(`#${r}`);s||(s=i?i.createElementNS(Ee,"svg"):document.createElementNS(Ee,"svg"),s.setAttribute("id",r),t.appendChild(s)),this.svg=s,this.options={...De,...n},this.elements=e,this.svg.setAttribute("style",a({left:"0",position:"absolute",top:"0",pointerEvents:"none"})),this.svg.innerHTML="";const o=i?i.createElementNS(Ee,"defs"):document.createElementNS(Ee,"defs"),l=this.createMarker(i);return o.appendChild(l),this.svg.appendChild(o),this.svg.setAttribute("width",`${this.options.width}`),this.svg.setAttribute("height",`${this.options.height}`),this.elements.forEach((({fromId:t,toId:e,source:n,target:r,dependencyType:s,lagPx:o})=>{this.svg.appendChild(Ie.drawArrow(n,r,this.svg,this.options,t,e,this.instanceId,i,s,o))})),this.svg}renderFromRects(t,e,n,i){this.chartContext=i||null;const r=`timeline-arrows-${this.instanceId}`;let s=t.querySelector(`#${r}`);s||(s=i?i.createElementNS(Ee,"svg"):document.createElementNS(Ee,"svg"),s.setAttribute("id",r),t.appendChild(s)),this.svg=s,this.options={...De,...n},this.svg.setAttribute("style",a({left:"0",position:"absolute",top:"0",pointerEvents:"none"})),this.svg.innerHTML="";const o=i?i.createElementNS(Ee,"defs"):document.createElementNS(Ee,"defs");o.appendChild(this.createMarker(i)),this.svg.appendChild(o),this.svg.setAttribute("width",`${this.options.width}`),this.svg.setAttribute("height",`${this.options.height}`);const l=n.arrowColor||"#94A3B8",d=`arrowhead-${this.instanceId}`,h=this.options.dependencies??{},c=h.cornerRadius??4,u=h.hitWidth??0,p=h.tooltipTemplate,m=h.classBuilder;return e.forEach((t=>{const{fromId:e,toId:n,sourceRect:r,targetRect:s,dependencyType:o="FS",lagPx:a=0,fromTask:h,toTask:g,lagDays:f}=t,b=Me(Ie.calculateArrowPathFromRects(r,s,this.options,o),c);if(u>0){const t=this.createPathElement(i);t.setAttribute("d",b),t.setAttribute("stroke","transparent"),t.setAttribute("stroke-width",String(u)),t.setAttribute("stroke-linejoin","round"),t.setAttribute("fill","none"),t.setAttribute(Te,e),t.setAttribute(Ae,n),t.setAttribute("data-arrow-hit",""),t.setAttribute("pointer-events","stroke"),t.style.cursor=p?"pointer":"default",p&&h&&g&&this.attachArrowTooltip(t,p,{fromTask:h,toTask:g,type:o,lag:f??0}),this.svg.appendChild(t)}const v=this.createPathElement(i);if(v.setAttribute("d",b),v.setAttribute("stroke",l),v.setAttribute("stroke-width","1.5"),v.setAttribute("stroke-linejoin","round"),v.setAttribute("fill","transparent"),v.setAttribute("marker-end",`url(#${d})`),v.setAttribute("data-from-id",e),v.setAttribute("data-to-id",n),v.setAttribute("data-dependency-type",o),v.setAttribute("pointer-events","none"),m&&h&&g){const t=m({fromTask:h,toTask:g,type:o,lag:f??0}),e=Array.isArray(t)?t.join(" "):t??"";e&&v.setAttribute("class",e)}0!==a&&v.setAttribute("data-lag-px",String(a)),v.addEventListener("mouseout",(()=>{v.setAttribute("stroke",l)})),this.svg.appendChild(v)})),this.svg}createPathElement(t){return t?t.createElementNS(Ee,"path"):document.createElementNS(Ee,"path")}attachArrowTooltip(t,e,n){if(!this.chartContext)return;const i=this.chartContext,{tooltipId:r,tooltipBgColor:s,tooltipBorderColor:o,tooltipFontColor:a,tooltipFontFamily:l,tooltipFontSize:d,tooltipFontWeight:h}=this.options;if(!r)return;const c=t=>{const c=e(n);Mt(i,r,t.clientX,t.clientY,c,{bgColor:s??"#FFFFFF",borderColor:o??"#BCBCBC",fontColor:a??"#000000",fontFamily:l??"inherit",fontSize:d??"12px",fontWeight:h??"400",maxWidth:320})};t.addEventListener("mouseenter",c),t.addEventListener("mousemove",c),t.addEventListener("mouseleave",(()=>Et(i,r)))}}const $e={criticalTaskIds:new Set,criticalEdgeKeys:new Set};function Fe(t,e,n){return n.workingDaysBetween(t,e,{inclusive:!0})}function Be(t){const e=e=>function(t,e){return getComputedStyle(t).getPropertyValue(e).trim()}(t,e);return{barFill:e("--apex-gantt-bar-fill"),bgColor:e("--apex-gantt-background-color"),rowBgEven:e("--apex-gantt-row-bg-even"),rowBgOdd:e("--apex-gantt-row-bg-odd"),headerBg:e("--apex-gantt-header-bg"),gridLine:e("--apex-gantt-grid-line"),dependencyLine:e("--apex-gantt-dependency-line"),fontFamily:e("--apex-gantt-font-family"),fontSize:e("--apex-gantt-font-size"),fontColor:e("--apex-gantt-font-color")}}let Le;function Re(t,e){var n;if(!t)return 0;const i=function(){if(void 0!==Le)return Le;try{Le="undefined"==typeof document?null:document.createElement("canvas").getContext("2d")}catch{Le=null}return Le}();if(i)return i.font=e,i.measureText(t).width;const r=parseFloat((null==(n=/(\d+(?:\.\d+)?)px/.exec(e))?void 0:n[1])??"14");return t.length*r*.6}function He(t,e,n){if(e.key===It.ProgressRing)return"";return Nt(t,e,n.inputDateFormat,n.snap,n.calendar).replace(/<[^>]*>/g,"")}function Pe(t){return!Ft(t.key)||!!t.render}function ze(t,e,n,i,r){const s=new TextEncoder,o=[];let a=0;const l=t=>{const e="string"==typeof t?s.encode(t):t;o.push(e),a+=e.length},d=Math.max(1,Math.round(e)),h=Math.max(1,Math.round(n)),c=Math.max(1,Math.round(i??e)),u=Math.max(1,Math.round(r??n)),p=[],m=t=>{p[t]=a};l("%PDF-1.4\n"),l(new Uint8Array([37,255,255,255,255,10])),m(1),l("1 0 obj\n<< /Type /Catalog /Pages 2 0 R >>\nendobj\n"),m(2),l("2 0 obj\n<< /Type /Pages /Kids [3 0 R] /Count 1 >>\nendobj\n"),m(3),l(`3 0 obj\n<< /Type /Page /Parent 2 0 R /MediaBox [0 0 ${c} ${u}] /Resources << /XObject << /Im0 4 0 R >> >> /Contents 5 0 R >>\nendobj\n`),m(4),l(`4 0 obj\n<< /Type /XObject /Subtype /Image /Width ${d} /Height ${h} /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /DCTDecode /Length ${t.length} >>\nstream\n`),l(t),l("\nendstream\nendobj\n");const g=`q\n${c} 0 0 ${u} 0 0 cm\n/Im0 Do\nQ\n`;m(5),l(`5 0 obj\n<< /Length ${g.length} >>\nstream\n${g}endstream\nendobj\n`);const f=a;let b="xref\n0 6\n0000000000 65535 f \n";for(let t=1;t<6;t++)b+=`${String(p[t]).padStart(10,"0")} 00000 n \n`;l(b),l(`trailer\n<< /Size 6 /Root 1 0 R >>\nstartxref\n${f}\n%%EOF\n`);const v=o.reduce(((t,e)=>t+e.length),0),y=new Uint8Array(v);let x=0;for(const t of o)y.set(t,x),x+=t.length;return y}const Oe="http://www.w3.org/2000/svg";function We(t,e){t&&Object.assign(t.style,e)}function Ne(t){const e=[];for(let t=0;t<document.styleSheets.length;t++)try{const n=document.styleSheets[t];if(n.href&&!n.href.startsWith(window.location.origin))continue;if(n.cssRules)for(let t=0;t<n.cssRules.length;t++)e.push(n.cssRules[t].cssText)}catch(t){continue}document.querySelectorAll("style").forEach((t=>{t.textContent&&e.push(t.textContent)}));const n=function(t){const e=window.getComputedStyle(t),n=[];for(let e=0;e<t.style.length;e++){const i=t.style[e];if(i.startsWith("--")){const e=t.style.getPropertyValue(i);n.push(`${i}: ${e};`)}}return Array.from(e).forEach((t=>{if(t.startsWith("--")){const i=`${t}: ${e.getPropertyValue(t)};`;n.includes(i)||n.push(i)}})),0===n.length?"":`:root {\n ${n.join("\n ")}\n}`}(t);return n&&e.unshift(n),e.join("\n")}function qe(t,e){const{contentWidth:n}=e,i=t.querySelector(".timeline-horizontal-scroll");null==i||i.remove();const r=t.querySelector(".timeline-container"),s=t.querySelector(".tasks-container"),o=t.querySelector(".timeline-body-wrapper"),a=t.querySelector(".timeline-header"),l=t.querySelector(".timeline-body"),d=t.querySelector(".bar-container"),h=t.querySelector(".annotation-container");var c;We(r,{overflow:"visible",maxWidth:"none",width:"auto",position:"relative"}),We(s,{overflow:"visible",height:"auto",maxHeight:"none"}),We(o,{overflow:"visible",maxWidth:"none",width:`${n}px`}),o&&(o.scrollLeft=0),We(a,{overflow:"visible",maxWidth:"none",width:`${n}px`}),a&&(a.scrollLeft=0),c={width:`${n}px`,minWidth:`${n}px`,maxWidth:"none"},[l,d,h].forEach((t=>We(t,c)))}function Ye(t){const e=function(t){const e=t.querySelector(".gantt-container");if(!e)throw new Error("Gantt container not found");const n=e.querySelector(".timeline-container"),i=e.querySelector(".tasks-container");if(!n||!i)throw new Error("Timeline or tasks container not found");return{ganttContainer:e,timelineContainer:n,tasksContainer:i,horizontalScroll:e.querySelector(".timeline-horizontal-scroll"),timelineBodyWrapper:n.querySelector(".timeline-body-wrapper"),timelineHeader:n.querySelector(".timeline-header"),timelineBody:n.querySelector(".timeline-body"),barContainer:n.querySelector(".bar-container"),annotationContainer:n.querySelector(".annotation-container")}}(t),n=function(t){var e,n,i,r;const s=Math.max((null==(e=t.timelineBody)?void 0:e.scrollWidth)||0,(null==(n=t.barContainer)?void 0:n.scrollWidth)||0,(null==(i=t.annotationContainer)?void 0:i.scrollWidth)||0,(null==(r=t.timelineHeader)?void 0:r.scrollWidth)||0),o=t.tasksContainer.scrollWidth;return{contentWidth:s,tasksWidth:o,totalWidth:o+s,totalHeight:Math.max(t.timelineContainer.scrollHeight,t.tasksContainer.scrollHeight)}}(e),i=e.ganttContainer.cloneNode(!0);qe(i,n),We(i,{display:"flex",overflow:"visible",width:"fit-content",height:"auto"});const r=Ne(t),s=document.createElement("style");s.textContent=r,i.insertBefore(s,i.firstChild);const o=document.createElementNS(Oe,"svg");o.setAttribute("width",n.totalWidth.toString()),o.setAttribute("height",n.totalHeight.toString()),o.setAttribute("xmlns",Oe),o.setAttribute("viewBox",`0 0 ${n.totalWidth} ${n.totalHeight}`);const a=document.createElementNS(Oe,"foreignObject");a.setAttribute("width",n.totalWidth.toString()),a.setAttribute("height",n.totalHeight.toString()),a.setAttribute("x","0"),a.setAttribute("y","0"),a.appendChild(i),o.appendChild(a);return{svgString:'<?xml version="1.0" encoding="UTF-8"?>\n'+(new XMLSerializer).serializeToString(o),width:n.totalWidth,height:n.totalHeight}}function Ue(t,e){const n=URL.createObjectURL(t),i=document.createElement("a");i.href=n,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout((()=>URL.revokeObjectURL(n)),100)}function je(t,e,n){return new Promise(((i,r)=>{t.toBlob((t=>t?i(t):r(new Error("Canvas export produced no blob"))),e,n)}))}const Ve=async(t,e="svg",n={})=>{try{const l=Ye(t),d=n.scale??2,h=n.background??"#FFFFFF",c=Date.now();if("svg"===e)return void Ue(new Blob([l.svgString],{type:"image/svg+xml;charset=utf-8"}),`gantt-chart-${c}.svg`);const u=await function(t,e,n){return new Promise(((i,r)=>{const s=document.createElement("canvas");s.width=Math.max(1,Math.round(t.width*e)),s.height=Math.max(1,Math.round(t.height*e));const o=s.getContext("2d");if(!o)return void r(new Error("Canvas 2D context unavailable"));const a=new Image;a.decoding="sync";const l="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(t.svgString);a.onload=()=>{o.setTransform(e,0,0,e,0,0),o.fillStyle=n||"#FFFFFF",o.fillRect(0,0,t.width,t.height),o.drawImage(a,0,0,t.width,t.height),i(s)},a.onerror=()=>r(new Error("Failed to rasterize gantt SVG")),a.src=l}))}(l,d,h);if("png"===e){return void Ue(await je(u,"image/png"),`gantt-chart-${c}.png`)}const p=await je(u,"image/jpeg",.92),m=new Uint8Array(await p.arrayBuffer());Ue((i=m,r=u.width,s=u.height,o=l.width,a=l.height,new Blob([ze(i,r,s,o,a)],{type:"application/pdf"})),`gantt-chart-${c}.pdf`)}catch(t){throw R.error("Error exporting gantt chart:",t),t}var i,r,s,o,a},_e=["contains","notContains","equals","notEquals","startsWith","endsWith","isEmpty","notEmpty"],Ge=["equals","notEquals","gt","gte","lt","lte","isEmpty","notEmpty"],Ke=["on","before","after","isEmpty","notEmpty"];function Xe(t){if(Ft(t))switch(t){case It.StartTime:case It.EndTime:case It.BaselineStart:case It.BaselineEnd:return"date";case It.Duration:case It.Progress:case It.ProgressRing:case It.BaselineVariance:return"number";default:return"text"}return"text"}function Ze(t){return"number"===t?Ge:"date"===t?Ke:_e}function Qe(t,e,n){if("number"!=typeof t||Number.isNaN(t))return!1;const i=Math.floor(t/tt),r=Math.floor(n/tt);switch(e){case"on":return i===r;case"before":return i<r;case"after":return i>r;default:return!1}}function Je(t){return null==t||""===t||"number"==typeof t&&Number.isNaN(t)}function tn(t,e,n,i){const r=Gt(t,e.field,n,i);if("isEmpty"===e.operator)return Je(r);if("notEmpty"===e.operator)return!Je(r);const s=Xe(e.field);if("date"===s){if(null==e.value||""===e.value)return!0;const t=U(String(e.value),i.inputDateFormat).valueOf();if(Number.isNaN(t)){const t=Date.parse(String(e.value));return!!Number.isNaN(t)||Qe(r,e.operator,t)}return Qe(r,e.operator,t)}if("number"===s){if(null==e.value||""===e.value)return!0;const t="number"==typeof e.value?e.value:Number(e.value);return!!Number.isNaN(t)||function(t,e,n){if("number"!=typeof t||Number.isNaN(t))return!1;switch(e){case"equals":return t===n;case"notEquals":return t!==n;case"gt":return t>n;case"gte":return t>=n;case"lt":return t<n;case"lte":return t<=n;default:return!1}}(r,e.operator,t)}return null==e.value||""===e.value||function(t,e,n){const i=null==t?"":String(t).toLowerCase(),r=n.toLowerCase();switch(e){case"contains":return i.includes(r);case"notContains":return!i.includes(r);case"equals":return i===r;case"notEquals":return i!==r;case"startsWith":return i.startsWith(r);case"endsWith":return i.endsWith(r);default:return!1}}(r,e.operator,String(e.value))}const en={ganttContainer:".gantt-container",actionsContainer:".gantt-actions-container",splitBar:".split-bar-container",splitViewContainer:".split-view-container",tasksContainer:".tasks-container",tasksHeader:".tasks-header",tasksBodyWrapper:".tasks-body-wrapper",tasksDataContainer:".tasks-data-container",tasksDataRow:".tasks-data-row",tasksEmptyRow:".tasks-empty-row",tasksDataCell:".tasks-data-cell",timelineContainer:".timeline-container",timelineHeader:".timeline-header",timelineHeaderRow:".timeline-header-row",timelineHeaderCell:".timeline-header-cell",timelineBodyWrapper:".timeline-body-wrapper",timelineBody:".timeline-body",timelineDataRow:".timeline-data-row",timelineEmptyRow:".timeline-empty-row",timelineDataCell:".timeline-data-cell",horizontalScroll:".timeline-horizontal-scroll",horizontalScrollContent:".timeline-horizontal-scroll-content",barContainer:".bar-container",virtualizerTopSpacer:".virtualizer-top-spacer",virtualizerBottomSpacer:".virtualizer-bottom-spacer"};class nn{constructor(){this.state={scrollPosition:{horizontal:0,tasksVertical:0,timelineVertical:0},pixelsPerMs:0,collapsedTasks:new Set,selectedTaskIds:[],hasState:!1}}captureState(t,e,n,i){const r=t.querySelector(".timeline-body-wrapper"),s=t.querySelector(".timeline-horizontal-scroll"),o=t.querySelector(".split-view-container");this.state.scrollPosition={horizontal:(null==r?void 0:r.scrollLeft)||(null==s?void 0:s.scrollLeft)||0,tasksVertical:(null==o?void 0:o.scrollTop)||0,timelineVertical:(null==o?void 0:o.scrollTop)||0},this.state.pixelsPerMs=n,this.state.hasState=!0,this.state.collapsedTasks=new Set(e.getFlatTasks().filter((t=>t.collapsed)).map((t=>t.id))),this.state.selectedTaskIds=i??[]}restoreState(t,e=!1){if(e)return;const{horizontal:n,tasksVertical:i}=this.state.scrollPosition,r=t.querySelector(".timeline-body-wrapper");r&&(r.scrollLeft=n);const s=t.querySelector(".timeline-header");s&&(s.scrollLeft=n);const o=t.querySelector(".timeline-horizontal-scroll");o&&(o.scrollLeft=n);const a=t.querySelector(".split-view-container");a&&(a.scrollTop=i)}getPixelsPerMs(){return this.state.pixelsPerMs}getCapturedVerticalScroll(){return this.state.scrollPosition.tasksVertical}getSelectedTaskIds(){return this.state.selectedTaskIds}hasState(){return this.state.hasState}clearState(){this.state={scrollPosition:{horizontal:0,tasksVertical:0,timelineVertical:0},pixelsPerMs:0,collapsedTasks:new Set,selectedTaskIds:[],hasState:!1}}}const rn=["endTime","progress","type","parentId","dependency","barBackgroundColor","rowBackgroundColor","collapsed"];class sn{static getNestedValue(t,e){if(!t||!e)return;const n=e.split(".");let i=t;for(const t of n){if(null==i)return;i=i[t]}return i}static processParsingValue(t,e){if("string"==typeof e)return this.getNestedValue(t,e);const{key:n,transform:i}=e,r=this.getNestedValue(t,n);if(i&&"function"==typeof i)try{return i(r)}catch(t){return R.warn(`DataParser: Transform function failed for key "${n}":`,t),r}return r}static buildTaskInput(t,e,n){const i=this.processParsingValue(t,e.id),r=this.processParsingValue(t,e.name),s=this.processParsingValue(t,e.startTime);if(!i||!r||!s)return R.warn(`DataParser: Skipping item at index ${n} - missing required fields`,{id:i,name:r,startTime:s,rawItem:t}),null;const o={id:i,name:r,startTime:s};for(const n of rn)if(void 0!==e[n]){const i=this.processParsingValue(t,e[n]);void 0!==i&&(o[n]=i)}return o}static parse(t,e){return Array.isArray(t)?e?t.map(((t,n)=>{try{return this.buildTaskInput(t,e,n)}catch(e){return R.warn(`DataParser: Error parsing item at index ${n}:`,e,t),null}})).filter((t=>null!==t)):(R.warn("DataParser: Parsing config is required"),[]):(R.warn("DataParser: Data must be an array"),[])}static validateConfig(t){return!!t&&(!!(t.id&&t.name&&t.startTime)||(R.warn("DataParser: Parsing config must include id, name, and startTime"),!1))}}class on{constructor(t,e,n){this.options=t,this.domCache=e,this.chartContext=n,this.bodyLine=null,this.label=null,this.mouseMoveHandler=null,this.mouseLeaveHandler=null,this.scrollHandler=null,this.headerMoveHandler=null,this.headerLeaveHandler=null,this.rafId=null,this.lastClientX=null,this.geometry=null,this.subTier="day"}updateOptions(t){this.options=t}attach(t,e){if(this.detach(),!this.options.enableCrosshair)return;const n=this.domCache.timelineBodyWrapper,i=this.domCache.timelineHeader,r=null==n?void 0:n.querySelector(en.timelineBody);if(n&&r){if(this.geometry=t,this.subTier=e,this.bodyLine=this.createLine(),r.appendChild(this.bodyLine),i){const t=i.querySelectorAll(en.timelineHeaderRow),e=t[t.length-1]??i;this.label=this.chartContext.createElement("div"),this.label.className="gantt-crosshair-label",this.label.style.background=this.options.crosshairColor,this.label.style.display="none",e.appendChild(this.label)}this.mouseMoveHandler=t=>this.onMouseMove(t),this.mouseLeaveHandler=()=>this.hide(),this.scrollHandler=()=>this.onScroll(),n.addEventListener("mousemove",this.mouseMoveHandler),n.addEventListener("mouseleave",this.mouseLeaveHandler),n.addEventListener("scroll",this.scrollHandler,{passive:!0}),i&&(this.headerMoveHandler=t=>this.onMouseMove(t),this.headerLeaveHandler=()=>this.hide(),i.addEventListener("mousemove",this.headerMoveHandler),i.addEventListener("mouseleave",this.headerLeaveHandler))}}createLine(){const t=this.chartContext.createElement("div");return t.className="gantt-crosshair",t.style.background=this.options.crosshairColor,t.style.display="none",t}detach(){var t,e;const n=this.domCache.timelineBodyWrapper;n&&(this.mouseMoveHandler&&n.removeEventListener("mousemove",this.mouseMoveHandler),this.mouseLeaveHandler&&n.removeEventListener("mouseleave",this.mouseLeaveHandler),this.scrollHandler&&n.removeEventListener("scroll",this.scrollHandler));const i=this.domCache.timelineHeader;i&&(this.headerMoveHandler&&i.removeEventListener("mousemove",this.headerMoveHandler),this.headerLeaveHandler&&i.removeEventListener("mouseleave",this.headerLeaveHandler)),null!==this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null),null==(t=this.bodyLine)||t.remove(),null==(e=this.label)||e.remove(),this.bodyLine=null,this.label=null,this.mouseMoveHandler=null,this.mouseLeaveHandler=null,this.scrollHandler=null,this.headerMoveHandler=null,this.headerLeaveHandler=null,this.lastClientX=null,this.geometry=null}onMouseMove(t){this.lastClientX=t.clientX,this.scheduleUpdate()}onScroll(){null!==this.lastClientX&&this.scheduleUpdate()}scheduleUpdate(){null===this.rafId&&(this.rafId=requestAnimationFrame((()=>{this.rafId=null,this.update()})))}update(){if(null===this.lastClientX||!this.bodyLine||!this.geometry)return;const t=this.domCache.timelineBodyWrapper;if(!t)return;const e=t.getBoundingClientRect(),n=this.lastClientX-e.left;if(n<0||n>e.width)return void this.hide();const i=n+t.scrollLeft,r=P(this.options.barLabel),s=this.geometry.dateForX(i-r).toDate(),o=`${i}px`;this.bodyLine.style.left=o,this.bodyLine.style.display="block",this.label&&(this.label.style.left=o,this.label.style.display="block",this.label.textContent=this.formatLabel(s))}hide(){this.bodyLine&&(this.bodyLine.style.display="none"),this.label&&(this.label.style.display="none"),this.lastClientX=null}formatLabel(t){const e=this.options.crosshairLabelFormat;if(e)return e(t,this.subTier);const n="minute"===this.subTier||"hour"===this.subTier||"halfday"===this.subTier?"MM/DD HH:mm":"ddd MM/DD/YYYY";return w(t).format(n)}}const an="splitview-resize",ln="timeline-horizontal-scroll";class dn{constructor(t,e,n,i,r){this.element=t,this.options=e,this.domCache=n,this.chartContext=i,this.instanceId=r,this.scrollbarResizeObserver=null,this.splitBarResizeHandler=null,this.timelineScrollHandlers={},this.isSyncingScroll=!1}setupTimelineHorizontalScroll(){const t=this.domCache.horizontalScroll,e=this.domCache.timelineHeader,n=this.domCache.timelineBodyWrapper;if(!t||!e||!n)return;this.updateHorizontalScrollbarContent(),this.applyScrollbarStylesToElement(t),this.timelineScrollHandlers.bodyScroll&&n.removeEventListener("scroll",this.timelineScrollHandlers.bodyScroll),this.timelineScrollHandlers.horizontalScroll&&t.removeEventListener("scroll",this.timelineScrollHandlers.horizontalScroll);const i=i=>{if(this.isSyncingScroll)return;this.isSyncingScroll=!0;const r=t.scrollLeft;e.scrollLeft=r,n.scrollLeft=r,requestAnimationFrame((()=>{this.isSyncingScroll=!1}))},r=i=>{if(this.isSyncingScroll)return;this.isSyncingScroll=!0;const r=n.scrollLeft;t.scrollLeft=r,e.scrollLeft=r,requestAnimationFrame((()=>{this.isSyncingScroll=!1}))};t.addEventListener("scroll",i,{passive:!0}),n.addEventListener("scroll",r,{passive:!0}),this.timelineScrollHandlers={horizontalScroll:i,bodyScroll:r}}positionHorizontalScrollbar(){const t=this.domCache.horizontalScroll,e=this.domCache.ganttContainer,n=this.domCache.tasksContainer;if(!t||!e)return void R.warn("Missing elements for scrollbar positioning");e.offsetHeight;const i=n?n.offsetWidth:0,r=this.domCache.splitBar,s=i+(r?r.offsetWidth:0)+2,o=window.getComputedStyle(this.element),a=parseFloat(o.paddingLeft)||0,l=parseFloat(o.paddingBottom)||0,d="rtl"===o.direction;t.style.left=`${d?a:s+a}px`,t.style.bottom=`${l}px`;const h=e.clientWidth-s;t.style.width=`${Math.max(0,h)}px`}setInitialHorizontalScroll(t){if(!t)return;const{horizontalScroll:e,timelineHeader:n,timelineBodyWrapper:i}=this.domCache;if(!i)return;const r=t=>{t&&(t.scrollLeft=t.scrollWidth)};r(i),r(n),r(e)}compensateForScrollbar(){const t=this.domCache.tasksBodyWrapper,e=this.domCache.tasksHeader;if(!t||!e)return;const n=t.offsetWidth-t.clientWidth;e.style.paddingRight="",e.style.boxSizing="",n>0&&(e.style.paddingRight=`${n}px`,e.style.boxSizing="border-box")}setupScrollbarResizeObserver(){if(!this.element)return;this.scrollbarResizeObserver&&this.scrollbarResizeObserver.disconnect(),this.scrollbarResizeObserver=new ResizeObserver((()=>{this.positionHorizontalScrollbar()})),this.scrollbarResizeObserver.observe(this.element);const t=this.domCache.ganttContainer;t&&this.scrollbarResizeObserver.observe(t),this.setupSplitBarResizeListener()}setupSplitBarResizeListener(){this.splitBarResizeHandler&&this.chartContext.removeEventListener(an,this.splitBarResizeHandler),this.splitBarResizeHandler=()=>{requestAnimationFrame((()=>{this.positionHorizontalScrollbar()}))},this.chartContext.addEventListener(an,this.splitBarResizeHandler)}updateHorizontalScrollbarContent(){const t=this.domCache.horizontalScroll,e=this.domCache.horizontalScrollContent,n=this.domCache.timelineBody;if(!t||!e||!n)return void R.warn("Scrollbar update: Missing elements",{horizontalScroll:!!t,scrollContent:!!e,timelineBody:!!n});const i=n.querySelector(".timeline-data-row"),r=(null==i?void 0:i.offsetWidth)??n.scrollWidth;e.style.width=`${r}px`}applyScrollbarStylesToElement(t){const{backgroundColor:e}=this.options;if(!this.isColorDark(e))return;const{borderColor:n,cellBorderColor:i}=this.options,r=`scrollbar-${this.instanceId}-${Date.now()}`,s=`\n #${t.id||ln} {\n scrollbar-width: thin;\n scrollbar-color: ${n} ${e};\n }\n\n #${t.id||ln}::-webkit-scrollbar {\n width: 12px;\n height: 12px;\n }\n\n #${t.id||ln}::-webkit-scrollbar-track {\n background: ${e};\n border-radius: 4px;\n }\n\n #${t.id||ln}::-webkit-scrollbar-thumb {\n background: ${n};\n border-radius: 4px;\n border: 2px solid ${e};\n }\n\n #${t.id||ln}::-webkit-scrollbar-thumb:hover {\n background: ${i};\n }\n `;t.id||(t.id=`timeline-horizontal-scroll-${this.instanceId}`),this.chartContext.injectStyles(s,r)}updateOptions(t){this.options=t}disableHeaderMousewheelScroll(){const t=this.domCache.timelineHeader;if(!t)return;t.addEventListener("wheel",(t=>{t.preventDefault()}),{passive:!1})}isColorDark(t){const e=t.replace("#","");return(.299*parseInt(e.substring(0,2),16)+.587*parseInt(e.substring(2,4),16)+.114*parseInt(e.substring(4,6),16))/255<.5}cleanup(){if(this.timelineScrollHandlers.bodyScroll||this.timelineScrollHandlers.horizontalScroll){const t=this.domCache.horizontalScroll,e=this.domCache.timelineBodyWrapper;t&&this.timelineScrollHandlers.horizontalScroll&&t.removeEventListener("scroll",this.timelineScrollHandlers.horizontalScroll),e&&this.timelineScrollHandlers.bodyScroll&&e.removeEventListener("scroll",this.timelineScrollHandlers.bodyScroll),this.timelineScrollHandlers={}}this.scrollbarResizeObserver&&(this.scrollbarResizeObserver.disconnect(),this.scrollbarResizeObserver=null),this.splitBarResizeHandler&&(this.chartContext.removeEventListener(an,this.splitBarResizeHandler),this.splitBarResizeHandler=null)}}const hn=180/365.25/2/tt,cn=7680/tt;class un{constructor(t,e,n,i,r,s){this.element=t,this.domCache=e,this.chartContext=n,this.instanceId=i,this.getPixelsPerMs=r,this.callbacks=s,this.zoomHandler=null}static clamp(t){return Math.min(cn,Math.max(hn,t))}setupZoomEventListener(){const t=this.instanceId,e=this.domCache.timelineContainer;e?(this.zoomHandler&&e.removeEventListener("wheel",this.zoomHandler),this.zoomHandler=t=>{if(!t.ctrlKey)return;t.preventDefault();const e=t.deltaY<0?1.1:1/1.1;this.applyZoom(e,t.clientX)},e.addEventListener("wheel",this.zoomHandler)):R.warn(`[${t}] Timeline element not found for zoom listener`)}zoomIn(){this.applyZoom(1.4)}zoomOut(){this.applyZoom(1/1.4)}isAtMaxZoom(){return this.getPixelsPerMs()>=cn-1e-12}isAtMinZoom(){return this.getPixelsPerMs()<=hn+1e-18}applyZoom(t,e){const n=this.getPixelsPerMs(),i=un.clamp(n*t);if(i===n)return;const r=i/n,s=this.domCache.timelineBodyWrapper,o=(null==s?void 0:s.scrollLeft)??0;let a=0;if(s){const t=s.clientWidth;if(void 0!==e){const n=s.getBoundingClientRect();a=Math.max(0,Math.min(t,e-n.left))}else a=t/2}const l=Math.max(0,(o+a)*r-a);this.callbacks.onZoomChange(i),this.callbacks.onToolbarUpdate(),this.callbacks.onTimelineRerender(),this.callbacks.onDependencyArrowsRender(),this.applyHorizontalScroll(l,!1),requestAnimationFrame((()=>{this.callbacks.onScrollbarUpdate(),this.callbacks.onScrollbarPosition(),this.applyHorizontalScroll(l,!0)}))}applyHorizontalScroll(t,e){const{timelineBodyWrapper:n,timelineHeader:i,horizontalScroll:r}=this.domCache;n&&(n.scrollLeft=t),i&&(i.scrollLeft=t),e&&r&&(r.scrollLeft=t)}updateToolbarAfterZoom(){this.domCache.actionsContainer&&this.callbacks.onToolbarUpdate()}cleanup(){if(this.zoomHandler){const t=this.domCache.timelineContainer;t&&t.removeEventListener("wheel",this.zoomHandler),this.zoomHandler=null}}}const pn="aria-valuenow";class mn{constructor(t,e,n,i={}){this.chartContext=t,this.leftContent=e,this.rightContent=n,this.options=i,this.isDragging=!1,this.mouseMoveHandler=null,this.mouseUpHandler=null}getSplitViewStyles(){return"\n .split-view-container {\n display: flex !important;\n height: 100%;\n width: 100%;\n position: relative;\n box-sizing: border-box;\n overflow-x: hidden;\n overflow-y: auto;\n }\n\n .split-view-container .split-left-container {\n flex-grow: 0 !important;\n flex-shrink: 1 !important;\n overflow: visible;\n display: flex !important;\n flex-direction: column;\n position: relative;\n box-sizing: border-box;\n height: fit-content;\n min-height: 100%;\n }\n\n .split-view-container .split-right-container {\n overflow: visible;\n position: relative;\n flex: 1 !important;\n display: flex !important;\n flex-direction: column;\n min-width: 0;\n box-sizing: border-box;\n height: fit-content;\n min-height: 100%;\n }\n \n .split-view-container .split-bar-container {\n cursor: col-resize !important;\n user-select: none !important;\n touch-action: none;\n height: 100%;\n align-items: center;\n background: var(--split-bar-color, #DEE2E6);\n display: flex;\n flex: 0 0 auto;\n justify-content: center;\n min-width: 6px;\n width: 6px;\n z-index: 15;\n position: sticky;\n top: 0;\n box-sizing: border-box;\n border-left: 1px solid var(--split-bar-border-color, #BBBBBB);\n border-right: 1px solid var(--split-bar-border-color, #BBBBBB);\n opacity: 1;\n visibility: visible;\n transition: background-color 0.2s ease, border-color 0.2s ease;\n }\n\n .split-view-container .split-bar-container:hover {\n background: var(--split-bar-hover-color, #007BFF);\n border-color: var(--split-bar-hover-border-color, #0056B3);\n }\n\n .split-view-container .split-bar-container .resize-handler {\n border-left: 1.5px solid var(--split-bar-handle-color, #666666);\n border-right: 1.5px solid var(--split-bar-handle-color, #666666);\n height: 20px;\n width: 4px;\n position: relative;\n pointer-events: none;\n box-sizing: border-box;\n background: rgba(102, 102, 102, 0.3);\n display: block;\n border-radius: 1px;\n margin: 0;\n padding: 0;\n opacity: 1;\n visibility: visible;\n transition: background-color 0.2s ease, border-color 0.2s ease;\n }\n\n .split-view-container .split-bar-container:hover .resize-handler {\n background: rgba(255, 255, 255, 0.9);\n border-color: #FFFFFF;\n }\n\n .split-view-container.dragging {\n user-select: none;\n cursor: col-resize;\n }\n\n .split-view-container.dragging * {\n pointer-events: none;\n }\n\n .split-view-container.dragging .split-bar-container {\n pointer-events: all;\n }\n\n :host .split-view-container {\n display: flex !important;\n height: auto;\n width: 100%;\n position: relative;\n box-sizing: border-box;\n overflow-y: auto; /* shadow DOM */\n }\n "}injectStyles(){this.chartContext.injectStyles(this.getSplitViewStyles(),"split-view-styles",{priority:"normal"})}buildElements(){const{leftContainerClass:t="",leftContainerWidth:e=425,rightContainerClass:n=""}=this.options;this.leftContainer=l(this.chartContext,{className:"split-left-container"+(t?" "+t:""),style:{flexBasis:`${e}px`}}),this.rightContainer=l(this.chartContext,{className:"split-right-container"+(n?" "+n:"")});const i=l(this.chartContext,{className:"resize-handler"}),r=l(this.chartContext,{className:"split-bar-click-area"});r.style.cssText="\n position: absolute;\n top: 0;\n left: 50%;\n transform: translateX(-50%);\n width: 20px;\n height: 100%;\n cursor: col-resize;\n z-index: 10;\n background: transparent;\n display: block;\n box-sizing: border-box;\n ",this.splitBarContainer=l(this.chartContext,{className:"split-bar-container"}),this.splitBarContainer.setAttribute("role","separator"),this.splitBarContainer.setAttribute("aria-orientation","vertical"),this.splitBarContainer.setAttribute("aria-label","Resize panels"),this.splitBarContainer.setAttribute(pn,String(e)),this.splitBarContainer.setAttribute("aria-valuemin","0"),this.splitBarContainer.setAttribute("aria-valuemax",String(4*e)),this.splitBarContainer.setAttribute("tabindex","0"),this.splitBarContainer.append(i,r),Array.isArray(this.leftContent)?this.leftContainer.append(...this.leftContent):this.leftContainer.append(this.leftContent),Array.isArray(this.rightContent)?this.rightContainer.append(...this.rightContent):this.rightContainer.append(this.rightContent)}isRtl(){var t,e;const n=(null==(t=this.leftContainer)?void 0:t.parentElement)??(null==(e=this.splitBarContainer)?void 0:e.parentElement);return!!n&&"rtl"===getComputedStyle(n).direction}attachEventListeners(){this.splitBarContainer.addEventListener("pointerdown",(t=>{var e,n;const i=t;if(null!=i.button&&i.button>0)return;t.preventDefault(),this.isDragging=!0;const r=i.pointerId??null;if(null!=i.pointerId)try{null==(n=(e=this.splitBarContainer).setPointerCapture)||n.call(e,i.pointerId)}catch{}const s=this.splitBarContainer.closest(".split-view-container");null==s||s.classList.add("dragging");const o=this.isRtl();this.mouseMoveHandler=t=>{var e;if(!this.isDragging)return;const n=t;if(null!=r&&null!=n.pointerId&&n.pointerId!==r)return;const i=null==(e=this.leftContainer.parentElement)?void 0:e.getBoundingClientRect();if(!i)return;const s=o?i.right-t.clientX:t.clientX-i.left,a=i.width-50,l=Math.max(0,Math.min(a,s));this.leftContainer.style.flexBasis=`${l}px`,this.splitBarContainer.setAttribute(pn,String(Math.round(l))),this.dispatchResizeEvent()},this.mouseUpHandler=()=>{var t,e;if(this.isDragging=!1,null!=i.pointerId)try{null==(e=(t=this.splitBarContainer).releasePointerCapture)||e.call(t,i.pointerId)}catch{}const n=this.splitBarContainer.closest(".split-view-container");null==n||n.classList.remove("dragging"),this.dispatchResizeEvent(),this.mouseMoveHandler&&(this.chartContext.removeEventListener("pointermove",this.mouseMoveHandler),this.mouseMoveHandler=null),this.mouseUpHandler&&(this.chartContext.removeEventListener("pointerup",this.mouseUpHandler),this.chartContext.removeEventListener("pointercancel",this.mouseUpHandler),this.mouseUpHandler=null)},this.chartContext.addEventListener("pointermove",this.mouseMoveHandler),this.chartContext.addEventListener("pointerup",this.mouseUpHandler),this.chartContext.addEventListener("pointercancel",this.mouseUpHandler)})),this.splitBarContainer.addEventListener("keydown",(t=>{let e;const n=parseInt(this.leftContainer.style.flexBasis)||this.options.leftContainerWidth||400;switch(t.key){case"ArrowLeft":t.preventDefault(),e=this.isRtl()?n+10:Math.max(0,n-10),this.leftContainer.style.flexBasis=`${e}px`,this.splitBarContainer.setAttribute(pn,String(e)),this.dispatchResizeEvent();break;case"ArrowRight":t.preventDefault(),e=this.isRtl()?Math.max(0,n-10):n+10,this.leftContainer.style.flexBasis=`${e}px`,this.splitBarContainer.setAttribute(pn,String(e)),this.dispatchResizeEvent();break;case"Home":t.preventDefault(),this.leftContainer.style.flexBasis="0px",this.splitBarContainer.setAttribute(pn,"0"),this.dispatchResizeEvent();break;case"End":{t.preventDefault();const e=this.splitBarContainer.parentElement;if(e){const t=e.clientWidth-50;this.leftContainer.style.flexBasis=`${t}px`,this.splitBarContainer.setAttribute(pn,String(Math.round(t)))}this.dispatchResizeEvent();break}}}))}dispatchResizeEvent(){const t=new CustomEvent("splitview-resize",{bubbles:!0,detail:{leftWidth:parseInt(this.leftContainer.style.flexBasis)||0}});this.chartContext.dispatchEvent(t)}cleanupEventListeners(){this.mouseMoveHandler&&(this.chartContext.removeEventListener("pointermove",this.mouseMoveHandler),this.mouseMoveHandler=null),this.mouseUpHandler&&(this.chartContext.removeEventListener("pointerup",this.mouseUpHandler),this.chartContext.removeEventListener("pointercancel",this.mouseUpHandler),this.mouseUpHandler=null)}render(){this.injectStyles(),this.buildElements(),this.attachEventListeners();const t=l(this.chartContext,{className:"split-view-container"});return t.append(this.leftContainer,this.splitBarContainer,this.rightContainer),[t]}destroy(){this.cleanupEventListeners()}}const gn="data-chart-instance";class fn{constructor(t,e,n,i,r){this.element=t,this.options=e,this.domCache=n,this.chartContext=i,this.instanceId=r}updateOptions(t){this.options=t}setupChartContainerPositioning(){if(this.element){"static"===window.getComputedStyle(this.element).position&&(this.element.style.position="relative"),this.element.style.isolation="isolate"}}createLayout(t,e,n,i,r){t.style.position="relative",t.style.isolation="isolate";const s=this.instanceId,o=l(this.chartContext,{className:en.tasksContainer.slice(1)});let a,d;if(!Array.isArray(e))return void R.error("Tasks table should be an array of [header, body]");a=e[0],d=e[1];const h=l(this.chartContext,{className:en.tasksBodyWrapper.slice(1)});h.appendChild(d),o.appendChild(a),o.appendChild(h);const c=l(this.chartContext,{className:en.timelineContainer.slice(1)});c.setAttribute(gn,s),c.setAttribute("dir","ltr");const u=n[0];c.appendChild(u);const p=l(this.chartContext,{className:en.timelineBodyWrapper.slice(1)});for(let t=1;t<n.length-1;t++)p.appendChild(n[t]);c.appendChild(p);const m=n[n.length-1];if(m.setAttribute("dir","ltr"),i){const e=new mn(this.chartContext,o,c,{leftContainerClass:"",leftContainerWidth:r,rightContainerClass:""}).render();t.append(...e)}else o.style.flex=`0 0 ${r}px`,t.append(o,c);t.appendChild(m)}syncTasksColumnWidths(){this.domCache.tasksContainer}fillEmptyRowsAfterRender(){const t=this.domCache.ganttContainer,e=this.domCache.timelineBody,n=this.domCache.tasksDataContainer;if(!t||!e||!n)return;e.querySelectorAll(en.timelineEmptyRow).forEach((t=>t.remove()));n.querySelectorAll(en.tasksEmptyRow).forEach((t=>t.remove()));const i=t.clientHeight,r=e.querySelectorAll(`${en.timelineDataRow}:not(${en.timelineEmptyRow})`).length,s=this.options.rowHeight,o=Math.floor(i/s),a=Math.max(0,o-r);if(0===a)return;let l=0;const d=e.querySelector(en.timelineDataRow);if(d)l=d.querySelectorAll(en.timelineDataCell).length;else{const t=this.domCache.timelineHeader;if(t){l=t.querySelectorAll(en.timelineHeaderCell).length}}if(0===l)return;const h=this.readSubHeaderCellWidths(l),c=n.querySelector(".tasks-add-row")?1:0;for(let t=0;t<a;t++){const n=this.createEmptyTimelineRow(r+t,h);e.appendChild(n)}const u=Math.max(0,a-c);for(let t=0;t<u;t++){const e=this.createEmptyTaskRow(r+c+t);n.appendChild(e)}}readSubHeaderCellWidths(t){const e=this.domCache.timelineHeader,n=[];if(e){const t=e.querySelectorAll(en.timelineHeaderRow),i=t[t.length-1];if(i){i.querySelectorAll(en.timelineHeaderCell).forEach((t=>{const e=t.getBoundingClientRect().width;e>0&&n.push(e)}))}}if(n.length===t)return n;const i=n[0]??0;return Array.from({length:t},(()=>i))}createEmptyTimelineRow(t,e){const n=l(this.chartContext,{className:`${en.timelineDataRow.slice(1)} ${en.timelineEmptyRow.slice(1)}`}),{rowHeight:i}=this.options,r=this.instanceId;return n.setAttribute("data-taskid",`empty-${t}`),n.setAttribute(gn,r),n.style.height=`${i}px`,e.forEach((t=>{const e=l(this.chartContext,{className:en.timelineDataCell.slice(1),style:{boxSizing:"border-box",height:`${i}px`,minWidth:`${t}px`,maxWidth:`${t}px`,flexShrink:"0"}});e.setAttribute(gn,r),n.appendChild(e)})),n}createEmptyTaskRow(t){const e=l(this.chartContext,{className:`${en.tasksDataRow.slice(1)} ${en.tasksEmptyRow.slice(1)}`}),{rowHeight:n}=this.options,i=this.instanceId;return e.setAttribute("data-taskid",`empty-${t}`),e.setAttribute(gn,i),e.style.height=`${n}px`,Lt.forEach((({key:t})=>{const r=l(this.chartContext,{className:en.tasksDataCell.slice(1),content:""});r.setAttribute("data-columnid",t),r.setAttribute(gn,i),r.style.height=`${n}px`,r.style.color="var(--text-color)",e.appendChild(r)})),e}}const bn="\n .gantt-context-menu {\n position: fixed;\n z-index: 1100;\n min-width: 180px;\n background-color: var(--dialog-bg-color, #fff);\n border: 1px solid var(--dialog-border-color, #D9D9D9);\n border-radius: 4px;\n box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);\n padding: 4px 0;\n font-family: inherit;\n font-size: 13px;\n line-height: 1.4;\n user-select: none;\n animation: ganttContextMenuFadeIn 0.12s ease-out;\n }\n\n .gantt-context-menu-item {\n display: block;\n width: 100%;\n text-align: left;\n padding: 7px 14px;\n background: transparent;\n border: none;\n color: var(--text-color, #333);\n cursor: pointer;\n font: inherit;\n }\n\n .gantt-context-menu-item:hover:not(:disabled) {\n background-color: var(--toolbar-hover-bg-color, #f1f1f1);\n }\n\n .gantt-context-menu-item:focus {\n outline: none;\n background-color: var(--button-hover-bg-color, #e6f3ff);\n }\n\n .gantt-context-menu-item:disabled {\n color: var(--text-color-muted, rgba(0, 0, 0, 0.35));\n cursor: not-allowed;\n }\n\n .gantt-context-menu-separator {\n height: 1px;\n margin: 4px 0;\n background-color: var(--dialog-border-color, #E4E4E4);\n }\n\n @keyframes ganttContextMenuFadeIn {\n from {\n opacity: 0;\n transform: translateY(-2px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n",vn="\n .gantt-dialog-container {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: none;\n z-index: 999;\n overflow: hidden;\n }\n\n .gantt-dialog-container .dialog-overlay {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n }\n\n .gantt-dialog-container .gantt-dialog {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n background: var(--dialog-bg-color, white);\n border-radius: 4px;\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);\n border: 1px solid var(--dialog-border-color, #eee);\n z-index: 1000;\n min-width: 300px;\n max-width: 90%;\n max-height: 90%;\n display: flex;\n flex-direction: column;\n }\n\n .gantt-dialog .dialog-header {\n padding: 12px 16px;\n border-bottom: 1px solid var(--dialog-border-color, #eee);\n display: flex;\n justify-content: space-between;\n align-items: center;\n background: var(--header-bg-color, #f3f3f3);\n flex-shrink: 0;\n }\n\n .gantt-dialog .dialog-title {\n font-weight: 600;\n font-size: 16px;\n color: var(--header-text-color, #333);\n margin: 0;\n }\n\n .gantt-dialog .dialog-close {\n background: none;\n border: none;\n font-size: 20px;\n cursor: pointer;\n padding: 0;\n color: var(--text-color, #666);\n transition: color 0.2s;\n line-height: 1;\n }\n\n .gantt-dialog .dialog-close:hover {\n color: var(--text-color, #333);\n }\n\n .gantt-dialog .dialog-content {\n padding: 16px;\n overflow-y: auto;\n overflow-x: hidden;\n flex: 1;\n background: var(--dialog-bg-color, white);\n color: var(--text-color, #333);\n }\n\n .gantt-dialog .dialog-content::-webkit-scrollbar {\n width: 8px;\n }\n\n .gantt-dialog .dialog-content::-webkit-scrollbar-track {\n background: var(--dialog-bg-color, #f1f1f1);\n }\n\n .gantt-dialog .dialog-content::-webkit-scrollbar-thumb {\n background: var(--border-color, #888);\n border-radius: 4px;\n }\n\n .gantt-dialog .dialog-content::-webkit-scrollbar-thumb:hover {\n background: var(--text-color, #555);\n }\n\n .gantt-dialog-container.show {\n display: block;\n }\n\n .gantt-dialog-container.animate .dialog-overlay {\n animation: fadeIn 0.2s ease-out;\n }\n\n .gantt-dialog-container.animate .gantt-dialog {\n animation: slideIn 0.3s ease-out;\n }\n\n @keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n\n @keyframes slideIn {\n from {\n opacity: 0;\n transform: translate(-50%, -48%);\n }\n to {\n opacity: 1;\n transform: translate(-50%, -50%);\n }\n }\n\n .gantt-container {\n position: relative;\n }\n",yn="\n .dropdown {\n position: relative;\n display: inline-block;\n }\n\n .dropdown .gantt-action-button {\n border-radius: 4px;\n }\n\n .dropdown.show .gantt-action-button {\n background: var(--toolbar-hover-bg-color, #f8f9fa);\n border-color: var(--button-bg-color, #0066cc);\n }\n \n .dropdown-btn {\n padding: 8px 16px;\n background-color: var(--toolbar-bg-color, #fff);\n color: var(--text-color, rgba(0, 0, 0, 0.7));\n border: 1px solid var(--toolbar-border-color, #ddd);\n cursor: pointer;\n font-weight: bold;\n border-radius: 2px;\n font-family: inherit;\n font-size: inherit;\n line-height: 1.5;\n transition: background-color 0.2s ease, border-color 0.2s ease;\n }\n \n .dropdown-btn:hover {\n background-color: var(--toolbar-hover-bg-color, #f8f9fa);\n border-color: var(--toolbar-border-color, #bbb);\n }\n \n .dropdown-btn:focus {\n outline: none;\n border-color: var(--button-bg-color, #0066cc);\n box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.2);\n }\n \n .dropdown-content {\n display: none;\n position: absolute;\n background-color: var(--dialog-bg-color, #fff);\n min-width: 160px;\n box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);\n z-index: 1000;\n border-radius: 4px;\n right: 0;\n top: calc(100% + 4px);\n border: 1px solid var(--dialog-border-color, #D9D9D9);\n overflow: hidden;\n }\n \n .dropdown-content a {\n color: var(--text-color, #333);\n padding: 10px 14px;\n text-decoration: none;\n display: block;\n font-family: inherit;\n font-size: 13px;\n line-height: 1.4;\n transition: background-color 0.2s ease;\n cursor: pointer;\n }\n \n .dropdown-content a:hover {\n background-color: var(--toolbar-hover-bg-color, #f1f1f1);\n }\n \n .dropdown-content a:focus {\n background-color: var(--button-hover-bg-color, #e6f3ff);\n outline: none;\n }\n \n .dropdown.show .dropdown-content {\n display: block;\n animation: dropdownSlideDown 0.2s ease-out;\n }\n \n @keyframes dropdownSlideDown {\n from {\n opacity: 0;\n transform: translateY(-5px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n \n /* Shadow DOM specific adjustments */\n :host .dropdown {\n position: relative;\n display: inline-block;\n }\n",xn="\n * {\n box-sizing: border-box;\n }\n\n .gantt-container * {\n user-select: none;\n }\n\n .gantt-actions-container {\n display: flex;\n align-items: center;\n gap: 2px;\n padding: 5px 10px;\n flex: 0 0 40px;\n min-height: 40px;\n max-height: 40px;\n background-color: var(--background-color, #FFFFFF);\n border: 1px solid var(--border-color, #DFE0E1);\n }\n\n .gantt-actions-spacer {\n flex: 1;\n min-width: 8px;\n }\n\n .gantt-action-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 30px;\n height: 30px;\n padding: 0;\n border: none;\n border-radius: 6px;\n background: transparent;\n color: var(--toolbar-icon-color, #444);\n cursor: pointer;\n transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;\n flex-shrink: 0;\n }\n\n .gantt-action-button:hover:not(:disabled) {\n background: var(--toolbar-hover-bg-color, rgba(0, 0, 0, 0.06));\n color: var(--toolbar-icon-hover-color, #111);\n transform: translateY(-1px);\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);\n }\n\n .gantt-action-button:active:not(:disabled) {\n transform: translateY(0);\n box-shadow: none;\n background: var(--toolbar-active-bg-color, rgba(0, 0, 0, 0.1));\n }\n\n .gantt-action-button:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px var(--focus-ring-color, #005fcc);\n }\n\n .gantt-action-button:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n }\n\n .gantt-action-button svg {\n width: 15px;\n height: 15px;\n stroke: currentColor;\n flex-shrink: 0;\n }\n\n .gantt-action-separator {\n width: 1px;\n height: 18px;\n background-color: var(--border-color, rgba(0, 0, 0, 0.1));\n margin: 0 6px;\n flex-shrink: 0;\n }\n\n .gantt-view-mode-display {\n display: inline-flex;\n align-items: center;\n gap: 5px;\n padding: 4px 10px;\n height: 28px;\n font-size: 12.5px;\n color: var(--text-color, #555);\n background: var(--toolbar-hover-bg-color, rgba(0, 0, 0, 0.05));\n border-radius: 6px;\n margin-left: 2px;\n font-weight: 500;\n white-space: nowrap;\n flex-shrink: 0;\n }\n\n .gantt-view-mode-display svg {\n width: 13px;\n height: 13px;\n flex-shrink: 0;\n }\n \n .gantt-container {\n display: flex;\n flex: 1 1 auto;\n min-height: 0;\n min-width: 0;\n border: 1px solid var(--border-color, #DFE0E1);\n border-top: none;\n position: relative;\n background-color: var(--background-color, #FFFFFF);\n overflow: hidden;\n height: 100%;\n box-sizing: border-box;\n }\n \n .gantt-button {\n border: 1px solid var(--toolbar-border-color, rgba(0, 0, 0, 0.12));\n border-radius: 6px;\n background: var(--toolbar-bg-color, #fff);\n padding: 4px 12px;\n color: var(--text-color, rgba(0, 0, 0, 0.75));\n line-height: 20px;\n font-weight: 500;\n cursor: pointer;\n transition: background-color 0.15s ease, border-color 0.15s ease;\n font-size: 13px;\n }\n\n .gantt-button:hover {\n background: var(--toolbar-hover-bg-color, rgba(0, 0, 0, 0.04));\n border-color: var(--toolbar-border-color, rgba(0, 0, 0, 0.2));\n }\n\n .gantt-button:disabled {\n color: rgba(128, 128, 128, 0.5);\n opacity: 0.6;\n }\n\n /* ── WCAG 2.1 AA: focus styles ─────────────────────────────────────────── */\n\n .tasks-data-row:focus-visible {\n outline: 2px solid var(--focus-ring-color, #005fcc);\n outline-offset: -2px;\n }\n\n .bar-timeline:focus {\n outline: none;\n }\n\n .bar-timeline:focus-visible {\n outline: 2px solid var(--focus-ring-color, #005fcc);\n outline-offset: 2px;\n }\n\n .tasks-data-row[aria-selected=\"true\"] {\n background-color: var(--row-selected-bg-color, rgba(0, 95, 204, 0.12));\n }\n\n /* ── Selection: checkbox column ────────────────────────────────────────── */\n\n .gantt-checkbox-cell {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n min-width: 28px;\n max-width: 28px;\n }\n\n .gantt-selection-checkbox,\n .gantt-select-all-checkbox {\n width: 15px;\n height: 15px;\n margin: 0;\n cursor: pointer;\n accent-color: var(--button-bg-color, #005fcc);\n }\n\n /* ── Selection: toolbar count indicator ─────────────────────────────────── */\n\n .gantt-selection-count {\n display: inline-flex;\n align-items: center;\n padding: 3px 10px;\n height: 24px;\n font-size: 12px;\n font-weight: 500;\n color: var(--button-bg-color, #005fcc);\n background: var(--row-selected-bg-color, rgba(0, 95, 204, 0.12));\n border-radius: 12px;\n margin-left: 8px;\n white-space: nowrap;\n flex-shrink: 0;\n }\n\n /* ── Quick-filter search box ─────────────────────────────────── */\n\n .gantt-quick-filter {\n display: inline-flex;\n align-items: center;\n flex-shrink: 0;\n }\n\n .gantt-quick-filter-input {\n height: 26px;\n width: 180px;\n max-width: 220px;\n padding: 2px 10px;\n font-size: 13px;\n font-family: inherit;\n color: var(--text-color, #222);\n background: var(--background-color, #FFFFFF);\n border: 1px solid var(--border-color, #DFE0E1);\n border-radius: 6px;\n outline: none;\n user-select: text;\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n }\n\n .gantt-quick-filter-input::placeholder {\n color: var(--text-color, #888);\n opacity: 0.6;\n }\n\n .gantt-quick-filter-input:focus {\n border-color: var(--button-bg-color, #005fcc);\n box-shadow: 0 0 0 2px var(--focus-ring-color, rgba(0, 95, 204, 0.25));\n }\n\n /* ── Advanced filter builder ─────────────────────────────────── */\n\n .gantt-filter-builder {\n position: relative;\n display: inline-flex;\n flex-shrink: 0;\n }\n\n .gantt-filter-builder-button {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n height: 28px;\n padding: 0 10px;\n font-size: 13px;\n font-family: inherit;\n color: var(--toolbar-icon-color, #444);\n background: transparent;\n border: 1px solid var(--border-color, #DFE0E1);\n border-radius: 6px;\n cursor: pointer;\n transition: background-color 0.15s ease, border-color 0.15s ease;\n }\n\n .gantt-filter-builder-button:hover {\n background: var(--toolbar-hover-bg-color, rgba(0, 0, 0, 0.06));\n }\n\n .gantt-filter-builder-button.is-active {\n border-color: var(--button-bg-color, #005fcc);\n color: var(--button-bg-color, #005fcc);\n }\n\n .gantt-filter-builder-button svg {\n width: 14px;\n height: 14px;\n stroke: currentColor;\n }\n\n .gantt-filter-builder-badge {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 16px;\n height: 16px;\n padding: 0 4px;\n font-size: 11px;\n font-weight: 600;\n color: #fff;\n background: var(--button-bg-color, #005fcc);\n border-radius: 8px;\n }\n\n .gantt-filter-popover {\n position: absolute;\n top: calc(100% + 6px);\n left: 0;\n z-index: 1000;\n width: 380px;\n max-width: 90vw;\n padding: 12px;\n background: var(--background-color, #FFFFFF);\n color: var(--text-color, #222);\n border: 1px solid var(--border-color, #DFE0E1);\n border-radius: 8px;\n box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16);\n cursor: default;\n }\n\n .gantt-filter-popover-header {\n display: flex;\n align-items: center;\n gap: 8px;\n margin-bottom: 10px;\n font-size: 13px;\n }\n\n .gantt-filter-rows {\n display: flex;\n flex-direction: column;\n gap: 8px;\n max-height: 240px;\n overflow-y: auto;\n }\n\n .gantt-filter-empty {\n font-size: 13px;\n color: var(--text-color, #888);\n opacity: 0.6;\n padding: 6px 2px;\n }\n\n .gantt-filter-row {\n display: grid;\n grid-template-columns: 1fr 1fr 1fr auto;\n gap: 6px;\n align-items: center;\n }\n\n .gantt-filter-row select,\n .gantt-filter-row input {\n height: 28px;\n min-width: 0;\n padding: 2px 6px;\n font-size: 13px;\n font-family: inherit;\n color: var(--text-color, #222);\n background: var(--background-color, #FFFFFF);\n border: 1px solid var(--border-color, #DFE0E1);\n border-radius: 4px;\n user-select: text;\n }\n\n .gantt-filter-match {\n height: 26px;\n font-size: 13px;\n font-family: inherit;\n color: var(--text-color, #222);\n background: var(--background-color, #FFFFFF);\n border: 1px solid var(--border-color, #DFE0E1);\n border-radius: 4px;\n }\n\n .gantt-filter-remove {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 26px;\n height: 26px;\n padding: 0;\n color: var(--toolbar-icon-color, #888);\n background: transparent;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n }\n\n .gantt-filter-remove:hover {\n background: var(--toolbar-hover-bg-color, rgba(0, 0, 0, 0.06));\n color: var(--text-color, #111);\n }\n\n .gantt-filter-popover-footer {\n display: flex;\n align-items: center;\n gap: 8px;\n margin-top: 12px;\n }\n\n .gantt-filter-footer-spacer {\n flex: 1;\n }\n\n .gantt-filter-add,\n .gantt-filter-clear,\n .gantt-filter-apply {\n height: 28px;\n padding: 0 12px;\n font-size: 13px;\n font-family: inherit;\n border-radius: 4px;\n cursor: pointer;\n border: 1px solid var(--border-color, #DFE0E1);\n background: var(--background-color, #FFFFFF);\n color: var(--text-color, #222);\n }\n\n .gantt-filter-add {\n margin-right: auto;\n }\n\n .gantt-filter-apply {\n background: var(--button-bg-color, #005fcc);\n border-color: var(--button-bg-color, #005fcc);\n color: #fff;\n }\n\n .gantt-filter-add:hover,\n .gantt-filter-clear:hover {\n background: var(--toolbar-hover-bg-color, rgba(0, 0, 0, 0.06));\n }\n\n /* ── Custom toolbar items ────────────────────────────────────── */\n\n .gantt-toolbar-button {\n display: inline-flex;\n align-items: center;\n gap: 5px;\n padding: 0 10px;\n width: auto;\n min-width: 30px;\n font-size: 12.5px;\n font-weight: 500;\n color: var(--toolbar-icon-color, #444);\n white-space: nowrap;\n border-radius: 6px;\n }\n\n .gantt-toolbar-button span {\n line-height: 1;\n }\n\n .gantt-toolbar-select-wrapper {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n flex-shrink: 0;\n }\n\n .gantt-toolbar-select-label {\n font-size: 13px;\n color: var(--text-color, #666);\n white-space: nowrap;\n flex-shrink: 0;\n }\n\n .gantt-toolbar-select {\n height: 28px;\n padding: 0 24px 0 8px;\n border: 1px solid var(--border-color, #DFE0E1);\n border-radius: 4px;\n background: var(--toolbar-bg-color, #fff);\n color: var(--text-color, #333);\n font-size: 13px;\n cursor: pointer;\n appearance: none;\n -webkit-appearance: none;\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");\n background-repeat: no-repeat;\n background-position: right 8px center;\n min-width: 100px;\n max-width: 180px;\n outline: none;\n }\n\n .gantt-toolbar-select:hover {\n border-color: var(--button-bg-color, #005fcc);\n }\n\n .gantt-toolbar-select:focus {\n border-color: var(--focus-ring-color, #005fcc);\n box-shadow: 0 0 0 2px rgba(0, 95, 204, 0.2);\n }\n\n /* ── prefers-reduced-motion ─────────────────────────────────────────────── */\n\n @media (prefers-reduced-motion: reduce) {\n .bar-timeline,\n .bar-timeline-progress,\n .bar-handle,\n .gantt-action-button,\n .gantt-button,\n .tasks-data-row,\n .gantt-dialog-container,\n .gantt-dialog {\n transition: none !important;\n animation: none !important;\n }\n }\n\n /* JS-detected reduced motion class (mirrors the media query in JS context) */\n .gantt-reduced-motion .bar-timeline,\n .gantt-reduced-motion .bar-timeline-progress,\n .gantt-reduced-motion .bar-handle,\n .gantt-reduced-motion .gantt-action-button,\n .gantt-reduced-motion .gantt-button,\n .gantt-reduced-motion .tasks-data-row,\n .gantt-reduced-motion .gantt-dialog-container,\n .gantt-reduced-motion .gantt-dialog {\n transition: none !important;\n animation: none !important;\n }\n",wn="\n .gantt-container ::-webkit-scrollbar {\n width: 12px;\n height: 12px;\n }\n\n .gantt-container ::-webkit-scrollbar-track {\n background: var(--scrollbar-track-color, #F5F5F5);\n border-radius: 4px;\n }\n\n .gantt-container ::-webkit-scrollbar-thumb {\n background: var(--scrollbar-thumb-color, #C1C1C1);\n border-radius: 4px;\n border: 2px solid var(--scrollbar-track-color, #F5F5F5);\n }\n\n .gantt-container ::-webkit-scrollbar-thumb:hover {\n background: var(--scrollbar-thumb-hover-color, #A8A8A8);\n }\n\n .gantt-container * {\n scrollbar-width: thin;\n scrollbar-color: var(--scrollbar-thumb-color, #C1C1C1) var(--scrollbar-track-color, #F5F5F5);\n }\n\n /* Shadow DOM support */\n :host .gantt-container ::-webkit-scrollbar {\n width: 12px;\n height: 12px;\n }\n\n :host .gantt-container ::-webkit-scrollbar-track {\n background: var(--scrollbar-track-color, #F5F5F5);\n border-radius: 4px;\n }\n\n :host .gantt-container ::-webkit-scrollbar-thumb {\n background: var(--scrollbar-thumb-color, #C1C1C1);\n border-radius: 4px;\n border: 2px solid var(--scrollbar-track-color, #F5F5F5);\n }\n\n :host .gantt-container ::-webkit-scrollbar-thumb:hover {\n background: var(--scrollbar-thumb-hover-color, #A8A8A8);\n }\n\n :host .gantt-container * {\n scrollbar-width: thin;\n scrollbar-color: var(--scrollbar-thumb-color, #C1C1C1) var(--scrollbar-track-color, #F5F5F5);\n }\n",kn="\n\n .task-form {\n overflow: visible;\n }\n\n .task-form .form-group {\n margin-bottom: 18px;\n position: relative;\n }\n\n /* extra padding to last form group for breathing room */\n .task-form .form-group:last-of-type {\n margin-bottom: 24px;\n }\n\n .task-form label {\n display: block;\n margin-bottom: 5px;\n font-weight: 500;\n color: var(--text-color, #333);\n }\n\n .task-form input {\n width: 100%;\n padding: 8px;\n border: 1px solid var(--dialog-border-color, #ddd);\n border-radius: 4px;\n font-size: 14px;\n background-color: var(--dialog-bg-color, #fff);\n color: var(--text-color, #333);\n }\n\n .task-form input:focus {\n outline: none;\n border-color: var(--button-bg-color, #0066cc);\n }\n\n .task-form .form-actions {\n display: flex;\n justify-content: flex-end;\n gap: 8px;\n margin-top: 24px;\n padding-top: 16px;\n border-top: 1px solid var(--dialog-border-color, #eee);\n position: sticky;\n bottom: -16px;\n background: var(--dialog-bg-color, white);\n margin-left: -16px;\n margin-right: -16px;\n margin-bottom: -16px;\n padding-left: 16px;\n padding-right: 16px;\n padding-bottom: 16px;\n }\n\n .task-form .btn-primary {\n background: var(--button-bg-color, #0066cc);\n color: var(--button-text-color, white);\n border: none;\n padding: 8px 16px;\n border-radius: 4px;\n cursor: pointer;\n font-weight: 500;\n }\n\n .task-form .btn-primary:hover {\n background: var(--button-hover-bg-color, #0052a3);\n }\n\n .task-form .btn-disabled,\n .task-form .btn-disabled:hover {\n background: #99c2ff;\n cursor: not-allowed;\n opacity: 0.7;\n }\n\n .task-form .form-error {\n position: absolute;\n bottom: -15px;\n left: 0;\n color: #dc3545;\n font-size: 12px;\n margin-top: 4px;\n line-height: 1.2;\n transition: opacity 0.2s ease;\n }\n\n .task-form .invalid {\n border-color: #dc3545;\n }\n\n .task-form .invalid:focus {\n border-color: #dc3545;\n box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);\n }\n",Cn="\n .tasks-container {\n height: 100%;\n position: relative;\n display: flex;\n flex-direction: column;\n overflow-x: visible;\n overflow-y: visible;\n }\n\n .tasks-header {\n flex-shrink: 0;\n position: sticky;\n top: 0;\n z-index: 10;\n background-color: var(--header-bg-color, #F3F3F3);\n overflow: hidden;\n }\n\n .tasks-header-row {\n display: grid;\n width: 100%;\n position: relative;\n }\n\n /* Column being dragged to reorder. */\n .tasks-header-cell-dragging {\n opacity: 0.5;\n }\n\n /* Insertion marker shown while reordering columns. */\n .tasks-column-drop-indicator {\n position: absolute;\n top: 0;\n height: 100%;\n width: 2px;\n transform: translateX(-1px);\n background: var(--split-bar-hover-color, #007BFF);\n pointer-events: none;\n z-index: 4;\n }\n\n .tasks-header-cell {\n padding: 0 10px;\n text-align: center;\n /* Visible so the resize grip can straddle the column divider; the inner\n label still clips + ellipsizes the title. */\n overflow: visible;\n display: flex;\n align-items: center;\n /* Only top + bottom + right are drawn so the column divider (right) is\n painted exactly once between adjacent cells (the previous full-border\n shorthand had cell-A's right + cell-B's left = ~2px line). */\n border-top: var(--cell-border-width, 1px) solid var(--cell-border-color, #eff0f0);\n /* Header/body divider uses the stronger structural border so the white\n header still reads as a distinct band; internal gridlines stay faint. */\n border-bottom: var(--cell-border-width, 1px) solid var(--border-color, #E5E7EB);\n border-right: var(--cell-border-width, 1px) solid var(--cell-border-color, #eff0f0);\n color: var(--text-color, #000);\n box-sizing: border-box;\n font-weight: 600;\n position: relative;\n transition: background-color 0.15s ease;\n }\n\n /* Subtle darken (light) / lighten (dark) on hover so header cells read as\n interactive for sorting, resizing, etc. */\n .tasks-header-cell:hover {\n background-color: var(--header-hover-bg-color, #eef0f2);\n }\n\n /* Title wrapper: owns the ellipsis now that the cell overflows visibly. */\n .tasks-header-cell-label {\n flex: 0 1 auto;\n min-width: 0;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .tasks-header-row .tasks-header-cell:last-child {\n border-right: none;\n }\n\n /* Drag-to-resize grip centered on the column divider (straddles the cell's\n trailing edge). Sits above the header's sort click target and the adjacent\n cell, and widens its hit area on hover. */\n .gantt-column-resize-handle {\n position: absolute;\n inset-inline-end: -4px;\n top: 0;\n height: 100%;\n width: 4px;\n cursor: col-resize;\n z-index: 3;\n touch-action: none;\n user-select: none;\n }\n\n .gantt-column-resize-handle:hover,\n .gantt-column-resize-handle:active {\n background: var(--split-bar-hover-color, #007BFF);\n opacity: 0.35;\n }\n\n .gantt-sort-caret {\n display: inline-flex;\n align-items: center;\n gap: 1px;\n margin-left: 5px;\n flex: 0 0 auto;\n line-height: 0;\n /* Both idle and active arrows use this (dark) text color; the active\n direction stands out via full opacity and a heavier stroke instead. */\n color: var(--text-color, #000);\n }\n\n /* Lift the resting (idle) arrow on hover to signal the column is sortable.\n Scoped to the dimmed hint arrow so an actively-sorted column stays at full\n strength. */\n .tasks-header-cell-sortable:hover .gantt-sort-caret svg[opacity='0.4'] {\n opacity: 0.7;\n }\n\n .gantt-sort-order {\n font-size: 0.7em;\n font-weight: 700;\n line-height: 1;\n color: var(--button-bg-color, #005fcc);\n }\n\n .tasks-body-wrapper {\n flex: 1;\n overflow: visible;\n position: relative;\n }\n\n .tasks-data-container {\n display: flex;\n flex-direction: column;\n width: 100%;\n }\n\n .tasks-data-row {\n display: grid;\n width: 100%;\n border-bottom: var(--cell-border-width, 1px) solid var(--cell-border-color, #eff0f0);\n box-sizing: border-box;\n }\n\n .tasks-data-cell {\n padding: 0 10px;\n text-align: center;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: flex;\n align-items: center;\n /* Only the right edge — the next cell supplies its own left, so each\n column divider is painted exactly once (the previous left+right setup\n doubled at every boundary, making verticals visibly thicker than the\n row dividers). */\n border-right: var(--cell-border-width, 1px) solid var(--cell-border-color, #eff0f0);\n color: var(--text-color, #000);\n box-sizing: border-box;\n }\n\n .tasks-data-row .tasks-data-cell:last-child {\n border-right: none;\n }\n\n /* Group-header row (rendered while grouping is active): a full-width band. */\n .tasks-group-row {\n display: flex;\n background-color: var(--group-header-bg-color, var(--header-bg-color, #f3f3f3));\n cursor: pointer;\n }\n\n .tasks-group-cell {\n flex: 1 1 auto;\n border-right: none;\n font-weight: 600;\n gap: 6px;\n }\n\n .tasks-group-count {\n color: var(--text-color-muted, rgba(0, 0, 0, 0.55));\n font-weight: 400;\n }\n\n .tasks-add-row {\n cursor: pointer;\n color: var(--text-color-muted, rgba(0, 0, 0, 0.55));\n transition: background-color 0.15s ease, color 0.15s ease;\n display: flex;\n }\n\n .tasks-add-row:hover,\n .tasks-add-row:focus {\n outline: none;\n background-color: var(--toolbar-hover-bg-color, #f1f5f9);\n color: var(--text-color, #000);\n }\n\n .tasks-add-row-cell {\n flex: 1;\n border-right: none !important;\n padding: 0 14px;\n text-align: left !important;\n justify-content: flex-start !important;\n font-style: italic;\n font-weight: 500;\n user-select: none;\n }\n\n .tasks-data-row .task-toggle-icon,\n .tasks-data-row .task-toggle-icon-blank {\n display: inline-block;\n margin-right: 5px;\n width: 10px;\n height: 10px;\n vertical-align: middle;\n flex-shrink: 0;\n }\n\n .tasks-data-row .task-toggle-icon {\n cursor: pointer;\n position: relative;\n }\n\n /* Chevron (expanded) - pointing down */\n .tasks-data-row .task-toggle-icon.expanded::before {\n content: '';\n position: absolute;\n width: 6px;\n height: 6px;\n border-right: 2px solid var(--text-color, #000000);\n border-bottom: 2px solid var(--text-color, #000000);\n transform: rotate(45deg);\n top: 0;\n left: 2px;\n }\n\n /* Chevron - pointing right (collapsed) */\n .tasks-data-row .task-toggle-icon.collapsed::before {\n content: '';\n position: absolute;\n width: 6px;\n height: 6px;\n border-right: 2px solid var(--text-color, #000000);\n border-bottom: 2px solid var(--text-color, #000000);\n transform: rotate(-45deg);\n top: 2px;\n left: 0;\n }\n\n .tasks-data-row .task-toggle-icon:hover::before {\n opacity: 0.7;\n }\n\n /* Inline editing */\n .tasks-data-cell.inline-editable {\n cursor: text;\n }\n\n .tasks-data-cell.inline-editable:hover {\n background-color: var(--inline-edit-hover-bg, rgba(0, 0, 0, 0.04));\n }\n\n .tasks-data-cell .inline-edit-input {\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n padding: 0 4px;\n margin: 0;\n border: 1px solid var(--inline-edit-border-color, #87B7FE);\n border-radius: 3px;\n background: var(--inline-edit-bg, #FFFFFF);\n color: var(--text-color, #000);\n font-family: inherit;\n font-size: inherit;\n font-weight: inherit;\n outline: none;\n text-align: inherit;\n }\n\n .tasks-data-cell .inline-edit-input:focus {\n box-shadow: 0 0 0 2px var(--inline-edit-focus-ring, rgba(49, 140, 231, 0.25));\n }\n\n /* Shadow DOM specific */\n :host .tasks-container {\n display: flex;\n flex-direction: column;\n height: 100%;\n }\n\n :host .tasks-header {\n position: sticky;\n top: 0;\n z-index: 10;\n }\n",Sn="\n .gantt-container .timeline-container {\n width: 100%;\n height: 100%;\n position: relative;\n background-color: var(--background-color, #FFFFFF);\n display: flex;\n flex-direction: column;\n overflow: visible;\n padding-bottom: 0;\n box-sizing: border-box;\n }\n\n .timeline-container .timeline-header {\n position: sticky;\n top: 0;\n z-index: 100;\n background-color: var(--header-bg-color, #F3F3F3);\n flex-shrink: 0;\n overflow-x: auto;\n overflow-y: hidden;\n width: 100%;\n scrollbar-width: none; \n -ms-overflow-style: none; \n }\n\n .timeline-container .timeline-header::-webkit-scrollbar {\n display: none;\n height: 0;\n width: 0;\n }\n\n /* Shadow DOM specific */\n :host .timeline-container .timeline-header {\n scrollbar-width: none !important;\n -ms-overflow-style: none !important;\n }\n\n :host .timeline-container .timeline-header::-webkit-scrollbar {\n display: none !important;\n height: 0 !important;\n width: 0 !important;\n }\n\n .timeline-container .timeline-header > .timeline-header-row {\n width: max-content;\n position: relative;\n }\n\n .timeline-container .timeline-body-wrapper {\n flex: 1;\n overflow-x: auto;\n overflow-y: hidden;\n position: relative;\n width: 100%;\n min-height: 0;\n scrollbar-width: none;\n -ms-overflow-style: none;\n padding-bottom: 0; \n margin-bottom: 0;\n }\n\n .timeline-body-wrapper .timeline-horizontal-scroll, .timeline-container .timeline-body-wrapper::-webkit-scrollbar {\n display: none;\n height: 0;\n width: 0;\n }\n\n /* shadow DOM specific */\n :host .timeline-container .timeline-body-wrapper {\n scrollbar-width: none !important;\n -ms-overflow-style: none !important;\n }\n\n :host .timeline-container .timeline-body-wrapper::-webkit-scrollbar {\n display: none !important;\n height: 0 !important;\n width: 0 !important;\n }\n\n\n .timeline-horizontal-scroll {\n position: absolute;\n bottom: 0;\n height: 17px;\n overflow-x: auto;\n overflow-y: hidden;\n z-index: 300;\n background-color: var(--split-bar-color, var(--background-color, #FFFFFF));\n border-top: 1px solid var(--border-color, #DFE0E1);\n box-sizing: border-box;\n display: block;\n visibility: visible;\n opacity: 1;\n pointer-events: auto;\n }\n\n .timeline-horizontal-scroll-content {\n height: 1px;\n width: max-content;\n }\n\n .timeline-container .annotation,\n .timeline-container .annotation-container {\n position: absolute;\n top: 0;\n left: 0;\n pointer-events: none;\n }\n\n .timeline-container .annotation-container > * {\n pointer-events: auto;\n }\n\n .timeline-container .bar-container {\n position: absolute;\n top: 0;\n left: 0;\n pointer-events: none;\n }\n\n .timeline-container .bar-container > * {\n pointer-events: auto;\n }\n\n /* Row is the positioning context for the off-screen scroll chevrons. */\n .timeline-container .timeline-data-row {\n position: relative;\n }\n\n /* Per-row chevrons that jump to a task whose bar is off-screen. Absolutely\n positioned inside the row; their left offset is set to the viewport edge on\n each horizontal scroll so they track the visible window without extending\n the row's max-content width. */\n .timeline-container .gantt-scroll-btn {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n display: none;\n z-index: 7;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n cursor: pointer;\n font-size: 15px;\n line-height: 1;\n color: #fff;\n background: var(--split-bar-hover-color, #007BFF);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);\n opacity: 0.85;\n user-select: none;\n pointer-events: auto;\n }\n\n .timeline-container .gantt-scroll-btn:hover {\n opacity: 1;\n }\n\n /* Crosshair cursor + preview bar while drawing a new task on the timeline. */\n .timeline-container .timeline-body.gantt-drawing {\n cursor: crosshair;\n }\n\n .timeline-container .gantt-draw-task-preview {\n position: absolute;\n z-index: 6;\n pointer-events: none;\n box-sizing: border-box;\n border-radius: var(--bar-border-radius, 4px);\n background: var(--split-bar-hover-color, #007BFF);\n opacity: 0.35;\n border: 1px dashed var(--split-bar-hover-border-color, #0056B3);\n }\n\n .timeline-container .gantt-crosshair {\n position: absolute;\n top: 0;\n bottom: 0;\n width: 1px;\n z-index: 200;\n pointer-events: none;\n transform: translateX(-0.5px);\n }\n\n .timeline-container .gantt-crosshair-label {\n position: absolute;\n top: 50%;\n transform: translate(-50%, -50%);\n z-index: 201;\n color: #FFFFFF;\n font-size: 12px;\n font-weight: 500;\n line-height: 1;\n padding: 4px 8px;\n border-radius: 4px;\n white-space: nowrap;\n pointer-events: none;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);\n }\n\n .timeline-container .bar-timeline {\n position: absolute;\n cursor: default;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n .timeline-container .bar-timeline.bar-interactive {\n cursor: move;\n cursor: grab;\n /* Suppress browser pan/zoom so a touch-drag keeps the pointer stream\n (otherwise the gesture is stolen and pointercancel fires). */\n touch-action: none;\n }\n\n .timeline-container .bar-timeline .bar-handle {\n height: 100%;\n width: 5px;\n position: absolute;\n z-index: 1000;\n background: transparent;\n touch-action: none;\n }\n\n .timeline-container .bar-timeline .bar-handle:hover {\n cursor: col-resize;\n }\n\n .resizing {\n pointer-events: none;\n opacity: 0.8;\n }\n\n .timeline-container .bar-timeline .bar-handle.handle-left {\n left: -5px;\n }\n\n .timeline-container .bar-timeline .bar-handle.handle-right {\n right: -5px;\n }\n\n .timeline-container .bar-timeline.dragging {\n cursor: grabbing;\n }\n\n .timeline-container .bar-baseline {\n position: absolute;\n z-index: 1;\n }\n\n .timeline-container .bar-timeline.bar-summary {\n cursor: default;\n background: var(--summary-bar-color);\n height: 8px !important;\n border-radius: 0 !important;\n overflow: visible;\n align-items: flex-start;\n }\n\n .timeline-container .bar-timeline.bar-summary::before,\n .timeline-container .bar-timeline.bar-summary::after {\n content: '';\n position: absolute;\n top: 2px;\n width: 0;\n height: 0;\n border-left: 6px solid transparent;\n border-right: 6px solid transparent;\n pointer-events: none;\n }\n\n .timeline-container .bar-timeline.bar-summary::before {\n left: -1px;\n border-top: 10px solid var(--summary-cap-left-color, var(--summary-bar-color));\n transform: rotate(270deg);\n }\n\n .timeline-container .bar-timeline.bar-summary::after {\n right: -1px;\n border-top: 10px solid var(--summary-cap-right-color, var(--summary-bar-color));\n transform: rotate(90deg);\n }\n\n .timeline-container .bar-timeline.bar-critical {\n background-color: var(--critical-bar-color, #e53935) !important;\n }\n\n .timeline-container .bar-timeline.bar-critical .bar-timeline-progress {\n background-color: color-mix(in srgb, var(--critical-bar-color, #e53935) 70%, white) !important;\n }\n\n svg path.critical-arrow {\n stroke: var(--critical-arrow-color, #e53935) !important;\n stroke-width: 2.5 !important;\n }\n\n /* Interactive dependency editing (dependencies.editable: true).\n The visible path gets state-driven styling; the hit-area sibling carries\n a pointer cursor + focus ring. */\n svg path[data-arrow-state='hover']:not([data-arrow-hit]) {\n stroke: var(--dep-arrow-hover-color, #475569);\n filter: drop-shadow(0 0 3px var(--dep-arrow-hover-shadow-color, rgba(15, 23, 42, 0.35)));\n stroke-width: 2;\n }\n\n svg path[data-arrow-state='selected']:not([data-arrow-hit]) {\n stroke: var(--dep-arrow-selected-color, #dc2626) !important;\n stroke-width: 2.5;\n }\n\n svg path[data-arrow-hit] {\n cursor: pointer;\n outline: none;\n }\n\n svg path[data-arrow-hit]:focus-visible {\n stroke: var(--dep-arrow-focus-color, rgba(37, 99, 235, 0.35));\n }\n\n /* The \"✕\" affordance rendered next to the arrowhead while the edge is selected. */\n svg g[data-arrow-remove] {\n cursor: pointer;\n }\n\n svg g[data-arrow-remove] circle {\n fill: var(--dep-arrow-selected-color, #dc2626);\n }\n\n svg g[data-arrow-remove] path {\n stroke: #fff;\n stroke-width: 1.5;\n stroke-linecap: round;\n fill: none;\n }\n\n svg g[data-arrow-remove]:hover circle {\n fill: color-mix(in srgb, var(--dep-arrow-selected-color, #dc2626) 80%, black);\n }\n\n .bar-timeline .bar-timeline-progress {\n position: absolute;\n pointer-events: none;\n height: 100%;\n left: 0;\n }\n\n /* RTL bars fill from the right (their start edge under a right-to-left time axis). */\n .bar-timeline.bar-rtl .bar-timeline-progress {\n left: auto;\n right: 0;\n }\n\n /* Split task: the envelope becomes transparent so the gaps show through; the\n worked spans are painted by .bar-segment children with a connector between. */\n .bar-timeline.bar-split {\n background-color: transparent !important;\n }\n\n .bar-timeline.bar-split .bar-split-connector {\n position: absolute;\n left: 0;\n top: 50%;\n height: 2px;\n transform: translateY(-50%);\n background-color: var(--split-connector-color, rgba(0, 0, 0, 0.25));\n pointer-events: none;\n z-index: 0;\n }\n\n .bar-timeline.bar-split .bar-segment {\n position: absolute;\n top: 0;\n height: 100%;\n z-index: 1;\n overflow: hidden;\n }\n\n .bar-timeline.bar-split .bar-segment .bar-segment-progress {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n pointer-events: none;\n }\n\n .bar-timeline.bar-split.bar-rtl .bar-segment .bar-segment-progress {\n left: auto;\n right: 0;\n }\n\n /* Dependency-draw anchor handles. Two solid circles straddle each bar's\n start/finish edges; hidden by default, fade in when the bar is hovered or\n while a drag is in progress. CSS owns visibility — DependencyDrawManager\n only sets a .bar-dep-anchor--drawing class on the source anchor so it\n stays visible until pointerup. */\n .timeline-container .bar-timeline .bar-dep-anchor {\n position: absolute;\n top: 50%;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n background: var(--dep-anchor-color, #2563eb);\n border: 2px solid #fff;\n box-sizing: content-box;\n opacity: 0;\n pointer-events: none;\n touch-action: none;\n transition:\n opacity 120ms ease,\n background-color 100ms ease,\n transform 100ms ease;\n z-index: 5;\n box-shadow: 0 1px 2px rgba(15, 23, 42, 0.25);\n }\n\n /* Anchors sit fully outside the bar's resize-handle zone (5px wide on each\n edge with z-index 1000), so the resize handle keeps its mousedown\n territory and the anchors keep theirs. Drag from the bar's interior →\n resize; drag from the circle → draw dependency. */\n .timeline-container .bar-timeline .bar-dep-anchor-start {\n left: -15px;\n transform: translate(0, -50%);\n }\n\n .timeline-container .bar-timeline .bar-dep-anchor-end {\n right: -15px;\n transform: translate(0, -50%);\n }\n\n .timeline-container .bar-timeline:hover .bar-dep-anchor,\n .timeline-container .bar-timeline .bar-dep-anchor.bar-dep-anchor--drawing {\n opacity: 1;\n pointer-events: auto;\n cursor: crosshair;\n }\n\n .timeline-container .bar-timeline .bar-dep-anchor:hover,\n .timeline-container .bar-timeline .bar-dep-anchor.bar-dep-anchor--drawing {\n background: var(--dep-anchor-hover-color, #1d4ed8);\n }\n\n /* Coarse pointers (touch / pen) — bump the anchor target size so it's\n reachable with a fingertip, and push it further out so it doesn't\n overlap the (also touch-sized) resize handle. The visual circle stays\n the same shape, just larger. */\n @media (pointer: coarse) {\n .timeline-container .bar-timeline .bar-dep-anchor {\n width: 18px;\n height: 18px;\n }\n .timeline-container .bar-timeline .bar-dep-anchor-start {\n left: -20px;\n }\n .timeline-container .bar-timeline .bar-dep-anchor-end {\n right: -20px;\n }\n /* Touch devices have no hover state — keep anchors visible so users can\n discover and grab them without needing to dwell on the bar. */\n .timeline-container .bar-timeline .bar-dep-anchor {\n opacity: 0.65;\n pointer-events: auto;\n }\n .timeline-container .bar-timeline .bar-dep-anchor.bar-dep-anchor--drawing {\n opacity: 1;\n }\n }\n\n /* Respect users who set prefers-reduced-motion: drop the anchor fade so\n they snap in/out rather than animating. The drag-preview path itself has\n no transitions so nothing more is needed there. */\n @media (prefers-reduced-motion: reduce) {\n .timeline-container .bar-timeline .bar-dep-anchor {\n transition: none;\n }\n }\n\n /* While dragging, hide anchors on the source bar's siblings (and on the\n source bar itself, since the dragging one carries --drawing).\n They re-appear when the target bar is hovered, which is handled by the\n standard :hover rule above. */\n\n /* Drop-target highlight on the destination bar while drawing. */\n .timeline-container .bar-timeline.bar-dep-drop-target {\n outline: 2px solid var(--dep-anchor-color, #2563eb);\n outline-offset: 1px;\n }\n\n .timeline-container .bar-timeline.bar-dep-drop-invalid {\n outline-color: var(--dep-arrow-selected-color, #dc2626);\n }\n\n /* Dashed preview path follows the cursor between source anchor and target. */\n svg path[data-edge-preview] {\n fill: none;\n stroke: var(--dep-anchor-color, #2563eb);\n stroke-width: 1.5;\n stroke-dasharray: 6 4;\n pointer-events: none;\n }\n\n svg path[data-edge-preview][data-preview-state='invalid'] {\n stroke: var(--dep-arrow-selected-color, #dc2626);\n }\n\n /* Tiny floating label that previews the dependency type during a drag. */\n .timeline-container .bar-dep-type-label {\n position: absolute;\n pointer-events: none;\n background: var(--dep-anchor-color, #2563eb);\n color: #fff;\n font-size: 10px;\n font-weight: 600;\n padding: 2px 6px;\n border-radius: 4px;\n transform: translate(8px, -50%);\n z-index: 1100;\n white-space: nowrap;\n box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);\n }\n\n .timeline-container .bar-dep-type-label[data-preview-state='invalid'] {\n background: var(--dep-arrow-selected-color, #dc2626);\n }\n\n /* Progress drag handle — small upward wedge anchored at the bottom edge of\n the bar, horizontally aligned to the right edge of the progress fill via\n left: <progress>%. Hidden by default, fades in on bar hover. */\n .timeline-container .bar-timeline .bar-progress-handle {\n position: absolute;\n bottom: -1px;\n width: 12px;\n height: 8px;\n transform: translateX(-50%);\n cursor: ew-resize;\n z-index: 4;\n pointer-events: auto;\n touch-action: none;\n opacity: 0;\n transition: opacity 120ms ease-in;\n /* Upward-pointing wedge built with a clip-path triangle. White fill with a\n subtle outline so it reads against any bar color. */\n background-color: #FFFFFF;\n clip-path: polygon(50% 0, 100% 100%, 0 100%);\n filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));\n }\n\n .timeline-container .bar-timeline:hover .bar-progress-handle,\n .timeline-container .bar-timeline .bar-progress-handle.dragging,\n .timeline-container .bar-timeline.progress-dragging .bar-progress-handle {\n opacity: 1;\n }\n\n /* While dragging the progress, suppress the bar's grab cursor so users see\n the resize affordance the whole time. */\n .timeline-container .bar-timeline.progress-dragging,\n .timeline-container .bar-timeline.progress-dragging.bar-interactive {\n cursor: ew-resize;\n }\n\n /* Live percent label that surfaces under the wedge while the user drags.\n Anchored to the same left percentage as the handle so it tracks the\n pointer in lockstep. Hidden by default; opacity-toggled when the bar\n gains the .progress-dragging class. */\n .timeline-container .bar-timeline .bar-progress-handle-label {\n position: absolute;\n bottom: -22px;\n transform: translateX(-50%);\n padding: 2px 6px;\n border-radius: 3px;\n background-color: rgba(0, 0, 0, 0.75);\n color: #FFFFFF;\n font-size: 11px;\n font-weight: 500;\n line-height: 1;\n white-space: nowrap;\n pointer-events: none;\n opacity: 0;\n transition: opacity 100ms ease-in;\n z-index: 5;\n }\n\n .timeline-container .bar-timeline.progress-dragging .bar-progress-handle-label {\n opacity: 1;\n }\n\n .bar-timeline .bar-label {\n white-space: nowrap;\n pointer-events: none;\n overflow: hidden;\n z-index: 2;\n }\n\n /* Outside-positioned labels: anchored to the bar's edge, vertically centred,\n allowed to overflow the bar so narrow tasks aren't truncated. */\n .bar-timeline .bar-label.bar-label-outside {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n overflow: visible;\n color: var(--text-color, #000);\n line-height: 1;\n z-index: 3;\n }\n\n .bar-timeline .bar-label.bar-label-outside-right {\n left: 100%;\n padding-left: 8px;\n text-align: left;\n }\n\n .bar-timeline .bar-label.bar-label-outside-left {\n right: 100%;\n padding-right: 8px;\n text-align: right;\n }\n\n .timeline-container .timeline-body {\n width: max-content;\n position: relative;\n padding-bottom: 17px;\n }\n \n .timeline-container .timeline-header-row,\n .timeline-container .timeline-data-row {\n display: flex;\n /* Shrink-to-content so the row width is deterministic (sum of pseudo +\n cells), matching what the horizontal scrollbar measures. Without this,\n data rows can fill the parent's max-content slot and end up wider than\n their cells, leaving stale grid space at the far right. */\n width: max-content;\n }\n\n .timeline-container .timeline-header-cell,\n .timeline-container .timeline-data-cell {\n padding: 0 10px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: flex;\n align-items: center;\n justify-content: center;\n /* Only bottom + right are drawn so each grid line is painted exactly\n once (adjacent borders don't double up). Borders stay inside the\n cell's rowHeight allocation via the global box-sizing: border-box\n (see Gantt.style.ts), keeping height math identical to the prior\n four-border setup — rows still occupy exactly rowHeight, so the\n timeline stays vertically aligned with the tasks pane.\n --column-line-color on the vertical so columnLines:false collapses\n verticals to transparent without affecting horizontal dividers. */\n border-bottom: var(--cell-border-width, 1px) solid var(--cell-border-color, #eff0f0);\n border-right: var(--cell-border-width, 1px) solid var(--column-line-color, var(--cell-border-color, #eff0f0));\n color: var(--text-color, #000);\n }\n\n /* Anchor the very top edge of the grid — the cell rule above only paints\n bottom + right. Border stays inside the cell's rowHeight allocation\n (border-box), so it doesn't shift the body downward. */\n .timeline-container .timeline-header > .timeline-header-row:first-child .timeline-header-cell {\n border-top: var(--cell-border-width, 1px) solid var(--cell-border-color, #eff0f0);\n }\n\n /* Header/body divider: the bottom-most header tier uses the stronger\n structural border so the white header reads as a distinct band, while\n inter-tier and internal grid lines stay whisper-faint. */\n .timeline-container .timeline-header > .timeline-header-row:last-child .timeline-header-cell {\n border-bottom: var(--cell-border-width, 1px) solid var(--border-color, #E5E7EB);\n }\n\n /* Drop the trailing edge so the grid has no outer right border (mirrors\n the tasks pane). */\n .timeline-container .timeline-header-row .timeline-header-cell:last-child,\n .timeline-container .timeline-data-row .timeline-data-cell:last-child {\n border-right: none;\n }\n\n .timeline-container .timeline-header-cell {\n background-color: var(--header-bg-color, #F3F3F3);\n color: var(--header-text-color, #333);\n }\n\n /* ── Working-calendar non-working-day stripes ───────────────────────── */\n /* Layer is a child of .timeline-body and fills it; stripes inside are\n absolutely-positioned per non-working day. Stripes sit behind rows\n because they appear earlier in DOM order with no positive z-index. */\n .timeline-container .timeline-stripes-layer {\n position: absolute;\n inset: 0;\n pointer-events: none;\n }\n\n .timeline-container .timeline-stripes-layer .apexgantt-day {\n position: absolute;\n top: 0;\n bottom: 0;\n box-sizing: border-box;\n pointer-events: none;\n }\n\n .timeline-container .timeline-stripes-layer .apexgantt-day--weekend {\n background-color: var(--apexgantt-non-working-bg, rgba(15, 23, 42, 0.035));\n }\n\n .timeline-container .timeline-stripes-layer .apexgantt-day--holiday {\n background-color: var(--apexgantt-holiday-bg, rgba(244, 63, 94, 0.08));\n pointer-events: auto;\n cursor: help;\n }\n",Mn="\n .apexgantt-tooltip {\n position: absolute;\n z-index: 1000;\n pointer-events: none;\n opacity: 0;\n visibility: hidden;\n transition: opacity 0.12s ease-out, transform 0.12s ease-out;\n transform: translateY(2px);\n font-family: inherit;\n font-size: 12px;\n line-height: 1.45;\n display: none;\n max-width: 320px;\n box-sizing: border-box;\n /* Soft shadow draws the outline of the combined body+arrow shape.\n Filter (rather than box-shadow on individual children) follows the\n silhouette of the rotated arrow, so the shadow wraps around the\n diamond corner with no visible seam at the body-arrow junction. */\n filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.14)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));\n }\n\n .apexgantt-tooltip.visible {\n display: block;\n opacity: 1;\n visibility: visible;\n transform: translateY(0);\n }\n\n :host .apexgantt-tooltip {\n position: absolute;\n z-index: 1000;\n pointer-events: none;\n opacity: 0;\n visibility: hidden;\n transition: opacity 0.12s ease-out, transform 0.12s ease-out;\n transform: translateY(2px);\n font-family: inherit;\n font-size: 12px;\n line-height: 1.45;\n display: none;\n max-width: 320px;\n box-sizing: border-box;\n filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.14)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));\n }\n\n :host .apexgantt-tooltip.visible {\n display: block;\n opacity: 1;\n visibility: visible;\n transform: translateY(0);\n }\n\n .apexgantt-tooltip .tooltip-content {\n padding: 8px 10px;\n border-radius: 6px;\n background-color: var(--apexgantt-tooltip-bg, #ffffff);\n word-wrap: break-word;\n overflow-wrap: break-word;\n box-sizing: border-box;\n /* In front of the arrow so the half of the rotated square that sits\n inside the body is masked, leaving only the diamond corner\n protruding. No border here — the shape is outlined by the parent's\n drop-shadow filter, which traces the body+arrow silhouette as one. */\n position: relative;\n z-index: 2;\n }\n\n .apexgantt-tooltip .tooltip-content > div {\n margin: 2px 0;\n word-break: break-word;\n line-height: 1.45;\n }\n\n .apexgantt-tooltip .tooltip-content strong {\n font-weight: 600;\n margin-right: 6px;\n opacity: 0.7;\n }\n\n .apexgantt-tooltip .tooltip-content span {\n display: inline;\n }\n\n /* Title separator only applies when the template renders sibling rows\n (title + body). If the template has a single wrapper div, the border\n would otherwise float at the bottom of the tooltip. */\n .apexgantt-tooltip .tooltip-content > div:first-child:not(:last-child) {\n margin-top: 0;\n margin-bottom: 6px;\n padding-bottom: 6px;\n border-bottom: 1px solid rgba(0, 0, 0, 0.08);\n font-weight: 600;\n font-size: 13px;\n }\n\n .apexgantt-tooltip .tooltip-content > div:first-child:not(:last-child) strong {\n font-weight: 600;\n opacity: 1;\n }\n\n .apexgantt-tooltip .tooltip-content > div:last-child {\n margin-bottom: 0;\n }\n\n /* Arrow rendered as a 10×10 bg-colored square rotated 45°. Center sits\n exactly on the body's bottom (or top) edge so the diamond's left and\n right corners meet the body edge without sub-pixel offset. No border\n of its own — the parent's drop-shadow handles the outline. */\n .apexgantt-tooltip .tooltip-arrow {\n position: absolute;\n width: 10px;\n height: 10px;\n background-color: var(--apexgantt-tooltip-bg, #ffffff);\n transform: rotate(45deg);\n z-index: 1;\n pointer-events: none;\n }\n\n .apexgantt-tooltip .tooltip-arrow.arrow-below {\n /* tooltip above the bar — visible corner points down */\n bottom: -5px;\n }\n\n .apexgantt-tooltip .tooltip-arrow.arrow-above {\n /* tooltip below the bar — visible corner points up */\n top: -5px;\n }\n";class En{constructor(t,e,n,i,r,s){this.element=t,this.domCache=e,this.options=n,this.chartContext=i,this.isShadowDOM=r,this.instanceId=s,this.stylesInjected=!1}setupShadowDOMEnvironment(){if(!this.isShadowDOM)return;const t=this.chartContext.getContext().host;t&&(t.style.display="block",t.style.boxSizing="border-box",t.style.contain="layout style"),this.element&&(this.element.style.display="block",this.element.style.boxSizing="border-box")}injectGanttStyles(){if(!this.stylesInjected)if(this.isShadowDOM)this.injectStylesDirectly();else try{const t=[{content:xn,id:"gantt-core-styles",options:{priority:"high"}},{content:Sn,id:"gantt-timeline-styles"},{content:Cn,id:"gantt-table-styles"},{content:vn,id:"gantt-dialog-styles"},{content:kn,id:"gantt-taskform-styles"},{content:Mn,id:"gantt-tooltip-styles"},{content:i,id:"gantt-toolbar-styles"},{content:yn,id:"gantt-dropdown-styles"},{content:bn,id:"gantt-context-menu-styles"},{content:wn,id:"gantt-scrollbar-styles"}];this.chartContext.injectStylesheets(t),this.stylesInjected=!0}catch(t){R.error("injectGanttStyles: ChartContext injection failed",t)}}injectStylesDirectly(){const t=this.chartContext.getContext();if(t.querySelector("#gantt-all-styles"))return void(this.stylesInjected=!0);const e=document.createElement("style");e.id="gantt-all-styles",e.textContent=`\n /* Shadow DOM CSS Reset - Critical for proper layout */\n :host {\n all: initial;\n display: block;\n contain: layout style;\n }\n\n *, *::before, *::after {\n box-sizing: border-box;\n }\n\n div, table, thead, tbody, tr, td, th {\n display: revert;\n margin: 0;\n padding: 0;\n border: 0;\n }\n\n .split-view-container,\n .gantt-container {\n display: flex !important;\n width: 100% !important;\n height: 100% !important;\n }\n\n .split-left-container,\n .split-right-container {\n display: block !important;\n }\n\n .timeline-container {\n flex: 1 !important;\n overflow: auto !important;\n position: relative !important;\n }\n\n .tasks-container {\n flex-shrink: 0 !important;\n overflow: auto !important;\n }\n\n ${xn}\n ${Sn}\n ${Cn}\n ${vn}\n ${kn}\n ${Mn}\n ${i}\n ${yn}\n ${bn}\n ${wn}\n `,t.insertBefore(e,t.firstChild),this.stylesInjected=!0}setCSSVariables(){["--apex-gantt-bar-fill","--apex-gantt-background-color","--apex-gantt-row-bg-even","--apex-gantt-row-bg-odd","--apex-gantt-header-bg","--apex-gantt-grid-line","--apex-gantt-dependency-line","--apex-gantt-font-family","--apex-gantt-font-size","--apex-gantt-font-color"].forEach((t=>this.element.style.removeProperty(t)));const t=Be(this.element),e=t.gridLine||this.options.cellBorderColor,n=this.options.cellBorderWidth,i=t.fontColor||this.options.fontColor,r=t.headerBg||this.options.headerBackground,{tooltipBGColor:s,tooltipBorderColor:o,borderColor:a,barTextColor:l}=this.options,d=t.bgColor||this.options.backgroundColor,c=t.barFill||this.options.barBackgroundColor,u=t.dependencyLine||this.options.arrowColor,p=[...this.options.rowBackgroundColors??[]];t.rowBgEven&&(p[0]=t.rowBgEven),t.rowBgOdd&&(p[1]=t.rowBgOdd),this.element.style.setProperty("--apex-gantt-row-bg-even",p[0]??""),this.element.style.setProperty("--apex-gantt-row-bg-odd",p[1]??p[0]??""),this.element.style.setProperty("--cell-border-color",e),this.element.style.setProperty("--cell-border-width",n),this.element.style.setProperty("--column-line-color",!1===this.options.columnLines?"transparent":e),this.element.style.setProperty("--gantt-font-color",i),this.element.style.setProperty("--text-color",i),this.element.style.setProperty("--header-bg-color",r),this.element.style.setProperty("--header-text-color",i),this.element.style.setProperty("--tooltip-bg-color",s),this.element.style.setProperty("--tooltip-border-color",o),this.element.style.setProperty("--tooltip-text-color",i),this.element.style.setProperty("--background-color",d),this.element.style.setProperty("--border-color",a),this.element.style.setProperty("--dialog-bg-color",d),this.element.style.setProperty("--dialog-border-color",a),this.element.style.setProperty("--button-bg-color",c),this.element.style.setProperty("--button-text-color",l),this.element.style.setProperty("--button-hover-bg-color",u),this.element.style.setProperty("--toolbar-bg-color",d),this.element.style.setProperty("--toolbar-border-color",a),this.element.style.setProperty("--toolbar-hover-bg-color",e),this.element.style.setProperty("--scrollbar-track-color",d),this.element.style.setProperty("--scrollbar-thumb-color",a),this.element.style.setProperty("--scrollbar-thumb-hover-color",e),this.element.style.setProperty("--split-bar-color",e),this.element.style.setProperty("--split-bar-hover-color",u),this.element.style.setProperty("--split-bar-border-color",a),this.element.style.setProperty("--split-bar-handle-color",i),this.element.style.setProperty("--split-bar-hover-border-color",u),this.element.style.setProperty("--critical-bar-color",this.options.criticalBarColor),this.element.style.setProperty("--critical-arrow-color",this.options.criticalArrowColor),this.element.style.setProperty("--summary-bar-color",this.options.summaryBarColor),this.element.style.setProperty("--milestone-color",this.options.milestoneColor);const m=this.isColorDark(d);m?this.element.style.setProperty("--toolbar-icon-filter","invert(1) brightness(2)"):this.element.style.setProperty("--toolbar-icon-filter","none"),this.element.style.setProperty("--header-hover-bg-color",h(r,{l:m?6:-5}))}handleWatermark(){const t=this.domCache.ganttContainer;if(!t)return;const e=t.parentNode;e&&(f.isLicenseValid()?v.remove(e):v.add(e))}isColorDark(t){const e=t.replace("#","");return(.299*parseInt(e.substring(0,2),16)+.587*parseInt(e.substring(2,4),16)+.114*parseInt(e.substring(4,6),16))/255<.5}cleanupScrollbarStyles(){try{this.chartContext.getInjectedStyleIds().filter((t=>t.startsWith(`scrollbar-${this.instanceId}`))).forEach((t=>this.chartContext.removeStyles(t)));const t=this.domCache.horizontalScroll;if(t){const e=t.style.width,n=t.style.left,i=t.style.bottom;t.removeAttribute("style"),e&&(t.style.width=e),n&&(t.style.left=n),i&&(t.style.bottom=i)}}catch(t){R.warn("Error cleaning up scrollbar styles:",t)}}updateOptions(t){this.options=t}resetStylesInjected(){this.stylesInjected=!1}areStylesInjected(){return this.stylesInjected}}const Tn="data-taskid",An="aria-level";class Dn{constructor(t,e,n,i,r,s){this.chartContext=t,this.dataManager=e,this.getTaskContainer=n,this.reRender=i,this.selectionManager=r,this.editingCommands=s,this.keydownHandler=null}attach(){this.detach();const t=this.getTaskContainer();t&&(this.initRovingTabindex(t),this.keydownHandler=e=>this.handleKeydown(e,t),t.addEventListener("keydown",this.keydownHandler))}detach(){const t=this.getTaskContainer();t&&this.keydownHandler&&t.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null}initRovingTabindex(t){this.getVisibleRows(t).forEach(((t,e)=>{t.setAttribute("tabindex",0===e?"0":"-1")}))}getVisibleRows(t){return Array.from(t.querySelectorAll(`${en.tasksDataRow}:not(${en.tasksEmptyRow}):not(.tasks-add-row)`))}moveFocusToRow(t,e){this.getVisibleRows(e).forEach((t=>t.setAttribute("tabindex","-1"))),t.setAttribute("tabindex","0"),t.focus()}handleKeydown(t,e){var n;const i=this.getVisibleRows(e);if(0===i.length)return;const r=this.chartContext.getActiveElement(),s=r?i.indexOf(r):-1;switch(t.key){case"ArrowDown":{t.preventDefault();const n=i[Math.min(s+1,i.length-1)];n&&this.moveFocusToRow(n,e);break}case"ArrowUp":{t.preventDefault();const n=i[Math.max(s-1,0)];n&&this.moveFocusToRow(n,e);break}case"ArrowRight":{if(t.preventDefault(),s<0||!r)break;const n=r.getAttribute(Tn);if(!n)break;const o=r.getAttribute("aria-expanded");if("false"===o)this.dataManager.toggleTask(n),this.reRender();else if("true"===o){const t=parseInt(r.getAttribute(An)||"1",10),n=i[s+1];if(n){parseInt(n.getAttribute(An)||"1",10)>t&&this.moveFocusToRow(n,e)}}break}case"ArrowLeft":{if(t.preventDefault(),s<0||!r)break;const n=r.getAttribute(Tn);if(!n)break;if("true"===r.getAttribute("aria-expanded"))this.dataManager.toggleTask(n),this.reRender();else{const t=parseInt(r.getAttribute(An)||"1",10);if(t<=1)break;for(let n=s-1;n>=0;n--){const r=i[n];if(parseInt(r.getAttribute(An)||"1",10)<t){this.moveFocusToRow(r,e);break}}}break}case"Home":{t.preventDefault();const n=i[0];n&&this.moveFocusToRow(n,e);break}case"End":{t.preventDefault();const n=i[i.length-1];n&&this.moveFocusToRow(n,e);break}case" ":{if(t.preventDefault(),!r)break;const e=r.getAttribute(Tn)?r:r.closest(`[${Tn}]`),n=(null==e?void 0:e.getAttribute(Tn))??null;if(!n)break;if(this.selectionManager)t.shiftKey?this.selectionManager.handleClick(n,{ctrlKey:!1,metaKey:!1,shiftKey:!0}):this.selectionManager.toggleTask(n);else{const t=e,n="true"===t.getAttribute("aria-selected");t.setAttribute("aria-selected",n?"false":"true")}break}case"a":if(!t.ctrlKey&&!t.metaKey)break;t.preventDefault(),null==(n=this.selectionManager)||n.selectAll();break;case"Enter":{if(t.preventDefault(),!r)break;const e=r.getAttribute(Tn);if(!e)break;const n=this.chartContext.querySelector(`[data-taskid="${CSS.escape(e)}"].bar-timeline`);n&&n.dispatchEvent(new MouseEvent("dblclick",{bubbles:!0}));break}case"Escape":this.selectionManager&&this.selectionManager.getSelectedIds().size>0?this.selectionManager.clearSelection():r&&r.blur();break;case"Delete":case"Backspace":{if(!this.editingCommands||!r)break;const e=r.getAttribute(Tn);if(!e)break;t.preventDefault(),this.editingCommands.delete(e);break}case"Tab":{if(!this.editingCommands||!r)break;const e=r.getAttribute(Tn);if(!e)break;t.preventDefault(),t.shiftKey?this.editingCommands.outdent(e):this.editingCommands.indent(e);break}}}}class In{constructor(t){this.chartContext=t,this.menuEl=null,this.outsideMouseDownHandler=null,this.escHandler=null,this.dismissOnScrollHandler=null}show(t,e,n){this.hide();if(0===n.filter((t=>!("separator"in t))).length)return!1;const i=this.chartContext.createElement("div");i.className="gantt-context-menu",i.setAttribute("role","menu"),n.forEach(((t,e)=>{if(function(t){return!0===t.separator}(t)){if(0===e||e===n.length-1)return;const t=this.chartContext.createElement("div");return t.className="gantt-context-menu-separator",t.setAttribute("role","separator"),void i.append(t)}const r=t,s=this.chartContext.createElement("button");s.className="gantt-context-menu-item",s.type="button",s.setAttribute("role","menuitem"),s.setAttribute("data-menu-id",r.id),s.textContent=r.label,r.disabled?s.disabled=!0:s.addEventListener("click",(t=>{t.stopPropagation(),this.hide(),r.onClick()})),i.append(s)})),document.body.append(i);const r=i.getBoundingClientRect(),s=Math.max(0,Math.min(t,window.innerWidth-r.width-4)),o=Math.max(0,Math.min(e,window.innerHeight-r.height-4));return i.style.left=`${s}px`,i.style.top=`${o}px`,this.outsideMouseDownHandler=t=>{this.menuEl&&!this.menuEl.contains(t.target)&&this.hide()},this.escHandler=t=>{"Escape"===t.key&&(t.stopPropagation(),this.hide())},this.dismissOnScrollHandler=()=>this.hide(),setTimeout((()=>{this.outsideMouseDownHandler&&document.addEventListener("mousedown",this.outsideMouseDownHandler)}),0),document.addEventListener("keydown",this.escHandler),window.addEventListener("scroll",this.dismissOnScrollHandler,!0),window.addEventListener("resize",this.dismissOnScrollHandler),this.menuEl=i,!0}hide(){this.menuEl&&(this.menuEl.remove(),this.menuEl=null),this.outsideMouseDownHandler&&(document.removeEventListener("mousedown",this.outsideMouseDownHandler),this.outsideMouseDownHandler=null),this.escHandler&&(document.removeEventListener("keydown",this.escHandler),this.escHandler=null),this.dismissOnScrollHandler&&(window.removeEventListener("scroll",this.dismissOnScrollHandler,!0),window.removeEventListener("resize",this.dismissOnScrollHandler),this.dismissOnScrollHandler=null)}isOpen(){return null!==this.menuEl}destroy(){this.hide()}}class $n{constructor(t,e,n){this.chartContext=t,this.dataManager=e,this.getElement=n,this.selectedIds=new Set,this.lastClickedId=null}getSelectedTasks(){return Array.from(this.selectedIds).map((t=>this.dataManager.getTaskById(t))).filter((t=>null!==t))}getSelectedIds(){return new Set(this.selectedIds)}setSelectedTasks(t){const e=new Set(this.selectedIds);this.selectedIds.clear(),t.forEach((t=>{this.dataManager.getTaskById(t)&&this.selectedIds.add(t)})),this.syncDom(),this.emitChange(e)}clearSelection(){if(0===this.selectedIds.size)return;const t=new Set(this.selectedIds);this.selectedIds.clear(),this.lastClickedId=null,this.syncDom(),this.emitChange(t)}toggleTask(t){const e=new Set(this.selectedIds);this.selectedIds.has(t)?this.selectedIds.delete(t):this.selectedIds.add(t),this.lastClickedId=t,this.syncDom(),this.emitChange(e)}handleClick(t,e){const n=new Set(this.selectedIds);e.shiftKey&&this.lastClickedId?this.rangeSelect(this.lastClickedId,t):e.ctrlKey||e.metaKey?(this.selectedIds.has(t)?this.selectedIds.delete(t):this.selectedIds.add(t),this.lastClickedId=t):(this.selectedIds.clear(),this.selectedIds.add(t),this.lastClickedId=t),this.syncDom(),this.emitChange(n)}selectAll(){const t=new Set(this.selectedIds),e=this.dataManager.getFlatVisibleTasks();this.selectedIds.clear(),e.forEach((t=>this.selectedIds.add(t.id))),this.syncDom(),this.emitChange(t)}selectGroup(t){const e=new Set(this.selectedIds),n=this.dataManager.getNestedChildTasks(t,!0);this.selectedIds.add(t),n.forEach((t=>this.selectedIds.add(t.id))),this.syncDom(),this.emitChange(e)}isSelected(t){return this.selectedIds.has(t)}restoreAfterRender(){const t=new Set;this.selectedIds.forEach((e=>{this.dataManager.getTaskById(e)&&t.add(e)})),this.selectedIds=t,this.syncDom()}captureState(){return Array.from(this.selectedIds)}restoreState(t){this.selectedIds=new Set(t)}destroy(){this.selectedIds.clear(),this.lastClickedId=null}rangeSelect(t,e){const n=this.dataManager.getFlatVisibleTasks(),i=n.findIndex((e=>e.id===t)),r=n.findIndex((t=>t.id===e));if(-1===i||-1===r)return;const s=Math.min(i,r),o=Math.max(i,r);for(let t=s;t<=o;t++)this.selectedIds.add(n[t].id)}syncDom(){this.getElement().querySelectorAll(`${en.tasksDataRow}:not(${en.tasksEmptyRow})`).forEach((t=>{const e=t.getAttribute("data-taskid");if(!e)return;const n=this.selectedIds.has(e);t.setAttribute("aria-selected",n?"true":"false");const i=t.querySelector(".gantt-selection-checkbox");i&&(i.checked=n)})),this.syncSelectAllCheckbox()}syncSelectAllCheckbox(){const t=this.getElement().querySelector(".gantt-select-all-checkbox");if(!t)return;const e=this.dataManager.getFlatVisibleTasks().length,n=this.selectedIds.size;0===n?(t.checked=!1,t.indeterminate=!1):n>=e?(t.checked=!0,t.indeterminate=!1):(t.checked=!1,t.indeterminate=!0)}emitChange(t){if(this.setsEqual(t,this.selectedIds))return;const e={selectedTasks:this.getSelectedTasks(),selectedIds:Array.from(this.selectedIds),timestamp:Date.now()};this.getElement().dispatchEvent(new CustomEvent(it.SELECTION_CHANGE,{detail:e,bubbles:!0,cancelable:!1}))}setsEqual(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}}const Fn="http://www.w3.org/2000/svg",Bn="data-from-id",Ln="data-to-id",Rn="data-arrow-state",Hn="data-arrow-remove";class Pn{constructor(t,e){this.chartContext=t,this.onRemove=e,this.hovered=null,this.selected=null,this.svg=null,this.rootElement=null,this.mouseOverHandler=null,this.mouseOutHandler=null,this.clickHandler=null,this.rootClickHandler=null,this.keyHandler=null}attach(t,e){if(this.detach(),!t)return;this.svg=t,this.rootElement=e,this.mouseOverHandler=t=>this.handleMouseOver(t),this.mouseOutHandler=t=>this.handleMouseOut(t),this.clickHandler=t=>this.handleClick(t),this.rootClickHandler=t=>this.handleRootClick(t),this.keyHandler=t=>this.handleKeyDown(t),t.addEventListener("mouseover",this.mouseOverHandler),t.addEventListener("mouseout",this.mouseOutHandler),t.addEventListener("click",this.clickHandler),e.addEventListener("click",this.rootClickHandler,!0),e.addEventListener("keydown",this.keyHandler),this.selected&&!this.findEdgePaths(this.selected)&&(this.selected=null),this.selected&&(this.applyState(this.selected,"selected"),this.renderRemoveButton(this.selected)),this.hovered=null;t.querySelectorAll("path[data-arrow-hit]").forEach((t=>{t.setAttribute("tabindex","0"),t.setAttribute("role","button"),t.setAttribute("aria-label",`Dependency from ${t.getAttribute(Bn)} to ${t.getAttribute(Ln)}`)}))}detach(){this.svg&&this.mouseOverHandler&&this.svg.removeEventListener("mouseover",this.mouseOverHandler),this.svg&&this.mouseOutHandler&&this.svg.removeEventListener("mouseout",this.mouseOutHandler),this.svg&&this.clickHandler&&this.svg.removeEventListener("click",this.clickHandler),this.rootElement&&this.rootClickHandler&&this.rootElement.removeEventListener("click",this.rootClickHandler,!0),this.rootElement&&this.keyHandler&&this.rootElement.removeEventListener("keydown",this.keyHandler),this.mouseOverHandler=null,this.mouseOutHandler=null,this.clickHandler=null,this.rootClickHandler=null,this.keyHandler=null,this.svg=null,this.rootElement=null}clearSelection(){this.selected&&(this.clearState(this.selected),this.removeRemoveButton(),this.selected=null)}getSelected(){return this.selected?{...this.selected}:null}handleMouseOver(t){const e=this.edgeFromEvent(t);e&&(this.selected&&this.selected.fromId===e.fromId&&this.selected.toId===e.toId||this.hovered&&this.hovered.fromId===e.fromId&&this.hovered.toId===e.toId||(this.hovered&&this.clearState(this.hovered),this.hovered=e,this.applyState(e,"hover")))}handleMouseOut(t){var e;const n=this.edgeFromEvent(t);if(!n||!this.hovered)return;if(n.fromId!==this.hovered.fromId||n.toId!==this.hovered.toId)return;const i=t.relatedTarget??null;i&&(null==(e=this.edgeFromElement(i))?void 0:e.fromId)===n.fromId||(this.clearState(n),this.hovered=null)}handleClick(t){const e=t.target;if((null==e?void 0:e.closest(`[${Hn}]`))&&this.selected){t.stopPropagation();const{fromId:e,toId:n}=this.selected;this.clearSelection();try{this.onRemove(e,n)}catch(t){R.warn(`[${this.chartContext.getInstanceId()}] removeDependency failed:`,t)}return}const n=this.edgeFromEvent(t);n&&(t.stopPropagation(),this.selectEdge(n))}handleRootClick(t){if(!this.selected)return;const e=t.target;e&&(e.closest(`[data-arrow-hit], [${Hn}]`)||this.clearSelection())}handleKeyDown(t){if("Escape"===t.key)return void(this.selected&&(t.preventDefault(),this.clearSelection()));const e=t.target,n=e?this.edgeFromElement(e):null;if(("Enter"===t.key||" "===t.key)&&n)return t.preventDefault(),void this.selectEdge(n);if("Delete"===t.key||"Backspace"===t.key){const e=n??this.selected;if(!e)return;t.preventDefault(),this.clearSelection();try{this.onRemove(e.fromId,e.toId)}catch(t){R.warn(`[${this.chartContext.getInstanceId()}] removeDependency failed:`,t)}}}selectEdge(t){this.hovered&&(this.clearState(this.hovered),this.hovered=null),this.selected&&(this.clearState(this.selected),this.removeRemoveButton()),this.selected=t,this.applyState(t,"selected"),this.renderRemoveButton(t)}edgeFromEvent(t){return this.edgeFromElement(t.target)}edgeFromElement(t){if(!t)return null;const e=t.closest(`path[${Bn}]`);if(!e)return null;const n=e.getAttribute(Bn),i=e.getAttribute(Ln);return n&&i?{fromId:n,toId:i}:null}findEdgePaths(t){if(!this.svg)return null;const e=this.svg.querySelectorAll(`path[${Bn}="${zn(t.fromId)}"][${Ln}="${zn(t.toId)}"]`);return e.length>0?e:null}applyState(t,e){const n=this.findEdgePaths(t);n&&n.forEach((t=>t.setAttribute(Rn,e)))}clearState(t){const e=this.findEdgePaths(t);e&&e.forEach((t=>t.removeAttribute(Rn)))}renderRemoveButton(t){if(this.removeRemoveButton(),!this.svg)return;const e=this.findEdgePaths(t);if(!e)return;const n=Array.from(e).find((t=>!t.hasAttribute("data-arrow-hit")));if(!n)return;const i=function(t){const e="function"==typeof t.getTotalLength?function(t){try{return t.getTotalLength()}catch{return 0}}(t):0;if(e>0&&"function"==typeof t.getPointAtLength)try{const n=t.getPointAtLength(e),i=t.getPointAtLength(Math.max(0,e-8));return{tip:{x:n.x,y:n.y},prev:{x:i.x,y:i.y}}}catch{}const n=t.getAttribute("d")??"";if(!n)return null;const i=/[ML]\s*(-?\d+(?:\.\d+)?)[ ,](-?\d+(?:\.\d+)?)/g,r=[];let s;for(;null!==(s=i.exec(n));)r.push({x:parseFloat(s[1]),y:parseFloat(s[2])});if(0===r.length)return null;const o=r[r.length-1],a=r.length>=2?r[r.length-2]:o;return{tip:o,prev:a}}(n);if(!i)return;const{tip:r,prev:s}=i,o=s.x>r.x?1:-1,a=r.x+11*o,l=r.y,d=this.chartContext,h=d.createElementNS(Fn,"g");h.setAttribute(Hn,""),h.setAttribute(Bn,t.fromId),h.setAttribute(Ln,t.toId),h.setAttribute("transform",`translate(${a}, ${l})`),h.setAttribute("role","button"),h.setAttribute("tabindex","0"),h.setAttribute("aria-label",`Remove dependency from ${t.fromId} to ${t.toId}`),h.setAttribute("pointer-events","auto");const c=d.createElementNS(Fn,"circle");c.setAttribute("r",String(7)),c.setAttribute("cx","0"),c.setAttribute("cy","0"),h.appendChild(c);const u=d.createElementNS(Fn,"path");u.setAttribute("d","M -3.5 -3.5 L 3.5 3.5 M 3.5 -3.5 L -3.5 3.5"),u.setAttribute("pointer-events","none"),h.appendChild(u),this.svg.appendChild(h)}removeRemoveButton(){if(!this.svg)return;const t=this.svg.querySelector(`g[${Hn}]`);t&&t.remove()}}function zn(t){return"undefined"!=typeof CSS&&"function"==typeof CSS.escape?CSS.escape(t):t.replace(/["\\]/g,"\\$&")}const On="http://www.w3.org/2000/svg",Wn="bar-dep-anchor--drawing",Nn="bar-dep-drop-target",qn="bar-dep-drop-invalid";class Yn{constructor(t,e,n,i,r){this.chartContext=t,this.getRowHeight=e,this.getCornerRadius=n,this.validate=i,this.onCommit=r,this.session=null,this.rootElement=null,this.timelineBody=null,this.scrollContainer=null,this.mouseDownHandler=null,this.mouseMoveHandler=null,this.mouseUpHandler=null,this.keyHandler=null,this.autoScrollRafId=null,this.autoScrollDx=0,this.lastClientEvent=null}attach(t,e,n){this.detach(),e&&(this.rootElement=t,this.timelineBody=e,this.scrollContainer=n??null,this.mouseDownHandler=t=>this.handleMouseDown(t),this.keyHandler=t=>this.handleKeyDown(t),t.addEventListener("pointerdown",this.mouseDownHandler,!0),t.addEventListener("keydown",this.keyHandler))}detach(){this.cancel(),this.rootElement&&this.mouseDownHandler&&this.rootElement.removeEventListener("pointerdown",this.mouseDownHandler,!0),this.rootElement&&this.keyHandler&&this.rootElement.removeEventListener("keydown",this.keyHandler),this.timelineBody=null,this.rootElement=null,this.scrollContainer=null,this.mouseDownHandler=null,this.keyHandler=null}isDrawing(){return null!==this.session}static deriveType(t,e){return"finish"===t&&"start"===e?"FS":"start"===t&&"start"===e?"SS":"finish"===t&&"finish"===e?"FF":"SF"}handleMouseDown(t){if(this.session)return;if(0!==t.button)return;const e=t.target,n=null==e?void 0:e.closest("[data-bar-anchor]");if(!n)return;const i=n.getAttribute("data-taskid"),r=n.getAttribute("data-bar-anchor");if(!i||!r)return;t.preventDefault(),t.stopPropagation();const s=n.parentElement;if(!(s instanceof HTMLElement&&this.timelineBody))return;const o=this.toLocalRect(s),a=this.toLocalRect(n),l=a.width>0||a.height>0?{x:(a.left+a.right)/2,y:(a.top+a.bottom)/2}:{x:"start"===r?o.left:o.right,y:(o.top+o.bottom)/2};n.classList.add(Wn),this.session={sourceTaskId:i,sourceAnchor:r,sourceAnchorEl:n,sourceBarEl:s,sourceAnchorPoint:l,sourceBarRect:o,targetTaskId:null,targetBarEl:null,targetAnchor:null,derivedType:null,verdict:{ok:!0},previewSvg:null,previewPath:null,typeLabel:null},this.ensurePreview(),this.updatePreviewToCursor(t),this.mouseMoveHandler=t=>this.handleMouseMove(t),this.mouseUpHandler=t=>this.handleMouseUp(t),document.addEventListener("pointermove",this.mouseMoveHandler),document.addEventListener("pointerup",this.mouseUpHandler),document.addEventListener("pointercancel",this.mouseUpHandler)}handleMouseMove(t){this.session&&(this.lastClientEvent=t,this.updatePreviewToCursor(t),this.updateAutoScroll(t))}updateAutoScroll(t){if(!this.scrollContainer)return;const e=this.computeAutoScrollVelocity(t);this.autoScrollDx=e,0!==e?this.startAutoScrollLoop():this.stopAutoScrollLoop()}computeAutoScrollVelocity(t){const e=this.scrollContainer;if(!e)return 0;const n=e.getBoundingClientRect(),i=t.clientX-n.left,r=n.right-t.clientX;if(i<40&&e.scrollLeft>0){const t=1-Math.max(0,i)/40;return-Math.round(12*t)}const s=e.scrollWidth-e.clientWidth;if(r<40&&e.scrollLeft<s){const t=1-Math.max(0,r)/40;return Math.round(12*t)}return 0}startAutoScrollLoop(){if(null!==this.autoScrollRafId)return;const t=()=>{if(this.autoScrollRafId=null,!this.session||!this.scrollContainer||0===this.autoScrollDx)return;const e=this.scrollContainer,n=e.scrollLeft;e.scrollLeft=n+this.autoScrollDx,e.scrollLeft!==n?(this.lastClientEvent&&this.updatePreviewToCursor(this.lastClientEvent),this.autoScrollRafId=requestAnimationFrame(t)):this.autoScrollDx=0};this.autoScrollRafId=requestAnimationFrame(t)}stopAutoScrollLoop(){null!==this.autoScrollRafId&&(cancelAnimationFrame(this.autoScrollRafId),this.autoScrollRafId=null)}handleMouseUp(t){if(!this.session)return;const e=this.session,n=e.targetTaskId&&e.derivedType&&e.verdict.ok?{fromId:e.sourceTaskId,toId:e.targetTaskId,type:e.derivedType}:null,i=e.sourceBarEl;if(this.endDrawing(),n){try{this.onCommit(n.fromId,n.toId,n.type)}catch(t){R.warn(`[${this.chartContext.getInstanceId()}] addDependency failed:`,t)}(null==i?void 0:i.isConnected)&&"function"==typeof i.focus&&i.focus({preventScroll:!0})}t.stopPropagation()}handleKeyDown(t){this.session&&"Escape"===t.key&&(t.preventDefault(),this.cancel())}cancel(){this.session&&this.endDrawing()}endDrawing(){var t,e;this.session&&(this.session.sourceAnchorEl.classList.remove(Wn),this.clearDropTargetHighlight(),null==(t=this.session.previewSvg)||t.remove(),null==(e=this.session.typeLabel)||e.remove()),this.session=null,this.stopAutoScrollLoop(),this.autoScrollDx=0,this.lastClientEvent=null,this.mouseMoveHandler&&document.removeEventListener("pointermove",this.mouseMoveHandler),this.mouseUpHandler&&(document.removeEventListener("pointerup",this.mouseUpHandler),document.removeEventListener("pointercancel",this.mouseUpHandler)),this.mouseMoveHandler=null,this.mouseUpHandler=null}updatePreviewToCursor(t){if(!this.session||!this.timelineBody)return;const e=this.session,n=this.findTargetBarUnderCursor(t,e.sourceTaskId);let i;this.clearDropTargetHighlight();let r=null;if(n){const s=this.toLocalRect(n),o=n.getAttribute("data-taskid")??"",a=this.clientToLocal(t).x<(s.left+s.right)/2?"start":"finish",l=Yn.deriveType(e.sourceAnchor,a),d=this.validate(e.sourceTaskId,o,l);e.targetTaskId=o,e.targetBarEl=n,e.targetAnchor=a,e.derivedType=l,e.verdict=d,n.classList.add(Nn),d.ok||n.classList.add(qn),i={x:"start"===a?s.left:s.right,y:(s.top+s.bottom)/2},r=s,this.showTypeLabel(s,l,d)}else e.targetTaskId=null,e.targetBarEl=null,e.targetAnchor=null,e.derivedType=null,e.verdict={ok:!0},i=this.clientToLocal(t),this.hideTypeLabel();this.updatePreviewPath(i,r)}findTargetBarUnderCursor(t,e){if("function"!=typeof document.elementsFromPoint)return null;const n=document.elementsFromPoint(t.clientX,t.clientY);for(const t of n){if(!(t instanceof HTMLElement))continue;if(!t.classList.contains("bar-timeline"))continue;const n=t.getAttribute("data-taskid");if(n&&n!==e)return t}return null}toLocalRect(t){const e=this.timelineBody,n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),r=i.left-n.left+e.scrollLeft,s=i.top-n.top+e.scrollTop;return{left:r,right:r+i.width,top:s,bottom:s+i.height,width:i.width,height:i.height}}clientToLocal(t){const e=this.timelineBody,n=e.getBoundingClientRect();return{x:t.clientX-n.left+e.scrollLeft,y:t.clientY-n.top+e.scrollTop}}ensurePreview(){if(!this.session||!this.timelineBody)return;const t=`${this.chartContext.getInstanceId()}-dep-preview`;let e=this.timelineBody.querySelector(`#${n=t,"undefined"!=typeof CSS&&"function"==typeof CSS.escape?CSS.escape(n):n.replace(/["\\]/g,"\\$&")}`);var n;e||(e=this.chartContext.createElementNS(On,"svg"),e.setAttribute("id",t),e.setAttribute("style","position:absolute;left:0;top:0;pointer-events:none;width:100%;height:100%;overflow:visible;z-index:6;"),this.timelineBody.appendChild(e)),this.session.previewSvg=e;const i=this.chartContext.createElementNS(On,"path");i.setAttribute("data-edge-preview",""),e.appendChild(i),this.session.previewPath=i}updatePreviewPath(t,e){const n=this.session;if(!n)return;const i=n.previewPath;if(!i)return;const r=this.virtualSourceRect(),s=e??{left:t.x,right:t.x+1,top:t.y-1,bottom:t.y+1,width:1,height:2},o=n.derivedType??("finish"===n.sourceAnchor?"FS":"SS"),a=Me(Ie.calculateArrowPathFromRects(r,s,{paddingX:20,paddingY:this.getRowHeight()/2},o),this.getCornerRadius());i.setAttribute("d",a),n.verdict.ok?i.removeAttribute("data-preview-state"):i.setAttribute("data-preview-state","invalid")}virtualSourceRect(){const t=this.session,{x:e,y:n}=t.sourceAnchorPoint,i="start"===t.sourceAnchor?e:e-1,r="finish"===t.sourceAnchor?e:e+1,s=t.sourceBarRect.height/2;return{left:i,right:r,top:n-s,bottom:n+s,width:r-i,height:2*s}}showTypeLabel(t,e,n){if(!this.timelineBody||!this.session)return;let i=this.session.typeLabel;i||(i=document.createElement("div"),i.className="bar-dep-type-label",this.timelineBody.appendChild(i),this.session.typeLabel=i),i.textContent=n.ok?e:`${e} — ${function(t){switch(t){case"self":return"self";case"duplicate":return"duplicate";case"cycle":return"cycle";case"summary-descendant":return"parent/child";case"task-missing":return"missing";case"hook-veto":return"blocked";default:return"invalid"}}(n.reason)}`,n.ok?i.removeAttribute("data-preview-state"):i.setAttribute("data-preview-state","invalid"),i.style.left=`${t.right+8}px`,i.style.top=(t.top+t.bottom)/2+"px"}hideTypeLabel(){var t;(null==(t=this.session)?void 0:t.typeLabel)&&(this.session.typeLabel.remove(),this.session.typeLabel=null)}clearDropTargetHighlight(){var t;(null==(t=this.session)?void 0:t.targetBarEl)&&this.session.targetBarEl.classList.remove(Nn,qn)}}const Un="gantt-drawing";class jn{constructor(t,e,n,i){this.chartContext=t,this.getRowHeight=e,this.getBarMargin=n,this.onCommit=i,this.session=null,this.rootElement=null,this.timelineBody=null,this.pointerDownHandler=null,this.pointerMoveHandler=null,this.pointerUpHandler=null,this.keyHandler=null}attach(t,e){this.detach(),e&&(this.rootElement=t,this.timelineBody=e,this.pointerDownHandler=t=>this.handlePointerDown(t),this.keyHandler=t=>this.handleKeyDown(t),t.addEventListener("pointerdown",this.pointerDownHandler),t.addEventListener("keydown",this.keyHandler))}detach(){this.cancel(),this.rootElement&&this.pointerDownHandler&&this.rootElement.removeEventListener("pointerdown",this.pointerDownHandler),this.rootElement&&this.keyHandler&&this.rootElement.removeEventListener("keydown",this.keyHandler),this.rootElement=null,this.timelineBody=null,this.pointerDownHandler=null,this.keyHandler=null}isDrawing(){return null!==this.session}isEmptyTimelineTarget(t){if(!t)return!1;return!!t.closest(".bar-container, .timeline-body, .timeline-data-row, .timeline-empty-row")&&!t.closest(".bar-timeline, [data-bar-anchor]")}handlePointerDown(t){if(this.session)return;if(null!=t.button&&t.button>0)return;const e=t.target;if(!this.isEmptyTimelineTarget(e)||!this.timelineBody)return;const{x:n,y:i}=this.clientToLocal(t),r=this.getRowHeight(),s=r>0?Math.max(0,Math.floor(i/r)):0,o=l(this.chartContext,{className:"gantt-draw-task-preview"});this.timelineBody.appendChild(o),this.timelineBody.classList.add(Un),this.session={startX:n,currentX:n,rowIndex:s,preview:o,pointerId:t.pointerId??null},this.positionPreview(),this.pointerMoveHandler=t=>this.handlePointerMove(t),this.pointerUpHandler=t=>this.handlePointerUp(t),document.addEventListener("pointermove",this.pointerMoveHandler),document.addEventListener("pointerup",this.pointerUpHandler),document.addEventListener("pointercancel",this.pointerUpHandler)}handlePointerMove(t){this.session&&(null!=this.session.pointerId&&null!=t.pointerId&&t.pointerId!==this.session.pointerId||(this.session.currentX=this.clientToLocal(t).x,this.positionPreview()))}handlePointerUp(t){if(!this.session)return;const{startX:e,currentX:n,rowIndex:i}=this.session;this.endDrawing(),Math.abs(n-e)<6||(t.stopPropagation(),this.onCommit(e,n,i))}handleKeyDown(t){this.session&&"Escape"===t.key&&(t.preventDefault(),this.cancel())}cancel(){this.session&&this.endDrawing()}endDrawing(){var t,e;null==(t=this.session)||t.preview.remove(),null==(e=this.timelineBody)||e.classList.remove(Un),this.session=null,this.pointerMoveHandler&&document.removeEventListener("pointermove",this.pointerMoveHandler),this.pointerUpHandler&&(document.removeEventListener("pointerup",this.pointerUpHandler),document.removeEventListener("pointercancel",this.pointerUpHandler)),this.pointerMoveHandler=null,this.pointerUpHandler=null}positionPreview(){if(!this.session)return;const{startX:t,currentX:e,rowIndex:n,preview:i}=this.session,r=this.getRowHeight(),s=this.getBarMargin(),o=Math.min(t,e),a=Math.abs(e-t);i.style.left=`${o}px`,i.style.width=`${a}px`,i.style.top=`${n*r+s}px`,i.style.height=`${Math.max(0,r-2*s)}px`}clientToLocal(t){const e=this.timelineBody,n=e.getBoundingClientRect();return{x:t.clientX-n.left+e.scrollLeft,y:t.clientY-n.top+e.scrollTop}}}class Vn{constructor(t,e){this.chartContext=t,this.onJump=e,this.wrapper=null,this.timelineBody=null,this.barContainer=null,this.rows=[],this.scrollHandler=null,this.rafId=null}attach(t){this.detach(),t&&(this.wrapper=t,this.timelineBody=t.querySelector(".timeline-body"),this.barContainer=t.querySelector(".bar-container"),this.timelineBody&&this.barContainer&&(this.build(),0!==this.rows.length&&(this.scrollHandler=()=>this.scheduleUpdate(),this.wrapper.addEventListener("scroll",this.scrollHandler,{passive:!0}),this.update())))}detach(){this.wrapper&&this.scrollHandler&&this.wrapper.removeEventListener("scroll",this.scrollHandler),null!==this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null);for(const t of this.rows)t.left.remove(),t.right.remove();this.rows=[],this.wrapper=null,this.timelineBody=null,this.barContainer=null,this.scrollHandler=null}build(){const t=this.timelineBody,e=this.barContainer;t.querySelectorAll(".timeline-data-row[data-taskid]").forEach((t=>{const n=t.getAttribute("data-taskid");if(!n||n.startsWith("empty-"))return;const i=e.querySelector(`.bar-timeline[data-taskid="${n}"]`);if(!i)return;const r=this.createButton(n,"left"),s=this.createButton(n,"right");t.append(r,s),this.rows.push({taskId:n,barLeft:i.offsetLeft,barWidth:i.offsetWidth,left:r,right:s})}))}createButton(t,e){const n=l(this.chartContext,{className:`gantt-scroll-btn gantt-scroll-btn-${e}`});return n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label","left"===e?"Scroll to task (earlier)":"Scroll to task (later)"),n.style.display="none",n.textContent="left"===e?"‹":"›",n.addEventListener("pointerdown",(t=>t.stopPropagation())),n.addEventListener("click",(e=>{e.stopPropagation(),this.onJump(t)})),n.addEventListener("keydown",(e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.onJump(t))})),n}scheduleUpdate(){null===this.rafId&&(this.rafId=requestAnimationFrame((()=>{this.rafId=null,this.update()})))}update(){const t=this.wrapper;if(!t)return;const e=t.scrollLeft,n=t.clientWidth,i=e+n;for(const t of this.rows){const r=t.barLeft+t.barWidth<=e+6,s=n>0&&t.barLeft>=i-6;r?(t.left.style.display="flex",t.left.style.left=`${e+6}px`):t.left.style.display="none",s?(t.right.style.display="flex",t.right.style.left=e+n-20-6+"px"):t.right.style.display="none"}}}class _n{constructor(t){this._scrollTop=0,this._rowHeight=Math.max(1,t.rowHeight),this._overscan=Math.max(0,t.overscan??5),this._totalRows=Math.max(0,t.totalRows),this._containerHeight=Math.max(0,t.containerHeight)}getVisibleRange(){if(0===this._totalRows)return{startIndex:0,endIndex:-1};const t=Math.floor(this._scrollTop/this._rowHeight),e=Math.max(0,t-this._overscan),n=Math.ceil(this._containerHeight/this._rowHeight);return{startIndex:e,endIndex:Math.min(this._totalRows-1,t+n-1+this._overscan)}}getTotalHeight(){return this._totalRows*this._rowHeight}getOffsetForIndex(t){return t*this._rowHeight}getTopSpacerHeight(){const{startIndex:t}=this.getVisibleRange();return t*this._rowHeight}getBottomSpacerHeight(){if(0===this._totalRows)return 0;const{endIndex:t}=this.getVisibleRange();return Math.max(0,(this._totalRows-1-t)*this._rowHeight)}getVisibleCount(){const{startIndex:t,endIndex:e}=this.getVisibleRange();return e<t?0:e-t+1}setScrollTop(t){this._scrollTop=Math.max(0,t)}setTotalRows(t){this._totalRows=Math.max(0,t)}setContainerHeight(t){this._containerHeight=Math.max(0,t)}setOverscan(t){this._overscan=Math.max(0,t)}get scrollTop(){return this._scrollTop}get totalRows(){return this._totalRows}get containerHeight(){return this._containerHeight}get rowHeight(){return this._rowHeight}get overscan(){return this._overscan}}const Gn="virtualizer-top-spacer",Kn="virtualizer-bottom-spacer",Xn=`.${Gn}`,Zn=`.${Kn}`,Qn="data-taskid";class Jn{constructor(t,e,n,i,r,s,o,a=(()=>{}),l){this.domRefs=t,this.options=e,this.chartContext=n,this.dataManager=i,this.getPixelsPerMs=r,this.getIsRtl=s,this.onAfterUpdate=o,this.onToggle=a,this.commitTaskUpdate=l,this.cachedVisibleTasks=[],this.lastVisibleRange=null,this.virtualScrollRAF=null,this.verticalScrollHandler=null,this._isActive=!1,this.renderedTaskIds=new Set,this.virtualizer=new _n({rowHeight:e.rowHeight,totalRows:0,containerHeight:0})}get isActive(){return this._isActive}getRenderedTaskIds(){return this.renderedTaskIds}initialise(t,e=0){this.cachedVisibleTasks=t;const{rowHeight:n,height:i}=this.options,r="number"==typeof i?Math.max(i-100,200):600,s=Math.ceil(r/n);if(this.virtualizer=new _n({rowHeight:n,totalRows:t.length,containerHeight:r,overscan:s}),e>0){const i=Math.max(0,t.length*n-r);this.virtualizer.setScrollTop(Math.min(e,i))}if(t.length<=50)return void(this._isActive=!1);this._isActive=!0;const o=this.virtualizer.getVisibleRange();return this.lastVisibleRange=o,this.renderedTaskIds=new Set(t.slice(o.startIndex,o.endIndex+1).map((t=>t.id))),{allTasks:t,range:o,rowHeight:n}}attach(){const{verticalScrollContainer:t}=this.domRefs;if(!t||!this._isActive)return;const e=t.clientHeight;e>0&&(this.virtualizer.setContainerHeight(e),this.virtualizer.setOverscan(Math.ceil(e/this.options.rowHeight))),this.detach(),this.verticalScrollHandler=()=>{const e=t.scrollTop;this.scheduleUpdate(e)},t.addEventListener("scroll",this.verticalScrollHandler,{passive:!0})}detach(){const{verticalScrollContainer:t}=this.domRefs;t&&this.verticalScrollHandler&&t.removeEventListener("scroll",this.verticalScrollHandler),this.verticalScrollHandler=null,null!==this.virtualScrollRAF&&"undefined"!=typeof cancelAnimationFrame&&(cancelAnimationFrame(this.virtualScrollRAF),this.virtualScrollRAF=null),this.lastVisibleRange=null}destroy(){this.detach(),this.cachedVisibleTasks=[],this.renderedTaskIds.clear(),this._isActive=!1}updateTotalRows(t){if(this.cachedVisibleTasks=t,!this._isActive)return;this.virtualizer.setTotalRows(t.length);const e=Math.max(0,t.length*this.virtualizer.rowHeight-this.virtualizer.containerHeight);if(this.virtualizer.scrollTop>e){this.virtualizer.setScrollTop(e);const{verticalScrollContainer:t}=this.domRefs;t&&(t.scrollTop=e)}const n=this.virtualizer.getVisibleRange();this.lastVisibleRange=n,this.applyUpdate(n)}expandAllForExport(){if(!this._isActive)return null;const t=this.cachedVisibleTasks,{rowHeight:e}=this.options,n={startIndex:0,endIndex:t.length-1},i=this.domRefs.tasksDataContainer;if(i){this.patchTasksPanel(t,n,e);const r=i.querySelector(Xn),s=i.querySelector(Zn);r&&(r.style.height="0px"),s&&(s.style.height="0px")}const r=this.domRefs.timelineBody;if(r){this.patchTimelinePanel(t,n,e);const i=r.querySelector(Xn),s=r.querySelector(Zn);i&&(i.style.height="0px"),s&&(s.style.height="0px")}this.patchBars(t,n,e);const s=this.lastVisibleRange;return s?{startIndex:s.startIndex,endIndex:s.endIndex}:null}restoreAfterExport(t){if(!this._isActive)return;const e=t??this.virtualizer.getVisibleRange();this.applyUpdate(e)}handleResize(){if(!this._isActive)return;const{verticalScrollContainer:t}=this.domRefs;t&&this.virtualizer.setContainerHeight(t.clientHeight);const e=this.virtualizer.getVisibleRange();this.lastVisibleRange&&e.startIndex===this.lastVisibleRange.startIndex&&e.endIndex===this.lastVisibleRange.endIndex||(this.lastVisibleRange=e,this.applyUpdate(e))}updateDomRefs(t){this.domRefs=t}scheduleUpdate(t){this.virtualizer.setScrollTop(t),this.cachedVisibleTasks.length<=50||(null!==this.virtualScrollRAF&&"undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame(this.virtualScrollRAF),"undefined"!=typeof requestAnimationFrame?this.virtualScrollRAF=requestAnimationFrame((()=>{this.virtualScrollRAF=null,this.applyIfChanged()})):this.applyIfChanged())}applyIfChanged(){const t=this.virtualizer.getVisibleRange();this.lastVisibleRange&&t.startIndex===this.lastVisibleRange.startIndex&&t.endIndex===this.lastVisibleRange.endIndex||(this.lastVisibleRange=t,this.applyUpdate(t))}applyUpdate(t){const e=this.cachedVisibleTasks,{rowHeight:n}=this.options;0!==e.length&&(this.patchTasksPanel(e,t,n),this.patchTimelinePanel(e,t,n),this.patchBars(e,t,n),this.onAfterUpdate())}patchTasksPanel(t,e,n){const i=this.domRefs.tasksDataContainer;if(!i)return;const{startIndex:r,endIndex:s}=e,o=t.slice(r,s+1),a=new Set(o.map((t=>t.id))),l=Array.from(i.querySelectorAll(`${en.tasksDataRow}:not(${en.tasksEmptyRow})`)),d=new Map;l.forEach((t=>{const e=t.getAttribute(Qn);e&&d.set(e,t)}));const h=new ee(this.options,this.chartContext,this.dataManager);o.forEach(((t,e)=>{if(!d.has(t.id)){const n=r+e,s=h.generateRow(t,this.onToggle,n+1);i.appendChild(s)}})),d.forEach(((t,e)=>{a.has(e)||i.removeChild(t)})),this.updateSpacers(i,r,s,t.length,n);const c=Array.from(i.querySelectorAll(`${en.tasksDataRow}:not(${en.tasksEmptyRow})`)),u=new Map;o.forEach(((t,e)=>u.set(t.id,e))),c.sort(((t,e)=>{const n=t.getAttribute(Qn)||"",i=e.getAttribute(Qn)||"";return(u.get(n)??0)-(u.get(i)??0)}));const p=i.querySelector(Zn)||null;c.forEach((t=>{i.insertBefore(t,p)})),c.forEach(((t,e)=>{t.setAttribute("aria-rowindex",(r+e+1).toString())})),this.renderedTaskIds=a}patchTimelinePanel(t,e,n){const i=this.domRefs.timelineBody;if(!i)return;const{startIndex:r,endIndex:s}=e,o=t.slice(r,s+1),a=new Set(o.map((t=>t.id))),l=Array.from(i.querySelectorAll(`${en.timelineDataRow}:not(${en.timelineEmptyRow})`)),d=new Map;l.forEach((t=>{const e=t.getAttribute(Qn);e&&d.set(e,t)}));const h=this.readSubHeaderCells();if(0===h.length)return;const c=new Se(this.getPixelsPerMs(),this.options,this.chartContext,this.dataManager,this.getIsRtl());o.forEach((t=>{if(!d.has(t.id)){const e=c.generateRow(t.id,h);i.appendChild(e)}})),d.forEach(((t,e)=>{a.has(e)||i.removeChild(t)})),this.updateSpacers(i,r,s,t.length,n);const u=new Map;o.forEach(((t,e)=>u.set(t.id,e)));const p=Array.from(i.querySelectorAll(`${en.timelineDataRow}:not(${en.timelineEmptyRow})`));p.sort(((t,e)=>{const n=t.getAttribute(Qn)||"",i=e.getAttribute(Qn)||"";return(u.get(n)??0)-(u.get(i)??0)}));const m=i.querySelector(Zn)||null;p.forEach((t=>{i.insertBefore(t,m)}))}patchBars(t,e,n){const i=this.domRefs.barContainer;if(!i)return;const{startIndex:r,endIndex:s}=e,o=this.getPixelsPerMs(),a=this.dataManager.getDateRange(8,o),{geometry:l}=ve(a[0],a[1],o,this.options.inputDateFormat,void 0,this.getIsRtl()),d=t.length*n,h=t.slice(r,s+1),c=new Set(h.map((t=>t.id))),u=Array.from(i.querySelectorAll(`[${Qn}]`)),p=new Map;u.forEach((t=>{const e=t.getAttribute(Qn);e&&p.set(e,t)}));const m=this.chartContext.getChartContainer();h.forEach(((t,e)=>{if(!p.has(t.id)){const n=r+e,s=new Tt(t,l,this.options,n,this.chartContext,this.dataManager),o=this.commitTaskUpdate?this.commitTaskUpdate:(t,e)=>{jt(this.chartContext,this.dataManager,t,e,this.options,l)},a=s.drawBar(o,this.onToggle);i.appendChild(a),m&&ke(a,0,m);const d=s.drawBaselineBar();d&&i.appendChild(d)}})),p.forEach(((t,e)=>{c.has(e)||i.removeChild(t)})),i.style.height=`${d}px`,i.style.width="100%"}updateSpacers(t,e,n,i,r){let s=t.querySelector(Xn);s||(s=this.chartContext.createElement("div"),s.className=Gn,t.insertBefore(s,t.firstChild)),s.style.height=e*r+"px";let o=t.querySelector(Zn);o||(o=this.chartContext.createElement("div"),o.className=Kn,t.appendChild(o));const a=Math.max(0,(i-1-n)*r);o.style.height=`${a}px`}getTimelineCellCount(){return this.readSubHeaderCells().length}readSubHeaderCells(){var t;const e=null==(t=this.domRefs.timelineBodyWrapper)?void 0:t.closest(".timeline-container");if(!e)return[];const n=e.querySelectorAll(".timeline-header-row"),i=n[n.length-1];if(!i)return[];const r=[];return i.querySelectorAll(".timeline-header-cell").forEach((t=>{const e=t.getBoundingClientRect();r.push({data:"",width:e.width})})),r}}class ti{constructor(t,e,n){if(0===e.length)throw new Error("Transaction must contain at least one command");this.label=t,this.commands=e,this.mergeKey=n}execute(t){for(const e of this.commands)e.execute(t)}undo(t){for(let e=this.commands.length-1;e>=0;e--)this.commands[e].undo(t)}}class ei{constructor(t={}){this.undoStack=[],this.redoStack=[],this.maxSize=Math.max(1,t.maxSize??100),this.enabled=t.enabled??!0}record(t){if(!this.enabled)return;const e=this.undoStack[this.undoStack.length-1];e&&t.mergeKey&&e.mergeKey===t.mergeKey?this.undoStack[this.undoStack.length-1]=new ti(e.label,[...e.commands,...t.commands],e.mergeKey):(this.undoStack.push(t),this.undoStack.length>this.maxSize&&this.undoStack.shift()),this.redoStack=[]}undo(t){if(!this.canUndo())return null;const e=this.undoStack.pop();return e.undo(t),this.redoStack.push(e),e}redo(t){if(!this.canRedo())return null;const e=this.redoStack.pop();return e.execute(t),this.undoStack.push(e),e}canUndo(){return this.enabled&&this.undoStack.length>0}canRedo(){return this.enabled&&this.redoStack.length>0}peekUndo(){return this.undoStack[this.undoStack.length-1]??null}peekRedo(){return this.redoStack[this.redoStack.length-1]??null}size(){return{undo:this.undoStack.length,redo:this.redoStack.length}}clear(){this.undoStack=[],this.redoStack=[]}setEnabled(t){this.enabled=t,t||this.clear()}isEnabled(){return this.enabled}}class ni{constructor(t,e,n,i={}){const r=n.getTask(t);if(!r)throw new Error(`UpdateTaskCommand: task "${t}" not found`);this.taskId=t,this.afterState={...e},this.beforeState=function(t,e){const n={};for(const i of Object.keys(e))n[i]=t[i];return n}(r,e),this.label=i.label??`Update task ${t}`,this.mergeKey=i.mergeKey}execute(t){t.applyTaskUpdate(this.taskId,this.afterState)}undo(t){t.applyTaskUpdate(this.taskId,this.beforeState)}}class ii{constructor(t,e,n){if(!t.id)throw new Error("AddTaskCommand: input.id is required for reversible add");this.input={...t},this.options=e,this.label=n??`Add task ${t.id}`}execute(t){t.applyAddTask(this.input,this.options)}undo(t){t.applyRemoveTask(this.input.id)}}class ri{constructor(t,e,n){const i=e.getTask(t);if(!i)throw new Error(`RemoveTaskCommand: task "${t}" not found`);this.taskId=t,this.snapshot=function(t){return{...t}}(i),this.parentIdAtRemoval=i.parentId,this.label=n??`Delete task ${t}`}execute(t){t.applyRemoveTask(this.taskId)}undo(t){t.applyAddTask(this.snapshot,{parentId:this.parentIdAtRemoval})}}class si{constructor(t,e,n,i){const r=n.getTask(t);if(!r)throw new Error(`MoveTaskCommand: task "${t}" not found`);this.taskId=t,this.newParentId=e,this.oldParentId=r.parentId,this.label=i??`Move task ${t}`}execute(t){t.applyTaskMove(this.taskId,this.newParentId)}undo(t){t.applyTaskMove(this.taskId,this.oldParentId)}}class oi{constructor(t,e,n="FS",i=0,r){this.fromId=t,this.toId=e,this.type=n,this.lag=i,this.label=r??`Add dependency ${t}→${e}`}execute(t){t.applyAddDependency(this.fromId,this.toId,this.type,this.lag)}undo(t){t.applyRemoveDependency(this.fromId,this.toId)}}class ai{constructor(t,e,n,i){const r=n.getDependency(t,e);if(!r)throw new Error(`RemoveDependencyCommand: no dependency ${t}→${e}`);this.fromId=t,this.toId=e,this.type=r.type,this.lag=r.lag,this.label=i??`Remove dependency ${t}→${e}`}execute(t){t.applyRemoveDependency(this.fromId,this.toId)}undo(t){t.applyAddDependency(this.fromId,this.toId,this.type,this.lag)}}w.extend(M),w.extend(C),w.extend(B),w.extend(D),w.extend($);const li="dependencyArrowUpdate",di="gantt-action-button--disabled";class hi extends n{constructor(t,e){var n,i;super(t,"gantt_"+crypto.randomUUID().replace(/-/g,"").substring(0,9)),this.options=ft,this.pixelsPerMs=0,this.currentGeometry=null,this._preservedPixelsPerMs=null,this.needsAutoFitZoom=!1,this.sortCriteria=[],this.activeFilter=null,this.quickFilterQuery="",this.quickFilterCaret=0,this.filterRuleSet=null,this.filterBuilderOpen=!1,this.filterBuilderDraft=null,this.groupCriterion=null,this.columnWidthOverrides=new Map,this.columnOrder=null,this.persistTimer=null,this.persistChangeHandler=null,this.stateRestoreAttempted=!1,this.isApplyingState=!1,this.commandContext={applyTaskUpdate:(t,e)=>{var n,i;const r=this.currentGeometry??this.buildFreshGeometry(),s=this.buildColumnRefreshContext();jt(this.chartContext,this.dataManager,t,e,this.options,r,s),Vt(this.chartContext,this.dataManager,t,this.options,r,s);const o=((null==(i=null==(n=this.dataManager.getTaskById(t))?void 0:n.segments)?void 0:i.length)??0)>1;("segments"in e||o)&&this.render()},applyTaskMove:(t,e)=>{this.dataManager.updateTask(t,{parentId:e}),this.render()},applyAddTask:(t,e)=>{const n=(null==e?void 0:e.parentId)?{...t,parentId:e.parentId}:t;this.dataManager.addTask(n),this.render()},applyRemoveTask:t=>{this.dataManager.removeTask(t),this.render()},applyAddDependency:(t,e,n,i)=>{this.dataManager.addDependency(t,e,n,i),this.renderDependencyArrows()},applyRemoveDependency:(t,e)=>{this.dataManager.removeDependency(t,e),this.renderDependencyArrows()},getTask:t=>this.dataManager.getTaskById(t)??null,getDependency:(t,e)=>{const n=this.dataManager.getAllDependencies().find((n=>n.fromId===t&&n.toId===e));return n?{type:n.type,lag:n.lag}:null}},this.commitTaskUpdate=(t,e,n)=>{if(!this.dataManager.getTaskById(t))return;const i=new ni(t,e,this.commandContext,{label:null==n?void 0:n.label,mergeKey:null==n?void 0:n.mergeKey});i.execute(this.commandContext),this.recordSingle(i)},this.containerResizeObserver=null,this.lastKnownWidth=0,this.lastKnownHeight=0,this.resizeDebounceTimer=null,this.dependencyArrowHandler=null,this.rowHoverHandler=null,this.rowHoverLeaveHandler=null,this._afterActionsRafId=null,this._destroyed=!1,this.criticalPathResult=null,this.domCache={ganttContainer:null,timelineContainer:null,timelineBody:null,timelineBodyWrapper:null,timelineHeader:null,horizontalScroll:null,horizontalScrollContent:null,tasksContainer:null,tasksBodyWrapper:null,tasksHeader:null,tasksDataContainer:null,splitBar:null,actionsContainer:null},this.keyboardNavigationManager=null,this.contextMenuManager=null,this.contextMenuHandler=null,this.undoRedoKeyHandler=null,this.selectionManager=null,this.dependencyEditManager=null,this.dependencyDrawManager=null,this.drawTaskManager=null,this.scrollButtonsManager=null,this.virtualScrollCoordinator=null,this.columnRenderManager=new H,this.reducedMotionMQL=null,this.reducedMotionHandler=null;const r=gt(null==e?void 0:e.theme);let s;(null==e?void 0:e.parsing)?sn.validateConfig(e.parsing)?s=sn.parse(e.series,e.parsing):(R.error("ApexGantt: Invalid parsing configuration provided"),s=[]):s=(null==e?void 0:e.series)||[];const o={...r.dependencies,...null==e?void 0:e.dependencies};o.editable&&(o.hitWidth??0)<12&&(o.hitWidth=12),this.options={...r,...e,baseline:{...r.baseline,...null==e?void 0:e.baseline},barLabel:{...r.barLabel,...null==e?void 0:e.barLabel},dependencies:o,history:{...r.history,...null==e?void 0:e.history},locale:{...r.locale,...null==e?void 0:e.locale},series:s},j(null==(n=this.options.locale)?void 0:n.dateLocale),this.history=new ei({enabled:this.options.history.enabled,maxSize:this.options.history.maxSize}),this.options.enableTaskEdit&&void 0===(null==e?void 0:e.enableInlineEdit)&&(this.options.enableInlineEdit=!0),this.options.baseline.enabled&&void 0===(null==e?void 0:e.rowHeight)&&(this.options.rowHeight=r.rowHeight+12),this.pixelsPerMs=this.computeInitialPixelsPerMs(this.options),this.needsAutoFitZoom=null==(null==e?void 0:e.pixelsPerDay);const a="arrows_"+crypto.randomUUID().replace(/-/g,"").substring(0,9);this.arrowLink=new Ie(a),this.dataManager=new xe,this.dataManager.setInputDateFormat(this.options.inputDateFormat),this.dataManager.setCalendar(function(t={},e){const n=Array.isArray(t.workingWeekdays),i=Array.isArray(t.holidays)&&t.holidays.length>0;if(!n&&!i)return e?new G({inputDateFormat:e}):K;const r=Z(t.holidays);return new G({workingWeekdays:t.workingWeekdays??[1,2,3,4,5],holidays:r.map((t=>t.date)),inputDateFormat:e})}(this.options.calendar,this.options.inputDateFormat),Z(null==(i=this.options.calendar)?void 0:i.holidays)),this.dataManager.setTasks(this.options.series),this.dataManager.setArrowLinkInstanceId(a),this.applyInitialSortAndFilter(),this.applyInitialGrouping(),this.stateManager=new nn,this.styleManager=new En(this.element,this.domCache,this.options,this.chartContext,this.isShadowDOM(),this.getInstanceId()),this.scrollManager=new dn(this.element,this.options,this.domCache,this.chartContext,this.getInstanceId()),this.layoutManager=new fn(this.element,this.options,this.domCache,this.chartContext,this.getInstanceId());const l={onZoomChange:t=>{this.pixelsPerMs=t,this.needsAutoFitZoom=!1,this.currentGeometry=null,this.schedulePersist()},onToolbarUpdate:()=>{const t=this.domCache.actionsContainer;t&&this.renderToolbar(t)},onTimelineRerender:()=>{this.rerenderTimeline()},onDependencyArrowsRender:()=>{this.renderDependencyArrows(),this.fadeArrowsAfterAnimation(),this.computeCriticalPath(),this.applyCriticalPathHighlighting()},onScrollbarUpdate:()=>{this.scrollManager.updateHorizontalScrollbarContent()},onScrollbarPosition:()=>{this.scrollManager.positionHorizontalScrollbar()}};this.zoomManager=new un(this.element,this.domCache,this.chartContext,this.getInstanceId(),(()=>this.pixelsPerMs),l),this.crosshairManager=new on(this.options,this.domCache,this.chartContext),this.styleManager.setupShadowDOMEnvironment(),this.options.enableSelection&&(this.selectionManager=new $n(this.chartContext,this.dataManager,(()=>this.element))),this.options.dependencies.editable&&(this.dependencyEditManager=new Pn(this.chartContext,((t,e)=>{this.dataManager.getAllDependencies().some((n=>n.fromId===t&&n.toId===e))&&this.removeDependency(t,e)})),this.dependencyDrawManager=new Yn(this.chartContext,(()=>this.options.rowHeight),(()=>this.options.dependencies.cornerRadius??4),((t,e,n)=>this.canAddDependency(t,e,{type:n})),((t,e,n)=>{this.addDependency(t,e,{type:n})}))),this.options.enableDrawTask&&(this.drawTaskManager=new jn(this.chartContext,(()=>this.options.rowHeight),(()=>this.options.barMargin),((t,e,n)=>this.commitDrawnTask(t,e,n)))),this.options.enableScrollButtons&&(this.scrollButtonsManager=new Vn(this.chartContext,(t=>this.scrollToTask(t)))),this.keyboardNavigationManager=new Dn(this.chartContext,this.dataManager,(()=>this.domCache.tasksDataContainer),(()=>this.render()),this.selectionManager??void 0,this.options.enableTaskEditingShortcuts?this.buildKeyboardEditingCommands():void 0),this.options.enableContextMenu&&(this.contextMenuManager=new In(this.chartContext)),this.setupReducedMotion(),this.columnRenderManager.observe(this.element)}get messages(){return mt(this.options)}get isRtl(){var t;return function(t,e){var n;if("rtl"===t)return!0;if("ltr"===t)return!1;if("undefined"==typeof window||"undefined"==typeof document)return!1;if(e){const t=e.closest('[dir="rtl"], [dir="ltr"]');return t?"rtl"===t.getAttribute("dir"):"rtl"===window.getComputedStyle(e).direction}return"rtl"===((null==(n=document.documentElement)?void 0:n.getAttribute("dir"))??document.dir)}((null==(t=this.options.locale)?void 0:t.direction)??"ltr",this.element)}buildColumnRefreshContext(){return{columns:Rt(this.options.columnConfig),dispatcher:this.columnRenderManager,onToggleCollapse:()=>this.render()}}computeAutoColumnWidths(t,e,n,i){if(this.options.autoSizeColumns)return function(t,e,n){const i=`${n.fontWeight} ${n.fontSize} ${n.fontFamily}`,r=`700 ${n.fontSize} ${n.fontFamily}`,s=e.length>400?e.slice(0,400):e,o=new Map;for(const e of t){const t=parseFloat(e.minWidth??"")||0,a=parseFloat(e.maxWidth??"")||320;let l=Re(e.title,r);if(e.key===It.ProgressRing)l=Math.max(l,32);else if(Pe(e))l=Math.max(l,90);else for(const t of s){if(t.isGroup)continue;let r=Re(He(t,e,n),i);e.key===It.Name&&(r+=15*(t.level??0)+22),l=Math.max(l,r)}const d=Math.min(a,Math.ceil(l)+20+10);o.set(String(e.key),Math.max(t,d))}return o}(Rt(this.options.columnConfig),t,{fontFamily:e,fontSize:n,fontWeight:i,inputDateFormat:this.options.inputDateFormat,calendar:this.dataManager.getCalendar(),snap:{unit:this.options.snapUnit,value:this.options.snapValue}})}effectivePanelWidth(t,e){if(!t)return e;let n=0;for(const e of t.values())n+=e;const i=this.options.enableSelection&&this.options.showCheckboxColumn?28:0;return Math.max(e,Math.ceil(n+i+2))}getPaddedDateRange(t=0){const e=P(this.options.barLabel);return this.dataManager.getDateRange(t,this.pixelsPerMs,e)}buildFreshGeometry(){const t=this.getPaddedDateRange(0);return ve(t[0],t[1],this.pixelsPerMs,this.options.inputDateFormat,void 0,this.isRtl).geometry}recordSingle(t,e,n){!function(t,e,n,i){const r=new ti(n??e.label,[e],i??e.mergeKey);t.record(r)}(this.history,t,e??t.label,n??t.mergeKey),this.dispatchHistoryChange("record")}recordTransaction(t){this.history.record(t),this.dispatchHistoryChange("record")}computeInitialPixelsPerMs(t){return"number"==typeof t.pixelsPerDay&&t.pixelsPerDay>0?t.pixelsPerDay/tt:oe}computeAutoFitPixelsPerMs(){if(!this.element)return null;const t=this.element.clientWidth;if(t<=0)return null;const e=P(this.options.barLabel),n=t-this.options.tasksContainerWidth-16-e;if(n<=0)return null;const i=this.dataManager.getFlatTasks();if(0===i.length)return null;let r=1/0,s=-1/0;const o=this.options.inputDateFormat;for(const t of i){if(t.startTime){const e=U(t.startTime,o).valueOf();Number.isFinite(e)&&e<r&&(r=e)}if(t.endTime){const e=U(t.endTime,o).valueOf();Number.isFinite(e)&&e>s&&(s=e)}}if(!Number.isFinite(r)||!Number.isFinite(s)||s<=r)return null;const a=.25/tt,l=1280/tt,d=n/(1.1*(s-r));return Math.max(a,Math.min(l,d))}static setLicense(t){f.setLicense(t)}setupReducedMotion(){if("undefined"==typeof window||!window.matchMedia)return;this.reducedMotionMQL=window.matchMedia("(prefers-reduced-motion: reduce)");const t=t=>{t?this.element.classList.add("gantt-reduced-motion"):this.element.classList.remove("gantt-reduced-motion")};t(this.reducedMotionMQL.matches),this.reducedMotionHandler=e=>t(e.matches),this.reducedMotionMQL.addEventListener("change",this.reducedMotionHandler)}initializeTooltip(){const{enableTooltip:t,tooltipId:e}=this.options;if(t){const t=o(this.chartContext,e);t.classList.add("apexgantt-tooltip");if(!this.chartContext.getElementById(e)){R.warn("Tooltip init: Tooltip not found after creation, appending manually");this.chartContext.getAppendContainer().appendChild(t)}}}render(t){var e,n,i,r,s;if(!this.element)throw new Error("Element not found");if(this.maybeRestorePersistedStateOnce())return this.element;this.virtualScrollCoordinator&&this.virtualScrollCoordinator.detach();const o=this.element&&this.element.children.length>0;o&&this.stateManager.captureState(this.element,this.dataManager,this.pixelsPerMs,null==(e=this.selectionManager)?void 0:e.captureState()),this.applyAutoFitZoomIfNeeded();const{enableResize:a,tasksContainerWidth:d,height:h,width:c}=this.options,u=Be(this.element),p=u.fontColor||this.options.fontColor,m=u.fontFamily||this.options.fontFamily,g=u.fontSize||this.options.fontSize,{fontWeight:f}=this.options;this.layoutManager.setupChartContainerPositioning(),this.styleManager.injectGanttStyles(),this.styleManager.setCSSVariables(),this.initializeTooltip();const b=new Set(Array.from(this.element.querySelectorAll(".bar-timeline[data-taskid]")).map((t=>t.getAttribute("data-taskid"))));this.columnRenderManager.flushCleanups(),this.element.innerHTML="";const v=this.normalizeDimension(h),y=this.normalizeDimension(c);var x,w;this.element.style.width=y,this.element.style.height=v,this.element.style.display="flex",this.element.style.flexDirection="column",this.element.style.boxSizing="border-box",this.element.style.overflow="hidden",x=this.element,w=(null==(n=this.options.locale)?void 0:n.direction)??"ltr",x&&("ltr"===w?x.removeAttribute("dir"):x.setAttribute("dir",w)),this.element.style.setProperty("color",p),this.element.style.setProperty("font-family",m),this.element.style.setProperty("font-size",g),this.element.style.setProperty("font-weight",f);const k=l(this.chartContext,{className:en.actionsContainer.slice(1)});this.renderToolbar(k);const C=l(this.chartContext,{className:en.ganttContainer.slice(1)}),S=this.dataManager.getFlatVisibleTasks(),M=this.computeAutoColumnWidths(S,m,g,f),E=this.effectivePanelWidth(M,d);this.initVirtualScrollCoordinator();const T=null==(i=this.virtualScrollCoordinator)?void 0:i.initialise(S,o?this.stateManager.getCapturedVerticalScroll():0);{const t=P(this.options.barLabel),e=this.dataManager.getDateRange(8,this.pixelsPerMs,t);this.currentGeometry=ve(e[0],e[1],this.pixelsPerMs,this.options.inputDateFormat,void 0,this.isRtl).geometry}const A=new Se(this.pixelsPerMs,this.options,this.chartContext,this.dataManager,this.isRtl).render(T,b,this.render.bind(this),this.commitTaskUpdate),D=this.options.enableAddTaskRow&&!T,I=new ee(this.options,this.chartContext,this.dataManager,this.selectionManager??void 0,this.options.enableInlineEdit?(t,e)=>this.commitInlineEdit(t,e):void 0,this.columnRenderManager,D?()=>this.addPlaceholderTask({}):void 0,((t,e)=>this.toggleSort(t,e)),(()=>this.getSort()),M,this.columnWidthOverrides,((t,e)=>this.handleColumnResize(t,e)),this.columnOrder??void 0,((t,e)=>this.handleColumnReorder(t,e)),(t=>this.scrollToTask(t))).render(this.render.bind(this),T);A&&this.layoutManager.createLayout(C,I,A,a,E),this.element.appendChild(k),this.element.appendChild(C);const $=this.element.querySelector(en.horizontalScroll);$&&($.remove(),this.element.appendChild($)),this.cacheDomElements(),this.styleManager.handleWatermark(),this.setupRowBackgroundColors(),this.zoomManager.setupZoomEventListener(),this.attachCrosshair(),this.setupDependencyArrowEvents(),this.renderDependencyArrows(),null==(r=this.dependencyDrawManager)||r.attach(this.element,this.domCache.timelineBody,this.domCache.timelineBodyWrapper),null==(s=this.drawTaskManager)||s.attach(this.element,this.domCache.timelineBody);const F=this.computeChangedVisibleIds(b,S);return this.fadeArrowsAfterAnimation(!1,F),this.computeCriticalPath(),this.applyCriticalPathHighlighting(),this._afterActionsRafId=requestAnimationFrame((()=>{this._afterActionsRafId=null,this.performAfterActions()})),o&&requestAnimationFrame((()=>{this.isDestroyed()||this.stateManager.restoreState(this.element)})),this.schedulePersist(),this.element}cacheDomElements(){var t;this.domCache.ganttContainer=this.element.querySelector(en.ganttContainer),this.domCache.timelineContainer=this.element.querySelector(en.timelineContainer),this.domCache.timelineBody=this.element.querySelector(en.timelineBody),this.domCache.timelineBodyWrapper=this.element.querySelector(en.timelineBodyWrapper),this.domCache.timelineHeader=this.element.querySelector(en.timelineHeader),this.domCache.horizontalScroll=this.element.querySelector(en.horizontalScroll),this.domCache.horizontalScrollContent=(null==(t=this.domCache.horizontalScroll)?void 0:t.querySelector(en.horizontalScrollContent))||null,this.domCache.tasksContainer=this.element.querySelector(en.tasksContainer),this.domCache.tasksBodyWrapper=this.element.querySelector(en.tasksBodyWrapper),this.domCache.tasksHeader=this.element.querySelector(en.tasksHeader),this.domCache.tasksDataContainer=this.element.querySelector(en.tasksDataContainer),this.domCache.splitBar=this.element.querySelector(en.splitBar),this.domCache.actionsContainer=this.element.querySelector(en.actionsContainer)}clearDomCache(){this.domCache.ganttContainer=null,this.domCache.timelineContainer=null,this.domCache.timelineBody=null,this.domCache.timelineBodyWrapper=null,this.domCache.timelineHeader=null,this.domCache.horizontalScroll=null,this.domCache.horizontalScrollContent=null,this.domCache.tasksContainer=null,this.domCache.tasksBodyWrapper=null,this.domCache.tasksHeader=null,this.domCache.tasksDataContainer=null,this.domCache.splitBar=null,this.domCache.actionsContainer=null}performAfterActions(){var t,e,n,i;if(!this.isDestroyed()){if(this.cacheDomElements(),this.layoutManager.syncTasksColumnWidths(),this.scrollManager.compensateForScrollbar(),this.scrollManager.updateHorizontalScrollbarContent(),this.scrollManager.setupTimelineHorizontalScroll(),this.scrollManager.positionHorizontalScrollbar(),this.scrollManager.setInitialHorizontalScroll(this.isRtl),this.setupContainerResizeObserver(),this.scrollManager.setupScrollbarResizeObserver(),this.setupRowBackgroundColors(),this.setupRowHoverSync(),this.scrollManager.disableHeaderMousewheelScroll(),null==(t=this.scrollButtonsManager)||t.attach(this.domCache.timelineBodyWrapper),(null==(e=this.virtualScrollCoordinator)?void 0:e.isActive)||this.layoutManager.fillEmptyRowsAfterRender(),this.virtualScrollCoordinator){const t=this.element.querySelector(en.splitViewContainer)??this.domCache.ganttContainer;this.virtualScrollCoordinator.updateDomRefs({tasksDataContainer:this.domCache.tasksDataContainer,timelineBody:this.domCache.timelineBody,barContainer:this.element.querySelector(en.barContainer),tasksBodyWrapper:this.domCache.tasksBodyWrapper,timelineBodyWrapper:this.domCache.timelineBodyWrapper,verticalScrollContainer:t}),this.virtualScrollCoordinator.attach()}null==(n=this.keyboardNavigationManager)||n.attach(),this.attachContextMenuHandler(),this.attachUndoRedoShortcuts(),null==(i=this.selectionManager)||i.restoreAfterRender()}}initVirtualScrollCoordinator(){this.virtualScrollCoordinator&&this.virtualScrollCoordinator.destroy(),this.virtualScrollCoordinator=new Jn({tasksDataContainer:null,timelineBody:null,barContainer:null,tasksBodyWrapper:null,timelineBodyWrapper:null,verticalScrollContainer:null},this.options,this.chartContext,this.dataManager,(()=>this.pixelsPerMs),(()=>this.isRtl),(()=>{var t;this.setupRowBackgroundColors(),this.renderDependencyArrows(),this.fadeArrowsAfterAnimation(),this.applyCriticalPathHighlighting(),null==(t=this.scrollButtonsManager)||t.attach(this.domCache.timelineBodyWrapper)}),(()=>this.render()),this.commitTaskUpdate)}setupRowHoverSync(){const t=this.domCache.ganttContainer;if(!t)return;this.rowHoverHandler&&(t.removeEventListener("mousemove",this.rowHoverHandler),this.rowHoverHandler=null),this.rowHoverLeaveHandler&&(t.removeEventListener("mouseleave",this.rowHoverLeaveHandler),this.rowHoverLeaveHandler=null);const e=this.chartContext.getInstanceId(),n=`${en.tasksDataRow}[data-chart-instance="${e}"]`,i=`${en.timelineDataRow}[data-chart-instance="${e}"]`,r=getComputedStyle(this.element).getPropertyValue("--row-hover-color").trim()||"rgba(0,0,0,0.06)",s=(t,e)=>{const s=this.element.querySelector(`${n}[data-taskid="${t}"]`),o=this.element.querySelector(`${i}[data-taskid="${t}"]`);for(const t of[s,o])t&&(e?(t.dataset.origBg||(t.dataset.origBg=t.style.backgroundColor),t.style.backgroundColor=r):(t.style.backgroundColor=t.dataset.origBg??"",delete t.dataset.origBg))};let o=null;const a=t=>{const r=t.target,a=null==r?void 0:r.closest(`${n}, ${i}`),l=null==r?void 0:r.closest(`[data-taskid][data-chart-instance="${e}"]`),d=(null==a?void 0:a.dataset.taskid)??(null==l?void 0:l.dataset.taskid)??null;d!==o&&(o&&s(o,!1),o=d,o&&s(o,!0))},l=e=>{const{relatedTarget:n}=e;n&&t.contains(n)||(o&&s(o,!1),o=null)};this.rowHoverHandler=a,this.rowHoverLeaveHandler=l,t.addEventListener("mousemove",a),t.addEventListener("mouseleave",l)}setupRowBackgroundColors(){var t;const e=new Map,n=Be(this.element),i=[...this.options.rowBackgroundColors];n.rowBgEven&&(i[0]=n.rowBgEven),n.rowBgOdd&&(i[1]=n.rowBgOdd);const r=(null==(t=this.virtualScrollCoordinator)?void 0:t.isActive)?this.virtualScrollCoordinator.getRenderedTaskIds():null;this.dataManager.getTopParentTasks().forEach(((t,n)=>{const s=t.rowBackgroundColor||Yt(n,i);e.set(t.id,s),r&&!r.has(t.id)||Ut(this.chartContext,t.id,s)}));const s=r?Array.from(r,(t=>this.dataManager.getTaskById(t))).filter((t=>null!=t)):this.dataManager.getFlatTasks();s.forEach((t=>{if(!t.parentId){if(t.type===Jt.Milestone&&!e.has(t.id)){const e=t.rowBackgroundColor||Yt(0,i);Ut(this.chartContext,t.id,e)}return}let n=this.dataManager.getTaskById(t.parentId);for(;null==n?void 0:n.parentId;)n=this.dataManager.getTaskById(n.parentId);const r=n?n.id:t.parentId,s=t.rowBackgroundColor||(e.get(r??"")??"");Ut(this.chartContext,t.id,s)}))}fadeArrowsAfterAnimation(t=!1,e){var n;const i=`timeline-arrows-${this.arrowLink.getInstanceId()}`;!function(t,e,n=!1,i){if(!t)return;const r=we(e);if(i&&i.size>0){const e=Array.from(t.querySelectorAll("path[data-from-id]")).filter((t=>{const e=t.getAttribute("data-from-id")??"",n=t.getAttribute("data-to-id")??"";return i.has(e)||i.has(n)}));if(0===e.length)return;return n||r?void e.forEach((t=>t.style.opacity="1")):(e.forEach((t=>t.style.opacity="0")),void setTimeout((()=>{e.forEach((t=>{"function"==typeof t.animate?t.animate([{opacity:"0"},{opacity:"1"}],{duration:150,easing:"ease-out",fill:"forwards"}).finished.then((()=>{t.style.opacity="1",t.getAnimations().forEach((t=>t.cancel()))})).catch((()=>{})):t.style.opacity="1"}))}),200))}n||r?t.style.opacity="1":(t.style.opacity="0",setTimeout((()=>{"function"==typeof t.animate?t.animate([{opacity:"0"},{opacity:"1"}],{duration:150,easing:"ease-out",fill:"forwards"}).finished.then((()=>{t.style.opacity="1",t.getAnimations().forEach((t=>t.cancel()))})).catch((()=>{})):t.style.opacity="1"}),200))}((null==(n=this.domCache.timelineBody)?void 0:n.querySelector(`#${i}`))??null,this.element,t,e)}renderDependencyArrows(){var t;const{rowHeight:e,barMargin:n}=this.options,i=this.getInstanceId(),r=this.arrowLink.getInstanceId(),s=this.domCache.timelineBody;if(!s)return void R.warn(`[${i}] Timeline body not found for arrows`);const o=`timeline-arrows-${r}`,a=s.querySelector(`#${o}`);a&&a.remove();const l=this.dataManager.getAllDependencies();if(0===l.length)return;const{indexMap:d,count:h}=this.dataManager.getFlatVisibleIndex(),c=this.getPaddedDateRange(8),{geometry:u}=ve(c[0],c[1],this.pixelsPerMs,this.options.inputDateFormat,void 0,this.isRtl),p=e-2*n,m=(t,i)=>{const r=Tt.calculateX(t,u,this.options),s=Tt.calculateWidth(t,u,this.options),o=n+i*e;return{left:r,right:r+s,top:o,bottom:o+p,width:s,height:p}},g=(null==(t=this.virtualScrollCoordinator)?void 0:t.isActive)?this.virtualScrollCoordinator.getRenderedTaskIds():null;let f;if(g){const t=this.dataManager.getDependencyAdjacency(),e=new Set,n=[];g.forEach((i=>{const r=t.get(i);if(r)for(const t of r){const i=`${t.fromId}->${t.toId}`;e.has(i)||(e.add(i),n.push(t))}})),f=n}else f=l;const b=f.flatMap((t=>{const{fromId:e,toId:n,type:i,lag:r}=t,s=this.dataManager.getTaskById(e),o=this.dataManager.getTaskById(n),a=d.get(e),l=d.get(n);if(!s||!o||void 0===a||void 0===l)return[];const h=m(s,a),c=m(o,l);if(isNaN(h.left)||isNaN(c.left))return[];return[{fromId:e,toId:n,sourceRect:h,targetRect:c,dependencyType:i,lagPx:r,fromTask:s,toTask:o,lagDays:r}]}));if(0===b.length)return;const v=h*e,y=this.arrowLink.renderFromRects(s,b,{arrowColor:this.options.arrowColor,height:Math.max(v,s.clientHeight),paddingY:e/2,width:(s.scrollWidth||s.clientWidth)+40,dependencies:this.options.dependencies,tooltipId:this.options.tooltipId,tooltipBgColor:this.options.tooltipBGColor,tooltipBorderColor:this.options.tooltipBorderColor,tooltipFontColor:this.options.fontColor,tooltipFontFamily:this.options.fontFamily,tooltipFontSize:this.options.fontSize,tooltipFontWeight:this.options.fontWeight},this.chartContext);this.dependencyEditManager&&this.dependencyEditManager.attach(y,this.element)}setupDependencyArrowEvents(){const t=this.getInstanceId(),e=this.arrowLink.getInstanceId();this.dependencyArrowHandler&&this.chartContext.removeEventListener(li,this.dependencyArrowHandler),this.dependencyArrowHandler=n=>{const i=n;if(i.detail.chartInstanceId!==t)return;const r=i.detail.arrowLinkInstanceId||e,s=function(t,e,n,i,r="FS",s=38,o){const a=t.getInstanceId(),l=O(t,e),d=O(t,n);if(!l||!d)return R.warn(`[${a}] Arrow source or target not found: ${e} -> ${n}`),!1;const h=t.querySelector(`.timeline-body[data-chart-instance="${a}"]`),c=`timeline-arrows-${i}`,u=null==h?void 0:h.querySelector(`#${c}`);if(!u)return R.warn(`[${a}] Arrow SVG not found: ${c}`),!1;const p=Ie.updateArrow(l,d,u,{paddingX:20,paddingY:s/2,dependencies:o},e,n,r);return p||R.warn(`[${a}] Arrow path not found in SVG for ${e} -> ${n} — caller should re-render`),p}(this.chartContext,i.detail.fromId,i.detail.toId,r,i.detail.type,this.options.rowHeight,this.options.dependencies);s||(this.renderDependencyArrows(),this.fadeArrowsAfterAnimation(!0))},this.chartContext.addEventListener(li,this.dependencyArrowHandler);const n=()=>{this.computeCriticalPath(),this.chartContext.querySelectorAll(".bar-critical").forEach((t=>t.classList.remove("bar-critical"))),this.chartContext.querySelectorAll(".critical-arrow").forEach((t=>t.classList.remove("critical-arrow"))),this.applyCriticalPathHighlighting()},i=this.chartContext.getChartContainer();i&&(i.removeEventListener(it.TASK_DRAGGED,n),i.removeEventListener(it.TASK_RESIZED,n),i.addEventListener(it.TASK_DRAGGED,n),i.addEventListener(it.TASK_RESIZED,n))}computeCriticalPath(){this.options.enableCriticalPath&&(this.criticalPathResult=function(t,e,n=K){if(0===t.length||0===e.length)return $e;const i=e.filter((t=>"FS"===t.type));if(0===i.length)return $e;const r=new Map;for(const e of t)r.set(e.id,e);const s=new Map,o=new Map,a=new Map;for(const e of t)a.set(e.id,0),s.set(e.id,[]),o.set(e.id,[]);for(const t of i)r.has(t.fromId)&&r.has(t.toId)&&(s.get(t.fromId).push(t),o.get(t.toId).push(t),a.set(t.toId,(a.get(t.toId)??0)+1));const l=[];for(const[t,e]of a)0===e&&l.push(t);const d=[];for(;l.length>0;){const t=l.shift();d.push(t);for(const e of s.get(t)??[]){const t=(a.get(e.toId)??0)-1;a.set(e.toId,t),0===t&&l.push(e.toId)}}if(d.length!==t.length)return $e;const h=new Map,c=new Map;for(const t of d){const e=r.get(t);if(!e)continue;const i=Fe(e.startTime,e.endTime??e.startTime,n);let s=0;for(const e of o.get(t)??[]){const t=c.get(e.fromId)??0;s=Math.max(s,t+e.lag+1)}h.set(t,s),c.set(t,s+i-1)}let u=0;for(const t of c.values())t>u&&(u=t);const p=new Map,m=new Map;for(const t of[...d].reverse()){const e=r.get(t);if(!e)continue;const i=Fe(e.startTime,e.endTime??e.startTime,n),o=s.get(t)??[];let a=u;for(const t of o){const e=m.get(t.toId)??u;a=Math.min(a,e-t.lag-1)}p.set(t,a),m.set(t,a-i+1)}const g=new Set;for(const t of d)0==(m.get(t)??0)-(h.get(t)??0)&&g.add(t);const f=new Set;for(const t of i)if(g.has(t.fromId)&&g.has(t.toId)){const e=c.get(t.fromId)??0,n=h.get(t.toId)??0;e+t.lag+1===n&&f.add(`${t.fromId}->${t.toId}`)}return{criticalTaskIds:g,criticalEdgeKeys:f}}(this.dataManager.getTasks(),this.dataManager.getAllDependencies(),this.dataManager.getCalendar()))}applyCriticalPathHighlighting(){var t,e;if(!this.options.enableCriticalPath||!this.criticalPathResult)return;for(const e of this.criticalPathResult.criticalTaskIds)null==(t=O(this.chartContext,e))||t.classList.add("bar-critical");const n=this.domCache.timelineBody;for(const t of this.criticalPathResult.criticalEdgeKeys){const[i,r]=t.split("->");null==(e=null==n?void 0:n.querySelector(`[data-from-id="${i}"][data-to-id="${r}"]:not([data-arrow-hit])`))||e.classList.add("critical-arrow")}}rerenderTimeline(){var t,e,n;const i=this.domCache.timelineContainer;if(!i)return;const r=new Map;this.element.querySelectorAll(".bar-timeline[data-taskid]").forEach((t=>{const e=t.getAttribute("data-taskid");r.set(e,{left:parseFloat(t.style.left)||0,width:parseFloat(t.style.width)||0})}));const s=this.dataManager.getFlatVisibleTasks(),o=this.element.querySelector(en.splitViewContainer)??this.domCache.ganttContainer,a=null==(t=this.virtualScrollCoordinator)?void 0:t.initialise(s,(null==o?void 0:o.scrollTop)??0),d=new Set(s.map((t=>t.id))),h=this.domCache.timelineHeader,c=this.domCache.timelineBodyWrapper;if(h&&c){h.innerHTML="",c.innerHTML="";const t=new Se(this.pixelsPerMs,this.options,this.chartContext,this.dataManager,this.isRtl).render(a,d,this.render.bind(this),this.commitTaskUpdate);if(t){const e=t[0];h.innerHTML=e.innerHTML;for(let e=1;e<t.length-1;e++)c.appendChild(t[e])}}else{i.innerHTML="";const t=new Se(this.pixelsPerMs,this.options,this.chartContext,this.dataManager,this.isRtl).render(a,d,this.render.bind(this),this.commitTaskUpdate);if(t){const e=t[0];i.appendChild(e);const n=l(this.chartContext,{className:en.timelineBodyWrapper.slice(1)});for(let e=1;e<t.length-1;e++)n.appendChild(t[e]);i.appendChild(n)}}this.cacheDomElements(),this.attachCrosshair(),null==(e=this.dependencyDrawManager)||e.attach(this.element,this.domCache.timelineBody,this.domCache.timelineBodyWrapper),null==(n=this.drawTaskManager)||n.attach(this.element,this.domCache.timelineBody),this.cancelPendingAfterActionsRaf(),this._afterActionsRafId=requestAnimationFrame((()=>{if(this._afterActionsRafId=null,r.size>0){const t=this.element;this.element.querySelectorAll(".bar-timeline[data-taskid]").forEach((e=>{const n=e.getAttribute("data-taskid"),i=r.get(n);i&&function(t,e,n,i){if(we(i))return;if("function"!=typeof t.animate)return;if(e.left===n.left&&e.width===n.width)return;const r=t.animate([{left:`${e.left}px`,width:`${e.width}px`},{left:`${n.left}px`,width:`${n.width}px`}],{duration:200,easing:"ease-in-out",fill:"forwards"});r.finished.then((()=>r.cancel())).catch((()=>{}))}(e,i,{left:parseFloat(e.style.left)||0,width:parseFloat(e.style.width)||0},t)}))}this.performAfterActions()}))}attachCrosshair(){if(!this.options.enableCrosshair)return void this.crosshairManager.detach();const t=this.getPaddedDateRange(8),{geometry:e,tiers:n}=ve(t[0],t[1],this.pixelsPerMs,this.options.inputDateFormat,void 0,this.isRtl);this.crosshairManager.updateOptions(this.options),this.crosshairManager.attach(e,n.sub.id)}cancelPendingAfterActionsRaf(){null!=this._afterActionsRafId&&(cancelAnimationFrame(this._afterActionsRafId),this._afterActionsRafId=null)}cleanupEventListeners(){var t,e;try{this.dependencyArrowHandler&&(this.chartContext.removeEventListener(li,this.dependencyArrowHandler),this.dependencyArrowHandler=null),this.rowHoverHandler&&(null==(t=this.domCache.ganttContainer)||t.removeEventListener("mousemove",this.rowHoverHandler),this.rowHoverHandler=null),this.rowHoverLeaveHandler&&(null==(e=this.domCache.ganttContainer)||e.removeEventListener("mouseleave",this.rowHoverLeaveHandler),this.rowHoverLeaveHandler=null);const n=this.domCache.timelineContainer;if(null==n?void 0:n.parentNode){const t=n.cloneNode(!0);n.parentNode.replaceChild(t,n)}}catch(t){R.warn("Error cleaning up event listeners:",t)}}cleanupTooltips(){try{const{enableTooltip:t,tooltipId:e}=this.options;if(t){const t=this.chartContext.getElementById(e);t&&(t.style.display="none",t.innerHTML="",t.removeAttribute("style"),t.classList.remove("visible"),t.setAttribute("aria-hidden","true"),this.isShadowDOM()&&t.remove())}}catch(t){R.warn("Error cleaning up tooltips:",t)}}cleanupDependencyArrows(){try{const t=this.domCache.timelineBody;if(t&&this.arrowLink){const e=this.arrowLink.getInstanceId(),n=`timeline-arrows-${e}`,i=t.querySelector(`#${n}`);i&&i.remove();t.querySelectorAll("[data-from-id]").forEach((t=>{const n=t.getAttribute("marker-end");(null==n?void 0:n.includes(`arrowhead-${e}`))&&t.remove()}))}}catch(t){R.warn("Error cleaning up dependency arrows:",t)}}createActionButton(t,e,n=!1){const i=this.chartContext.createElement("button");return i.className="gantt-action-button",i.innerHTML=t,i.title=e,i.disabled=n,i.setAttribute("aria-label",e),i}createSeparator(){const t=this.chartContext.createElement("div");return t.className="gantt-action-separator",t}renderToolbar(t){t.innerHTML="";const e=[],n=()=>{var t;return{selectedTasks:(null==(t=this.selectionManager)?void 0:t.getSelectedTasks())??[]}},i=(this.options.toolbarItems??[]).filter((t=>"left"===(t.position??"right")));i.length>0&&(i.forEach((i=>{const r=this.createToolbarItem(i,n,e);r&&t.append(r)})),t.append(this.createSeparator()));const r=this.createActionButton(Xt.zoomIn,"Zoom In",this.zoomManager.isAtMaxZoom());r.addEventListener("click",(()=>this.zoomIn()));const s=this.createActionButton(Xt.zoomOut,"Zoom Out",this.zoomManager.isAtMinZoom());if(s.addEventListener("click",(()=>this.zoomOut())),t.append(r,s),this.options.enableQuickFilter&&(t.append(this.createSeparator()),t.append(this.buildQuickFilterInput())),this.options.enableFilterBuilder&&(t.append(this.createSeparator()),t.append(this.buildFilterBuilder(t))),this.options.enableSelection&&this.selectionManager){const n=this.chartContext.createElement("div");n.className="gantt-selection-count";const i=this.selectionManager.getSelectedIds().size;n.textContent=i>0?`${i} selected`:"",n.style.display=i>0?"":"none",e.push((()=>{var t;const e=(null==(t=this.selectionManager)?void 0:t.getSelectedIds().size)??0;n.textContent=e>0?`${e} selected`:"",n.style.display=e>0?"":"none"})),t.append(n)}if(this.options.enableTaskCRUDToolbar){t.append(this.createSeparator());const n=this.createActionButton(Xt.plus,this.messages.addTask);n.classList.add("gantt-toolbar-add-task"),n.addEventListener("click",(()=>this.addTaskFromToolbar())),t.append(n);const i=()=>{var t;return(null==(t=this.selectionManager)?void 0:t.getSelectedIds().size)??0},r=this.createActionButton(Xt.trash,this.messages.deleteSelected,0===i());r.classList.add("gantt-toolbar-delete-task"),r.addEventListener("click",(()=>this.deleteSelectedFromToolbar())),t.append(r),e.push((()=>{const t=0===i();r.disabled=t,r.classList.toggle(di,t)}))}if(this.options.enableTaskCRUDToolbar&&this.options.history.enabled){const e=this.createActionButton(Xt.undo,this.messages.undo,!this.canUndo());e.classList.add("gantt-toolbar-undo"),e.addEventListener("click",(()=>this.undo())),t.append(e);const n=this.createActionButton(Xt.redo,this.messages.redo,!this.canRedo());n.classList.add("gantt-toolbar-redo"),n.addEventListener("click",(()=>this.redo())),t.append(n);const i=()=>{const t=!this.canUndo();e.disabled=t,e.classList.toggle(di,t);const i=!this.canRedo();n.disabled=i,n.classList.toggle(di,i)};this.element.addEventListener(it.HISTORY_CHANGE,i)}const o=(this.options.toolbarItems??[]).filter((t=>"right"===(t.position??"right")));if(o.length>0&&(t.append(this.createSeparator()),o.forEach((i=>{const r=this.createToolbarItem(i,n,e);r&&t.append(r)}))),this.options.enableExport){const e=this.chartContext.createElement("div");e.className="gantt-actions-spacer",t.append(e);const n=this.createActionButton(Xt.download,this.exportButtonLabel());n.addEventListener("click",(()=>{this.exportChart()})),t.append(n)}e.length>0&&this.element.addEventListener(it.SELECTION_CHANGE,(()=>{e.forEach((t=>t()))}))}createToolbarItem(t,e,n){return"separator"===t.type?this.createSeparator():"button"===t.type?this.createToolbarButton(t,e,n):"select"===t.type?this.createToolbarSelect(t,e):null}createToolbarButton(t,e,n){const i=this.chartContext.createElement("button");i.className="gantt-action-button gantt-toolbar-button",t.tooltip?(i.title=t.tooltip,i.setAttribute("aria-label",t.tooltip)):t.label&&i.setAttribute("aria-label",t.label);const r=()=>{i.innerHTML=(()=>{const n=e().selectedTasks.length,i=t.showCount&&n>0?` (${n})`:"",r=t.label?`<span>${t.label}${i}</span>`:"";return`${t.icon??""}${r}`})(),i.disabled=t.requiresSelection?0===e().selectedTasks.length:"function"==typeof t.disabled?t.disabled(e()):t.disabled??!1};r(),i.addEventListener("click",(()=>{i.disabled||t.onClick(e())}));return(t.requiresSelection||"function"==typeof t.disabled||t.showCount)&&n.push(r),i}createToolbarSelect(t,e){const n=this.chartContext.createElement("div");if(n.className="gantt-toolbar-select-wrapper",t.label){const e=this.chartContext.createElement("span");e.className="gantt-toolbar-select-label",e.textContent=t.label,n.append(e)}const i=this.chartContext.createElement("select");if(i.className="gantt-toolbar-select",t.placeholder){const e=this.chartContext.createElement("option");e.value="",e.textContent=t.placeholder,e.disabled=!0,e.selected=!0,i.append(e)}return t.options.forEach((({value:t,text:e})=>{const n=this.chartContext.createElement("option");n.value=t,n.textContent=e,i.append(n)})),i.addEventListener("change",(()=>{t.onChange(i.value,e())})),n.append(i),n}mergeNestedOptionGroups(t,e,n){const i={...t,...e,...n};return i.baseline={...t.baseline,...e.baseline??t.baseline,...n.baseline??{}},i.barLabel={...t.barLabel,...e.barLabel??t.barLabel,...n.barLabel??{}},i.dependencies={...t.dependencies,...e.dependencies??t.dependencies,...n.dependencies??{}},i.locale={...t.locale,...e.locale??t.locale,...n.locale??{}},i}update(t){var e,n;this.element&&!this.isDestroyed()&&this.stateManager.captureState(this.element,this.dataManager,this.pixelsPerMs,null==(e=this.selectionManager)?void 0:e.captureState());const i=this.detectCurrentTheme(),r=t.theme,s=r&&r!==i,o=this.stateManager.hasState()?this.stateManager.getPixelsPerMs():this.pixelsPerMs,a=new Set(Object.keys(t).filter((e=>void 0===t[e]))),l=Object.fromEntries(Object.entries(t).filter((([,t])=>void 0!==t))),d=gt(r||i);let h;if(s){this.styleManager.cleanupScrollbarStyles();const t={series:this.options.series,parsing:this.options.parsing,width:this.options.width,height:this.options.height,pixelsPerDay:this.options.pixelsPerDay,rowHeight:this.options.rowHeight,tasksContainerWidth:this.options.tasksContainerWidth,inputDateFormat:this.options.inputDateFormat,annotations:this.options.annotations,enableSelection:this.options.enableSelection,enableExport:this.options.enableExport,enableResize:this.options.enableResize,enableTaskDrag:this.options.enableTaskDrag,enableTaskEdit:this.options.enableTaskEdit,enableTaskResize:this.options.enableTaskResize,enableTooltip:this.options.enableTooltip,tooltipTemplate:this.options.tooltipTemplate,canvasStyle:this.options.canvasStyle};h=this.mergeNestedOptionGroups(d,t,l)}else{const t=Object.fromEntries(Object.entries(this.options).filter((([t])=>!a.has(t))));h=this.mergeNestedOptionGroups(d,t,l)}const c=t.pixelsPerDay;let u;"number"==typeof c&&c>0?(this._preservedPixelsPerMs=null,this.needsAutoFitZoom=!1):this._preservedPixelsPerMs=o,h.parsing?sn.validateConfig(h.parsing)?u=sn.parse(h.series,h.parsing):(R.error("ApexGantt: Invalid parsing configuration provided in update()"),u=this.options.series):u=h.series?h.series:this.options.series,this.options={...h,series:u},j(null==(n=this.options.locale)?void 0:n.dateLocale),this.options.enableTaskEdit&&!1!==t.enableInlineEdit&&(this.options.enableInlineEdit=!0),this.pixelsPerMs=this._preservedPixelsPerMs??this.computeInitialPixelsPerMs(this.options),this._preservedPixelsPerMs=null,this.dataManager.setTasks(this.options.series),"sortBy"in t&&(this.sortCriteria=this.normalizeSortBy(t.sortBy)),this.rebuildSort(),this.reapplyFilterAfterUpdate(t),this.reapplyGroupingAfterUpdate(t),this.styleManager.updateOptions(this.options),this.scrollManager.updateOptions(this.options),this.layoutManager.updateOptions(this.options),this.crosshairManager.updateOptions(this.options),this.render()}detectCurrentTheme(){const t=this.options.backgroundColor;return this.styleManager.isColorDark(t)?"dark":"light"}updateTask(t,e){var n,i;const r=this.dataManager.getTaskById(t);if(!r)throw new Error(`Task with ID ${t} not found`);if(!1===(null==(i=(n=this.options).beforeTaskUpdate)?void 0:i.call(n,{task:r,updates:e})))return;const s=new ni(t,e,this.commandContext);s.execute(this.commandContext),this.recordSingle(s)}splitTask(t,e,n={}){const i=this.dataManager.getTaskById(t);if(!i)throw new Error(`ApexGantt.splitTask: task "${t}" not found`);if(i.type===Jt.Milestone||i.showSummaryBar)return;const r=this.options.inputDateFormat,s=i.segments&&i.segments.length>=1?re(i.segments,r):[{start:i.startTime,end:i.endTime}],o=function(t,e,n,i){const r=t=>U(t,i).valueOf(),s=r(e),o=[];let a=!1;for(const i of t)!a&&s>r(i.start)&&s<r(i.end)?(o.push({start:i.start,end:e}),o.push({start:n,end:i.end}),a=!0):o.push({start:i.start,end:i.end});return re(o,i)}(s,e,n.resumeAt??U(e,r).add(1,"day").format(r),r);o.length!==s.length&&this.updateTask(t,{segments:o})}isSplit(t){const e=this.dataManager.getTaskById(t);return!!(null==e?void 0:e.segments)&&e.segments.length>1}addTask(t,e={}){var n,i;if(!t.id)throw new Error("ApexGantt.addTask: input.id is required");if(this.dataManager.getTaskById(t.id))throw new Error(`ApexGantt.addTask: task with id "${t.id}" already exists`);if(!1===(null==(i=(n=this.options).beforeTaskAdd)?void 0:i.call(n,{input:t,parentId:e.parentId})))return null;const r=new ii(t,e);r.execute(this.commandContext),this.recordSingle(r);const s=this.dataManager.getTaskById(t.id);return s?(this.dispatchTaskAdded(s,e.parentId),s):null}deleteTask(t,e={}){var n,i;const r=e.cascade??"forbid",s=this.dataManager.getTaskById(t);if(!s)throw new Error(`ApexGantt.deleteTask: task with id "${t}" not found`);const o=this.dataManager.hasChildren(t);if("forbid"===r&&o)throw new Error(`ApexGantt.deleteTask: task "${t}" has children. Pass {cascade: 'children'} or {cascade: 'orphan'} to handle the subtree.`);const a="children"===r?this.dataManager.getNestedChildTasks(t,!1):[],l=a.map((t=>t.id)),d="orphan"===r?this.dataManager.getImmediateChildren(t):[];if(!1===(null==(i=(n=this.options).beforeTaskDelete)?void 0:i.call(n,{task:s,descendantIds:l,cascade:r})))return!1;const h=new Set([t,...l]),c=this.dataManager.getAllDependencies().filter((t=>h.has(t.fromId)||h.has(t.toId))),u=c.map((t=>({fromId:t.fromId,toId:t.toId,type:t.type,lag:t.lag}))),p=[];for(const t of c){const e=new ai(t.fromId,t.toId,this.commandContext);e.execute(this.commandContext),p.push(e)}if("orphan"===r&&d.length>0){const t=s.parentId;for(const e of d){const n=new si(e.id,t,this.commandContext);n.execute(this.commandContext),p.push(n)}}const m=[...a,s].sort(((t,e)=>this.depthOf(e.id)-this.depthOf(t.id)));for(const t of m){const e=new ri(t.id,this.commandContext);e.execute(this.commandContext),p.push(e)}const g=a.length>0?`Delete task ${t} + ${a.length} descendant(s)`:d.length>0?`Delete task ${t} + reparent ${d.length} child(ren)`:`Delete task ${t}`;1===p.length?this.recordSingle(p[0],g):this.recordTransaction(new ti(g,p));for(const t of u)this.dispatchDependencyChanged(it.DEPENDENCY_REMOVED,t.fromId,t.toId,t.type,t.lag);for(const e of d)this.dispatchTaskMoved(e.id,t,s.parentId);return this.dispatchTaskDeleted(s,l),!0}moveTask(t,e={}){var n,i,r;const s=this.dataManager.getTaskById(t);if(!s)throw new Error(`ApexGantt.moveTask: task with id "${t}" not found`);const o=e.newParentId??void 0;if(o===t)throw new Error(`ApexGantt.moveTask: cannot move task "${t}" onto itself`);if(void 0!==o){if(!this.dataManager.getTaskById(o))throw new Error(`ApexGantt.moveTask: parent "${o}" not found`);let e=o;for(;e;){if(e===t)throw new Error(`ApexGantt.moveTask: cannot move "${t}" under its own descendant`);e=null==(n=this.dataManager.getTaskById(e))?void 0:n.parentId}}if(s.parentId===o)return!0;const a=s.parentId;if(!1===(null==(r=(i=this.options).beforeTaskMove)?void 0:r.call(i,{task:s,oldParentId:a,newParentId:o})))return!1;const l=new si(t,o,this.commandContext);return l.execute(this.commandContext),this.recordSingle(l),this.dispatchTaskMoved(t,a,o),!0}canAddDependency(t,e,n={}){var i,r;if(t===e)return{ok:!1,reason:"self"};if(!this.dataManager.getTaskById(t))return{ok:!1,reason:"task-missing"};if(!this.dataManager.getTaskById(e))return{ok:!1,reason:"task-missing"};const s=this.dataManager.getAllDependencies();if(s.some((n=>n.fromId===t&&n.toId===e)))return{ok:!1,reason:"duplicate"};if(this.wouldCreateCycle(t,e,s))return{ok:!1,reason:"cycle"};if(!this.options.dependencies.allowSummaryDescendantLinks&&this.isAncestorDescendantPair(t,e))return{ok:!1,reason:"summary-descendant"};const o=n.type??"FS",a=n.lag??0;return!1===(null==(r=(i=this.options).beforeDependencyChange)?void 0:r.call(i,{change:"add",fromId:t,toId:e,type:o,lag:a}))?{ok:!1,reason:"hook-veto"}:{ok:!0}}wouldCreateCycle(t,e,n){const i=new Set,r=[e];for(;r.length;){const e=r.pop();if(e===t)return!0;if(!i.has(e)){i.add(e);for(const t of n)t.fromId===e&&r.push(t.toId)}}return!1}isAncestorDescendantPair(t,e){return this.isAncestor(t,e)||this.isAncestor(e,t)}isAncestor(t,e){var n,i;let r=null==(n=this.dataManager.getTaskById(e))?void 0:n.parentId;for(;r;){if(r===t)return!0;r=null==(i=this.dataManager.getTaskById(r))?void 0:i.parentId}return!1}addDependency(t,e,n={}){var i,r;if(!this.dataManager.getTaskById(t))throw new Error(`ApexGantt.addDependency: task "${t}" not found`);if(!this.dataManager.getTaskById(e))throw new Error(`ApexGantt.addDependency: task "${e}" not found`);if(this.dataManager.getAllDependencies().find((n=>n.fromId===t&&n.toId===e)))throw new Error(`ApexGantt.addDependency: dependency ${t}→${e} already exists`);const s=n.type??"FS",o=n.lag??0;if(!1===(null==(r=(i=this.options).beforeDependencyChange)?void 0:r.call(i,{change:"add",fromId:t,toId:e,type:s,lag:o})))return!1;const a=new oi(t,e,s,o);return a.execute(this.commandContext),this.recordSingle(a),this.dispatchDependencyChanged(it.DEPENDENCY_ADDED,t,e,s,o),!0}removeDependency(t,e){var n,i;const r=this.dataManager.getAllDependencies().find((n=>n.fromId===t&&n.toId===e));if(!r)throw new Error(`ApexGantt.removeDependency: no dependency ${t}→${e}`);if(!1===(null==(i=(n=this.options).beforeDependencyChange)?void 0:i.call(n,{change:"remove",fromId:t,toId:e,type:r.type,lag:r.lag})))return!1;const s=new ai(t,e,this.commandContext);return s.execute(this.commandContext),this.recordSingle(s),this.dispatchDependencyChanged(it.DEPENDENCY_REMOVED,t,e,r.type,r.lag),!0}undo(){return!!this.history.canUndo()&&(this.history.undo(this.commandContext),this.dispatchHistoryChange("undo"),!0)}redo(){return!!this.history.canRedo()&&(this.history.redo(this.commandContext),this.dispatchHistoryChange("redo"),!0)}canUndo(){return this.history.canUndo()}canRedo(){return this.history.canRedo()}clearHistory(){0===this.history.size().undo&&0===this.history.size().redo||(this.history.clear(),this.dispatchHistoryChange("clear"))}getHistorySize(){return this.history.size()}normalizeSortBy(t){return void 0===t?[{key:It.StartTime,direction:"asc"}]:Array.isArray(t)?[...t]:[t]}rebuildSort(){const t=Rt(this.options.columnConfig),e=function(t,e,n){if(!t.length)return null;const i=new Map(e.map((t=>[t.key,t]))),r=t.map((t=>({column:i.get(t.key),dir:"desc"===t.direction?-1:1,key:t.key})));return(t,e)=>{for(const{column:i,dir:s,key:o}of r){let r;if(r=(null==i?void 0:i.comparator)?i.comparator(t,e):_t(Gt(t,o,i,n),Gt(e,o,i,n)),0!==r)return r*s}return 0}}(this.sortCriteria,t,{inputDateFormat:this.options.inputDateFormat,calendar:this.dataManager.getCalendar()});this.dataManager.setSortComparator(e)}applyInitialSortAndFilter(){this.sortCriteria=this.normalizeSortBy(this.options.sortBy),this.rebuildSort(),this.options.filterRules?(this.filterRuleSet=this.options.filterRules,this.activeFilter=this.compileRules(this.filterRuleSet)):this.activeFilter=this.options.filterBy??null,this.dataManager.setFilterPredicate(this.activeFilter)}reapplyFilterAfterUpdate(t){"filterRules"in t&&(this.filterRuleSet=t.filterRules??null,this.quickFilterQuery=""),"filterBy"in t&&(this.activeFilter=t.filterBy??null,this.filterRuleSet=null,this.quickFilterQuery=""),this.filterRuleSet?this.activeFilter=this.compileRules(this.filterRuleSet):this.quickFilterQuery&&(this.activeFilter=this.buildQuickFilterPredicate(this.quickFilterQuery.trim())),this.dataManager.setFilterPredicate(this.activeFilter)}filterContext(){return{inputDateFormat:this.options.inputDateFormat,calendar:this.dataManager.getCalendar()}}compileRules(t){return function(t,e,n){if(!t||0===t.rules.length)return null;const i=new Map(e.map((t=>[t.key,t]))),r=t.rules,s="any"!==t.match;return t=>s?r.every((e=>tn(t,e,i.get(e.field),n))):r.some((e=>tn(t,e,i.get(e.field),n)))}(t,Rt(this.options.columnConfig),this.filterContext())}normalizeGroupBy(t){return null==t?null:"string"==typeof t?{field:t}:t}rebuildGrouping(){if(!this.groupCriterion)return void this.dataManager.setGroupBy(null);const t=Rt(this.options.columnConfig).find((t=>{var e;return t.key===(null==(e=this.groupCriterion)?void 0:e.field)}));this.dataManager.setGroupBy(this.groupCriterion,t,this.messages.groupNone)}applyInitialGrouping(){this.groupCriterion=this.normalizeGroupBy(this.options.groupBy),this.rebuildGrouping()}reapplyGroupingAfterUpdate(t){"groupBy"in t&&(this.groupCriterion=this.normalizeGroupBy(t.groupBy)),this.rebuildGrouping()}groupBy(t){this.groupCriterion=this.normalizeGroupBy(t),this.rebuildGrouping(),this.render(),this.dispatchGroupChange()}clearGrouping(){this.groupCriterion&&(this.groupCriterion=null,this.dataManager.setGroupBy(null),this.render(),this.dispatchGroupChange())}getGroupBy(){return this.groupCriterion?{...this.groupCriterion}:null}isGrouping(){return null!==this.groupCriterion}dispatchGroupChange(){const t={active:this.isGrouping(),field:this.groupCriterion?String(this.groupCriterion.field):null,groupCount:this.groupCriterion?this.dataManager.getFlatVisibleTasks().filter((t=>t.isGroup)).length:0,timestamp:Date.now()};this.element.dispatchEvent(new CustomEvent(it.GROUP_CHANGE,{detail:t,bubbles:!0,composed:!0}))}sort(t){this.sortCriteria=Array.isArray(t)?[...t]:[t],this.rebuildSort(),this.render(),this.dispatchSortChange()}clearSort(){0!==this.sortCriteria.length&&(this.sortCriteria=[],this.rebuildSort(),this.render(),this.dispatchSortChange())}getSort(){return this.sortCriteria.map((t=>({key:t.key,direction:t.direction??"asc"})))}toggleSort(t,e={}){const n=Rt(this.options.columnConfig).find((e=>e.key===t));if(!n||!Kt(n))return;const i=this.sortCriteria.findIndex((e=>e.key===t)),r=(i>=0?this.sortCriteria[i].direction:void 0)??"asc";if(e.append){const e=this.sortCriteria.map((t=>({...t})));i<0?e.push({key:t,direction:"asc"}):"asc"===r?e[i]={key:t,direction:"desc"}:e.splice(i,1),this.sortCriteria=e}else i<0||this.sortCriteria.length>1?this.sortCriteria=[{key:t,direction:"asc"}]:this.sortCriteria="asc"===r?[{key:t,direction:"desc"}]:[];this.rebuildSort(),this.render(),this.dispatchSortChange()}filter(t){this.activeFilter=t,this.dataManager.setFilterPredicate(t),this.render(),this.dispatchFilterChange()}clearFilter(){this.activeFilter&&(this.activeFilter=null,this.quickFilterQuery="",this.filterRuleSet=null,this.dataManager.setFilterPredicate(null),this.render(),this.dispatchFilterChange())}isFiltered(){return null!==this.activeFilter}setFilterRules(t){this.filterRuleSet=t&&t.rules.length>0?t:null,this.quickFilterQuery="",this.activeFilter=this.compileRules(this.filterRuleSet),this.dataManager.setFilterPredicate(this.activeFilter),this.render(),this.dispatchFilterChange()}getFilterRules(){return this.filterRuleSet?{match:this.filterRuleSet.match,rules:this.filterRuleSet.rules.map((t=>({...t})))}:null}handleColumnResize(t,e){null==e?this.columnWidthOverrides.delete(t):this.columnWidthOverrides.set(t,e),this.dispatchColumnResize(t,e),this.schedulePersist()}dispatchColumnResize(t,e){const n={key:t,width:e,widths:this.getColumnWidths(),timestamp:Date.now()};this.element.dispatchEvent(new CustomEvent(it.COLUMN_RESIZE,{detail:n,bubbles:!0,composed:!0}))}setColumnWidth(t,e){!Number.isFinite(e)||e<=0||(this.columnWidthOverrides.set(String(t),Math.round(e)),this.render(),this.dispatchColumnResize(String(t),Math.round(e)),this.schedulePersist())}resetColumnWidths(t){if(void 0===t){if(0===this.columnWidthOverrides.size)return;this.columnWidthOverrides.clear()}else if(!this.columnWidthOverrides.delete(String(t)))return;this.render(),this.dispatchColumnResize(void 0===t?"*":String(t),null),this.schedulePersist()}getColumnWidths(){return Object.fromEntries(this.columnWidthOverrides)}handleColumnReorder(t,e){this.columnOrder=e,this.render(),this.dispatchColumnReorder(e,t),this.schedulePersist()}dispatchColumnReorder(t,e){const n={order:[...t],movedKey:e,timestamp:Date.now()};this.element.dispatchEvent(new CustomEvent(it.COLUMN_REORDER,{detail:n,bubbles:!0,composed:!0}))}setColumnOrder(t){this.columnOrder=t.map(String),this.render(),this.dispatchColumnReorder(this.columnOrder,null),this.schedulePersist()}getColumnOrder(){return Ht(Rt(this.options.columnConfig),this.columnOrder??void 0).map((t=>String(t.key)))}scrollToTask(t){const e=this.dataManager.getTaskById(t);if(!e)return!1;const n=this.currentGeometry??this.buildFreshGeometry(),i=this.options.rowHeight;let r=!1;const s=this.domCache.timelineBodyWrapper;if(s&&s.clientWidth>0){const t=Tt.calculateX(e,n,this.options),o=Tt.calculateWidth(e,n,this.options),a=i,l=s.scrollLeft,d=l+s.clientWidth;let h=l;t<l?h=t-a:t+o>d&&(h=t+o-s.clientWidth+a),h=Math.max(0,h),Math.round(h)!==Math.round(l)&&(s.scrollLeft=h,r=!0)}const o=this.element.querySelector(en.splitViewContainer)??this.domCache.ganttContainer,{indexMap:a}=this.dataManager.getFlatVisibleIndex(),l=a.get(t);if(o&&void 0!==l&&o.clientHeight>0){const t=2*i,e=t+l*i,n=e+i,s=o.scrollTop;let a=s;e<s+t?a=e-t:n>s+o.clientHeight&&(a=n-o.clientHeight),a=Math.max(0,a),Math.round(a)!==Math.round(s)&&(o.scrollTop=a,r=!0)}return r}getState(){var t,e,n;const i=null==(t=this.element)?void 0:t.querySelector(en.horizontalScroll),r=null==(e=this.element)?void 0:e.querySelector(en.splitViewContainer);return{version:1,zoom:this.pixelsPerMs*tt,scroll:{horizontal:(null==i?void 0:i.scrollLeft)??0,vertical:(null==r?void 0:r.scrollTop)??0},collapsed:this.dataManager.getFlatTasks().filter((t=>t.collapsed)).map((t=>t.id)),selected:(null==(n=this.selectionManager)?void 0:n.captureState())??[],sort:this.getSort().map((t=>({key:String(t.key),direction:t.direction??"asc"}))),filterRules:this.getFilterRules(),quickFilter:this.quickFilterQuery||void 0,group:this.groupCriterion?{field:String(this.groupCriterion.field),direction:this.groupCriterion.direction??"asc"}:null,columnWidths:this.columnWidthOverrides.size?this.getColumnWidths():void 0,columnOrder:this.columnOrder?[...this.columnOrder]:void 0}}setState(t,e={}){var n;if(!t)return;const i=Array.isArray(t.sort),r="filterRules"in t||void 0!==t.quickFilter,s="group"in t;this.isApplyingState=!0;try{this.applySortState(t),this.applyFilterState(t),this.applyGroupState(t),this.applyColumnWidthsState(t),"columnOrder"in t&&(this.columnOrder=t.columnOrder?[...t.columnOrder]:null),Array.isArray(t.collapsed)&&this.dataManager.setCollapsedTasks(t.collapsed),"number"==typeof t.zoom&&t.zoom>0&&(this.pixelsPerMs=un.clamp(t.zoom/tt),this.needsAutoFitZoom=!1,this.currentGeometry=null),this.render(),Array.isArray(t.selected)&&(null==(n=this.selectionManager)||n.setSelectedTasks(t.selected)),t.scroll&&this.applyScrollState(t.scroll)}finally{this.isApplyingState=!1}e.silent||(i&&this.dispatchSortChange(),r&&this.dispatchFilterChange(),s&&this.dispatchGroupChange()),this.schedulePersist()}applySortState(t){Array.isArray(t.sort)&&(this.sortCriteria=t.sort.map((t=>({key:t.key,direction:t.direction}))),this.rebuildSort())}applyColumnWidthsState(t){"columnWidths"in t&&(this.columnWidthOverrides=new Map(Object.entries(t.columnWidths??{})))}applyGroupState(t){"group"in t&&(this.groupCriterion=t.group?{field:t.group.field,direction:t.group.direction}:null,this.rebuildGrouping())}applyFilterState(t){if("filterRules"in t){const e=t.filterRules&&t.filterRules.rules.length>0?t.filterRules:null;this.filterRuleSet=e,this.quickFilterQuery="",this.activeFilter=this.compileRules(e),this.dataManager.setFilterPredicate(this.activeFilter)}else if(void 0!==t.quickFilter){const e=t.quickFilter.trim();this.quickFilterQuery=t.quickFilter,this.filterRuleSet=null,this.activeFilter=e?this.buildQuickFilterPredicate(e):null,this.dataManager.setFilterPredicate(this.activeFilter)}}applyScrollState(t){requestAnimationFrame((()=>{var e,n,i;const r=null==(e=this.element)?void 0:e.querySelector(en.horizontalScroll),s=null==(n=this.element)?void 0:n.querySelector(en.timelineHeader),o=null==(i=this.element)?void 0:i.querySelector(en.splitViewContainer);r&&(r.scrollLeft=t.horizontal),s&&(s.scrollLeft=t.horizontal),o&&(o.scrollTop=t.vertical)}))}resolvePersistence(){const t=this.options.persistState;if(!t)return null;if("undefined"==typeof window)return null;let e;try{if(e=window.localStorage,!e)return null}catch{return null}return{storage:e,key:"object"==typeof t&&t.key||"apexgantt-state"}}schedulePersist(){this.isApplyingState||this.resolvePersistence()&&(null!==this.persistTimer&&clearTimeout(this.persistTimer),this.persistTimer=setTimeout((()=>{this.persistTimer=null,this.writePersistedState()}),200))}writePersistedState(){const t=this.resolvePersistence();if(t)try{t.storage.setItem(t.key,JSON.stringify(this.getState()))}catch(t){R.warn("[ApexGantt] Failed to persist UI state:",t)}}restorePersistedState(){const t=this.resolvePersistence();if(!t)return!1;let e;try{e=t.storage.getItem(t.key)}catch{return!1}if(!e)return!1;try{const t=JSON.parse(e);return!(!t||1!==t.version)&&(this.setState(t,{silent:!0}),!0)}catch(t){return R.warn("[ApexGantt] Failed to restore persisted UI state:",t),!1}}attachPersistenceListeners(){this.resolvePersistence()&&!this.persistChangeHandler&&(this.persistChangeHandler=()=>this.schedulePersist(),this.element.addEventListener(it.SELECTION_CHANGE,this.persistChangeHandler),this.element.addEventListener("scroll",this.persistChangeHandler,{capture:!0}))}maybeRestorePersistedStateOnce(){return!this.stateRestoreAttempted&&!this.isApplyingState&&(this.stateRestoreAttempted=!0,this.attachPersistenceListeners(),this.restorePersistedState())}detachPersistence(){var t,e;null!==this.persistTimer&&(clearTimeout(this.persistTimer),this.persistTimer=null),this.persistChangeHandler&&(null==(t=this.element)||t.removeEventListener(it.SELECTION_CHANGE,this.persistChangeHandler),null==(e=this.element)||e.removeEventListener("scroll",this.persistChangeHandler,{capture:!0}),this.persistChangeHandler=null)}applyAutoFitZoomIfNeeded(){if(!this.needsAutoFitZoom)return;const t=this.computeAutoFitPixelsPerMs();null!=t&&(this.pixelsPerMs=t,this.needsAutoFitZoom=!1)}computeChangedVisibleIds(t,e){const n=new Set(e.map((t=>t.id)));if(0!==t.size)return new Set([...t,...n].filter((e=>!t.has(e)||!n.has(e))))}exportButtonLabel(){switch(this.options.exportFormat){case"png":return this.messages.exportAsPng;case"pdf":return this.messages.exportAsPdf;default:return this.messages.exportAsSvg}}async exportChart(t=this.options.exportFormat){var e,n;if(!this.element)return R.error("Export failed: Chart element not found"),void alert(this.messages.exportFailedNoChart);if(!this.element.querySelector(en.ganttContainer))return void R.error("Export failed: Gantt container not found in chart");const i=(null==(e=this.virtualScrollCoordinator)?void 0:e.expandAllForExport())??null;try{await Ve(this.element,t,{background:this.options.backgroundColor})}catch(t){R.error("Export error:",t),alert(this.messages.exportFailedGeneric)}finally{null==(n=this.virtualScrollCoordinator)||n.restoreAfterExport(i)}}dispatchSortChange(){const t={criteria:this.sortCriteria.map((t=>({key:String(t.key),direction:t.direction??"asc"}))),timestamp:Date.now()};this.element.dispatchEvent(new CustomEvent(it.SORT_CHANGE,{detail:t,bubbles:!0,composed:!0}))}dispatchFilterChange(){const t={active:this.isFiltered(),visibleCount:this.dataManager.getFlatVisibleTasks().length,timestamp:Date.now()};this.element.dispatchEvent(new CustomEvent(it.FILTER_CHANGE,{detail:t,bubbles:!0,composed:!0}))}buildQuickFilterInput(){var t;const e=(null==(t=this.options.quickFilter)?void 0:t.placeholder)??this.messages.quickFilterPlaceholder,n=this.chartContext.createElement("div");n.className="gantt-quick-filter";const i=this.chartContext.createElement("input");return i.type="search",i.className="gantt-quick-filter-input",i.value=this.quickFilterQuery,i.placeholder=e,i.setAttribute("aria-label",e),i.autocomplete="off",i.addEventListener("keydown",(t=>t.stopPropagation())),i.addEventListener("input",(()=>{this.quickFilterCaret=i.selectionStart??i.value.length,this.applyQuickFilter(i.value)})),n.append(i),n}applyQuickFilter(t){this.quickFilterQuery=t,this.filterRuleSet=null,this.activeFilter=this.buildQuickFilterPredicate(t.trim()),this.dataManager.setFilterPredicate(this.activeFilter),this.render(),this.dispatchFilterChange(),this.restoreQuickFilterFocus()}buildQuickFilterPredicate(t){if(!t)return null;const e=this.options.quickFilter,n=(null==e?void 0:e.fields)??["name"],i=(null==e?void 0:e.caseSensitive)??!1,r=i?t:t.toLowerCase();return t=>n.some((e=>{const n=t[e];return"string"==typeof n&&(i?n:n.toLowerCase()).includes(r)}))}restoreQuickFilterFocus(){var t;const e=null==(t=this.domCache.actionsContainer)?void 0:t.querySelector(".gantt-quick-filter-input");if(e instanceof HTMLInputElement){e.focus();const t=Math.min(this.quickFilterCaret,e.value.length);try{e.setSelectionRange(t,t)}catch{}}}buildFilterBuilder(t){var e;const n=this.chartContext.createElement("div");n.className="gantt-filter-builder";const i=(null==(e=this.filterRuleSet)?void 0:e.rules.length)??0,r=this.chartContext.createElement("button");return r.type="button",r.className="gantt-filter-builder-button",i>0&&r.classList.add("is-active"),r.setAttribute("aria-haspopup","dialog"),r.setAttribute("aria-expanded",String(this.filterBuilderOpen)),r.innerHTML=`${Xt.filter}<span>${At(this.messages.filterButton)}</span>${i>0?`<span class="gantt-filter-builder-badge">${i}</span>`:""}`,r.addEventListener("click",(()=>this.toggleFilterBuilder(t))),n.append(r),this.filterBuilderOpen&&n.append(this.buildFilterPopover(t)),n}toggleFilterBuilder(t){this.filterBuilderOpen=!this.filterBuilderOpen,this.filterBuilderOpen&&(this.filterBuilderDraft=this.cloneRuleSet(this.filterRuleSet)??{match:"all",rules:[]}),this.renderToolbar(t)}cloneRuleSet(t){return t?{match:t.match,rules:t.rules.map((t=>({...t})))}:null}buildFilterPopover(t){const e=this.filterBuilderDraft??{match:"all",rules:[]},n=Rt(this.options.columnConfig).filter((t=>t.key!==It.ProgressRing)),i=this.chartContext.createElement("div");i.className="gantt-filter-popover",i.setAttribute("role","dialog"),i.setAttribute("aria-label",this.messages.filterHeading),i.addEventListener("keydown",(t=>t.stopPropagation()));const r=this.chartContext.createElement("div");r.className="gantt-filter-popover-header";const s=this.chartContext.createElement("span");s.textContent=this.messages.filterMatchLabel;const o=this.chartContext.createElement("select");o.className="gantt-filter-match",o.innerHTML=`<option value="all">${this.messages.filterMatchAll}</option><option value="any">${this.messages.filterMatchAny}</option>`,o.value=e.match,o.addEventListener("change",(()=>{e.match="any"===o.value?"any":"all"})),r.append(s,o),i.append(r);const a=this.chartContext.createElement("div");if(a.className="gantt-filter-rows",0===e.rules.length){const t=this.chartContext.createElement("div");t.className="gantt-filter-empty",t.textContent=this.messages.filterNoConditions,a.append(t)}else e.rules.forEach(((i,r)=>a.append(this.buildFilterRow(i,r,n,e,t))));i.append(a);const l=this.chartContext.createElement("div");l.className="gantt-filter-popover-footer";const d=this.chartContext.createElement("button");d.type="button",d.className="gantt-filter-add",d.textContent=this.messages.filterAddCondition,d.addEventListener("click",(()=>{const i=n[0],r=i?Xe(i.key):"text";e.rules.push({field:(null==i?void 0:i.key)??It.Name,operator:Ze(r)[0],value:""}),this.renderToolbar(t)}));const h=this.chartContext.createElement("div");h.className="gantt-filter-footer-spacer";const c=this.chartContext.createElement("button");c.type="button",c.className="gantt-filter-clear",c.textContent=this.messages.filterClear,c.addEventListener("click",(()=>{this.filterBuilderDraft={match:"all",rules:[]},this.clearFilter()}));const u=this.chartContext.createElement("button");return u.type="button",u.className="gantt-filter-apply",u.textContent=this.messages.filterApply,u.addEventListener("click",(()=>{this.setFilterRules(this.cloneRuleSet(e))})),l.append(d,h,c,u),i.append(l),i}buildFilterRow(t,e,n,i,r){const s=this.chartContext.createElement("div");s.className="gantt-filter-row";const o=this.chartContext.createElement("select");o.className="gantt-filter-field",o.innerHTML=n.map((t=>`<option value="${At(String(t.key))}">${At(t.title)}</option>`)).join(""),o.value=String(t.field),o.addEventListener("change",(()=>{i.rules[e]={field:o.value,operator:Ze(Xe(o.value))[0],value:""},this.renderToolbar(r)}));const a=Xe(t.field),l=Ze(a),d=this.chartContext.createElement("select");d.className="gantt-filter-operator",d.innerHTML=l.map((t=>`<option value="${t}">${At(this.messages.filterOperatorLabel(t))}</option>`)).join(""),d.value=l.includes(t.operator)?t.operator:l[0],d.addEventListener("change",(()=>{i.rules[e]={...i.rules[e],operator:d.value},this.renderToolbar(r)})),s.append(o,d);if("isEmpty"!==t.operator&&"notEmpty"!==t.operator){const n=this.chartContext.createElement("input");n.className="gantt-filter-value",n.type="date"===a?"date":"number"===a?"number":"text",n.value=null!=t.value?String(t.value):"",n.addEventListener("input",(()=>{i.rules[e]={...i.rules[e],value:n.value}})),s.append(n)}else{const t=this.chartContext.createElement("span");t.className="gantt-filter-value-placeholder",s.append(t)}const h=this.chartContext.createElement("button");return h.type="button",h.className="gantt-filter-remove",h.setAttribute("aria-label",this.messages.filterRemoveCondition),h.innerHTML=Xt.close,h.addEventListener("click",(()=>{i.rules.splice(e,1),this.renderToolbar(r)})),s.append(h),s}attachUndoRedoShortcuts(){this.undoRedoKeyHandler&&(this.element.removeEventListener("keydown",this.undoRedoKeyHandler),this.undoRedoKeyHandler=null),this.options.history.enabled&&(this.undoRedoKeyHandler=t=>{if(!(t.ctrlKey||t.metaKey)||t.altKey)return;const e=t.target;if(e&&("INPUT"===e.tagName||"TEXTAREA"===e.tagName||e.isContentEditable))return;const n=t.key.toLowerCase();if("y"===n&&!t.shiftKey||"z"===n&&t.shiftKey){if(!this.canRedo())return;return t.preventDefault(),void this.redo()}if("z"===n&&!t.shiftKey){if(!this.canUndo())return;t.preventDefault(),this.undo()}},this.element.addEventListener("keydown",this.undoRedoKeyHandler))}depthOf(t){let e=0,n=this.dataManager.getTaskById(t);for(;null==n?void 0:n.parentId;)e++,n=this.dataManager.getTaskById(n.parentId);return e}dispatchTaskAdded(t,e){const n={taskId:t.id,task:t,parentId:e,timestamp:Date.now()};this.element.dispatchEvent(new CustomEvent(it.TASK_ADDED,{detail:n,bubbles:!0,composed:!0}))}dispatchTaskDeleted(t,e){const n={taskId:t.id,task:t,removedDescendantIds:e,timestamp:Date.now()};this.element.dispatchEvent(new CustomEvent(it.TASK_DELETED,{detail:n,bubbles:!0,composed:!0}))}dispatchTaskMoved(t,e,n){const i={taskId:t,oldParentId:e,newParentId:n,timestamp:Date.now()};this.element.dispatchEvent(new CustomEvent(it.TASK_MOVED,{detail:i,bubbles:!0,composed:!0}))}dispatchHistoryChange(t){var e,n;const i=this.history.size(),r={kind:t,canUndo:this.history.canUndo(),canRedo:this.history.canRedo(),undoSize:i.undo,redoSize:i.redo,topUndoLabel:null==(e=this.history.peekUndo())?void 0:e.label,topRedoLabel:null==(n=this.history.peekRedo())?void 0:n.label,timestamp:Date.now()};this.element.dispatchEvent(new CustomEvent(it.HISTORY_CHANGE,{detail:r,bubbles:!0,composed:!0}))}attachContextMenuHandler(){this.contextMenuHandler&&(this.element.removeEventListener("contextmenu",this.contextMenuHandler),this.contextMenuHandler=null),this.contextMenuManager&&(this.contextMenuHandler=t=>{var e;const n=t.target,i=null==n?void 0:n.closest("[data-taskid]"),r=null==i?void 0:i.getAttribute("data-taskid");if(!r)return;if(!this.dataManager.getTaskById(r))return;t.preventDefault();const s=this.buildContextMenuItems(r);null==(e=this.contextMenuManager)||e.show(t.clientX,t.clientY,s)},this.element.addEventListener("contextmenu",this.contextMenuHandler))}buildContextMenuItems(t){var e;const n=[],i=this.dataManager.getTaskById(t);if(!i)return n;const r=this.messages;this.options.enableTaskEdit&&n.push({id:"edit",label:r.editTask,onClick:()=>{const e=this.chartContext.querySelector(`[data-taskid="${CSS.escape(t)}"].bar-timeline`);null==e||e.dispatchEvent(new MouseEvent("dblclick",{bubbles:!0}))}}),n.push({id:"add-child",label:r.addChildTask,onClick:()=>this.addPlaceholderTask({parentId:t})}),n.push({id:"add-sibling",label:r.addSiblingTask,onClick:()=>this.addPlaceholderTask({parentId:i.parentId})});const s=this.findPreviousSiblingId(t),o=null!==s,a=void 0!==i.parentId;if((o||a)&&n.push({separator:!0}),o&&n.push({id:"indent",label:r.indent,onClick:()=>{try{this.moveTask(t,{newParentId:s})}catch(e){R.warn(`[ApexGantt] context indent failed for "${t}":`,e)}}}),a){const s=i.parentId?(null==(e=this.dataManager.getTaskById(i.parentId))?void 0:e.parentId)??null:null;n.push({id:"outdent",label:r.outdent,onClick:()=>{try{this.moveTask(t,{newParentId:s})}catch(e){R.warn(`[ApexGantt] context outdent failed for "${t}":`,e)}}})}return n.push({separator:!0}),n.push({id:"delete",label:this.dataManager.hasChildren(t)?r.deleteTaskWithChildren:r.deleteTask,onClick:()=>{try{this.deleteTask(t,{cascade:"children"})}catch(e){R.warn(`[ApexGantt] context delete failed for "${t}":`,e)}}}),n}snapStepMs(){const{snapUnit:t,snapValue:e}=this.options;return("minute"===t?Q:"hour"===t?J:tt)*Math.max(1,e)}commitDrawnTask(t,e,n){const i=this.currentGeometry;if(!i)return;const r=this.options.inputDateFormat,s=P(this.options.barLabel),o=i.dateForX(t-s).valueOf(),a=i.dateForX(e-s).valueOf(),l=Math.min(o,a),d=Math.max(o,a),h=this.snapStepMs(),c=Math.round(l/h)*h,u=Math.round(d/h)*h,p=Math.max(1,Math.round((u-c)/h)),m=c+(!Y(r)?p-1:p)*h,g=`task-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`;try{this.addTask({id:g,name:"New task",startTime:w(c).format(r),endTime:w(m).format(r),type:Jt.Task,progress:0})}catch(t){R.warn("[ApexGantt] draw-to-create task failed:",t)}}addPlaceholderTask(t){const e=this.getPaddedDateRange(0),n=this.options.inputDateFormat,i=e[0],r=i.add(7,"day"),s=`task-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`;try{this.addTask({id:s,name:"New task",startTime:i.format(n),endTime:r.format(n),type:Jt.Task,progress:0},t)}catch(t){R.warn("[ApexGantt] addPlaceholderTask failed:",t)}}addTaskFromToolbar(){this.addPlaceholderTask({})}deleteSelectedFromToolbar(){var t,e;const n=(null==(t=this.selectionManager)?void 0:t.getSelectedIds())??new Set;if(0===n.size)return;const i=[...n].filter((t=>{var e,i;let r=null==(e=this.dataManager.getTaskById(t))?void 0:e.parentId;for(;r;){if(n.has(r))return!1;r=null==(i=this.dataManager.getTaskById(r))?void 0:i.parentId}return!0}));for(const t of i)try{this.deleteTask(t,{cascade:"children"})}catch(e){R.warn(`[ApexGantt] toolbar delete failed for "${t}":`,e)}null==(e=this.selectionManager)||e.clearSelection()}buildKeyboardEditingCommands(){return{delete:t=>{try{this.deleteTask(t,{cascade:"children"})}catch(e){R.warn(`[ApexGantt] keyboard delete failed for "${t}":`,e)}},indent:t=>{const e=this.findPreviousSiblingId(t);if(e)try{this.moveTask(t,{newParentId:e})}catch(e){R.warn(`[ApexGantt] keyboard indent failed for "${t}":`,e)}},outdent:t=>{const e=this.dataManager.getTaskById(t);if(!(null==e?void 0:e.parentId))return;const n=this.dataManager.getTaskById(e.parentId);try{this.moveTask(t,{newParentId:(null==n?void 0:n.parentId)??null})}catch(e){R.warn(`[ApexGantt] keyboard outdent failed for "${t}":`,e)}}}}findPreviousSiblingId(t){const e=this.dataManager.getTaskById(t);if(!e)return null;const n=this.dataManager.getFlatVisibleTasks(),i=n.findIndex((e=>e.id===t));for(let t=i-1;t>=0;t--)if(n[t].parentId===e.parentId)return n[t].id;return null}dispatchDependencyChanged(t,e,n,i,r){const s={fromId:e,toId:n,type:i,lag:r,timestamp:Date.now()};this.element.dispatchEvent(new CustomEvent(t,{detail:s,bubbles:!0,composed:!0}))}commitInlineEdit(t,e){var n,i;const r=this.dataManager.getTaskById(t);if(r&&!1!==(null==(i=(n=this.options).beforeTaskUpdate)?void 0:i.call(n,{task:r,updates:e})))try{this.element.dispatchEvent(new CustomEvent(it.TASK_UPDATE,{detail:{taskId:t,updates:e,updatedTask:{...r,...e},timestamp:Date.now()},bubbles:!0,composed:!0}));const n=new ni(t,e,this.commandContext);n.execute(this.commandContext),this.recordSingle(n);const i=this.dataManager.getTaskById(t)??{...r,...e};this.element.dispatchEvent(new CustomEvent(it.TASK_UPDATE_SUCCESS,{detail:{taskId:t,updatedTask:i,timestamp:Date.now()},bubbles:!0,composed:!0}))}catch(e){R.warn(`[ApexGantt] Inline edit failed for task ${t}:`,e),this.element.dispatchEvent(new CustomEvent(it.TASK_UPDATE_ERROR,{detail:{taskId:t,error:e instanceof Error?e:new Error(String(e)),timestamp:Date.now()},bubbles:!0,composed:!0}))}}getSelectedTasks(){var t;return(null==(t=this.selectionManager)?void 0:t.getSelectedTasks())??[]}setSelectedTasks(t){var e;null==(e=this.selectionManager)||e.setSelectedTasks(t)}clearSelection(){var t;null==(t=this.selectionManager)||t.clearSelection()}zoomIn(){this.zoomManager.zoomIn()}zoomOut(){this.zoomManager.zoomOut()}normalizeDimension(t){return"number"==typeof t?`${t}px`:t}setupContainerResizeObserver(){if(!this.element)return;this.containerResizeObserver&&this.containerResizeObserver.disconnect();const t=this.normalizeDimension(this.options.width),e=this.normalizeDimension(this.options.height),n="string"==typeof t&&t.includes("%"),i="string"==typeof e&&e.includes("%");(n||i)&&(this.lastKnownWidth=this.element.offsetWidth,this.lastKnownHeight=this.element.offsetHeight,this.containerResizeObserver=new ResizeObserver((t=>{for(const e of t){const t=e.contentRect.width,n=e.contentRect.height,i=Math.abs(t-this.lastKnownWidth)>1,r=Math.abs(n-this.lastKnownHeight)>1;(i||r)&&(this.lastKnownWidth=t,this.lastKnownHeight=n,this.handleContainerResize())}})),this.containerResizeObserver.observe(this.element))}handleContainerResize(){null!==this.resizeDebounceTimer&&window.clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout((()=>{this.performResize(),this.resizeDebounceTimer=null}),150)}performResize(){if(!this.element||this.isDestroyed())return;const t=this.normalizeDimension(this.options.width),e=this.normalizeDimension(this.options.height),n="string"==typeof t&&t.includes("%"),i="string"==typeof e&&e.includes("%");if(n){window.getComputedStyle(this.element.parentElement||this.element).width!==window.getComputedStyle(this.element).width&&requestAnimationFrame((()=>{this.scrollManager.positionHorizontalScrollbar(),this.scrollManager.updateHorizontalScrollbarContent(),this.layoutManager.syncTasksColumnWidths()}))}i&&requestAnimationFrame((()=>{this.layoutManager.fillEmptyRowsAfterRender()}))}destroy(){var t,e,n,i,r,s,o;this._destroyed=!0;try{this.virtualScrollCoordinator&&(this.virtualScrollCoordinator.destroy(),this.virtualScrollCoordinator=null),this.containerResizeObserver&&(this.containerResizeObserver.disconnect(),this.containerResizeObserver=null),null!==this.resizeDebounceTimer&&(window.clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=null),this.cancelPendingAfterActionsRaf(),this.detachPersistence(),this.zoomManager.cleanup(),this.scrollManager.cleanup(),this.crosshairManager.detach(),null==(t=this.keyboardNavigationManager)||t.detach(),this.contextMenuHandler&&(this.element.removeEventListener("contextmenu",this.contextMenuHandler),this.contextMenuHandler=null),this.undoRedoKeyHandler&&(this.element.removeEventListener("keydown",this.undoRedoKeyHandler),this.undoRedoKeyHandler=null),null==(e=this.contextMenuManager)||e.destroy(),null==(n=this.selectionManager)||n.destroy(),null==(i=this.dependencyEditManager)||i.detach(),null==(r=this.dependencyDrawManager)||r.detach(),null==(s=this.drawTaskManager)||s.detach(),null==(o=this.scrollButtonsManager)||o.detach(),this.reducedMotionMQL&&this.reducedMotionHandler&&(this.reducedMotionMQL.removeEventListener("change",this.reducedMotionHandler),this.reducedMotionMQL=null,this.reducedMotionHandler=null),this.cleanupEventListeners(),this.cleanupTooltips(),this.cleanupDependencyArrows(),this.columnRenderManager.destroy(),this.element.innerHTML="",this.clearDomCache(),super.destroy()}catch(t){R.error("Error during ApexGantt destruction:",t)}}isDestroyed(){return this._destroyed||!this.element}}const ci=["#3B82F6","#EF4444","#10B981","#F59E0B","#8B5CF6","#EC4899","#06B6D4","#84CC16"];function ui(t,e,n,i,r){const s=`width:${e}px;height:${e}px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;margin-left:${0===n?"0":`-${n}px`};border:2px solid ${At(i)};box-sizing:border-box;overflow:hidden;flex-shrink:0;`,o=At(t.name);if(t.avatarUrl)return`<span class="apexgantt-avatar" style="${s}" title="${o}"><img src="${At(t.avatarUrl)}" alt="${o}" style="width:100%;height:100%;object-fit:cover;display:block" /></span>`;const a=t.initials??function(t){const e=t.trim().split(/\s+/);return 0===e.length?"":1===e.length?e[0].slice(0,2).toUpperCase():(e[0][0]+e[e.length-1][0]).toUpperCase()}(t.name),l=t.color??r??function(t){let e=0;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e|=0;return ci[Math.abs(e)%ci.length]}(t.name),d=Math.max(10,Math.round(.4*e));return`<span class="apexgantt-avatar" style="${s}background:${At(l)};color:#fff;font-size:${d}px;font-weight:600;line-height:1" title="${o}">${At(a)}</span>`}const pi=Object.freeze(Object.defineProperty({__proto__:null,avatars:function(t){const{accessor:e,max:n=4,size:i=24,overlap:r=8,borderColor:s="#FFFFFF",fallbackColor:o}=t;return t=>{const a=e(t.task);if(!a||0===a.length)return"";const l=a.slice(0,n),d=a.length-l.length,h=l.map(((t,e)=>ui(t,i,0===e?0:r,s,o))).join(""),c=d>0?function(t,e,n,i){const r=Math.max(10,Math.round(.36*e));return`<span class="apexgantt-avatar-overflow" style="width:${e}px;height:${e}px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;margin-left:-${n}px;border:2px solid ${At(i)};box-sizing:border-box;background:#E5E7EB;color:#374151;font-size:${r}px;font-weight:600;flex-shrink:0;line-height:1;">+${t}</span>`}(d,i,r,s):"";return`<div class="apexgantt-avatar-stack" style="display:inline-flex;align-items:center;vertical-align:middle">${h}${c}</div>`}},progressRing:function(t={}){const{accessor:e=(t=>t.progress),size:n=32,strokeWidth:i=3,progressColor:r="#EF4444",trackColor:s="#E5E7EB",showLabel:o=!0,labelColor:a}=t;return t=>{const l=e(t.task),d="number"==typeof l&&Number.isFinite(l)?l:0,h="function"==typeof r?r(t.task,Math.max(0,Math.min(100,d))):r;return Dt({value:d,size:n,strokeWidth:i,progressColor:h,trackColor:s,showLabel:o,labelColor:a})}}},Symbol.toStringTag,{value:"Module"})),mi={tooltipBGColor:"#FFFFFF",tooltipBorderColor:"#CCCCCC",tooltipTextColor:"#333333",cellBorderColor:"#D0D7DE",rowBackgroundColors:["#FFFFFF","#F5F9FF"],headerBackground:"#EBF3FB",headerTextColor:"#333333",barBackgroundColor:"#87B7FE",barTextColor:"#FFFFFF",arrowColor:"#94A3B8",backgroundColor:"#FFFFFF",textColor:"#000000",borderColor:"#DFE0E1",annotationBgColor:"#DBEAFE",annotationBorderColor:"#60A5FA",dialogBgColor:"#FFFFFF",dialogBorderColor:"#EEEEEE",buttonBgColor:"#87B7FE",buttonTextColor:"#FFFFFF",buttonHoverBgColor:"#1A6FC4",toolbarBgColor:"#FFFFFF",toolbarBorderColor:"#BCBCBC",toolbarHoverBgColor:"#F0F7FF",scrollbarTrackColor:"#F5F5F5",scrollbarThumbColor:"#C1C1C1",scrollbarThumbHoverColor:"#A8A8A8",splitBarColor:"#DEE2E6",splitBarHoverColor:"#87B7FE",splitBarBorderColor:"#BBBBBB",splitBarHandleColor:"#666666",summaryBarColor:"#B9CECE",milestoneColor:"#7C3AED",criticalBarColor:"#E53935",criticalArrowColor:"#E53935"},gi={tooltipBGColor:"#2D2D2D",tooltipBorderColor:"#444444",tooltipTextColor:"#E0E0E0",cellBorderColor:"#3A3A3A",rowBackgroundColors:["#1E1E1E","#252525"],headerBackground:"#2A2A2A",headerTextColor:"#E0E0E0",barBackgroundColor:"#818CF8",barTextColor:"#FFFFFF",arrowColor:"#94A3B8",backgroundColor:"#1E1E1E",textColor:"#E0E0E0",borderColor:"#3A3A3A",annotationBgColor:"#4A2D4D",annotationBorderColor:"#8B4D8F",dialogBgColor:"#2D2D2D",dialogBorderColor:"#444444",buttonBgColor:"#6366F1",buttonTextColor:"#FFFFFF",buttonHoverBgColor:"#4F46E5",toolbarBgColor:"#2D2D2D",toolbarBorderColor:"#444444",toolbarHoverBgColor:"#3A3A3A",scrollbarTrackColor:"#000",scrollbarThumbColor:"#4A4A4A",scrollbarThumbHoverColor:"#5A5A5A",splitBarColor:"#3A3A3A",splitBarHoverColor:"#818CF8",splitBarBorderColor:"#4A4A4A",splitBarHandleColor:"#666666",summaryBarColor:"#8FBCBC",milestoneColor:"#A78BFA",criticalBarColor:"#F87171",criticalArrowColor:"#F87171"};function fi(t){return"dark"===t?gi:mi}"undefined"!=typeof window&&(Object.assign(hi,{ColumnKey:It,ColumnList:Lt,renderers:pi,escapeHtml:At}),window.ApexGantt=hi);export{hi as ApexGantt,It as ColumnKey,Lt as ColumnList,pt as DEFAULT_GANTT_MESSAGES,gi as DarkTheme,sn as DataParser,it as GanttEvents,mi as LightTheme,lt as Orientation,Jt as TaskType,hi as default,At as escapeHtml,fi as getTheme,pi as renderers};
|
|
1
|
+
const t=()=>{};class e{constructor(t,e){this.injectedStyles=new Set,this.trackedTooltips=new Set,this.instanceId=e||Math.random().toString(36).substr(2,9),this.context=this.detectContext(t),this.chartContainer=t}getChartContainer(){return this.chartContainer}getChartScopedContainer(){return this.context===document?document.body||document.getElementsByTagName("body")[0]:this.chartContainer||this.context}detectContext(t){const e=t.getRootNode();return e instanceof ShadowRoot?e:document}getContext(){return this.context}getInstanceId(){return this.instanceId}isShadowDOM(){return this.context instanceof ShadowRoot}createElement(t){return document.createElement(t)}createElementNS(t,e){return document.createElementNS(t,e)}createTextNode(t){return document.createTextNode(t)}getElementById(t){return this.context===document?document.getElementById(t):this.context.querySelector(`#${t}`)}getElementsByClassName(t){if(this.context===document)return document.getElementsByClassName(t);const e=this.context.querySelectorAll(`.${t}`),n=Array.from(e);return{item:t=>n[t]||null,get length(){return n.length},[Symbol.iterator]:()=>n[Symbol.iterator](),...Object.fromEntries(n.map(((t,e)=>[e,t])))}}querySelector(t){return this.context.querySelector(t)}querySelectorAll(t){return this.context.querySelectorAll(t)}getAppendContainer(){return this.context===document?document.body||document.getElementsByTagName("body")[0]:this.context}getChartBounds(){var t;return(null==(t=this.chartContainer)?void 0:t.getBoundingClientRect())||new DOMRect}getBody(){if(this.context===document)return document.body||document.getElementsByTagName("body")[0];return this.context.host}dispatchEvent(t){this.context===document?document.dispatchEvent(t):this.context.dispatchEvent(t)}addEventListener(t,e,n){this.context===document||"mousemove"===t||"mouseup"===t||"keydown"===t?document.addEventListener(t,e,n):this.context.addEventListener(t,e,n)}removeEventListener(t,e,n){this.context===document||"mousemove"===t||"mouseup"===t||"keydown"===t?document.removeEventListener(t,e,n):this.context.removeEventListener(t,e,n)}injectStyles(t,e,n={}){const{force:i=!1,priority:r="normal"}=n;if(!i&&this.injectedStyles.has(e))return;if(i){const t=this.context.querySelector(`#${e}`);t&&(t.remove(),this.injectedStyles.delete(e))}if(this.context.querySelector(`#${e}`)&&!i)return void this.injectedStyles.add(e);const s=document.createElement("style");if(s.id=e,s.textContent=t,"normal"!==r&&s.setAttribute("data-priority",r),this.context===document)document.head.appendChild(s);else{const t=this.context;"high"===r?t.insertBefore(s,t.firstChild):t.appendChild(s)}this.injectedStyles.add(e)}injectStylesheets(t){t.forEach((({content:t,id:e,options:n})=>{this.injectStyles(t,e,n)}))}hasInjectedStyles(t){return this.injectedStyles.has(t)}removeStyles(t){const e=this.context.querySelector(`#${t}`);e&&(e.remove(),this.injectedStyles.delete(t))}removeAllStyles(){this.injectedStyles.forEach((t=>{const e=this.context.querySelector(`#${t}`);e&&e.remove()})),this.injectedStyles.clear()}getInjectedStyleIds(){return Array.from(this.injectedStyles)}getActiveElement(){if(this.context===document)return document.activeElement;return this.context.activeElement||document.activeElement}trackTooltip(t){this.trackedTooltips.add(t)}destroy(){this.removeAllStyles(),this.injectedStyles.clear(),this.trackedTooltips.forEach((t=>t.remove())),this.trackedTooltips.clear()}}class n{constructor(t,n){if(!t)throw new Error("Container element is required");this.element=t,this.chartContext=new e(t,n)}getContext(){return this.chartContext}isShadowDOM(){return this.chartContext.isShadowDOM()}getTooltipContainer(){return this.chartContext.getAppendContainer()}injectStyles(t,e){this.chartContext.injectStyles(t,e)}createElement(t){return this.chartContext.createElement(t)}querySelector(t){return this.chartContext.querySelector(t)}addEventListener(t,e,n){this.chartContext.addEventListener(t,e,n)}removeEventListener(t,e,n){this.chartContext.removeEventListener(t,e,n)}dispatchEvent(t){this.chartContext.dispatchEvent(t)}destroy(){this.chartContext.destroy()}getInstanceId(){return this.chartContext.getInstanceId()}}const i="\n #toolbar {\n display: flex;\n gap: 2px;\n position: absolute;\n /* Logical inset: stays on the right in LTR, mirrors to the left in RTL\n (so it never collides with RTL-flipped chrome such as the search box). */\n inset-inline-end: 12px;\n top: 12px;\n z-index: 100;\n user-select: none;\n background: var(--toolbar-bg-color, rgba(255, 255, 255, 0.92));\n border: 1px solid var(--toolbar-border-color, rgba(0, 0, 0, 0.08));\n border-radius: 10px;\n padding: 4px;\n box-shadow:\n 0 1px 3px rgba(0, 0, 0, 0.08),\n 0 4px 12px rgba(0, 0, 0, 0.06);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n }\n\n .toolbar-item {\n align-items: center;\n background-color: transparent;\n border: none;\n border-radius: 6px;\n color: var(--toolbar-icon-color, #444);\n cursor: pointer;\n display: flex;\n height: 30px;\n justify-content: center;\n width: 30px;\n transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;\n position: relative;\n flex-shrink: 0;\n }\n\n .toolbar-item:hover {\n background-color: var(--toolbar-hover-bg-color, rgba(0, 0, 0, 0.06));\n color: var(--toolbar-icon-hover-color, #111);\n transform: translateY(-1px);\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);\n }\n\n .toolbar-item:active {\n transform: translateY(0);\n box-shadow: none;\n background-color: var(--toolbar-active-bg-color, rgba(0, 0, 0, 0.1));\n }\n\n .toolbar-item:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px var(--button-bg-color, #0066cc);\n }\n\n .toolbar-item svg {\n width: 15px;\n height: 15px;\n pointer-events: none;\n flex-shrink: 0;\n }\n\n .toolbar-item[disabled] {\n opacity: 0.4;\n cursor: not-allowed;\n pointer-events: none;\n }\n\n /* Tooltip */\n .toolbar-item::after {\n content: attr(data-tooltip);\n position: absolute;\n bottom: calc(100% + 8px);\n left: 50%;\n transform: translateX(-50%);\n background: var(--tooltip-bg-color, rgba(30, 30, 30, 0.92));\n color: var(--tooltip-text-color, #fff);\n padding: 5px 9px;\n border-radius: 6px;\n font-size: 11.5px;\n font-weight: 500;\n white-space: nowrap;\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.15s ease;\n z-index: 1000;\n letter-spacing: 0.01em;\n }\n\n .toolbar-item::before {\n content: '';\n position: absolute;\n bottom: calc(100% + 3px);\n left: 50%;\n transform: translateX(-50%);\n border: 4px solid transparent;\n border-top-color: var(--tooltip-bg-color, rgba(30, 30, 30, 0.92));\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.15s ease;\n z-index: 1000;\n }\n\n .toolbar-item:hover::after,\n .toolbar-item:hover::before {\n opacity: 1;\n }\n\n /* Shadow DOM specific adjustments */\n :host #toolbar {\n display: flex;\n gap: 2px;\n position: absolute;\n inset-inline-end: 12px;\n top: 12px;\n z-index: 100;\n }\n";function r(t){const e=t.getRootNode();return e instanceof ShadowRoot?e.host:t.parentElement}function s(t,e){const n=t.getBoundingClientRect(),i=e.getBoundingClientRect(),s=function(t){let e=1,n=1,i=0,s=0,o=t.parentElement;for(;o&&o!==document.body&&o!==document.documentElement;){const t=window.getComputedStyle(o),a=t.scale;if(a&&"none"!==a){const t=a.split(" ").map(parseFloat);1===t.length?(e*=t[0],n*=t[0]):t.length>=2&&(e*=t[0],n*=t[1])}const l=t.transform;if(l&&"none"!==l)try{const t=new DOMMatrix(l);e*=t.a,n*=t.d,i+=t.e,s+=t.f}catch{}o=r(o)}return{scaleX:e,scaleY:n,translateX:i,translateY:s}}(e),o=function(t){const e=window.getComputedStyle(t);let n=1,i=1,r=0,s=0,o=0;const a=e.scale;if(a&&"none"!==a){const t=a.split(" ").map(parseFloat);1===t.length?(n=t[0],i=t[0]):t.length>=2&&(n=t[0],i=t[1])}const l=e.transform;if(l&&"none"!==l)try{const t=new DOMMatrix(l);n*=t.a,i*=t.d,r=t.e,s=t.f,o=Math.atan2(t.b,t.a)}catch{}return{scaleX:n,scaleY:i,translateX:r,translateY:s,rotation:o}}(t),a=s.scaleX||1,l=s.scaleY||1,d=(n.left-i.left)/a,h=(n.top-i.top)/l,c=n.width/a,u=n.height/l;if(Math.abs(o.rotation)>.01){const t=d+c/2,e=h+u/2;return{left:t,right:t,top:e,bottom:e,width:0,height:0}}return{left:d,right:d+c,top:h,bottom:h+u,width:c,height:u}}const o=(t,e="apex-tooltip-container")=>{let n=t.getElementById(e);if(!n){n=t.createElement("div"),n.id=e,n.setAttribute("role","tooltip"),n.setAttribute("aria-hidden","true");t.getAppendContainer().appendChild(n),t.trackTooltip(n)}return n},a=(t={})=>{const e=[];for(const i in t){const r=`${n=i,n.replace(/([A-Z])/g,(t=>`-${t.toLowerCase()}`))}: ${t[i]};`;e.push(r)}var n;return e.join(" ")};function l(t,{className:e="",content:n,style:i={}}={}){const r=d(t,"div",{className:e,innerHTML:n||""});return r.setAttribute("style",a(i)),r}function d(t,e,n={}){const i=t.createElement(e);return Object.assign(i,n)}function h(t,e){if(!t)return"#000000";3===(t=t.replace(/^#/,"")).length&&(t=t.split("").map((t=>t+t)).join(""));const n=parseInt(t,16),i=(n>>16&255)/255,r=(n>>8&255)/255,s=(255&n)/255,o=Math.max(i,r,s),a=Math.min(i,r,s),l=o-a;let d=0,h=0;const c=(o+a)/2;0!==l&&(h=l/(1-Math.abs(2*c-1)),d=o===i?((r-s)/l%6+6)%6:o===r?(s-i)/l+2:(i-r)/l+4,d*=60);const u=((d+(e.h??0))%360+360)%360,p=Math.min(1,Math.max(0,h+(e.s??0)/100)),m=Math.min(1,Math.max(0,c+(e.l??0)/100)),g=(1-Math.abs(2*m-1))*p,f=g*(1-Math.abs(u/60%2-1)),b=m-g/2;let v=0,y=0,x=0;u<60?(v=g,y=f):u<120?(v=f,y=g):u<180?(y=g,x=f):u<240?(y=f,x=g):u<300?(v=f,x=g):(v=g,x=f);const w=t=>Math.round(255*(t+b)).toString(16).padStart(2,"0");return`#${w(v)}${w(y)}${w(x)}`}const c=globalThis.console;function u(t){c.error(t)}function p(t){c.warn(t)}const m="APEX-",g=new Date("2027-07-31T00:00:00Z"),f="__apex_license_v1__";function b(){const t=globalThis;let e=t[f];return e||(e={key:null,listeners:new Set,result:null},t[f]=e),e}const v=class{static get licenseKey(){return b().key}static set licenseKey(t){b().key=t}static get listeners(){return b().listeners}static get validationResult(){return b().result}static set validationResult(t){b().result=t}static getKey(){return this.licenseKey}static getLicenseStatus(){return this.licenseKey?(this.validationResult=this.validateKey(this.licenseKey),this.validationResult):{expired:!1,signatureVerified:!1,valid:!1}}static isKeyValid(t){return!!t&&this.validateKey(t).valid}static isLicenseValid(){return this.getLicenseStatus().valid}static onChange(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}static setLicense(t){var e;if(!t)return this.licenseKey=null,void this.publish({expired:!1,signatureVerified:!1,valid:!1});const n=this.validateKey(t);n.valid||t===this.licenseKey||!(null==(e=this.validationResult)?void 0:e.valid)?(this.licenseKey=t,this.publish(n),n.valid||u(`[Apex] ${n.message}`)):p(`[Apex] Ignoring license key: ${n.message??"it is not valid"} A valid license is already active on this page.`)}static validateKey(t){const e=this.parseKey(t),n=this.validateStructure(t,e);if(!n.valid||!(null==e?void 0:e.signature))return n;const i=this.verdicts.get(t);return!1===i?{data:e.data,expired:!1,message:"Invalid license key. The license signature does not verify.",signatureVerified:!0,valid:!1}:(void 0===i&&this.verifySignature(t,e,n),{...n,signatureVerified:!0===i})}static _resetSignatureState(){this.verdicts.clear(),this.verifying.clear(),this.warnedUnverifiable=!1,this.epoch++}static base64ToBytes(t){const e=t.replace(/-/g,"+").replace(/_/g,"/"),n=e.padEnd(4*Math.ceil(e.length/4),"="),i=globalThis.atob;if("function"!=typeof i)throw new Error("no base64 decoder available");const r=i(n),s=new Uint8Array(r.length);for(let t=0;t<r.length;t++)s[t]=r.charCodeAt(t);return s}static canonicalPayload(t){const e=t.domains&&t.domains.length>0?t.domains.join(","):"";return`v1|${t.issueDate}|${t.expiryDate}|${t.plan}|${e}`}static notify(t){for(const e of this.listeners)try{e(t)}catch{}}static parseKey(t){if("string"!=typeof t||!t.startsWith(m))return null;const e=t.slice(5);if(!e)return null;try{const t=(new TextDecoder).decode(this.base64ToBytes(e)),n=JSON.parse(t);return n.issueDate&&n.expiryDate&&n.plan?{data:{domains:Array.isArray(n.domains)?n.domains:void 0,expiryDate:n.expiryDate,issueDate:n.issueDate,plan:n.plan,valid:!0},signature:"string"==typeof n.sig&&n.sig?n.sig:null}:null}catch{return null}}static publish(t){this.validationResult=t,this.notify(t)}static validateStructure(t,e){const n=t=>({expired:!1,message:t,signatureVerified:!1,valid:!1});if("string"!=typeof t||!t.startsWith(m))return n('Invalid license key format. License key must start with "APEX-".');if(!e)return n("Invalid license key. Unable to decode license data.");const{data:i,signature:r}=e;if(!r&&new Date>=g)return n("This license key is in the old unsigned format, which is no longer accepted. Please request a replacement key.");if(new Date(i.expiryDate)<new Date)return{data:i,expired:!0,message:`License expired on ${i.expiryDate}. Please renew your license.`,signatureVerified:!1,valid:!1};if(i.domains&&i.domains.length>0){const t="undefined"==typeof location?"":location.hostname;if(!i.domains.some((e=>t===e||t.endsWith(`.${e}`))))return{data:i,expired:!1,message:`License is not valid for this domain (${t}). Allowed domains: ${i.domains.join(", ")}.`,signatureVerified:!1,valid:!1}}return{data:i,expired:!1,signatureVerified:!1,valid:!0}}static async verifySignature(t,e,n){var i;if(this.verifying.has(t)||this.verdicts.has(t))return;this.verifying.add(t);const r=this.epoch,s=null==(i=globalThis.crypto)?void 0:i.subtle;if(!s||0===this.publicKeysSpki.length)return this.verifying.delete(t),void(this.warnedUnverifiable||(this.warnedUnverifiable=!0,p(s?"[Apex] No license signing key is configured in this build, so license signatures cannot be verified.":"[Apex] Web Crypto is unavailable (a secure context is required), so the license signature cannot be verified.")));const o=(new TextEncoder).encode(this.canonicalPayload(e.data));let a=!1;for(const t of this.publicKeysSpki){try{const n=await s.importKey("spki",this.base64ToBytes(t),{name:"ECDSA",namedCurve:"P-256"},!1,["verify"]);a=await s.verify({hash:"SHA-256",name:"ECDSA"},n,this.base64ToBytes(e.signature),o)}catch{a=!1}if(a)break}if(this.verifying.delete(t),this.epoch!==r)return;if(this.verdicts.set(t,a),a){const e={...n,signatureVerified:!0};return void(this.licenseKey===t?this.publish(e):this.notify(e))}const l="Invalid license key. The license signature does not verify.",d={data:e.data,expired:!1,message:l,signatureVerified:!0,valid:!1};this.licenseKey===t?this.publish(d):this.notify(d),u(`[Apex] ${l}`)}};v.publicKeysSpki=["MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEQIaK9UMD6n0oR/FIy8QdL0uSzKMQlf1BB+tOrji4/WuHsyRNxeDhVykoSsNURozMi1xhmqWvBH1L//xIfugTPA=="],v.verdicts=new Map,v.verifying=new Set,v.warnedUnverifiable=!1,v.epoch=0;let y=v;const x=class{static applyStyles(t){Object.assign(t.style,this.CRITICAL_STYLES,{backgroundImage:this.createWatermarkPattern(),backgroundRepeat:"repeat"})}static node(t){return t?t.querySelector(`[${this.WATERMARK_ATTR}]`):null}static add(t,e){return t&&"undefined"!=typeof document?(this.setManaged(t,e),this.paint(t)):null}static exists(t){return!!this.node(t)}static remove(t,e){t&&(this.setManaged(t,e),this.erase(t))}static untrack(t){this.managed.delete(t)}static createWatermarkPattern(){const t=this.WATERMARK_TEXT;return`url("data:image/svg+xml,${encodeURIComponent(`\n <svg xmlns="http://www.w3.org/2000/svg" width="300" height="200">\n <text\n x="50%"\n y="50%"\n dominant-baseline="middle"\n text-anchor="middle"\n font-family="-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Arial, sans-serif"\n font-size="18"\n font-weight="600"\n fill="rgba(134, 134, 134, 0.1)"\n transform="rotate(-35, 100, 60)"\n >${t}</text>\n </svg>\n `.trim())}")`}static erase(t){var e;null==(e=this.node(t))||e.remove()}static paint(t){let e=this.node(t);return e||(e=document.createElement("div"),e.setAttribute(this.WATERMARK_ATTR,""),t.appendChild(e)),this.applyStyles(e),"function"==typeof getComputedStyle&&"static"===getComputedStyle(t).position&&(t.style.position="relative"),e}static reconcile(){const t=y.isLicenseValid();for(const e of this.managed)e.isConnected?t?this.erase(e):this.paint(e):this.managed.delete(e)}static setManaged(t,e){!1!==(null==e?void 0:e.manage)?this.track(t):this.managed.delete(t)}static track(t){this.managed.add(t),this.subscribed||(this.subscribed=!0,y.onChange((()=>{this.reconcile()})))}};x.WATERMARK_ATTR="data-apexcharts-watermark",x.WATERMARK_TEXT="APEXCHARTS",x.ATTR="data-apexcharts-watermark",x.CRITICAL_STYLES={bottom:"0",display:"block",left:"0",msUserSelect:"none",opacity:"1",pointerEvents:"none",position:"absolute",right:"0",top:"0",userSelect:"none",visibility:"visible",webkitUserSelect:"none",zIndex:"10000"},x.managed=new Set,x.subscribed=!1;let w=x;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function k(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var C={exports:{}};C.exports=function(){var t=1e3,e=6e4,n=36e5,i="millisecond",r="second",s="minute",o="hour",a="day",l="week",d="month",h="quarter",c="year",u="date",p="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,g=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,f={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},b=function(t,e,n){var i=String(t);return!i||i.length>=e?t:""+Array(e+1-i.length).join(n)+t},v={s:b,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),i=Math.floor(n/60),r=n%60;return(e<=0?"+":"-")+b(i,2,"0")+":"+b(r,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var i=12*(n.year()-e.year())+(n.month()-e.month()),r=e.clone().add(i,d),s=n-r<0,o=e.clone().add(i+(s?-1:1),d);return+(-(i+(n-r)/(s?r-o:o-r))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:d,y:c,w:l,d:a,D:u,h:o,m:s,s:r,ms:i,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},y="en",x={};x[y]=f;var w="$isDayjsObject",k=function(t){return t instanceof E||!(!t||!t[w])},C=function t(e,n,i){var r;if(!e)return y;if("string"==typeof e){var s=e.toLowerCase();x[s]&&(r=s),n&&(x[s]=n,r=s);var o=e.split("-");if(!r&&o.length>1)return t(o[0])}else{var a=e.name;x[a]=e,r=a}return!i&&r&&(y=r),r||!i&&y},S=function(t,e){if(k(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new E(n)},M=v;M.l=C,M.i=k,M.w=function(t,e){return S(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var E=function(){function f(t){this.$L=C(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[w]=!0}var b=f.prototype;return b.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(M.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var i=e.match(m);if(i){var r=i[2]-1||0,s=(i[7]||"0").substring(0,3);return n?new Date(Date.UTC(i[1],r,i[3]||1,i[4]||0,i[5]||0,i[6]||0,s)):new Date(i[1],r,i[3]||1,i[4]||0,i[5]||0,i[6]||0,s)}}return new Date(e)}(t),this.init()},b.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},b.$utils=function(){return M},b.isValid=function(){return!(this.$d.toString()===p)},b.isSame=function(t,e){var n=S(t);return this.startOf(e)<=n&&n<=this.endOf(e)},b.isAfter=function(t,e){return S(t)<this.startOf(e)},b.isBefore=function(t,e){return this.endOf(e)<S(t)},b.$g=function(t,e,n){return M.u(t)?this[e]:this.set(n,t)},b.unix=function(){return Math.floor(this.valueOf()/1e3)},b.valueOf=function(){return this.$d.getTime()},b.startOf=function(t,e){var n=this,i=!!M.u(e)||e,h=M.p(t),p=function(t,e){var r=M.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return i?r:r.endOf(a)},m=function(t,e){return M.w(n.toDate()[t].apply(n.toDate("s"),(i?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},g=this.$W,f=this.$M,b=this.$D,v="set"+(this.$u?"UTC":"");switch(h){case c:return i?p(1,0):p(31,11);case d:return i?p(1,f):p(0,f+1);case l:var y=this.$locale().weekStart||0,x=(g<y?g+7:g)-y;return p(i?b-x:b+(6-x),f);case a:case u:return m(v+"Hours",0);case o:return m(v+"Minutes",1);case s:return m(v+"Seconds",2);case r:return m(v+"Milliseconds",3);default:return this.clone()}},b.endOf=function(t){return this.startOf(t,!1)},b.$set=function(t,e){var n,l=M.p(t),h="set"+(this.$u?"UTC":""),p=(n={},n[a]=h+"Date",n[u]=h+"Date",n[d]=h+"Month",n[c]=h+"FullYear",n[o]=h+"Hours",n[s]=h+"Minutes",n[r]=h+"Seconds",n[i]=h+"Milliseconds",n)[l],m=l===a?this.$D+(e-this.$W):e;if(l===d||l===c){var g=this.clone().set(u,1);g.$d[p](m),g.init(),this.$d=g.set(u,Math.min(this.$D,g.daysInMonth())).$d}else p&&this.$d[p](m);return this.init(),this},b.set=function(t,e){return this.clone().$set(t,e)},b.get=function(t){return this[M.p(t)]()},b.add=function(i,h){var u,p=this;i=Number(i);var m=M.p(h),g=function(t){var e=S(p);return M.w(e.date(e.date()+Math.round(t*i)),p)};if(m===d)return this.set(d,this.$M+i);if(m===c)return this.set(c,this.$y+i);if(m===a)return g(1);if(m===l)return g(7);var f=(u={},u[s]=e,u[o]=n,u[r]=t,u)[m]||1,b=this.$d.getTime()+i*f;return M.w(b,this)},b.subtract=function(t,e){return this.add(-1*t,e)},b.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var i=t||"YYYY-MM-DDTHH:mm:ssZ",r=M.z(this),s=this.$H,o=this.$m,a=this.$M,l=n.weekdays,d=n.months,h=n.meridiem,c=function(t,n,r,s){return t&&(t[n]||t(e,i))||r[n].slice(0,s)},u=function(t){return M.s(s%12||12,t,"0")},m=h||function(t,e,n){var i=t<12?"AM":"PM";return n?i.toLowerCase():i};return i.replace(g,(function(t,i){return i||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return M.s(e.$y,4,"0");case"M":return a+1;case"MM":return M.s(a+1,2,"0");case"MMM":return c(n.monthsShort,a,d,3);case"MMMM":return c(d,a);case"D":return e.$D;case"DD":return M.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return c(n.weekdaysMin,e.$W,l,2);case"ddd":return c(n.weekdaysShort,e.$W,l,3);case"dddd":return l[e.$W];case"H":return String(s);case"HH":return M.s(s,2,"0");case"h":return u(1);case"hh":return u(2);case"a":return m(s,o,!0);case"A":return m(s,o,!1);case"m":return String(o);case"mm":return M.s(o,2,"0");case"s":return String(e.$s);case"ss":return M.s(e.$s,2,"0");case"SSS":return M.s(e.$ms,3,"0");case"Z":return r}return null}(t)||r.replace(":","")}))},b.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},b.diff=function(i,u,p){var m,g=this,f=M.p(u),b=S(i),v=(b.utcOffset()-this.utcOffset())*e,y=this-b,x=function(){return M.m(g,b)};switch(f){case c:m=x()/12;break;case d:m=x();break;case h:m=x()/3;break;case l:m=(y-v)/6048e5;break;case a:m=(y-v)/864e5;break;case o:m=y/n;break;case s:m=y/e;break;case r:m=y/t;break;default:m=y}return p?m:M.a(m)},b.daysInMonth=function(){return this.endOf(d).$D},b.$locale=function(){return x[this.$L]},b.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),i=C(t,e,!0);return i&&(n.$L=i),n},b.clone=function(){return M.w(this.$d,this)},b.toDate=function(){return new Date(this.valueOf())},b.toJSON=function(){return this.isValid()?this.toISOString():null},b.toISOString=function(){return this.$d.toISOString()},b.toString=function(){return this.$d.toUTCString()},f}(),T=E.prototype;return S.prototype=T,[["$ms",i],["$s",r],["$m",s],["$H",o],["$W",a],["$M",d],["$y",c],["$D",u]].forEach((function(t){T[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),S.extend=function(t,e){return t.$i||(t(e,E,S),t.$i=!0),S},S.locale=C,S.isDayjs=k,S.unix=function(t){return S(1e3*t)},S.en=x[y],S.Ls=x,S.p={},S}();const S=k(C.exports);var M={exports:{}};const E=k(M.exports=function(t,e){e.prototype.isSameOrBefore=function(t,e){return this.isSame(t,e)||this.isBefore(t,e)}});var T={exports:{}};T.exports=function(t,e,n){var i=function(t,e){if(!e||!e.length||1===e.length&&!e[0]||1===e.length&&Array.isArray(e[0])&&!e[0].length)return null;var n;1===e.length&&e[0].length>0&&(e=e[0]),n=(e=e.filter((function(t){return t})))[0];for(var i=1;i<e.length;i+=1)e[i].isValid()&&!e[i][t](n)||(n=e[i]);return n};n.max=function(){var t=[].slice.call(arguments,0);return i("isAfter",t)},n.min=function(){var t=[].slice.call(arguments,0);return i("isBefore",t)}};const A=k(T.exports);var D,I,$={exports:{}};const F=k($.exports=(D="month",I="quarter",function(t,e){var n=e.prototype;n.quarter=function(t){return this.$utils().u(t)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(t-1))};var i=n.add;n.add=function(t,e){return t=Number(t),this.$utils().p(e)===I?this.add(3*t,D):i.bind(this)(t,e)};var r=n.startOf;n.startOf=function(t,e){var n=this.$utils(),i=!!n.u(e)||e;if(n.p(t)===I){var s=this.quarter()-1;return i?this.month(3*s).startOf(D).startOf("day"):this.month(3*s+2).endOf(D).endOf("day")}return r.bind(this)(t,e)}}));var B={exports:{}};B.exports=function(t,e){e.prototype.weekday=function(t){var e=this.$locale().weekStart||0,n=this.$W,i=(n<e?n+7:n)-e;return this.$utils().u(t)?i:this.subtract(i,"day").add(t,"day")}};const L=k(B.exports);var R={exports:{}};R.exports=function(){var t="week",e="year";return function(n,i,r){var s=i.prototype;s.week=function(n){if(void 0===n&&(n=null),null!==n)return this.add(7*(n-this.week()),"day");var i=this.$locale().yearStart||1;if(11===this.month()&&this.date()>25){var s=r(this).startOf(e).add(1,e).date(i),o=r(this).endOf(t);if(s.isBefore(o))return 1}var a=r(this).startOf(e).date(i).startOf(t).subtract(1,"millisecond"),l=this.diff(a,t,!0);return l<0?r(this).startOf("week").week():Math.ceil(l)},s.weeks=function(t){return void 0===t&&(t=null),this.week(t)}}}();const H=k(R.exports),P=globalThis.console,z={warn(...t){P.warn(...t)},error(...t){P.error(...t)}};class O{constructor(){this.cleanups=new Map,this.observer=null}dispatch(t,e,n){let i;this.cleanupCell(n);try{i=t(e,n)}catch(t){return void z.error("Column renderer threw:",t)}"string"==typeof i?n.innerHTML=i:"function"==typeof i&&this.cleanups.set(n,i)}observe(t){this.disconnect(),"undefined"!=typeof MutationObserver&&(this.observer=new MutationObserver((t=>{for(const e of t)e.removedNodes.forEach((t=>{t instanceof HTMLElement&&this.cleanupSubtree(t)}))})),this.observer.observe(t,{childList:!0,subtree:!0}))}disconnect(){var t;null==(t=this.observer)||t.disconnect(),this.observer=null}flushCleanups(){const t=Array.from(this.cleanups.values());this.cleanups.clear(),t.forEach((t=>this.invokeCleanup(t)))}destroy(){this.disconnect(),this.flushCleanups()}cleanupCell(t){const e=this.cleanups.get(t);e&&(this.cleanups.delete(t),this.invokeCleanup(e))}cleanupSubtree(t){if(0===this.cleanups.size)return;const e=[];this.cleanups.forEach(((n,i)=>{(t===i||t.contains(i))&&e.push(i)})),e.forEach((t=>this.cleanupCell(t)))}invokeCleanup(t){try{t()}catch(t){z.error("Column renderer cleanup threw:",t)}}}function W(t){return"number"==typeof t.leadingPadding&&t.leadingPadding>=0?t.leadingPadding:"left"===t.position?120:0}function N(t,e,n){if(e.render){const i=e.render(n);if(null==i){const i=e.field??"name";return void(t.textContent=String(n[i]??""))}return void("string"==typeof i?t.innerHTML=i:t.replaceChildren(i))}const i=e.field??"name";t.textContent=String(n[i]??"")}function q(t,e){const n=t.getInstanceId(),i=`.bar-container .bar-timeline[data-taskid="${e}"][data-chart-instance="${n}"]`,r=t.querySelector(i);return r||z.warn(`[${n}] Bar element not found for task: ${e}`),r}function Y(t,e){const n=t.getInstanceId(),i=`.timeline-body .timeline-data-row[data-taskid="${e}"][data-chart-instance="${n}"]`,r=t.querySelector(i);return r||z.warn(`[${n}] Bar row element not found for task: ${e}`),r}var U={exports:{}};U.exports=function(){var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},e=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,i=/\d\d/,r=/\d\d?/,s=/\d*[^-_:/,()\s\d]+/,o={},a=function(t){return(t=+t)+(t>68?1900:2e3)},l=function(t){return function(e){this[t]=+e}},d=[/[+-]\d\d:?(\d\d)?|Z/,function(t){(this.zone||(this.zone={})).offset=function(t){if(!t)return 0;if("Z"===t)return 0;var e=t.match(/([+-]|\d\d)/g),n=60*e[1]+(+e[2]||0);return 0===n?0:"+"===e[0]?-n:n}(t)}],h=function(t){var e=o[t];return e&&(e.indexOf?e:e.s.concat(e.f))},c=function(t,e){var n,i=o.meridiem;if(i){for(var r=1;r<=24;r+=1)if(t.indexOf(i(r,0,e))>-1){n=r>12;break}}else n=t===(e?"pm":"PM");return n},u={A:[s,function(t){this.afternoon=c(t,!1)}],a:[s,function(t){this.afternoon=c(t,!0)}],Q:[n,function(t){this.month=3*(t-1)+1}],S:[n,function(t){this.milliseconds=100*+t}],SS:[i,function(t){this.milliseconds=10*+t}],SSS:[/\d{3}/,function(t){this.milliseconds=+t}],s:[r,l("seconds")],ss:[r,l("seconds")],m:[r,l("minutes")],mm:[r,l("minutes")],H:[r,l("hours")],h:[r,l("hours")],HH:[r,l("hours")],hh:[r,l("hours")],D:[r,l("day")],DD:[i,l("day")],Do:[s,function(t){var e=o.ordinal,n=t.match(/\d+/);if(this.day=n[0],e)for(var i=1;i<=31;i+=1)e(i).replace(/\[|\]/g,"")===t&&(this.day=i)}],w:[r,l("week")],ww:[i,l("week")],M:[r,l("month")],MM:[i,l("month")],MMM:[s,function(t){var e=h("months"),n=(h("monthsShort")||e.map((function(t){return t.slice(0,3)}))).indexOf(t)+1;if(n<1)throw new Error;this.month=n%12||n}],MMMM:[s,function(t){var e=h("months").indexOf(t)+1;if(e<1)throw new Error;this.month=e%12||e}],Y:[/[+-]?\d+/,l("year")],YY:[i,function(t){this.year=a(t)}],YYYY:[/\d{4}/,l("year")],Z:d,ZZ:d};function p(n){var i,r;i=n,r=o&&o.formats;for(var s=(n=i.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(e,n,i){var s=i&&i.toUpperCase();return n||r[i]||t[i]||r[s].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(t,e,n){return e||n.slice(1)}))}))).match(e),a=s.length,l=0;l<a;l+=1){var d=s[l],h=u[d],c=h&&h[0],p=h&&h[1];s[l]=p?{regex:c,parser:p}:d.replace(/^\[|\]$/g,"")}return function(t){for(var e={},n=0,i=0;n<a;n+=1){var r=s[n];if("string"==typeof r)i+=r.length;else{var o=r.regex,l=r.parser,d=t.slice(i),h=o.exec(d)[0];l.call(e,h),t=t.replace(h,"")}}return function(t){var e=t.afternoon;if(void 0!==e){var n=t.hours;e?n<12&&(t.hours+=12):12===n&&(t.hours=0),delete t.afternoon}}(e),e}}return function(t,e,n){n.p.customParseFormat=!0,t&&t.parseTwoDigitYear&&(a=t.parseTwoDigitYear);var i=e.prototype,r=i.parse;i.parse=function(t){var e=t.date,i=t.utc,s=t.args;this.$u=i;var a=s[1];if("string"==typeof a){var l=!0===s[2],d=!0===s[3],h=l||d,c=s[2];d&&(c=s[2]),o=this.$locale(),!l&&c&&(o=n.Ls[c]),this.$d=function(t,e,n,i){try{if(["x","X"].indexOf(e)>-1)return new Date(("X"===e?1e3:1)*t);var r=p(e)(t),s=r.year,o=r.month,a=r.day,l=r.hours,d=r.minutes,h=r.seconds,c=r.milliseconds,u=r.zone,m=r.week,g=new Date,f=a||(s||o?1:g.getDate()),b=s||g.getFullYear(),v=0;s&&!o||(v=o>0?o-1:g.getMonth());var y,x=l||0,w=d||0,k=h||0,C=c||0;return u?new Date(Date.UTC(b,v,f,x,w,k,C+60*u.offset*1e3)):n?new Date(Date.UTC(b,v,f,x,w,k,C)):(y=new Date(b,v,f,x,w,k,C),m&&(y=i(y).week(m).toDate()),y)}catch(t){return new Date("")}}(e,a,i,n),this.init(),c&&!0!==c&&(this.$L=this.locale(c).$L),h&&e!=this.format(a)&&(this.$d=new Date("")),o={}}else if(a instanceof Array)for(var u=a.length,m=1;m<=u;m+=1){s[1]=a[m-1];var g=n.apply(this,s);if(g.isValid()){this.$d=g.$d,this.$L=g.$L,this.init();break}m===u&&(this.$d=new Date(""))}else r.call(this,t)}}}();const V=k(U.exports);function j(t){return/[HhmsS]/.test(t)}function _(t,e){if(null==t)return S(NaN);if("string"!=typeof t)return S(t);const n=S(t,e,!0);return n.isValid()?n:S(t)}function G(t){if(null==t?void 0:t.name)return S.locale(t,void 0,!0),t.name}function K(t,e){return e?t.locale(e):t}S.extend(V);const X=[0,1,2,3,4,5,6];class Z{constructor(t={}){this.inputDateFormat=t.inputDateFormat??"YYYY-MM-DD";const e=t.workingWeekdays??X;this.workingWeekdaysSet=new Set(e.filter((t=>Number.isInteger(t)&&t>=0&&t<=6)));const n=(t.holidays??[]).map((t=>this.parse(t).format("YYYY-MM-DD")));this.holidaysSet=new Set(n),this.isNoOp=7===this.workingWeekdaysSet.size&&0===this.holidaysSet.size}parse(t){return _(t,this.inputDateFormat)}getInputDateFormat(){return this.inputDateFormat}isWorkingDay(t){if(this.isNoOp)return!0;const e=this.parse(t);return this.workingWeekdaysSet.has(e.day())&&!this.holidaysSet.has(e.format("YYYY-MM-DD"))}nextWorkingDay(t){let e=this.parse(t).startOf("day");if(this.isNoOp)return e.toDate();let n=3660;for(;!this.isWorkingDay(e)&&n-- >0;)e=e.add(1,"day");return e.toDate()}prevWorkingDay(t){let e=this.parse(t).startOf("day");if(this.isNoOp)return e.toDate();let n=3660;for(;!this.isWorkingDay(e)&&n-- >0;)e=e.subtract(1,"day");return e.toDate()}addWorkingDays(t,e){let n=this.parse(t).startOf("day");if(this.isNoOp||0===e)return n.add(e,"day").toDate();const i=e>0?1:-1;let r=Math.abs(e);for(;r>0;)n=n.add(i,"day"),this.isWorkingDay(n)&&r--;return n.toDate()}workingDaysBetween(t,e,n={}){let i=this.parse(t).startOf("day");const r=this.parse(e).startOf("day");if(i.isAfter(r))return 0;if(this.isNoOp){const t=r.diff(i,"day");return n.inclusive?t+1:t}let s=0;for(;i.isBefore(r);)this.isWorkingDay(i)&&s++,i=i.add(1,"day");return n.inclusive&&this.isWorkingDay(r)&&s++,s}iterateWorkingDays(t,e,n){let i=this.parse(t).startOf("day");const r=this.parse(e).startOf("day");for(;!i.isAfter(r);)this.isWorkingDay(i)&&n(i.toDate()),i=i.add(1,"day")}}const Q=new Z;function J(t,e,n){return"allow"===n||e.isNoOp||e.isWorkingDay(t)?_(t,e.getInputDateFormat()).startOf("day").toDate():"previous"===n?e.prevWorkingDay(t):e.nextWorkingDay(t)}function tt(t=[]){return t.map((t=>{const e="object"==typeof t&&null!==t&&"date"in t?t.date:t,n=S(e);return{key:n.format("YYYY-MM-DD"),date:n.toDate(),label:"object"==typeof t&&"label"in t?t.label:void 0}}))}S.extend(V);const et=6e4,nt=36e5,it=864e5;function rt(t,e){return("minute"===t?et:"hour"===t?nt:it)*Math.max(1,e)}function st(t,e,n){return _(t,n).add(e,"millisecond").format(n)}const ot={TASK_UPDATE:"taskUpdate",TASK_VALIDATION_ERROR:"taskValidationError",TASK_UPDATE_SUCCESS:"taskUpdateSuccess",TASK_UPDATE_ERROR:"taskUpdateError",TASK_ADDED:"taskAdded",TASK_DELETED:"taskDeleted",TASK_MOVED:"taskMoved",DEPENDENCY_ADDED:"dependencyAdded",DEPENDENCY_REMOVED:"dependencyRemoved",TASK_DRAGGED:"taskDragged",TASK_RESIZED:"taskResized",TASK_PROGRESS_CHANGED:"taskProgressChanged",SELECTION_CHANGE:"selectionChange",DEPENDENCY_ARROW_UPDATE:"dependencyArrowUpdate",HISTORY_CHANGE:"historyChange",SORT_CHANGE:"sortChange",FILTER_CHANGE:"filterChange",GROUP_CHANGE:"groupChange",COLUMN_RESIZE:"columnResize",COLUMN_REORDER:"columnReorder"};class at{constructor(t,e,n,i,r,s=!1){this.taskId=t,this.options=e,this.chartContext=i,this.dataManager=r,this.rtl=s,this.dragState={childTasks:[],pixelsPerSnap:0,msPerSnap:0,initialLeft:0,initialPosition:0,initialStartTime:"",initialEndTime:"",isDragging:!1,dragSessionId:""},this.task=null,this.activePointerId=null;if(!this.dataManager.getTaskById(t))throw new Error(`BarDragManager: Task with id "${t}" not found`);const o=rt(this.options.snapUnit,this.options.snapValue);this.dragState.msPerSnap=o,this.dragState.pixelsPerSnap=n*o}isForeignPointer(t){return null!=this.activePointerId&&null!=t.pointerId&&t.pointerId!==this.activePointerId}calculateFinalPosition(t){const{pixelsPerSnap:e,initialLeft:n,initialPosition:i}=this.dragState,r=t.clientX-i,s=Math.round(r/e);return{calculatedLeft:n+s*e,snapsMoved:s}}shiftTimestamp(t,e){return st(t,(this.rtl?-1:1)*e*this.dragState.msPerSnap,this.options.inputDateFormat)}snapToWorkingCalendar(t,e,n,i){var r;const s=this.dataManager.getCalendar(),o=(null==(r=this.options.calendar)?void 0:r.dragSnapMode)??"next";if(s.isNoOp||"allow"===o||"day"!==this.options.snapUnit||j(this.options.inputDateFormat))return{newStart:n,newEnd:i};const a=s.workingDaysBetween(t,e,{inclusive:!0}),l=J(n,s,o),d=Math.max(0,a-1),h=0===d?l:s.addWorkingDays(l,d),c=this.options.inputDateFormat;return{newStart:S(l).format(c),newEnd:S(h).format(c)}}createMouseDownHandler(t){return e=>{var n;if(!(null!=e.button&&e.button>0)&&(this.task=this.dataManager.getTaskById(this.taskId),this.task)){if(this.activePointerId=e.pointerId??null,null!=e.pointerId)try{null==(n=t.setPointerCapture)||n.call(t,e.pointerId)}catch{}this.dragState={...this.dragState,initialLeft:parseInt(t.style.left)||0,initialPosition:e.clientX,initialStartTime:this.task.startTime,initialEndTime:this.task.endTime,isDragging:!0,dragSessionId:`drag-${this.task.id}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`},t.classList.add("dragging"),t.setAttribute("aria-grabbed","true"),this.dragState.childTasks=this.dataManager.getNestedChildTasks(this.task.id).map((t=>{const e=q(this.chartContext,t.id);return e?{...t,element:e,left:parseInt(e.style.left)||0,width:parseInt(e.style.width)||0}:t}))}}}createMouseMoveHandler(t){return e=>{this.dragState.isDragging&&!this.isForeignPointer(e)&&requestAnimationFrame((()=>{const{pixelsPerSnap:n,initialLeft:i,initialPosition:r}=this.dragState,s=Math.round((e.clientX-r)/n)*n;t.style.left=`${i+s}px`,this.task&&this.dataManager.updateDependencyArrows(this.task.id,this.chartContext),this.dragState.childTasks.forEach((t=>{if(!t.element)return;const e=t.left??0;t.element.style.left=`${e+s}px`,this.dataManager.updateDependencyArrows(t.id,this.chartContext)}))}))}}createMouseUpHandler(t,e){return n=>{if(!this.dragState.isDragging||this.isForeignPointer(n))return;if(this.dragState.isDragging=!1,this.releaseCapture(t,n),t.classList.remove("dragging"),t.setAttribute("aria-grabbed","false"),!this.task)return;const{calculatedLeft:i,snapsMoved:r}=this.calculateFinalPosition(n);if(0===r)return void(this.dragState={...this.dragState,isDragging:!1});this.armClickSwallow(t);const s=this.shiftTimestamp(this.task.startTime,r),o=this.shiftTimestamp(this.task.endTime,r),{newStart:a,newEnd:l}=this.snapToWorkingCalendar(this.task.startTime,this.task.endTime,s,o),d=this.dragState.childTasks.map((t=>{if(!t.endTime)return null;const e=this.shiftTimestamp(t.startTime,r),n=this.shiftTimestamp(t.endTime,r),i=this.snapToWorkingCalendar(t.startTime,t.endTime,e,n);return{taskId:t.id,newStartTime:i.newStart,newEndTime:i.newEnd}})).filter((t=>null!==t)),h=(this.rtl?-r:r)*this.dragState.msPerSnap/it;this.emitTaskDraggedEvent(h,a,l,d),this.updateTaskPosition(t,i,r,e),this.updateChildrenPositions(i,r,e)}}emitTaskDraggedEvent(t,e,n,i){if(!this.task)return;const r={taskId:this.task.id,oldStartTime:this.dragState.initialStartTime,oldEndTime:this.dragState.initialEndTime,newStartTime:e,newEndTime:n,daysMoved:t,affectedChildTasks:i,timestamp:Date.now()},s=new CustomEvent(ot.TASK_DRAGGED,{detail:r,bubbles:!0,composed:!0,cancelable:!1}),o=this.chartContext.getChartContainer();o&&o.dispatchEvent(s)}updateChildrenPositions(t,e,n){this.dragState.childTasks.forEach((i=>{const r=q(this.chartContext,i.id);if(r){const s=t-this.dragState.initialLeft;r.style.left=`${(i.left??0)+s}px`;const o=this.shiftTimestamp(i.startTime,e),a=i.endTime?this.shiftTimestamp(i.endTime,e):null,l=null!==a?this.snapToWorkingCalendar(i.startTime,i.endTime,o,a):{newStart:o,newEnd:void 0};this.dataManager.updateDependencyArrows(i.id,this.chartContext),null==n||n(i.id,{endTime:l.newEnd??void 0,startTime:l.newStart},{label:"Move task",mergeKey:this.dragState.dragSessionId})}}))}updateTaskPosition(t,e,n,i){if(!this.task)return;t.style.left=`${e}px`;const r=this.shiftTimestamp(this.task.startTime,n),s=this.shiftTimestamp(this.task.endTime,n),{newStart:o,newEnd:a}=this.snapToWorkingCalendar(this.task.startTime,this.task.endTime,r,s);this.dataManager.updateDependencyArrows(this.task.id,this.chartContext),null==i||i(this.task.id,{endTime:a,startTime:o},{label:"Move task",mergeKey:this.dragState.dragSessionId})}armClickSwallow(t){t.addEventListener("click",(t=>{t.stopPropagation(),t.preventDefault()}),{capture:!0,once:!0})}releaseCapture(t,e){var n;if(this.activePointerId=null,null!=e.pointerId)try{null==(n=t.releasePointerCapture)||n.call(t,e.pointerId)}catch{}}createPointerCancelHandler(t){return e=>{this.dragState.isDragging&&!this.isForeignPointer(e)&&(this.dragState.isDragging=!1,this.releaseCapture(t,e),t.classList.remove("dragging"),t.setAttribute("aria-grabbed","false"),t.style.left=`${this.dragState.initialLeft}px`,this.dragState.childTasks.forEach((t=>{t.element&&(t.element.style.left=`${t.left??0}px`)})),this.task&&this.dataManager.updateDependencyArrows(this.task.id,this.chartContext))}}makeDraggable(t,e){const n=this.createMouseDownHandler(t),i=this.createMouseMoveHandler(t),r=this.createMouseUpHandler(t,e),s=this.createPointerCancelHandler(t);return t.addEventListener("pointerdown",n),this.chartContext.addEventListener("pointermove",i),this.chartContext.addEventListener("pointerup",r),this.chartContext.addEventListener("pointercancel",s),()=>{t.removeEventListener("pointerdown",n),this.chartContext.removeEventListener("pointermove",i),this.chartContext.removeEventListener("pointerup",r),this.chartContext.removeEventListener("pointercancel",s)}}}class lt{constructor(t,e,n,i,r=!1){this.taskId=t,this.options=e,this.chartContext=n,this.dataManager=i,this.rtl=r,this.state={initialProgress:0,initialClientX:0,barWidth:0,isDragging:!1,currentProgress:0},this.task=null,this.activePointerId=null;if(!this.dataManager.getTaskById(t))throw new Error(`BarProgressManager: Task with id "${t}" not found`)}isForeignPointer(t){return null!=this.activePointerId&&null!=t.pointerId&&t.pointerId!==this.activePointerId}clamp(t){return t<0?0:t>100?100:t}updateVisuals(t,e){const n=this.rtl?"right":"left",i=t.querySelector(".bar-timeline-progress");i&&(i.style.width=`${e}%`);const r=t.querySelector(".bar-progress-handle");r&&(r.style[n]=`${e}%`,r.setAttribute("aria-valuenow",String(Math.round(e))));const s=t.querySelector(".bar-progress-handle-label");s&&(s.style[n]=`${e}%`,s.textContent=`${Math.round(e)}%`)}createMouseDownHandler(t,e){return n=>{var i;if(null!=n.button&&n.button>0)return;if(n.stopPropagation(),n.preventDefault(),this.task=this.dataManager.getTaskById(this.taskId),!this.task)return;const r=parseInt(t.style.width)||t.offsetWidth||0;if(!(r<=0)){if(this.activePointerId=n.pointerId??null,null!=n.pointerId)try{null==(i=e.setPointerCapture)||i.call(e,n.pointerId)}catch{}this.state={initialProgress:this.task.progress??0,initialClientX:n.clientX,barWidth:r,isDragging:!0,currentProgress:this.task.progress??0},t.classList.add("progress-dragging"),e.classList.add("dragging")}}}createMouseMoveHandler(t){return e=>{this.state.isDragging&&!this.isForeignPointer(e)&&requestAnimationFrame((()=>{const n=e.clientX-this.state.initialClientX,i=(this.rtl?-n:n)/this.state.barWidth*100,r=this.clamp(this.state.initialProgress+i);this.state.currentProgress=r,this.updateVisuals(t,r)}))}}createMouseUpHandler(t,e,n){return i=>{var r;if(!this.state.isDragging||this.isForeignPointer(i))return;if(this.state.isDragging=!1,this.activePointerId=null,null!=i.pointerId)try{null==(r=e.releasePointerCapture)||r.call(e,i.pointerId)}catch{}if(t.classList.remove("progress-dragging"),e.classList.remove("dragging"),!this.task)return;const s=this.state.initialProgress,o=Math.round(this.state.currentProgress);this.updateVisuals(t,o),o!==s&&(null==n||n(this.task.id,{progress:o},{label:"Update progress"}),this.emitTaskProgressChangedEvent(s,o))}}emitTaskProgressChangedEvent(t,e){if(!this.task)return;const n={taskId:this.task.id,oldProgress:t,newProgress:e,timestamp:Date.now()},i=new CustomEvent(ot.TASK_PROGRESS_CHANGED,{detail:n,bubbles:!0,composed:!0,cancelable:!1}),r=this.chartContext.getChartContainer();r&&r.dispatchEvent(i)}makeProgressDraggable(t,e,n){const i=this.createMouseDownHandler(t,e),r=this.createMouseMoveHandler(t),s=this.createMouseUpHandler(t,e,n);return e.addEventListener("pointerdown",i),this.chartContext.addEventListener("pointermove",r),this.chartContext.addEventListener("pointerup",s),this.chartContext.addEventListener("pointercancel",s),()=>{e.removeEventListener("pointerdown",i),this.chartContext.removeEventListener("pointermove",r),this.chartContext.removeEventListener("pointerup",s),this.chartContext.removeEventListener("pointercancel",s)}}}class dt{constructor(t,e,n,i,r,s=!1){this.taskId=t,this.options=e,this.chartContext=i,this.dataManager=r,this.rtl=s,this.interactionState={pixelsPerSnap:0,msPerSnap:0,initialLeft:0,initialPosition:0,initialWidth:0,initialStartTime:"",initialEndTime:"",isResizing:!1,resizeHandle:null},this.task=null,this.activePointerId=null;if(!this.dataManager.getTaskById(t))throw new Error(`BarResizeManager: Task with id "${t}" not found`);const o=rt(this.options.snapUnit,this.options.snapValue);this.interactionState.msPerSnap=o,this.interactionState.pixelsPerSnap=n*o}isForeignPointer(t){return null!=this.activePointerId&&null!=t.pointerId&&t.pointerId!==this.activePointerId}armClickSwallow(t){t.addEventListener("click",(t=>{t.stopPropagation(),t.preventDefault()}),{capture:!0,once:!0})}shiftTimestamp(t,e){return st(t,e*this.interactionState.msPerSnap,this.options.inputDateFormat)}snapResizedEndpoint(t){var e;const n=this.dataManager.getCalendar(),i=(null==(e=this.options.calendar)?void 0:e.dragSnapMode)??"next";return n.isNoOp||"allow"===i||"day"!==this.options.snapUnit||j(this.options.inputDateFormat)?t:S(J(t,n,i)).format(this.options.inputDateFormat)}createMouseMoveHandler(t){return e=>{this.interactionState.isResizing&&!this.isForeignPointer(e)&&requestAnimationFrame((()=>{const{pixelsPerSnap:n,resizeHandle:i,initialLeft:r,initialPosition:s,initialWidth:o}=this.interactionState,a=Math.round((e.clientX-s)/n)*n;if("left"===i){let e=r+a,i=o-a;i<n&&(i=n,e=r+o-n),e<0&&(i+=e,e=0),t.style.left=`${e}px`,t.style.width=`${i}px`}else{const e=Math.max(n,o+a);t.style.width=`${e}px`}this.task&&this.dataManager.updateDependencyArrows(this.task.id,this.chartContext)}))}}createMouseUpHandler(t,e){return n=>{var i;if(!this.interactionState.isResizing||this.isForeignPointer(n))return;if(!this.task)return;if(this.armClickSwallow(t),this.activePointerId=null,null!=n.pointerId)try{null==(i=t.releasePointerCapture)||i.call(t,n.pointerId)}catch{}t.classList.remove("resizing");const{pixelsPerSnap:r,msPerSnap:s,initialLeft:o,initialPosition:a,initialWidth:l,resizeHandle:d}=this.interactionState,h=n.clientX-a,c=this.interactionState.initialStartTime,u=this.interactionState.initialEndTime;let p=c,m=u,g=0;if("left"===d){let n=Math.round(h/r),i=o+n*r,a=l-n*r;if(a<r&&(a=r,i=o+l-r,n=Math.round((i-o)/r)),0===n)return void(this.interactionState={...this.interactionState,isResizing:!1,resizeHandle:null});if(t.style.left=`${i}px`,t.style.width=`${a}px`,g=-n*s/it,this.rtl){const t=this.shiftTimestamp(this.task.endTime,-n);m=this.snapResizedEndpoint(t),null==e||e(this.task.id,{endTime:m},{label:"Resize task"})}else{const t=this.shiftTimestamp(this.task.startTime,n);p=this.snapResizedEndpoint(t),null==e||e(this.task.id,{startTime:p},{label:"Resize task"})}}else{let n=Math.round(h/r),i=l+n*r;if(i<r&&(i=r,n=Math.round((i-l)/r)),0===n)return void(this.interactionState={...this.interactionState,isResizing:!1,resizeHandle:null});if(t.style.width=`${i}px`,g=n*s/it,this.rtl){const t=this.shiftTimestamp(this.task.startTime,-n);p=this.snapResizedEndpoint(t),null==e||e(this.task.id,{startTime:p},{label:"Resize task"})}else{const t=this.shiftTimestamp(this.task.endTime,n);m=this.snapResizedEndpoint(t),null==e||e(this.task.id,{endTime:m},{label:"Resize task"})}}null!==d&&this.emitTaskResizedEvent(d,c,u,p,m,g),this.dataManager.updateDependencyArrows(this.task.id,this.chartContext),this.interactionState={...this.interactionState,isResizing:!1,resizeHandle:null}}}emitTaskResizedEvent(t,e,n,i,r,s){if(!this.task)return;const o={taskId:this.task.id,resizeHandle:t,oldStartTime:e,oldEndTime:n,newStartTime:i,newEndTime:r,durationChange:s,timestamp:Date.now()},a=new CustomEvent(ot.TASK_RESIZED,{detail:o,bubbles:!0,composed:!0,cancelable:!1}),l=this.chartContext.getChartContainer();l&&l.dispatchEvent(a)}createResizeMouseDownHandler(t){return(e,n)=>{var i;if(!(null!=e.button&&e.button>0)&&(e.stopPropagation(),this.task=this.dataManager.getTaskById(this.taskId),this.task)){if(this.activePointerId=e.pointerId??null,null!=e.pointerId)try{null==(i=t.setPointerCapture)||i.call(t,e.pointerId)}catch{}this.interactionState={...this.interactionState,initialLeft:parseInt(t.style.left)||0,initialPosition:e.clientX,initialWidth:parseInt(t.style.width)||0,initialStartTime:this.task.startTime,initialEndTime:this.task.endTime,isResizing:!0,resizeHandle:n},t.classList.add("resizing")}}}makeResizable(t,e){const n=t.querySelector(".handle-left"),i=t.querySelector(".handle-right"),r=this.createResizeMouseDownHandler(t),s=this.createMouseMoveHandler(t),o=this.createMouseUpHandler(t,e),a=t=>r(t,"left"),l=t=>r(t,"right");return null==n||n.addEventListener("pointerdown",a),null==i||i.addEventListener("pointerdown",l),this.chartContext.addEventListener("pointermove",s),this.chartContext.addEventListener("pointerup",o),this.chartContext.addEventListener("pointercancel",o),()=>{null==n||n.removeEventListener("pointerdown",a),null==i||i.removeEventListener("pointerdown",l),this.chartContext.removeEventListener("pointermove",s),this.chartContext.removeEventListener("pointerup",o),this.chartContext.removeEventListener("pointercancel",o)}}}class ht{constructor(t,e){this.chartContext=t,this.options=e,this.overlay=null,this.keydownHandler=null,this.clickOutsideHandler=null,this.createDialog(),this.setupEventListeners()}createDialog(){const t=this.chartContext.getInstanceId(),e=this.chartContext.getElementById(`${this.options.id}-container`);if(e){this.container=e;const t=this.container.querySelector(".gantt-dialog");return void this.updateDialogContent(t)}this.container=this.chartContext.createElement("div"),this.container.id=`${this.options.id}-container`,this.container.className="gantt-dialog-container",this.container.setAttribute("role","dialog"),this.container.setAttribute("aria-modal","true"),this.container.setAttribute("aria-labelledby",`${this.options.id}-title`),this.container.setAttribute("data-chart-instance",t),this.options.modal&&(this.overlay=this.chartContext.createElement("div"),this.overlay.className="dialog-overlay",this.container.appendChild(this.overlay));const n=this.chartContext.createElement("div");n.id=this.options.id,n.className="gantt-dialog",this.createDialogStructure(n),this.options.width&&(n.style.width=this.options.width),this.options.height&&(n.style.height=this.options.height),this.container.appendChild(n),!1!==this.options.positionRelativeToChart&&this.positionRelativeToChart();const i=!1!==this.options.positionRelativeToChart?this.chartContext.getChartContainer():this.chartContext.getAppendContainer();null==i||i.appendChild(this.container)}createDialogStructure(t){t.innerHTML=`\n <div class="dialog-header">\n <h2 id="${this.options.id}-title-${this.chartContext.getInstanceId()}" class="dialog-title">${this.options.title||""}</h2>\n <button class="dialog-close" aria-label="Close dialog" type="button">×</button>\n </div>\n <div class="dialog-content"></div>\n `,this.updateDialogContent(t)}positionRelativeToChart(){const t=this.chartContext.getChartContainer();if(t){"static"===window.getComputedStyle(t).position&&(t.style.position="relative")}this.container.style.position="absolute",this.container.style.top="0",this.container.style.left="0",this.container.style.width="100%",this.container.style.height="100%",this.container.style.zIndex="999"}setupEventListeners(){const t=this.container.querySelector(".dialog-close");null==t||t.addEventListener("click",(()=>this.hide())),this.options.closeOnEscape&&(this.keydownHandler=t=>{"Escape"===t.key&&this.isVisible()&&(t.preventDefault(),this.hide())},this.chartContext.addEventListener("keydown",this.keydownHandler)),this.options.closeOnClickOutside&&this.overlay&&(this.clickOutsideHandler=t=>{t.target===this.overlay&&this.hide()},this.overlay.addEventListener("click",this.clickOutsideHandler)),this.container.addEventListener("keydown",(t=>{"Tab"===t.key&&this.isVisible()&&this.trapFocus(t)}))}trapFocus(t){const e=this.container.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),n=e[0],i=e[e.length-1],r=this.chartContext.getActiveElement();t.shiftKey?r===n&&(t.preventDefault(),null==i||i.focus()):r===i&&(t.preventDefault(),null==n||n.focus())}updateDialogContent(t){const e=t.querySelector(".dialog-content"),n=t.querySelector(".dialog-title");n&&(n.textContent=this.options.title||""),e&&(e.innerHTML="","string"==typeof this.options.content?e.innerHTML=this.options.content:this.options.content instanceof HTMLElement&&e.appendChild(this.options.content))}cleanupEventListeners(){this.keydownHandler&&(this.chartContext.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null),this.clickOutsideHandler&&this.overlay&&(this.overlay.removeEventListener("click",this.clickOutsideHandler),this.clickOutsideHandler=null)}destroy(){this.cleanupEventListeners(),this.container.remove()}hide(){this.container.classList.remove("show","animate");const t=this.chartContext.querySelector("[data-dialog-trigger]");null==t||t.focus()}isVisible(){return this.container.classList.contains("show")}setContent(t){const e=this.container.querySelector(".dialog-content");e&&(e.innerHTML="","string"==typeof t?e.innerHTML=t:e.appendChild(t))}show(){const t=this.chartContext.getActiveElement();null==t||t.setAttribute("data-dialog-trigger","true"),this.container.classList.add("show","animate");const e=this.container.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');null==e||e.focus()}}var ct=(t=>(t.Horizontal="horizontal",t.Vertical="vertical",t))(ct||{});class ut{constructor(t,e,n,i){this.options=t,this.geometry=e,this.chartContext=n,this.totalHeight=i}calculateWidth(t){const e=this.options.inputDateFormat,n=_(t.x1,e).valueOf(),i=_(t.x2,e);return((j(e)?i.valueOf():i.add(1,"day").valueOf())-n)*this.geometry.pixelsPerMs}calculateX(t){const e=t.x2?this.calculateWidth(t):0;return this.geometry.leftForDate(t.x1,e)}drawAnnotation(t){const e=l(this.chartContext,{className:"annotation"}),n=this.calculateX(t),i=a(this.getAnnotationStyles(t,n));if(e.setAttribute("style",i),t.label){const n=this.renderLabel(t);e.append(n)}return e}getAnnotationStyles(t,e){const{annotationBgColor:n,annotationBorderColor:i,annotationBorderWidth:r}=this.options,{bgColor:s,borderColor:o,borderWidth:a}=t;let l=0;const d=t.x2?a??r:(a??r??0)/2;return t.x2&&(l=this.calculateWidth(t)),{backgroundColor:s||n,borderColor:`${o||i}`,borderStyle:"solid",borderWidth:`${d}px`,height:`${this.totalHeight}px`,left:`${e}px`,position:"absolute",top:"0px",width:l?`${l}px`:"unset",zIndex:"10"}}renderLabel(t){const e=l(this.chartContext,{className:"annotation-label"}),{annotationBgColor:n,annotationBorderColor:i,fontColor:r,fontFamily:s,fontSize:o,fontWeight:d}=this.options,{bgColor:h,borderColor:c}=t,{label:u}=t;if(!u)return e;const p=u.fontColor||r,m=u.fontFamily||s,g=u.fontSize||o,f=u.fontWeight||d,b=a({background:h||n,borderColor:`${c||i}`,borderStyle:"solid",borderWidth:"1px",color:p,fontFamily:m,fontSize:g,fontWeight:f,left:"0px",padding:"2px 5px",position:"absolute",top:"-1px",width:"max-content",zIndex:"1"});return e.setAttribute("style",b),e.innerText=u.text??"",e}render(t=[]){const e=[];return[...this.options.annotations,...t].forEach((t=>{e.push(this.drawAnnotation(t))})),e}}const pt={annotationBorderDashArray:[],annotationBorderWidth:2,annotationOrientation:ct.Horizontal,annotations:[],enableProjectBoundary:!1,projectBoundaryColor:"#7C3AED",barBorderRadius:"5px",barLabel:{position:"right",field:"name"},barMargin:8,baseline:{enabled:!1,striped:!0,stripeColor:"#FFFFFF",stripeWidth:3,stripeAngle:45},canvasStyle:"border: 1px solid #E5E7EB; box-sizing: border-box",calendar:{},dependencies:{},enableCriticalPath:!1,enableCrosshair:!1,cellBorderWidth:"1px",columnLines:!0,enableInlineEdit:!1,enableProgressDrag:!0,enableTaskEditingShortcuts:!1,enableTaskCRUDToolbar:!1,enableContextMenu:!1,enableAddTaskRow:!1,enableDrawTask:!1,enableScrollButtons:!1,scrollToTaskOnRowClick:!1,history:{enabled:!0,maxSize:100},enableRollups:!1,enableSelection:!1,enableExport:!0,exportFormat:"svg",persistState:!1,toolbarItems:[],enableQuickFilter:!1,enableFilterBuilder:!1,enableResize:!0,enableTaskDrag:!0,enableTaskEdit:!1,enableTaskResize:!0,enableTooltip:!0,fontFamily:'system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',fontSize:"14px",fontWeight:"400",height:"500px",inputDateFormat:"MM-DD-YYYY",locale:{direction:"ltr"},rowHeight:40,series:[],showCheckboxColumn:!0,snapUnit:"day",snapValue:1,autoSizeColumns:!0,resizableColumns:!0,reorderableColumns:!0,tasksContainerWidth:425,tooltipId:"apexgantt-tooltip-container",tooltipTemplate(t,e){const n=[`<div>\n <strong>Task:</strong>\n <span>${t.name}</span>\n </div>\n `];if(t.type===ne.Task?n.push(`\n <div>\n <strong>Start:</strong>\n <span>${Yt(t,Bt.StartTime,e)}</span>\n </div>\n <div>\n <strong>End:</strong>\n <span>${Yt(t,Bt.EndTime,e)}</span>\n </div>\n <div>\n <strong>Duration:</strong>\n <span>${Yt(t,Bt.Duration,e)}</span>\n </div>\n <div>\n <strong>Progress:</strong>\n <span>${t.progress}%</span>\n </div>\n `):t.type===ne.Milestone&&n.push(`\n <div>\n <strong>Date:</strong>\n <span>${Yt(t,Bt.StartTime,e)}</span>\n </div>\n `),t.dependency){const e="string"==typeof t.dependency?{taskId:t.dependency,type:"FS",lag:0}:t.dependency,i=e.type??"FS",r=e.lag??0,s=0===r?"":` (${r>0?"+":""}${r}d)`;n.push(`\n <div>\n <strong>Depends on:</strong>\n <span>${e.taskId} · ${i}${s}</span>\n </div>\n `)}return n.join("")},width:"100%"},mt={annotationBgColor:"#DBEAFE",annotationBorderColor:"#60A5FA",arrowColor:"#94A3B8",backgroundColor:"#FFFFFF",barBackgroundColor:"#87B7FE",barTextColor:"#FFFFFF",borderColor:"#E5E7EB",cellBorderColor:"#EDEFF2",criticalArrowColor:"#E53935",criticalBarColor:"#E53935",crosshairColor:"#3B82F6",fontColor:"#1F2933",headerBackground:"#F8F9FB",milestoneColor:"#7C3AED",rowBackgroundColors:["#FFFFFF"],summaryBarColor:"#94A3B8",tooltipBGColor:"#FFFFFF",tooltipBorderColor:"#E5E7EB"},gt={annotationBgColor:"#4A2D4D",annotationBorderColor:"#8B4D8F",arrowColor:"#94A3B8",backgroundColor:"#1E1E1E",barBackgroundColor:"#818CF8",barTextColor:"#FFFFFF",borderColor:"#3A3A3A",cellBorderColor:"#3A3A3A",criticalArrowColor:"#F87171",criticalBarColor:"#F87171",crosshairColor:"#818CF8",fontColor:"#E0E0E0",headerBackground:"#2A2A2A",milestoneColor:"#A78BFA",rowBackgroundColors:["#1E1E1E","#252525"],summaryBarColor:"#8FBCBC",tooltipBGColor:"#2D2D2D",tooltipBorderColor:"#444444"},ft={addTask:"Add task",deleteSelected:"Delete selected",undo:"Undo (Ctrl+Z)",redo:"Redo (Ctrl+Y)",exportAsSvg:"Export as SVG",exportAsPng:"Export as PNG",exportAsPdf:"Export as PDF",quickFilterPlaceholder:"Search tasks…",filterButton:"Filter",filterHeading:"Filter tasks",filterMatchLabel:"Match",filterMatchAll:"All",filterMatchAny:"Any",filterAddCondition:"+ Add condition",filterApply:"Apply",filterClear:"Clear",filterRemoveCondition:"Remove condition",filterNoConditions:"No conditions yet.",filterOperatorLabel:t=>({contains:"contains",notContains:"does not contain",equals:"equals",notEquals:"does not equal",startsWith:"starts with",endsWith:"ends with",gt:"greater than",gte:"greater or equal",lt:"less than",lte:"less or equal",before:"before",after:"after",on:"on",isEmpty:"is empty",notEmpty:"is not empty"}[t]??t),groupNone:"(None)",groupCountLabel:t=>`(${t})`,exportFailedNoChart:"Export failed: Chart not found. Please refresh and try again.",exportFailedGeneric:"Export failed. Please check the console for details.",editTask:"Edit task",addChildTask:"Add child task",addSiblingTask:"Add sibling task",indent:"Indent",outdent:"Outdent",deleteTask:"Delete task",deleteTaskWithChildren:"Delete (with children)",formTaskName:"Task Name",formStartDate:"Start Date",formEndDate:"End Date",formProgress:"Progress (%)",formSubmit:"Update",editTaskTitle:t=>`Edit Task: ${t}`,validationStartRequired:"Start date is required",validationEndRequired:"End date is required",validationEndAfterStart:"End date must be after start date",validationNameRequired:"Task name is required",validationProgressRequired:"Progress is required",validationProgressRange:"Progress must be between 0 and 100",addTaskRowLabel:"+ Add task",baselineLabel:"Baseline:",startLabel:"Start:",endLabel:"End:",summaryAriaLabel:({canToggle:t,collapsed:e,name:n})=>t?`${n} (summary) — ${e?"expand":"collapse"}`:`${n} (summary)`,barAriaLabel:({end:t,name:e,progress:n,start:i})=>void 0===n?`${e}: ${i} to ${t}`:`${e}: ${i} to ${t}, ${n}% complete`,barAriaValueText:({durationDays:t,end:e,start:n})=>`${n} to ${e}, ${t} days`,progressAriaLabel:t=>`${t} progress`};function bt(t){var e;return function(t,e){if(!e)return{...t};const n={...t};for(const t of Object.keys(e)){const i=e[t];void 0!==i&&(n[t]=i)}return n}(ft,null==(e=t.locale)?void 0:e.messages)}function vt(t){return{...pt,..."dark"===t?gt:mt}}const yt=vt("light");class xt{constructor(t,e,n,i,r,s="MM-DD-YYYY",o=ft){this.chartContext=t,this.dataManager=e,this.task=n,this.containerElement=i,this.onSubmit=r,this.dateFormat=s,this.messages=o,this.errors=[],this.submitButton=null,this.form=this.createForm()}emitEvent(t,e){const n=new CustomEvent(t,{detail:e,bubbles:!0,composed:!0,cancelable:!1});this.containerElement.dispatchEvent(n)}clearError(t){var e;const n=this.form.querySelector(`[name="${t}"]`),i=null==(e=n.parentElement)?void 0:e.querySelector(".form-error");null==i||i.remove(),n.classList.remove("invalid"),this.errors=this.errors.filter((e=>e.field!==t)),this.updateSubmitButton()}createForm(){const t=this.chartContext.createElement("form");return t.className="task-form",t.innerHTML=`\n <div class="form-group">\n <label for="name">${this.messages.formTaskName}</label>\n <input type="text" id="name" name="name" value="${this.task.name}">\n </div>\n\n <div class="form-group">\n <label for="startTime">${this.messages.formStartDate}</label>\n <input type="date" id="startTime" name="startTime" value="${this.formatDate(this.task.startTime)}">\n </div>\n\n <div class="form-group">\n <label for="endTime">${this.messages.formEndDate}</label>\n <input type="date" id="endTime" name="endTime" value="${this.formatDate(this.task.endTime)}">\n </div>\n\n <div class="form-group">\n <label for="progress">${this.messages.formProgress}</label>\n <input type="number" id="progress" name="progress" min="0" max="100" value="${this.task.progress}">\n </div>\n\n <div class="form-actions">\n <button type="submit" class="btn-primary">${this.messages.formSubmit}</button>\n </div>\n `,t.addEventListener("submit",this.handleSubmit.bind(this)),this.setupFieldValidation(t),t}formatDate(t){return S(t,this.dateFormat).format("YYYY-MM-DD")}handleSubmit(t){if(t.preventDefault(),this.errors.length>0)this.emitEvent(ot.TASK_VALIDATION_ERROR,{taskId:this.task.id,errors:this.errors,timestamp:Date.now()});else try{const t=new FormData(this.form),e={...this.task,endTime:S(t.get("endTime")).format(this.dateFormat),name:t.get("name"),progress:Number(t.get("progress")),startTime:S(t.get("startTime")).format(this.dateFormat)},n=this.dataManager.getTaskById(this.task.id)??this.task;this.emitEvent(ot.TASK_UPDATE,{taskId:this.task.id,updates:e,updatedTask:{...n,...e},timestamp:Date.now()}),this.onSubmit(e),this.emitEvent(ot.TASK_UPDATE_SUCCESS,{taskId:this.task.id,updatedTask:{...n,...e},timestamp:Date.now()})}catch(t){z.warn(`[TaskForm] Error updating task ${this.task.id}:`,t),this.emitEvent(ot.TASK_UPDATE_ERROR,{taskId:this.task.id,error:t instanceof Error?t:new Error(String(t)),timestamp:Date.now()})}}setupFieldValidation(t){const e=t.querySelector('[name="name"]'),n=t.querySelector('[name="startTime"]'),i=t.querySelector('[name="endTime"]'),r=t.querySelector('[name="progress"]');null==e||e.addEventListener("change",(()=>{const t=this.validateName(e.value);t?this.showError("name",t):this.clearError("name")}));const s=()=>{const{endError:t,startError:e}=this.validateDates(n.value,i.value);e?this.showError("startTime",e):this.clearError("startTime"),t?this.showError("endTime",t):this.clearError("endTime")};null==n||n.addEventListener("change",s),null==i||i.addEventListener("change",s),null==r||r.addEventListener("change",(()=>{const t=this.validateProgress(Number(r.value));t?this.showError("progress",t):this.clearError("progress")}))}showError(t,e){var n,i;const r=this.form.querySelector(`[name="${t}"]`),s=this.chartContext.createElement("div");s.className="form-error",s.textContent=e;const o=null==(n=r.parentElement)?void 0:n.querySelector(".form-error");null==o||o.remove(),null==(i=r.parentElement)||i.appendChild(s),r.classList.add("invalid"),this.errors.push({field:t,message:e}),this.updateSubmitButton()}updateSubmitButton(){if(this.submitButton||(this.submitButton=this.form.querySelector(".btn-primary")),this.submitButton){const t=this.errors.length>0;this.submitButton.disabled=t,this.submitButton.classList.toggle("btn-disabled",t)}}validateDates(t,e){const n={endError:null,startError:null},i=S(t),r=S(e);return t||(n.startError=this.messages.validationStartRequired),e||(n.endError=this.messages.validationEndRequired),i.isValid()&&r.isValid()&&r.isBefore(i)&&(n.endError=this.messages.validationEndAfterStart),n}validateName(t){return t.trim()?null:this.messages.validationNameRequired}validateProgress(t){return t||0===t?isNaN(t)||t<0||t>100?this.messages.validationProgressRange:null:this.messages.validationProgressRequired}getElement(){return this.form}}const wt=12,kt=5,Ct=14,St=6;function Mt(t,e,n,i,r,s){return`<div class="tooltip-content" style="${`background-color: ${e}; color: ${i};`}">${t}</div><div class="tooltip-arrow ${"above"===s?"arrow-below":"arrow-above"}" style="${`left: ${r}px; background-color: ${e};`}"></div>`}const Et=new Map;function Tt(t,e,n,i,r){const s=Et.get(e);void 0!==s&&(clearTimeout(s),Et.delete(e));const a=o(t,e);a.classList.add("apexgantt-tooltip"),a.innerHTML=Mt(i,r.bgColor,r.borderColor,r.fontColor,0,"above");const l=[r.fontFamily?`font-family: ${r.fontFamily};`:"",r.fontSize?`font-size: ${r.fontSize};`:"",r.fontWeight?`font-weight: ${r.fontWeight};`:""].filter(Boolean).join(" ");a.setAttribute("style",`position: absolute; left: -9999px; top: -9999px; visibility: hidden; opacity: 0; display: block; ${l}`);const d=n.getBoundingClientRect(),h=a.getBoundingClientRect(),c=function(t,e,n,i){const r=t.left+t.width/2,s=t.top>=n+wt+St?"above":"below";let o=r-e/2;const a=i.width-e-St;o=Math.min(Math.max(St,o),Math.max(St,a));const l="above"===s?t.top-n-wt:t.top+t.height+wt;let d=r-o;return d=Math.min(Math.max(Ct,d),e-Ct),{left:o+i.scrollX,top:l+i.scrollY,placement:s,arrowLeft:d-kt}}({left:d.left,top:d.top,width:d.width,height:d.height},h.width,h.height,{width:window.innerWidth,height:window.innerHeight,scrollX:window.scrollX||document.documentElement.scrollLeft,scrollY:window.scrollY||document.documentElement.scrollTop});a.innerHTML=Mt(i,r.bgColor,r.borderColor,r.fontColor,c.arrowLeft,c.placement),a.setAttribute("style",`position: absolute; left: ${c.left}px; top: ${c.top}px; ${l}`),a.classList.add("visible"),a.setAttribute("aria-hidden","false")}function At(t,e,n,i,r,s){const a=Et.get(e);void 0!==a&&(clearTimeout(a),Et.delete(e));const l=o(t,e);l.classList.add("apexgantt-tooltip");const d=`background-color: ${s.bgColor}; color: ${s.fontColor};`;l.innerHTML=`<div class="tooltip-content" style="${d}">${r}</div>`;const h=[s.fontFamily?`font-family: ${s.fontFamily};`:"",s.fontSize?`font-size: ${s.fontSize};`:"",s.fontWeight?`font-weight: ${s.fontWeight};`:"",s.maxWidth?`max-width: ${s.maxWidth}px;`:""].filter(Boolean).join(" ");l.setAttribute("style",`position: absolute; left: -9999px; top: -9999px; visibility: hidden; opacity: 0; display: block; ${h}`);const c=l.getBoundingClientRect(),{x:u,y:p}=((t,e,n=300,i=120,r=20,s=20)=>{const o=window.innerWidth,a=window.innerHeight,l=window.scrollX||document.documentElement.scrollLeft,d=window.scrollY||document.documentElement.scrollTop;let h=t+r+l,c=e+s+d;return t+r+n>o&&(h=t-n-r+l),e+s+i>a&&(c=e-i-s+d),h=Math.max(l+5,h),c=Math.max(d+5,c),{x:h,y:c}})(n,i,c.width,c.height,s.cursorOffsetX??12,s.cursorOffsetY??16);l.setAttribute("style",`position: absolute; left: ${u}px; top: ${p}px; ${h}`),l.classList.add("visible"),l.setAttribute("aria-hidden","false")}function Dt(t,e){const n=Et.get(e);void 0!==n&&(clearTimeout(n),Et.delete(e));const i=t.getElementById(e);i&&(i.removeAttribute("style"),i.classList.remove("visible"),i.setAttribute("aria-hidden","true"),i.innerHTML="")}class It{constructor(t,e,n,i,r,s){this.task=t,this.geometry=e,this.options=n,this.index=i,this.chartContext=r,this.dataManager=s,this.tooltipHandler=null}static calculateWidth(t,e,n){const{barMargin:i,rowHeight:r}=n;if(t.type===ne.Milestone)return(r-i)/2;const s=n.inputDateFormat,o=_(t.showSummaryBar?t.summaryStart:t.startTime,s),a=_(t.showSummaryBar?t.summaryEnd:t.endTime,s),l=o.valueOf();return((j(s)?a.valueOf():a.add(1,"day").valueOf())-l)*e.pixelsPerMs}static calculateX(t,e,n){const i=t.showSummaryBar?t.summaryStart:t.startTime;if(t.type===ne.Milestone){const{barMargin:t,rowHeight:r}=n,s=(r-t)/4*-1;return e.leftForDate(i,0)+s}const r=It.calculateWidth(t,e,n);return e.leftForDate(i,r)}get messages(){return bt(this.options)}get dateLocaleName(){var t,e;return null==(e=null==(t=this.options.locale)?void 0:t.dateLocale)?void 0:e.name}hasBaseline(){var t;return!(!(null==(t=this.options.baseline)?void 0:t.enabled)||!this.task.baseline)}calculateHeight(){const{barMargin:t,rowHeight:e}=this.options;return this.task.type===ne.Milestone?(e-t)/2:this.hasBaseline()?e-2*t-6-2:e-2*t}attachHoverTooltip(t,e){if(!this.options.enableTooltip)return;const{tooltipBGColor:n,tooltipBorderColor:i,fontColor:r,fontFamily:s,fontSize:o,fontWeight:a,tooltipId:l}=this.options;t.addEventListener("mouseenter",(()=>{const d=e();d&&Tt(this.chartContext,l,t,d,{bgColor:n,borderColor:i,fontColor:r,fontFamily:s,fontSize:o,fontWeight:a})})),t.addEventListener("mouseleave",(()=>{!function(t,e,n=100){const i=Et.get(e);void 0!==i&&clearTimeout(i);const r=setTimeout((()=>{Et.delete(e),Dt(t,e)}),n);Et.set(e,r)}(this.chartContext,l)}))}setupTooltip(t){const{tooltipTemplate:e,inputDateFormat:n}=this.options;this.attachHoverTooltip(t,(()=>{if(!e)return null;const t=this.dataManager.getTaskById(this.task.id);return t?e(t,n):null}))}setupBaselineTooltip(t){const{inputDateFormat:e}=this.options;this.attachHoverTooltip(t,(()=>{const t=this.dataManager.getTaskById(this.task.id),n=null==t?void 0:t.baseline;if(!t||!n)return null;const i=_(n.start,e).format(e),r=_(n.end,e).format(e),s=this.messages;return`\n <div>\n <strong>${s.baselineLabel}</strong>\n <span>${t.name}</span>\n </div>\n <div>\n <strong>${s.startLabel}</strong>\n <span>${i}</span>\n </div>\n <div>\n <strong>${s.endLabel}</strong>\n <span>${r}</span>\n </div>\n `}))}setupTaskEdit(t,e){if(!this.options.enableTaskEdit)return;const n=this.chartContext.getInstanceId();t.addEventListener("dblclick",(t=>{t.stopPropagation(),t.preventDefault();const i=this.dataManager.getTaskById(this.task.id);if(!i)return void z.error(`[${n}] Task not found in dataManager: ${this.task.id}`);const r=this.chartContext.getChartContainer();if(!r)return;const s=new xt(this.chartContext,this.dataManager,i,r,(t=>{null==e||e(i.id,t,{label:"Edit task"}),a.hide()}),this.options.inputDateFormat,this.messages),o=`taskDialog-${n}-${this.task.id}`,a=new ht(this.chartContext,{closeOnClickOutside:!1,closeOnEscape:!0,content:s.getElement(),id:o,modal:!0,title:this.messages.editTaskTitle(this.task.name),width:"400px",positionRelativeToChart:!0});a.show()}))}setupInteractions(t,e){const{enableTaskDrag:n,enableTaskResize:i,enableProgressDrag:r}=this.options;if(n&&this.makeDraggable(t,e),i&&this.task.type===ne.Task){const n=l(this.chartContext,{className:"bar-handle handle-left"}),i=l(this.chartContext,{className:"bar-handle handle-right"});t.append(n,i),this.makeResizable(t,e)}if(r&&this.task.type===ne.Task){const n=l(this.chartContext,{className:"bar-progress-handle"}),i=this.task.progress??0;n.setAttribute("style",`${this.geometry.rtl?"right":"left"}: ${i}%;`),n.setAttribute("role","slider"),n.setAttribute("aria-label",this.messages.progressAriaLabel(this.task.name)),n.setAttribute("aria-valuemin","0"),n.setAttribute("aria-valuemax","100"),n.setAttribute("aria-valuenow",String(Math.round(i))),t.append(n);const r=l(this.chartContext,{className:"bar-progress-handle-label"});r.setAttribute("style",`left: ${i}%;`),r.setAttribute("aria-hidden","true"),r.textContent=`${Math.round(i)}%`,t.append(r),this.makeProgressDraggable(t,n,e)}}drawRollups(){if(!this.options.enableRollups||!this.task.showSummaryBar)return[];const{rowHeight:t,barBackgroundColor:e,milestoneColor:n}=this.options,i=Math.round((t-8)/2)+8+2+this.index*t,r=i+2,s=this.dataManager.getNestedChildTasks(this.task.id),o=[];for(const t of s){if(t.showSummaryBar)continue;if(!t.startTime)continue;const s=t.type===ne.Milestone,d=l(this.chartContext,{className:"bar-rollup"});if(s){const e=this.geometry.leftForDate(t.startTime,0),i=t.barBackgroundColor||n;d.classList.add("bar-rollup-milestone"),d.setAttribute("style",a({backgroundColor:i,borderRadius:"1px",height:"7px",left:e-3.5+"px",opacity:"0.85",pointerEvents:"none",position:"absolute",top:r-3.5+"px",transform:"rotate(45deg)",width:"7px"}))}else{if(!t.endTime)continue;const n=It.calculateX(t,this.geometry,this.options),r=Math.max(2,It.calculateWidth(t,this.geometry,this.options)),s=t.barBackgroundColor||e;d.setAttribute("style",a({backgroundColor:s,borderRadius:"2px",height:"4px",left:`${n}px`,opacity:"0.7",pointerEvents:"none",position:"absolute",top:`${i}px`,width:`${r}px`}))}d.setAttribute("data-rollup-for",this.task.id),d.setAttribute("aria-hidden","true"),o.push(d)}return o}drawSummaryBar(t){const{summaryBarColor:e,rowHeight:n}=this.options,i=l(this.chartContext,{className:"bar-timeline bar-summary"+(this.geometry.rtl?" bar-rtl":"")}),r=this.task.barBackgroundColor||e,s=h(r,{l:-15}),o=It.calculateX(this.task,this.geometry,this.options),d=It.calculateWidth(this.task,this.geometry,this.options),c=Math.round((n-8)/2)+this.index*n,u=this.task.progress??0,p=u>0?s:r,m=u>=100?s:r,g=!!t&&this.dataManager.hasChildren(this.task.id),f=a({"--summary-bar-color":r,"--summary-cap-left-color":p,"--summary-cap-right-color":m,left:`${o}px`,top:`${c}px`,width:`${d}px`,...g?{cursor:"pointer"}:{}});if(i.setAttribute("style",f),i.setAttribute("data-taskid",this.task.id),i.setAttribute("data-chart-instance",this.chartContext.getInstanceId()),i.setAttribute("role",g?"button":"group"),i.setAttribute("aria-label",this.messages.summaryAriaLabel({canToggle:g,collapsed:!!this.task.collapsed,name:this.task.name})),i.setAttribute("aria-expanded",this.task.collapsed?"false":"true"),i.setAttribute("tabindex","0"),u>0){const t=l(this.chartContext,{className:"bar-timeline-progress"}),e=a({backgroundColor:s,width:`${u}%`});t.setAttribute("style",e),i.appendChild(t)}if(this.appendDependencyAnchors(i),this.setupTooltip(i),g&&t){const e=()=>{this.dataManager.toggleTask(this.task.id),t()};i.addEventListener("click",(t=>{t.stopPropagation(),e()})),i.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e())}))}return i}drawBar(e=t,n){if(this.task.showSummaryBar)return this.drawSummaryBar(n);const{barBackgroundColor:i,barBorderRadius:r,barLabel:s}=this.options,o=l(this.chartContext,{className:"bar-timeline"+(this.geometry.rtl?" bar-rtl":"")}),d=It.calculateWidth(this.task,this.geometry,this.options),c=function(t,e,n,i){const r=t.position??"right";if("auto"!==r)return r;if(t.render)return"right";const s=e[t.field??"name"];if(null==s)return"inside";const o=String(s),a=parseFloat(i),l=.55*(Number.isFinite(a)?a:14);return o.length*l+12>n?"right":"inside"}(s,this.task,d,this.options.fontSize),u=["bar-label"];"inside"!==c&&u.push("bar-label-outside",`bar-label-outside-${c}`),s.className&&u.push(s.className);const p=l(this.chartContext,{className:u.join(" ")});N(p,s,this.task);const m=l(this.chartContext,{className:"bar-timeline-progress"}),g=this.task.barBackgroundColor||i,f=a(this.getBarStyles(g)),b=a({backgroundColor:h(g,{l:-15}),borderRadius:r,width:`${this.task.progress}%`}),v=this.chartContext.getInstanceId();o.setAttribute("data-taskid",this.task.id),o.setAttribute("data-chart-instance",v),m.setAttribute("style",b),o.setAttribute("style",f);const y=_(this.task.startTime,this.options.inputDateFormat),x=_(this.task.endTime,this.options.inputDateFormat),w=this.dateLocaleName,k=K(y,w).format("MMMM D, YYYY"),C=K(x,w).format("MMMM D, YYYY"),S=y.valueOf(),M=x.valueOf(),E=x.diff(y,"day"),{enableTaskDrag:T,enableTaskResize:A,enableTaskEdit:D}=this.options,I=A&&this.task.type===ne.Task,$=T||I;($||D)&&o.classList.add("bar-interactive"),$?(o.setAttribute("role","slider"),o.setAttribute("aria-label",this.messages.barAriaLabel({end:C,name:this.task.name,start:k})),o.setAttribute("aria-valuenow",S.toString()),o.setAttribute("aria-valuemin",S.toString()),o.setAttribute("aria-valuemax",M.toString()),o.setAttribute("aria-valuetext",this.messages.barAriaValueText({durationDays:E,end:C,start:k})),o.setAttribute("aria-grabbed","false"),T&&o.setAttribute("aria-dropeffect","move")):(o.setAttribute("role","progressbar"),o.setAttribute("aria-label",this.messages.barAriaLabel({end:C,name:this.task.name,progress:this.task.progress,start:k})),o.setAttribute("aria-valuenow",this.task.progress.toString()),o.setAttribute("aria-valuemin","0"),o.setAttribute("aria-valuemax","100")),o.setAttribute("tabindex","0"),this.task.type!==ne.Milestone&&o.append(p);const F=this.buildSplitSegments(g,d);return F?(o.classList.add("bar-split"),o.append(...F)):o.append(m),this.task.type!==ne.Milestone&&this.appendDependencyAnchors(o),this.setupTaskEdit(o,e),this.setupTooltip(o),this.setupInteractions(o,e),o.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),o.dispatchEvent(new MouseEvent("dblclick",{bubbles:!0})))})),o}drawBaselineBar(){if(!this.hasBaseline())return null;const{barBorderRadius:t,barMargin:e,rowHeight:n}=this.options,i=this.task.baseline,r={...this.task,startTime:i.start,endTime:i.end,type:ne.Task},s=It.calculateX(r,this.geometry,this.options),o=It.calculateWidth(r,this.geometry,this.options),d=e+this.calculateHeight()+2+this.index*n,h=l(this.chartContext,{className:"bar-baseline"});h.setAttribute("aria-hidden","true"),h.setAttribute("data-taskid-baseline",this.task.id);const c=a({borderRadius:t,cursor:"default",height:"6px",left:`${s}px`,top:`${d}px`,width:`${o}px`,...this.getBaselineFillStyles()});return h.setAttribute("style",c),this.setupBaselineTooltip(h),h}getBaselineFillStyles(){const{color:t,striped:e,stripeColor:n,stripeWidth:i,stripeAngle:r}=this.options.baseline,s=t??this.getBarProgressColor();if(!e)return{backgroundColor:s};const o=`${i}px`;return{backgroundColor:n,backgroundImage:`repeating-linear-gradient(${r}deg, ${s} 0, ${s} ${o}, ${n} ${o}, ${n} ${2*i+"px"})`}}getBarProgressColor(){return h(this.task.barBackgroundColor||this.options.barBackgroundColor,{l:-15})}buildSplitSegments(t,e){const{barBorderRadius:n}=this.options,i=this.options.inputDateFormat,r=this.task.segments;if(this.task.type===ne.Milestone||!r||r.length<2)return null;const s=t=>_(t,i).valueOf(),o=t=>j(i)?s(t):_(t,i).add(1,"day").valueOf(),d=this.geometry.pixelsPerMs,c=this.geometry.rtl,u=s(r[0].start),p=o(r[r.length-1].end),m=h(t,{l:-15}),g=r.map((t=>({startMs:s(t.start),finishMs:o(t.end)}))),f=g.reduce(((t,e)=>t+(e.finishMs-e.startMs)),0);let b=Math.max(0,Math.min(100,this.task.progress))/100*f;const v=[],y=l(this.chartContext,{className:"bar-split-connector"});y.setAttribute("style",a({width:`${e}px`})),v.push(y);for(const e of g){const i=(e.finishMs-e.startMs)*d,r=c?(p-e.finishMs)*d:(e.startMs-u)*d,s=l(this.chartContext,{className:"bar-segment"});s.setAttribute("style",a({backgroundColor:t,borderRadius:n,left:`${r}px`,width:`${i}px`}));const o=e.finishMs-e.startMs,h=Math.max(0,Math.min(o,b));if(b-=h,h>0&&o>0){const t=l(this.chartContext,{className:"bar-segment-progress"});t.setAttribute("style",a({backgroundColor:m,borderRadius:n,width:h/o*100+"%"})),s.append(t)}v.push(s)}return v}getBarStyles(t){const{barBackgroundColor:e,barBorderRadius:n,barMargin:i,barTextColor:r,milestoneColor:s,rowHeight:o}=this.options,a=It.calculateX(this.task,this.geometry,this.options),l=It.calculateWidth(this.task,this.geometry,this.options),d=this.calculateHeight(),h=t||e;if(this.task.type===ne.Milestone){return{backgroundColor:this.task.barBackgroundColor||s,borderRadius:"2px",color:r,height:`${d}px`,left:`${a}px`,top:o/3-i/2+this.index*o+"px",transform:"rotate(45deg)",width:`${l}px`}}return{backgroundColor:h,borderRadius:n,color:r,height:`${d}px`,left:`${a}px`,top:`${i+this.index*o}px`,width:`${l}px`}}appendDependencyAnchors(t){var e;if(!(null==(e=this.options.dependencies)?void 0:e.editable))return;const n="data-taskid",i="aria-hidden",r=l(this.chartContext,{className:"bar-dep-anchor bar-dep-anchor-start"});r.setAttribute("data-bar-anchor","start"),r.setAttribute(n,this.task.id),r.setAttribute(i,"true");const s=l(this.chartContext,{className:"bar-dep-anchor bar-dep-anchor-end"});s.setAttribute("data-bar-anchor","finish"),s.setAttribute(n,this.task.id),s.setAttribute(i,"true"),t.append(r,s)}makeDraggable(t,e){new at(this.task.id,this.options,this.geometry.pixelsPerMs,this.chartContext,this.dataManager,this.geometry.rtl).makeDraggable(t,e)}makeResizable(t,e){new dt(this.task.id,this.options,this.geometry.pixelsPerMs,this.chartContext,this.dataManager,this.geometry.rtl).makeResizable(t,e)}makeProgressDraggable(t,e,n){new lt(this.task.id,this.options,this.chartContext,this.dataManager,this.geometry.rtl).makeProgressDraggable(t,e,n)}cleanup(){this.tooltipHandler&&(this.tooltipHandler.cleanup(),this.tooltipHandler=null)}}function $t(t){return null==t?"":String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ft(t){const{value:e,size:n=28,strokeWidth:i=3,progressColor:r="#3B82F6",trackColor:s="#E5E7EB",showLabel:o=!0,labelColor:a}=t,l=Math.max(0,Math.min(100,Number.isFinite(e)?e:0)),d=(n-i)/2,h=2*Math.PI*d,c=n/2,u=n/2,p=h*(1-l/100),m=o?`<text x="${c}" y="${u}" text-anchor="middle" dominant-baseline="central" font-size="${Math.round(.32*n)}" font-weight="600" fill="${a?$t(a):"currentColor"}">${l}</text>`:"";return`<svg class="apexgantt-progress-ring" width="${n}" height="${n}" viewBox="0 0 ${n} ${n}" role="img" aria-label="${l} percent complete" style="vertical-align:middle"><circle cx="${c}" cy="${u}" r="${d}" stroke="${$t(s)}" stroke-width="${i}" fill="none" /><circle cx="${c}" cy="${u}" r="${d}" stroke="${$t(r)}" stroke-width="${i}" fill="none" stroke-linecap="round" stroke-dasharray="${h}" stroke-dashoffset="${p}" transform="rotate(-90 ${c} ${u})" />`+m+"</svg>"}var Bt=(t=>(t.Assignees="assignees",t.BaselineEnd="baselineEnd",t.BaselineStart="baselineStart",t.BaselineVariance="baselineVariance",t.Duration="duration",t.EndTime="endTime",t.Name="name",t.Predecessors="predecessors",t.Progress="progress",t.ProgressRing="progressRing",t.StartTime="startTime",t.Successors="successors",t.Wbs="wbs",t))(Bt||{});const Lt=new Set(Object.values(Bt));function Rt(t){return Lt.has(t)}const Ht={assignees:"Assignees",baselineEnd:"Baseline End",baselineStart:"Baseline Start",baselineVariance:"Variance",duration:"Duration",endTime:"End",name:"Task Name",predecessors:"Predecessors",progress:"Progress",progressRing:"Progress",startTime:"Start",successors:"Successors",wbs:"WBS"},Pt=[{key:"name",title:Ht.name,minWidth:"120px",flexGrow:3},{key:"startTime",title:Ht.startTime,minWidth:"70px",flexGrow:1.5},{key:"duration",title:Ht.duration,minWidth:"50px",flexGrow:1},{key:"progress",title:Ht.progress,minWidth:"50px",flexGrow:1}];function zt(t,e=Pt){if(!t||0===t.length)return e;const n=t.map((t=>{const n=e.find((e=>e.key===t.key));return n?{...n,...t}:t})).filter((t=>!1!==t.visible));return 0===n.length?e:n}function Ot(t,e){if(!e||0===e.length)return t;const n=new Map(e.map(((t,e)=>[t,e]))),i=e.length;return t.map(((t,e)=>({col:t,i:e}))).sort(((t,e)=>(n.get(String(t.col.key))??i)-(n.get(String(e.col.key))??i)||t.i-e.i)).map((t=>t.col))}function Wt(t){return(t.assignees??[]).map((t=>t.name)).join(", ")}function Nt(t,e){var n;const i=null==(n=t.baseline)?void 0:n.end,r=t.showSummaryBar?t.summaryEnd:t.endTime;if(!i||!r)return;const s=_(i,e).valueOf(),o=_(r,e).valueOf();return Math.round((o-s)/it)}function qt(t,e,n,i,r){const s=i??{unit:"day",value:1},o=function(t,e){return"minute"===t.unit?"m":"hour"===t.unit?"h":e?"wd":"d"}(s,"day"===s.unit&&!r.isNoOp);if(!t||!e)return`0 ${o}`;const a=Math.max(1,s.value),l=!j(n);if("day"===s.unit){const n=r.workingDaysBetween(t,e,{inclusive:l});return`${Math.max(0,Math.round(n/a))} ${o}`}const d=_(t,n).valueOf(),h=_(e,n).valueOf(),c=("minute"===(u=s.unit)?et:"hour"===u?nt:it)*a;var u;const p=l?c:0;return`${Math.max(0,Math.round((h-d+p)/c))} ${o}`}function Yt(t,e,n,i,r=Q){const s=function(t,e,n){var i,r;switch(e){case"assignees":return $t(Wt(t));case"predecessors":return t.predecessors??"";case"successors":return t.successors??"";case"baselineStart":return(null==(i=t.baseline)?void 0:i.start)?_(t.baseline.start,n).format(n):"";case"baselineEnd":return(null==(r=t.baseline)?void 0:r.end)?_(t.baseline.end,n).format(n):"";case"baselineVariance":{const e=Nt(t,n);return void 0===e?"":`${e>0?"+":""}${e} d`}default:return}}(t,e,n);if(void 0!==s)return s;const o=t.showSummaryBar?t.summaryStart:t.startTime,a=t.showSummaryBar?t.summaryEnd:t.endTime;switch(e){case"startTime":return o?_(o,n).format(n):"";case"endTime":return a?_(a,n).format(n):"";case"duration":return qt(o,a,n,i,r);case"progress":return`${t.progress??0}%`;case"progressRing":return Ft({value:t.progress??0});case"wbs":return t.wbs??"";default:return t[e]}}function Ut(t,e,n,i,r=Q){const{key:s}=e;if(!Rt(s)&&e.accessor){const n=e.accessor(t);return null==n?"":String(n)}return Yt(t,s,n,i,r)}function Vt(t,e){const n=t.getInstanceId(),i=`.tasks-container .tasks-data-row[data-taskid="${e}"][data-chart-instance="${n}"]`,r=t.querySelector(i);return r||z.warn(`[${n}] Task row element not found for task: ${e}`),r}function jt(t,e){return(null==e?void 0:e.length)?e[t%e.length]:"transparent"}function _t(t,e,n){const i=Vt(t,e),r=Y(t,e);i&&(i.style.backgroundColor=n),r&&(r.style.backgroundColor=n)}const Gt=(t,e,n,i,r,s,o)=>{const{taskBar:a,taskBarRow:l,taskRow:d}=((t,e)=>{const n=Vt(t,e);return{taskBar:q(t,e),taskBarRow:Y(t,e),taskRow:n}})(t,n);if(!d||!a)return;const c=e.updateTask(n,i);if(!c)return;if(d.querySelectorAll(".tasks-data-cell").forEach((i=>{const s=i.getAttribute("data-columnid");if(!s)return;const a=null==o?void 0:o.columns.find((t=>t.key===s)),l=null==a?void 0:a.render,d=null==o?void 0:o.dispatcher;if(l&&d){const t=Rt(s);if(d.dispatch(l,{task:c,options:r,rowIndex:0,isSummary:!!c.showSummaryBar&&e.hasChildren(n),isMilestone:c.type===ne.Milestone},i),!t)return}else{const t={unit:r.snapUnit,value:r.snapValue};i.innerHTML=a?Ut(c,a,r.inputDateFormat,t,e.getCalendar()):Yt(c,s,r.inputDateFormat,t,e.getCalendar())}if("name"===s)if(e.hasChildren(n)){const r=t.createElement("span");r.className="task-toggle-icon "+(c.collapsed?"collapsed":"expanded"),r.addEventListener("click",(()=>{var t;e.toggleTask(n),null==(t=null==o?void 0:o.onToggleCollapse)||t.call(o)})),i.prepend(r)}else{const e=t.createElement("span");e.className="task-toggle-icon-blank",i.prepend(e)}})),i.rowBackgroundColor&&l&&(d.style.backgroundColor=i.rowBackgroundColor,l.style.backgroundColor=i.rowBackgroundColor),i.barBackgroundColor&&(a.style.backgroundColor=i.barBackgroundColor),i.startTime||i.endTime){const t=It.calculateX(c,s,r),e=It.calculateWidth(c,s,r);a.style.left=`${t}px`,a.style.width=`${e}px`}if(void 0!==i.progress){const t=a.querySelector(".bar-timeline-progress");t&&(t.style.width=`${i.progress}%`),i.barBackgroundColor&&(t.style.backgroundColor=h(i.barBackgroundColor,{l:-15}));const e=a.querySelector(".bar-progress-handle");e&&(e.style.left=`${i.progress}%`,e.setAttribute("aria-valuenow",String(Math.round(i.progress))));const n=a.querySelector(".bar-progress-handle-label");n&&(n.style.left=`${i.progress}%`,n.textContent=`${Math.round(i.progress)}%`)}if(void 0!==i.name){const t=a.querySelector(".bar-label");t&&N(t,r.barLabel,c)}void 0===i.startTime&&void 0===i.endTime&&void 0===i.type||e.updateDependencyArrows(n,t)},Kt=(t,e,n,i,r,s)=>{const o=t.getInstanceId(),a=e.getTaskById(n);if(!a)return;let l=a.parentId?e.getTaskById(a.parentId)??null:null;for(;l;){if(l.showSummaryBar){const n=l,a=`.tasks-container .tasks-data-row[data-taskid="${n.id}"][data-chart-instance="${o}"]`,d=t.querySelector(a);d&&d.querySelectorAll(".tasks-data-cell").forEach((t=>{const r=t.getAttribute("data-columnid");if(!r||"name"===r)return;const o=null==s?void 0:s.columns.find((t=>t.key===r)),a=null==o?void 0:o.render,l=null==s?void 0:s.dispatcher;if(a&&l)return void l.dispatch(a,{task:n,options:i,rowIndex:0,isSummary:!0,isMilestone:!1},t);const d={unit:i.snapUnit,value:i.snapValue};t.innerHTML=o?Ut(n,o,i.inputDateFormat,d,e.getCalendar()):Yt(n,r,i.inputDateFormat,d,e.getCalendar())}));const c=`.bar-container .bar-timeline[data-taskid="${n.id}"][data-chart-instance="${o}"]`,u=t.querySelector(c);if(u){const e=It.calculateX(n,r,i),s=It.calculateWidth(n,r,i);u.style.left=`${e}px`,u.style.width=`${s}px`;const o=n.progress??0,a=n.barBackgroundColor||i.summaryBarColor,l=h(a,{l:-15}),d=o>0?l:a,c=o>=100?l:a;u.style.setProperty("--summary-bar-color",a),u.style.setProperty("--summary-cap-left-color",d),u.style.setProperty("--summary-cap-right-color",c);let p=u.querySelector(".bar-timeline-progress");o>0?(p||(p=t.createElement("div"),p.className="bar-timeline-progress",u.appendChild(p)),p.style.backgroundColor=l,p.style.width=`${o}%`):p&&p.remove()}}l.showSummaryBar&&e.updateDependencyArrows(l.id,t),l=l.parentId?e.getTaskById(l.parentId)??null:null}};function Xt(t,e){const n=null==t||""===t,i=null==e||""===e;return n&&i?0:n?1:i?-1:"number"==typeof t&&"number"==typeof e?t-e:t instanceof Date&&e instanceof Date?t.valueOf()-e.valueOf():String(t).localeCompare(String(e))}function Zt(t,e,n,i){var r,s;const o=t.showSummaryBar?t.summaryStart:t.startTime,a=t.showSummaryBar?t.summaryEnd:t.endTime,l=t=>t?_(t,i.inputDateFormat).valueOf():void 0;if(Rt(e))switch(e){case Bt.Name:return(t.name??"").toLowerCase();case Bt.StartTime:return l(o);case Bt.EndTime:return l(a);case Bt.Duration:{const t=l(o),e=l(a);return void 0!==t&&void 0!==e?e-t:void 0}case Bt.Progress:case Bt.ProgressRing:return t.progress??0;case Bt.Wbs:return t.wbs??"";case Bt.Assignees:return Wt(t).toLowerCase();case Bt.Predecessors:return t.predecessors??"";case Bt.Successors:return t.successors??"";case Bt.BaselineStart:return l(null==(r=t.baseline)?void 0:r.start);case Bt.BaselineEnd:return l(null==(s=t.baseline)?void 0:s.end);case Bt.BaselineVariance:return Nt(t,i.inputDateFormat);default:return}return(null==n?void 0:n.accessor)?n.accessor(t):void 0}function Qt(t){return void 0!==t.sortable?t.sortable:Rt(t.key)?t.key!==Bt.Wbs:Boolean(t.accessor||t.comparator)}const Jt={zoomIn:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <circle cx="11" cy="11" r="8"/>\n <path d="m21 21-4.35-4.35"/>\n <line x1="11" y1="8" x2="11" y2="14"/>\n <line x1="8" y1="11" x2="14" y2="11"/>\n </svg>',zoomOut:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <circle cx="11" cy="11" r="8"/>\n <path d="m21 21-4.35-4.35"/>\n <line x1="8" y1="11" x2="14" y2="11"/>\n </svg>',calendar:'<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <rect x="3" y="4" width="18" height="18" rx="2" ry="2"/>\n <line x1="16" y1="2" x2="16" y2="6"/>\n <line x1="8" y1="2" x2="8" y2="6"/>\n <line x1="3" y1="10" x2="21" y2="10"/>\n </svg>',chevronDown:'<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <polyline points="6 9 12 15 18 9"/>\n </svg>',download:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>\n <polyline points="7 10 12 15 17 10"/>\n <line x1="12" y1="15" x2="12" y2="3"/>\n </svg>',plus:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <line x1="12" y1="5" x2="12" y2="19"/>\n <line x1="5" y1="12" x2="19" y2="12"/>\n </svg>',filter:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <polygon points="22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"/>\n </svg>',close:'<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <line x1="18" y1="6" x2="6" y2="18"/>\n <line x1="6" y1="6" x2="18" y2="18"/>\n </svg>',trash:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <polyline points="3 6 5 6 21 6"/>\n <path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/>\n <path d="M10 11v6"/>\n <path d="M14 11v6"/>\n <path d="M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"/>\n </svg>',undo:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M3 7v6h6"/>\n <path d="M21 17a9 9 0 0 0-15-6.7L3 13"/>\n </svg>',redo:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M21 7v6h-6"/>\n <path d="M3 17a9 9 0 0 1 15-6.7L21 13"/>\n </svg>'};function te(t){return"minute"===t?et:"hour"===t?nt:it}const ee="data-chart-instance";var ne=(t=>(t.Milestone="milestone",t.Task="task",t))(ne||{});function ie(t){return"string"==typeof t?{taskId:t,type:"FS",lag:0}:{taskId:t.taskId,type:t.type??"FS",lag:t.lag??0}}class re{constructor(t,e,n,i,r,s,o,a,l,d,h,c,u,p,m){this.options=t,this.chartContext=e,this.dataManager=n,this.selectionManager=i,this.commitInlineEdit=r,this.columnRenderManager=s,this.onAddTaskRowClick=o,this.onHeaderSort=a,this.getActiveSort=l,this.columnWidths=d,this.onColumnResize=c,this.columnOrder=u,this.onColumnReorder=p,this.onRowActivate=m,this.activeInlineEditor=null,this.selectionEnabled=t.enableSelection,this.showCheckbox=t.enableSelection&&t.showCheckboxColumn,this.inlineEditEnabled=t.enableInlineEdit&&!!r,this.columnsResizable=t.resizableColumns&&!!c,this.columnsReorderable=t.reorderableColumns&&!!p,this.columnWidthOverrides=new Map(h??[]),this.effectiveColumnList=this.mergeColumnConfig(),this.injectDynamicColumnStyles()}mergeColumnConfig(){return Ot(zt(this.options.columnConfig),this.columnOrder)}injectDynamicColumnStyles(){const t=(e=this.effectiveColumnList,n=this.columnWidths,i=this.columnWidthOverrides,e.map((t=>{const e=null==i?void 0:i.get(String(t.key));if(void 0!==e)return`${e}px`;const r=null==n?void 0:n.get(String(t.key));if(void 0!==r)return`minmax(${Math.min(r,32)}px, ${r}fr)`;const s=t.flexGrow||1;return`minmax(${t.minWidth||"30px"}, ${s}fr)`})).join(" "));var e,n,i;const r=this.showCheckbox?"28px ":"",s=this.chartContext.getInstanceId(),o=`\n .tasks-container .tasks-header[data-chart-instance="${s}"] .tasks-header-row {\n grid-template-columns: ${r}${t};\n }\n\n .tasks-container .tasks-data-row[data-chart-instance="${s}"] {\n grid-template-columns: ${r}${t};\n }\n `;this.chartContext.injectStyles(o,`tasks-dynamic-columns-${s}`,{priority:"high",force:!0})}generateBody(t,e,n){const i=l(this.chartContext,{className:"tasks-data-container"}),r=n?n.allTasks:t;return i.setAttribute("role","treegrid"),i.setAttribute("aria-label",this.options.taskListAriaLabel??"Gantt task list"),i.setAttribute("aria-rowcount",r.length.toString()),n?this.generateRowsVirtualized(r,i,e,n.range,n.rowHeight):this.generateRows(t,i,e),i}generateHeader(t){var e;const n=l(this.chartContext,{className:"tasks-header"}),i=l(this.chartContext,{className:"tasks-header-row"}),{rowHeight:r}=this.options,s=this.chartContext.getInstanceId();if(n.setAttribute(ee,s),this.showCheckbox){const t=l(this.chartContext,{className:"tasks-header-cell gantt-checkbox-cell"});t.style.height=2*r+"px";const e=this.chartContext.createElement("input");e.type="checkbox",e.className="gantt-select-all-checkbox",e.setAttribute("aria-label","Select all tasks"),e.addEventListener("change",(()=>{this.selectionManager&&(e.checked?this.selectionManager.selectAll():this.selectionManager.clearSelection())})),t.append(e),i.append(t)}const o=(null==(e=this.getActiveSort)?void 0:e.call(this))??[];return this.effectiveColumnList.forEach(((e,n)=>{const s=l(this.chartContext,{className:"tasks-header-cell"});s.append(l(this.chartContext,{className:"tasks-header-cell-label",content:t[n]??e.title})),s.style.height=2*r+"px",s.style.color="var(--text-color)";if(Boolean(this.onHeaderSort)&&Qt(e)){const t=o.findIndex((t=>t.key===e.key)),n=t>=0?o[t]:null,i=n?n.direction??"asc":null,r=o.length>1&&t>=0;s.classList.add("tasks-header-cell-sortable"),s.style.cursor="pointer",s.style.userSelect="none",s.setAttribute("role","button"),s.setAttribute("tabindex","0");const a="asc"===i?"sorted ascending":"desc"===i?"sorted descending":"not sorted",d=r?`, sort position ${t+1}`:"";s.setAttribute("aria-label",`${e.title}, ${a}${d}`);const h=l(this.chartContext,{className:"gantt-sort-caret"});h.setAttribute("aria-hidden","true"),h.innerHTML=`${function(t){const e=null!==t;return`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${e?"2.5":"2"}" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" opacity="${e?"1":"0.4"}">${"desc"===t?'<path d="M12 5v14"/><path d="m19 12-7 7-7-7"/>':'<path d="M12 19V5"/><path d="m5 12 7-7 7 7"/>'}</svg>`}(i)}${r?`<span class="gantt-sort-order">${t+1}</span>`:""}`,s.append(h);const c=t=>{var n;return null==(n=this.onHeaderSort)?void 0:n.call(this,e.key,{append:t})};s.addEventListener("click",(t=>c(t.shiftKey))),s.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),c(t.shiftKey))}))}this.columnsResizable&&!1!==e.resizable&&this.appendColumnResizeHandle(s,e),this.columnsReorderable&&this.attachColumnReorder(s,String(e.key)),i.append(s)})),n.append(i),n.style.background="var(--header-bg-color)",n}appendColumnResizeHandle(t,e){const n=String(e.key),i=l(this.chartContext,{className:"gantt-column-resize-handle"});i.setAttribute("role","separator"),i.setAttribute("aria-orientation","vertical"),i.setAttribute("aria-label",`Resize ${e.title} column`),i.addEventListener("click",(t=>t.stopPropagation())),i.addEventListener("dblclick",(t=>{var e;t.preventDefault(),t.stopPropagation(),this.columnWidthOverrides.delete(n),this.injectDynamicColumnStyles(),null==(e=this.onColumnResize)||e.call(this,n,null)})),i.addEventListener("pointerdown",(e=>this.startColumnResize(e,t,n))),t.append(i)}startColumnResize(t,e,n){var i,r;if(null!=t.button&&t.button>0)return;t.preventDefault(),t.stopPropagation();const s=t.clientX,o=e.getBoundingClientRect().width,a="rtl"===getComputedStyle(e).direction;if(null!=t.pointerId)try{null==(r=(i=t.target).setPointerCapture)||r.call(i,t.pointerId)}catch{}const l=t=>{const e=t,i=a?s-e.clientX:e.clientX-s,r=Math.max(40,Math.round(o+i));this.columnWidthOverrides.set(n,r),this.injectDynamicColumnStyles()},d=()=>{var t;this.chartContext.removeEventListener("pointermove",l),this.chartContext.removeEventListener("pointerup",d),this.chartContext.removeEventListener("pointercancel",d),null==(t=this.onColumnResize)||t.call(this,n,this.columnWidthOverrides.get(n)??null)};this.chartContext.addEventListener("pointermove",l),this.chartContext.addEventListener("pointerup",d),this.chartContext.addEventListener("pointercancel",d)}attachColumnReorder(t,e){t.addEventListener("pointerdown",(n=>this.startColumnReorder(n,t,e)))}startColumnReorder(t,e,n){if(null!=t.button&&t.button>0)return;const i=e.parentElement;if(!i)return;const r=t.clientX,s="rtl"===getComputedStyle(e).direction,o=Array.from(i.querySelectorAll(".tasks-header-cell:not(.gantt-checkbox-cell)")),a=o.indexOf(e);if(a<0)return;let d=!1,h=a,c=null;const u=()=>{this.chartContext.removeEventListener("pointermove",p),this.chartContext.removeEventListener("pointerup",m),this.chartContext.removeEventListener("pointercancel",m),e.classList.remove("tasks-header-cell-dragging"),null==c||c.remove()},p=t=>{const n=t;if(!d){if(Math.abs(n.clientX-r)<5)return;d=!0,e.classList.add("tasks-header-cell-dragging"),c=l(this.chartContext,{className:"tasks-column-drop-indicator"}),i.append(c)}h=function(t,e,n){let i=0;for(const r of t){const t=r.getBoundingClientRect(),s=t.left+t.width/2;(n?s>e:s<e)&&i++}return i}(o,n.clientX,s),function(t,e,n,i,r){const s=e.getBoundingClientRect().left,o=n.length;let a;a=r?i<o?n[i].getBoundingClientRect().right:n[o-1].getBoundingClientRect().left:i<o?n[i].getBoundingClientRect().left:n[o-1].getBoundingClientRect().right,t.style.left=a-s+"px"}(c,i,o,h,s)},m=()=>{var t;if(u(),!d)return;e.addEventListener("click",(t=>{t.stopPropagation(),t.preventDefault()}),{capture:!0,once:!0});const i=this.effectiveColumnList.map((t=>String(t.key)));let r=h;if(r>a&&r--,r===a)return;const[s]=i.splice(a,1);i.splice(r,0,s),null==(t=this.onColumnReorder)||t.call(this,n,i)};this.chartContext.addEventListener("pointermove",p),this.chartContext.addEventListener("pointerup",m),this.chartContext.addEventListener("pointercancel",m)}isCellEditable(t,e){return!!this.inlineEditEnabled&&(t.showSummaryBar&&this.dataManager.hasChildren(t.id)?e===Bt.Name:"milestone"===t.type?e===Bt.Name||e===Bt.StartTime:e===Bt.Name||e===Bt.StartTime||e===Bt.EndTime||e===Bt.Duration||e===Bt.Progress)}attachInlineEditHandler(t,e,n){t.addEventListener("dblclick",(i=>{i.stopPropagation();const r=this.dataManager.getTaskById(e);r&&this.openInlineEditor(t,r,n)}))}openInlineEditor(t,e,n){var i;this.activeInlineEditor&&this.activeInlineEditor.blur();const r=this.chartContext.createElement("input");r.className="inline-edit-input",this.configureEditorInput(r,e,n);const s=t.innerHTML;t.innerHTML="",t.appendChild(r);let o=!1;const a=()=>{o||(o=!0,this.activeInlineEditor=null,t.innerHTML=s)};if(r.addEventListener("keydown",(t=>{"Enter"===t.key?(t.preventDefault(),r.blur()):"Escape"===t.key&&(t.preventDefault(),a()),t.key.startsWith("Arrow")&&t.stopPropagation()})),r.addEventListener("blur",(()=>{var i;if(o)return;o=!0;const a=this.parseEditorValue(r,e,n);this.activeInlineEditor=null,a?null==(i=this.commitInlineEdit)||i.call(this,e.id,a):t.innerHTML=s})),this.activeInlineEditor=r,r.focus(),"text"!==r.type&&"number"!==r.type||r.select(),"date"===r.type||"datetime-local"===r.type)try{null==(i=r.showPicker)||i.call(r)}catch{}}configureEditorInput(t,e,n){const i=this.options.inputDateFormat,r=j(i),s=r?"datetime-local":"date",o=r?"YYYY-MM-DDTHH:mm":"YYYY-MM-DD";switch(n){case Bt.Name:t.type="text",t.value=e.name;break;case Bt.StartTime:t.type=s,t.value=e.startTime?_(e.startTime,i).format(o):"";break;case Bt.EndTime:t.type=s,t.value=e.endTime?_(e.endTime,i).format(o):"";break;case Bt.Duration:t.type="number",t.min="1",t.step="1",t.value=String(this.computeDurationInSnapUnits(e));break;case Bt.Progress:t.type="number",t.min="0",t.max="100",t.step="1",t.value=String(e.progress??0)}}computeDurationInSnapUnits(t){const e=this.options.inputDateFormat,{snapUnit:n,snapValue:i}=this.options,r=t.startTime?_(t.startTime,e):null,s=t.endTime?_(t.endTime,e):null;if(!(r&&s&&r.isValid()&&s.isValid()))return 1;const o=te(n)*Math.max(1,i),a=j(e)?0:o,l=s.valueOf()-r.valueOf()+a;return Math.max(1,Math.round(l/o))}parseEditorValue(t,e,n){const i=this.options.inputDateFormat,r=j(i),s=r?"YYYY-MM-DDTHH:mm":"YYYY-MM-DD",{snapUnit:o,snapValue:a}=this.options,l=te(o)*Math.max(1,a);switch(n){case Bt.Name:{const n=t.value.trim();return n&&n!==e.name?{name:n}:null}case Bt.StartTime:{if(!t.value)return null;const n=S(t.value,s);if(!n.isValid())return null;const r=n.format(i);if(r===e.startTime)return null;if("milestone"!==e.type&&e.endTime){const t=_(e.startTime,i),s=_(e.endTime,i);if(t.isValid()&&s.isValid()){const e=s.valueOf()-t.valueOf();return{startTime:r,endTime:n.add(e,"millisecond").format(i)}}}return{startTime:r}}case Bt.EndTime:{if(!t.value)return null;const n=S(t.value,s);if(!n.isValid())return null;const r=_(e.startTime,i);if(r.isValid()&&n.isBefore(r))return null;const o=n.format(i);return o===e.endTime?null:{endTime:o}}case Bt.Duration:{const n=parseInt(t.value,10);if(!Number.isFinite(n)||n<1)return null;const s=_(e.startTime,i);if(!s.isValid())return null;const o=(r?n:n-1)*l,a=s.add(o,"millisecond").format(i);return a===e.endTime?null:{endTime:a}}case Bt.Progress:{const n=parseInt(t.value,10);if(!Number.isFinite(n))return null;const i=Math.max(0,Math.min(100,n));return i===(e.progress??0)?null:{progress:i}}default:return null}}generateRow(t,e,n){var i;if(t.isGroup)return this.generateGroupRow(t,e,n);const r=l(this.chartContext,{className:"tasks-data-row"}),{rowHeight:s}=this.options,o=this.chartContext.getInstanceId();if(r.setAttribute("data-taskid",t.id),r.setAttribute(ee,o),r.style.height=`${s}px`,r.setAttribute("role","row"),r.setAttribute("aria-rowindex",n.toString()),r.setAttribute("aria-level",(t.level??1).toString()),r.setAttribute("aria-selected","false"),r.setAttribute("tabindex",1===n?"0":"-1"),this.dataManager.hasChildren(t.id)&&r.setAttribute("aria-expanded",t.collapsed?"false":"true"),this.showCheckbox){const e=l(this.chartContext,{className:"tasks-data-cell gantt-checkbox-cell"});e.style.height=`${s}px`;const n=this.chartContext.createElement("input");n.type="checkbox",n.className="gantt-selection-checkbox",n.checked=(null==(i=this.selectionManager)?void 0:i.isSelected(t.id))??!1,n.setAttribute("aria-label",`Select ${t.name}`),n.addEventListener("click",(e=>{e.stopPropagation(),this.selectionManager&&(e.shiftKey?this.selectionManager.handleClick(t.id,{ctrlKey:!1,metaKey:!1,shiftKey:!0}):this.selectionManager.toggleTask(t.id))})),e.append(n),r.append(e)}if(this.selectionEnabled&&this.selectionManager){const e=this.selectionManager;r.addEventListener("click",(n=>{n.target.classList.contains("gantt-selection-checkbox")||n.target.classList.contains("task-toggle-icon")||(e.handleClick(t.id,{ctrlKey:n.ctrlKey,metaKey:n.metaKey,shiftKey:n.shiftKey}),r.focus())})),r.style.cursor="pointer"}if(this.options.scrollToTaskOnRowClick&&this.onRowActivate){const e=this.onRowActivate;r.addEventListener("click",(n=>{const i=n.target;i.classList.contains("gantt-selection-checkbox")||i.classList.contains("task-toggle-icon")||i.closest('input, textarea, select, [contenteditable="true"]')||e(t.id)})),r.style.cursor="pointer"}let a=1;return this.effectiveColumnList.forEach((i=>{const{key:h}=i,c=Rt(h)?h:null,u=l(this.chartContext,{className:"tasks-data-cell",content:!c&&i.render?"":Ut(t,i,this.options.inputDateFormat,{unit:this.options.snapUnit,value:this.options.snapValue},this.dataManager.getCalendar())});u.setAttribute("data-columnid",h),u.setAttribute(ee,o),u.style.height=`${s}px`,u.style.color="var(--text-color)",u.setAttribute("role","gridcell"),u.setAttribute("aria-colindex",a.toString());const p=!!c&&this.isCellEditable(t,c);if(u.setAttribute("aria-readonly",p?"false":"true"),p&&c&&(u.classList.add("inline-editable"),this.attachInlineEditHandler(u,t.id,c)),a++,!c&&i.render&&this.columnRenderManager){const e={task:t,options:this.options,rowIndex:n-1,isSummary:!!t.showSummaryBar&&this.dataManager.hasChildren(t.id),isMilestone:"milestone"===t.type};this.columnRenderManager.dispatch(i.render,e,u)}if(c===Bt.Name){if(u.style.paddingLeft=15*(t.level??0)+"px",u.style.textAlign="left",u.innerHTML="",this.dataManager.hasChildren(t.id)){const n=d(this.chartContext,"span",{className:"task-toggle-icon "+(t.collapsed?"collapsed":"expanded")});n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label",t.collapsed?`Expand ${t.name}`:`Collapse ${t.name}`);const i=()=>{this.dataManager.toggleTask(t.id),e()};n.addEventListener("click",i),n.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i())})),u.append(n)}else{const t=d(this.chartContext,"span",{className:"task-toggle-icon-blank"});u.append(t)}const n=d(this.chartContext,"span",{textContent:t.name});u.append(n)}r.append(u)})),r}generateGroupRow(t,e,n){const{rowHeight:i}=this.options,r=bt(this.options),s=this.chartContext.getInstanceId(),o=t.groupKey??"",a=this.dataManager.isGroupCollapsed(o),h=l(this.chartContext,{className:"tasks-data-row tasks-group-row"});h.setAttribute("data-taskid",t.id),h.setAttribute(ee,s),h.style.height=`${i}px`,h.setAttribute("role","row"),h.setAttribute("aria-rowindex",n.toString()),h.setAttribute("aria-level","1"),h.setAttribute("aria-expanded",a?"false":"true"),h.setAttribute("tabindex",1===n?"0":"-1");const c=l(this.chartContext,{className:"tasks-data-cell tasks-group-cell"});c.setAttribute(ee,s),c.setAttribute("role","gridcell"),c.setAttribute("aria-colindex","1"),c.style.height=`${i}px`;const u=d(this.chartContext,"span",{className:"task-toggle-icon "+(a?"collapsed":"expanded")});u.setAttribute("role","button"),u.setAttribute("tabindex","0");const p=t.groupLabel??"";u.setAttribute("aria-label",a?`Expand ${p}`:`Collapse ${p}`);const m=()=>{this.dataManager.toggleGroup(o),e()};u.addEventListener("click",m),u.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),m())})),c.append(u);const g=d(this.chartContext,"span",{className:"tasks-group-label",textContent:p});c.append(g);const f=d(this.chartContext,"span",{className:"tasks-group-count",textContent:r.groupCountLabel(t.groupCount??0)});return c.append(f),h.append(c),h}generateRows(t,e,n){return t.forEach(((t,i)=>{const r=this.generateRow(t,n,i+1);e.appendChild(r)})),this.onAddTaskRowClick&&e.appendChild(this.generateAddTaskRow(this.onAddTaskRowClick)),this.fillEmptyRows(e,t.length+(this.onAddTaskRowClick?1:0),n),e}generateAddTaskRow(t){const e=l(this.chartContext,{className:"tasks-data-row tasks-add-row"}),{rowHeight:n}=this.options,i=this.chartContext.getInstanceId(),r=bt(this.options);e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.setAttribute("aria-label",r.addTask),e.setAttribute(ee,i),e.style.height=`${n}px`;const s=l(this.chartContext,{className:"tasks-data-cell tasks-add-row-cell"});s.setAttribute(ee,i),s.style.height=`${n}px`,s.textContent=r.addTaskRowLabel,e.append(s);const o=e=>{e.preventDefault(),e.stopPropagation(),t()};return e.addEventListener("click",o),e.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||o(t)})),e}generateRowsVirtualized(t,e,n,i,r){const{startIndex:s,endIndex:o}=i,a=t.length,l=this.chartContext.createElement("div");l.className="virtualizer-top-spacer",l.style.height=s*r+"px",e.appendChild(l);t.slice(s,o+1).forEach(((t,i)=>{const r=s+i,o=this.generateRow(t,n,r+1);e.appendChild(o)}));const d=Math.max(0,(a-1-o)*r),h=this.chartContext.createElement("div");return h.className="virtualizer-bottom-spacer",h.style.height=`${d}px`,e.appendChild(h),e}fillEmptyRows(t,e,n){const i=this.chartContext.querySelector(".gantt-container");if(!i)return;const r=i.clientHeight,s=this.options.rowHeight,o=r-2*s,a=Math.floor(o/s),l=Math.max(0,a-e);for(let e=0;e<l;e++){const n=this.generateEmptyRow(e);t.appendChild(n)}}generateEmptyRow(t){const e=l(this.chartContext,{className:"tasks-data-row tasks-empty-row"}),{rowHeight:n}=this.options,i=this.chartContext.getInstanceId();return e.setAttribute("data-taskid",`empty-${t}`),e.setAttribute(ee,i),e.style.height=`${n}px`,this.effectiveColumnList.forEach((({key:t})=>{const r=l(this.chartContext,{className:"tasks-data-cell",content:""});r.setAttribute("data-columnid",t),r.setAttribute(ee,i),r.style.height=`${n}px`,r.style.color="var(--text-color)",e.append(r)})),e}render(t,e){const n=this.generateHeader(this.effectiveColumnList.map((t=>t.title))),i=e?e.allTasks.slice(e.range.startIndex,e.range.endIndex+1):this.dataManager.getFlatVisibleTasks();return[n,this.generateBody(i,t,e)]}}function se(t,e,n,i){let r;if(r=e.accessor?e.accessor(t):(null==n?void 0:n.accessor)?n.accessor(t):Rt(e.field)?Yt(t,e.field,i.inputDateFormat,void 0,i.calendar):t[e.field],null==r||""===r)return{key:"",label:i.noneLabel};const s=e.label?e.label(r):String(r);return{key:String(r),label:s}}function oe(t){return{id:`__group__:${t.key}`,name:t.label,startTime:"",endTime:"",progress:0,type:ne.Task,level:0,isGroup:!0,groupKey:t.key,groupLabel:t.label,groupCount:t.members.length}}function ae(t,e){return t&&0!==t.length?t.filter((t=>(null==t?void 0:t.start)&&(null==t?void 0:t.end))).map((t=>({start:t.start,end:t.end}))).sort(((t,n)=>_(t.start,e).valueOf()-_(n.start,e).valueOf())):[]}function le(t,e,n){const i=t=>S(_(t,n).valueOf()+e).format(n);return t.map((t=>({start:i(t.start),end:i(t.end)})))}const de=180/(7*it);function he(t,e){return null==t?S().valueOf():"number"==typeof t?t:t instanceof Date?t.getTime():"string"==typeof t?_(t,e).valueOf():t.valueOf()}class ce{constructor(t,e,n="YYYY-MM-DD",i=!1,r=0){this.origin=t,this.pixelsPerMs=e,this.inputDateFormat=n,this.rtl=i,this.totalWidth=r}xForDate(t){return(he(t,this.inputDateFormat)-this.origin.valueOf())*this.pixelsPerMs}leftForDate(t,e=0){const n=this.xForDate(t);return this.rtl?this.totalWidth-n-e:n}widthForRange(t,e){return(he(e,this.inputDateFormat)-he(t,this.inputDateFormat))*this.pixelsPerMs}dateForX(t){const e=this.rtl?this.totalWidth-t:t;return S(this.origin.valueOf()+e/this.pixelsPerMs)}get pixelsPerDay(){return this.pixelsPerMs*it}get msPerPixel(){return 1/this.pixelsPerMs}}function ue(t){const e=t.startOf("quarter");return{first:e.format("MMM"),last:e.add(2,"month").format("MMM")}}const pe={minute:{id:"minute",unit:"minute",step:15,msPerCell:9e5,parent:"hour",formats:{sub:[{minWidth:60,format:t=>t.format("HH:mm")},{minWidth:0,format:t=>t.format("mm")}],top:[{minWidth:60,format:t=>t.format("HH:mm")},{minWidth:0,format:t=>t.format("mm")}]}},hour:{id:"hour",unit:"hour",step:1,msPerCell:36e5,parent:"day",formats:{sub:[{minWidth:80,format:t=>t.format("h A")},{minWidth:30,format:t=>t.format("HH")},{minWidth:0,format:t=>t.format("h")}],top:[{minWidth:180,format:t=>t.format("ddd DD MMM, h A")},{minWidth:110,format:t=>t.format("DD MMM, h A")},{minWidth:60,format:t=>t.format("h A")},{minWidth:0,format:t=>t.format("HH")}]}},halfday:{id:"halfday",unit:"hour",step:12,msPerCell:432e5,parent:"day",minSubPx:200,formats:{sub:[{minWidth:60,format:t=>t.format("A")},{minWidth:0,format:t=>t.format("A").charAt(0)}],top:[{minWidth:100,format:t=>t.format("DD MMM, A")},{minWidth:0,format:t=>t.format("A")}]}},day:{id:"day",unit:"day",step:1,msPerCell:it,parent:"week",minSubPx:42,formats:{sub:[{minWidth:100,format:t=>t.format("ddd DD MMM")},{minWidth:60,format:t=>t.format("DD MMM")},{minWidth:0,format:t=>t.format("dd").charAt(0)}],top:[{minWidth:150,format:t=>t.format("ddd DD MMM YYYY")},{minWidth:100,format:t=>t.format("ddd DD MMM")},{minWidth:60,format:t=>t.format("DD MMM")},{minWidth:0,format:t=>t.format("DD/MM")}]}},week:{id:"week",unit:"week",step:1,msPerCell:7*it,parent:"month",formats:{sub:[{minWidth:220,format:t=>`#${t.week()}, ${t.day(0).format("DD MMM")} - ${t.day(6).format("DD MMM")}`},{minWidth:140,format:t=>`Wk ${t.week()}, ${t.day(0).format("DD MMM")}`},{minWidth:100,format:t=>t.day(0).format("DD MMM")},{minWidth:0,format:t=>`${t.week()}`}],top:[{minWidth:320,format:t=>`${t.day(0).format("DD MMM YYYY")} - ${t.day(6).format("DD MMM YYYY")}`},{minWidth:220,format:t=>`#${t.week()}, ${t.day(0).format("DD MMM YYYY")}`},{minWidth:120,format:t=>`Wk ${t.week()}, ${t.day(0).format("DD MMM")}`},{minWidth:0,format:t=>`Wk ${t.week()}`}]}},month:{id:"month",unit:"month",step:1,msPerCell:30.4375*it,parent:"year",formats:{sub:[{minWidth:110,format:t=>t.format("MMMM")},{minWidth:60,format:t=>t.format("MMM")},{minWidth:0,format:t=>t.format("M")}],top:[{minWidth:130,format:t=>t.format("MMMM YYYY")},{minWidth:80,format:t=>t.format("MMM YYYY")},{minWidth:50,format:t=>t.format("MMM")},{minWidth:0,format:t=>t.format("MM/YY")}]}},quarter:{id:"quarter",unit:"quarter",step:1,msPerCell:91.3125*it,parent:"year",formats:{sub:[{minWidth:100,format:t=>{const e=ue(t);return`#${t.quarter()} ${e.first}-${e.last}`}},{minWidth:50,format:t=>`#${t.quarter()}`},{minWidth:0,format:t=>`Q${t.quarter()}`}],top:[{minWidth:140,format:t=>{const e=ue(t);return`#${t.quarter()} ${e.first}-${e.last} ${t.format("YYYY")}`}},{minWidth:80,format:t=>`#${t.quarter()} ${t.format("YYYY")}`},{minWidth:0,format:t=>`Q${t.quarter()}`}]}},year:{id:"year",unit:"year",step:1,msPerCell:365.25*it,parent:null,formats:{sub:[{minWidth:80,format:t=>t.format("YYYY")},{minWidth:40,format:t=>`'${t.format("YY")}`},{minWidth:0,format:t=>t.format("YY")}],top:[{minWidth:0,format:t=>t.format("YYYY")}]}}},me=["minute","hour","halfday","day","week","month","quarter","year"],ge=80,fe=50;function be(t){let e=pe.year;for(const n of me){const i=pe[n],r=i.minSubPx??ge;if(i.msPerCell*t>=r){e=i;break}}let n=null;if(e.parent){const i=pe[e.parent];i.msPerCell*t>=fe&&(n=i)}return{top:n,sub:e}}function ve(t,e){const n=t.startOf(e.unit);return e.step<=1?n:"minute"===e.unit?n.minute(Math.floor(n.minute()/e.step)*e.step):"hour"===e.unit?n.hour(Math.floor(n.hour()/e.step)*e.step):n}function ye(t,e){for(const n of t)if(e>=n.minWidth)return n.format;return t[t.length-1].format}function xe(t,e,n,i,r,s){const o=[],a=t.valueOf(),l=e.valueOf(),d=n.formats[i];let h=ve(t,n);for(;h.valueOf()<l;){const t=h.add(n.step,n.unit),e=Math.max(h.valueOf(),a),i=Math.min(t.valueOf(),l);if(i>e){const t=(i-e)*r.pixelsPerMs,n=ye(d,t);o.push({data:n(K(h,s)),width:t})}h=t}return o}function we(t,e,n,i,r,s=!1){const o=be(n),a=function(t,e,n){return[ve(t,n),ve(e,n).add(n.step,n.unit)]}(t,e,o.sub),l=(a[1].valueOf()-a[0].valueOf())*n,d=new ce(a[0],n,i,s,l),h=xe(a[0],a[1],o.sub,"sub",d,r);return{geometry:d,timelineSpan:a,top:o.top?xe(a[0],a[1],o.top,"top",d,r):null,sub:h,tiers:o}}S.extend(A);const ke="root";class Ce{constructor(t=[]){this.dependencies=[],this.buildingTree=!1,this.taskMap={},this.taskTree={},this.arrowLinkInstanceId=null,this.revision=0,this.flatVisibleIndexCache=null,this.dependencyAdjacencyCache=null,this.userSetSummaryProgress=new Set,this.calendar=Q,this.holidaysByKey=new Map,this.inputDateFormat="MM-DD-YYYY",this.naturalSeq=new Map,this.nextSeq=0,this.sortComparator=void 0,this.filterPredicate=null,this.filteredIds=null,this.groupCriterion=null,this.groupColumn=void 0,this.groupNoneLabel="(None)",this.collapsedGroups=new Set,this.startTimeComparator=(t,e)=>{const n=t.startTime||(t.showSummaryBar?t.summaryStart:void 0),i=e.startTime||(e.showSummaryBar?e.summaryStart:void 0);return(n?_(n,this.inputDateFormat).valueOf():1/0)-(i?_(i,this.inputDateFormat).valueOf():1/0)},this.compareTasks=(t,e)=>{const n=void 0===this.sortComparator?this.startTimeComparator:this.sortComparator;if(n){const i=n(t,e);if(0!==i)return i}return(this.naturalSeq.get(t.id)??0)-(this.naturalSeq.get(e.id)??0)},this.setTasks(t)}setInputDateFormat(t){this.inputDateFormat=t}setCalendar(t,e=[]){this.calendar=t,this.holidaysByKey=new Map(e.map((t=>[t.key,t])))}getCalendar(){return this.calendar}getHolidaysByKey(){return this.holidaysByKey}buildTaskTree(t){this.buildingTree=!0;const e={[ke]:[]},n=new Set(t.map((t=>t.id)));t.forEach((t=>{var i;if(this.taskMap[t.id]=t,e[t.id]||(e[t.id]=[]),void 0===t.parentId||e[t.parentId]||(e[t.parentId]=[]),t.dependency){const{taskId:e,type:i,lag:r}=ie(t.dependency);n.has(e)&&this.addDependency(e,t.id,i,r)}t.parentId?null==(i=e[t.parentId])||i.push(t.id):e[ke].push(t.id)})),this.taskTree=e,this.buildingTree=!1,this.revision++}computeDependencyFields(){var t,e;const n=new Map,i=new Map;for(const r of this.dependencies)null==(t=n.get(r.toId)??n.set(r.toId,[]).get(r.toId))||t.push(r),null==(e=i.get(r.fromId)??i.set(r.fromId,[]).get(r.fromId))||e.push(r);const r=(t,e,n)=>{if(!t)return"";return`${t}${"FS"!==e?e:""}${n?`${n>0?"+":""}${n}d`:""}`};for(const t of Object.keys(this.taskMap)){const e=this.taskMap[t],s=(n.get(t)??[]).map((t=>{var e;return r(null==(e=this.taskMap[t.fromId])?void 0:e.wbs,t.type,t.lag)})).filter(Boolean).join(", "),o=(i.get(t)??[]).map((t=>{var e;return r(null==(e=this.taskMap[t.toId])?void 0:e.wbs,t.type,t.lag)})).filter(Boolean).join(", ");this.taskMap[t]={...e,predecessors:s,successors:o}}}applyShowSummaryBarDefaults(){Object.keys(this.taskTree).forEach((t=>{var e;if("root"===t)return;const n=this.taskMap[t];if(!n)return;const i=(null==(e=this.taskTree[t])?void 0:e.length)>0;if(!n.startTime&&!n.endTime&&!i)throw new Error(`Task "${t}" has no startTime/endTime and no children. Provide dates or add child tasks.`);!1!==n.showSummaryBar&&i&&(this.taskMap[t]={...n,showSummaryBar:!0})}))}processLevel(){const t=(e,n)=>{e.forEach((e=>{this.taskMap[e.id]={...e,level:n};const i=this.taskTree[e.id].map((t=>this.taskMap[t]));Array.isArray(i)&&t(i,n+1)}))};t(this.getTasks().filter((t=>!t.parentId)),1)}processWbs(){const t=(e,n)=>{(this.taskTree[e]??[]).forEach(((e,i)=>{const r=n?`${n}.${i+1}`:`${i+1}`,s=this.taskMap[e];s&&(this.taskMap[e]={...s,wbs:r},t(e,r))}))};t(ke,"")}applySort(){const t=e=>{const n=this.taskTree[e];if(!n||0===n.length)return;const i=n.map((t=>this.taskMap[t])).filter((t=>null!=t));i.sort(this.compareTasks),this.taskTree[e]=i.map((t=>t.id)),i.forEach((e=>t(e.id)))};t(ke)}setSortComparator(t){this.sortComparator=t,this.applySort(),this.processWbs(),this.computeDependencyFields(),this.revision++}setFilterPredicate(t){this.filterPredicate=t,this.recomputeFilter(),this.revision++}hasActiveFilter(){return null!==this.filterPredicate}recomputeFilter(){if(!this.filterPredicate)return void(this.filteredIds=null);const t=this.filterPredicate,e=new Set,n=i=>{const r=this.taskMap[i];if(!r)return!1;let s=!1;return(this.taskTree[i]??[]).forEach((t=>{n(t)&&(s=!0)})),!(!t(r)&&!s)&&(e.add(i),!0)};(this.taskTree[ke]??[]).forEach(n),this.filteredIds=e}setGroupBy(t,e,n){this.groupCriterion=t,this.groupColumn=e,void 0!==n&&(this.groupNoneLabel=n),this.collapsedGroups.clear(),this.revision++}getGroupBy(){return this.groupCriterion}isGrouping(){return null!==this.groupCriterion}toggleGroup(t){this.collapsedGroups.has(t)?this.collapsedGroups.delete(t):this.collapsedGroups.add(t),this.revision++}isGroupCollapsed(t){return this.collapsedGroups.has(t)}getGroupedFlatTasks(){const t=this.groupCriterion;if(!t)return[];const e={inputDateFormat:this.inputDateFormat,calendar:this.calendar,noneLabel:this.groupNoneLabel},n=function(t,e,n,i){const r=new Map;for(const s of t){const{key:t,label:o}=se(s,e,n,i);let a=r.get(t);a||(a={key:t,label:o,members:[]},r.set(t,a)),a.members.push(s)}const s="desc"===e.direction?-1:1;return[...r.values()].sort(((t,e)=>""===t.key||""===e.key?""===t.key?1:-1:t.label.localeCompare(e.label)*s))}(Object.values(this.taskMap).filter((t=>!this.filterPredicate||this.filterPredicate(t))).sort(this.compareTasks),t,this.groupColumn,e),i=[];for(const t of n)if(i.push(oe(t)),!this.collapsedGroups.has(t.key))for(const e of t.members)i.push({...e,level:1});return i}validateTask(t){if(!t.id)throw new Error("Task must have an id");const e=ae(t.segments,this.inputDateFormat);if(e.length>=1){const i={startTime:(n=e)[0].start,endTime:n[n.length-1].end};t={...t,segments:e,startTime:i.startTime,endTime:i.endTime}}var n;if(t.showSummaryBar||!t.startTime&&!t.endTime)return{...t,startTime:t.startTime??"",endTime:t.endTime??"",progress:t.progress??0,type:t.type??ne.Task,level:1};if("milestone"===t.type){if(!t.startTime)throw new Error("Milestone must have an id and start date")}else if(!t.startTime||!t.endTime)throw new Error("Task must have an id, start, and end date");return{...t,endTime:t.endTime||t.startTime,progress:t.progress??0,type:t.type??ne.Task,level:1}}computeSummaryDates(){const t=e=>{const n=this.taskTree[e]||[];if(0===n.length){const t=this.taskMap[e];return(null==t?void 0:t.startTime)&&t.endTime?{starts:[_(t.startTime,this.inputDateFormat)],ends:[_(t.endTime,this.inputDateFormat)]}:{ends:[],starts:[]}}const i=[],r=[];return n.forEach((e=>{const n=this.taskMap[e];if(n)if(n.showSummaryBar){const n=t(e);i.push(...n.starts),r.push(...n.ends)}else{n.startTime&&i.push(_(n.startTime,this.inputDateFormat)),n.endTime&&r.push(_(n.endTime,this.inputDateFormat));const s=t(e);i.push(...s.starts),r.push(...s.ends)}})),{ends:r,starts:i}};Object.values(this.taskMap).forEach((e=>{if(!e.showSummaryBar)return;const{ends:n,starts:i}=t(e.id);if(0===i.length||0===n.length)return;const r=S.min(i),s=S.max(n);this.taskMap[e.id]={...this.taskMap[e.id],summaryStart:r.format("YYYY-MM-DD"),summaryEnd:s.format("YYYY-MM-DD")}}))}computeSummaryProgress(){const t=e=>{const n=this.taskMap[e];if(!n)return{totalDuration:0,weightedProgress:0};const i=this.taskTree[e]||[];if(0===i.length){if(!n.startTime||!n.endTime)return{totalDuration:0,weightedProgress:0};const t=Math.max(1,this.calendar.workingDaysBetween(n.startTime,n.endTime,{inclusive:!0}));return{totalDuration:t,weightedProgress:t*(n.progress??0)}}let r=0,s=0;return i.forEach((e=>{const n=t(e);r+=n.totalDuration,s+=n.weightedProgress})),n.showSummaryBar&&!this.userSetSummaryProgress.has(n.id)&&r>0&&(this.taskMap[n.id]={...n,progress:Math.round(s/r)}),{totalDuration:r,weightedProgress:s}};(this.taskTree[ke]||[]).forEach((e=>t(e)))}addDependency(t,e,n="FS",i=0){this.dependencies.some((n=>n.fromId===t&&n.toId===e))||(this.dependencies.push({fromId:t,toId:e,type:n,lag:i}),this.revision++,this.buildingTree||this.computeDependencyFields())}addTask(t){const e=this.validateTask(t);this.taskMap[e.id]=e,this.naturalSeq.has(e.id)||this.naturalSeq.set(e.id,this.nextSeq++),this.buildTaskTree(this.getTasks()),this.applyShowSummaryBarDefaults(),this.computeSummaryDates(),this.computeSummaryProgress(),this.applySort(),this.processWbs(),this.computeDependencyFields(),this.recomputeFilter()}calculateProgress(){const t=this.getTasks().filter((t=>!!t.startTime&&!!t.endTime)),e=t=>this.calendar.workingDaysBetween(t.startTime,t.endTime),n=t.reduce(((t,n)=>t+e(n)),0),i=t.reduce(((t,n)=>t+n.progress/100*e(n)),0);return n?i/n*100:0}getDateRange(t=0,e,n=0){const i=this.getTasks(),r=be(e).sub,s=r.unit,o=r.step,a=t=>{if(n<=0||e<=0)return t;const i=n/e;return t.subtract(i,"millisecond").startOf(s)};if(0===i.length){const e=S();return[a(e.startOf(s)),e.startOf(s).add((30+t)*o,s)]}const l=i.filter((t=>!!t.startTime)).map((t=>_(t.startTime,this.inputDateFormat))),d=i.filter((t=>!!t.endTime)).map((t=>_(t.endTime,this.inputDateFormat)));return[a(S.min(l)),S.max(d).add(t*o,s)]}getFlatSortedTasks(t,e=!1,n=!1){let i=[];return t.forEach((t=>{if(n&&this.filteredIds&&!this.filteredIds.has(t.id))return;i.push(t);const r=this.taskTree[t.id].map((t=>this.taskMap[t]));!e&&t.collapsed||!Array.isArray(r)||(i=i.concat(this.getFlatSortedTasks(r,e,n)))})),i}getFlatTasks(){return this.getFlatSortedTasks(this.taskTree[ke].map((t=>this.getTaskById(t))).filter((t=>null!==t)),!0)}getFlatVisibleTasks(){return this.groupCriterion?this.getGroupedFlatTasks():this.getFlatSortedTasks(this.taskTree[ke].map((t=>this.getTaskById(t))).filter((t=>null!==t)),!1,!0)}getFlatVisibleIndex(){if(this.flatVisibleIndexCache&&this.flatVisibleIndexCache.revision===this.revision)return{indexMap:this.flatVisibleIndexCache.map,count:this.flatVisibleIndexCache.count};const t=this.getFlatVisibleTasks(),e=new Map;return t.forEach(((t,n)=>e.set(t.id,n))),this.flatVisibleIndexCache={revision:this.revision,map:e,count:t.length},{indexMap:e,count:t.length}}getImmediateChildren(t){return(this.taskTree[t]||[]).map((t=>this.taskMap[t])).filter((t=>null!=t))}getNestedChildTasks(t,e=!1){const n=[],i=t=>{var r;if(e&&(null==(r=this.taskMap[t])?void 0:r.collapsed))return;(this.taskTree[t]||[]).forEach((t=>{const e=this.taskMap[t];e&&(n.push(e),i(t))}))};return i(t),n}getTaskById(t){return this.taskMap[t]}getTaskDependencies(t){return{incoming:this.dependencies.filter((e=>e.toId===t)),outgoing:this.dependencies.filter((e=>e.fromId===t))}}getTasks(){return Object.values(this.taskMap)}getTopParentTasks(){return Object.values(this.taskMap).filter((t=>void 0===t.parentId&&t.type===ne.Task))}hasChildren(t){var e;return((null==(e=this.taskTree[t])?void 0:e.length)??0)>0}removeDependency(t,e){this.dependencies=this.dependencies.filter((n=>!(n.fromId===t&&n.toId===e))),this.revision++;const n=this.taskMap[e];if(null==n?void 0:n.dependency){if(ie(n.dependency).taskId===t){const{dependency:t,...i}=n;this.taskMap[e]=i}}this.buildingTree||this.computeDependencyFields()}removeTask(t){delete this.taskMap[t],this.userSetSummaryProgress.delete(t),this.naturalSeq.delete(t),this.buildTaskTree(Object.values(this.taskMap)),this.applySort(),this.processWbs(),this.computeDependencyFields(),this.recomputeFilter()}setTasks(t){if(!Array.isArray(t))throw new Error("Tasks must be an array");this.userSetSummaryProgress=new Set;const e=t.map((t=>this.validateTask(t)));this.taskMap={},this.dependencies=[],this.naturalSeq=new Map(e.map(((t,e)=>[t.id,e]))),this.nextSeq=e.length,this.buildTaskTree(e),this.applyShowSummaryBarDefaults(),this.computeSummaryDates(),this.computeSummaryProgress(),this.applySort(),this.processLevel(),this.processWbs(),this.computeDependencyFields(),this.recomputeFilter()}toggleTask(t){const e=this.getTaskById(t);e&&(this.taskMap[t]={...e,collapsed:!e.collapsed},this.revision++)}setCollapsedTasks(t){const e=new Set(t);let n=!1;for(const t of Object.keys(this.taskMap)){const i=this.taskMap[t],r=e.has(t);!!i.collapsed!==r&&(this.taskMap[t]={...i,collapsed:r},n=!0)}n&&this.revision++}setArrowLinkInstanceId(t){this.arrowLinkInstanceId=t}updateDependencyArrows(t,e){const n=this.getTaskDependencies(t);[...n.incoming,...n.outgoing].forEach((t=>{const n=this.getTaskById(t.fromId),i=this.getTaskById(t.toId);if(n&&i){const n=(null==e?void 0:e.getInstanceId())||"unknown",i={fromId:t.fromId,toId:t.toId,type:t.type,lag:t.lag,chartInstanceId:n,arrowLinkInstanceId:this.arrowLinkInstanceId??void 0},r=new CustomEvent("dependencyArrowUpdate",{detail:i,bubbles:!1,cancelable:!1});e?e.dispatchEvent(r):(z.warn(`[${n}] No chartContext provided for dependency arrow update`),document.dispatchEvent(r))}}))}getAllDependencies(){return this.dependencies}getDependencyAdjacency(){if(this.dependencyAdjacencyCache&&this.dependencyAdjacencyCache.revision===this.revision)return this.dependencyAdjacencyCache.map;const t=new Map,e=(e,n)=>{const i=t.get(e);i?i.push(n):t.set(e,[n])};for(const t of this.dependencies)e(t.fromId,t),t.toId!==t.fromId&&e(t.toId,t);return this.dependencyAdjacencyCache={revision:this.revision,map:t},t}updateTask(t,e){const n=this.taskMap[t];if(!n)throw new Error(`Task with id "${t}" not found`);"progress"in e&&(void 0===e.progress?this.userSetSummaryProgress.delete(t):this.userSetSummaryProgress.add(t));const i=function(t,e,n){if(i=t.segments,!(i&&i.length>1)||"segments"in e)return e;var i;const r=null!=e.startTime,s=null!=e.endTime;if(!r&&!s)return e;const o=ae(t.segments,n),a=t=>_(t,n).valueOf(),l=t=>S(t).format(n);if(r&&s)return{...e,segments:le(o,a(e.startTime)-a(t.startTime),n)};if(r){const t=o[0],n=Math.min(a(e.startTime),a(t.end));return{...e,segments:[{start:l(n),end:t.end},...o.slice(1)]}}const d=o[o.length-1],h=Math.max(a(e.endTime),a(d.start));return{...e,segments:[...o.slice(0,-1),{start:d.start,end:l(h)}]}}(n,e,this.inputDateFormat),r=this.validateTask({...n,...i});return this.taskMap[t]=r,this.buildTaskTree(this.getTasks()),this.applyShowSummaryBarDefaults(),this.computeSummaryDates(),this.computeSummaryProgress(),this.processWbs(),this.computeDependencyFields(),r}}function Se(t){return t.classList.contains("gantt-reduced-motion")}function Me(t,e,n){if(Se(n))return;if("function"!=typeof t.animate)return;const i=Math.min(30*e,500);t.animate([{transformOrigin:"top",transform:"translateY(-8px) scaleY(0)"},{transformOrigin:"top",transform:"translateY(0) scaleY(1)"}],{duration:200,easing:"ease-out",delay:i,fill:"backwards"})}const Ee="data-chart-instance";class Te{constructor(t,e,n,i,r=!1){this.pixelsPerMs=t,this.options=e,this.chartContext=n,this.dataManager=i,this.rtl=r}generateHeader(t,e){const n=l(this.chartContext,{className:"timeline-header"}),i=l(this.chartContext,{className:"timeline-header-row"}),{rowHeight:r}=this.options,s=this.chartContext.getInstanceId();if(n.setAttribute(Ee,s),n.setAttribute("tabindex","0"),n.setAttribute("aria-label","Timeline header"),t.forEach((t=>{const n=l(this.chartContext,{className:"timeline-header-cell",content:t.data,style:{height:e?`${r}px`:2*r+"px",minWidth:`${t.width}px`||"100%",color:"var(--text-color)"}});i.append(n)})),n.append(i),!e)return n.style.background="var(--header-bg-color)",n;const o=l(this.chartContext,{className:"timeline-header-row"});return e.forEach((t=>{const e=l(this.chartContext,{className:"timeline-header-cell",content:t.data,style:{height:`${r}px`,maxWidth:`${t.width}px`,minWidth:`${t.width}px`,color:"var(--text-color)"}});o.append(e)})),n.append(o),n.style.background="var(--header-bg-color)",n}generateRow(t,e){const n=l(this.chartContext,{className:"timeline-data-row"}),{rowHeight:i}=this.options,r=this.chartContext.getInstanceId();return n.setAttribute("data-taskid",t),n.setAttribute(Ee,r),e.forEach((t=>{const e=l(this.chartContext,{className:"timeline-data-cell",style:{height:`${i}px`,maxWidth:`${t.width}px`,minWidth:`${t.width}px`}});e.setAttribute(Ee,r),n.append(e)})),n}generateRows(t,e){const n=l(this.chartContext,{className:"timeline-body"}),i=this.chartContext.getInstanceId();return n.setAttribute(Ee,i),t.forEach((t=>{const i=this.generateRow(t.id,e);n.append(i)})),this.fillEmptyRows(n,t.length,e),n}generateRowsVirtualized(t,e,n,i){const r=l(this.chartContext,{className:"timeline-body"}),s=this.chartContext.getInstanceId();r.setAttribute(Ee,s);const{startIndex:o,endIndex:a}=n,d=t.length,h=this.chartContext.createElement("div");h.className="virtualizer-top-spacer",h.style.height=o*i+"px",r.appendChild(h);t.slice(o,a+1).forEach((t=>{const n=this.generateRow(t.id,e);r.append(n)}));const c=Math.max(0,(d-1-a)*i),u=this.chartContext.createElement("div");return u.className="virtualizer-bottom-spacer",u.style.height=`${c}px`,r.appendChild(u),r}appendNonWorkingStripes(t,e,n){var i;if(!1===(null==(i=this.options.calendar)?void 0:i.showNonWorkingStripes))return;const r=function(t){const{calendar:e,holidaysByKey:n,timelineStart:i,timelineEnd:r,pixelsPerMs:s,rtl:o,chartContext:a,height:d,onHolidayStripe:h}=t;if(e.isNoOp)return null;const c=s*it;if(c<4)return null;const u=l(a,{className:"timeline-stripes-layer"});void 0!==d&&(u.style.height=`${d}px`);const p=i.valueOf(),m=r.valueOf(),g=(m-p)*s;let f=S(i).startOf("day");for(;f.valueOf()<m;){if(!e.isWorkingDay(f)){const t=f.format("YYYY-MM-DD"),e=n.get(t),i=(f.valueOf()-p)*s,r=o?g-i-c:i,l=a.createElement("div");l.className=e?"apexgantt-day apexgantt-day--holiday":"apexgantt-day apexgantt-day--weekend",l.style.left=`${r}px`,l.style.width=`${c}px`,l.setAttribute("data-date",t),(null==e?void 0:e.label)&&l.setAttribute("data-holiday-label",e.label),u.append(l),e&&h&&h(l,e)}f=f.add(1,"day")}return u}({calendar:this.dataManager.getCalendar(),holidaysByKey:this.dataManager.getHolidaysByKey(),timelineStart:e,timelineEnd:n,pixelsPerMs:this.pixelsPerMs,rtl:this.rtl,chartContext:this.chartContext,onHolidayStripe:(t,e)=>this.wireHolidayTooltip(t,e)});r&&t.insertBefore(r,t.firstChild)}wireHolidayTooltip(t,e){var n;const i=null==(n=this.options.calendar)?void 0:n.holidayTooltip;if(!i)return;const{tooltipId:r,tooltipBGColor:s,tooltipBorderColor:o,fontColor:a,fontFamily:l,fontSize:d}=this.options;if(!r)return;const h=t=>{const n=i({date:e.date,label:e.label});At(this.chartContext,r,t.clientX,t.clientY,n,{bgColor:s||"#FFFFFF",borderColor:o||"#BCBCBC",fontColor:a||"#000000",fontFamily:l||"inherit",fontSize:d||"12px",fontWeight:"400",maxWidth:240})};t.addEventListener("mouseenter",h),t.addEventListener("mousemove",h),t.addEventListener("mouseleave",(()=>Dt(this.chartContext,r)))}fillEmptyRows(t,e,n){const i=this.chartContext.querySelector(".gantt-container");if(!i)return;const r=i.clientHeight,s=this.options.rowHeight,o=r-2*s,a=Math.floor(o/s),l=Math.max(0,a-e);for(let e=0;e<l;e++){const i=this.generateRow(`empty-${e}`,n);i.classList.add("timeline-empty-row"),t.append(i)}}render(t,e=new Set,n,i){var r,s;const o=t?t.allTasks:this.dataManager.getFlatVisibleTasks(),a=W(this.options.barLabel),d=this.dataManager.getDateRange(8,this.pixelsPerMs,a),{top:h,sub:c,geometry:u,timelineSpan:p}=we(d[0],d[1],this.pixelsPerMs,this.options.inputDateFormat,null==(s=null==(r=this.options.locale)?void 0:r.dateLocale)?void 0:s.name,this.rtl),m=this.rtl&&h?[...h].reverse():h,g=this.rtl?[...c].reverse():c,f=m??g,b=m?g:null,v=this.generateHeader(f,b),y=g;let x;x=t?this.generateRowsVirtualized(o,y,t.range,t.rowHeight):this.generateRows(o,y),this.appendNonWorkingStripes(x,p[0],p[1]);const w=l(this.chartContext,{className:"bar-container"}),k=l(this.chartContext,{className:"annotation-container"}),C=this.chartContext.getChartContainer();if(t){const{startIndex:r,endIndex:s}=t.range,a=o.length*t.rowHeight;w.style.height=`${a}px`,w.style.width="100%";o.slice(r,s+1).forEach(((t,s)=>{const o=r+s;if(t.isGroup)return;const a=new It(t,u,this.options,o,this.chartContext,this.dataManager),l=i||((t,e)=>{Gt(this.chartContext,this.dataManager,t,e,this.options,u),Kt(this.chartContext,this.dataManager,t,this.options,u)}),d=a.drawBar(l,n);w.append(d),!e.has(t.id)&&C&&Me(d,o,C);const h=a.drawBaselineBar();h&&w.append(h);for(const t of a.drawRollups())w.append(t)}))}else o.forEach(((t,r)=>{if(t.isGroup)return;const s=new It(t,u,this.options,r,this.chartContext,this.dataManager),o=i||((t,e)=>{Gt(this.chartContext,this.dataManager,t,e,this.options,u),Kt(this.chartContext,this.dataManager,t,this.options,u)}),a=s.drawBar(o,n);w.append(a),!e.has(t.id)&&C&&Me(a,r,C);const l=s.drawBaselineBar();l&&w.append(l);for(const t of s.drawRollups())w.append(t)}));const S=o.length*this.options.rowHeight,M=this.computeProjectBoundaryAnnotations(o),E=new ut(this.options,u,this.chartContext,S).render(M);k.append(...E);const T=l(this.chartContext,{className:"timeline-horizontal-scroll"}),A=l(this.chartContext,{className:"timeline-horizontal-scroll-content"}),D=this.chartContext.getInstanceId();T.id=`timeline-horizontal-scroll-${D}`;const I=y.reduce(((t,e)=>t+e.width),0);return A.style.width=`${I}px`,A.style.height="1px",T.appendChild(A),[v,k,x,w,T]}computeProjectBoundaryAnnotations(t){if(!this.options.enableProjectBoundary||0===t.length)return[];let e,n,i=1/0,r=-1/0;const s=this.options.inputDateFormat;for(const o of t){const t=o.showSummaryBar?o.summaryStart??o.startTime:o.startTime,a=o.showSummaryBar?o.summaryEnd??o.endTime:o.endTime;if(t){const n=_(t,s).valueOf();Number.isFinite(n)&&n<i&&(i=n,e=t)}if(a){const t=_(a,s).valueOf();Number.isFinite(t)&&t>r&&(r=t,n=a)}}if(!e||!n)return[];const o=j(this.options.inputDateFormat)?n:_(n,this.options.inputDateFormat).add(1,"day").format(this.options.inputDateFormat),a={bgColor:"transparent",borderColor:this.options.projectBoundaryColor||this.options.annotationBorderColor,borderWidth:2};return[{...a,x1:e},{...a,x1:o}]}}function Ae(t,e){if(!Number.isFinite(e)||e<=0)return t;const n=function(t){const e=t.match(/[ML]\s*-?\d+(?:\.\d+)?[,\s]+-?\d+(?:\.\d+)?/g);if(!e)return[];const n=[];for(const t of e){const e=t.match(/[ML]\s*(-?\d+(?:\.\d+)?)[,\s]+(-?\d+(?:\.\d+)?)/);e&&n.push([parseFloat(e[1]),parseFloat(e[2])])}return n}(t);if(n.length<3)return t;const i=[`M ${n[0][0]},${n[0][1]}`];for(let t=1;t<n.length-1;t++){const[r,s]=n[t-1],[o,a]=n[t],[l,d]=n[t+1],h=o-r,c=a-s,u=l-o,p=d-a,m=Math.abs(h)+Math.abs(c),g=Math.abs(u)+Math.abs(p),f=Math.min(e,m/2,g/2);if(f<=0||0===h&&0===c||0===u&&0===p){i.push(`L ${o},${a}`);continue}const b=0===h?0:Math.sign(h),v=0===c?0:Math.sign(c),y=0===u?0:Math.sign(u),x=0===p?0:Math.sign(p),w=o-b*f,k=a-v*f,C=o+y*f,S=a+x*f,M=b*x-v*y;if(0===M){i.push(`L ${o},${a}`);continue}const E=M>0?1:0;i.push(`L ${w},${k}`),i.push(`A ${f},${f} 0 0 ${E} ${C},${S}`)}const r=n[n.length-1];return i.push(`L ${r[0]},${r[1]}`),i.join(" ")}const De="http://www.w3.org/2000/svg",Ie="data-from-id",$e="data-to-id",Fe={paddingX:20,paddingY:15};class Be{constructor(t){this.elements=[],this.chartContext=null,this.instanceId=t??"arrow_"+crypto.randomUUID().replace(/-/g,"").substring(0,9)}getInstanceId(){return this.instanceId}static calculateArrowPathFromRects(t,e,n,i="FS"){const{paddingX:r=Fe.paddingX,paddingY:s=Fe.paddingY}=n;switch(i){case"SS":return Be.calculateSSPath(t,e,r,s);case"FF":return Be.calculateFFPath(t,e,r,s);case"SF":return Be.calculateSFPath(t,e,r,s);default:return Be.calculateFSPath(t,e,r,s)}}static calculateArrowPath(t,e,n,i,r="FS"){const o=s(t,n),a=s(e,n),{paddingX:l=Fe.paddingX,paddingY:d=Fe.paddingY}=i;switch(r){case"SS":return Be.calculateSSPath(o,a,l,d);case"FF":return Be.calculateFFPath(o,a,l,d);case"SF":return Be.calculateSFPath(o,a,l,d);default:return Be.calculateFSPath(o,a,l,d)}}static calculateFSPath(t,e,n,i){const r=t.right,s=t.top+t.height/2,o=e.left-2,a=e.top+e.height/2,l=[`M ${r},${s}`];if(o>r){if(a!==s){const t=4,e=Math.max(r,(r+o-t)/2);l.push(`L ${e},${s}`),l.push(`L ${e},${a}`)}}else if(o<r)if(a!==s){const t=r+n,e=s+i*(a<s?-1:1),d=o-n,h=a+i*(a<s?1:-1);l.push(`L ${t},${s}`),l.push(`L ${t},${e}`),l.push(`L ${d},${e}`),h!==e&&l.push(`L ${d},${h}`),l.push(`L ${d},${a}`)}else{const t=r+n,e=s+i,d=o-n,h=a;l.push(`L ${t},${s}`),l.push(`L ${t},${e}`),l.push(`L ${d},${e}`),l.push(`L ${d},${h}`)}return l.push(`L ${o},${a}`),l.join(" ")}static calculateSSPath(t,e,n,i){const r=t.left,s=t.top+t.height/2,o=e.left-2,a=e.top+e.height/2,l=Math.min(r,o+2)-n,d=[`M ${r},${s}`];if(s===a)d.push(`L ${l},${s}`),d.push(`L ${l},${a}`);else{const t=s+i*(a>s?1:-1);d.push(`L ${l},${s}`),d.push(`L ${l},${t}`),d.push(`L ${l},${a}`)}return d.push(`L ${o},${a}`),d.join(" ")}static calculateFFPath(t,e,n,i){const r=t.right,s=t.top+t.height/2,o=e.right+2,a=e.top+e.height/2,l=Math.max(r,o-2)+n,d=[`M ${r},${s}`];if(s===a)d.push(`L ${l},${s}`),d.push(`L ${l},${a}`);else{const t=s+i*(a>s?1:-1);d.push(`L ${l},${s}`),d.push(`L ${l},${t}`),d.push(`L ${l},${a}`)}return d.push(`L ${o},${a}`),d.join(" ")}static calculateSFPath(t,e,n,i){const r=t.left,s=t.top+t.height/2,o=e.right+2,a=e.top+e.height/2,l=r-n,d=e.right+n,h=[`M ${r},${s}`];if(h.push(`L ${l},${s}`),s<=a){const e=t.bottom+i-t.height/2;h.push(`L ${l},${e}`),h.push(`L ${d},${e}`),h.push(`L ${d},${a}`)}else{const t=e.top-i;h.push(`L ${l},${t}`),h.push(`L ${d},${t}`),h.push(`L ${d},${a}`)}return h.push(`L ${o},${a}`),h.join(" ")}static drawArrow(t,e,n,i,r,s,o,a,l="FS",d=0){var h;const c=a?a.createElementNS(De,"path"):document.createElementNS(De,"path"),u=Ae(Be.calculateArrowPath(t,e,n,i,l),(null==(h=i.dependencies)?void 0:h.cornerRadius)??4);c.setAttribute("d",u);const p=i.arrowColor||"#94A3B8";c.setAttribute("stroke",p),c.setAttribute("stroke-width","1.5"),c.setAttribute("stroke-linejoin","round"),c.setAttribute("fill","transparent");const m=o?`arrowhead-${o}`:"arrowhead";return c.setAttribute("marker-end",`url(#${m})`),c.setAttribute(Ie,r),c.setAttribute($e,s),c.setAttribute("data-dependency-type",l),c.addEventListener("mouseout",(function(){c.setAttribute("stroke",p)})),0!==d&&c.setAttribute("data-lag-px",String(d)),c}static updateArrow(t,e,n,i,r,s,o="FS"){var a;const l=Ae(Be.calculateArrowPath(t,e,n,i,o),(null==(a=i.dependencies)?void 0:a.cornerRadius)??4),d=`[${Ie}="${r}"][${$e}="${s}"]`,h=n.querySelector(`${d}:not([data-arrow-hit])`);h&&h.setAttribute("d",l);const c=n.querySelector(`${d}[data-arrow-hit]`);return c&&c.setAttribute("d",l),null!==h}createMarker(t){const e=t?t.createElementNS(De,"marker"):document.createElementNS(De,"marker"),n=`arrowhead-${this.instanceId}`;e.setAttribute("id",n),e.setAttribute("markerWidth","5"),e.setAttribute("markerHeight","5"),e.setAttribute("refX","4"),e.setAttribute("refY","2.5"),e.setAttribute("orient","auto"),e.setAttribute("fill","context-stroke");const i=t?t.createElementNS(De,"polygon"):document.createElementNS(De,"polygon");return i.setAttribute("points","0,0 5,2.5 0,5 1, 2.5"),e.appendChild(i),e}render(t,e,n,i){this.chartContext=i||null;const r=`timeline-arrows-${this.instanceId}`;let s=t.querySelector(`#${r}`);s||(s=i?i.createElementNS(De,"svg"):document.createElementNS(De,"svg"),s.setAttribute("id",r),t.appendChild(s)),this.svg=s,this.options={...Fe,...n},this.elements=e,this.svg.setAttribute("style",a({left:"0",position:"absolute",top:"0",pointerEvents:"none"})),this.svg.innerHTML="";const o=i?i.createElementNS(De,"defs"):document.createElementNS(De,"defs"),l=this.createMarker(i);return o.appendChild(l),this.svg.appendChild(o),this.svg.setAttribute("width",`${this.options.width}`),this.svg.setAttribute("height",`${this.options.height}`),this.elements.forEach((({fromId:t,toId:e,source:n,target:r,dependencyType:s,lagPx:o})=>{this.svg.appendChild(Be.drawArrow(n,r,this.svg,this.options,t,e,this.instanceId,i,s,o))})),this.svg}renderFromRects(t,e,n,i){this.chartContext=i||null;const r=`timeline-arrows-${this.instanceId}`;let s=t.querySelector(`#${r}`);s||(s=i?i.createElementNS(De,"svg"):document.createElementNS(De,"svg"),s.setAttribute("id",r),t.appendChild(s)),this.svg=s,this.options={...Fe,...n},this.svg.setAttribute("style",a({left:"0",position:"absolute",top:"0",pointerEvents:"none"})),this.svg.innerHTML="";const o=i?i.createElementNS(De,"defs"):document.createElementNS(De,"defs");o.appendChild(this.createMarker(i)),this.svg.appendChild(o),this.svg.setAttribute("width",`${this.options.width}`),this.svg.setAttribute("height",`${this.options.height}`);const l=n.arrowColor||"#94A3B8",d=`arrowhead-${this.instanceId}`,h=this.options.dependencies??{},c=h.cornerRadius??4,u=h.hitWidth??0,p=h.tooltipTemplate,m=h.classBuilder;return e.forEach((t=>{const{fromId:e,toId:n,sourceRect:r,targetRect:s,dependencyType:o="FS",lagPx:a=0,fromTask:h,toTask:g,lagDays:f}=t,b=Ae(Be.calculateArrowPathFromRects(r,s,this.options,o),c);if(u>0){const t=this.createPathElement(i);t.setAttribute("d",b),t.setAttribute("stroke","transparent"),t.setAttribute("stroke-width",String(u)),t.setAttribute("stroke-linejoin","round"),t.setAttribute("fill","none"),t.setAttribute(Ie,e),t.setAttribute($e,n),t.setAttribute("data-arrow-hit",""),t.setAttribute("pointer-events","stroke"),t.style.cursor=p?"pointer":"default",p&&h&&g&&this.attachArrowTooltip(t,p,{fromTask:h,toTask:g,type:o,lag:f??0}),this.svg.appendChild(t)}const v=this.createPathElement(i);if(v.setAttribute("d",b),v.setAttribute("stroke",l),v.setAttribute("stroke-width","1.5"),v.setAttribute("stroke-linejoin","round"),v.setAttribute("fill","transparent"),v.setAttribute("marker-end",`url(#${d})`),v.setAttribute("data-from-id",e),v.setAttribute("data-to-id",n),v.setAttribute("data-dependency-type",o),v.setAttribute("pointer-events","none"),m&&h&&g){const t=m({fromTask:h,toTask:g,type:o,lag:f??0}),e=Array.isArray(t)?t.join(" "):t??"";e&&v.setAttribute("class",e)}0!==a&&v.setAttribute("data-lag-px",String(a)),v.addEventListener("mouseout",(()=>{v.setAttribute("stroke",l)})),this.svg.appendChild(v)})),this.svg}createPathElement(t){return t?t.createElementNS(De,"path"):document.createElementNS(De,"path")}attachArrowTooltip(t,e,n){if(!this.chartContext)return;const i=this.chartContext,{tooltipId:r,tooltipBgColor:s,tooltipBorderColor:o,tooltipFontColor:a,tooltipFontFamily:l,tooltipFontSize:d,tooltipFontWeight:h}=this.options;if(!r)return;const c=t=>{const c=e(n);At(i,r,t.clientX,t.clientY,c,{bgColor:s??"#FFFFFF",borderColor:o??"#BCBCBC",fontColor:a??"#000000",fontFamily:l??"inherit",fontSize:d??"12px",fontWeight:h??"400",maxWidth:320})};t.addEventListener("mouseenter",c),t.addEventListener("mousemove",c),t.addEventListener("mouseleave",(()=>Dt(i,r)))}}const Le={criticalTaskIds:new Set,criticalEdgeKeys:new Set};function Re(t,e,n){return n.workingDaysBetween(t,e,{inclusive:!0})}function He(t){const e=e=>function(t,e){return getComputedStyle(t).getPropertyValue(e).trim()}(t,e);return{barFill:e("--apex-gantt-bar-fill"),bgColor:e("--apex-gantt-background-color"),rowBgEven:e("--apex-gantt-row-bg-even"),rowBgOdd:e("--apex-gantt-row-bg-odd"),headerBg:e("--apex-gantt-header-bg"),gridLine:e("--apex-gantt-grid-line"),dependencyLine:e("--apex-gantt-dependency-line"),fontFamily:e("--apex-gantt-font-family"),fontSize:e("--apex-gantt-font-size"),fontColor:e("--apex-gantt-font-color")}}let Pe;function ze(t,e){var n;if(!t)return 0;const i=function(){if(void 0!==Pe)return Pe;try{Pe="undefined"==typeof document?null:document.createElement("canvas").getContext("2d")}catch{Pe=null}return Pe}();if(i)return i.font=e,i.measureText(t).width;const r=parseFloat((null==(n=/(\d+(?:\.\d+)?)px/.exec(e))?void 0:n[1])??"14");return t.length*r*.6}function Oe(t,e,n){if(e.key===Bt.ProgressRing)return"";return Ut(t,e,n.inputDateFormat,n.snap,n.calendar).replace(/<[^>]*>/g,"")}function We(t){return!Rt(t.key)||!!t.render}function Ne(t,e,n,i,r){const s=new TextEncoder,o=[];let a=0;const l=t=>{const e="string"==typeof t?s.encode(t):t;o.push(e),a+=e.length},d=Math.max(1,Math.round(e)),h=Math.max(1,Math.round(n)),c=Math.max(1,Math.round(i??e)),u=Math.max(1,Math.round(r??n)),p=[],m=t=>{p[t]=a};l("%PDF-1.4\n"),l(new Uint8Array([37,255,255,255,255,10])),m(1),l("1 0 obj\n<< /Type /Catalog /Pages 2 0 R >>\nendobj\n"),m(2),l("2 0 obj\n<< /Type /Pages /Kids [3 0 R] /Count 1 >>\nendobj\n"),m(3),l(`3 0 obj\n<< /Type /Page /Parent 2 0 R /MediaBox [0 0 ${c} ${u}] /Resources << /XObject << /Im0 4 0 R >> >> /Contents 5 0 R >>\nendobj\n`),m(4),l(`4 0 obj\n<< /Type /XObject /Subtype /Image /Width ${d} /Height ${h} /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /DCTDecode /Length ${t.length} >>\nstream\n`),l(t),l("\nendstream\nendobj\n");const g=`q\n${c} 0 0 ${u} 0 0 cm\n/Im0 Do\nQ\n`;m(5),l(`5 0 obj\n<< /Length ${g.length} >>\nstream\n${g}endstream\nendobj\n`);const f=a;let b="xref\n0 6\n0000000000 65535 f \n";for(let t=1;t<6;t++)b+=`${String(p[t]).padStart(10,"0")} 00000 n \n`;l(b),l(`trailer\n<< /Size 6 /Root 1 0 R >>\nstartxref\n${f}\n%%EOF\n`);const v=o.reduce(((t,e)=>t+e.length),0),y=new Uint8Array(v);let x=0;for(const t of o)y.set(t,x),x+=t.length;return y}const qe="http://www.w3.org/2000/svg";function Ye(t,e){t&&Object.assign(t.style,e)}function Ue(t){const e=[];for(let t=0;t<document.styleSheets.length;t++)try{const n=document.styleSheets[t];if(n.href&&!n.href.startsWith(window.location.origin))continue;if(n.cssRules)for(let t=0;t<n.cssRules.length;t++)e.push(n.cssRules[t].cssText)}catch(t){continue}document.querySelectorAll("style").forEach((t=>{t.textContent&&e.push(t.textContent)}));const n=function(t){const e=window.getComputedStyle(t),n=[];for(let e=0;e<t.style.length;e++){const i=t.style[e];if(i.startsWith("--")){const e=t.style.getPropertyValue(i);n.push(`${i}: ${e};`)}}return Array.from(e).forEach((t=>{if(t.startsWith("--")){const i=`${t}: ${e.getPropertyValue(t)};`;n.includes(i)||n.push(i)}})),0===n.length?"":`:root {\n ${n.join("\n ")}\n}`}(t);return n&&e.unshift(n),e.join("\n")}function Ve(t,e){const{contentWidth:n}=e,i=t.querySelector(".timeline-horizontal-scroll");null==i||i.remove();const r=t.querySelector(".timeline-container"),s=t.querySelector(".tasks-container"),o=t.querySelector(".timeline-body-wrapper"),a=t.querySelector(".timeline-header"),l=t.querySelector(".timeline-body"),d=t.querySelector(".bar-container"),h=t.querySelector(".annotation-container");var c;Ye(r,{overflow:"visible",maxWidth:"none",width:"auto",position:"relative"}),Ye(s,{overflow:"visible",height:"auto",maxHeight:"none"}),Ye(o,{overflow:"visible",maxWidth:"none",width:`${n}px`}),o&&(o.scrollLeft=0),Ye(a,{overflow:"visible",maxWidth:"none",width:`${n}px`}),a&&(a.scrollLeft=0),c={width:`${n}px`,minWidth:`${n}px`,maxWidth:"none"},[l,d,h].forEach((t=>Ye(t,c)))}function je(t){const e=function(t){const e=t.querySelector(".gantt-container");if(!e)throw new Error("Gantt container not found");const n=e.querySelector(".timeline-container"),i=e.querySelector(".tasks-container");if(!n||!i)throw new Error("Timeline or tasks container not found");return{ganttContainer:e,timelineContainer:n,tasksContainer:i,horizontalScroll:e.querySelector(".timeline-horizontal-scroll"),timelineBodyWrapper:n.querySelector(".timeline-body-wrapper"),timelineHeader:n.querySelector(".timeline-header"),timelineBody:n.querySelector(".timeline-body"),barContainer:n.querySelector(".bar-container"),annotationContainer:n.querySelector(".annotation-container")}}(t),n=function(t){var e,n,i,r;const s=Math.max((null==(e=t.timelineBody)?void 0:e.scrollWidth)||0,(null==(n=t.barContainer)?void 0:n.scrollWidth)||0,(null==(i=t.annotationContainer)?void 0:i.scrollWidth)||0,(null==(r=t.timelineHeader)?void 0:r.scrollWidth)||0),o=t.tasksContainer.scrollWidth;return{contentWidth:s,tasksWidth:o,totalWidth:o+s,totalHeight:Math.max(t.timelineContainer.scrollHeight,t.tasksContainer.scrollHeight)}}(e),i=e.ganttContainer.cloneNode(!0);Ve(i,n),Ye(i,{display:"flex",overflow:"visible",width:"fit-content",height:"auto"});const r=Ue(t),s=document.createElement("style");s.textContent=r,i.insertBefore(s,i.firstChild);const o=document.createElementNS(qe,"svg");o.setAttribute("width",n.totalWidth.toString()),o.setAttribute("height",n.totalHeight.toString()),o.setAttribute("xmlns",qe),o.setAttribute("viewBox",`0 0 ${n.totalWidth} ${n.totalHeight}`);const a=document.createElementNS(qe,"foreignObject");a.setAttribute("width",n.totalWidth.toString()),a.setAttribute("height",n.totalHeight.toString()),a.setAttribute("x","0"),a.setAttribute("y","0"),a.appendChild(i),o.appendChild(a);return{svgString:'<?xml version="1.0" encoding="UTF-8"?>\n'+(new XMLSerializer).serializeToString(o),width:n.totalWidth,height:n.totalHeight}}function _e(t,e){const n=URL.createObjectURL(t),i=document.createElement("a");i.href=n,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout((()=>URL.revokeObjectURL(n)),100)}function Ge(t,e,n){return new Promise(((i,r)=>{t.toBlob((t=>t?i(t):r(new Error("Canvas export produced no blob"))),e,n)}))}const Ke=async(t,e="svg",n={})=>{try{const l=je(t),d=n.scale??2,h=n.background??"#FFFFFF",c=Date.now();if("svg"===e)return void _e(new Blob([l.svgString],{type:"image/svg+xml;charset=utf-8"}),`gantt-chart-${c}.svg`);const u=await function(t,e,n){return new Promise(((i,r)=>{const s=document.createElement("canvas");s.width=Math.max(1,Math.round(t.width*e)),s.height=Math.max(1,Math.round(t.height*e));const o=s.getContext("2d");if(!o)return void r(new Error("Canvas 2D context unavailable"));const a=new Image;a.decoding="sync";const l="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(t.svgString);a.onload=()=>{o.setTransform(e,0,0,e,0,0),o.fillStyle=n||"#FFFFFF",o.fillRect(0,0,t.width,t.height),o.drawImage(a,0,0,t.width,t.height),i(s)},a.onerror=()=>r(new Error("Failed to rasterize gantt SVG")),a.src=l}))}(l,d,h);if("png"===e){return void _e(await Ge(u,"image/png"),`gantt-chart-${c}.png`)}const p=await Ge(u,"image/jpeg",.92),m=new Uint8Array(await p.arrayBuffer());_e((i=m,r=u.width,s=u.height,o=l.width,a=l.height,new Blob([Ne(i,r,s,o,a)],{type:"application/pdf"})),`gantt-chart-${c}.pdf`)}catch(t){throw z.error("Error exporting gantt chart:",t),t}var i,r,s,o,a},Xe=["contains","notContains","equals","notEquals","startsWith","endsWith","isEmpty","notEmpty"],Ze=["equals","notEquals","gt","gte","lt","lte","isEmpty","notEmpty"],Qe=["on","before","after","isEmpty","notEmpty"];function Je(t){if(Rt(t))switch(t){case Bt.StartTime:case Bt.EndTime:case Bt.BaselineStart:case Bt.BaselineEnd:return"date";case Bt.Duration:case Bt.Progress:case Bt.ProgressRing:case Bt.BaselineVariance:return"number";default:return"text"}return"text"}function tn(t){return"number"===t?Ze:"date"===t?Qe:Xe}function en(t,e,n){if("number"!=typeof t||Number.isNaN(t))return!1;const i=Math.floor(t/it),r=Math.floor(n/it);switch(e){case"on":return i===r;case"before":return i<r;case"after":return i>r;default:return!1}}function nn(t){return null==t||""===t||"number"==typeof t&&Number.isNaN(t)}function rn(t,e,n,i){const r=Zt(t,e.field,n,i);if("isEmpty"===e.operator)return nn(r);if("notEmpty"===e.operator)return!nn(r);const s=Je(e.field);if("date"===s){if(null==e.value||""===e.value)return!0;const t=_(String(e.value),i.inputDateFormat).valueOf();if(Number.isNaN(t)){const t=Date.parse(String(e.value));return!!Number.isNaN(t)||en(r,e.operator,t)}return en(r,e.operator,t)}if("number"===s){if(null==e.value||""===e.value)return!0;const t="number"==typeof e.value?e.value:Number(e.value);return!!Number.isNaN(t)||function(t,e,n){if("number"!=typeof t||Number.isNaN(t))return!1;switch(e){case"equals":return t===n;case"notEquals":return t!==n;case"gt":return t>n;case"gte":return t>=n;case"lt":return t<n;case"lte":return t<=n;default:return!1}}(r,e.operator,t)}return null==e.value||""===e.value||function(t,e,n){const i=null==t?"":String(t).toLowerCase(),r=n.toLowerCase();switch(e){case"contains":return i.includes(r);case"notContains":return!i.includes(r);case"equals":return i===r;case"notEquals":return i!==r;case"startsWith":return i.startsWith(r);case"endsWith":return i.endsWith(r);default:return!1}}(r,e.operator,String(e.value))}const sn={ganttContainer:".gantt-container",actionsContainer:".gantt-actions-container",splitBar:".split-bar-container",splitViewContainer:".split-view-container",tasksContainer:".tasks-container",tasksHeader:".tasks-header",tasksBodyWrapper:".tasks-body-wrapper",tasksDataContainer:".tasks-data-container",tasksDataRow:".tasks-data-row",tasksEmptyRow:".tasks-empty-row",tasksDataCell:".tasks-data-cell",timelineContainer:".timeline-container",timelineHeader:".timeline-header",timelineHeaderRow:".timeline-header-row",timelineHeaderCell:".timeline-header-cell",timelineBodyWrapper:".timeline-body-wrapper",timelineBody:".timeline-body",timelineDataRow:".timeline-data-row",timelineEmptyRow:".timeline-empty-row",timelineDataCell:".timeline-data-cell",horizontalScroll:".timeline-horizontal-scroll",horizontalScrollContent:".timeline-horizontal-scroll-content",barContainer:".bar-container",virtualizerTopSpacer:".virtualizer-top-spacer",virtualizerBottomSpacer:".virtualizer-bottom-spacer"};class on{constructor(){this.state={scrollPosition:{horizontal:0,tasksVertical:0,timelineVertical:0},pixelsPerMs:0,collapsedTasks:new Set,selectedTaskIds:[],hasState:!1}}captureState(t,e,n,i){const r=t.querySelector(".timeline-body-wrapper"),s=t.querySelector(".timeline-horizontal-scroll"),o=t.querySelector(".split-view-container");this.state.scrollPosition={horizontal:(null==r?void 0:r.scrollLeft)||(null==s?void 0:s.scrollLeft)||0,tasksVertical:(null==o?void 0:o.scrollTop)||0,timelineVertical:(null==o?void 0:o.scrollTop)||0},this.state.pixelsPerMs=n,this.state.hasState=!0,this.state.collapsedTasks=new Set(e.getFlatTasks().filter((t=>t.collapsed)).map((t=>t.id))),this.state.selectedTaskIds=i??[]}restoreState(t,e=!1){if(e)return;const{horizontal:n,tasksVertical:i}=this.state.scrollPosition,r=t.querySelector(".timeline-body-wrapper");r&&(r.scrollLeft=n);const s=t.querySelector(".timeline-header");s&&(s.scrollLeft=n);const o=t.querySelector(".timeline-horizontal-scroll");o&&(o.scrollLeft=n);const a=t.querySelector(".split-view-container");a&&(a.scrollTop=i)}getPixelsPerMs(){return this.state.pixelsPerMs}getCapturedVerticalScroll(){return this.state.scrollPosition.tasksVertical}getSelectedTaskIds(){return this.state.selectedTaskIds}hasState(){return this.state.hasState}clearState(){this.state={scrollPosition:{horizontal:0,tasksVertical:0,timelineVertical:0},pixelsPerMs:0,collapsedTasks:new Set,selectedTaskIds:[],hasState:!1}}}const an=["endTime","progress","type","parentId","dependency","barBackgroundColor","rowBackgroundColor","collapsed"];class ln{static getNestedValue(t,e){if(!t||!e)return;const n=e.split(".");let i=t;for(const t of n){if(null==i)return;i=i[t]}return i}static processParsingValue(t,e){if("string"==typeof e)return this.getNestedValue(t,e);const{key:n,transform:i}=e,r=this.getNestedValue(t,n);if(i&&"function"==typeof i)try{return i(r)}catch(t){return z.warn(`DataParser: Transform function failed for key "${n}":`,t),r}return r}static buildTaskInput(t,e,n){const i=this.processParsingValue(t,e.id),r=this.processParsingValue(t,e.name),s=this.processParsingValue(t,e.startTime);if(!i||!r||!s)return z.warn(`DataParser: Skipping item at index ${n} - missing required fields`,{id:i,name:r,startTime:s,rawItem:t}),null;const o={id:i,name:r,startTime:s};for(const n of an)if(void 0!==e[n]){const i=this.processParsingValue(t,e[n]);void 0!==i&&(o[n]=i)}return o}static parse(t,e){return Array.isArray(t)?e?t.map(((t,n)=>{try{return this.buildTaskInput(t,e,n)}catch(e){return z.warn(`DataParser: Error parsing item at index ${n}:`,e,t),null}})).filter((t=>null!==t)):(z.warn("DataParser: Parsing config is required"),[]):(z.warn("DataParser: Data must be an array"),[])}static validateConfig(t){return!!t&&(!!(t.id&&t.name&&t.startTime)||(z.warn("DataParser: Parsing config must include id, name, and startTime"),!1))}}class dn{constructor(t,e,n){this.options=t,this.domCache=e,this.chartContext=n,this.bodyLine=null,this.label=null,this.mouseMoveHandler=null,this.mouseLeaveHandler=null,this.scrollHandler=null,this.headerMoveHandler=null,this.headerLeaveHandler=null,this.rafId=null,this.lastClientX=null,this.geometry=null,this.subTier="day"}updateOptions(t){this.options=t}attach(t,e){if(this.detach(),!this.options.enableCrosshair)return;const n=this.domCache.timelineBodyWrapper,i=this.domCache.timelineHeader,r=null==n?void 0:n.querySelector(sn.timelineBody);if(n&&r){if(this.geometry=t,this.subTier=e,this.bodyLine=this.createLine(),r.appendChild(this.bodyLine),i){const t=i.querySelectorAll(sn.timelineHeaderRow),e=t[t.length-1]??i;this.label=this.chartContext.createElement("div"),this.label.className="gantt-crosshair-label",this.label.style.background=this.options.crosshairColor,this.label.style.display="none",e.appendChild(this.label)}this.mouseMoveHandler=t=>this.onMouseMove(t),this.mouseLeaveHandler=()=>this.hide(),this.scrollHandler=()=>this.onScroll(),n.addEventListener("mousemove",this.mouseMoveHandler),n.addEventListener("mouseleave",this.mouseLeaveHandler),n.addEventListener("scroll",this.scrollHandler,{passive:!0}),i&&(this.headerMoveHandler=t=>this.onMouseMove(t),this.headerLeaveHandler=()=>this.hide(),i.addEventListener("mousemove",this.headerMoveHandler),i.addEventListener("mouseleave",this.headerLeaveHandler))}}createLine(){const t=this.chartContext.createElement("div");return t.className="gantt-crosshair",t.style.background=this.options.crosshairColor,t.style.display="none",t}detach(){var t,e;const n=this.domCache.timelineBodyWrapper;n&&(this.mouseMoveHandler&&n.removeEventListener("mousemove",this.mouseMoveHandler),this.mouseLeaveHandler&&n.removeEventListener("mouseleave",this.mouseLeaveHandler),this.scrollHandler&&n.removeEventListener("scroll",this.scrollHandler));const i=this.domCache.timelineHeader;i&&(this.headerMoveHandler&&i.removeEventListener("mousemove",this.headerMoveHandler),this.headerLeaveHandler&&i.removeEventListener("mouseleave",this.headerLeaveHandler)),null!==this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null),null==(t=this.bodyLine)||t.remove(),null==(e=this.label)||e.remove(),this.bodyLine=null,this.label=null,this.mouseMoveHandler=null,this.mouseLeaveHandler=null,this.scrollHandler=null,this.headerMoveHandler=null,this.headerLeaveHandler=null,this.lastClientX=null,this.geometry=null}onMouseMove(t){this.lastClientX=t.clientX,this.scheduleUpdate()}onScroll(){null!==this.lastClientX&&this.scheduleUpdate()}scheduleUpdate(){null===this.rafId&&(this.rafId=requestAnimationFrame((()=>{this.rafId=null,this.update()})))}update(){if(null===this.lastClientX||!this.bodyLine||!this.geometry)return;const t=this.domCache.timelineBodyWrapper;if(!t)return;const e=t.getBoundingClientRect(),n=this.lastClientX-e.left;if(n<0||n>e.width)return void this.hide();const i=n+t.scrollLeft,r=W(this.options.barLabel),s=this.geometry.dateForX(i-r).toDate(),o=`${i}px`;this.bodyLine.style.left=o,this.bodyLine.style.display="block",this.label&&(this.label.style.left=o,this.label.style.display="block",this.label.textContent=this.formatLabel(s))}hide(){this.bodyLine&&(this.bodyLine.style.display="none"),this.label&&(this.label.style.display="none"),this.lastClientX=null}formatLabel(t){const e=this.options.crosshairLabelFormat;if(e)return e(t,this.subTier);const n="minute"===this.subTier||"hour"===this.subTier||"halfday"===this.subTier?"MM/DD HH:mm":"ddd MM/DD/YYYY";return S(t).format(n)}}const hn="splitview-resize",cn="timeline-horizontal-scroll";class un{constructor(t,e,n,i,r){this.element=t,this.options=e,this.domCache=n,this.chartContext=i,this.instanceId=r,this.scrollbarResizeObserver=null,this.splitBarResizeHandler=null,this.timelineScrollHandlers={},this.isSyncingScroll=!1}setupTimelineHorizontalScroll(){const t=this.domCache.horizontalScroll,e=this.domCache.timelineHeader,n=this.domCache.timelineBodyWrapper;if(!t||!e||!n)return;this.updateHorizontalScrollbarContent(),this.applyScrollbarStylesToElement(t),this.timelineScrollHandlers.bodyScroll&&n.removeEventListener("scroll",this.timelineScrollHandlers.bodyScroll),this.timelineScrollHandlers.horizontalScroll&&t.removeEventListener("scroll",this.timelineScrollHandlers.horizontalScroll);const i=i=>{if(this.isSyncingScroll)return;this.isSyncingScroll=!0;const r=t.scrollLeft;e.scrollLeft=r,n.scrollLeft=r,requestAnimationFrame((()=>{this.isSyncingScroll=!1}))},r=i=>{if(this.isSyncingScroll)return;this.isSyncingScroll=!0;const r=n.scrollLeft;t.scrollLeft=r,e.scrollLeft=r,requestAnimationFrame((()=>{this.isSyncingScroll=!1}))};t.addEventListener("scroll",i,{passive:!0}),n.addEventListener("scroll",r,{passive:!0}),this.timelineScrollHandlers={horizontalScroll:i,bodyScroll:r}}positionHorizontalScrollbar(){const t=this.domCache.horizontalScroll,e=this.domCache.ganttContainer,n=this.domCache.tasksContainer;if(!t||!e)return void z.warn("Missing elements for scrollbar positioning");e.offsetHeight;const i=n?n.offsetWidth:0,r=this.domCache.splitBar,s=i+(r?r.offsetWidth:0)+2,o=window.getComputedStyle(this.element),a=parseFloat(o.paddingLeft)||0,l=parseFloat(o.paddingBottom)||0,d="rtl"===o.direction;t.style.left=`${d?a:s+a}px`,t.style.bottom=`${l}px`;const h=e.clientWidth-s;t.style.width=`${Math.max(0,h)}px`}setInitialHorizontalScroll(t){if(!t)return;const{horizontalScroll:e,timelineHeader:n,timelineBodyWrapper:i}=this.domCache;if(!i)return;const r=t=>{t&&(t.scrollLeft=t.scrollWidth)};r(i),r(n),r(e)}compensateForScrollbar(){const t=this.domCache.tasksBodyWrapper,e=this.domCache.tasksHeader;if(!t||!e)return;const n=t.offsetWidth-t.clientWidth;e.style.paddingRight="",e.style.boxSizing="",n>0&&(e.style.paddingRight=`${n}px`,e.style.boxSizing="border-box")}setupScrollbarResizeObserver(){if(!this.element)return;this.scrollbarResizeObserver&&this.scrollbarResizeObserver.disconnect(),this.scrollbarResizeObserver=new ResizeObserver((()=>{this.positionHorizontalScrollbar()})),this.scrollbarResizeObserver.observe(this.element);const t=this.domCache.ganttContainer;t&&this.scrollbarResizeObserver.observe(t),this.setupSplitBarResizeListener()}setupSplitBarResizeListener(){this.splitBarResizeHandler&&this.chartContext.removeEventListener(hn,this.splitBarResizeHandler),this.splitBarResizeHandler=()=>{requestAnimationFrame((()=>{this.positionHorizontalScrollbar()}))},this.chartContext.addEventListener(hn,this.splitBarResizeHandler)}updateHorizontalScrollbarContent(){const t=this.domCache.horizontalScroll,e=this.domCache.horizontalScrollContent,n=this.domCache.timelineBody;if(!t||!e||!n)return void z.warn("Scrollbar update: Missing elements",{horizontalScroll:!!t,scrollContent:!!e,timelineBody:!!n});const i=n.querySelector(".timeline-data-row"),r=(null==i?void 0:i.offsetWidth)??n.scrollWidth;e.style.width=`${r}px`}applyScrollbarStylesToElement(t){const{backgroundColor:e}=this.options;if(!this.isColorDark(e))return;const{borderColor:n,cellBorderColor:i}=this.options,r=`scrollbar-${this.instanceId}-${Date.now()}`,s=`\n #${t.id||cn} {\n scrollbar-width: thin;\n scrollbar-color: ${n} ${e};\n }\n\n #${t.id||cn}::-webkit-scrollbar {\n width: 12px;\n height: 12px;\n }\n\n #${t.id||cn}::-webkit-scrollbar-track {\n background: ${e};\n border-radius: 4px;\n }\n\n #${t.id||cn}::-webkit-scrollbar-thumb {\n background: ${n};\n border-radius: 4px;\n border: 2px solid ${e};\n }\n\n #${t.id||cn}::-webkit-scrollbar-thumb:hover {\n background: ${i};\n }\n `;t.id||(t.id=`timeline-horizontal-scroll-${this.instanceId}`),this.chartContext.injectStyles(s,r)}updateOptions(t){this.options=t}disableHeaderMousewheelScroll(){const t=this.domCache.timelineHeader;if(!t)return;t.addEventListener("wheel",(t=>{t.preventDefault()}),{passive:!1})}isColorDark(t){const e=t.replace("#","");return(.299*parseInt(e.substring(0,2),16)+.587*parseInt(e.substring(2,4),16)+.114*parseInt(e.substring(4,6),16))/255<.5}cleanup(){if(this.timelineScrollHandlers.bodyScroll||this.timelineScrollHandlers.horizontalScroll){const t=this.domCache.horizontalScroll,e=this.domCache.timelineBodyWrapper;t&&this.timelineScrollHandlers.horizontalScroll&&t.removeEventListener("scroll",this.timelineScrollHandlers.horizontalScroll),e&&this.timelineScrollHandlers.bodyScroll&&e.removeEventListener("scroll",this.timelineScrollHandlers.bodyScroll),this.timelineScrollHandlers={}}this.scrollbarResizeObserver&&(this.scrollbarResizeObserver.disconnect(),this.scrollbarResizeObserver=null),this.splitBarResizeHandler&&(this.chartContext.removeEventListener(hn,this.splitBarResizeHandler),this.splitBarResizeHandler=null)}}const pn=180/365.25/2/it,mn=7680/it;class gn{constructor(t,e,n,i,r,s){this.element=t,this.domCache=e,this.chartContext=n,this.instanceId=i,this.getPixelsPerMs=r,this.callbacks=s,this.zoomHandler=null}static clamp(t){return Math.min(mn,Math.max(pn,t))}setupZoomEventListener(){const t=this.instanceId,e=this.domCache.timelineContainer;e?(this.zoomHandler&&e.removeEventListener("wheel",this.zoomHandler),this.zoomHandler=t=>{if(!t.ctrlKey)return;t.preventDefault();const e=t.deltaY<0?1.1:1/1.1;this.applyZoom(e,t.clientX)},e.addEventListener("wheel",this.zoomHandler)):z.warn(`[${t}] Timeline element not found for zoom listener`)}zoomIn(){this.applyZoom(1.4)}zoomOut(){this.applyZoom(1/1.4)}isAtMaxZoom(){return this.getPixelsPerMs()>=mn-1e-12}isAtMinZoom(){return this.getPixelsPerMs()<=pn+1e-18}applyZoom(t,e){const n=this.getPixelsPerMs(),i=gn.clamp(n*t);if(i===n)return;const r=i/n,s=this.domCache.timelineBodyWrapper,o=(null==s?void 0:s.scrollLeft)??0;let a=0;if(s){const t=s.clientWidth;if(void 0!==e){const n=s.getBoundingClientRect();a=Math.max(0,Math.min(t,e-n.left))}else a=t/2}const l=Math.max(0,(o+a)*r-a);this.callbacks.onZoomChange(i),this.callbacks.onToolbarUpdate(),this.callbacks.onTimelineRerender(),this.callbacks.onDependencyArrowsRender(),this.applyHorizontalScroll(l,!1),requestAnimationFrame((()=>{this.callbacks.onScrollbarUpdate(),this.callbacks.onScrollbarPosition(),this.applyHorizontalScroll(l,!0)}))}applyHorizontalScroll(t,e){const{timelineBodyWrapper:n,timelineHeader:i,horizontalScroll:r}=this.domCache;n&&(n.scrollLeft=t),i&&(i.scrollLeft=t),e&&r&&(r.scrollLeft=t)}updateToolbarAfterZoom(){this.domCache.actionsContainer&&this.callbacks.onToolbarUpdate()}cleanup(){if(this.zoomHandler){const t=this.domCache.timelineContainer;t&&t.removeEventListener("wheel",this.zoomHandler),this.zoomHandler=null}}}const fn="aria-valuenow";class bn{constructor(t,e,n,i={}){this.chartContext=t,this.leftContent=e,this.rightContent=n,this.options=i,this.isDragging=!1,this.mouseMoveHandler=null,this.mouseUpHandler=null}getSplitViewStyles(){return"\n .split-view-container {\n display: flex !important;\n height: 100%;\n width: 100%;\n position: relative;\n box-sizing: border-box;\n overflow-x: hidden;\n overflow-y: auto;\n }\n\n .split-view-container .split-left-container {\n flex-grow: 0 !important;\n flex-shrink: 1 !important;\n overflow: visible;\n display: flex !important;\n flex-direction: column;\n position: relative;\n box-sizing: border-box;\n height: fit-content;\n min-height: 100%;\n }\n\n .split-view-container .split-right-container {\n overflow: visible;\n position: relative;\n flex: 1 !important;\n display: flex !important;\n flex-direction: column;\n min-width: 0;\n box-sizing: border-box;\n height: fit-content;\n min-height: 100%;\n }\n \n .split-view-container .split-bar-container {\n cursor: col-resize !important;\n user-select: none !important;\n touch-action: none;\n height: 100%;\n align-items: center;\n background: var(--split-bar-color, #DEE2E6);\n display: flex;\n flex: 0 0 auto;\n justify-content: center;\n min-width: 6px;\n width: 6px;\n z-index: 15;\n position: sticky;\n top: 0;\n box-sizing: border-box;\n border-left: 1px solid var(--split-bar-border-color, #BBBBBB);\n border-right: 1px solid var(--split-bar-border-color, #BBBBBB);\n opacity: 1;\n visibility: visible;\n transition: background-color 0.2s ease, border-color 0.2s ease;\n }\n\n .split-view-container .split-bar-container:hover {\n background: var(--split-bar-hover-color, #007BFF);\n border-color: var(--split-bar-hover-border-color, #0056B3);\n }\n\n .split-view-container .split-bar-container .resize-handler {\n border-left: 1.5px solid var(--split-bar-handle-color, #666666);\n border-right: 1.5px solid var(--split-bar-handle-color, #666666);\n height: 20px;\n width: 4px;\n position: relative;\n pointer-events: none;\n box-sizing: border-box;\n background: rgba(102, 102, 102, 0.3);\n display: block;\n border-radius: 1px;\n margin: 0;\n padding: 0;\n opacity: 1;\n visibility: visible;\n transition: background-color 0.2s ease, border-color 0.2s ease;\n }\n\n .split-view-container .split-bar-container:hover .resize-handler {\n background: rgba(255, 255, 255, 0.9);\n border-color: #FFFFFF;\n }\n\n .split-view-container.dragging {\n user-select: none;\n cursor: col-resize;\n }\n\n .split-view-container.dragging * {\n pointer-events: none;\n }\n\n .split-view-container.dragging .split-bar-container {\n pointer-events: all;\n }\n\n :host .split-view-container {\n display: flex !important;\n height: auto;\n width: 100%;\n position: relative;\n box-sizing: border-box;\n overflow-y: auto; /* shadow DOM */\n }\n "}injectStyles(){this.chartContext.injectStyles(this.getSplitViewStyles(),"split-view-styles",{priority:"normal"})}buildElements(){const{leftContainerClass:t="",leftContainerWidth:e=425,rightContainerClass:n=""}=this.options;this.leftContainer=l(this.chartContext,{className:"split-left-container"+(t?" "+t:""),style:{flexBasis:`${e}px`}}),this.rightContainer=l(this.chartContext,{className:"split-right-container"+(n?" "+n:"")});const i=l(this.chartContext,{className:"resize-handler"}),r=l(this.chartContext,{className:"split-bar-click-area"});r.style.cssText="\n position: absolute;\n top: 0;\n left: 50%;\n transform: translateX(-50%);\n width: 20px;\n height: 100%;\n cursor: col-resize;\n z-index: 10;\n background: transparent;\n display: block;\n box-sizing: border-box;\n ",this.splitBarContainer=l(this.chartContext,{className:"split-bar-container"}),this.splitBarContainer.setAttribute("role","separator"),this.splitBarContainer.setAttribute("aria-orientation","vertical"),this.splitBarContainer.setAttribute("aria-label","Resize panels"),this.splitBarContainer.setAttribute(fn,String(e)),this.splitBarContainer.setAttribute("aria-valuemin","0"),this.splitBarContainer.setAttribute("aria-valuemax",String(4*e)),this.splitBarContainer.setAttribute("tabindex","0"),this.splitBarContainer.append(i,r),Array.isArray(this.leftContent)?this.leftContainer.append(...this.leftContent):this.leftContainer.append(this.leftContent),Array.isArray(this.rightContent)?this.rightContainer.append(...this.rightContent):this.rightContainer.append(this.rightContent)}isRtl(){var t,e;const n=(null==(t=this.leftContainer)?void 0:t.parentElement)??(null==(e=this.splitBarContainer)?void 0:e.parentElement);return!!n&&"rtl"===getComputedStyle(n).direction}attachEventListeners(){this.splitBarContainer.addEventListener("pointerdown",(t=>{var e,n;const i=t;if(null!=i.button&&i.button>0)return;t.preventDefault(),this.isDragging=!0;const r=i.pointerId??null;if(null!=i.pointerId)try{null==(n=(e=this.splitBarContainer).setPointerCapture)||n.call(e,i.pointerId)}catch{}const s=this.splitBarContainer.closest(".split-view-container");null==s||s.classList.add("dragging");const o=this.isRtl();this.mouseMoveHandler=t=>{var e;if(!this.isDragging)return;const n=t;if(null!=r&&null!=n.pointerId&&n.pointerId!==r)return;const i=null==(e=this.leftContainer.parentElement)?void 0:e.getBoundingClientRect();if(!i)return;const s=o?i.right-t.clientX:t.clientX-i.left,a=i.width-50,l=Math.max(0,Math.min(a,s));this.leftContainer.style.flexBasis=`${l}px`,this.splitBarContainer.setAttribute(fn,String(Math.round(l))),this.dispatchResizeEvent()},this.mouseUpHandler=()=>{var t,e;if(this.isDragging=!1,null!=i.pointerId)try{null==(e=(t=this.splitBarContainer).releasePointerCapture)||e.call(t,i.pointerId)}catch{}const n=this.splitBarContainer.closest(".split-view-container");null==n||n.classList.remove("dragging"),this.dispatchResizeEvent(),this.mouseMoveHandler&&(this.chartContext.removeEventListener("pointermove",this.mouseMoveHandler),this.mouseMoveHandler=null),this.mouseUpHandler&&(this.chartContext.removeEventListener("pointerup",this.mouseUpHandler),this.chartContext.removeEventListener("pointercancel",this.mouseUpHandler),this.mouseUpHandler=null)},this.chartContext.addEventListener("pointermove",this.mouseMoveHandler),this.chartContext.addEventListener("pointerup",this.mouseUpHandler),this.chartContext.addEventListener("pointercancel",this.mouseUpHandler)})),this.splitBarContainer.addEventListener("keydown",(t=>{let e;const n=parseInt(this.leftContainer.style.flexBasis)||this.options.leftContainerWidth||400;switch(t.key){case"ArrowLeft":t.preventDefault(),e=this.isRtl()?n+10:Math.max(0,n-10),this.leftContainer.style.flexBasis=`${e}px`,this.splitBarContainer.setAttribute(fn,String(e)),this.dispatchResizeEvent();break;case"ArrowRight":t.preventDefault(),e=this.isRtl()?Math.max(0,n-10):n+10,this.leftContainer.style.flexBasis=`${e}px`,this.splitBarContainer.setAttribute(fn,String(e)),this.dispatchResizeEvent();break;case"Home":t.preventDefault(),this.leftContainer.style.flexBasis="0px",this.splitBarContainer.setAttribute(fn,"0"),this.dispatchResizeEvent();break;case"End":{t.preventDefault();const e=this.splitBarContainer.parentElement;if(e){const t=e.clientWidth-50;this.leftContainer.style.flexBasis=`${t}px`,this.splitBarContainer.setAttribute(fn,String(Math.round(t)))}this.dispatchResizeEvent();break}}}))}dispatchResizeEvent(){const t=new CustomEvent("splitview-resize",{bubbles:!0,detail:{leftWidth:parseInt(this.leftContainer.style.flexBasis)||0}});this.chartContext.dispatchEvent(t)}cleanupEventListeners(){this.mouseMoveHandler&&(this.chartContext.removeEventListener("pointermove",this.mouseMoveHandler),this.mouseMoveHandler=null),this.mouseUpHandler&&(this.chartContext.removeEventListener("pointerup",this.mouseUpHandler),this.chartContext.removeEventListener("pointercancel",this.mouseUpHandler),this.mouseUpHandler=null)}render(){this.injectStyles(),this.buildElements(),this.attachEventListeners();const t=l(this.chartContext,{className:"split-view-container"});return t.append(this.leftContainer,this.splitBarContainer,this.rightContainer),[t]}destroy(){this.cleanupEventListeners()}}const vn="data-chart-instance";class yn{constructor(t,e,n,i,r){this.element=t,this.options=e,this.domCache=n,this.chartContext=i,this.instanceId=r}updateOptions(t){this.options=t}setupChartContainerPositioning(){if(this.element){"static"===window.getComputedStyle(this.element).position&&(this.element.style.position="relative"),this.element.style.isolation="isolate"}}createLayout(t,e,n,i,r){t.style.position="relative",t.style.isolation="isolate";const s=this.instanceId,o=l(this.chartContext,{className:sn.tasksContainer.slice(1)});let a,d;if(!Array.isArray(e))return void z.error("Tasks table should be an array of [header, body]");a=e[0],d=e[1];const h=l(this.chartContext,{className:sn.tasksBodyWrapper.slice(1)});h.appendChild(d),o.appendChild(a),o.appendChild(h);const c=l(this.chartContext,{className:sn.timelineContainer.slice(1)});c.setAttribute(vn,s),c.setAttribute("dir","ltr");const u=n[0];c.appendChild(u);const p=l(this.chartContext,{className:sn.timelineBodyWrapper.slice(1)});for(let t=1;t<n.length-1;t++)p.appendChild(n[t]);c.appendChild(p);const m=n[n.length-1];if(m.setAttribute("dir","ltr"),i){const e=new bn(this.chartContext,o,c,{leftContainerClass:"",leftContainerWidth:r,rightContainerClass:""}).render();t.append(...e)}else o.style.flex=`0 0 ${r}px`,t.append(o,c);t.appendChild(m)}syncTasksColumnWidths(){this.domCache.tasksContainer}fillEmptyRowsAfterRender(){const t=this.domCache.ganttContainer,e=this.domCache.timelineBody,n=this.domCache.tasksDataContainer;if(!t||!e||!n)return;e.querySelectorAll(sn.timelineEmptyRow).forEach((t=>t.remove()));n.querySelectorAll(sn.tasksEmptyRow).forEach((t=>t.remove()));const i=t.clientHeight,r=e.querySelectorAll(`${sn.timelineDataRow}:not(${sn.timelineEmptyRow})`).length,s=this.options.rowHeight,o=Math.floor(i/s),a=Math.max(0,o-r);if(0===a)return;let l=0;const d=e.querySelector(sn.timelineDataRow);if(d)l=d.querySelectorAll(sn.timelineDataCell).length;else{const t=this.domCache.timelineHeader;if(t){l=t.querySelectorAll(sn.timelineHeaderCell).length}}if(0===l)return;const h=this.readSubHeaderCellWidths(l),c=n.querySelector(".tasks-add-row")?1:0;for(let t=0;t<a;t++){const n=this.createEmptyTimelineRow(r+t,h);e.appendChild(n)}const u=Math.max(0,a-c);for(let t=0;t<u;t++){const e=this.createEmptyTaskRow(r+c+t);n.appendChild(e)}}readSubHeaderCellWidths(t){const e=this.domCache.timelineHeader,n=[];if(e){const t=e.querySelectorAll(sn.timelineHeaderRow),i=t[t.length-1];if(i){i.querySelectorAll(sn.timelineHeaderCell).forEach((t=>{const e=t.getBoundingClientRect().width;e>0&&n.push(e)}))}}if(n.length===t)return n;const i=n[0]??0;return Array.from({length:t},(()=>i))}createEmptyTimelineRow(t,e){const n=l(this.chartContext,{className:`${sn.timelineDataRow.slice(1)} ${sn.timelineEmptyRow.slice(1)}`}),{rowHeight:i}=this.options,r=this.instanceId;return n.setAttribute("data-taskid",`empty-${t}`),n.setAttribute(vn,r),n.style.height=`${i}px`,e.forEach((t=>{const e=l(this.chartContext,{className:sn.timelineDataCell.slice(1),style:{boxSizing:"border-box",height:`${i}px`,minWidth:`${t}px`,maxWidth:`${t}px`,flexShrink:"0"}});e.setAttribute(vn,r),n.appendChild(e)})),n}createEmptyTaskRow(t){const e=l(this.chartContext,{className:`${sn.tasksDataRow.slice(1)} ${sn.tasksEmptyRow.slice(1)}`}),{rowHeight:n}=this.options,i=this.instanceId;return e.setAttribute("data-taskid",`empty-${t}`),e.setAttribute(vn,i),e.style.height=`${n}px`,Pt.forEach((({key:t})=>{const r=l(this.chartContext,{className:sn.tasksDataCell.slice(1),content:""});r.setAttribute("data-columnid",t),r.setAttribute(vn,i),r.style.height=`${n}px`,r.style.color="var(--text-color)",e.appendChild(r)})),e}}const xn="\n .gantt-context-menu {\n position: fixed;\n z-index: 1100;\n min-width: 180px;\n background-color: var(--dialog-bg-color, #fff);\n border: 1px solid var(--dialog-border-color, #D9D9D9);\n border-radius: 4px;\n box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);\n padding: 4px 0;\n font-family: inherit;\n font-size: 13px;\n line-height: 1.4;\n user-select: none;\n animation: ganttContextMenuFadeIn 0.12s ease-out;\n }\n\n .gantt-context-menu-item {\n display: block;\n width: 100%;\n text-align: left;\n padding: 7px 14px;\n background: transparent;\n border: none;\n color: var(--text-color, #333);\n cursor: pointer;\n font: inherit;\n }\n\n .gantt-context-menu-item:hover:not(:disabled) {\n background-color: var(--toolbar-hover-bg-color, #f1f1f1);\n }\n\n .gantt-context-menu-item:focus {\n outline: none;\n background-color: var(--button-hover-bg-color, #e6f3ff);\n }\n\n .gantt-context-menu-item:disabled {\n color: var(--text-color-muted, rgba(0, 0, 0, 0.35));\n cursor: not-allowed;\n }\n\n .gantt-context-menu-separator {\n height: 1px;\n margin: 4px 0;\n background-color: var(--dialog-border-color, #E4E4E4);\n }\n\n @keyframes ganttContextMenuFadeIn {\n from {\n opacity: 0;\n transform: translateY(-2px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n",wn="\n .gantt-dialog-container {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: none;\n z-index: 999;\n overflow: hidden;\n }\n\n .gantt-dialog-container .dialog-overlay {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n }\n\n .gantt-dialog-container .gantt-dialog {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n background: var(--dialog-bg-color, white);\n border-radius: 4px;\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);\n border: 1px solid var(--dialog-border-color, #eee);\n z-index: 1000;\n min-width: 300px;\n max-width: 90%;\n max-height: 90%;\n display: flex;\n flex-direction: column;\n }\n\n .gantt-dialog .dialog-header {\n padding: 12px 16px;\n border-bottom: 1px solid var(--dialog-border-color, #eee);\n display: flex;\n justify-content: space-between;\n align-items: center;\n background: var(--header-bg-color, #f3f3f3);\n flex-shrink: 0;\n }\n\n .gantt-dialog .dialog-title {\n font-weight: 600;\n font-size: 16px;\n color: var(--header-text-color, #333);\n margin: 0;\n }\n\n .gantt-dialog .dialog-close {\n background: none;\n border: none;\n font-size: 20px;\n cursor: pointer;\n padding: 0;\n color: var(--text-color, #666);\n transition: color 0.2s;\n line-height: 1;\n }\n\n .gantt-dialog .dialog-close:hover {\n color: var(--text-color, #333);\n }\n\n .gantt-dialog .dialog-content {\n padding: 16px;\n overflow-y: auto;\n overflow-x: hidden;\n flex: 1;\n background: var(--dialog-bg-color, white);\n color: var(--text-color, #333);\n }\n\n .gantt-dialog .dialog-content::-webkit-scrollbar {\n width: 8px;\n }\n\n .gantt-dialog .dialog-content::-webkit-scrollbar-track {\n background: var(--dialog-bg-color, #f1f1f1);\n }\n\n .gantt-dialog .dialog-content::-webkit-scrollbar-thumb {\n background: var(--border-color, #888);\n border-radius: 4px;\n }\n\n .gantt-dialog .dialog-content::-webkit-scrollbar-thumb:hover {\n background: var(--text-color, #555);\n }\n\n .gantt-dialog-container.show {\n display: block;\n }\n\n .gantt-dialog-container.animate .dialog-overlay {\n animation: fadeIn 0.2s ease-out;\n }\n\n .gantt-dialog-container.animate .gantt-dialog {\n animation: slideIn 0.3s ease-out;\n }\n\n @keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n\n @keyframes slideIn {\n from {\n opacity: 0;\n transform: translate(-50%, -48%);\n }\n to {\n opacity: 1;\n transform: translate(-50%, -50%);\n }\n }\n\n .gantt-container {\n position: relative;\n }\n",kn="\n .dropdown {\n position: relative;\n display: inline-block;\n }\n\n .dropdown .gantt-action-button {\n border-radius: 4px;\n }\n\n .dropdown.show .gantt-action-button {\n background: var(--toolbar-hover-bg-color, #f8f9fa);\n border-color: var(--button-bg-color, #0066cc);\n }\n \n .dropdown-btn {\n padding: 8px 16px;\n background-color: var(--toolbar-bg-color, #fff);\n color: var(--text-color, rgba(0, 0, 0, 0.7));\n border: 1px solid var(--toolbar-border-color, #ddd);\n cursor: pointer;\n font-weight: bold;\n border-radius: 2px;\n font-family: inherit;\n font-size: inherit;\n line-height: 1.5;\n transition: background-color 0.2s ease, border-color 0.2s ease;\n }\n \n .dropdown-btn:hover {\n background-color: var(--toolbar-hover-bg-color, #f8f9fa);\n border-color: var(--toolbar-border-color, #bbb);\n }\n \n .dropdown-btn:focus {\n outline: none;\n border-color: var(--button-bg-color, #0066cc);\n box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.2);\n }\n \n .dropdown-content {\n display: none;\n position: absolute;\n background-color: var(--dialog-bg-color, #fff);\n min-width: 160px;\n box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);\n z-index: 1000;\n border-radius: 4px;\n right: 0;\n top: calc(100% + 4px);\n border: 1px solid var(--dialog-border-color, #D9D9D9);\n overflow: hidden;\n }\n \n .dropdown-content a {\n color: var(--text-color, #333);\n padding: 10px 14px;\n text-decoration: none;\n display: block;\n font-family: inherit;\n font-size: 13px;\n line-height: 1.4;\n transition: background-color 0.2s ease;\n cursor: pointer;\n }\n \n .dropdown-content a:hover {\n background-color: var(--toolbar-hover-bg-color, #f1f1f1);\n }\n \n .dropdown-content a:focus {\n background-color: var(--button-hover-bg-color, #e6f3ff);\n outline: none;\n }\n \n .dropdown.show .dropdown-content {\n display: block;\n animation: dropdownSlideDown 0.2s ease-out;\n }\n \n @keyframes dropdownSlideDown {\n from {\n opacity: 0;\n transform: translateY(-5px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n \n /* Shadow DOM specific adjustments */\n :host .dropdown {\n position: relative;\n display: inline-block;\n }\n",Cn="\n * {\n box-sizing: border-box;\n }\n\n .gantt-container * {\n user-select: none;\n }\n\n .gantt-actions-container {\n display: flex;\n align-items: center;\n gap: 2px;\n padding: 5px 10px;\n flex: 0 0 40px;\n min-height: 40px;\n max-height: 40px;\n background-color: var(--background-color, #FFFFFF);\n border: 1px solid var(--border-color, #DFE0E1);\n }\n\n .gantt-actions-spacer {\n flex: 1;\n min-width: 8px;\n }\n\n .gantt-action-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 30px;\n height: 30px;\n padding: 0;\n border: none;\n border-radius: 6px;\n background: transparent;\n color: var(--toolbar-icon-color, #444);\n cursor: pointer;\n transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;\n flex-shrink: 0;\n }\n\n .gantt-action-button:hover:not(:disabled) {\n background: var(--toolbar-hover-bg-color, rgba(0, 0, 0, 0.06));\n color: var(--toolbar-icon-hover-color, #111);\n transform: translateY(-1px);\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);\n }\n\n .gantt-action-button:active:not(:disabled) {\n transform: translateY(0);\n box-shadow: none;\n background: var(--toolbar-active-bg-color, rgba(0, 0, 0, 0.1));\n }\n\n .gantt-action-button:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px var(--focus-ring-color, #005fcc);\n }\n\n .gantt-action-button:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n }\n\n .gantt-action-button svg {\n width: 15px;\n height: 15px;\n stroke: currentColor;\n flex-shrink: 0;\n }\n\n .gantt-action-separator {\n width: 1px;\n height: 18px;\n background-color: var(--border-color, rgba(0, 0, 0, 0.1));\n margin: 0 6px;\n flex-shrink: 0;\n }\n\n .gantt-view-mode-display {\n display: inline-flex;\n align-items: center;\n gap: 5px;\n padding: 4px 10px;\n height: 28px;\n font-size: 12.5px;\n color: var(--text-color, #555);\n background: var(--toolbar-hover-bg-color, rgba(0, 0, 0, 0.05));\n border-radius: 6px;\n margin-left: 2px;\n font-weight: 500;\n white-space: nowrap;\n flex-shrink: 0;\n }\n\n .gantt-view-mode-display svg {\n width: 13px;\n height: 13px;\n flex-shrink: 0;\n }\n \n .gantt-container {\n display: flex;\n flex: 1 1 auto;\n min-height: 0;\n min-width: 0;\n border: 1px solid var(--border-color, #DFE0E1);\n border-top: none;\n position: relative;\n background-color: var(--background-color, #FFFFFF);\n overflow: hidden;\n height: 100%;\n box-sizing: border-box;\n }\n \n .gantt-button {\n border: 1px solid var(--toolbar-border-color, rgba(0, 0, 0, 0.12));\n border-radius: 6px;\n background: var(--toolbar-bg-color, #fff);\n padding: 4px 12px;\n color: var(--text-color, rgba(0, 0, 0, 0.75));\n line-height: 20px;\n font-weight: 500;\n cursor: pointer;\n transition: background-color 0.15s ease, border-color 0.15s ease;\n font-size: 13px;\n }\n\n .gantt-button:hover {\n background: var(--toolbar-hover-bg-color, rgba(0, 0, 0, 0.04));\n border-color: var(--toolbar-border-color, rgba(0, 0, 0, 0.2));\n }\n\n .gantt-button:disabled {\n color: rgba(128, 128, 128, 0.5);\n opacity: 0.6;\n }\n\n /* ── WCAG 2.1 AA: focus styles ─────────────────────────────────────────── */\n\n .tasks-data-row:focus-visible {\n outline: 2px solid var(--focus-ring-color, #005fcc);\n outline-offset: -2px;\n }\n\n .bar-timeline:focus {\n outline: none;\n }\n\n .bar-timeline:focus-visible {\n outline: 2px solid var(--focus-ring-color, #005fcc);\n outline-offset: 2px;\n }\n\n .tasks-data-row[aria-selected=\"true\"] {\n background-color: var(--row-selected-bg-color, rgba(0, 95, 204, 0.12));\n }\n\n /* ── Selection: checkbox column ────────────────────────────────────────── */\n\n .gantt-checkbox-cell {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n min-width: 28px;\n max-width: 28px;\n }\n\n .gantt-selection-checkbox,\n .gantt-select-all-checkbox {\n width: 15px;\n height: 15px;\n margin: 0;\n cursor: pointer;\n accent-color: var(--button-bg-color, #005fcc);\n }\n\n /* ── Selection: toolbar count indicator ─────────────────────────────────── */\n\n .gantt-selection-count {\n display: inline-flex;\n align-items: center;\n padding: 3px 10px;\n height: 24px;\n font-size: 12px;\n font-weight: 500;\n color: var(--button-bg-color, #005fcc);\n background: var(--row-selected-bg-color, rgba(0, 95, 204, 0.12));\n border-radius: 12px;\n margin-left: 8px;\n white-space: nowrap;\n flex-shrink: 0;\n }\n\n /* ── Quick-filter search box ─────────────────────────────────── */\n\n .gantt-quick-filter {\n display: inline-flex;\n align-items: center;\n flex-shrink: 0;\n }\n\n .gantt-quick-filter-input {\n height: 26px;\n width: 180px;\n max-width: 220px;\n padding: 2px 10px;\n font-size: 13px;\n font-family: inherit;\n color: var(--text-color, #222);\n background: var(--background-color, #FFFFFF);\n border: 1px solid var(--border-color, #DFE0E1);\n border-radius: 6px;\n outline: none;\n user-select: text;\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n }\n\n .gantt-quick-filter-input::placeholder {\n color: var(--text-color, #888);\n opacity: 0.6;\n }\n\n .gantt-quick-filter-input:focus {\n border-color: var(--button-bg-color, #005fcc);\n box-shadow: 0 0 0 2px var(--focus-ring-color, rgba(0, 95, 204, 0.25));\n }\n\n /* ── Advanced filter builder ─────────────────────────────────── */\n\n .gantt-filter-builder {\n position: relative;\n display: inline-flex;\n flex-shrink: 0;\n }\n\n .gantt-filter-builder-button {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n height: 28px;\n padding: 0 10px;\n font-size: 13px;\n font-family: inherit;\n color: var(--toolbar-icon-color, #444);\n background: transparent;\n border: 1px solid var(--border-color, #DFE0E1);\n border-radius: 6px;\n cursor: pointer;\n transition: background-color 0.15s ease, border-color 0.15s ease;\n }\n\n .gantt-filter-builder-button:hover {\n background: var(--toolbar-hover-bg-color, rgba(0, 0, 0, 0.06));\n }\n\n .gantt-filter-builder-button.is-active {\n border-color: var(--button-bg-color, #005fcc);\n color: var(--button-bg-color, #005fcc);\n }\n\n .gantt-filter-builder-button svg {\n width: 14px;\n height: 14px;\n stroke: currentColor;\n }\n\n .gantt-filter-builder-badge {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 16px;\n height: 16px;\n padding: 0 4px;\n font-size: 11px;\n font-weight: 600;\n color: #fff;\n background: var(--button-bg-color, #005fcc);\n border-radius: 8px;\n }\n\n .gantt-filter-popover {\n position: absolute;\n top: calc(100% + 6px);\n left: 0;\n z-index: 1000;\n width: 380px;\n max-width: 90vw;\n padding: 12px;\n background: var(--background-color, #FFFFFF);\n color: var(--text-color, #222);\n border: 1px solid var(--border-color, #DFE0E1);\n border-radius: 8px;\n box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16);\n cursor: default;\n }\n\n .gantt-filter-popover-header {\n display: flex;\n align-items: center;\n gap: 8px;\n margin-bottom: 10px;\n font-size: 13px;\n }\n\n .gantt-filter-rows {\n display: flex;\n flex-direction: column;\n gap: 8px;\n max-height: 240px;\n overflow-y: auto;\n }\n\n .gantt-filter-empty {\n font-size: 13px;\n color: var(--text-color, #888);\n opacity: 0.6;\n padding: 6px 2px;\n }\n\n .gantt-filter-row {\n display: grid;\n grid-template-columns: 1fr 1fr 1fr auto;\n gap: 6px;\n align-items: center;\n }\n\n .gantt-filter-row select,\n .gantt-filter-row input {\n height: 28px;\n min-width: 0;\n padding: 2px 6px;\n font-size: 13px;\n font-family: inherit;\n color: var(--text-color, #222);\n background: var(--background-color, #FFFFFF);\n border: 1px solid var(--border-color, #DFE0E1);\n border-radius: 4px;\n user-select: text;\n }\n\n .gantt-filter-match {\n height: 26px;\n font-size: 13px;\n font-family: inherit;\n color: var(--text-color, #222);\n background: var(--background-color, #FFFFFF);\n border: 1px solid var(--border-color, #DFE0E1);\n border-radius: 4px;\n }\n\n .gantt-filter-remove {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 26px;\n height: 26px;\n padding: 0;\n color: var(--toolbar-icon-color, #888);\n background: transparent;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n }\n\n .gantt-filter-remove:hover {\n background: var(--toolbar-hover-bg-color, rgba(0, 0, 0, 0.06));\n color: var(--text-color, #111);\n }\n\n .gantt-filter-popover-footer {\n display: flex;\n align-items: center;\n gap: 8px;\n margin-top: 12px;\n }\n\n .gantt-filter-footer-spacer {\n flex: 1;\n }\n\n .gantt-filter-add,\n .gantt-filter-clear,\n .gantt-filter-apply {\n height: 28px;\n padding: 0 12px;\n font-size: 13px;\n font-family: inherit;\n border-radius: 4px;\n cursor: pointer;\n border: 1px solid var(--border-color, #DFE0E1);\n background: var(--background-color, #FFFFFF);\n color: var(--text-color, #222);\n }\n\n .gantt-filter-add {\n margin-right: auto;\n }\n\n .gantt-filter-apply {\n background: var(--button-bg-color, #005fcc);\n border-color: var(--button-bg-color, #005fcc);\n color: #fff;\n }\n\n .gantt-filter-add:hover,\n .gantt-filter-clear:hover {\n background: var(--toolbar-hover-bg-color, rgba(0, 0, 0, 0.06));\n }\n\n /* ── Custom toolbar items ────────────────────────────────────── */\n\n .gantt-toolbar-button {\n display: inline-flex;\n align-items: center;\n gap: 5px;\n padding: 0 10px;\n width: auto;\n min-width: 30px;\n font-size: 12.5px;\n font-weight: 500;\n color: var(--toolbar-icon-color, #444);\n white-space: nowrap;\n border-radius: 6px;\n }\n\n .gantt-toolbar-button span {\n line-height: 1;\n }\n\n .gantt-toolbar-select-wrapper {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n flex-shrink: 0;\n }\n\n .gantt-toolbar-select-label {\n font-size: 13px;\n color: var(--text-color, #666);\n white-space: nowrap;\n flex-shrink: 0;\n }\n\n .gantt-toolbar-select {\n height: 28px;\n padding: 0 24px 0 8px;\n border: 1px solid var(--border-color, #DFE0E1);\n border-radius: 4px;\n background: var(--toolbar-bg-color, #fff);\n color: var(--text-color, #333);\n font-size: 13px;\n cursor: pointer;\n appearance: none;\n -webkit-appearance: none;\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");\n background-repeat: no-repeat;\n background-position: right 8px center;\n min-width: 100px;\n max-width: 180px;\n outline: none;\n }\n\n .gantt-toolbar-select:hover {\n border-color: var(--button-bg-color, #005fcc);\n }\n\n .gantt-toolbar-select:focus {\n border-color: var(--focus-ring-color, #005fcc);\n box-shadow: 0 0 0 2px rgba(0, 95, 204, 0.2);\n }\n\n /* ── prefers-reduced-motion ─────────────────────────────────────────────── */\n\n @media (prefers-reduced-motion: reduce) {\n .bar-timeline,\n .bar-timeline-progress,\n .bar-handle,\n .gantt-action-button,\n .gantt-button,\n .tasks-data-row,\n .gantt-dialog-container,\n .gantt-dialog {\n transition: none !important;\n animation: none !important;\n }\n }\n\n /* JS-detected reduced motion class (mirrors the media query in JS context) */\n .gantt-reduced-motion .bar-timeline,\n .gantt-reduced-motion .bar-timeline-progress,\n .gantt-reduced-motion .bar-handle,\n .gantt-reduced-motion .gantt-action-button,\n .gantt-reduced-motion .gantt-button,\n .gantt-reduced-motion .tasks-data-row,\n .gantt-reduced-motion .gantt-dialog-container,\n .gantt-reduced-motion .gantt-dialog {\n transition: none !important;\n animation: none !important;\n }\n",Sn="\n .gantt-container ::-webkit-scrollbar {\n width: 12px;\n height: 12px;\n }\n\n .gantt-container ::-webkit-scrollbar-track {\n background: var(--scrollbar-track-color, #F5F5F5);\n border-radius: 4px;\n }\n\n .gantt-container ::-webkit-scrollbar-thumb {\n background: var(--scrollbar-thumb-color, #C1C1C1);\n border-radius: 4px;\n border: 2px solid var(--scrollbar-track-color, #F5F5F5);\n }\n\n .gantt-container ::-webkit-scrollbar-thumb:hover {\n background: var(--scrollbar-thumb-hover-color, #A8A8A8);\n }\n\n .gantt-container * {\n scrollbar-width: thin;\n scrollbar-color: var(--scrollbar-thumb-color, #C1C1C1) var(--scrollbar-track-color, #F5F5F5);\n }\n\n /* Shadow DOM support */\n :host .gantt-container ::-webkit-scrollbar {\n width: 12px;\n height: 12px;\n }\n\n :host .gantt-container ::-webkit-scrollbar-track {\n background: var(--scrollbar-track-color, #F5F5F5);\n border-radius: 4px;\n }\n\n :host .gantt-container ::-webkit-scrollbar-thumb {\n background: var(--scrollbar-thumb-color, #C1C1C1);\n border-radius: 4px;\n border: 2px solid var(--scrollbar-track-color, #F5F5F5);\n }\n\n :host .gantt-container ::-webkit-scrollbar-thumb:hover {\n background: var(--scrollbar-thumb-hover-color, #A8A8A8);\n }\n\n :host .gantt-container * {\n scrollbar-width: thin;\n scrollbar-color: var(--scrollbar-thumb-color, #C1C1C1) var(--scrollbar-track-color, #F5F5F5);\n }\n",Mn="\n\n .task-form {\n overflow: visible;\n }\n\n .task-form .form-group {\n margin-bottom: 18px;\n position: relative;\n }\n\n /* extra padding to last form group for breathing room */\n .task-form .form-group:last-of-type {\n margin-bottom: 24px;\n }\n\n .task-form label {\n display: block;\n margin-bottom: 5px;\n font-weight: 500;\n color: var(--text-color, #333);\n }\n\n .task-form input {\n width: 100%;\n padding: 8px;\n border: 1px solid var(--dialog-border-color, #ddd);\n border-radius: 4px;\n font-size: 14px;\n background-color: var(--dialog-bg-color, #fff);\n color: var(--text-color, #333);\n }\n\n .task-form input:focus {\n outline: none;\n border-color: var(--button-bg-color, #0066cc);\n }\n\n .task-form .form-actions {\n display: flex;\n justify-content: flex-end;\n gap: 8px;\n margin-top: 24px;\n padding-top: 16px;\n border-top: 1px solid var(--dialog-border-color, #eee);\n position: sticky;\n bottom: -16px;\n background: var(--dialog-bg-color, white);\n margin-left: -16px;\n margin-right: -16px;\n margin-bottom: -16px;\n padding-left: 16px;\n padding-right: 16px;\n padding-bottom: 16px;\n }\n\n .task-form .btn-primary {\n background: var(--button-bg-color, #0066cc);\n color: var(--button-text-color, white);\n border: none;\n padding: 8px 16px;\n border-radius: 4px;\n cursor: pointer;\n font-weight: 500;\n }\n\n .task-form .btn-primary:hover {\n background: var(--button-hover-bg-color, #0052a3);\n }\n\n .task-form .btn-disabled,\n .task-form .btn-disabled:hover {\n background: #99c2ff;\n cursor: not-allowed;\n opacity: 0.7;\n }\n\n .task-form .form-error {\n position: absolute;\n bottom: -15px;\n left: 0;\n color: #dc3545;\n font-size: 12px;\n margin-top: 4px;\n line-height: 1.2;\n transition: opacity 0.2s ease;\n }\n\n .task-form .invalid {\n border-color: #dc3545;\n }\n\n .task-form .invalid:focus {\n border-color: #dc3545;\n box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);\n }\n",En="\n .tasks-container {\n height: 100%;\n position: relative;\n display: flex;\n flex-direction: column;\n overflow-x: visible;\n overflow-y: visible;\n }\n\n .tasks-header {\n flex-shrink: 0;\n position: sticky;\n top: 0;\n z-index: 10;\n background-color: var(--header-bg-color, #F3F3F3);\n overflow: hidden;\n }\n\n .tasks-header-row {\n display: grid;\n width: 100%;\n position: relative;\n }\n\n /* Column being dragged to reorder. */\n .tasks-header-cell-dragging {\n opacity: 0.5;\n }\n\n /* Insertion marker shown while reordering columns. */\n .tasks-column-drop-indicator {\n position: absolute;\n top: 0;\n height: 100%;\n width: 2px;\n transform: translateX(-1px);\n background: var(--split-bar-hover-color, #007BFF);\n pointer-events: none;\n z-index: 4;\n }\n\n .tasks-header-cell {\n padding: 0 10px;\n text-align: center;\n /* Visible so the resize grip can straddle the column divider; the inner\n label still clips + ellipsizes the title. */\n overflow: visible;\n display: flex;\n align-items: center;\n /* Only top + bottom + right are drawn so the column divider (right) is\n painted exactly once between adjacent cells (the previous full-border\n shorthand had cell-A's right + cell-B's left = ~2px line). */\n border-top: var(--cell-border-width, 1px) solid var(--cell-border-color, #eff0f0);\n /* Header/body divider uses the stronger structural border so the white\n header still reads as a distinct band; internal gridlines stay faint. */\n border-bottom: var(--cell-border-width, 1px) solid var(--border-color, #E5E7EB);\n border-right: var(--cell-border-width, 1px) solid var(--cell-border-color, #eff0f0);\n color: var(--text-color, #000);\n box-sizing: border-box;\n font-weight: 600;\n position: relative;\n transition: background-color 0.15s ease;\n }\n\n /* Subtle darken (light) / lighten (dark) on hover so header cells read as\n interactive for sorting, resizing, etc. */\n .tasks-header-cell:hover {\n background-color: var(--header-hover-bg-color, #eef0f2);\n }\n\n /* Title wrapper: owns the ellipsis now that the cell overflows visibly. */\n .tasks-header-cell-label {\n flex: 0 1 auto;\n min-width: 0;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .tasks-header-row .tasks-header-cell:last-child {\n border-right: none;\n }\n\n /* Drag-to-resize grip centered on the column divider (straddles the cell's\n trailing edge). Sits above the header's sort click target and the adjacent\n cell, and widens its hit area on hover. */\n .gantt-column-resize-handle {\n position: absolute;\n inset-inline-end: -4px;\n top: 0;\n height: 100%;\n width: 4px;\n cursor: col-resize;\n z-index: 3;\n touch-action: none;\n user-select: none;\n }\n\n .gantt-column-resize-handle:hover,\n .gantt-column-resize-handle:active {\n background: var(--split-bar-hover-color, #007BFF);\n opacity: 0.35;\n }\n\n .gantt-sort-caret {\n display: inline-flex;\n align-items: center;\n gap: 1px;\n margin-left: 5px;\n flex: 0 0 auto;\n line-height: 0;\n /* Both idle and active arrows use this (dark) text color; the active\n direction stands out via full opacity and a heavier stroke instead. */\n color: var(--text-color, #000);\n }\n\n /* Lift the resting (idle) arrow on hover to signal the column is sortable.\n Scoped to the dimmed hint arrow so an actively-sorted column stays at full\n strength. */\n .tasks-header-cell-sortable:hover .gantt-sort-caret svg[opacity='0.4'] {\n opacity: 0.7;\n }\n\n .gantt-sort-order {\n font-size: 0.7em;\n font-weight: 700;\n line-height: 1;\n color: var(--button-bg-color, #005fcc);\n }\n\n .tasks-body-wrapper {\n flex: 1;\n overflow: visible;\n position: relative;\n }\n\n .tasks-data-container {\n display: flex;\n flex-direction: column;\n width: 100%;\n }\n\n .tasks-data-row {\n display: grid;\n width: 100%;\n border-bottom: var(--cell-border-width, 1px) solid var(--cell-border-color, #eff0f0);\n box-sizing: border-box;\n }\n\n .tasks-data-cell {\n padding: 0 10px;\n text-align: center;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: flex;\n align-items: center;\n /* Only the right edge — the next cell supplies its own left, so each\n column divider is painted exactly once (the previous left+right setup\n doubled at every boundary, making verticals visibly thicker than the\n row dividers). */\n border-right: var(--cell-border-width, 1px) solid var(--cell-border-color, #eff0f0);\n color: var(--text-color, #000);\n box-sizing: border-box;\n }\n\n .tasks-data-row .tasks-data-cell:last-child {\n border-right: none;\n }\n\n /* Group-header row (rendered while grouping is active): a full-width band. */\n .tasks-group-row {\n display: flex;\n background-color: var(--group-header-bg-color, var(--header-bg-color, #f3f3f3));\n cursor: pointer;\n }\n\n .tasks-group-cell {\n flex: 1 1 auto;\n border-right: none;\n font-weight: 600;\n gap: 6px;\n }\n\n .tasks-group-count {\n color: var(--text-color-muted, rgba(0, 0, 0, 0.55));\n font-weight: 400;\n }\n\n .tasks-add-row {\n cursor: pointer;\n color: var(--text-color-muted, rgba(0, 0, 0, 0.55));\n transition: background-color 0.15s ease, color 0.15s ease;\n display: flex;\n }\n\n .tasks-add-row:hover,\n .tasks-add-row:focus {\n outline: none;\n background-color: var(--toolbar-hover-bg-color, #f1f5f9);\n color: var(--text-color, #000);\n }\n\n .tasks-add-row-cell {\n flex: 1;\n border-right: none !important;\n padding: 0 14px;\n text-align: left !important;\n justify-content: flex-start !important;\n font-style: italic;\n font-weight: 500;\n user-select: none;\n }\n\n .tasks-data-row .task-toggle-icon,\n .tasks-data-row .task-toggle-icon-blank {\n display: inline-block;\n margin-right: 5px;\n width: 10px;\n height: 10px;\n vertical-align: middle;\n flex-shrink: 0;\n }\n\n .tasks-data-row .task-toggle-icon {\n cursor: pointer;\n position: relative;\n }\n\n /* Chevron (expanded) - pointing down */\n .tasks-data-row .task-toggle-icon.expanded::before {\n content: '';\n position: absolute;\n width: 6px;\n height: 6px;\n border-right: 2px solid var(--text-color, #000000);\n border-bottom: 2px solid var(--text-color, #000000);\n transform: rotate(45deg);\n top: 0;\n left: 2px;\n }\n\n /* Chevron - pointing right (collapsed) */\n .tasks-data-row .task-toggle-icon.collapsed::before {\n content: '';\n position: absolute;\n width: 6px;\n height: 6px;\n border-right: 2px solid var(--text-color, #000000);\n border-bottom: 2px solid var(--text-color, #000000);\n transform: rotate(-45deg);\n top: 2px;\n left: 0;\n }\n\n .tasks-data-row .task-toggle-icon:hover::before {\n opacity: 0.7;\n }\n\n /* Inline editing */\n .tasks-data-cell.inline-editable {\n cursor: text;\n }\n\n .tasks-data-cell.inline-editable:hover {\n background-color: var(--inline-edit-hover-bg, rgba(0, 0, 0, 0.04));\n }\n\n .tasks-data-cell .inline-edit-input {\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n padding: 0 4px;\n margin: 0;\n border: 1px solid var(--inline-edit-border-color, #87B7FE);\n border-radius: 3px;\n background: var(--inline-edit-bg, #FFFFFF);\n color: var(--text-color, #000);\n font-family: inherit;\n font-size: inherit;\n font-weight: inherit;\n outline: none;\n text-align: inherit;\n }\n\n .tasks-data-cell .inline-edit-input:focus {\n box-shadow: 0 0 0 2px var(--inline-edit-focus-ring, rgba(49, 140, 231, 0.25));\n }\n\n /* Shadow DOM specific */\n :host .tasks-container {\n display: flex;\n flex-direction: column;\n height: 100%;\n }\n\n :host .tasks-header {\n position: sticky;\n top: 0;\n z-index: 10;\n }\n",Tn="\n .gantt-container .timeline-container {\n width: 100%;\n height: 100%;\n position: relative;\n background-color: var(--background-color, #FFFFFF);\n display: flex;\n flex-direction: column;\n overflow: visible;\n padding-bottom: 0;\n box-sizing: border-box;\n }\n\n .timeline-container .timeline-header {\n position: sticky;\n top: 0;\n z-index: 100;\n background-color: var(--header-bg-color, #F3F3F3);\n flex-shrink: 0;\n overflow-x: auto;\n overflow-y: hidden;\n width: 100%;\n scrollbar-width: none; \n -ms-overflow-style: none; \n }\n\n .timeline-container .timeline-header::-webkit-scrollbar {\n display: none;\n height: 0;\n width: 0;\n }\n\n /* Shadow DOM specific */\n :host .timeline-container .timeline-header {\n scrollbar-width: none !important;\n -ms-overflow-style: none !important;\n }\n\n :host .timeline-container .timeline-header::-webkit-scrollbar {\n display: none !important;\n height: 0 !important;\n width: 0 !important;\n }\n\n .timeline-container .timeline-header > .timeline-header-row {\n width: max-content;\n position: relative;\n }\n\n .timeline-container .timeline-body-wrapper {\n flex: 1;\n overflow-x: auto;\n overflow-y: hidden;\n position: relative;\n width: 100%;\n min-height: 0;\n scrollbar-width: none;\n -ms-overflow-style: none;\n padding-bottom: 0; \n margin-bottom: 0;\n }\n\n .timeline-body-wrapper .timeline-horizontal-scroll, .timeline-container .timeline-body-wrapper::-webkit-scrollbar {\n display: none;\n height: 0;\n width: 0;\n }\n\n /* shadow DOM specific */\n :host .timeline-container .timeline-body-wrapper {\n scrollbar-width: none !important;\n -ms-overflow-style: none !important;\n }\n\n :host .timeline-container .timeline-body-wrapper::-webkit-scrollbar {\n display: none !important;\n height: 0 !important;\n width: 0 !important;\n }\n\n\n .timeline-horizontal-scroll {\n position: absolute;\n bottom: 0;\n height: 17px;\n overflow-x: auto;\n overflow-y: hidden;\n z-index: 300;\n background-color: var(--split-bar-color, var(--background-color, #FFFFFF));\n border-top: 1px solid var(--border-color, #DFE0E1);\n box-sizing: border-box;\n display: block;\n visibility: visible;\n opacity: 1;\n pointer-events: auto;\n }\n\n .timeline-horizontal-scroll-content {\n height: 1px;\n width: max-content;\n }\n\n .timeline-container .annotation,\n .timeline-container .annotation-container {\n position: absolute;\n top: 0;\n left: 0;\n pointer-events: none;\n }\n\n .timeline-container .annotation-container > * {\n pointer-events: auto;\n }\n\n .timeline-container .bar-container {\n position: absolute;\n top: 0;\n left: 0;\n pointer-events: none;\n }\n\n .timeline-container .bar-container > * {\n pointer-events: auto;\n }\n\n /* Row is the positioning context for the off-screen scroll chevrons. */\n .timeline-container .timeline-data-row {\n position: relative;\n }\n\n /* Per-row chevrons that jump to a task whose bar is off-screen. Absolutely\n positioned inside the row; their left offset is set to the viewport edge on\n each horizontal scroll so they track the visible window without extending\n the row's max-content width. */\n .timeline-container .gantt-scroll-btn {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n display: none;\n z-index: 7;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n cursor: pointer;\n font-size: 15px;\n line-height: 1;\n color: #fff;\n background: var(--split-bar-hover-color, #007BFF);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);\n opacity: 0.85;\n user-select: none;\n pointer-events: auto;\n }\n\n .timeline-container .gantt-scroll-btn:hover {\n opacity: 1;\n }\n\n /* Crosshair cursor + preview bar while drawing a new task on the timeline. */\n .timeline-container .timeline-body.gantt-drawing {\n cursor: crosshair;\n }\n\n .timeline-container .gantt-draw-task-preview {\n position: absolute;\n z-index: 6;\n pointer-events: none;\n box-sizing: border-box;\n border-radius: var(--bar-border-radius, 4px);\n background: var(--split-bar-hover-color, #007BFF);\n opacity: 0.35;\n border: 1px dashed var(--split-bar-hover-border-color, #0056B3);\n }\n\n .timeline-container .gantt-crosshair {\n position: absolute;\n top: 0;\n bottom: 0;\n width: 1px;\n z-index: 200;\n pointer-events: none;\n transform: translateX(-0.5px);\n }\n\n .timeline-container .gantt-crosshair-label {\n position: absolute;\n top: 50%;\n transform: translate(-50%, -50%);\n z-index: 201;\n color: #FFFFFF;\n font-size: 12px;\n font-weight: 500;\n line-height: 1;\n padding: 4px 8px;\n border-radius: 4px;\n white-space: nowrap;\n pointer-events: none;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);\n }\n\n .timeline-container .bar-timeline {\n position: absolute;\n cursor: default;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n .timeline-container .bar-timeline.bar-interactive {\n cursor: move;\n cursor: grab;\n /* Suppress browser pan/zoom so a touch-drag keeps the pointer stream\n (otherwise the gesture is stolen and pointercancel fires). */\n touch-action: none;\n }\n\n .timeline-container .bar-timeline .bar-handle {\n height: 100%;\n width: 5px;\n position: absolute;\n z-index: 1000;\n background: transparent;\n touch-action: none;\n }\n\n .timeline-container .bar-timeline .bar-handle:hover {\n cursor: col-resize;\n }\n\n .resizing {\n pointer-events: none;\n opacity: 0.8;\n }\n\n .timeline-container .bar-timeline .bar-handle.handle-left {\n left: -5px;\n }\n\n .timeline-container .bar-timeline .bar-handle.handle-right {\n right: -5px;\n }\n\n .timeline-container .bar-timeline.dragging {\n cursor: grabbing;\n }\n\n .timeline-container .bar-baseline {\n position: absolute;\n z-index: 1;\n }\n\n .timeline-container .bar-timeline.bar-summary {\n cursor: default;\n background: var(--summary-bar-color);\n height: 8px !important;\n border-radius: 0 !important;\n overflow: visible;\n align-items: flex-start;\n }\n\n .timeline-container .bar-timeline.bar-summary::before,\n .timeline-container .bar-timeline.bar-summary::after {\n content: '';\n position: absolute;\n top: 2px;\n width: 0;\n height: 0;\n border-left: 6px solid transparent;\n border-right: 6px solid transparent;\n pointer-events: none;\n }\n\n .timeline-container .bar-timeline.bar-summary::before {\n left: -1px;\n border-top: 10px solid var(--summary-cap-left-color, var(--summary-bar-color));\n transform: rotate(270deg);\n }\n\n .timeline-container .bar-timeline.bar-summary::after {\n right: -1px;\n border-top: 10px solid var(--summary-cap-right-color, var(--summary-bar-color));\n transform: rotate(90deg);\n }\n\n .timeline-container .bar-timeline.bar-critical {\n background-color: var(--critical-bar-color, #e53935) !important;\n }\n\n .timeline-container .bar-timeline.bar-critical .bar-timeline-progress {\n background-color: color-mix(in srgb, var(--critical-bar-color, #e53935) 70%, white) !important;\n }\n\n svg path.critical-arrow {\n stroke: var(--critical-arrow-color, #e53935) !important;\n stroke-width: 2.5 !important;\n }\n\n /* Interactive dependency editing (dependencies.editable: true).\n The visible path gets state-driven styling; the hit-area sibling carries\n a pointer cursor + focus ring. */\n svg path[data-arrow-state='hover']:not([data-arrow-hit]) {\n stroke: var(--dep-arrow-hover-color, #475569);\n filter: drop-shadow(0 0 3px var(--dep-arrow-hover-shadow-color, rgba(15, 23, 42, 0.35)));\n stroke-width: 2;\n }\n\n svg path[data-arrow-state='selected']:not([data-arrow-hit]) {\n stroke: var(--dep-arrow-selected-color, #dc2626) !important;\n stroke-width: 2.5;\n }\n\n svg path[data-arrow-hit] {\n cursor: pointer;\n outline: none;\n }\n\n svg path[data-arrow-hit]:focus-visible {\n stroke: var(--dep-arrow-focus-color, rgba(37, 99, 235, 0.35));\n }\n\n /* The \"✕\" affordance rendered next to the arrowhead while the edge is selected. */\n svg g[data-arrow-remove] {\n cursor: pointer;\n }\n\n svg g[data-arrow-remove] circle {\n fill: var(--dep-arrow-selected-color, #dc2626);\n }\n\n svg g[data-arrow-remove] path {\n stroke: #fff;\n stroke-width: 1.5;\n stroke-linecap: round;\n fill: none;\n }\n\n svg g[data-arrow-remove]:hover circle {\n fill: color-mix(in srgb, var(--dep-arrow-selected-color, #dc2626) 80%, black);\n }\n\n .bar-timeline .bar-timeline-progress {\n position: absolute;\n pointer-events: none;\n height: 100%;\n left: 0;\n }\n\n /* RTL bars fill from the right (their start edge under a right-to-left time axis). */\n .bar-timeline.bar-rtl .bar-timeline-progress {\n left: auto;\n right: 0;\n }\n\n /* Split task: the envelope becomes transparent so the gaps show through; the\n worked spans are painted by .bar-segment children with a connector between. */\n .bar-timeline.bar-split {\n background-color: transparent !important;\n }\n\n .bar-timeline.bar-split .bar-split-connector {\n position: absolute;\n left: 0;\n top: 50%;\n height: 2px;\n transform: translateY(-50%);\n background-color: var(--split-connector-color, rgba(0, 0, 0, 0.25));\n pointer-events: none;\n z-index: 0;\n }\n\n .bar-timeline.bar-split .bar-segment {\n position: absolute;\n top: 0;\n height: 100%;\n z-index: 1;\n overflow: hidden;\n }\n\n .bar-timeline.bar-split .bar-segment .bar-segment-progress {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n pointer-events: none;\n }\n\n .bar-timeline.bar-split.bar-rtl .bar-segment .bar-segment-progress {\n left: auto;\n right: 0;\n }\n\n /* Dependency-draw anchor handles. Two solid circles straddle each bar's\n start/finish edges; hidden by default, fade in when the bar is hovered or\n while a drag is in progress. CSS owns visibility — DependencyDrawManager\n only sets a .bar-dep-anchor--drawing class on the source anchor so it\n stays visible until pointerup. */\n .timeline-container .bar-timeline .bar-dep-anchor {\n position: absolute;\n top: 50%;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n background: var(--dep-anchor-color, #2563eb);\n border: 2px solid #fff;\n box-sizing: content-box;\n opacity: 0;\n pointer-events: none;\n touch-action: none;\n transition:\n opacity 120ms ease,\n background-color 100ms ease,\n transform 100ms ease;\n z-index: 5;\n box-shadow: 0 1px 2px rgba(15, 23, 42, 0.25);\n }\n\n /* Anchors sit fully outside the bar's resize-handle zone (5px wide on each\n edge with z-index 1000), so the resize handle keeps its mousedown\n territory and the anchors keep theirs. Drag from the bar's interior →\n resize; drag from the circle → draw dependency. */\n .timeline-container .bar-timeline .bar-dep-anchor-start {\n left: -15px;\n transform: translate(0, -50%);\n }\n\n .timeline-container .bar-timeline .bar-dep-anchor-end {\n right: -15px;\n transform: translate(0, -50%);\n }\n\n .timeline-container .bar-timeline:hover .bar-dep-anchor,\n .timeline-container .bar-timeline .bar-dep-anchor.bar-dep-anchor--drawing {\n opacity: 1;\n pointer-events: auto;\n cursor: crosshair;\n }\n\n .timeline-container .bar-timeline .bar-dep-anchor:hover,\n .timeline-container .bar-timeline .bar-dep-anchor.bar-dep-anchor--drawing {\n background: var(--dep-anchor-hover-color, #1d4ed8);\n }\n\n /* Coarse pointers (touch / pen) — bump the anchor target size so it's\n reachable with a fingertip, and push it further out so it doesn't\n overlap the (also touch-sized) resize handle. The visual circle stays\n the same shape, just larger. */\n @media (pointer: coarse) {\n .timeline-container .bar-timeline .bar-dep-anchor {\n width: 18px;\n height: 18px;\n }\n .timeline-container .bar-timeline .bar-dep-anchor-start {\n left: -20px;\n }\n .timeline-container .bar-timeline .bar-dep-anchor-end {\n right: -20px;\n }\n /* Touch devices have no hover state — keep anchors visible so users can\n discover and grab them without needing to dwell on the bar. */\n .timeline-container .bar-timeline .bar-dep-anchor {\n opacity: 0.65;\n pointer-events: auto;\n }\n .timeline-container .bar-timeline .bar-dep-anchor.bar-dep-anchor--drawing {\n opacity: 1;\n }\n }\n\n /* Respect users who set prefers-reduced-motion: drop the anchor fade so\n they snap in/out rather than animating. The drag-preview path itself has\n no transitions so nothing more is needed there. */\n @media (prefers-reduced-motion: reduce) {\n .timeline-container .bar-timeline .bar-dep-anchor {\n transition: none;\n }\n }\n\n /* While dragging, hide anchors on the source bar's siblings (and on the\n source bar itself, since the dragging one carries --drawing).\n They re-appear when the target bar is hovered, which is handled by the\n standard :hover rule above. */\n\n /* Drop-target highlight on the destination bar while drawing. */\n .timeline-container .bar-timeline.bar-dep-drop-target {\n outline: 2px solid var(--dep-anchor-color, #2563eb);\n outline-offset: 1px;\n }\n\n .timeline-container .bar-timeline.bar-dep-drop-invalid {\n outline-color: var(--dep-arrow-selected-color, #dc2626);\n }\n\n /* Dashed preview path follows the cursor between source anchor and target. */\n svg path[data-edge-preview] {\n fill: none;\n stroke: var(--dep-anchor-color, #2563eb);\n stroke-width: 1.5;\n stroke-dasharray: 6 4;\n pointer-events: none;\n }\n\n svg path[data-edge-preview][data-preview-state='invalid'] {\n stroke: var(--dep-arrow-selected-color, #dc2626);\n }\n\n /* Tiny floating label that previews the dependency type during a drag. */\n .timeline-container .bar-dep-type-label {\n position: absolute;\n pointer-events: none;\n background: var(--dep-anchor-color, #2563eb);\n color: #fff;\n font-size: 10px;\n font-weight: 600;\n padding: 2px 6px;\n border-radius: 4px;\n transform: translate(8px, -50%);\n z-index: 1100;\n white-space: nowrap;\n box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);\n }\n\n .timeline-container .bar-dep-type-label[data-preview-state='invalid'] {\n background: var(--dep-arrow-selected-color, #dc2626);\n }\n\n /* Progress drag handle — small upward wedge anchored at the bottom edge of\n the bar, horizontally aligned to the right edge of the progress fill via\n left: <progress>%. Hidden by default, fades in on bar hover. */\n .timeline-container .bar-timeline .bar-progress-handle {\n position: absolute;\n bottom: -1px;\n width: 12px;\n height: 8px;\n transform: translateX(-50%);\n cursor: ew-resize;\n z-index: 4;\n pointer-events: auto;\n touch-action: none;\n opacity: 0;\n transition: opacity 120ms ease-in;\n /* Upward-pointing wedge built with a clip-path triangle. White fill with a\n subtle outline so it reads against any bar color. */\n background-color: #FFFFFF;\n clip-path: polygon(50% 0, 100% 100%, 0 100%);\n filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));\n }\n\n .timeline-container .bar-timeline:hover .bar-progress-handle,\n .timeline-container .bar-timeline .bar-progress-handle.dragging,\n .timeline-container .bar-timeline.progress-dragging .bar-progress-handle {\n opacity: 1;\n }\n\n /* While dragging the progress, suppress the bar's grab cursor so users see\n the resize affordance the whole time. */\n .timeline-container .bar-timeline.progress-dragging,\n .timeline-container .bar-timeline.progress-dragging.bar-interactive {\n cursor: ew-resize;\n }\n\n /* Live percent label that surfaces under the wedge while the user drags.\n Anchored to the same left percentage as the handle so it tracks the\n pointer in lockstep. Hidden by default; opacity-toggled when the bar\n gains the .progress-dragging class. */\n .timeline-container .bar-timeline .bar-progress-handle-label {\n position: absolute;\n bottom: -22px;\n transform: translateX(-50%);\n padding: 2px 6px;\n border-radius: 3px;\n background-color: rgba(0, 0, 0, 0.75);\n color: #FFFFFF;\n font-size: 11px;\n font-weight: 500;\n line-height: 1;\n white-space: nowrap;\n pointer-events: none;\n opacity: 0;\n transition: opacity 100ms ease-in;\n z-index: 5;\n }\n\n .timeline-container .bar-timeline.progress-dragging .bar-progress-handle-label {\n opacity: 1;\n }\n\n .bar-timeline .bar-label {\n white-space: nowrap;\n pointer-events: none;\n overflow: hidden;\n z-index: 2;\n }\n\n /* Outside-positioned labels: anchored to the bar's edge, vertically centred,\n allowed to overflow the bar so narrow tasks aren't truncated. */\n .bar-timeline .bar-label.bar-label-outside {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n overflow: visible;\n color: var(--text-color, #000);\n line-height: 1;\n z-index: 3;\n }\n\n .bar-timeline .bar-label.bar-label-outside-right {\n left: 100%;\n padding-left: 8px;\n text-align: left;\n }\n\n .bar-timeline .bar-label.bar-label-outside-left {\n right: 100%;\n padding-right: 8px;\n text-align: right;\n }\n\n .timeline-container .timeline-body {\n width: max-content;\n position: relative;\n padding-bottom: 17px;\n }\n \n .timeline-container .timeline-header-row,\n .timeline-container .timeline-data-row {\n display: flex;\n /* Shrink-to-content so the row width is deterministic (sum of pseudo +\n cells), matching what the horizontal scrollbar measures. Without this,\n data rows can fill the parent's max-content slot and end up wider than\n their cells, leaving stale grid space at the far right. */\n width: max-content;\n }\n\n .timeline-container .timeline-header-cell,\n .timeline-container .timeline-data-cell {\n padding: 0 10px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: flex;\n align-items: center;\n justify-content: center;\n /* Only bottom + right are drawn so each grid line is painted exactly\n once (adjacent borders don't double up). Borders stay inside the\n cell's rowHeight allocation via the global box-sizing: border-box\n (see Gantt.style.ts), keeping height math identical to the prior\n four-border setup — rows still occupy exactly rowHeight, so the\n timeline stays vertically aligned with the tasks pane.\n --column-line-color on the vertical so columnLines:false collapses\n verticals to transparent without affecting horizontal dividers. */\n border-bottom: var(--cell-border-width, 1px) solid var(--cell-border-color, #eff0f0);\n border-right: var(--cell-border-width, 1px) solid var(--column-line-color, var(--cell-border-color, #eff0f0));\n color: var(--text-color, #000);\n }\n\n /* Anchor the very top edge of the grid — the cell rule above only paints\n bottom + right. Border stays inside the cell's rowHeight allocation\n (border-box), so it doesn't shift the body downward. */\n .timeline-container .timeline-header > .timeline-header-row:first-child .timeline-header-cell {\n border-top: var(--cell-border-width, 1px) solid var(--cell-border-color, #eff0f0);\n }\n\n /* Header/body divider: the bottom-most header tier uses the stronger\n structural border so the white header reads as a distinct band, while\n inter-tier and internal grid lines stay whisper-faint. */\n .timeline-container .timeline-header > .timeline-header-row:last-child .timeline-header-cell {\n border-bottom: var(--cell-border-width, 1px) solid var(--border-color, #E5E7EB);\n }\n\n /* Drop the trailing edge so the grid has no outer right border (mirrors\n the tasks pane). */\n .timeline-container .timeline-header-row .timeline-header-cell:last-child,\n .timeline-container .timeline-data-row .timeline-data-cell:last-child {\n border-right: none;\n }\n\n .timeline-container .timeline-header-cell {\n background-color: var(--header-bg-color, #F3F3F3);\n color: var(--header-text-color, #333);\n }\n\n /* ── Working-calendar non-working-day stripes ───────────────────────── */\n /* Layer is a child of .timeline-body and fills it; stripes inside are\n absolutely-positioned per non-working day. Stripes sit behind rows\n because they appear earlier in DOM order with no positive z-index. */\n .timeline-container .timeline-stripes-layer {\n position: absolute;\n inset: 0;\n pointer-events: none;\n }\n\n .timeline-container .timeline-stripes-layer .apexgantt-day {\n position: absolute;\n top: 0;\n bottom: 0;\n box-sizing: border-box;\n pointer-events: none;\n }\n\n .timeline-container .timeline-stripes-layer .apexgantt-day--weekend {\n background-color: var(--apexgantt-non-working-bg, rgba(15, 23, 42, 0.035));\n }\n\n .timeline-container .timeline-stripes-layer .apexgantt-day--holiday {\n background-color: var(--apexgantt-holiday-bg, rgba(244, 63, 94, 0.08));\n pointer-events: auto;\n cursor: help;\n }\n",An="\n .apexgantt-tooltip {\n position: absolute;\n z-index: 1000;\n pointer-events: none;\n opacity: 0;\n visibility: hidden;\n transition: opacity 0.12s ease-out, transform 0.12s ease-out;\n transform: translateY(2px);\n font-family: inherit;\n font-size: 12px;\n line-height: 1.45;\n display: none;\n max-width: 320px;\n box-sizing: border-box;\n /* Soft shadow draws the outline of the combined body+arrow shape.\n Filter (rather than box-shadow on individual children) follows the\n silhouette of the rotated arrow, so the shadow wraps around the\n diamond corner with no visible seam at the body-arrow junction. */\n filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.14)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));\n }\n\n .apexgantt-tooltip.visible {\n display: block;\n opacity: 1;\n visibility: visible;\n transform: translateY(0);\n }\n\n :host .apexgantt-tooltip {\n position: absolute;\n z-index: 1000;\n pointer-events: none;\n opacity: 0;\n visibility: hidden;\n transition: opacity 0.12s ease-out, transform 0.12s ease-out;\n transform: translateY(2px);\n font-family: inherit;\n font-size: 12px;\n line-height: 1.45;\n display: none;\n max-width: 320px;\n box-sizing: border-box;\n filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.14)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));\n }\n\n :host .apexgantt-tooltip.visible {\n display: block;\n opacity: 1;\n visibility: visible;\n transform: translateY(0);\n }\n\n .apexgantt-tooltip .tooltip-content {\n padding: 8px 10px;\n border-radius: 6px;\n background-color: var(--apexgantt-tooltip-bg, #ffffff);\n word-wrap: break-word;\n overflow-wrap: break-word;\n box-sizing: border-box;\n /* In front of the arrow so the half of the rotated square that sits\n inside the body is masked, leaving only the diamond corner\n protruding. No border here — the shape is outlined by the parent's\n drop-shadow filter, which traces the body+arrow silhouette as one. */\n position: relative;\n z-index: 2;\n }\n\n .apexgantt-tooltip .tooltip-content > div {\n margin: 2px 0;\n word-break: break-word;\n line-height: 1.45;\n }\n\n .apexgantt-tooltip .tooltip-content strong {\n font-weight: 600;\n margin-right: 6px;\n opacity: 0.7;\n }\n\n .apexgantt-tooltip .tooltip-content span {\n display: inline;\n }\n\n /* Title separator only applies when the template renders sibling rows\n (title + body). If the template has a single wrapper div, the border\n would otherwise float at the bottom of the tooltip. */\n .apexgantt-tooltip .tooltip-content > div:first-child:not(:last-child) {\n margin-top: 0;\n margin-bottom: 6px;\n padding-bottom: 6px;\n border-bottom: 1px solid rgba(0, 0, 0, 0.08);\n font-weight: 600;\n font-size: 13px;\n }\n\n .apexgantt-tooltip .tooltip-content > div:first-child:not(:last-child) strong {\n font-weight: 600;\n opacity: 1;\n }\n\n .apexgantt-tooltip .tooltip-content > div:last-child {\n margin-bottom: 0;\n }\n\n /* Arrow rendered as a 10×10 bg-colored square rotated 45°. Center sits\n exactly on the body's bottom (or top) edge so the diamond's left and\n right corners meet the body edge without sub-pixel offset. No border\n of its own — the parent's drop-shadow handles the outline. */\n .apexgantt-tooltip .tooltip-arrow {\n position: absolute;\n width: 10px;\n height: 10px;\n background-color: var(--apexgantt-tooltip-bg, #ffffff);\n transform: rotate(45deg);\n z-index: 1;\n pointer-events: none;\n }\n\n .apexgantt-tooltip .tooltip-arrow.arrow-below {\n /* tooltip above the bar — visible corner points down */\n bottom: -5px;\n }\n\n .apexgantt-tooltip .tooltip-arrow.arrow-above {\n /* tooltip below the bar — visible corner points up */\n top: -5px;\n }\n";class Dn{constructor(t,e,n,i,r,s){this.element=t,this.domCache=e,this.options=n,this.chartContext=i,this.isShadowDOM=r,this.instanceId=s,this.stylesInjected=!1}setupShadowDOMEnvironment(){if(!this.isShadowDOM)return;const t=this.chartContext.getContext().host;t&&(t.style.display="block",t.style.boxSizing="border-box",t.style.contain="layout style"),this.element&&(this.element.style.display="block",this.element.style.boxSizing="border-box")}injectGanttStyles(){if(!this.stylesInjected)if(this.isShadowDOM)this.injectStylesDirectly();else try{const t=[{content:Cn,id:"gantt-core-styles",options:{priority:"high"}},{content:Tn,id:"gantt-timeline-styles"},{content:En,id:"gantt-table-styles"},{content:wn,id:"gantt-dialog-styles"},{content:Mn,id:"gantt-taskform-styles"},{content:An,id:"gantt-tooltip-styles"},{content:i,id:"gantt-toolbar-styles"},{content:kn,id:"gantt-dropdown-styles"},{content:xn,id:"gantt-context-menu-styles"},{content:Sn,id:"gantt-scrollbar-styles"}];this.chartContext.injectStylesheets(t),this.stylesInjected=!0}catch(t){z.error("injectGanttStyles: ChartContext injection failed",t)}}injectStylesDirectly(){const t=this.chartContext.getContext();if(t.querySelector("#gantt-all-styles"))return void(this.stylesInjected=!0);const e=document.createElement("style");e.id="gantt-all-styles",e.textContent=`\n /* Shadow DOM CSS Reset - Critical for proper layout */\n :host {\n all: initial;\n display: block;\n contain: layout style;\n }\n\n *, *::before, *::after {\n box-sizing: border-box;\n }\n\n div, table, thead, tbody, tr, td, th {\n display: revert;\n margin: 0;\n padding: 0;\n border: 0;\n }\n\n .split-view-container,\n .gantt-container {\n display: flex !important;\n width: 100% !important;\n height: 100% !important;\n }\n\n .split-left-container,\n .split-right-container {\n display: block !important;\n }\n\n .timeline-container {\n flex: 1 !important;\n overflow: auto !important;\n position: relative !important;\n }\n\n .tasks-container {\n flex-shrink: 0 !important;\n overflow: auto !important;\n }\n\n ${Cn}\n ${Tn}\n ${En}\n ${wn}\n ${Mn}\n ${An}\n ${i}\n ${kn}\n ${xn}\n ${Sn}\n `,t.insertBefore(e,t.firstChild),this.stylesInjected=!0}setCSSVariables(){["--apex-gantt-bar-fill","--apex-gantt-background-color","--apex-gantt-row-bg-even","--apex-gantt-row-bg-odd","--apex-gantt-header-bg","--apex-gantt-grid-line","--apex-gantt-dependency-line","--apex-gantt-font-family","--apex-gantt-font-size","--apex-gantt-font-color"].forEach((t=>this.element.style.removeProperty(t)));const t=He(this.element),e=t.gridLine||this.options.cellBorderColor,n=this.options.cellBorderWidth,i=t.fontColor||this.options.fontColor,r=t.headerBg||this.options.headerBackground,{tooltipBGColor:s,tooltipBorderColor:o,borderColor:a,barTextColor:l}=this.options,d=t.bgColor||this.options.backgroundColor,c=t.barFill||this.options.barBackgroundColor,u=t.dependencyLine||this.options.arrowColor,p=[...this.options.rowBackgroundColors??[]];t.rowBgEven&&(p[0]=t.rowBgEven),t.rowBgOdd&&(p[1]=t.rowBgOdd),this.element.style.setProperty("--apex-gantt-row-bg-even",p[0]??""),this.element.style.setProperty("--apex-gantt-row-bg-odd",p[1]??p[0]??""),this.element.style.setProperty("--cell-border-color",e),this.element.style.setProperty("--cell-border-width",n),this.element.style.setProperty("--column-line-color",!1===this.options.columnLines?"transparent":e),this.element.style.setProperty("--gantt-font-color",i),this.element.style.setProperty("--text-color",i),this.element.style.setProperty("--header-bg-color",r),this.element.style.setProperty("--header-text-color",i),this.element.style.setProperty("--tooltip-bg-color",s),this.element.style.setProperty("--tooltip-border-color",o),this.element.style.setProperty("--tooltip-text-color",i),this.element.style.setProperty("--background-color",d),this.element.style.setProperty("--border-color",a),this.element.style.setProperty("--dialog-bg-color",d),this.element.style.setProperty("--dialog-border-color",a),this.element.style.setProperty("--button-bg-color",c),this.element.style.setProperty("--button-text-color",l),this.element.style.setProperty("--button-hover-bg-color",u),this.element.style.setProperty("--toolbar-bg-color",d),this.element.style.setProperty("--toolbar-border-color",a),this.element.style.setProperty("--toolbar-hover-bg-color",e),this.element.style.setProperty("--scrollbar-track-color",d),this.element.style.setProperty("--scrollbar-thumb-color",a),this.element.style.setProperty("--scrollbar-thumb-hover-color",e),this.element.style.setProperty("--split-bar-color",e),this.element.style.setProperty("--split-bar-hover-color",u),this.element.style.setProperty("--split-bar-border-color",a),this.element.style.setProperty("--split-bar-handle-color",i),this.element.style.setProperty("--split-bar-hover-border-color",u),this.element.style.setProperty("--critical-bar-color",this.options.criticalBarColor),this.element.style.setProperty("--critical-arrow-color",this.options.criticalArrowColor),this.element.style.setProperty("--summary-bar-color",this.options.summaryBarColor),this.element.style.setProperty("--milestone-color",this.options.milestoneColor);const m=this.isColorDark(d);m?this.element.style.setProperty("--toolbar-icon-filter","invert(1) brightness(2)"):this.element.style.setProperty("--toolbar-icon-filter","none"),this.element.style.setProperty("--header-hover-bg-color",h(r,{l:m?6:-5}))}handleWatermark(){const t=this.domCache.ganttContainer;if(!t)return;const e=t.parentNode;e&&(y.isLicenseValid()?w.remove(e):w.add(e))}isColorDark(t){const e=t.replace("#","");return(.299*parseInt(e.substring(0,2),16)+.587*parseInt(e.substring(2,4),16)+.114*parseInt(e.substring(4,6),16))/255<.5}cleanupScrollbarStyles(){try{this.chartContext.getInjectedStyleIds().filter((t=>t.startsWith(`scrollbar-${this.instanceId}`))).forEach((t=>this.chartContext.removeStyles(t)));const t=this.domCache.horizontalScroll;if(t){const e=t.style.width,n=t.style.left,i=t.style.bottom;t.removeAttribute("style"),e&&(t.style.width=e),n&&(t.style.left=n),i&&(t.style.bottom=i)}}catch(t){z.warn("Error cleaning up scrollbar styles:",t)}}updateOptions(t){this.options=t}resetStylesInjected(){this.stylesInjected=!1}areStylesInjected(){return this.stylesInjected}}const In="data-taskid",$n="aria-level";class Fn{constructor(t,e,n,i,r,s){this.chartContext=t,this.dataManager=e,this.getTaskContainer=n,this.reRender=i,this.selectionManager=r,this.editingCommands=s,this.keydownHandler=null}attach(){this.detach();const t=this.getTaskContainer();t&&(this.initRovingTabindex(t),this.keydownHandler=e=>this.handleKeydown(e,t),t.addEventListener("keydown",this.keydownHandler))}detach(){const t=this.getTaskContainer();t&&this.keydownHandler&&t.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null}initRovingTabindex(t){this.getVisibleRows(t).forEach(((t,e)=>{t.setAttribute("tabindex",0===e?"0":"-1")}))}getVisibleRows(t){return Array.from(t.querySelectorAll(`${sn.tasksDataRow}:not(${sn.tasksEmptyRow}):not(.tasks-add-row)`))}moveFocusToRow(t,e){this.getVisibleRows(e).forEach((t=>t.setAttribute("tabindex","-1"))),t.setAttribute("tabindex","0"),t.focus()}handleKeydown(t,e){var n;const i=this.getVisibleRows(e);if(0===i.length)return;const r=this.chartContext.getActiveElement(),s=r?i.indexOf(r):-1;switch(t.key){case"ArrowDown":{t.preventDefault();const n=i[Math.min(s+1,i.length-1)];n&&this.moveFocusToRow(n,e);break}case"ArrowUp":{t.preventDefault();const n=i[Math.max(s-1,0)];n&&this.moveFocusToRow(n,e);break}case"ArrowRight":{if(t.preventDefault(),s<0||!r)break;const n=r.getAttribute(In);if(!n)break;const o=r.getAttribute("aria-expanded");if("false"===o)this.dataManager.toggleTask(n),this.reRender();else if("true"===o){const t=parseInt(r.getAttribute($n)||"1",10),n=i[s+1];if(n){parseInt(n.getAttribute($n)||"1",10)>t&&this.moveFocusToRow(n,e)}}break}case"ArrowLeft":{if(t.preventDefault(),s<0||!r)break;const n=r.getAttribute(In);if(!n)break;if("true"===r.getAttribute("aria-expanded"))this.dataManager.toggleTask(n),this.reRender();else{const t=parseInt(r.getAttribute($n)||"1",10);if(t<=1)break;for(let n=s-1;n>=0;n--){const r=i[n];if(parseInt(r.getAttribute($n)||"1",10)<t){this.moveFocusToRow(r,e);break}}}break}case"Home":{t.preventDefault();const n=i[0];n&&this.moveFocusToRow(n,e);break}case"End":{t.preventDefault();const n=i[i.length-1];n&&this.moveFocusToRow(n,e);break}case" ":{if(t.preventDefault(),!r)break;const e=r.getAttribute(In)?r:r.closest(`[${In}]`),n=(null==e?void 0:e.getAttribute(In))??null;if(!n)break;if(this.selectionManager)t.shiftKey?this.selectionManager.handleClick(n,{ctrlKey:!1,metaKey:!1,shiftKey:!0}):this.selectionManager.toggleTask(n);else{const t=e,n="true"===t.getAttribute("aria-selected");t.setAttribute("aria-selected",n?"false":"true")}break}case"a":if(!t.ctrlKey&&!t.metaKey)break;t.preventDefault(),null==(n=this.selectionManager)||n.selectAll();break;case"Enter":{if(t.preventDefault(),!r)break;const e=r.getAttribute(In);if(!e)break;const n=this.chartContext.querySelector(`[data-taskid="${CSS.escape(e)}"].bar-timeline`);n&&n.dispatchEvent(new MouseEvent("dblclick",{bubbles:!0}));break}case"Escape":this.selectionManager&&this.selectionManager.getSelectedIds().size>0?this.selectionManager.clearSelection():r&&r.blur();break;case"Delete":case"Backspace":{if(!this.editingCommands||!r)break;const e=r.getAttribute(In);if(!e)break;t.preventDefault(),this.editingCommands.delete(e);break}case"Tab":{if(!this.editingCommands||!r)break;const e=r.getAttribute(In);if(!e)break;t.preventDefault(),t.shiftKey?this.editingCommands.outdent(e):this.editingCommands.indent(e);break}}}}class Bn{constructor(t){this.chartContext=t,this.menuEl=null,this.outsideMouseDownHandler=null,this.escHandler=null,this.dismissOnScrollHandler=null}show(t,e,n){this.hide();if(0===n.filter((t=>!("separator"in t))).length)return!1;const i=this.chartContext.createElement("div");i.className="gantt-context-menu",i.setAttribute("role","menu"),n.forEach(((t,e)=>{if(function(t){return!0===t.separator}(t)){if(0===e||e===n.length-1)return;const t=this.chartContext.createElement("div");return t.className="gantt-context-menu-separator",t.setAttribute("role","separator"),void i.append(t)}const r=t,s=this.chartContext.createElement("button");s.className="gantt-context-menu-item",s.type="button",s.setAttribute("role","menuitem"),s.setAttribute("data-menu-id",r.id),s.textContent=r.label,r.disabled?s.disabled=!0:s.addEventListener("click",(t=>{t.stopPropagation(),this.hide(),r.onClick()})),i.append(s)})),document.body.append(i);const r=i.getBoundingClientRect(),s=Math.max(0,Math.min(t,window.innerWidth-r.width-4)),o=Math.max(0,Math.min(e,window.innerHeight-r.height-4));return i.style.left=`${s}px`,i.style.top=`${o}px`,this.outsideMouseDownHandler=t=>{this.menuEl&&!this.menuEl.contains(t.target)&&this.hide()},this.escHandler=t=>{"Escape"===t.key&&(t.stopPropagation(),this.hide())},this.dismissOnScrollHandler=()=>this.hide(),setTimeout((()=>{this.outsideMouseDownHandler&&document.addEventListener("mousedown",this.outsideMouseDownHandler)}),0),document.addEventListener("keydown",this.escHandler),window.addEventListener("scroll",this.dismissOnScrollHandler,!0),window.addEventListener("resize",this.dismissOnScrollHandler),this.menuEl=i,!0}hide(){this.menuEl&&(this.menuEl.remove(),this.menuEl=null),this.outsideMouseDownHandler&&(document.removeEventListener("mousedown",this.outsideMouseDownHandler),this.outsideMouseDownHandler=null),this.escHandler&&(document.removeEventListener("keydown",this.escHandler),this.escHandler=null),this.dismissOnScrollHandler&&(window.removeEventListener("scroll",this.dismissOnScrollHandler,!0),window.removeEventListener("resize",this.dismissOnScrollHandler),this.dismissOnScrollHandler=null)}isOpen(){return null!==this.menuEl}destroy(){this.hide()}}class Ln{constructor(t,e,n){this.chartContext=t,this.dataManager=e,this.getElement=n,this.selectedIds=new Set,this.lastClickedId=null}getSelectedTasks(){return Array.from(this.selectedIds).map((t=>this.dataManager.getTaskById(t))).filter((t=>null!==t))}getSelectedIds(){return new Set(this.selectedIds)}setSelectedTasks(t){const e=new Set(this.selectedIds);this.selectedIds.clear(),t.forEach((t=>{this.dataManager.getTaskById(t)&&this.selectedIds.add(t)})),this.syncDom(),this.emitChange(e)}clearSelection(){if(0===this.selectedIds.size)return;const t=new Set(this.selectedIds);this.selectedIds.clear(),this.lastClickedId=null,this.syncDom(),this.emitChange(t)}toggleTask(t){const e=new Set(this.selectedIds);this.selectedIds.has(t)?this.selectedIds.delete(t):this.selectedIds.add(t),this.lastClickedId=t,this.syncDom(),this.emitChange(e)}handleClick(t,e){const n=new Set(this.selectedIds);e.shiftKey&&this.lastClickedId?this.rangeSelect(this.lastClickedId,t):e.ctrlKey||e.metaKey?(this.selectedIds.has(t)?this.selectedIds.delete(t):this.selectedIds.add(t),this.lastClickedId=t):(this.selectedIds.clear(),this.selectedIds.add(t),this.lastClickedId=t),this.syncDom(),this.emitChange(n)}selectAll(){const t=new Set(this.selectedIds),e=this.dataManager.getFlatVisibleTasks();this.selectedIds.clear(),e.forEach((t=>this.selectedIds.add(t.id))),this.syncDom(),this.emitChange(t)}selectGroup(t){const e=new Set(this.selectedIds),n=this.dataManager.getNestedChildTasks(t,!0);this.selectedIds.add(t),n.forEach((t=>this.selectedIds.add(t.id))),this.syncDom(),this.emitChange(e)}isSelected(t){return this.selectedIds.has(t)}restoreAfterRender(){const t=new Set;this.selectedIds.forEach((e=>{this.dataManager.getTaskById(e)&&t.add(e)})),this.selectedIds=t,this.syncDom()}captureState(){return Array.from(this.selectedIds)}restoreState(t){this.selectedIds=new Set(t)}destroy(){this.selectedIds.clear(),this.lastClickedId=null}rangeSelect(t,e){const n=this.dataManager.getFlatVisibleTasks(),i=n.findIndex((e=>e.id===t)),r=n.findIndex((t=>t.id===e));if(-1===i||-1===r)return;const s=Math.min(i,r),o=Math.max(i,r);for(let t=s;t<=o;t++)this.selectedIds.add(n[t].id)}syncDom(){this.getElement().querySelectorAll(`${sn.tasksDataRow}:not(${sn.tasksEmptyRow})`).forEach((t=>{const e=t.getAttribute("data-taskid");if(!e)return;const n=this.selectedIds.has(e);t.setAttribute("aria-selected",n?"true":"false");const i=t.querySelector(".gantt-selection-checkbox");i&&(i.checked=n)})),this.syncSelectAllCheckbox()}syncSelectAllCheckbox(){const t=this.getElement().querySelector(".gantt-select-all-checkbox");if(!t)return;const e=this.dataManager.getFlatVisibleTasks().length,n=this.selectedIds.size;0===n?(t.checked=!1,t.indeterminate=!1):n>=e?(t.checked=!0,t.indeterminate=!1):(t.checked=!1,t.indeterminate=!0)}emitChange(t){if(this.setsEqual(t,this.selectedIds))return;const e={selectedTasks:this.getSelectedTasks(),selectedIds:Array.from(this.selectedIds),timestamp:Date.now()};this.getElement().dispatchEvent(new CustomEvent(ot.SELECTION_CHANGE,{detail:e,bubbles:!0,cancelable:!1}))}setsEqual(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}}const Rn="http://www.w3.org/2000/svg",Hn="data-from-id",Pn="data-to-id",zn="data-arrow-state",On="data-arrow-remove";class Wn{constructor(t,e){this.chartContext=t,this.onRemove=e,this.hovered=null,this.selected=null,this.svg=null,this.rootElement=null,this.mouseOverHandler=null,this.mouseOutHandler=null,this.clickHandler=null,this.rootClickHandler=null,this.keyHandler=null}attach(t,e){if(this.detach(),!t)return;this.svg=t,this.rootElement=e,this.mouseOverHandler=t=>this.handleMouseOver(t),this.mouseOutHandler=t=>this.handleMouseOut(t),this.clickHandler=t=>this.handleClick(t),this.rootClickHandler=t=>this.handleRootClick(t),this.keyHandler=t=>this.handleKeyDown(t),t.addEventListener("mouseover",this.mouseOverHandler),t.addEventListener("mouseout",this.mouseOutHandler),t.addEventListener("click",this.clickHandler),e.addEventListener("click",this.rootClickHandler,!0),e.addEventListener("keydown",this.keyHandler),this.selected&&!this.findEdgePaths(this.selected)&&(this.selected=null),this.selected&&(this.applyState(this.selected,"selected"),this.renderRemoveButton(this.selected)),this.hovered=null;t.querySelectorAll("path[data-arrow-hit]").forEach((t=>{t.setAttribute("tabindex","0"),t.setAttribute("role","button"),t.setAttribute("aria-label",`Dependency from ${t.getAttribute(Hn)} to ${t.getAttribute(Pn)}`)}))}detach(){this.svg&&this.mouseOverHandler&&this.svg.removeEventListener("mouseover",this.mouseOverHandler),this.svg&&this.mouseOutHandler&&this.svg.removeEventListener("mouseout",this.mouseOutHandler),this.svg&&this.clickHandler&&this.svg.removeEventListener("click",this.clickHandler),this.rootElement&&this.rootClickHandler&&this.rootElement.removeEventListener("click",this.rootClickHandler,!0),this.rootElement&&this.keyHandler&&this.rootElement.removeEventListener("keydown",this.keyHandler),this.mouseOverHandler=null,this.mouseOutHandler=null,this.clickHandler=null,this.rootClickHandler=null,this.keyHandler=null,this.svg=null,this.rootElement=null}clearSelection(){this.selected&&(this.clearState(this.selected),this.removeRemoveButton(),this.selected=null)}getSelected(){return this.selected?{...this.selected}:null}handleMouseOver(t){const e=this.edgeFromEvent(t);e&&(this.selected&&this.selected.fromId===e.fromId&&this.selected.toId===e.toId||this.hovered&&this.hovered.fromId===e.fromId&&this.hovered.toId===e.toId||(this.hovered&&this.clearState(this.hovered),this.hovered=e,this.applyState(e,"hover")))}handleMouseOut(t){var e;const n=this.edgeFromEvent(t);if(!n||!this.hovered)return;if(n.fromId!==this.hovered.fromId||n.toId!==this.hovered.toId)return;const i=t.relatedTarget??null;i&&(null==(e=this.edgeFromElement(i))?void 0:e.fromId)===n.fromId||(this.clearState(n),this.hovered=null)}handleClick(t){const e=t.target;if((null==e?void 0:e.closest(`[${On}]`))&&this.selected){t.stopPropagation();const{fromId:e,toId:n}=this.selected;this.clearSelection();try{this.onRemove(e,n)}catch(t){z.warn(`[${this.chartContext.getInstanceId()}] removeDependency failed:`,t)}return}const n=this.edgeFromEvent(t);n&&(t.stopPropagation(),this.selectEdge(n))}handleRootClick(t){if(!this.selected)return;const e=t.target;e&&(e.closest(`[data-arrow-hit], [${On}]`)||this.clearSelection())}handleKeyDown(t){if("Escape"===t.key)return void(this.selected&&(t.preventDefault(),this.clearSelection()));const e=t.target,n=e?this.edgeFromElement(e):null;if(("Enter"===t.key||" "===t.key)&&n)return t.preventDefault(),void this.selectEdge(n);if("Delete"===t.key||"Backspace"===t.key){const e=n??this.selected;if(!e)return;t.preventDefault(),this.clearSelection();try{this.onRemove(e.fromId,e.toId)}catch(t){z.warn(`[${this.chartContext.getInstanceId()}] removeDependency failed:`,t)}}}selectEdge(t){this.hovered&&(this.clearState(this.hovered),this.hovered=null),this.selected&&(this.clearState(this.selected),this.removeRemoveButton()),this.selected=t,this.applyState(t,"selected"),this.renderRemoveButton(t)}edgeFromEvent(t){return this.edgeFromElement(t.target)}edgeFromElement(t){if(!t)return null;const e=t.closest(`path[${Hn}]`);if(!e)return null;const n=e.getAttribute(Hn),i=e.getAttribute(Pn);return n&&i?{fromId:n,toId:i}:null}findEdgePaths(t){if(!this.svg)return null;const e=this.svg.querySelectorAll(`path[${Hn}="${Nn(t.fromId)}"][${Pn}="${Nn(t.toId)}"]`);return e.length>0?e:null}applyState(t,e){const n=this.findEdgePaths(t);n&&n.forEach((t=>t.setAttribute(zn,e)))}clearState(t){const e=this.findEdgePaths(t);e&&e.forEach((t=>t.removeAttribute(zn)))}renderRemoveButton(t){if(this.removeRemoveButton(),!this.svg)return;const e=this.findEdgePaths(t);if(!e)return;const n=Array.from(e).find((t=>!t.hasAttribute("data-arrow-hit")));if(!n)return;const i=function(t){const e="function"==typeof t.getTotalLength?function(t){try{return t.getTotalLength()}catch{return 0}}(t):0;if(e>0&&"function"==typeof t.getPointAtLength)try{const n=t.getPointAtLength(e),i=t.getPointAtLength(Math.max(0,e-8));return{tip:{x:n.x,y:n.y},prev:{x:i.x,y:i.y}}}catch{}const n=t.getAttribute("d")??"";if(!n)return null;const i=/[ML]\s*(-?\d+(?:\.\d+)?)[ ,](-?\d+(?:\.\d+)?)/g,r=[];let s;for(;null!==(s=i.exec(n));)r.push({x:parseFloat(s[1]),y:parseFloat(s[2])});if(0===r.length)return null;const o=r[r.length-1],a=r.length>=2?r[r.length-2]:o;return{tip:o,prev:a}}(n);if(!i)return;const{tip:r,prev:s}=i,o=s.x>r.x?1:-1,a=r.x+11*o,l=r.y,d=this.chartContext,h=d.createElementNS(Rn,"g");h.setAttribute(On,""),h.setAttribute(Hn,t.fromId),h.setAttribute(Pn,t.toId),h.setAttribute("transform",`translate(${a}, ${l})`),h.setAttribute("role","button"),h.setAttribute("tabindex","0"),h.setAttribute("aria-label",`Remove dependency from ${t.fromId} to ${t.toId}`),h.setAttribute("pointer-events","auto");const c=d.createElementNS(Rn,"circle");c.setAttribute("r",String(7)),c.setAttribute("cx","0"),c.setAttribute("cy","0"),h.appendChild(c);const u=d.createElementNS(Rn,"path");u.setAttribute("d","M -3.5 -3.5 L 3.5 3.5 M 3.5 -3.5 L -3.5 3.5"),u.setAttribute("pointer-events","none"),h.appendChild(u),this.svg.appendChild(h)}removeRemoveButton(){if(!this.svg)return;const t=this.svg.querySelector(`g[${On}]`);t&&t.remove()}}function Nn(t){return"undefined"!=typeof CSS&&"function"==typeof CSS.escape?CSS.escape(t):t.replace(/["\\]/g,"\\$&")}const qn="http://www.w3.org/2000/svg",Yn="bar-dep-anchor--drawing",Un="bar-dep-drop-target",Vn="bar-dep-drop-invalid";class jn{constructor(t,e,n,i,r){this.chartContext=t,this.getRowHeight=e,this.getCornerRadius=n,this.validate=i,this.onCommit=r,this.session=null,this.rootElement=null,this.timelineBody=null,this.scrollContainer=null,this.mouseDownHandler=null,this.mouseMoveHandler=null,this.mouseUpHandler=null,this.keyHandler=null,this.autoScrollRafId=null,this.autoScrollDx=0,this.lastClientEvent=null}attach(t,e,n){this.detach(),e&&(this.rootElement=t,this.timelineBody=e,this.scrollContainer=n??null,this.mouseDownHandler=t=>this.handleMouseDown(t),this.keyHandler=t=>this.handleKeyDown(t),t.addEventListener("pointerdown",this.mouseDownHandler,!0),t.addEventListener("keydown",this.keyHandler))}detach(){this.cancel(),this.rootElement&&this.mouseDownHandler&&this.rootElement.removeEventListener("pointerdown",this.mouseDownHandler,!0),this.rootElement&&this.keyHandler&&this.rootElement.removeEventListener("keydown",this.keyHandler),this.timelineBody=null,this.rootElement=null,this.scrollContainer=null,this.mouseDownHandler=null,this.keyHandler=null}isDrawing(){return null!==this.session}static deriveType(t,e){return"finish"===t&&"start"===e?"FS":"start"===t&&"start"===e?"SS":"finish"===t&&"finish"===e?"FF":"SF"}handleMouseDown(t){if(this.session)return;if(0!==t.button)return;const e=t.target,n=null==e?void 0:e.closest("[data-bar-anchor]");if(!n)return;const i=n.getAttribute("data-taskid"),r=n.getAttribute("data-bar-anchor");if(!i||!r)return;t.preventDefault(),t.stopPropagation();const s=n.parentElement;if(!(s instanceof HTMLElement&&this.timelineBody))return;const o=this.toLocalRect(s),a=this.toLocalRect(n),l=a.width>0||a.height>0?{x:(a.left+a.right)/2,y:(a.top+a.bottom)/2}:{x:"start"===r?o.left:o.right,y:(o.top+o.bottom)/2};n.classList.add(Yn),this.session={sourceTaskId:i,sourceAnchor:r,sourceAnchorEl:n,sourceBarEl:s,sourceAnchorPoint:l,sourceBarRect:o,targetTaskId:null,targetBarEl:null,targetAnchor:null,derivedType:null,verdict:{ok:!0},previewSvg:null,previewPath:null,typeLabel:null},this.ensurePreview(),this.updatePreviewToCursor(t),this.mouseMoveHandler=t=>this.handleMouseMove(t),this.mouseUpHandler=t=>this.handleMouseUp(t),document.addEventListener("pointermove",this.mouseMoveHandler),document.addEventListener("pointerup",this.mouseUpHandler),document.addEventListener("pointercancel",this.mouseUpHandler)}handleMouseMove(t){this.session&&(this.lastClientEvent=t,this.updatePreviewToCursor(t),this.updateAutoScroll(t))}updateAutoScroll(t){if(!this.scrollContainer)return;const e=this.computeAutoScrollVelocity(t);this.autoScrollDx=e,0!==e?this.startAutoScrollLoop():this.stopAutoScrollLoop()}computeAutoScrollVelocity(t){const e=this.scrollContainer;if(!e)return 0;const n=e.getBoundingClientRect(),i=t.clientX-n.left,r=n.right-t.clientX;if(i<40&&e.scrollLeft>0){const t=1-Math.max(0,i)/40;return-Math.round(12*t)}const s=e.scrollWidth-e.clientWidth;if(r<40&&e.scrollLeft<s){const t=1-Math.max(0,r)/40;return Math.round(12*t)}return 0}startAutoScrollLoop(){if(null!==this.autoScrollRafId)return;const t=()=>{if(this.autoScrollRafId=null,!this.session||!this.scrollContainer||0===this.autoScrollDx)return;const e=this.scrollContainer,n=e.scrollLeft;e.scrollLeft=n+this.autoScrollDx,e.scrollLeft!==n?(this.lastClientEvent&&this.updatePreviewToCursor(this.lastClientEvent),this.autoScrollRafId=requestAnimationFrame(t)):this.autoScrollDx=0};this.autoScrollRafId=requestAnimationFrame(t)}stopAutoScrollLoop(){null!==this.autoScrollRafId&&(cancelAnimationFrame(this.autoScrollRafId),this.autoScrollRafId=null)}handleMouseUp(t){if(!this.session)return;const e=this.session,n=e.targetTaskId&&e.derivedType&&e.verdict.ok?{fromId:e.sourceTaskId,toId:e.targetTaskId,type:e.derivedType}:null,i=e.sourceBarEl;if(this.endDrawing(),n){try{this.onCommit(n.fromId,n.toId,n.type)}catch(t){z.warn(`[${this.chartContext.getInstanceId()}] addDependency failed:`,t)}(null==i?void 0:i.isConnected)&&"function"==typeof i.focus&&i.focus({preventScroll:!0})}t.stopPropagation()}handleKeyDown(t){this.session&&"Escape"===t.key&&(t.preventDefault(),this.cancel())}cancel(){this.session&&this.endDrawing()}endDrawing(){var t,e;this.session&&(this.session.sourceAnchorEl.classList.remove(Yn),this.clearDropTargetHighlight(),null==(t=this.session.previewSvg)||t.remove(),null==(e=this.session.typeLabel)||e.remove()),this.session=null,this.stopAutoScrollLoop(),this.autoScrollDx=0,this.lastClientEvent=null,this.mouseMoveHandler&&document.removeEventListener("pointermove",this.mouseMoveHandler),this.mouseUpHandler&&(document.removeEventListener("pointerup",this.mouseUpHandler),document.removeEventListener("pointercancel",this.mouseUpHandler)),this.mouseMoveHandler=null,this.mouseUpHandler=null}updatePreviewToCursor(t){if(!this.session||!this.timelineBody)return;const e=this.session,n=this.findTargetBarUnderCursor(t,e.sourceTaskId);let i;this.clearDropTargetHighlight();let r=null;if(n){const s=this.toLocalRect(n),o=n.getAttribute("data-taskid")??"",a=this.clientToLocal(t).x<(s.left+s.right)/2?"start":"finish",l=jn.deriveType(e.sourceAnchor,a),d=this.validate(e.sourceTaskId,o,l);e.targetTaskId=o,e.targetBarEl=n,e.targetAnchor=a,e.derivedType=l,e.verdict=d,n.classList.add(Un),d.ok||n.classList.add(Vn),i={x:"start"===a?s.left:s.right,y:(s.top+s.bottom)/2},r=s,this.showTypeLabel(s,l,d)}else e.targetTaskId=null,e.targetBarEl=null,e.targetAnchor=null,e.derivedType=null,e.verdict={ok:!0},i=this.clientToLocal(t),this.hideTypeLabel();this.updatePreviewPath(i,r)}findTargetBarUnderCursor(t,e){if("function"!=typeof document.elementsFromPoint)return null;const n=document.elementsFromPoint(t.clientX,t.clientY);for(const t of n){if(!(t instanceof HTMLElement))continue;if(!t.classList.contains("bar-timeline"))continue;const n=t.getAttribute("data-taskid");if(n&&n!==e)return t}return null}toLocalRect(t){const e=this.timelineBody,n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),r=i.left-n.left+e.scrollLeft,s=i.top-n.top+e.scrollTop;return{left:r,right:r+i.width,top:s,bottom:s+i.height,width:i.width,height:i.height}}clientToLocal(t){const e=this.timelineBody,n=e.getBoundingClientRect();return{x:t.clientX-n.left+e.scrollLeft,y:t.clientY-n.top+e.scrollTop}}ensurePreview(){if(!this.session||!this.timelineBody)return;const t=`${this.chartContext.getInstanceId()}-dep-preview`;let e=this.timelineBody.querySelector(`#${n=t,"undefined"!=typeof CSS&&"function"==typeof CSS.escape?CSS.escape(n):n.replace(/["\\]/g,"\\$&")}`);var n;e||(e=this.chartContext.createElementNS(qn,"svg"),e.setAttribute("id",t),e.setAttribute("style","position:absolute;left:0;top:0;pointer-events:none;width:100%;height:100%;overflow:visible;z-index:6;"),this.timelineBody.appendChild(e)),this.session.previewSvg=e;const i=this.chartContext.createElementNS(qn,"path");i.setAttribute("data-edge-preview",""),e.appendChild(i),this.session.previewPath=i}updatePreviewPath(t,e){const n=this.session;if(!n)return;const i=n.previewPath;if(!i)return;const r=this.virtualSourceRect(),s=e??{left:t.x,right:t.x+1,top:t.y-1,bottom:t.y+1,width:1,height:2},o=n.derivedType??("finish"===n.sourceAnchor?"FS":"SS"),a=Ae(Be.calculateArrowPathFromRects(r,s,{paddingX:20,paddingY:this.getRowHeight()/2},o),this.getCornerRadius());i.setAttribute("d",a),n.verdict.ok?i.removeAttribute("data-preview-state"):i.setAttribute("data-preview-state","invalid")}virtualSourceRect(){const t=this.session,{x:e,y:n}=t.sourceAnchorPoint,i="start"===t.sourceAnchor?e:e-1,r="finish"===t.sourceAnchor?e:e+1,s=t.sourceBarRect.height/2;return{left:i,right:r,top:n-s,bottom:n+s,width:r-i,height:2*s}}showTypeLabel(t,e,n){if(!this.timelineBody||!this.session)return;let i=this.session.typeLabel;i||(i=document.createElement("div"),i.className="bar-dep-type-label",this.timelineBody.appendChild(i),this.session.typeLabel=i),i.textContent=n.ok?e:`${e} — ${function(t){switch(t){case"self":return"self";case"duplicate":return"duplicate";case"cycle":return"cycle";case"summary-descendant":return"parent/child";case"task-missing":return"missing";case"hook-veto":return"blocked";default:return"invalid"}}(n.reason)}`,n.ok?i.removeAttribute("data-preview-state"):i.setAttribute("data-preview-state","invalid"),i.style.left=`${t.right+8}px`,i.style.top=(t.top+t.bottom)/2+"px"}hideTypeLabel(){var t;(null==(t=this.session)?void 0:t.typeLabel)&&(this.session.typeLabel.remove(),this.session.typeLabel=null)}clearDropTargetHighlight(){var t;(null==(t=this.session)?void 0:t.targetBarEl)&&this.session.targetBarEl.classList.remove(Un,Vn)}}const _n="gantt-drawing";class Gn{constructor(t,e,n,i){this.chartContext=t,this.getRowHeight=e,this.getBarMargin=n,this.onCommit=i,this.session=null,this.rootElement=null,this.timelineBody=null,this.pointerDownHandler=null,this.pointerMoveHandler=null,this.pointerUpHandler=null,this.keyHandler=null}attach(t,e){this.detach(),e&&(this.rootElement=t,this.timelineBody=e,this.pointerDownHandler=t=>this.handlePointerDown(t),this.keyHandler=t=>this.handleKeyDown(t),t.addEventListener("pointerdown",this.pointerDownHandler),t.addEventListener("keydown",this.keyHandler))}detach(){this.cancel(),this.rootElement&&this.pointerDownHandler&&this.rootElement.removeEventListener("pointerdown",this.pointerDownHandler),this.rootElement&&this.keyHandler&&this.rootElement.removeEventListener("keydown",this.keyHandler),this.rootElement=null,this.timelineBody=null,this.pointerDownHandler=null,this.keyHandler=null}isDrawing(){return null!==this.session}isEmptyTimelineTarget(t){if(!t)return!1;return!!t.closest(".bar-container, .timeline-body, .timeline-data-row, .timeline-empty-row")&&!t.closest(".bar-timeline, [data-bar-anchor]")}handlePointerDown(t){if(this.session)return;if(null!=t.button&&t.button>0)return;const e=t.target;if(!this.isEmptyTimelineTarget(e)||!this.timelineBody)return;const{x:n,y:i}=this.clientToLocal(t),r=this.getRowHeight(),s=r>0?Math.max(0,Math.floor(i/r)):0,o=l(this.chartContext,{className:"gantt-draw-task-preview"});this.timelineBody.appendChild(o),this.timelineBody.classList.add(_n),this.session={startX:n,currentX:n,rowIndex:s,preview:o,pointerId:t.pointerId??null},this.positionPreview(),this.pointerMoveHandler=t=>this.handlePointerMove(t),this.pointerUpHandler=t=>this.handlePointerUp(t),document.addEventListener("pointermove",this.pointerMoveHandler),document.addEventListener("pointerup",this.pointerUpHandler),document.addEventListener("pointercancel",this.pointerUpHandler)}handlePointerMove(t){this.session&&(null!=this.session.pointerId&&null!=t.pointerId&&t.pointerId!==this.session.pointerId||(this.session.currentX=this.clientToLocal(t).x,this.positionPreview()))}handlePointerUp(t){if(!this.session)return;const{startX:e,currentX:n,rowIndex:i}=this.session;this.endDrawing(),Math.abs(n-e)<6||(t.stopPropagation(),this.onCommit(e,n,i))}handleKeyDown(t){this.session&&"Escape"===t.key&&(t.preventDefault(),this.cancel())}cancel(){this.session&&this.endDrawing()}endDrawing(){var t,e;null==(t=this.session)||t.preview.remove(),null==(e=this.timelineBody)||e.classList.remove(_n),this.session=null,this.pointerMoveHandler&&document.removeEventListener("pointermove",this.pointerMoveHandler),this.pointerUpHandler&&(document.removeEventListener("pointerup",this.pointerUpHandler),document.removeEventListener("pointercancel",this.pointerUpHandler)),this.pointerMoveHandler=null,this.pointerUpHandler=null}positionPreview(){if(!this.session)return;const{startX:t,currentX:e,rowIndex:n,preview:i}=this.session,r=this.getRowHeight(),s=this.getBarMargin(),o=Math.min(t,e),a=Math.abs(e-t);i.style.left=`${o}px`,i.style.width=`${a}px`,i.style.top=`${n*r+s}px`,i.style.height=`${Math.max(0,r-2*s)}px`}clientToLocal(t){const e=this.timelineBody,n=e.getBoundingClientRect();return{x:t.clientX-n.left+e.scrollLeft,y:t.clientY-n.top+e.scrollTop}}}class Kn{constructor(t,e){this.chartContext=t,this.onJump=e,this.wrapper=null,this.timelineBody=null,this.barContainer=null,this.rows=[],this.scrollHandler=null,this.rafId=null}attach(t){this.detach(),t&&(this.wrapper=t,this.timelineBody=t.querySelector(".timeline-body"),this.barContainer=t.querySelector(".bar-container"),this.timelineBody&&this.barContainer&&(this.build(),0!==this.rows.length&&(this.scrollHandler=()=>this.scheduleUpdate(),this.wrapper.addEventListener("scroll",this.scrollHandler,{passive:!0}),this.update())))}detach(){this.wrapper&&this.scrollHandler&&this.wrapper.removeEventListener("scroll",this.scrollHandler),null!==this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null);for(const t of this.rows)t.left.remove(),t.right.remove();this.rows=[],this.wrapper=null,this.timelineBody=null,this.barContainer=null,this.scrollHandler=null}build(){const t=this.timelineBody,e=this.barContainer;t.querySelectorAll(".timeline-data-row[data-taskid]").forEach((t=>{const n=t.getAttribute("data-taskid");if(!n||n.startsWith("empty-"))return;const i=e.querySelector(`.bar-timeline[data-taskid="${n}"]`);if(!i)return;const r=this.createButton(n,"left"),s=this.createButton(n,"right");t.append(r,s),this.rows.push({taskId:n,barLeft:i.offsetLeft,barWidth:i.offsetWidth,left:r,right:s})}))}createButton(t,e){const n=l(this.chartContext,{className:`gantt-scroll-btn gantt-scroll-btn-${e}`});return n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label","left"===e?"Scroll to task (earlier)":"Scroll to task (later)"),n.style.display="none",n.textContent="left"===e?"‹":"›",n.addEventListener("pointerdown",(t=>t.stopPropagation())),n.addEventListener("click",(e=>{e.stopPropagation(),this.onJump(t)})),n.addEventListener("keydown",(e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.onJump(t))})),n}scheduleUpdate(){null===this.rafId&&(this.rafId=requestAnimationFrame((()=>{this.rafId=null,this.update()})))}update(){const t=this.wrapper;if(!t)return;const e=t.scrollLeft,n=t.clientWidth,i=e+n;for(const t of this.rows){const r=t.barLeft+t.barWidth<=e+6,s=n>0&&t.barLeft>=i-6;r?(t.left.style.display="flex",t.left.style.left=`${e+6}px`):t.left.style.display="none",s?(t.right.style.display="flex",t.right.style.left=e+n-20-6+"px"):t.right.style.display="none"}}}class Xn{constructor(t){this._scrollTop=0,this._rowHeight=Math.max(1,t.rowHeight),this._overscan=Math.max(0,t.overscan??5),this._totalRows=Math.max(0,t.totalRows),this._containerHeight=Math.max(0,t.containerHeight)}getVisibleRange(){if(0===this._totalRows)return{startIndex:0,endIndex:-1};const t=Math.floor(this._scrollTop/this._rowHeight),e=Math.max(0,t-this._overscan),n=Math.ceil(this._containerHeight/this._rowHeight);return{startIndex:e,endIndex:Math.min(this._totalRows-1,t+n-1+this._overscan)}}getTotalHeight(){return this._totalRows*this._rowHeight}getOffsetForIndex(t){return t*this._rowHeight}getTopSpacerHeight(){const{startIndex:t}=this.getVisibleRange();return t*this._rowHeight}getBottomSpacerHeight(){if(0===this._totalRows)return 0;const{endIndex:t}=this.getVisibleRange();return Math.max(0,(this._totalRows-1-t)*this._rowHeight)}getVisibleCount(){const{startIndex:t,endIndex:e}=this.getVisibleRange();return e<t?0:e-t+1}setScrollTop(t){this._scrollTop=Math.max(0,t)}setTotalRows(t){this._totalRows=Math.max(0,t)}setContainerHeight(t){this._containerHeight=Math.max(0,t)}setOverscan(t){this._overscan=Math.max(0,t)}get scrollTop(){return this._scrollTop}get totalRows(){return this._totalRows}get containerHeight(){return this._containerHeight}get rowHeight(){return this._rowHeight}get overscan(){return this._overscan}}const Zn="virtualizer-top-spacer",Qn="virtualizer-bottom-spacer",Jn=`.${Zn}`,ti=`.${Qn}`,ei="data-taskid";class ni{constructor(t,e,n,i,r,s,o,a=(()=>{}),l){this.domRefs=t,this.options=e,this.chartContext=n,this.dataManager=i,this.getPixelsPerMs=r,this.getIsRtl=s,this.onAfterUpdate=o,this.onToggle=a,this.commitTaskUpdate=l,this.cachedVisibleTasks=[],this.lastVisibleRange=null,this.virtualScrollRAF=null,this.verticalScrollHandler=null,this._isActive=!1,this.renderedTaskIds=new Set,this.virtualizer=new Xn({rowHeight:e.rowHeight,totalRows:0,containerHeight:0})}get isActive(){return this._isActive}getRenderedTaskIds(){return this.renderedTaskIds}initialise(t,e=0){this.cachedVisibleTasks=t;const{rowHeight:n,height:i}=this.options,r="number"==typeof i?Math.max(i-100,200):600,s=Math.ceil(r/n);if(this.virtualizer=new Xn({rowHeight:n,totalRows:t.length,containerHeight:r,overscan:s}),e>0){const i=Math.max(0,t.length*n-r);this.virtualizer.setScrollTop(Math.min(e,i))}if(t.length<=50)return void(this._isActive=!1);this._isActive=!0;const o=this.virtualizer.getVisibleRange();return this.lastVisibleRange=o,this.renderedTaskIds=new Set(t.slice(o.startIndex,o.endIndex+1).map((t=>t.id))),{allTasks:t,range:o,rowHeight:n}}attach(){const{verticalScrollContainer:t}=this.domRefs;if(!t||!this._isActive)return;const e=t.clientHeight;e>0&&(this.virtualizer.setContainerHeight(e),this.virtualizer.setOverscan(Math.ceil(e/this.options.rowHeight))),this.detach(),this.verticalScrollHandler=()=>{const e=t.scrollTop;this.scheduleUpdate(e)},t.addEventListener("scroll",this.verticalScrollHandler,{passive:!0})}detach(){const{verticalScrollContainer:t}=this.domRefs;t&&this.verticalScrollHandler&&t.removeEventListener("scroll",this.verticalScrollHandler),this.verticalScrollHandler=null,null!==this.virtualScrollRAF&&"undefined"!=typeof cancelAnimationFrame&&(cancelAnimationFrame(this.virtualScrollRAF),this.virtualScrollRAF=null),this.lastVisibleRange=null}destroy(){this.detach(),this.cachedVisibleTasks=[],this.renderedTaskIds.clear(),this._isActive=!1}updateTotalRows(t){if(this.cachedVisibleTasks=t,!this._isActive)return;this.virtualizer.setTotalRows(t.length);const e=Math.max(0,t.length*this.virtualizer.rowHeight-this.virtualizer.containerHeight);if(this.virtualizer.scrollTop>e){this.virtualizer.setScrollTop(e);const{verticalScrollContainer:t}=this.domRefs;t&&(t.scrollTop=e)}const n=this.virtualizer.getVisibleRange();this.lastVisibleRange=n,this.applyUpdate(n)}expandAllForExport(){if(!this._isActive)return null;const t=this.cachedVisibleTasks,{rowHeight:e}=this.options,n={startIndex:0,endIndex:t.length-1},i=this.domRefs.tasksDataContainer;if(i){this.patchTasksPanel(t,n,e);const r=i.querySelector(Jn),s=i.querySelector(ti);r&&(r.style.height="0px"),s&&(s.style.height="0px")}const r=this.domRefs.timelineBody;if(r){this.patchTimelinePanel(t,n,e);const i=r.querySelector(Jn),s=r.querySelector(ti);i&&(i.style.height="0px"),s&&(s.style.height="0px")}this.patchBars(t,n,e);const s=this.lastVisibleRange;return s?{startIndex:s.startIndex,endIndex:s.endIndex}:null}restoreAfterExport(t){if(!this._isActive)return;const e=t??this.virtualizer.getVisibleRange();this.applyUpdate(e)}handleResize(){if(!this._isActive)return;const{verticalScrollContainer:t}=this.domRefs;t&&this.virtualizer.setContainerHeight(t.clientHeight);const e=this.virtualizer.getVisibleRange();this.lastVisibleRange&&e.startIndex===this.lastVisibleRange.startIndex&&e.endIndex===this.lastVisibleRange.endIndex||(this.lastVisibleRange=e,this.applyUpdate(e))}updateDomRefs(t){this.domRefs=t}scheduleUpdate(t){this.virtualizer.setScrollTop(t),this.cachedVisibleTasks.length<=50||(null!==this.virtualScrollRAF&&"undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame(this.virtualScrollRAF),"undefined"!=typeof requestAnimationFrame?this.virtualScrollRAF=requestAnimationFrame((()=>{this.virtualScrollRAF=null,this.applyIfChanged()})):this.applyIfChanged())}applyIfChanged(){const t=this.virtualizer.getVisibleRange();this.lastVisibleRange&&t.startIndex===this.lastVisibleRange.startIndex&&t.endIndex===this.lastVisibleRange.endIndex||(this.lastVisibleRange=t,this.applyUpdate(t))}applyUpdate(t){const e=this.cachedVisibleTasks,{rowHeight:n}=this.options;0!==e.length&&(this.patchTasksPanel(e,t,n),this.patchTimelinePanel(e,t,n),this.patchBars(e,t,n),this.onAfterUpdate())}patchTasksPanel(t,e,n){const i=this.domRefs.tasksDataContainer;if(!i)return;const{startIndex:r,endIndex:s}=e,o=t.slice(r,s+1),a=new Set(o.map((t=>t.id))),l=Array.from(i.querySelectorAll(`${sn.tasksDataRow}:not(${sn.tasksEmptyRow})`)),d=new Map;l.forEach((t=>{const e=t.getAttribute(ei);e&&d.set(e,t)}));const h=new re(this.options,this.chartContext,this.dataManager);o.forEach(((t,e)=>{if(!d.has(t.id)){const n=r+e,s=h.generateRow(t,this.onToggle,n+1);i.appendChild(s)}})),d.forEach(((t,e)=>{a.has(e)||i.removeChild(t)})),this.updateSpacers(i,r,s,t.length,n);const c=Array.from(i.querySelectorAll(`${sn.tasksDataRow}:not(${sn.tasksEmptyRow})`)),u=new Map;o.forEach(((t,e)=>u.set(t.id,e))),c.sort(((t,e)=>{const n=t.getAttribute(ei)||"",i=e.getAttribute(ei)||"";return(u.get(n)??0)-(u.get(i)??0)}));const p=i.querySelector(ti)||null;c.forEach((t=>{i.insertBefore(t,p)})),c.forEach(((t,e)=>{t.setAttribute("aria-rowindex",(r+e+1).toString())})),this.renderedTaskIds=a}patchTimelinePanel(t,e,n){const i=this.domRefs.timelineBody;if(!i)return;const{startIndex:r,endIndex:s}=e,o=t.slice(r,s+1),a=new Set(o.map((t=>t.id))),l=Array.from(i.querySelectorAll(`${sn.timelineDataRow}:not(${sn.timelineEmptyRow})`)),d=new Map;l.forEach((t=>{const e=t.getAttribute(ei);e&&d.set(e,t)}));const h=this.readSubHeaderCells();if(0===h.length)return;const c=new Te(this.getPixelsPerMs(),this.options,this.chartContext,this.dataManager,this.getIsRtl());o.forEach((t=>{if(!d.has(t.id)){const e=c.generateRow(t.id,h);i.appendChild(e)}})),d.forEach(((t,e)=>{a.has(e)||i.removeChild(t)})),this.updateSpacers(i,r,s,t.length,n);const u=new Map;o.forEach(((t,e)=>u.set(t.id,e)));const p=Array.from(i.querySelectorAll(`${sn.timelineDataRow}:not(${sn.timelineEmptyRow})`));p.sort(((t,e)=>{const n=t.getAttribute(ei)||"",i=e.getAttribute(ei)||"";return(u.get(n)??0)-(u.get(i)??0)}));const m=i.querySelector(ti)||null;p.forEach((t=>{i.insertBefore(t,m)}))}patchBars(t,e,n){const i=this.domRefs.barContainer;if(!i)return;const{startIndex:r,endIndex:s}=e,o=this.getPixelsPerMs(),a=this.dataManager.getDateRange(8,o),{geometry:l}=we(a[0],a[1],o,this.options.inputDateFormat,void 0,this.getIsRtl()),d=t.length*n,h=t.slice(r,s+1),c=new Set(h.map((t=>t.id))),u=Array.from(i.querySelectorAll(`[${ei}]`)),p=new Map;u.forEach((t=>{const e=t.getAttribute(ei);e&&p.set(e,t)}));const m=this.chartContext.getChartContainer();h.forEach(((t,e)=>{if(!p.has(t.id)){const n=r+e,s=new It(t,l,this.options,n,this.chartContext,this.dataManager),o=this.commitTaskUpdate?this.commitTaskUpdate:(t,e)=>{Gt(this.chartContext,this.dataManager,t,e,this.options,l)},a=s.drawBar(o,this.onToggle);i.appendChild(a),m&&Me(a,0,m);const d=s.drawBaselineBar();d&&i.appendChild(d)}})),p.forEach(((t,e)=>{c.has(e)||i.removeChild(t)})),i.style.height=`${d}px`,i.style.width="100%"}updateSpacers(t,e,n,i,r){let s=t.querySelector(Jn);s||(s=this.chartContext.createElement("div"),s.className=Zn,t.insertBefore(s,t.firstChild)),s.style.height=e*r+"px";let o=t.querySelector(ti);o||(o=this.chartContext.createElement("div"),o.className=Qn,t.appendChild(o));const a=Math.max(0,(i-1-n)*r);o.style.height=`${a}px`}getTimelineCellCount(){return this.readSubHeaderCells().length}readSubHeaderCells(){var t;const e=null==(t=this.domRefs.timelineBodyWrapper)?void 0:t.closest(".timeline-container");if(!e)return[];const n=e.querySelectorAll(".timeline-header-row"),i=n[n.length-1];if(!i)return[];const r=[];return i.querySelectorAll(".timeline-header-cell").forEach((t=>{const e=t.getBoundingClientRect();r.push({data:"",width:e.width})})),r}}class ii{constructor(t,e,n){if(0===e.length)throw new Error("Transaction must contain at least one command");this.label=t,this.commands=e,this.mergeKey=n}execute(t){for(const e of this.commands)e.execute(t)}undo(t){for(let e=this.commands.length-1;e>=0;e--)this.commands[e].undo(t)}}class ri{constructor(t={}){this.undoStack=[],this.redoStack=[],this.maxSize=Math.max(1,t.maxSize??100),this.enabled=t.enabled??!0}record(t){if(!this.enabled)return;const e=this.undoStack[this.undoStack.length-1];e&&t.mergeKey&&e.mergeKey===t.mergeKey?this.undoStack[this.undoStack.length-1]=new ii(e.label,[...e.commands,...t.commands],e.mergeKey):(this.undoStack.push(t),this.undoStack.length>this.maxSize&&this.undoStack.shift()),this.redoStack=[]}undo(t){if(!this.canUndo())return null;const e=this.undoStack.pop();return e.undo(t),this.redoStack.push(e),e}redo(t){if(!this.canRedo())return null;const e=this.redoStack.pop();return e.execute(t),this.undoStack.push(e),e}canUndo(){return this.enabled&&this.undoStack.length>0}canRedo(){return this.enabled&&this.redoStack.length>0}peekUndo(){return this.undoStack[this.undoStack.length-1]??null}peekRedo(){return this.redoStack[this.redoStack.length-1]??null}size(){return{undo:this.undoStack.length,redo:this.redoStack.length}}clear(){this.undoStack=[],this.redoStack=[]}setEnabled(t){this.enabled=t,t||this.clear()}isEnabled(){return this.enabled}}class si{constructor(t,e,n,i={}){const r=n.getTask(t);if(!r)throw new Error(`UpdateTaskCommand: task "${t}" not found`);this.taskId=t,this.afterState={...e},this.beforeState=function(t,e){const n={};for(const i of Object.keys(e))n[i]=t[i];return n}(r,e),this.label=i.label??`Update task ${t}`,this.mergeKey=i.mergeKey}execute(t){t.applyTaskUpdate(this.taskId,this.afterState)}undo(t){t.applyTaskUpdate(this.taskId,this.beforeState)}}class oi{constructor(t,e,n){if(!t.id)throw new Error("AddTaskCommand: input.id is required for reversible add");this.input={...t},this.options=e,this.label=n??`Add task ${t.id}`}execute(t){t.applyAddTask(this.input,this.options)}undo(t){t.applyRemoveTask(this.input.id)}}class ai{constructor(t,e,n){const i=e.getTask(t);if(!i)throw new Error(`RemoveTaskCommand: task "${t}" not found`);this.taskId=t,this.snapshot=function(t){return{...t}}(i),this.parentIdAtRemoval=i.parentId,this.label=n??`Delete task ${t}`}execute(t){t.applyRemoveTask(this.taskId)}undo(t){t.applyAddTask(this.snapshot,{parentId:this.parentIdAtRemoval})}}class li{constructor(t,e,n,i){const r=n.getTask(t);if(!r)throw new Error(`MoveTaskCommand: task "${t}" not found`);this.taskId=t,this.newParentId=e,this.oldParentId=r.parentId,this.label=i??`Move task ${t}`}execute(t){t.applyTaskMove(this.taskId,this.newParentId)}undo(t){t.applyTaskMove(this.taskId,this.oldParentId)}}class di{constructor(t,e,n="FS",i=0,r){this.fromId=t,this.toId=e,this.type=n,this.lag=i,this.label=r??`Add dependency ${t}→${e}`}execute(t){t.applyAddDependency(this.fromId,this.toId,this.type,this.lag)}undo(t){t.applyRemoveDependency(this.fromId,this.toId)}}class hi{constructor(t,e,n,i){const r=n.getDependency(t,e);if(!r)throw new Error(`RemoveDependencyCommand: no dependency ${t}→${e}`);this.fromId=t,this.toId=e,this.type=r.type,this.lag=r.lag,this.label=i??`Remove dependency ${t}→${e}`}execute(t){t.applyRemoveDependency(this.fromId,this.toId)}undo(t){t.applyAddDependency(this.fromId,this.toId,this.type,this.lag)}}S.extend(A),S.extend(E),S.extend(H),S.extend(F),S.extend(L);const ci="dependencyArrowUpdate",ui="gantt-action-button--disabled";class pi extends n{constructor(t,e){var n,i;super(t,"gantt_"+crypto.randomUUID().replace(/-/g,"").substring(0,9)),this.options=yt,this.pixelsPerMs=0,this.currentGeometry=null,this._preservedPixelsPerMs=null,this.needsAutoFitZoom=!1,this.sortCriteria=[],this.activeFilter=null,this.quickFilterQuery="",this.quickFilterCaret=0,this.filterRuleSet=null,this.filterBuilderOpen=!1,this.filterBuilderDraft=null,this.groupCriterion=null,this.columnWidthOverrides=new Map,this.columnOrder=null,this.persistTimer=null,this.persistChangeHandler=null,this.stateRestoreAttempted=!1,this.isApplyingState=!1,this.commandContext={applyTaskUpdate:(t,e)=>{var n,i;const r=this.currentGeometry??this.buildFreshGeometry(),s=this.buildColumnRefreshContext();Gt(this.chartContext,this.dataManager,t,e,this.options,r,s),Kt(this.chartContext,this.dataManager,t,this.options,r,s);const o=((null==(i=null==(n=this.dataManager.getTaskById(t))?void 0:n.segments)?void 0:i.length)??0)>1;("segments"in e||o)&&this.render()},applyTaskMove:(t,e)=>{this.dataManager.updateTask(t,{parentId:e}),this.render()},applyAddTask:(t,e)=>{const n=(null==e?void 0:e.parentId)?{...t,parentId:e.parentId}:t;this.dataManager.addTask(n),this.render()},applyRemoveTask:t=>{this.dataManager.removeTask(t),this.render()},applyAddDependency:(t,e,n,i)=>{this.dataManager.addDependency(t,e,n,i),this.renderDependencyArrows()},applyRemoveDependency:(t,e)=>{this.dataManager.removeDependency(t,e),this.renderDependencyArrows()},getTask:t=>this.dataManager.getTaskById(t)??null,getDependency:(t,e)=>{const n=this.dataManager.getAllDependencies().find((n=>n.fromId===t&&n.toId===e));return n?{type:n.type,lag:n.lag}:null}},this.commitTaskUpdate=(t,e,n)=>{if(!this.dataManager.getTaskById(t))return;const i=new si(t,e,this.commandContext,{label:null==n?void 0:n.label,mergeKey:null==n?void 0:n.mergeKey});i.execute(this.commandContext),this.recordSingle(i)},this.containerResizeObserver=null,this.lastKnownWidth=0,this.lastKnownHeight=0,this.resizeDebounceTimer=null,this.dependencyArrowHandler=null,this.rowHoverHandler=null,this.rowHoverLeaveHandler=null,this._afterActionsRafId=null,this._destroyed=!1,this.criticalPathResult=null,this.domCache={ganttContainer:null,timelineContainer:null,timelineBody:null,timelineBodyWrapper:null,timelineHeader:null,horizontalScroll:null,horizontalScrollContent:null,tasksContainer:null,tasksBodyWrapper:null,tasksHeader:null,tasksDataContainer:null,splitBar:null,actionsContainer:null},this.keyboardNavigationManager=null,this.contextMenuManager=null,this.contextMenuHandler=null,this.undoRedoKeyHandler=null,this.selectionManager=null,this.dependencyEditManager=null,this.dependencyDrawManager=null,this.drawTaskManager=null,this.scrollButtonsManager=null,this.virtualScrollCoordinator=null,this.columnRenderManager=new O,this.reducedMotionMQL=null,this.reducedMotionHandler=null;const r=vt(null==e?void 0:e.theme);let s;(null==e?void 0:e.parsing)?ln.validateConfig(e.parsing)?s=ln.parse(e.series,e.parsing):(z.error("ApexGantt: Invalid parsing configuration provided"),s=[]):s=(null==e?void 0:e.series)||[];const o={...r.dependencies,...null==e?void 0:e.dependencies};o.editable&&(o.hitWidth??0)<12&&(o.hitWidth=12),this.options={...r,...e,baseline:{...r.baseline,...null==e?void 0:e.baseline},barLabel:{...r.barLabel,...null==e?void 0:e.barLabel},dependencies:o,history:{...r.history,...null==e?void 0:e.history},locale:{...r.locale,...null==e?void 0:e.locale},series:s},G(null==(n=this.options.locale)?void 0:n.dateLocale),this.history=new ri({enabled:this.options.history.enabled,maxSize:this.options.history.maxSize}),this.options.enableTaskEdit&&void 0===(null==e?void 0:e.enableInlineEdit)&&(this.options.enableInlineEdit=!0),this.options.baseline.enabled&&void 0===(null==e?void 0:e.rowHeight)&&(this.options.rowHeight=r.rowHeight+12),this.pixelsPerMs=this.computeInitialPixelsPerMs(this.options),this.needsAutoFitZoom=null==(null==e?void 0:e.pixelsPerDay);const a="arrows_"+crypto.randomUUID().replace(/-/g,"").substring(0,9);this.arrowLink=new Be(a),this.dataManager=new Ce,this.dataManager.setInputDateFormat(this.options.inputDateFormat),this.dataManager.setCalendar(function(t={},e){const n=Array.isArray(t.workingWeekdays),i=Array.isArray(t.holidays)&&t.holidays.length>0;if(!n&&!i)return e?new Z({inputDateFormat:e}):Q;const r=tt(t.holidays);return new Z({workingWeekdays:t.workingWeekdays??[1,2,3,4,5],holidays:r.map((t=>t.date)),inputDateFormat:e})}(this.options.calendar,this.options.inputDateFormat),tt(null==(i=this.options.calendar)?void 0:i.holidays)),this.dataManager.setTasks(this.options.series),this.dataManager.setArrowLinkInstanceId(a),this.applyInitialSortAndFilter(),this.applyInitialGrouping(),this.stateManager=new on,this.styleManager=new Dn(this.element,this.domCache,this.options,this.chartContext,this.isShadowDOM(),this.getInstanceId()),this.scrollManager=new un(this.element,this.options,this.domCache,this.chartContext,this.getInstanceId()),this.layoutManager=new yn(this.element,this.options,this.domCache,this.chartContext,this.getInstanceId());const l={onZoomChange:t=>{this.pixelsPerMs=t,this.needsAutoFitZoom=!1,this.currentGeometry=null,this.schedulePersist()},onToolbarUpdate:()=>{const t=this.domCache.actionsContainer;t&&this.renderToolbar(t)},onTimelineRerender:()=>{this.rerenderTimeline()},onDependencyArrowsRender:()=>{this.renderDependencyArrows(),this.fadeArrowsAfterAnimation(),this.computeCriticalPath(),this.applyCriticalPathHighlighting()},onScrollbarUpdate:()=>{this.scrollManager.updateHorizontalScrollbarContent()},onScrollbarPosition:()=>{this.scrollManager.positionHorizontalScrollbar()}};this.zoomManager=new gn(this.element,this.domCache,this.chartContext,this.getInstanceId(),(()=>this.pixelsPerMs),l),this.crosshairManager=new dn(this.options,this.domCache,this.chartContext),this.styleManager.setupShadowDOMEnvironment(),this.options.enableSelection&&(this.selectionManager=new Ln(this.chartContext,this.dataManager,(()=>this.element))),this.options.dependencies.editable&&(this.dependencyEditManager=new Wn(this.chartContext,((t,e)=>{this.dataManager.getAllDependencies().some((n=>n.fromId===t&&n.toId===e))&&this.removeDependency(t,e)})),this.dependencyDrawManager=new jn(this.chartContext,(()=>this.options.rowHeight),(()=>this.options.dependencies.cornerRadius??4),((t,e,n)=>this.canAddDependency(t,e,{type:n})),((t,e,n)=>{this.addDependency(t,e,{type:n})}))),this.options.enableDrawTask&&(this.drawTaskManager=new Gn(this.chartContext,(()=>this.options.rowHeight),(()=>this.options.barMargin),((t,e,n)=>this.commitDrawnTask(t,e,n)))),this.options.enableScrollButtons&&(this.scrollButtonsManager=new Kn(this.chartContext,(t=>this.scrollToTask(t)))),this.keyboardNavigationManager=new Fn(this.chartContext,this.dataManager,(()=>this.domCache.tasksDataContainer),(()=>this.render()),this.selectionManager??void 0,this.options.enableTaskEditingShortcuts?this.buildKeyboardEditingCommands():void 0),this.options.enableContextMenu&&(this.contextMenuManager=new Bn(this.chartContext)),this.setupReducedMotion(),this.columnRenderManager.observe(this.element)}get messages(){return bt(this.options)}get isRtl(){var t;return function(t,e){var n;if("rtl"===t)return!0;if("ltr"===t)return!1;if("undefined"==typeof window||"undefined"==typeof document)return!1;if(e){const t=e.closest('[dir="rtl"], [dir="ltr"]');return t?"rtl"===t.getAttribute("dir"):"rtl"===window.getComputedStyle(e).direction}return"rtl"===((null==(n=document.documentElement)?void 0:n.getAttribute("dir"))??document.dir)}((null==(t=this.options.locale)?void 0:t.direction)??"ltr",this.element)}buildColumnRefreshContext(){return{columns:zt(this.options.columnConfig),dispatcher:this.columnRenderManager,onToggleCollapse:()=>this.render()}}computeAutoColumnWidths(t,e,n,i){if(this.options.autoSizeColumns)return function(t,e,n){const i=`${n.fontWeight} ${n.fontSize} ${n.fontFamily}`,r=`700 ${n.fontSize} ${n.fontFamily}`,s=e.length>400?e.slice(0,400):e,o=new Map;for(const e of t){const t=parseFloat(e.minWidth??"")||0,a=parseFloat(e.maxWidth??"")||320;let l=ze(e.title,r);if(e.key===Bt.ProgressRing)l=Math.max(l,32);else if(We(e))l=Math.max(l,90);else for(const t of s){if(t.isGroup)continue;let r=ze(Oe(t,e,n),i);e.key===Bt.Name&&(r+=15*(t.level??0)+22),l=Math.max(l,r)}const d=Math.min(a,Math.ceil(l)+20+10);o.set(String(e.key),Math.max(t,d))}return o}(zt(this.options.columnConfig),t,{fontFamily:e,fontSize:n,fontWeight:i,inputDateFormat:this.options.inputDateFormat,calendar:this.dataManager.getCalendar(),snap:{unit:this.options.snapUnit,value:this.options.snapValue}})}effectivePanelWidth(t,e){if(!t)return e;let n=0;for(const e of t.values())n+=e;const i=this.options.enableSelection&&this.options.showCheckboxColumn?28:0;return Math.max(e,Math.ceil(n+i+2))}getPaddedDateRange(t=0){const e=W(this.options.barLabel);return this.dataManager.getDateRange(t,this.pixelsPerMs,e)}buildFreshGeometry(){const t=this.getPaddedDateRange(0);return we(t[0],t[1],this.pixelsPerMs,this.options.inputDateFormat,void 0,this.isRtl).geometry}recordSingle(t,e,n){!function(t,e,n,i){const r=new ii(n??e.label,[e],i??e.mergeKey);t.record(r)}(this.history,t,e??t.label,n??t.mergeKey),this.dispatchHistoryChange("record")}recordTransaction(t){this.history.record(t),this.dispatchHistoryChange("record")}computeInitialPixelsPerMs(t){return"number"==typeof t.pixelsPerDay&&t.pixelsPerDay>0?t.pixelsPerDay/it:de}computeAutoFitPixelsPerMs(){if(!this.element)return null;const t=this.element.clientWidth;if(t<=0)return null;const e=W(this.options.barLabel),n=t-this.options.tasksContainerWidth-16-e;if(n<=0)return null;const i=this.dataManager.getFlatTasks();if(0===i.length)return null;let r=1/0,s=-1/0;const o=this.options.inputDateFormat;for(const t of i){if(t.startTime){const e=_(t.startTime,o).valueOf();Number.isFinite(e)&&e<r&&(r=e)}if(t.endTime){const e=_(t.endTime,o).valueOf();Number.isFinite(e)&&e>s&&(s=e)}}if(!Number.isFinite(r)||!Number.isFinite(s)||s<=r)return null;const a=.25/it,l=1280/it,d=n/(1.1*(s-r));return Math.max(a,Math.min(l,d))}static setLicense(t){y.setLicense(t)}setupReducedMotion(){if("undefined"==typeof window||!window.matchMedia)return;this.reducedMotionMQL=window.matchMedia("(prefers-reduced-motion: reduce)");const t=t=>{t?this.element.classList.add("gantt-reduced-motion"):this.element.classList.remove("gantt-reduced-motion")};t(this.reducedMotionMQL.matches),this.reducedMotionHandler=e=>t(e.matches),this.reducedMotionMQL.addEventListener("change",this.reducedMotionHandler)}initializeTooltip(){const{enableTooltip:t,tooltipId:e}=this.options;if(t){const t=o(this.chartContext,e);t.classList.add("apexgantt-tooltip");if(!this.chartContext.getElementById(e)){z.warn("Tooltip init: Tooltip not found after creation, appending manually");this.chartContext.getAppendContainer().appendChild(t)}}}render(t){var e,n,i,r,s;if(!this.element)throw new Error("Element not found");if(this.maybeRestorePersistedStateOnce())return this.element;this.virtualScrollCoordinator&&this.virtualScrollCoordinator.detach();const o=this.element&&this.element.children.length>0;o&&this.stateManager.captureState(this.element,this.dataManager,this.pixelsPerMs,null==(e=this.selectionManager)?void 0:e.captureState()),this.applyAutoFitZoomIfNeeded();const{enableResize:a,tasksContainerWidth:d,height:h,width:c}=this.options,u=He(this.element),p=u.fontColor||this.options.fontColor,m=u.fontFamily||this.options.fontFamily,g=u.fontSize||this.options.fontSize,{fontWeight:f}=this.options;this.layoutManager.setupChartContainerPositioning(),this.styleManager.injectGanttStyles(),this.styleManager.setCSSVariables(),this.initializeTooltip();const b=new Set(Array.from(this.element.querySelectorAll(".bar-timeline[data-taskid]")).map((t=>t.getAttribute("data-taskid"))));this.columnRenderManager.flushCleanups(),this.element.innerHTML="";const v=this.normalizeDimension(h),y=this.normalizeDimension(c);var x,w;this.element.style.width=y,this.element.style.height=v,this.element.style.display="flex",this.element.style.flexDirection="column",this.element.style.boxSizing="border-box",this.element.style.overflow="hidden",x=this.element,w=(null==(n=this.options.locale)?void 0:n.direction)??"ltr",x&&("ltr"===w?x.removeAttribute("dir"):x.setAttribute("dir",w)),this.element.style.setProperty("color",p),this.element.style.setProperty("font-family",m),this.element.style.setProperty("font-size",g),this.element.style.setProperty("font-weight",f);const k=l(this.chartContext,{className:sn.actionsContainer.slice(1)});this.renderToolbar(k);const C=l(this.chartContext,{className:sn.ganttContainer.slice(1)}),S=this.dataManager.getFlatVisibleTasks(),M=this.computeAutoColumnWidths(S,m,g,f),E=this.effectivePanelWidth(M,d);this.initVirtualScrollCoordinator();const T=null==(i=this.virtualScrollCoordinator)?void 0:i.initialise(S,o?this.stateManager.getCapturedVerticalScroll():0);{const t=W(this.options.barLabel),e=this.dataManager.getDateRange(8,this.pixelsPerMs,t);this.currentGeometry=we(e[0],e[1],this.pixelsPerMs,this.options.inputDateFormat,void 0,this.isRtl).geometry}const A=new Te(this.pixelsPerMs,this.options,this.chartContext,this.dataManager,this.isRtl).render(T,b,this.render.bind(this),this.commitTaskUpdate),D=this.options.enableAddTaskRow&&!T,I=new re(this.options,this.chartContext,this.dataManager,this.selectionManager??void 0,this.options.enableInlineEdit?(t,e)=>this.commitInlineEdit(t,e):void 0,this.columnRenderManager,D?()=>this.addPlaceholderTask({}):void 0,((t,e)=>this.toggleSort(t,e)),(()=>this.getSort()),M,this.columnWidthOverrides,((t,e)=>this.handleColumnResize(t,e)),this.columnOrder??void 0,((t,e)=>this.handleColumnReorder(t,e)),(t=>this.scrollToTask(t))).render(this.render.bind(this),T);A&&this.layoutManager.createLayout(C,I,A,a,E),this.element.appendChild(k),this.element.appendChild(C);const $=this.element.querySelector(sn.horizontalScroll);$&&($.remove(),this.element.appendChild($)),this.cacheDomElements(),this.styleManager.handleWatermark(),this.setupRowBackgroundColors(),this.zoomManager.setupZoomEventListener(),this.attachCrosshair(),this.setupDependencyArrowEvents(),this.renderDependencyArrows(),null==(r=this.dependencyDrawManager)||r.attach(this.element,this.domCache.timelineBody,this.domCache.timelineBodyWrapper),null==(s=this.drawTaskManager)||s.attach(this.element,this.domCache.timelineBody);const F=this.computeChangedVisibleIds(b,S);return this.fadeArrowsAfterAnimation(!1,F),this.computeCriticalPath(),this.applyCriticalPathHighlighting(),this._afterActionsRafId=requestAnimationFrame((()=>{this._afterActionsRafId=null,this.performAfterActions()})),o&&requestAnimationFrame((()=>{this.isDestroyed()||this.stateManager.restoreState(this.element)})),this.schedulePersist(),this.element}cacheDomElements(){var t;this.domCache.ganttContainer=this.element.querySelector(sn.ganttContainer),this.domCache.timelineContainer=this.element.querySelector(sn.timelineContainer),this.domCache.timelineBody=this.element.querySelector(sn.timelineBody),this.domCache.timelineBodyWrapper=this.element.querySelector(sn.timelineBodyWrapper),this.domCache.timelineHeader=this.element.querySelector(sn.timelineHeader),this.domCache.horizontalScroll=this.element.querySelector(sn.horizontalScroll),this.domCache.horizontalScrollContent=(null==(t=this.domCache.horizontalScroll)?void 0:t.querySelector(sn.horizontalScrollContent))||null,this.domCache.tasksContainer=this.element.querySelector(sn.tasksContainer),this.domCache.tasksBodyWrapper=this.element.querySelector(sn.tasksBodyWrapper),this.domCache.tasksHeader=this.element.querySelector(sn.tasksHeader),this.domCache.tasksDataContainer=this.element.querySelector(sn.tasksDataContainer),this.domCache.splitBar=this.element.querySelector(sn.splitBar),this.domCache.actionsContainer=this.element.querySelector(sn.actionsContainer)}clearDomCache(){this.domCache.ganttContainer=null,this.domCache.timelineContainer=null,this.domCache.timelineBody=null,this.domCache.timelineBodyWrapper=null,this.domCache.timelineHeader=null,this.domCache.horizontalScroll=null,this.domCache.horizontalScrollContent=null,this.domCache.tasksContainer=null,this.domCache.tasksBodyWrapper=null,this.domCache.tasksHeader=null,this.domCache.tasksDataContainer=null,this.domCache.splitBar=null,this.domCache.actionsContainer=null}performAfterActions(){var t,e,n,i;if(!this.isDestroyed()){if(this.cacheDomElements(),this.layoutManager.syncTasksColumnWidths(),this.scrollManager.compensateForScrollbar(),this.scrollManager.updateHorizontalScrollbarContent(),this.scrollManager.setupTimelineHorizontalScroll(),this.scrollManager.positionHorizontalScrollbar(),this.scrollManager.setInitialHorizontalScroll(this.isRtl),this.setupContainerResizeObserver(),this.scrollManager.setupScrollbarResizeObserver(),this.setupRowBackgroundColors(),this.setupRowHoverSync(),this.scrollManager.disableHeaderMousewheelScroll(),null==(t=this.scrollButtonsManager)||t.attach(this.domCache.timelineBodyWrapper),(null==(e=this.virtualScrollCoordinator)?void 0:e.isActive)||this.layoutManager.fillEmptyRowsAfterRender(),this.virtualScrollCoordinator){const t=this.element.querySelector(sn.splitViewContainer)??this.domCache.ganttContainer;this.virtualScrollCoordinator.updateDomRefs({tasksDataContainer:this.domCache.tasksDataContainer,timelineBody:this.domCache.timelineBody,barContainer:this.element.querySelector(sn.barContainer),tasksBodyWrapper:this.domCache.tasksBodyWrapper,timelineBodyWrapper:this.domCache.timelineBodyWrapper,verticalScrollContainer:t}),this.virtualScrollCoordinator.attach()}null==(n=this.keyboardNavigationManager)||n.attach(),this.attachContextMenuHandler(),this.attachUndoRedoShortcuts(),null==(i=this.selectionManager)||i.restoreAfterRender()}}initVirtualScrollCoordinator(){this.virtualScrollCoordinator&&this.virtualScrollCoordinator.destroy(),this.virtualScrollCoordinator=new ni({tasksDataContainer:null,timelineBody:null,barContainer:null,tasksBodyWrapper:null,timelineBodyWrapper:null,verticalScrollContainer:null},this.options,this.chartContext,this.dataManager,(()=>this.pixelsPerMs),(()=>this.isRtl),(()=>{var t;this.setupRowBackgroundColors(),this.renderDependencyArrows(),this.fadeArrowsAfterAnimation(),this.applyCriticalPathHighlighting(),null==(t=this.scrollButtonsManager)||t.attach(this.domCache.timelineBodyWrapper)}),(()=>this.render()),this.commitTaskUpdate)}setupRowHoverSync(){const t=this.domCache.ganttContainer;if(!t)return;this.rowHoverHandler&&(t.removeEventListener("mousemove",this.rowHoverHandler),this.rowHoverHandler=null),this.rowHoverLeaveHandler&&(t.removeEventListener("mouseleave",this.rowHoverLeaveHandler),this.rowHoverLeaveHandler=null);const e=this.chartContext.getInstanceId(),n=`${sn.tasksDataRow}[data-chart-instance="${e}"]`,i=`${sn.timelineDataRow}[data-chart-instance="${e}"]`,r=getComputedStyle(this.element).getPropertyValue("--row-hover-color").trim()||"rgba(0,0,0,0.06)",s=(t,e)=>{const s=this.element.querySelector(`${n}[data-taskid="${t}"]`),o=this.element.querySelector(`${i}[data-taskid="${t}"]`);for(const t of[s,o])t&&(e?(t.dataset.origBg||(t.dataset.origBg=t.style.backgroundColor),t.style.backgroundColor=r):(t.style.backgroundColor=t.dataset.origBg??"",delete t.dataset.origBg))};let o=null;const a=t=>{const r=t.target,a=null==r?void 0:r.closest(`${n}, ${i}`),l=null==r?void 0:r.closest(`[data-taskid][data-chart-instance="${e}"]`),d=(null==a?void 0:a.dataset.taskid)??(null==l?void 0:l.dataset.taskid)??null;d!==o&&(o&&s(o,!1),o=d,o&&s(o,!0))},l=e=>{const{relatedTarget:n}=e;n&&t.contains(n)||(o&&s(o,!1),o=null)};this.rowHoverHandler=a,this.rowHoverLeaveHandler=l,t.addEventListener("mousemove",a),t.addEventListener("mouseleave",l)}setupRowBackgroundColors(){var t;const e=new Map,n=He(this.element),i=[...this.options.rowBackgroundColors];n.rowBgEven&&(i[0]=n.rowBgEven),n.rowBgOdd&&(i[1]=n.rowBgOdd);const r=(null==(t=this.virtualScrollCoordinator)?void 0:t.isActive)?this.virtualScrollCoordinator.getRenderedTaskIds():null;this.dataManager.getTopParentTasks().forEach(((t,n)=>{const s=t.rowBackgroundColor||jt(n,i);e.set(t.id,s),r&&!r.has(t.id)||_t(this.chartContext,t.id,s)}));const s=r?Array.from(r,(t=>this.dataManager.getTaskById(t))).filter((t=>null!=t)):this.dataManager.getFlatTasks();s.forEach((t=>{if(!t.parentId){if(t.type===ne.Milestone&&!e.has(t.id)){const e=t.rowBackgroundColor||jt(0,i);_t(this.chartContext,t.id,e)}return}let n=this.dataManager.getTaskById(t.parentId);for(;null==n?void 0:n.parentId;)n=this.dataManager.getTaskById(n.parentId);const r=n?n.id:t.parentId,s=t.rowBackgroundColor||(e.get(r??"")??"");_t(this.chartContext,t.id,s)}))}fadeArrowsAfterAnimation(t=!1,e){var n;const i=`timeline-arrows-${this.arrowLink.getInstanceId()}`;!function(t,e,n=!1,i){if(!t)return;const r=Se(e);if(i&&i.size>0){const e=Array.from(t.querySelectorAll("path[data-from-id]")).filter((t=>{const e=t.getAttribute("data-from-id")??"",n=t.getAttribute("data-to-id")??"";return i.has(e)||i.has(n)}));if(0===e.length)return;return n||r?void e.forEach((t=>t.style.opacity="1")):(e.forEach((t=>t.style.opacity="0")),void setTimeout((()=>{e.forEach((t=>{"function"==typeof t.animate?t.animate([{opacity:"0"},{opacity:"1"}],{duration:150,easing:"ease-out",fill:"forwards"}).finished.then((()=>{t.style.opacity="1",t.getAnimations().forEach((t=>t.cancel()))})).catch((()=>{})):t.style.opacity="1"}))}),200))}n||r?t.style.opacity="1":(t.style.opacity="0",setTimeout((()=>{"function"==typeof t.animate?t.animate([{opacity:"0"},{opacity:"1"}],{duration:150,easing:"ease-out",fill:"forwards"}).finished.then((()=>{t.style.opacity="1",t.getAnimations().forEach((t=>t.cancel()))})).catch((()=>{})):t.style.opacity="1"}),200))}((null==(n=this.domCache.timelineBody)?void 0:n.querySelector(`#${i}`))??null,this.element,t,e)}renderDependencyArrows(){var t;const{rowHeight:e,barMargin:n}=this.options,i=this.getInstanceId(),r=this.arrowLink.getInstanceId(),s=this.domCache.timelineBody;if(!s)return void z.warn(`[${i}] Timeline body not found for arrows`);const o=`timeline-arrows-${r}`,a=s.querySelector(`#${o}`);a&&a.remove();const l=this.dataManager.getAllDependencies();if(0===l.length)return;const{indexMap:d,count:h}=this.dataManager.getFlatVisibleIndex(),c=this.getPaddedDateRange(8),{geometry:u}=we(c[0],c[1],this.pixelsPerMs,this.options.inputDateFormat,void 0,this.isRtl),p=e-2*n,m=(t,i)=>{const r=It.calculateX(t,u,this.options),s=It.calculateWidth(t,u,this.options),o=n+i*e;return{left:r,right:r+s,top:o,bottom:o+p,width:s,height:p}},g=(null==(t=this.virtualScrollCoordinator)?void 0:t.isActive)?this.virtualScrollCoordinator.getRenderedTaskIds():null;let f;if(g){const t=this.dataManager.getDependencyAdjacency(),e=new Set,n=[];g.forEach((i=>{const r=t.get(i);if(r)for(const t of r){const i=`${t.fromId}->${t.toId}`;e.has(i)||(e.add(i),n.push(t))}})),f=n}else f=l;const b=f.flatMap((t=>{const{fromId:e,toId:n,type:i,lag:r}=t,s=this.dataManager.getTaskById(e),o=this.dataManager.getTaskById(n),a=d.get(e),l=d.get(n);if(!s||!o||void 0===a||void 0===l)return[];const h=m(s,a),c=m(o,l);if(isNaN(h.left)||isNaN(c.left))return[];return[{fromId:e,toId:n,sourceRect:h,targetRect:c,dependencyType:i,lagPx:r,fromTask:s,toTask:o,lagDays:r}]}));if(0===b.length)return;const v=h*e,y=this.arrowLink.renderFromRects(s,b,{arrowColor:this.options.arrowColor,height:Math.max(v,s.clientHeight),paddingY:e/2,width:(s.scrollWidth||s.clientWidth)+40,dependencies:this.options.dependencies,tooltipId:this.options.tooltipId,tooltipBgColor:this.options.tooltipBGColor,tooltipBorderColor:this.options.tooltipBorderColor,tooltipFontColor:this.options.fontColor,tooltipFontFamily:this.options.fontFamily,tooltipFontSize:this.options.fontSize,tooltipFontWeight:this.options.fontWeight},this.chartContext);this.dependencyEditManager&&this.dependencyEditManager.attach(y,this.element)}setupDependencyArrowEvents(){const t=this.getInstanceId(),e=this.arrowLink.getInstanceId();this.dependencyArrowHandler&&this.chartContext.removeEventListener(ci,this.dependencyArrowHandler),this.dependencyArrowHandler=n=>{const i=n;if(i.detail.chartInstanceId!==t)return;const r=i.detail.arrowLinkInstanceId||e,s=function(t,e,n,i,r="FS",s=38,o){const a=t.getInstanceId(),l=q(t,e),d=q(t,n);if(!l||!d)return z.warn(`[${a}] Arrow source or target not found: ${e} -> ${n}`),!1;const h=t.querySelector(`.timeline-body[data-chart-instance="${a}"]`),c=`timeline-arrows-${i}`,u=null==h?void 0:h.querySelector(`#${c}`);if(!u)return z.warn(`[${a}] Arrow SVG not found: ${c}`),!1;const p=Be.updateArrow(l,d,u,{paddingX:20,paddingY:s/2,dependencies:o},e,n,r);return p||z.warn(`[${a}] Arrow path not found in SVG for ${e} -> ${n} — caller should re-render`),p}(this.chartContext,i.detail.fromId,i.detail.toId,r,i.detail.type,this.options.rowHeight,this.options.dependencies);s||(this.renderDependencyArrows(),this.fadeArrowsAfterAnimation(!0))},this.chartContext.addEventListener(ci,this.dependencyArrowHandler);const n=()=>{this.computeCriticalPath(),this.chartContext.querySelectorAll(".bar-critical").forEach((t=>t.classList.remove("bar-critical"))),this.chartContext.querySelectorAll(".critical-arrow").forEach((t=>t.classList.remove("critical-arrow"))),this.applyCriticalPathHighlighting()},i=this.chartContext.getChartContainer();i&&(i.removeEventListener(ot.TASK_DRAGGED,n),i.removeEventListener(ot.TASK_RESIZED,n),i.addEventListener(ot.TASK_DRAGGED,n),i.addEventListener(ot.TASK_RESIZED,n))}computeCriticalPath(){this.options.enableCriticalPath&&(this.criticalPathResult=function(t,e,n=Q){if(0===t.length||0===e.length)return Le;const i=e.filter((t=>"FS"===t.type));if(0===i.length)return Le;const r=new Map;for(const e of t)r.set(e.id,e);const s=new Map,o=new Map,a=new Map;for(const e of t)a.set(e.id,0),s.set(e.id,[]),o.set(e.id,[]);for(const t of i)r.has(t.fromId)&&r.has(t.toId)&&(s.get(t.fromId).push(t),o.get(t.toId).push(t),a.set(t.toId,(a.get(t.toId)??0)+1));const l=[];for(const[t,e]of a)0===e&&l.push(t);const d=[];for(;l.length>0;){const t=l.shift();d.push(t);for(const e of s.get(t)??[]){const t=(a.get(e.toId)??0)-1;a.set(e.toId,t),0===t&&l.push(e.toId)}}if(d.length!==t.length)return Le;const h=new Map,c=new Map;for(const t of d){const e=r.get(t);if(!e)continue;const i=Re(e.startTime,e.endTime??e.startTime,n);let s=0;for(const e of o.get(t)??[]){const t=c.get(e.fromId)??0;s=Math.max(s,t+e.lag+1)}h.set(t,s),c.set(t,s+i-1)}let u=0;for(const t of c.values())t>u&&(u=t);const p=new Map,m=new Map;for(const t of[...d].reverse()){const e=r.get(t);if(!e)continue;const i=Re(e.startTime,e.endTime??e.startTime,n),o=s.get(t)??[];let a=u;for(const t of o){const e=m.get(t.toId)??u;a=Math.min(a,e-t.lag-1)}p.set(t,a),m.set(t,a-i+1)}const g=new Set;for(const t of d)0==(m.get(t)??0)-(h.get(t)??0)&&g.add(t);const f=new Set;for(const t of i)if(g.has(t.fromId)&&g.has(t.toId)){const e=c.get(t.fromId)??0,n=h.get(t.toId)??0;e+t.lag+1===n&&f.add(`${t.fromId}->${t.toId}`)}return{criticalTaskIds:g,criticalEdgeKeys:f}}(this.dataManager.getTasks(),this.dataManager.getAllDependencies(),this.dataManager.getCalendar()))}applyCriticalPathHighlighting(){var t,e;if(!this.options.enableCriticalPath||!this.criticalPathResult)return;for(const e of this.criticalPathResult.criticalTaskIds)null==(t=q(this.chartContext,e))||t.classList.add("bar-critical");const n=this.domCache.timelineBody;for(const t of this.criticalPathResult.criticalEdgeKeys){const[i,r]=t.split("->");null==(e=null==n?void 0:n.querySelector(`[data-from-id="${i}"][data-to-id="${r}"]:not([data-arrow-hit])`))||e.classList.add("critical-arrow")}}rerenderTimeline(){var t,e,n;const i=this.domCache.timelineContainer;if(!i)return;const r=new Map;this.element.querySelectorAll(".bar-timeline[data-taskid]").forEach((t=>{const e=t.getAttribute("data-taskid");r.set(e,{left:parseFloat(t.style.left)||0,width:parseFloat(t.style.width)||0})}));const s=this.dataManager.getFlatVisibleTasks(),o=this.element.querySelector(sn.splitViewContainer)??this.domCache.ganttContainer,a=null==(t=this.virtualScrollCoordinator)?void 0:t.initialise(s,(null==o?void 0:o.scrollTop)??0),d=new Set(s.map((t=>t.id))),h=this.domCache.timelineHeader,c=this.domCache.timelineBodyWrapper;if(h&&c){h.innerHTML="",c.innerHTML="";const t=new Te(this.pixelsPerMs,this.options,this.chartContext,this.dataManager,this.isRtl).render(a,d,this.render.bind(this),this.commitTaskUpdate);if(t){const e=t[0];h.innerHTML=e.innerHTML;for(let e=1;e<t.length-1;e++)c.appendChild(t[e])}}else{i.innerHTML="";const t=new Te(this.pixelsPerMs,this.options,this.chartContext,this.dataManager,this.isRtl).render(a,d,this.render.bind(this),this.commitTaskUpdate);if(t){const e=t[0];i.appendChild(e);const n=l(this.chartContext,{className:sn.timelineBodyWrapper.slice(1)});for(let e=1;e<t.length-1;e++)n.appendChild(t[e]);i.appendChild(n)}}this.cacheDomElements(),this.attachCrosshair(),null==(e=this.dependencyDrawManager)||e.attach(this.element,this.domCache.timelineBody,this.domCache.timelineBodyWrapper),null==(n=this.drawTaskManager)||n.attach(this.element,this.domCache.timelineBody),this.cancelPendingAfterActionsRaf(),this._afterActionsRafId=requestAnimationFrame((()=>{if(this._afterActionsRafId=null,r.size>0){const t=this.element;this.element.querySelectorAll(".bar-timeline[data-taskid]").forEach((e=>{const n=e.getAttribute("data-taskid"),i=r.get(n);i&&function(t,e,n,i){if(Se(i))return;if("function"!=typeof t.animate)return;if(e.left===n.left&&e.width===n.width)return;const r=t.animate([{left:`${e.left}px`,width:`${e.width}px`},{left:`${n.left}px`,width:`${n.width}px`}],{duration:200,easing:"ease-in-out",fill:"forwards"});r.finished.then((()=>r.cancel())).catch((()=>{}))}(e,i,{left:parseFloat(e.style.left)||0,width:parseFloat(e.style.width)||0},t)}))}this.performAfterActions()}))}attachCrosshair(){if(!this.options.enableCrosshair)return void this.crosshairManager.detach();const t=this.getPaddedDateRange(8),{geometry:e,tiers:n}=we(t[0],t[1],this.pixelsPerMs,this.options.inputDateFormat,void 0,this.isRtl);this.crosshairManager.updateOptions(this.options),this.crosshairManager.attach(e,n.sub.id)}cancelPendingAfterActionsRaf(){null!=this._afterActionsRafId&&(cancelAnimationFrame(this._afterActionsRafId),this._afterActionsRafId=null)}cleanupEventListeners(){var t,e;try{this.dependencyArrowHandler&&(this.chartContext.removeEventListener(ci,this.dependencyArrowHandler),this.dependencyArrowHandler=null),this.rowHoverHandler&&(null==(t=this.domCache.ganttContainer)||t.removeEventListener("mousemove",this.rowHoverHandler),this.rowHoverHandler=null),this.rowHoverLeaveHandler&&(null==(e=this.domCache.ganttContainer)||e.removeEventListener("mouseleave",this.rowHoverLeaveHandler),this.rowHoverLeaveHandler=null);const n=this.domCache.timelineContainer;if(null==n?void 0:n.parentNode){const t=n.cloneNode(!0);n.parentNode.replaceChild(t,n)}}catch(t){z.warn("Error cleaning up event listeners:",t)}}cleanupTooltips(){try{const{enableTooltip:t,tooltipId:e}=this.options;if(t){const t=this.chartContext.getElementById(e);t&&(t.style.display="none",t.innerHTML="",t.removeAttribute("style"),t.classList.remove("visible"),t.setAttribute("aria-hidden","true"),this.isShadowDOM()&&t.remove())}}catch(t){z.warn("Error cleaning up tooltips:",t)}}cleanupDependencyArrows(){try{const t=this.domCache.timelineBody;if(t&&this.arrowLink){const e=this.arrowLink.getInstanceId(),n=`timeline-arrows-${e}`,i=t.querySelector(`#${n}`);i&&i.remove();t.querySelectorAll("[data-from-id]").forEach((t=>{const n=t.getAttribute("marker-end");(null==n?void 0:n.includes(`arrowhead-${e}`))&&t.remove()}))}}catch(t){z.warn("Error cleaning up dependency arrows:",t)}}createActionButton(t,e,n=!1){const i=this.chartContext.createElement("button");return i.className="gantt-action-button",i.innerHTML=t,i.title=e,i.disabled=n,i.setAttribute("aria-label",e),i}createSeparator(){const t=this.chartContext.createElement("div");return t.className="gantt-action-separator",t}renderToolbar(t){t.innerHTML="";const e=[],n=()=>{var t;return{selectedTasks:(null==(t=this.selectionManager)?void 0:t.getSelectedTasks())??[]}},i=(this.options.toolbarItems??[]).filter((t=>"left"===(t.position??"right")));i.length>0&&(i.forEach((i=>{const r=this.createToolbarItem(i,n,e);r&&t.append(r)})),t.append(this.createSeparator()));const r=this.createActionButton(Jt.zoomIn,"Zoom In",this.zoomManager.isAtMaxZoom());r.addEventListener("click",(()=>this.zoomIn()));const s=this.createActionButton(Jt.zoomOut,"Zoom Out",this.zoomManager.isAtMinZoom());if(s.addEventListener("click",(()=>this.zoomOut())),t.append(r,s),this.options.enableQuickFilter&&(t.append(this.createSeparator()),t.append(this.buildQuickFilterInput())),this.options.enableFilterBuilder&&(t.append(this.createSeparator()),t.append(this.buildFilterBuilder(t))),this.options.enableSelection&&this.selectionManager){const n=this.chartContext.createElement("div");n.className="gantt-selection-count";const i=this.selectionManager.getSelectedIds().size;n.textContent=i>0?`${i} selected`:"",n.style.display=i>0?"":"none",e.push((()=>{var t;const e=(null==(t=this.selectionManager)?void 0:t.getSelectedIds().size)??0;n.textContent=e>0?`${e} selected`:"",n.style.display=e>0?"":"none"})),t.append(n)}if(this.options.enableTaskCRUDToolbar){t.append(this.createSeparator());const n=this.createActionButton(Jt.plus,this.messages.addTask);n.classList.add("gantt-toolbar-add-task"),n.addEventListener("click",(()=>this.addTaskFromToolbar())),t.append(n);const i=()=>{var t;return(null==(t=this.selectionManager)?void 0:t.getSelectedIds().size)??0},r=this.createActionButton(Jt.trash,this.messages.deleteSelected,0===i());r.classList.add("gantt-toolbar-delete-task"),r.addEventListener("click",(()=>this.deleteSelectedFromToolbar())),t.append(r),e.push((()=>{const t=0===i();r.disabled=t,r.classList.toggle(ui,t)}))}if(this.options.enableTaskCRUDToolbar&&this.options.history.enabled){const e=this.createActionButton(Jt.undo,this.messages.undo,!this.canUndo());e.classList.add("gantt-toolbar-undo"),e.addEventListener("click",(()=>this.undo())),t.append(e);const n=this.createActionButton(Jt.redo,this.messages.redo,!this.canRedo());n.classList.add("gantt-toolbar-redo"),n.addEventListener("click",(()=>this.redo())),t.append(n);const i=()=>{const t=!this.canUndo();e.disabled=t,e.classList.toggle(ui,t);const i=!this.canRedo();n.disabled=i,n.classList.toggle(ui,i)};this.element.addEventListener(ot.HISTORY_CHANGE,i)}const o=(this.options.toolbarItems??[]).filter((t=>"right"===(t.position??"right")));if(o.length>0&&(t.append(this.createSeparator()),o.forEach((i=>{const r=this.createToolbarItem(i,n,e);r&&t.append(r)}))),this.options.enableExport){const e=this.chartContext.createElement("div");e.className="gantt-actions-spacer",t.append(e);const n=this.createActionButton(Jt.download,this.exportButtonLabel());n.addEventListener("click",(()=>{this.exportChart()})),t.append(n)}e.length>0&&this.element.addEventListener(ot.SELECTION_CHANGE,(()=>{e.forEach((t=>t()))}))}createToolbarItem(t,e,n){return"separator"===t.type?this.createSeparator():"button"===t.type?this.createToolbarButton(t,e,n):"select"===t.type?this.createToolbarSelect(t,e):null}createToolbarButton(t,e,n){const i=this.chartContext.createElement("button");i.className="gantt-action-button gantt-toolbar-button",t.tooltip?(i.title=t.tooltip,i.setAttribute("aria-label",t.tooltip)):t.label&&i.setAttribute("aria-label",t.label);const r=()=>{i.innerHTML=(()=>{const n=e().selectedTasks.length,i=t.showCount&&n>0?` (${n})`:"",r=t.label?`<span>${t.label}${i}</span>`:"";return`${t.icon??""}${r}`})(),i.disabled=t.requiresSelection?0===e().selectedTasks.length:"function"==typeof t.disabled?t.disabled(e()):t.disabled??!1};r(),i.addEventListener("click",(()=>{i.disabled||t.onClick(e())}));return(t.requiresSelection||"function"==typeof t.disabled||t.showCount)&&n.push(r),i}createToolbarSelect(t,e){const n=this.chartContext.createElement("div");if(n.className="gantt-toolbar-select-wrapper",t.label){const e=this.chartContext.createElement("span");e.className="gantt-toolbar-select-label",e.textContent=t.label,n.append(e)}const i=this.chartContext.createElement("select");if(i.className="gantt-toolbar-select",t.placeholder){const e=this.chartContext.createElement("option");e.value="",e.textContent=t.placeholder,e.disabled=!0,e.selected=!0,i.append(e)}return t.options.forEach((({value:t,text:e})=>{const n=this.chartContext.createElement("option");n.value=t,n.textContent=e,i.append(n)})),i.addEventListener("change",(()=>{t.onChange(i.value,e())})),n.append(i),n}mergeNestedOptionGroups(t,e,n){const i={...t,...e,...n};return i.baseline={...t.baseline,...e.baseline??t.baseline,...n.baseline??{}},i.barLabel={...t.barLabel,...e.barLabel??t.barLabel,...n.barLabel??{}},i.dependencies={...t.dependencies,...e.dependencies??t.dependencies,...n.dependencies??{}},i.locale={...t.locale,...e.locale??t.locale,...n.locale??{}},i}update(t){var e,n;this.element&&!this.isDestroyed()&&this.stateManager.captureState(this.element,this.dataManager,this.pixelsPerMs,null==(e=this.selectionManager)?void 0:e.captureState());const i=this.detectCurrentTheme(),r=t.theme,s=r&&r!==i,o=this.stateManager.hasState()?this.stateManager.getPixelsPerMs():this.pixelsPerMs,a=new Set(Object.keys(t).filter((e=>void 0===t[e]))),l=Object.fromEntries(Object.entries(t).filter((([,t])=>void 0!==t))),d=vt(r||i);let h;if(s){this.styleManager.cleanupScrollbarStyles();const t={series:this.options.series,parsing:this.options.parsing,width:this.options.width,height:this.options.height,pixelsPerDay:this.options.pixelsPerDay,rowHeight:this.options.rowHeight,tasksContainerWidth:this.options.tasksContainerWidth,inputDateFormat:this.options.inputDateFormat,annotations:this.options.annotations,enableSelection:this.options.enableSelection,enableExport:this.options.enableExport,enableResize:this.options.enableResize,enableTaskDrag:this.options.enableTaskDrag,enableTaskEdit:this.options.enableTaskEdit,enableTaskResize:this.options.enableTaskResize,enableTooltip:this.options.enableTooltip,tooltipTemplate:this.options.tooltipTemplate,canvasStyle:this.options.canvasStyle};h=this.mergeNestedOptionGroups(d,t,l)}else{const t=Object.fromEntries(Object.entries(this.options).filter((([t])=>!a.has(t))));h=this.mergeNestedOptionGroups(d,t,l)}const c=t.pixelsPerDay;let u;"number"==typeof c&&c>0?(this._preservedPixelsPerMs=null,this.needsAutoFitZoom=!1):this._preservedPixelsPerMs=o,h.parsing?ln.validateConfig(h.parsing)?u=ln.parse(h.series,h.parsing):(z.error("ApexGantt: Invalid parsing configuration provided in update()"),u=this.options.series):u=h.series?h.series:this.options.series,this.options={...h,series:u},G(null==(n=this.options.locale)?void 0:n.dateLocale),this.options.enableTaskEdit&&!1!==t.enableInlineEdit&&(this.options.enableInlineEdit=!0),this.pixelsPerMs=this._preservedPixelsPerMs??this.computeInitialPixelsPerMs(this.options),this._preservedPixelsPerMs=null,this.dataManager.setTasks(this.options.series),"sortBy"in t&&(this.sortCriteria=this.normalizeSortBy(t.sortBy)),this.rebuildSort(),this.reapplyFilterAfterUpdate(t),this.reapplyGroupingAfterUpdate(t),this.styleManager.updateOptions(this.options),this.scrollManager.updateOptions(this.options),this.layoutManager.updateOptions(this.options),this.crosshairManager.updateOptions(this.options),this.render()}detectCurrentTheme(){const t=this.options.backgroundColor;return this.styleManager.isColorDark(t)?"dark":"light"}updateTask(t,e){var n,i;const r=this.dataManager.getTaskById(t);if(!r)throw new Error(`Task with ID ${t} not found`);if(!1===(null==(i=(n=this.options).beforeTaskUpdate)?void 0:i.call(n,{task:r,updates:e})))return;const s=new si(t,e,this.commandContext);s.execute(this.commandContext),this.recordSingle(s)}splitTask(t,e,n={}){const i=this.dataManager.getTaskById(t);if(!i)throw new Error(`ApexGantt.splitTask: task "${t}" not found`);if(i.type===ne.Milestone||i.showSummaryBar)return;const r=this.options.inputDateFormat,s=i.segments&&i.segments.length>=1?ae(i.segments,r):[{start:i.startTime,end:i.endTime}],o=function(t,e,n,i){const r=t=>_(t,i).valueOf(),s=r(e),o=[];let a=!1;for(const i of t)!a&&s>r(i.start)&&s<r(i.end)?(o.push({start:i.start,end:e}),o.push({start:n,end:i.end}),a=!0):o.push({start:i.start,end:i.end});return ae(o,i)}(s,e,n.resumeAt??_(e,r).add(1,"day").format(r),r);o.length!==s.length&&this.updateTask(t,{segments:o})}isSplit(t){const e=this.dataManager.getTaskById(t);return!!(null==e?void 0:e.segments)&&e.segments.length>1}addTask(t,e={}){var n,i;if(!t.id)throw new Error("ApexGantt.addTask: input.id is required");if(this.dataManager.getTaskById(t.id))throw new Error(`ApexGantt.addTask: task with id "${t.id}" already exists`);if(!1===(null==(i=(n=this.options).beforeTaskAdd)?void 0:i.call(n,{input:t,parentId:e.parentId})))return null;const r=new oi(t,e);r.execute(this.commandContext),this.recordSingle(r);const s=this.dataManager.getTaskById(t.id);return s?(this.dispatchTaskAdded(s,e.parentId),s):null}deleteTask(t,e={}){var n,i;const r=e.cascade??"forbid",s=this.dataManager.getTaskById(t);if(!s)throw new Error(`ApexGantt.deleteTask: task with id "${t}" not found`);const o=this.dataManager.hasChildren(t);if("forbid"===r&&o)throw new Error(`ApexGantt.deleteTask: task "${t}" has children. Pass {cascade: 'children'} or {cascade: 'orphan'} to handle the subtree.`);const a="children"===r?this.dataManager.getNestedChildTasks(t,!1):[],l=a.map((t=>t.id)),d="orphan"===r?this.dataManager.getImmediateChildren(t):[];if(!1===(null==(i=(n=this.options).beforeTaskDelete)?void 0:i.call(n,{task:s,descendantIds:l,cascade:r})))return!1;const h=new Set([t,...l]),c=this.dataManager.getAllDependencies().filter((t=>h.has(t.fromId)||h.has(t.toId))),u=c.map((t=>({fromId:t.fromId,toId:t.toId,type:t.type,lag:t.lag}))),p=[];for(const t of c){const e=new hi(t.fromId,t.toId,this.commandContext);e.execute(this.commandContext),p.push(e)}if("orphan"===r&&d.length>0){const t=s.parentId;for(const e of d){const n=new li(e.id,t,this.commandContext);n.execute(this.commandContext),p.push(n)}}const m=[...a,s].sort(((t,e)=>this.depthOf(e.id)-this.depthOf(t.id)));for(const t of m){const e=new ai(t.id,this.commandContext);e.execute(this.commandContext),p.push(e)}const g=a.length>0?`Delete task ${t} + ${a.length} descendant(s)`:d.length>0?`Delete task ${t} + reparent ${d.length} child(ren)`:`Delete task ${t}`;1===p.length?this.recordSingle(p[0],g):this.recordTransaction(new ii(g,p));for(const t of u)this.dispatchDependencyChanged(ot.DEPENDENCY_REMOVED,t.fromId,t.toId,t.type,t.lag);for(const e of d)this.dispatchTaskMoved(e.id,t,s.parentId);return this.dispatchTaskDeleted(s,l),!0}moveTask(t,e={}){var n,i,r;const s=this.dataManager.getTaskById(t);if(!s)throw new Error(`ApexGantt.moveTask: task with id "${t}" not found`);const o=e.newParentId??void 0;if(o===t)throw new Error(`ApexGantt.moveTask: cannot move task "${t}" onto itself`);if(void 0!==o){if(!this.dataManager.getTaskById(o))throw new Error(`ApexGantt.moveTask: parent "${o}" not found`);let e=o;for(;e;){if(e===t)throw new Error(`ApexGantt.moveTask: cannot move "${t}" under its own descendant`);e=null==(n=this.dataManager.getTaskById(e))?void 0:n.parentId}}if(s.parentId===o)return!0;const a=s.parentId;if(!1===(null==(r=(i=this.options).beforeTaskMove)?void 0:r.call(i,{task:s,oldParentId:a,newParentId:o})))return!1;const l=new li(t,o,this.commandContext);return l.execute(this.commandContext),this.recordSingle(l),this.dispatchTaskMoved(t,a,o),!0}canAddDependency(t,e,n={}){var i,r;if(t===e)return{ok:!1,reason:"self"};if(!this.dataManager.getTaskById(t))return{ok:!1,reason:"task-missing"};if(!this.dataManager.getTaskById(e))return{ok:!1,reason:"task-missing"};const s=this.dataManager.getAllDependencies();if(s.some((n=>n.fromId===t&&n.toId===e)))return{ok:!1,reason:"duplicate"};if(this.wouldCreateCycle(t,e,s))return{ok:!1,reason:"cycle"};if(!this.options.dependencies.allowSummaryDescendantLinks&&this.isAncestorDescendantPair(t,e))return{ok:!1,reason:"summary-descendant"};const o=n.type??"FS",a=n.lag??0;return!1===(null==(r=(i=this.options).beforeDependencyChange)?void 0:r.call(i,{change:"add",fromId:t,toId:e,type:o,lag:a}))?{ok:!1,reason:"hook-veto"}:{ok:!0}}wouldCreateCycle(t,e,n){const i=new Set,r=[e];for(;r.length;){const e=r.pop();if(e===t)return!0;if(!i.has(e)){i.add(e);for(const t of n)t.fromId===e&&r.push(t.toId)}}return!1}isAncestorDescendantPair(t,e){return this.isAncestor(t,e)||this.isAncestor(e,t)}isAncestor(t,e){var n,i;let r=null==(n=this.dataManager.getTaskById(e))?void 0:n.parentId;for(;r;){if(r===t)return!0;r=null==(i=this.dataManager.getTaskById(r))?void 0:i.parentId}return!1}addDependency(t,e,n={}){var i,r;if(!this.dataManager.getTaskById(t))throw new Error(`ApexGantt.addDependency: task "${t}" not found`);if(!this.dataManager.getTaskById(e))throw new Error(`ApexGantt.addDependency: task "${e}" not found`);if(this.dataManager.getAllDependencies().find((n=>n.fromId===t&&n.toId===e)))throw new Error(`ApexGantt.addDependency: dependency ${t}→${e} already exists`);const s=n.type??"FS",o=n.lag??0;if(!1===(null==(r=(i=this.options).beforeDependencyChange)?void 0:r.call(i,{change:"add",fromId:t,toId:e,type:s,lag:o})))return!1;const a=new di(t,e,s,o);return a.execute(this.commandContext),this.recordSingle(a),this.dispatchDependencyChanged(ot.DEPENDENCY_ADDED,t,e,s,o),!0}removeDependency(t,e){var n,i;const r=this.dataManager.getAllDependencies().find((n=>n.fromId===t&&n.toId===e));if(!r)throw new Error(`ApexGantt.removeDependency: no dependency ${t}→${e}`);if(!1===(null==(i=(n=this.options).beforeDependencyChange)?void 0:i.call(n,{change:"remove",fromId:t,toId:e,type:r.type,lag:r.lag})))return!1;const s=new hi(t,e,this.commandContext);return s.execute(this.commandContext),this.recordSingle(s),this.dispatchDependencyChanged(ot.DEPENDENCY_REMOVED,t,e,r.type,r.lag),!0}undo(){return!!this.history.canUndo()&&(this.history.undo(this.commandContext),this.dispatchHistoryChange("undo"),!0)}redo(){return!!this.history.canRedo()&&(this.history.redo(this.commandContext),this.dispatchHistoryChange("redo"),!0)}canUndo(){return this.history.canUndo()}canRedo(){return this.history.canRedo()}clearHistory(){0===this.history.size().undo&&0===this.history.size().redo||(this.history.clear(),this.dispatchHistoryChange("clear"))}getHistorySize(){return this.history.size()}normalizeSortBy(t){return void 0===t?[{key:Bt.StartTime,direction:"asc"}]:Array.isArray(t)?[...t]:[t]}rebuildSort(){const t=zt(this.options.columnConfig),e=function(t,e,n){if(!t.length)return null;const i=new Map(e.map((t=>[t.key,t]))),r=t.map((t=>({column:i.get(t.key),dir:"desc"===t.direction?-1:1,key:t.key})));return(t,e)=>{for(const{column:i,dir:s,key:o}of r){let r;if(r=(null==i?void 0:i.comparator)?i.comparator(t,e):Xt(Zt(t,o,i,n),Zt(e,o,i,n)),0!==r)return r*s}return 0}}(this.sortCriteria,t,{inputDateFormat:this.options.inputDateFormat,calendar:this.dataManager.getCalendar()});this.dataManager.setSortComparator(e)}applyInitialSortAndFilter(){this.sortCriteria=this.normalizeSortBy(this.options.sortBy),this.rebuildSort(),this.options.filterRules?(this.filterRuleSet=this.options.filterRules,this.activeFilter=this.compileRules(this.filterRuleSet)):this.activeFilter=this.options.filterBy??null,this.dataManager.setFilterPredicate(this.activeFilter)}reapplyFilterAfterUpdate(t){"filterRules"in t&&(this.filterRuleSet=t.filterRules??null,this.quickFilterQuery=""),"filterBy"in t&&(this.activeFilter=t.filterBy??null,this.filterRuleSet=null,this.quickFilterQuery=""),this.filterRuleSet?this.activeFilter=this.compileRules(this.filterRuleSet):this.quickFilterQuery&&(this.activeFilter=this.buildQuickFilterPredicate(this.quickFilterQuery.trim())),this.dataManager.setFilterPredicate(this.activeFilter)}filterContext(){return{inputDateFormat:this.options.inputDateFormat,calendar:this.dataManager.getCalendar()}}compileRules(t){return function(t,e,n){if(!t||0===t.rules.length)return null;const i=new Map(e.map((t=>[t.key,t]))),r=t.rules,s="any"!==t.match;return t=>s?r.every((e=>rn(t,e,i.get(e.field),n))):r.some((e=>rn(t,e,i.get(e.field),n)))}(t,zt(this.options.columnConfig),this.filterContext())}normalizeGroupBy(t){return null==t?null:"string"==typeof t?{field:t}:t}rebuildGrouping(){if(!this.groupCriterion)return void this.dataManager.setGroupBy(null);const t=zt(this.options.columnConfig).find((t=>{var e;return t.key===(null==(e=this.groupCriterion)?void 0:e.field)}));this.dataManager.setGroupBy(this.groupCriterion,t,this.messages.groupNone)}applyInitialGrouping(){this.groupCriterion=this.normalizeGroupBy(this.options.groupBy),this.rebuildGrouping()}reapplyGroupingAfterUpdate(t){"groupBy"in t&&(this.groupCriterion=this.normalizeGroupBy(t.groupBy)),this.rebuildGrouping()}groupBy(t){this.groupCriterion=this.normalizeGroupBy(t),this.rebuildGrouping(),this.render(),this.dispatchGroupChange()}clearGrouping(){this.groupCriterion&&(this.groupCriterion=null,this.dataManager.setGroupBy(null),this.render(),this.dispatchGroupChange())}getGroupBy(){return this.groupCriterion?{...this.groupCriterion}:null}isGrouping(){return null!==this.groupCriterion}dispatchGroupChange(){const t={active:this.isGrouping(),field:this.groupCriterion?String(this.groupCriterion.field):null,groupCount:this.groupCriterion?this.dataManager.getFlatVisibleTasks().filter((t=>t.isGroup)).length:0,timestamp:Date.now()};this.element.dispatchEvent(new CustomEvent(ot.GROUP_CHANGE,{detail:t,bubbles:!0,composed:!0}))}sort(t){this.sortCriteria=Array.isArray(t)?[...t]:[t],this.rebuildSort(),this.render(),this.dispatchSortChange()}clearSort(){0!==this.sortCriteria.length&&(this.sortCriteria=[],this.rebuildSort(),this.render(),this.dispatchSortChange())}getSort(){return this.sortCriteria.map((t=>({key:t.key,direction:t.direction??"asc"})))}toggleSort(t,e={}){const n=zt(this.options.columnConfig).find((e=>e.key===t));if(!n||!Qt(n))return;const i=this.sortCriteria.findIndex((e=>e.key===t)),r=(i>=0?this.sortCriteria[i].direction:void 0)??"asc";if(e.append){const e=this.sortCriteria.map((t=>({...t})));i<0?e.push({key:t,direction:"asc"}):"asc"===r?e[i]={key:t,direction:"desc"}:e.splice(i,1),this.sortCriteria=e}else i<0||this.sortCriteria.length>1?this.sortCriteria=[{key:t,direction:"asc"}]:this.sortCriteria="asc"===r?[{key:t,direction:"desc"}]:[];this.rebuildSort(),this.render(),this.dispatchSortChange()}filter(t){this.activeFilter=t,this.dataManager.setFilterPredicate(t),this.render(),this.dispatchFilterChange()}clearFilter(){this.activeFilter&&(this.activeFilter=null,this.quickFilterQuery="",this.filterRuleSet=null,this.dataManager.setFilterPredicate(null),this.render(),this.dispatchFilterChange())}isFiltered(){return null!==this.activeFilter}setFilterRules(t){this.filterRuleSet=t&&t.rules.length>0?t:null,this.quickFilterQuery="",this.activeFilter=this.compileRules(this.filterRuleSet),this.dataManager.setFilterPredicate(this.activeFilter),this.render(),this.dispatchFilterChange()}getFilterRules(){return this.filterRuleSet?{match:this.filterRuleSet.match,rules:this.filterRuleSet.rules.map((t=>({...t})))}:null}handleColumnResize(t,e){null==e?this.columnWidthOverrides.delete(t):this.columnWidthOverrides.set(t,e),this.dispatchColumnResize(t,e),this.schedulePersist()}dispatchColumnResize(t,e){const n={key:t,width:e,widths:this.getColumnWidths(),timestamp:Date.now()};this.element.dispatchEvent(new CustomEvent(ot.COLUMN_RESIZE,{detail:n,bubbles:!0,composed:!0}))}setColumnWidth(t,e){!Number.isFinite(e)||e<=0||(this.columnWidthOverrides.set(String(t),Math.round(e)),this.render(),this.dispatchColumnResize(String(t),Math.round(e)),this.schedulePersist())}resetColumnWidths(t){if(void 0===t){if(0===this.columnWidthOverrides.size)return;this.columnWidthOverrides.clear()}else if(!this.columnWidthOverrides.delete(String(t)))return;this.render(),this.dispatchColumnResize(void 0===t?"*":String(t),null),this.schedulePersist()}getColumnWidths(){return Object.fromEntries(this.columnWidthOverrides)}handleColumnReorder(t,e){this.columnOrder=e,this.render(),this.dispatchColumnReorder(e,t),this.schedulePersist()}dispatchColumnReorder(t,e){const n={order:[...t],movedKey:e,timestamp:Date.now()};this.element.dispatchEvent(new CustomEvent(ot.COLUMN_REORDER,{detail:n,bubbles:!0,composed:!0}))}setColumnOrder(t){this.columnOrder=t.map(String),this.render(),this.dispatchColumnReorder(this.columnOrder,null),this.schedulePersist()}getColumnOrder(){return Ot(zt(this.options.columnConfig),this.columnOrder??void 0).map((t=>String(t.key)))}scrollToTask(t){const e=this.dataManager.getTaskById(t);if(!e)return!1;const n=this.currentGeometry??this.buildFreshGeometry(),i=this.options.rowHeight;let r=!1;const s=this.domCache.timelineBodyWrapper;if(s&&s.clientWidth>0){const t=It.calculateX(e,n,this.options),o=It.calculateWidth(e,n,this.options),a=i,l=s.scrollLeft,d=l+s.clientWidth;let h=l;t<l?h=t-a:t+o>d&&(h=t+o-s.clientWidth+a),h=Math.max(0,h),Math.round(h)!==Math.round(l)&&(s.scrollLeft=h,r=!0)}const o=this.element.querySelector(sn.splitViewContainer)??this.domCache.ganttContainer,{indexMap:a}=this.dataManager.getFlatVisibleIndex(),l=a.get(t);if(o&&void 0!==l&&o.clientHeight>0){const t=2*i,e=t+l*i,n=e+i,s=o.scrollTop;let a=s;e<s+t?a=e-t:n>s+o.clientHeight&&(a=n-o.clientHeight),a=Math.max(0,a),Math.round(a)!==Math.round(s)&&(o.scrollTop=a,r=!0)}return r}getState(){var t,e,n;const i=null==(t=this.element)?void 0:t.querySelector(sn.horizontalScroll),r=null==(e=this.element)?void 0:e.querySelector(sn.splitViewContainer);return{version:1,zoom:this.pixelsPerMs*it,scroll:{horizontal:(null==i?void 0:i.scrollLeft)??0,vertical:(null==r?void 0:r.scrollTop)??0},collapsed:this.dataManager.getFlatTasks().filter((t=>t.collapsed)).map((t=>t.id)),selected:(null==(n=this.selectionManager)?void 0:n.captureState())??[],sort:this.getSort().map((t=>({key:String(t.key),direction:t.direction??"asc"}))),filterRules:this.getFilterRules(),quickFilter:this.quickFilterQuery||void 0,group:this.groupCriterion?{field:String(this.groupCriterion.field),direction:this.groupCriterion.direction??"asc"}:null,columnWidths:this.columnWidthOverrides.size?this.getColumnWidths():void 0,columnOrder:this.columnOrder?[...this.columnOrder]:void 0}}setState(t,e={}){var n;if(!t)return;const i=Array.isArray(t.sort),r="filterRules"in t||void 0!==t.quickFilter,s="group"in t;this.isApplyingState=!0;try{this.applySortState(t),this.applyFilterState(t),this.applyGroupState(t),this.applyColumnWidthsState(t),"columnOrder"in t&&(this.columnOrder=t.columnOrder?[...t.columnOrder]:null),Array.isArray(t.collapsed)&&this.dataManager.setCollapsedTasks(t.collapsed),"number"==typeof t.zoom&&t.zoom>0&&(this.pixelsPerMs=gn.clamp(t.zoom/it),this.needsAutoFitZoom=!1,this.currentGeometry=null),this.render(),Array.isArray(t.selected)&&(null==(n=this.selectionManager)||n.setSelectedTasks(t.selected)),t.scroll&&this.applyScrollState(t.scroll)}finally{this.isApplyingState=!1}e.silent||(i&&this.dispatchSortChange(),r&&this.dispatchFilterChange(),s&&this.dispatchGroupChange()),this.schedulePersist()}applySortState(t){Array.isArray(t.sort)&&(this.sortCriteria=t.sort.map((t=>({key:t.key,direction:t.direction}))),this.rebuildSort())}applyColumnWidthsState(t){"columnWidths"in t&&(this.columnWidthOverrides=new Map(Object.entries(t.columnWidths??{})))}applyGroupState(t){"group"in t&&(this.groupCriterion=t.group?{field:t.group.field,direction:t.group.direction}:null,this.rebuildGrouping())}applyFilterState(t){if("filterRules"in t){const e=t.filterRules&&t.filterRules.rules.length>0?t.filterRules:null;this.filterRuleSet=e,this.quickFilterQuery="",this.activeFilter=this.compileRules(e),this.dataManager.setFilterPredicate(this.activeFilter)}else if(void 0!==t.quickFilter){const e=t.quickFilter.trim();this.quickFilterQuery=t.quickFilter,this.filterRuleSet=null,this.activeFilter=e?this.buildQuickFilterPredicate(e):null,this.dataManager.setFilterPredicate(this.activeFilter)}}applyScrollState(t){requestAnimationFrame((()=>{var e,n,i;const r=null==(e=this.element)?void 0:e.querySelector(sn.horizontalScroll),s=null==(n=this.element)?void 0:n.querySelector(sn.timelineHeader),o=null==(i=this.element)?void 0:i.querySelector(sn.splitViewContainer);r&&(r.scrollLeft=t.horizontal),s&&(s.scrollLeft=t.horizontal),o&&(o.scrollTop=t.vertical)}))}resolvePersistence(){const t=this.options.persistState;if(!t)return null;if("undefined"==typeof window)return null;let e;try{if(e=window.localStorage,!e)return null}catch{return null}return{storage:e,key:"object"==typeof t&&t.key||"apexgantt-state"}}schedulePersist(){this.isApplyingState||this.resolvePersistence()&&(null!==this.persistTimer&&clearTimeout(this.persistTimer),this.persistTimer=setTimeout((()=>{this.persistTimer=null,this.writePersistedState()}),200))}writePersistedState(){const t=this.resolvePersistence();if(t)try{t.storage.setItem(t.key,JSON.stringify(this.getState()))}catch(t){z.warn("[ApexGantt] Failed to persist UI state:",t)}}restorePersistedState(){const t=this.resolvePersistence();if(!t)return!1;let e;try{e=t.storage.getItem(t.key)}catch{return!1}if(!e)return!1;try{const t=JSON.parse(e);return!(!t||1!==t.version)&&(this.setState(t,{silent:!0}),!0)}catch(t){return z.warn("[ApexGantt] Failed to restore persisted UI state:",t),!1}}attachPersistenceListeners(){this.resolvePersistence()&&!this.persistChangeHandler&&(this.persistChangeHandler=()=>this.schedulePersist(),this.element.addEventListener(ot.SELECTION_CHANGE,this.persistChangeHandler),this.element.addEventListener("scroll",this.persistChangeHandler,{capture:!0}))}maybeRestorePersistedStateOnce(){return!this.stateRestoreAttempted&&!this.isApplyingState&&(this.stateRestoreAttempted=!0,this.attachPersistenceListeners(),this.restorePersistedState())}detachPersistence(){var t,e;null!==this.persistTimer&&(clearTimeout(this.persistTimer),this.persistTimer=null),this.persistChangeHandler&&(null==(t=this.element)||t.removeEventListener(ot.SELECTION_CHANGE,this.persistChangeHandler),null==(e=this.element)||e.removeEventListener("scroll",this.persistChangeHandler,{capture:!0}),this.persistChangeHandler=null)}applyAutoFitZoomIfNeeded(){if(!this.needsAutoFitZoom)return;const t=this.computeAutoFitPixelsPerMs();null!=t&&(this.pixelsPerMs=t,this.needsAutoFitZoom=!1)}computeChangedVisibleIds(t,e){const n=new Set(e.map((t=>t.id)));if(0!==t.size)return new Set([...t,...n].filter((e=>!t.has(e)||!n.has(e))))}exportButtonLabel(){switch(this.options.exportFormat){case"png":return this.messages.exportAsPng;case"pdf":return this.messages.exportAsPdf;default:return this.messages.exportAsSvg}}async exportChart(t=this.options.exportFormat){var e,n;if(!this.element)return z.error("Export failed: Chart element not found"),void alert(this.messages.exportFailedNoChart);if(!this.element.querySelector(sn.ganttContainer))return void z.error("Export failed: Gantt container not found in chart");const i=(null==(e=this.virtualScrollCoordinator)?void 0:e.expandAllForExport())??null;try{await Ke(this.element,t,{background:this.options.backgroundColor})}catch(t){z.error("Export error:",t),alert(this.messages.exportFailedGeneric)}finally{null==(n=this.virtualScrollCoordinator)||n.restoreAfterExport(i)}}dispatchSortChange(){const t={criteria:this.sortCriteria.map((t=>({key:String(t.key),direction:t.direction??"asc"}))),timestamp:Date.now()};this.element.dispatchEvent(new CustomEvent(ot.SORT_CHANGE,{detail:t,bubbles:!0,composed:!0}))}dispatchFilterChange(){const t={active:this.isFiltered(),visibleCount:this.dataManager.getFlatVisibleTasks().length,timestamp:Date.now()};this.element.dispatchEvent(new CustomEvent(ot.FILTER_CHANGE,{detail:t,bubbles:!0,composed:!0}))}buildQuickFilterInput(){var t;const e=(null==(t=this.options.quickFilter)?void 0:t.placeholder)??this.messages.quickFilterPlaceholder,n=this.chartContext.createElement("div");n.className="gantt-quick-filter";const i=this.chartContext.createElement("input");return i.type="search",i.className="gantt-quick-filter-input",i.value=this.quickFilterQuery,i.placeholder=e,i.setAttribute("aria-label",e),i.autocomplete="off",i.addEventListener("keydown",(t=>t.stopPropagation())),i.addEventListener("input",(()=>{this.quickFilterCaret=i.selectionStart??i.value.length,this.applyQuickFilter(i.value)})),n.append(i),n}applyQuickFilter(t){this.quickFilterQuery=t,this.filterRuleSet=null,this.activeFilter=this.buildQuickFilterPredicate(t.trim()),this.dataManager.setFilterPredicate(this.activeFilter),this.render(),this.dispatchFilterChange(),this.restoreQuickFilterFocus()}buildQuickFilterPredicate(t){if(!t)return null;const e=this.options.quickFilter,n=(null==e?void 0:e.fields)??["name"],i=(null==e?void 0:e.caseSensitive)??!1,r=i?t:t.toLowerCase();return t=>n.some((e=>{const n=t[e];return"string"==typeof n&&(i?n:n.toLowerCase()).includes(r)}))}restoreQuickFilterFocus(){var t;const e=null==(t=this.domCache.actionsContainer)?void 0:t.querySelector(".gantt-quick-filter-input");if(e instanceof HTMLInputElement){e.focus();const t=Math.min(this.quickFilterCaret,e.value.length);try{e.setSelectionRange(t,t)}catch{}}}buildFilterBuilder(t){var e;const n=this.chartContext.createElement("div");n.className="gantt-filter-builder";const i=(null==(e=this.filterRuleSet)?void 0:e.rules.length)??0,r=this.chartContext.createElement("button");return r.type="button",r.className="gantt-filter-builder-button",i>0&&r.classList.add("is-active"),r.setAttribute("aria-haspopup","dialog"),r.setAttribute("aria-expanded",String(this.filterBuilderOpen)),r.innerHTML=`${Jt.filter}<span>${$t(this.messages.filterButton)}</span>${i>0?`<span class="gantt-filter-builder-badge">${i}</span>`:""}`,r.addEventListener("click",(()=>this.toggleFilterBuilder(t))),n.append(r),this.filterBuilderOpen&&n.append(this.buildFilterPopover(t)),n}toggleFilterBuilder(t){this.filterBuilderOpen=!this.filterBuilderOpen,this.filterBuilderOpen&&(this.filterBuilderDraft=this.cloneRuleSet(this.filterRuleSet)??{match:"all",rules:[]}),this.renderToolbar(t)}cloneRuleSet(t){return t?{match:t.match,rules:t.rules.map((t=>({...t})))}:null}buildFilterPopover(t){const e=this.filterBuilderDraft??{match:"all",rules:[]},n=zt(this.options.columnConfig).filter((t=>t.key!==Bt.ProgressRing)),i=this.chartContext.createElement("div");i.className="gantt-filter-popover",i.setAttribute("role","dialog"),i.setAttribute("aria-label",this.messages.filterHeading),i.addEventListener("keydown",(t=>t.stopPropagation()));const r=this.chartContext.createElement("div");r.className="gantt-filter-popover-header";const s=this.chartContext.createElement("span");s.textContent=this.messages.filterMatchLabel;const o=this.chartContext.createElement("select");o.className="gantt-filter-match",o.innerHTML=`<option value="all">${this.messages.filterMatchAll}</option><option value="any">${this.messages.filterMatchAny}</option>`,o.value=e.match,o.addEventListener("change",(()=>{e.match="any"===o.value?"any":"all"})),r.append(s,o),i.append(r);const a=this.chartContext.createElement("div");if(a.className="gantt-filter-rows",0===e.rules.length){const t=this.chartContext.createElement("div");t.className="gantt-filter-empty",t.textContent=this.messages.filterNoConditions,a.append(t)}else e.rules.forEach(((i,r)=>a.append(this.buildFilterRow(i,r,n,e,t))));i.append(a);const l=this.chartContext.createElement("div");l.className="gantt-filter-popover-footer";const d=this.chartContext.createElement("button");d.type="button",d.className="gantt-filter-add",d.textContent=this.messages.filterAddCondition,d.addEventListener("click",(()=>{const i=n[0],r=i?Je(i.key):"text";e.rules.push({field:(null==i?void 0:i.key)??Bt.Name,operator:tn(r)[0],value:""}),this.renderToolbar(t)}));const h=this.chartContext.createElement("div");h.className="gantt-filter-footer-spacer";const c=this.chartContext.createElement("button");c.type="button",c.className="gantt-filter-clear",c.textContent=this.messages.filterClear,c.addEventListener("click",(()=>{this.filterBuilderDraft={match:"all",rules:[]},this.clearFilter()}));const u=this.chartContext.createElement("button");return u.type="button",u.className="gantt-filter-apply",u.textContent=this.messages.filterApply,u.addEventListener("click",(()=>{this.setFilterRules(this.cloneRuleSet(e))})),l.append(d,h,c,u),i.append(l),i}buildFilterRow(t,e,n,i,r){const s=this.chartContext.createElement("div");s.className="gantt-filter-row";const o=this.chartContext.createElement("select");o.className="gantt-filter-field",o.innerHTML=n.map((t=>`<option value="${$t(String(t.key))}">${$t(t.title)}</option>`)).join(""),o.value=String(t.field),o.addEventListener("change",(()=>{i.rules[e]={field:o.value,operator:tn(Je(o.value))[0],value:""},this.renderToolbar(r)}));const a=Je(t.field),l=tn(a),d=this.chartContext.createElement("select");d.className="gantt-filter-operator",d.innerHTML=l.map((t=>`<option value="${t}">${$t(this.messages.filterOperatorLabel(t))}</option>`)).join(""),d.value=l.includes(t.operator)?t.operator:l[0],d.addEventListener("change",(()=>{i.rules[e]={...i.rules[e],operator:d.value},this.renderToolbar(r)})),s.append(o,d);if("isEmpty"!==t.operator&&"notEmpty"!==t.operator){const n=this.chartContext.createElement("input");n.className="gantt-filter-value",n.type="date"===a?"date":"number"===a?"number":"text",n.value=null!=t.value?String(t.value):"",n.addEventListener("input",(()=>{i.rules[e]={...i.rules[e],value:n.value}})),s.append(n)}else{const t=this.chartContext.createElement("span");t.className="gantt-filter-value-placeholder",s.append(t)}const h=this.chartContext.createElement("button");return h.type="button",h.className="gantt-filter-remove",h.setAttribute("aria-label",this.messages.filterRemoveCondition),h.innerHTML=Jt.close,h.addEventListener("click",(()=>{i.rules.splice(e,1),this.renderToolbar(r)})),s.append(h),s}attachUndoRedoShortcuts(){this.undoRedoKeyHandler&&(this.element.removeEventListener("keydown",this.undoRedoKeyHandler),this.undoRedoKeyHandler=null),this.options.history.enabled&&(this.undoRedoKeyHandler=t=>{if(!(t.ctrlKey||t.metaKey)||t.altKey)return;const e=t.target;if(e&&("INPUT"===e.tagName||"TEXTAREA"===e.tagName||e.isContentEditable))return;const n=t.key.toLowerCase();if("y"===n&&!t.shiftKey||"z"===n&&t.shiftKey){if(!this.canRedo())return;return t.preventDefault(),void this.redo()}if("z"===n&&!t.shiftKey){if(!this.canUndo())return;t.preventDefault(),this.undo()}},this.element.addEventListener("keydown",this.undoRedoKeyHandler))}depthOf(t){let e=0,n=this.dataManager.getTaskById(t);for(;null==n?void 0:n.parentId;)e++,n=this.dataManager.getTaskById(n.parentId);return e}dispatchTaskAdded(t,e){const n={taskId:t.id,task:t,parentId:e,timestamp:Date.now()};this.element.dispatchEvent(new CustomEvent(ot.TASK_ADDED,{detail:n,bubbles:!0,composed:!0}))}dispatchTaskDeleted(t,e){const n={taskId:t.id,task:t,removedDescendantIds:e,timestamp:Date.now()};this.element.dispatchEvent(new CustomEvent(ot.TASK_DELETED,{detail:n,bubbles:!0,composed:!0}))}dispatchTaskMoved(t,e,n){const i={taskId:t,oldParentId:e,newParentId:n,timestamp:Date.now()};this.element.dispatchEvent(new CustomEvent(ot.TASK_MOVED,{detail:i,bubbles:!0,composed:!0}))}dispatchHistoryChange(t){var e,n;const i=this.history.size(),r={kind:t,canUndo:this.history.canUndo(),canRedo:this.history.canRedo(),undoSize:i.undo,redoSize:i.redo,topUndoLabel:null==(e=this.history.peekUndo())?void 0:e.label,topRedoLabel:null==(n=this.history.peekRedo())?void 0:n.label,timestamp:Date.now()};this.element.dispatchEvent(new CustomEvent(ot.HISTORY_CHANGE,{detail:r,bubbles:!0,composed:!0}))}attachContextMenuHandler(){this.contextMenuHandler&&(this.element.removeEventListener("contextmenu",this.contextMenuHandler),this.contextMenuHandler=null),this.contextMenuManager&&(this.contextMenuHandler=t=>{var e;const n=t.target,i=null==n?void 0:n.closest("[data-taskid]"),r=null==i?void 0:i.getAttribute("data-taskid");if(!r)return;if(!this.dataManager.getTaskById(r))return;t.preventDefault();const s=this.buildContextMenuItems(r);null==(e=this.contextMenuManager)||e.show(t.clientX,t.clientY,s)},this.element.addEventListener("contextmenu",this.contextMenuHandler))}buildContextMenuItems(t){var e;const n=[],i=this.dataManager.getTaskById(t);if(!i)return n;const r=this.messages;this.options.enableTaskEdit&&n.push({id:"edit",label:r.editTask,onClick:()=>{const e=this.chartContext.querySelector(`[data-taskid="${CSS.escape(t)}"].bar-timeline`);null==e||e.dispatchEvent(new MouseEvent("dblclick",{bubbles:!0}))}}),n.push({id:"add-child",label:r.addChildTask,onClick:()=>this.addPlaceholderTask({parentId:t})}),n.push({id:"add-sibling",label:r.addSiblingTask,onClick:()=>this.addPlaceholderTask({parentId:i.parentId})});const s=this.findPreviousSiblingId(t),o=null!==s,a=void 0!==i.parentId;if((o||a)&&n.push({separator:!0}),o&&n.push({id:"indent",label:r.indent,onClick:()=>{try{this.moveTask(t,{newParentId:s})}catch(e){z.warn(`[ApexGantt] context indent failed for "${t}":`,e)}}}),a){const s=i.parentId?(null==(e=this.dataManager.getTaskById(i.parentId))?void 0:e.parentId)??null:null;n.push({id:"outdent",label:r.outdent,onClick:()=>{try{this.moveTask(t,{newParentId:s})}catch(e){z.warn(`[ApexGantt] context outdent failed for "${t}":`,e)}}})}return n.push({separator:!0}),n.push({id:"delete",label:this.dataManager.hasChildren(t)?r.deleteTaskWithChildren:r.deleteTask,onClick:()=>{try{this.deleteTask(t,{cascade:"children"})}catch(e){z.warn(`[ApexGantt] context delete failed for "${t}":`,e)}}}),n}snapStepMs(){const{snapUnit:t,snapValue:e}=this.options;return("minute"===t?et:"hour"===t?nt:it)*Math.max(1,e)}commitDrawnTask(t,e,n){const i=this.currentGeometry;if(!i)return;const r=this.options.inputDateFormat,s=W(this.options.barLabel),o=i.dateForX(t-s).valueOf(),a=i.dateForX(e-s).valueOf(),l=Math.min(o,a),d=Math.max(o,a),h=this.snapStepMs(),c=Math.round(l/h)*h,u=Math.round(d/h)*h,p=Math.max(1,Math.round((u-c)/h)),m=c+(!j(r)?p-1:p)*h,g=`task-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`;try{this.addTask({id:g,name:"New task",startTime:S(c).format(r),endTime:S(m).format(r),type:ne.Task,progress:0})}catch(t){z.warn("[ApexGantt] draw-to-create task failed:",t)}}addPlaceholderTask(t){const e=this.getPaddedDateRange(0),n=this.options.inputDateFormat,i=e[0],r=i.add(7,"day"),s=`task-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`;try{this.addTask({id:s,name:"New task",startTime:i.format(n),endTime:r.format(n),type:ne.Task,progress:0},t)}catch(t){z.warn("[ApexGantt] addPlaceholderTask failed:",t)}}addTaskFromToolbar(){this.addPlaceholderTask({})}deleteSelectedFromToolbar(){var t,e;const n=(null==(t=this.selectionManager)?void 0:t.getSelectedIds())??new Set;if(0===n.size)return;const i=[...n].filter((t=>{var e,i;let r=null==(e=this.dataManager.getTaskById(t))?void 0:e.parentId;for(;r;){if(n.has(r))return!1;r=null==(i=this.dataManager.getTaskById(r))?void 0:i.parentId}return!0}));for(const t of i)try{this.deleteTask(t,{cascade:"children"})}catch(e){z.warn(`[ApexGantt] toolbar delete failed for "${t}":`,e)}null==(e=this.selectionManager)||e.clearSelection()}buildKeyboardEditingCommands(){return{delete:t=>{try{this.deleteTask(t,{cascade:"children"})}catch(e){z.warn(`[ApexGantt] keyboard delete failed for "${t}":`,e)}},indent:t=>{const e=this.findPreviousSiblingId(t);if(e)try{this.moveTask(t,{newParentId:e})}catch(e){z.warn(`[ApexGantt] keyboard indent failed for "${t}":`,e)}},outdent:t=>{const e=this.dataManager.getTaskById(t);if(!(null==e?void 0:e.parentId))return;const n=this.dataManager.getTaskById(e.parentId);try{this.moveTask(t,{newParentId:(null==n?void 0:n.parentId)??null})}catch(e){z.warn(`[ApexGantt] keyboard outdent failed for "${t}":`,e)}}}}findPreviousSiblingId(t){const e=this.dataManager.getTaskById(t);if(!e)return null;const n=this.dataManager.getFlatVisibleTasks(),i=n.findIndex((e=>e.id===t));for(let t=i-1;t>=0;t--)if(n[t].parentId===e.parentId)return n[t].id;return null}dispatchDependencyChanged(t,e,n,i,r){const s={fromId:e,toId:n,type:i,lag:r,timestamp:Date.now()};this.element.dispatchEvent(new CustomEvent(t,{detail:s,bubbles:!0,composed:!0}))}commitInlineEdit(t,e){var n,i;const r=this.dataManager.getTaskById(t);if(r&&!1!==(null==(i=(n=this.options).beforeTaskUpdate)?void 0:i.call(n,{task:r,updates:e})))try{this.element.dispatchEvent(new CustomEvent(ot.TASK_UPDATE,{detail:{taskId:t,updates:e,updatedTask:{...r,...e},timestamp:Date.now()},bubbles:!0,composed:!0}));const n=new si(t,e,this.commandContext);n.execute(this.commandContext),this.recordSingle(n);const i=this.dataManager.getTaskById(t)??{...r,...e};this.element.dispatchEvent(new CustomEvent(ot.TASK_UPDATE_SUCCESS,{detail:{taskId:t,updatedTask:i,timestamp:Date.now()},bubbles:!0,composed:!0}))}catch(e){z.warn(`[ApexGantt] Inline edit failed for task ${t}:`,e),this.element.dispatchEvent(new CustomEvent(ot.TASK_UPDATE_ERROR,{detail:{taskId:t,error:e instanceof Error?e:new Error(String(e)),timestamp:Date.now()},bubbles:!0,composed:!0}))}}getSelectedTasks(){var t;return(null==(t=this.selectionManager)?void 0:t.getSelectedTasks())??[]}setSelectedTasks(t){var e;null==(e=this.selectionManager)||e.setSelectedTasks(t)}clearSelection(){var t;null==(t=this.selectionManager)||t.clearSelection()}zoomIn(){this.zoomManager.zoomIn()}zoomOut(){this.zoomManager.zoomOut()}normalizeDimension(t){return"number"==typeof t?`${t}px`:t}setupContainerResizeObserver(){if(!this.element)return;this.containerResizeObserver&&this.containerResizeObserver.disconnect();const t=this.normalizeDimension(this.options.width),e=this.normalizeDimension(this.options.height),n="string"==typeof t&&t.includes("%"),i="string"==typeof e&&e.includes("%");(n||i)&&(this.lastKnownWidth=this.element.offsetWidth,this.lastKnownHeight=this.element.offsetHeight,this.containerResizeObserver=new ResizeObserver((t=>{for(const e of t){const t=e.contentRect.width,n=e.contentRect.height,i=Math.abs(t-this.lastKnownWidth)>1,r=Math.abs(n-this.lastKnownHeight)>1;(i||r)&&(this.lastKnownWidth=t,this.lastKnownHeight=n,this.handleContainerResize())}})),this.containerResizeObserver.observe(this.element))}handleContainerResize(){null!==this.resizeDebounceTimer&&window.clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout((()=>{this.performResize(),this.resizeDebounceTimer=null}),150)}performResize(){if(!this.element||this.isDestroyed())return;const t=this.normalizeDimension(this.options.width),e=this.normalizeDimension(this.options.height),n="string"==typeof t&&t.includes("%"),i="string"==typeof e&&e.includes("%");if(n){window.getComputedStyle(this.element.parentElement||this.element).width!==window.getComputedStyle(this.element).width&&requestAnimationFrame((()=>{this.scrollManager.positionHorizontalScrollbar(),this.scrollManager.updateHorizontalScrollbarContent(),this.layoutManager.syncTasksColumnWidths()}))}i&&requestAnimationFrame((()=>{this.layoutManager.fillEmptyRowsAfterRender()}))}destroy(){var t,e,n,i,r,s,o;this._destroyed=!0;try{this.virtualScrollCoordinator&&(this.virtualScrollCoordinator.destroy(),this.virtualScrollCoordinator=null),this.containerResizeObserver&&(this.containerResizeObserver.disconnect(),this.containerResizeObserver=null),null!==this.resizeDebounceTimer&&(window.clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=null),this.cancelPendingAfterActionsRaf(),this.detachPersistence(),this.zoomManager.cleanup(),this.scrollManager.cleanup(),this.crosshairManager.detach(),null==(t=this.keyboardNavigationManager)||t.detach(),this.contextMenuHandler&&(this.element.removeEventListener("contextmenu",this.contextMenuHandler),this.contextMenuHandler=null),this.undoRedoKeyHandler&&(this.element.removeEventListener("keydown",this.undoRedoKeyHandler),this.undoRedoKeyHandler=null),null==(e=this.contextMenuManager)||e.destroy(),null==(n=this.selectionManager)||n.destroy(),null==(i=this.dependencyEditManager)||i.detach(),null==(r=this.dependencyDrawManager)||r.detach(),null==(s=this.drawTaskManager)||s.detach(),null==(o=this.scrollButtonsManager)||o.detach(),this.reducedMotionMQL&&this.reducedMotionHandler&&(this.reducedMotionMQL.removeEventListener("change",this.reducedMotionHandler),this.reducedMotionMQL=null,this.reducedMotionHandler=null),this.cleanupEventListeners(),this.cleanupTooltips(),this.cleanupDependencyArrows(),this.columnRenderManager.destroy(),this.element.innerHTML="",this.clearDomCache(),super.destroy()}catch(t){z.error("Error during ApexGantt destruction:",t)}}isDestroyed(){return this._destroyed||!this.element}}const mi=["#3B82F6","#EF4444","#10B981","#F59E0B","#8B5CF6","#EC4899","#06B6D4","#84CC16"];function gi(t,e,n,i,r){const s=`width:${e}px;height:${e}px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;margin-left:${0===n?"0":`-${n}px`};border:2px solid ${$t(i)};box-sizing:border-box;overflow:hidden;flex-shrink:0;`,o=$t(t.name);if(t.avatarUrl)return`<span class="apexgantt-avatar" style="${s}" title="${o}"><img src="${$t(t.avatarUrl)}" alt="${o}" style="width:100%;height:100%;object-fit:cover;display:block" /></span>`;const a=t.initials??function(t){const e=t.trim().split(/\s+/);return 0===e.length?"":1===e.length?e[0].slice(0,2).toUpperCase():(e[0][0]+e[e.length-1][0]).toUpperCase()}(t.name),l=t.color??r??function(t){let e=0;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e|=0;return mi[Math.abs(e)%mi.length]}(t.name),d=Math.max(10,Math.round(.4*e));return`<span class="apexgantt-avatar" style="${s}background:${$t(l)};color:#fff;font-size:${d}px;font-weight:600;line-height:1" title="${o}">${$t(a)}</span>`}const fi=Object.freeze(Object.defineProperty({__proto__:null,avatars:function(t){const{accessor:e,max:n=4,size:i=24,overlap:r=8,borderColor:s="#FFFFFF",fallbackColor:o}=t;return t=>{const a=e(t.task);if(!a||0===a.length)return"";const l=a.slice(0,n),d=a.length-l.length,h=l.map(((t,e)=>gi(t,i,0===e?0:r,s,o))).join(""),c=d>0?function(t,e,n,i){const r=Math.max(10,Math.round(.36*e));return`<span class="apexgantt-avatar-overflow" style="width:${e}px;height:${e}px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;margin-left:-${n}px;border:2px solid ${$t(i)};box-sizing:border-box;background:#E5E7EB;color:#374151;font-size:${r}px;font-weight:600;flex-shrink:0;line-height:1;">+${t}</span>`}(d,i,r,s):"";return`<div class="apexgantt-avatar-stack" style="display:inline-flex;align-items:center;vertical-align:middle">${h}${c}</div>`}},progressRing:function(t={}){const{accessor:e=(t=>t.progress),size:n=32,strokeWidth:i=3,progressColor:r="#EF4444",trackColor:s="#E5E7EB",showLabel:o=!0,labelColor:a}=t;return t=>{const l=e(t.task),d="number"==typeof l&&Number.isFinite(l)?l:0,h="function"==typeof r?r(t.task,Math.max(0,Math.min(100,d))):r;return Ft({value:d,size:n,strokeWidth:i,progressColor:h,trackColor:s,showLabel:o,labelColor:a})}}},Symbol.toStringTag,{value:"Module"})),bi={tooltipBGColor:"#FFFFFF",tooltipBorderColor:"#CCCCCC",tooltipTextColor:"#333333",cellBorderColor:"#D0D7DE",rowBackgroundColors:["#FFFFFF","#F5F9FF"],headerBackground:"#EBF3FB",headerTextColor:"#333333",barBackgroundColor:"#87B7FE",barTextColor:"#FFFFFF",arrowColor:"#94A3B8",backgroundColor:"#FFFFFF",textColor:"#000000",borderColor:"#DFE0E1",annotationBgColor:"#DBEAFE",annotationBorderColor:"#60A5FA",dialogBgColor:"#FFFFFF",dialogBorderColor:"#EEEEEE",buttonBgColor:"#87B7FE",buttonTextColor:"#FFFFFF",buttonHoverBgColor:"#1A6FC4",toolbarBgColor:"#FFFFFF",toolbarBorderColor:"#BCBCBC",toolbarHoverBgColor:"#F0F7FF",scrollbarTrackColor:"#F5F5F5",scrollbarThumbColor:"#C1C1C1",scrollbarThumbHoverColor:"#A8A8A8",splitBarColor:"#DEE2E6",splitBarHoverColor:"#87B7FE",splitBarBorderColor:"#BBBBBB",splitBarHandleColor:"#666666",summaryBarColor:"#B9CECE",milestoneColor:"#7C3AED",criticalBarColor:"#E53935",criticalArrowColor:"#E53935"},vi={tooltipBGColor:"#2D2D2D",tooltipBorderColor:"#444444",tooltipTextColor:"#E0E0E0",cellBorderColor:"#3A3A3A",rowBackgroundColors:["#1E1E1E","#252525"],headerBackground:"#2A2A2A",headerTextColor:"#E0E0E0",barBackgroundColor:"#818CF8",barTextColor:"#FFFFFF",arrowColor:"#94A3B8",backgroundColor:"#1E1E1E",textColor:"#E0E0E0",borderColor:"#3A3A3A",annotationBgColor:"#4A2D4D",annotationBorderColor:"#8B4D8F",dialogBgColor:"#2D2D2D",dialogBorderColor:"#444444",buttonBgColor:"#6366F1",buttonTextColor:"#FFFFFF",buttonHoverBgColor:"#4F46E5",toolbarBgColor:"#2D2D2D",toolbarBorderColor:"#444444",toolbarHoverBgColor:"#3A3A3A",scrollbarTrackColor:"#000",scrollbarThumbColor:"#4A4A4A",scrollbarThumbHoverColor:"#5A5A5A",splitBarColor:"#3A3A3A",splitBarHoverColor:"#818CF8",splitBarBorderColor:"#4A4A4A",splitBarHandleColor:"#666666",summaryBarColor:"#8FBCBC",milestoneColor:"#A78BFA",criticalBarColor:"#F87171",criticalArrowColor:"#F87171"};function yi(t){return"dark"===t?vi:bi}"undefined"!=typeof window&&(Object.assign(pi,{ColumnKey:Bt,ColumnList:Pt,renderers:fi,escapeHtml:$t}),window.ApexGantt=pi);export{pi as ApexGantt,Bt as ColumnKey,Pt as ColumnList,ft as DEFAULT_GANTT_MESSAGES,vi as DarkTheme,ln as DataParser,ot as GanttEvents,bi as LightTheme,ct as Orientation,ne as TaskType,pi as default,$t as escapeHtml,yi as getTheme,fi as renderers};
|