@toclocoinc/lattice-grid 1.88.2 → 1.88.3
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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/angular/fesm2022/toclocoinc-lattice-grid-angular.mjs +6 -2
- package/angular/package.json +1 -1
- package/angular/types/toclocoinc-lattice-grid-angular.d.ts +3 -1
- package/docs/API.html +62 -6
- package/docs/api/adapters.html +1 -1
- package/docs/api/ai.html +1 -1
- package/docs/api/alarms.html +1 -1
- package/docs/api/calendar.html +1 -1
- package/docs/api/charts.html +1 -1
- package/docs/api/dashboard.html +1 -1
- package/docs/api/data-router.html +1 -1
- package/docs/api/deckgl.html +1 -1
- package/docs/api/gantt.html +58 -2
- package/docs/api/geometry.html +1 -1
- package/docs/api/grid.html +2 -2
- package/docs/api/index.html +2 -2
- package/docs/api/kanban.html +1 -1
- package/docs/api/kpi.html +1 -1
- package/docs/api/layout.html +1 -1
- package/docs/api/leaflet.html +1 -1
- package/docs/api/list.html +1 -1
- package/docs/api/mapview.html +1 -1
- package/docs/api/mock-socket.html +1 -1
- package/docs/api/presets.html +1 -1
- package/docs/api/tabs.html +1 -1
- package/docs/api/types.html +2 -2
- package/docs/api-detail.html +4 -4
- package/docs/warnings.json +1 -1
- package/lattice-grid.d.ts +1 -1
- package/lattice-grid.esm.min.js +3 -3
- package/lattice-grid.min.cjs +3 -3
- package/lattice-grid.min.js +3 -3
- package/modules/ai.d.ts +1 -1
- package/modules/ai.esm.min.js +2 -2
- package/modules/ai.min.cjs +2 -2
- package/modules/ai.min.js +2 -2
- package/modules/alarms.d.ts +1 -1
- package/modules/alarms.esm.min.js +2 -2
- package/modules/alarms.min.cjs +2 -2
- package/modules/alarms.min.js +2 -2
- package/modules/angular.d.ts +1 -1
- package/modules/angular.esm.min.js +2 -2
- package/modules/angular.min.cjs +2 -2
- package/modules/angular.min.js +2 -2
- package/modules/calendar.d.ts +1 -1
- package/modules/calendar.esm.min.js +2 -2
- package/modules/calendar.min.cjs +2 -2
- package/modules/calendar.min.js +2 -2
- package/modules/chart-alluvial.d.ts +1 -1
- package/modules/chart-alluvial.esm.min.js +1 -1
- package/modules/chart-alluvial.min.cjs +1 -1
- package/modules/chart-alluvial.min.js +1 -1
- package/modules/chart-arc.d.ts +1 -1
- package/modules/chart-arc.esm.min.js +1 -1
- package/modules/chart-arc.min.cjs +1 -1
- package/modules/chart-arc.min.js +1 -1
- package/modules/chart-barrace.d.ts +1 -1
- package/modules/chart-barrace.esm.min.js +1 -1
- package/modules/chart-barrace.min.cjs +1 -1
- package/modules/chart-barrace.min.js +1 -1
- package/modules/chart-bubblemap.d.ts +1 -1
- package/modules/chart-bubblemap.esm.min.js +1 -1
- package/modules/chart-bubblemap.min.cjs +1 -1
- package/modules/chart-bubblemap.min.js +1 -1
- package/modules/chart-bump.d.ts +1 -1
- package/modules/chart-bump.esm.min.js +1 -1
- package/modules/chart-bump.min.cjs +1 -1
- package/modules/chart-bump.min.js +1 -1
- package/modules/chart-calendar.d.ts +1 -1
- package/modules/chart-calendar.esm.min.js +1 -1
- package/modules/chart-calendar.min.cjs +1 -1
- package/modules/chart-calendar.min.js +1 -1
- package/modules/chart-choropleth.d.ts +1 -1
- package/modules/chart-choropleth.esm.min.js +1 -1
- package/modules/chart-choropleth.min.cjs +1 -1
- package/modules/chart-choropleth.min.js +1 -1
- package/modules/chart-decomposition.d.ts +1 -1
- package/modules/chart-decomposition.esm.min.js +1 -1
- package/modules/chart-decomposition.min.cjs +1 -1
- package/modules/chart-decomposition.min.js +1 -1
- package/modules/chart-diverging.d.ts +1 -1
- package/modules/chart-diverging.esm.min.js +1 -1
- package/modules/chart-diverging.min.cjs +1 -1
- package/modules/chart-diverging.min.js +1 -1
- package/modules/chart-dumbbell.d.ts +1 -1
- package/modules/chart-dumbbell.esm.min.js +1 -1
- package/modules/chart-dumbbell.min.cjs +1 -1
- package/modules/chart-dumbbell.min.js +1 -1
- package/modules/chart-fan.d.ts +1 -1
- package/modules/chart-fan.esm.min.js +1 -1
- package/modules/chart-fan.min.cjs +1 -1
- package/modules/chart-fan.min.js +1 -1
- package/modules/chart-forcetree.d.ts +1 -1
- package/modules/chart-forcetree.esm.min.js +1 -1
- package/modules/chart-forcetree.min.cjs +1 -1
- package/modules/chart-forcetree.min.js +1 -1
- package/modules/chart-hexbin.d.ts +1 -1
- package/modules/chart-hexbin.esm.min.js +1 -1
- package/modules/chart-hexbin.min.cjs +1 -1
- package/modules/chart-hexbin.min.js +1 -1
- package/modules/chart-hexmap.d.ts +1 -1
- package/modules/chart-hexmap.esm.min.js +1 -1
- package/modules/chart-hexmap.min.cjs +1 -1
- package/modules/chart-hexmap.min.js +1 -1
- package/modules/chart-icicle.d.ts +1 -1
- package/modules/chart-icicle.esm.min.js +1 -1
- package/modules/chart-icicle.min.cjs +1 -1
- package/modules/chart-icicle.min.js +1 -1
- package/modules/chart-markermap.d.ts +1 -1
- package/modules/chart-markermap.esm.min.js +1 -1
- package/modules/chart-markermap.min.cjs +1 -1
- package/modules/chart-markermap.min.js +1 -1
- package/modules/chart-motion.d.ts +1 -1
- package/modules/chart-motion.esm.min.js +1 -1
- package/modules/chart-motion.min.cjs +1 -1
- package/modules/chart-motion.min.js +1 -1
- package/modules/chart-pack.d.ts +1 -1
- package/modules/chart-pack.esm.min.js +1 -1
- package/modules/chart-pack.min.cjs +1 -1
- package/modules/chart-pack.min.js +1 -1
- package/modules/chart-parallel.d.ts +1 -1
- package/modules/chart-parallel.esm.min.js +1 -1
- package/modules/chart-parallel.min.cjs +1 -1
- package/modules/chart-parallel.min.js +1 -1
- package/modules/chart-pictorial.d.ts +1 -1
- package/modules/chart-pictorial.esm.min.js +1 -1
- package/modules/chart-pictorial.min.cjs +1 -1
- package/modules/chart-pictorial.min.js +1 -1
- package/modules/chart-polararea.d.ts +1 -1
- package/modules/chart-polararea.esm.min.js +1 -1
- package/modules/chart-polararea.min.cjs +1 -1
- package/modules/chart-polararea.min.js +1 -1
- package/modules/chart-polarscatter.d.ts +1 -1
- package/modules/chart-polarscatter.esm.min.js +1 -1
- package/modules/chart-polarscatter.min.cjs +1 -1
- package/modules/chart-polarscatter.min.js +1 -1
- package/modules/chart-pyramid.d.ts +1 -1
- package/modules/chart-pyramid.esm.min.js +1 -1
- package/modules/chart-pyramid.min.cjs +1 -1
- package/modules/chart-pyramid.min.js +1 -1
- package/modules/chart-radialbar.d.ts +1 -1
- package/modules/chart-radialbar.esm.min.js +1 -1
- package/modules/chart-radialbar.min.cjs +1 -1
- package/modules/chart-radialbar.min.js +1 -1
- package/modules/chart-ridgeline.d.ts +1 -1
- package/modules/chart-ridgeline.esm.min.js +1 -1
- package/modules/chart-ridgeline.min.cjs +1 -1
- package/modules/chart-ridgeline.min.js +1 -1
- package/modules/chart-roc.d.ts +1 -1
- package/modules/chart-roc.esm.min.js +1 -1
- package/modules/chart-roc.min.cjs +1 -1
- package/modules/chart-roc.min.js +1 -1
- package/modules/chart-serpentine.d.ts +1 -1
- package/modules/chart-serpentine.esm.min.js +1 -1
- package/modules/chart-serpentine.min.cjs +1 -1
- package/modules/chart-serpentine.min.js +1 -1
- package/modules/chart-slope.d.ts +1 -1
- package/modules/chart-slope.esm.min.js +1 -1
- package/modules/chart-slope.min.cjs +1 -1
- package/modules/chart-slope.min.js +1 -1
- package/modules/chart-spiral.d.ts +1 -1
- package/modules/chart-spiral.esm.min.js +1 -1
- package/modules/chart-spiral.min.cjs +1 -1
- package/modules/chart-spiral.min.js +1 -1
- package/modules/chart-splom.d.ts +1 -1
- package/modules/chart-splom.esm.min.js +1 -1
- package/modules/chart-splom.min.cjs +1 -1
- package/modules/chart-splom.min.js +1 -1
- package/modules/chart-tree.d.ts +1 -1
- package/modules/chart-tree.esm.min.js +1 -1
- package/modules/chart-tree.min.cjs +1 -1
- package/modules/chart-tree.min.js +1 -1
- package/modules/chart-venn.d.ts +1 -1
- package/modules/chart-venn.esm.min.js +1 -1
- package/modules/chart-venn.min.cjs +1 -1
- package/modules/chart-venn.min.js +1 -1
- package/modules/chart-voronoi.d.ts +1 -1
- package/modules/chart-voronoi.esm.min.js +1 -1
- package/modules/chart-voronoi.min.cjs +1 -1
- package/modules/chart-voronoi.min.js +1 -1
- package/modules/chart-waffle.d.ts +1 -1
- package/modules/chart-waffle.esm.min.js +1 -1
- package/modules/chart-waffle.min.cjs +1 -1
- package/modules/chart-waffle.min.js +1 -1
- package/modules/chart-wordcloud.d.ts +1 -1
- package/modules/chart-wordcloud.esm.min.js +1 -1
- package/modules/chart-wordcloud.min.cjs +1 -1
- package/modules/chart-wordcloud.min.js +1 -1
- package/modules/charts.d.ts +1 -1
- package/modules/charts.esm.min.js +2 -2
- package/modules/charts.min.cjs +2 -2
- package/modules/charts.min.js +2 -2
- package/modules/dashboard.d.ts +1 -1
- package/modules/dashboard.esm.min.js +2 -2
- package/modules/dashboard.min.cjs +2 -2
- package/modules/dashboard.min.js +2 -2
- package/modules/data-router.d.ts +1 -1
- package/modules/data-router.esm.min.js +2 -2
- package/modules/data-router.min.cjs +2 -2
- package/modules/data-router.min.js +2 -2
- package/modules/deckgl.d.ts +1 -1
- package/modules/deckgl.esm.min.js +2 -2
- package/modules/deckgl.min.cjs +2 -2
- package/modules/deckgl.min.js +2 -2
- package/modules/devtools.d.ts +1 -1
- package/modules/devtools.esm.min.js +1 -1
- package/modules/devtools.min.cjs +1 -1
- package/modules/devtools.min.js +1 -1
- package/modules/dhtmlx-compat.d.ts +1 -1
- package/modules/dhtmlx-compat.esm.min.js +2 -2
- package/modules/dhtmlx-compat.min.cjs +2 -2
- package/modules/dhtmlx-compat.min.js +2 -2
- package/modules/gantt.d.ts +58 -3
- package/modules/gantt.esm.min.js +223 -217
- package/modules/gantt.esm.min.js.map +2 -2
- package/modules/gantt.min.cjs +222 -216
- package/modules/gantt.min.js +222 -216
- package/modules/gantt.min.js.map +2 -2
- package/modules/geo-europe-nuts.d.ts +1 -1
- package/modules/geo-europe-nuts.esm.min.js +1 -1
- package/modules/geo-europe-nuts.min.cjs +1 -1
- package/modules/geo-europe-nuts.min.js +1 -1
- package/modules/geo-uk.d.ts +1 -1
- package/modules/geo-uk.esm.min.js +1 -1
- package/modules/geo-uk.min.cjs +1 -1
- package/modules/geo-uk.min.js +1 -1
- package/modules/geo-us-states.d.ts +1 -1
- package/modules/geo-us-states.esm.min.js +1 -1
- package/modules/geo-us-states.min.cjs +1 -1
- package/modules/geo-us-states.min.js +1 -1
- package/modules/geo-world-110m.d.ts +1 -1
- package/modules/geo-world-110m.esm.min.js +1 -1
- package/modules/geo-world-110m.min.cjs +1 -1
- package/modules/geo-world-110m.min.js +1 -1
- package/modules/geo-world-50m.d.ts +1 -1
- package/modules/geo-world-50m.esm.min.js +1 -1
- package/modules/geo-world-50m.min.cjs +1 -1
- package/modules/geo-world-50m.min.js +1 -1
- package/modules/geometry.d.ts +1 -1
- package/modules/geometry.esm.min.js +2 -2
- package/modules/geometry.min.cjs +2 -2
- package/modules/geometry.min.js +2 -2
- package/modules/htmx.d.ts +1 -1
- package/modules/htmx.esm.min.js +3 -3
- package/modules/htmx.min.cjs +3 -3
- package/modules/htmx.min.js +3 -3
- package/modules/kanban.d.ts +1 -1
- package/modules/kanban.esm.min.js +2 -2
- package/modules/kanban.min.cjs +2 -2
- package/modules/kanban.min.js +2 -2
- package/modules/kpi.d.ts +1 -1
- package/modules/kpi.esm.min.js +2 -2
- package/modules/kpi.min.cjs +2 -2
- package/modules/kpi.min.js +2 -2
- package/modules/layout.d.ts +1 -1
- package/modules/layout.esm.min.js +2 -2
- package/modules/layout.min.cjs +2 -2
- package/modules/layout.min.js +2 -2
- package/modules/leaflet.d.ts +1 -1
- package/modules/leaflet.esm.min.js +2 -2
- package/modules/leaflet.min.cjs +2 -2
- package/modules/leaflet.min.js +2 -2
- package/modules/list.d.ts +1 -1
- package/modules/list.esm.min.js +2 -2
- package/modules/list.min.cjs +2 -2
- package/modules/list.min.js +2 -2
- package/modules/mapview.d.ts +1 -1
- package/modules/mapview.esm.min.js +2 -2
- package/modules/mapview.min.cjs +2 -2
- package/modules/mapview.min.js +2 -2
- package/modules/mock-socket.d.ts +1 -1
- package/modules/mock-socket.esm.min.js +1 -1
- package/modules/mock-socket.min.cjs +1 -1
- package/modules/mock-socket.min.js +1 -1
- package/modules/presets.d.ts +1 -1
- package/modules/presets.esm.min.js +2 -2
- package/modules/presets.min.cjs +2 -2
- package/modules/presets.min.js +2 -2
- package/modules/react.d.ts +1 -1
- package/modules/react.esm.min.js +2 -2
- package/modules/react.esm.min.js.map +1 -1
- package/modules/react.min.cjs +2 -2
- package/modules/react.min.js +2 -2
- package/modules/react.min.js.map +1 -1
- package/modules/svelte.d.ts +1 -1
- package/modules/svelte.esm.min.js +3 -3
- package/modules/svelte.esm.min.js.map +1 -1
- package/modules/svelte.min.cjs +2 -2
- package/modules/svelte.min.js +2 -2
- package/modules/svelte.min.js.map +1 -1
- package/modules/tabs.d.ts +1 -1
- package/modules/tabs.esm.min.js +2 -2
- package/modules/tabs.min.cjs +2 -2
- package/modules/tabs.min.js +2 -2
- package/modules/vue.d.ts +1 -1
- package/modules/vue.esm.min.js +2 -2
- package/modules/vue.esm.min.js.map +1 -1
- package/modules/vue.min.cjs +2 -2
- package/modules/vue.min.js +2 -2
- package/modules/vue.min.js.map +1 -1
- package/modules/webcomponent.d.ts +1 -1
- package/modules/webcomponent.esm.min.js +4 -4
- package/modules/webcomponent.esm.min.js.map +1 -1
- package/modules/webcomponent.min.cjs +4 -4
- package/modules/webcomponent.min.js +4 -4
- package/modules/webcomponent.min.js.map +1 -1
- package/package.json +1 -1
package/modules/gantt.min.cjs
CHANGED
|
@@ -1,90 +1,96 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.88.
|
|
2
|
+
* Lattice Grid 1.88.3, gantt module
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
6
|
-
(function(Ie){"use strict";var Pe=Object.create(null),Oe=Object.create(null);function ae(m,bt){Pe[m]=bt}function je(m){var bt=Oe[m];if(bt)return bt;var Vt=Object.create(null);Oe[m]=Vt;var vt=Pe[m];if(!vt)throw new Error("[lattice] missing module: "+m);return vt(Vt,je),Vt}ae("packages/core/src/internal/util.js",function(m,bt){"use strict";Object.defineProperty(m,"VERSION",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(m,"reportedWarnings",{enumerable:!0,get:function(){return S}}),Object.defineProperty(m,"warnOnce",{enumerable:!0,get:function(){return A}}),Object.defineProperty(m,"infoOnce",{enumerable:!0,get:function(){return B}}),Object.defineProperty(m,"resetWarnings",{enumerable:!0,get:function(){return G}}),Object.defineProperty(m,"fail",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(m,"invariant",{enumerable:!0,get:function(){return w}}),Object.defineProperty(m,"DEV",{enumerable:!0,get:function(){return g}}),Object.defineProperty(m,"isObject",{enumerable:!0,get:function(){return y}}),Object.defineProperty(m,"isFunction",{enumerable:!0,get:function(){return H}}),Object.defineProperty(m,"isNil",{enumerable:!0,get:function(){return F}}),Object.defineProperty(m,"isBlank",{enumerable:!0,get:function(){return et}}),Object.defineProperty(m,"isCtor",{enumerable:!0,get:function(){return it}}),Object.defineProperty(m,"pathGetter",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(m,"pathSetter",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(m,"getPath",{enumerable:!0,get:function(){return pt}}),Object.defineProperty(m,"setPath",{enumerable:!0,get:function(){return xt}}),Object.defineProperty(m,"humanise",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(m,"escapeHtml",{enumerable:!0,get:function(){return D}}),Object.defineProperty(m,"titleCase",{enumerable:!0,get:function(){return K}}),Object.defineProperty(m,"expand",{enumerable:!0,get:function(){return N}}),Object.defineProperty(m,"toArray",{enumerable:!0,get:function(){return b}}),Object.defineProperty(m,"merge",{enumerable:!0,get:function(){return z}}),Object.defineProperty(m,"mergeRow",{enumerable:!0,get:function(){return X}}),Object.defineProperty(m,"Lru",{enumerable:!0,get:function(){return p}}),Object.defineProperty(m,"collator",{enumerable:!0,get:function(){return st}}),Object.defineProperty(m,"defaultCompare",{enumerable:!0,get:function(){return At}}),Object.defineProperty(m,"now",{enumerable:!0,get:function(){return zt}}),Object.defineProperty(m,"nextFrame",{enumerable:!0,get:function(){return a}}),Object.defineProperty(m,"cancelFrame",{enumerable:!0,get:function(){return h}}),Object.defineProperty(m,"frameBatched",{enumerable:!0,get:function(){return k}}),Object.defineProperty(m,"settleDebounce",{enumerable:!0,get:function(){return _}}),Object.defineProperty(m,"whenIdle",{enumerable:!0,get:function(){return j}}),Object.defineProperty(m,"uid",{enumerable:!0,get:function(){return I}});const Vt="1.88.2";async function vt(){return Vt}const lt="1.88.2",Q=new Set,rt=2e3;function M(r){if(Q.add(r),Q.size>rt){const o=Q.values().next().value;o!==void 0&&Q.delete(o)}}const at=[],l=500;function J(r,o,n){at.push({key:r,level:o,message:n.map(u=>typeof u=="string"?u:f(u)).join(" "),at:Date.now()}),at.length>l&&at.shift()}function f(r){if(r instanceof Error)return r.message;try{return JSON.stringify(r)}catch{return String(r)}}function S(){return at.map(r=>({...r}))}function L(r){if(r.length===0||typeof r[0]!="string")return r;const o=r[0].replace(/^\[lattice\]\s*/,"");return o===r[0]?r:[o,...r.slice(1)]}function A(r,...o){if(Q.has(r))return;M(r);const n=L(o);J(r,"warn",n),console.warn("[lattice]",...n)}function B(r,...o){if(Q.has(r))return;M(r);const n=L(o);J(r,"info",n),console.info("[lattice]",...n)}function G(){Q.clear(),at.length=0}function tt(r,o){const n=new Error(`[lattice] ${r}`);throw o!==void 0&&(n.cause=o),n}function w(r,o){r||tt(o)}const g=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function y(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}function H(r){return typeof r=="function"}function F(r){return r==null}function et(r){return r==null||r===""}function it(r){return typeof r!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(r))?!0:!!(r.prototype&&Object.getOwnPropertyNames(r.prototype).length>1)}const $=new Map;function Y(r){let o=$.get(r);if(o)return o;if(!r.includes("."))o=n=>n?.[r];else{const n=r.split("."),u=n.length;o=t=>{let d=t;for(let c=0;c<u;c++){if(d==null)return;d=d[n[c]]}return d}}return $.set(r,o),o}const R=new Map;function dt(r){let o=R.get(r);if(o)return o;if(!r.includes("."))o=(n,u)=>{n!=null&&(n[r]=u)};else{const n=r.split("."),u=n.length-1;o=(t,d)=>{let c=t;for(let q=0;q<u;q++){if(c==null)return;const W=n[q];c[W]==null&&(c[W]={}),c=c[W]}c!=null&&(c[n[u]]=d)}}return R.set(r,o),o}function pt(r,o){return Y(o)(r)}function xt(r,o,n){dt(o)(r,n)}function ot(r){return r?(r.includes(".")?r.slice(r.lastIndexOf(".")+1):r).replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,n=>n.toUpperCase()):""}const _t={"&":"&","<":"<",">":">",'"':""","'":"'"};function D(r){const o=r==null?"":String(r);return/[&<>"']/.test(o)?o.replace(/[&<>"']/g,n=>_t[n]):o}function K(r){return String(r).replace(/\w\S*/g,o=>o[0].toUpperCase()+o.slice(1).toLowerCase())}function N(r,o,n){if(r!==void 0)return r===!0?{enabled:!0,...n}:r===!1?{enabled:!1}:y(r)?r:{[o]:r,enabled:!0}}function b(r){return r==null?[]:Array.isArray(r)?r:[r]}const x=Object.freeze(new Set(["__proto__","constructor","prototype"]));function z(r,o){if(!y(r))return y(o)?{...o}:o;if(!y(o))return o===void 0?r:o;const n={...r};for(const u of Object.keys(o)){if(x.has(u))continue;const t=o[u];t!==void 0&&(n[u]=y(t)&&y(n[u])?z(n[u],t):t)}return n}function X(r,o){if(!y(r)||!y(o)||r===o)return o;const n=Object.create(Object.getPrototypeOf(r));return Object.assign(n,r,o),n}class p{#n;#i=new Map;#t;constructor(o=256,n=null){this.#n=o,this.#t=n}get size(){return this.#i.size}get max(){return this.#n}set max(o){this.#n=o,this.#e()}has(o){return this.#i.has(o)}get(o){const n=this.#i;if(!n.has(o))return;const u=n.get(o);return n.delete(o),n.set(o,u),u}peek(o){return this.#i.get(o)}set(o,n){const u=this.#i;return u.has(o)&&u.delete(o),u.set(o,n),this.#e(),n}delete(o){const n=this.#i.get(o);return this.#i.delete(o)&&this.#t&&this.#t(n,o),n}clear(){if(this.#t)for(const[o,n]of this.#i)this.#t(n,o);this.#i.clear()}keys(){return this.#i.keys()}values(){return this.#i.values()}#e(){const o=this.#i;for(;o.size>this.#n;){const n=o.keys().next().value,u=o.get(n);o.delete(n),this.#t&&this.#t(u,n)}}}const St=new Map;function st(r,o){const n=`${r||""}|${o?JSON.stringify(o):""}`;let u=St.get(n);return u||(u=new Intl.Collator(r||void 0,{numeric:!0,sensitivity:"variant",...o}),St.set(n,u)),u}function At(r,o){if(r===o)return 0;if(r==null)return 1;if(o==null)return-1;if(typeof r=="number"&&typeof o=="number")return Number.isNaN(r)?Number.isNaN(o)?0:1:Number.isNaN(o)||r<o?-1:r>o?1:0;const n=String(r),u=String(o);return n<u?-1:n>u?1:0}function zt(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const It=typeof requestAnimationFrame=="function";function a(r){return It?requestAnimationFrame(r):setTimeout(()=>r(zt()),16)}function h(r){r!=null&&(It?cancelAnimationFrame(r):clearTimeout(r))}function k(r){let o=null,n=null;const u=()=>{o=null;const d=n;n=null,r(...d||[])},t=(...d)=>{n=d,o===null&&(o=a(u))};return t.cancel=()=>{h(o),o=null,n=null},t.flush=()=>{o!==null&&(h(o),u())},t}function _(r,o){let n=null,u=null;const t=()=>{if(n=null,u===null)return;const q=u;u=null,r(...q),d()},d=()=>{n=setTimeout(t,o),typeof n?.unref=="function"&&n.unref()},c=(...q)=>{n===null?(r(...q),d()):(u=q,clearTimeout(n),d())};return c.flush=()=>{if(n!==null&&clearTimeout(n),n=null,u===null)return;const q=u;u=null,r(...q)},c.cancel=()=>{n!==null&&clearTimeout(n),n=null,u=null},c.pending=()=>n!==null||u!==null,c}function j(r,o=50){return typeof requestIdleCallback=="function"?requestIdleCallback(r,{timeout:o}):setTimeout(()=>r({timeRemaining:()=>0,didTimeout:!0}),1)}let P=0;function I(r="l"){return`${r}${(++P).toString(36)}`}}),ae("packages/modules/shared/emitter.js",function(m,bt){"use strict";Object.defineProperty(m,"WILDCARD",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(m,"Emitter",{enumerable:!0,get:function(){return at}}),Object.defineProperty(m,"gate",{enumerable:!0,get:function(){return l}});const Vt=bt("packages/core/src/internal/util.js"),vt=Vt.isFunction,lt=Vt.warnOnce,Q="*",rt=new Set(["api","user","init","ai"]);function M(J,f){return J&&J.name?J.name:`#${f}`}class at{#n=new Map;#i;constructor(f="module"){this.#i=String(f)}on(f,S){if(!vt(S))return()=>{};let L=this.#n.get(f);return L||(L=new Set,this.#n.set(f,L)),L.add(S),()=>this.off(f,S)}off(f,S){const L=this.#n.get(f);L&&L.delete(S)}count(f){const S=this.#n.get(f);return S?S.size:0}emit(f,S){const L=this.#n.get(f),A=this.#n.get(Q);if((!L||L.size===0)&&(!A||A.size===0))return;const B={...S||null,type:f};L&&L.size&&this.#t([...L],B,f),A&&A.size&&this.#t([...A],B,Q)}#t(f,S,L){for(let A=0;A<f.length;A++)try{f[A](S)}catch(B){lt(`${this.#i}.emit.throw:${L}:${M(f[A],A)}`,`${this.#i}: a '${L}' handler threw; other handlers were unaffected.`,B)}}emitBefore(f,S,L){const A=L??(S&&S.origin),B=rt.has(A)?A:"user";let G=!1,tt=null;const w=it=>{G=!0,it!=null&&tt===null&&(tt=String(it))},g={...S||null,type:f,origin:B,get defaultPrevented(){return G},get reason(){return tt},preventDefault(it){w(it)}},y=this.#n.get(f);if(!y||y.size===0)return!0;const H=[...y],F=()=>(G&&tt===null&&(tt="prevented"),G&&S&&typeof S=="object"&&(S.reason=tt),!G),et=[];for(let it=0;it<H.length;it++){const $=H[it];try{const Y=$(g);Y&&vt(Y.then)?et.push(Y):Y===!1&&w("prevented")}catch(Y){w("error"),lt(`${this.#i}.beforeThrow:${f}:${M($,it)}`,`${this.#i}: a '${f}' before-handler threw; the action was cancelled.`,Y)}}return et.length===0?F():Promise.allSettled(et).then(it=>{for(const $ of it)$.status==="rejected"?(w("error"),lt(`${this.#i}.beforeReject:${f}`,`${this.#i}: a '${f}' before-handler rejected; the action was cancelled.`,$.reason)):$.value===!1&&w("prevented");return F()})}clear(){this.#n.clear()}}function l(J,f,S,L,A){const B=J.emitBefore(f,L,L.origin),G=()=>(J.emit(S,{...L,reason:L.reason||"prevented"}),!1);return B===!1?G():B&&vt(B.then)?B.then(tt=>tt?A():G()):A()}}),ae("packages/core/src/model/history.js",function(m,bt){"use strict";Object.defineProperty(m,"DEFAULT_HISTORY_DEPTH",{enumerable:!0,get:function(){return M}}),Object.defineProperty(m,"DEFAULT_COALESCE_MS",{enumerable:!0,get:function(){return at}}),Object.defineProperty(m,"HISTORY_TYPES",{enumerable:!0,get:function(){return l}}),Object.defineProperty(m,"COALESCING_TYPES",{enumerable:!0,get:function(){return J}}),Object.defineProperty(m,"HISTORY_LABELS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(m,"diffSlices",{enumerable:!0,get:function(){return G}}),Object.defineProperty(m,"HistoryModel",{enumerable:!0,get:function(){return tt}});const Vt=bt("packages/core/src/internal/util.js"),vt=Vt.warnOnce,lt=Vt.isFunction,Q=Vt.isObject,rt=Vt.now,M=10,at=400,l=["sort","filter","group","pivot","column:move","column:resize","column:visible","column:pin","column:decorate","page","edit","transaction"],J=new Set(["column:resize","column:move"]),f={sort:"sort",filter:"filter",group:"grouping",pivot:"pivot",formatting:"conditional formatting","column:move":"column move","column:resize":"column resize","column:visible":"column visibility","column:pin":"column pin","column:decorate":"column decoration",page:"page change",edit:"edit",transaction:"change"};function S(w){if(w===null||typeof w!="object")return w;try{return structuredClone(w)}catch{try{return JSON.parse(JSON.stringify(w))}catch{return w}}}function L(w,g){if(w===g)return!0;if(w===null||g===null||typeof w!="object"||typeof g!="object")return w!==w&&g!==g;if(w instanceof Date||g instanceof Date)return w instanceof Date&&g instanceof Date&&w.getTime()===g.getTime();if(Array.isArray(w)||Array.isArray(g))return!Array.isArray(w)||!Array.isArray(g)||w.length!==g.length?!1:w.every((F,et)=>L(F,g[et]));const y=Object.keys(w),H=Object.keys(g);return y.length!==H.length?!1:y.every(F=>Object.prototype.hasOwnProperty.call(g,F)&&L(w[F],g[F]))}function A(w,g){const y=new Map;for(const it of g)Q(it)&&typeof it.id=="string"&&y.set(it.id,it);const H=new Set,F=[],et=[];for(const it of w){if(!Q(it)||typeof it.id!="string")continue;H.add(it.id);const $=y.get(it.id);if(!$){F.push({...it});continue}const Y=new Set([...Object.keys(it),...Object.keys($)]);Y.delete("id");const R={id:it.id},dt={id:it.id};let pt=!1;for(const xt of Y)L(it[xt],$[xt])||(pt=!0,xt in it&&(R[xt]=it[xt]),xt in $&&(dt[xt]=$[xt]));pt&&(F.push(R),et.push(dt))}for(const it of g)!Q(it)||typeof it.id!="string"||H.has(it.id)||et.push({...it});return F.length===0&&et.length===0?null:{before:F,after:et}}function B(w){if(typeof w=="string")return"";if(Array.isArray(w))return[]}function G(w,g){const y=Q(w)?w:null,H=Q(g)?g:null;if(!y&&!H)return null;if(!y||!H)return{before:y?{...y}:null,after:H?{...H}:null};const F={},et={};let it=!1;const $=new Set([...Object.keys(y),...Object.keys(H)]);$.delete("version");for(const Y of $){if(Y==="columns"&&Array.isArray(y.columns)&&Array.isArray(H.columns)){const pt=A(y.columns,H.columns);if(!pt)continue;F.columns=pt.before,et.columns=pt.after,it=!0;continue}if(L(y[Y],H[Y]))continue;it=!0;const R=Y in y,dt=Y in H;R?F[Y]=y[Y]:B(H[Y])!==void 0&&(F[Y]=B(H[Y])),dt?et[Y]=H[Y]:B(y[Y])!==void 0&&(et[Y]=B(y[Y]))}return it?(F.columns&&Array.isArray(y.columnOrder)&&(F.columnOrder=y.columnOrder),et.columns&&Array.isArray(H.columnOrder)&&(et.columnOrder=H.columnOrder),y.version!==void 0&&(F.version=y.version),H.version!==void 0&&(et.version=H.version),{before:F,after:et}):null}class tt{#n=[];#i=[];#t=M;#e=at;#o=null;#r=null;#a=null;#c=rt;#u=!1;#s=0;#d=0;constructor(g={}){g.apply&&(this.#o=g.apply),g.capture&&(this.#r=g.capture),g.edit&&(this.#a=g.edit),lt(g.now)&&(this.#c=g.now),this.configure(g)}configure(g={}){typeof g.depth=="number"&&g.depth>=0&&(this.#t=Math.floor(g.depth),this.#y()),typeof g.coalesceMs=="number"&&g.coalesceMs>=0&&(this.#e=g.coalesceMs)}get depth(){return this.#t}set depth(g){this.configure({depth:g})}get coalesceMs(){return this.#e}set coalesceMs(g){this.configure({coalesceMs:g})}get size(){return this.#n.length}get redoSize(){return this.#i.length}get replaying(){return this.#u}canUndo(){return this.#n.length>0}canRedo(){return this.#i.length>0}push(g){if(this.#u||this.#s>0||this.#t===0||!Q(g)||typeof g.type!="string"||!g.type)return null;const y=g.type,H=y==="edit";let F=null,et=null;if(!H){const Y=G(S(g.before??null),S(g.after??null));if(!Y)return null;F=Y.before,et=Y.after}const it={seq:++this.#d,type:y,label:typeof g.label=="string"&&g.label?g.label:f[y]||y,target:g.target==null?null:String(g.target),before:F,after:et,at:typeof g.at=="number"?g.at:this.#c(),delegated:H,mergeable:H?!1:g.coalesce===void 0?J.has(y):!!g.coalesce};this.#i.length=0;const $=this.#g(it);return $!==void 0?$:(this.#n.push(it),this.#y(),it)}recordEdit(g,y={}){return this.push({type:"edit",label:g,target:y.target,at:y.at})}transaction(g,y,H={}){if(!lt(y))return null;if(this.#u||this.#s>0){this.#s++;try{y()}finally{this.#s--}return null}const F=H.type||"transaction",et=H.type?F:void 0,it=this.#S(et,H.target);this.#s++;try{y()}finally{this.#s--}const $=this.#S(et,H.target);return this.push({type:F,label:g,target:H.target,before:it,after:$,coalesce:H.coalesce===void 0?!1:H.coalesce})}#g(g){if(!g.mergeable)return;const y=this.#n[this.#n.length-1];if(!y||!y.mergeable||y.delegated||y.type!==g.type||y.target!==g.target||g.at-y.at>this.#e)return;const H=G(y.before,g.after);return H?(y.before=H.before,y.after=H.after,y.at=g.at,y.label=g.label,y):(this.#n.pop(),null)}#S(g,y){if(!this.#r)return null;try{return S(this.#r(g,y??null))}catch(H){return vt("history.capture.throw","history capture threw; the action was not recorded.",H),null}}#y(){for(;this.#n.length>this.#t;)this.#n.shift();for(;this.#i.length>this.#t;)this.#i.shift()}undo(){return this.#_("undo")}redo(){return this.#_("redo")}#_(g){if(this.#u)return null;const y=g==="undo"?this.#n:this.#i,H=g==="undo"?this.#i:this.#n;this.#u=!0;try{for(;y.length;){const F=y[y.length-1],et=this.#C(F,g);if(F.delegated){if(!this.#x(g)){y.pop();continue}}else et.patch&&this.#A(et.patch,et);return y.pop(),H.push(F),this.#y(),et}return null}finally{this.#u=!1}}#x(g){const y=this.#a;if(!y||!lt(y[g]))return!1;try{return y[g]({origin:"history"})!=null}catch(H){return vt("history.edit.throw",`edit ${g} threw; the entry was dropped.`,H),!1}}#A(g,y){if(this.#o)try{this.#o(g,y)}catch(H){vt("history.apply.throw",`applying the ${y.direction} of '${y.label}' threw.`,H)}}#C(g,y){return{direction:y,seq:g.seq,type:g.type,label:g.label,target:g.target,at:g.at,delegated:g.delegated,patch:g.delegated?null:S(y==="undo"?g.before:g.after)}}peek(g="undo"){const y=g==="redo"?this.#i:this.#n,H=y[y.length-1];return H?{seq:H.seq,type:H.type,label:H.label,target:H.target,at:H.at,delegated:H.delegated}:null}list(){const g=(y,H)=>({seq:y.seq,type:y.type,label:y.label,target:y.target,at:y.at,delegated:y.delegated,undone:H});return[...this.#i.map(y=>g(y,!0)),...[...this.#n].reverse().map(y=>g(y,!1))]}clear(){this.#n.length=0,this.#i.length=0}destroy(){this.clear(),this.#a=null}}}),ae("packages/modules/gantt/time.js",function(m,bt){"use strict";Object.defineProperty(m,"toDayNumber",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(m,"fromDayNumber",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(m,"toISODate",{enumerable:!0,get:function(){return M}}),Object.defineProperty(m,"resolveProjectEpoch",{enumerable:!0,get:function(){return at}});const vt=bt("packages/core/src/internal/util.js").warnOnce,lt=864e5;function Q(l){if(l==null||l==="")return null;if(typeof l=="number")return Number.isFinite(l)?l:null;if(l instanceof Date)return Number.isFinite(l.getTime())?Math.floor(Date.UTC(l.getFullYear(),l.getMonth(),l.getDate())/lt):null;const J=Date.parse(l);return Number.isFinite(J)?Math.floor(J/lt):null}function rt(l){return Number.isFinite(l)?new Date(Math.round(l)*lt):null}function M(l){const J=rt(l);return J?J.toISOString().slice(0,10):null}function at(l){if(l==null||l==="")return 0;const J=Q(l);return Number.isFinite(J)?J:(vt(`gantt.projectEpoch:${String(l)}`,`[lattice] gantt: projectEpoch ${JSON.stringify(l)} is not a date or a day number; the plan is rendered against the Unix epoch (day 0 = 1970-01-01).`),0)}}),ae("packages/modules/gantt/calendar.js",function(m,bt){"use strict";Object.defineProperty(m,"createCalendar",{enumerable:!0,get:function(){return Q}});const vt=bt("packages/modules/gantt/time.js").toDayNumber,lt=Object.freeze([1,2,3,4,5]);function Q(rt,M=0){if(rt==null)return null;let at,l;rt==="weekends"?(at=lt,l=new Set):(at=Array.isArray(rt.workdays)&&rt.workdays.length?rt.workdays.map(Number).filter(g=>g>=0&&g<=6):lt,l=new Set((Array.isArray(rt.holidays)?rt.holidays:[]).map(g=>vt(g)).filter(g=>g!=null)));const J=new Set(at);if(J.size===7&&l.size===0||J.size===0)return null;const f=g=>{let y=(g%7+4)%7;return y<0&&(y+=7),y},S=g=>{if(!Number.isFinite(g))return!1;const y=Math.round(g);return J.has(f(y))&&!l.has(y)},L=g=>{let y=g;for(;!S(y);)y+=1;return y},A=L(Math.round(Number.isFinite(M)?M:0)),B=J.size,G=(g,y)=>{if(y<g)return 0;const H=y-g+1,F=Math.floor(H/7);let et=F*B;const it=f(g);for(let $=F*7;$<H;$+=1)J.has((it+$)%7)&&(et+=1);for(const $ of l)$>=g&&$<=y&&J.has(f($))&&(et-=1);return et};return{isWorking:S,nextWorking:L,dayOf:g=>{const y=Math.round(g);if(y===0)return A;if(y>0){const Y=Math.floor(y/B);let R=A+Y*7,dt=y-Y*B;for(;dt>0;)R+=1,J.has(f(R))&&(dt-=1);let pt=0;for(const xt of l)xt>A&&xt<=R&&J.has(f(xt))&&(pt+=1);for(;pt>0;)R+=1,S(R)&&(pt-=1);for(;!S(R);)R+=1;return R}const H=-y,F=Math.floor(H/B);let et=A-F*7,it=H-F*B;for(;it>0;)et-=1,J.has(f(et))&&(it-=1);let $=0;for(const Y of l)Y>=et&&Y<A&&J.has(f(Y))&&($+=1);for(;$>0;)et-=1,S(et)&&($-=1);for(;!S(et);)et-=1;return et},indexOf:g=>{const y=L(Math.round(g));return y>=A?G(A,y)-1:-(G(y,A)-1)},anchor:A}}}),ae("packages/modules/gantt/assignments.js",function(m,bt){"use strict";Object.defineProperty(m,"parseAssignments",{enumerable:!0,get:function(){return vt}});function Vt(lt){if(lt==null||lt==="")return null;const Q=typeof lt=="number"?lt:Number(lt);return Number.isFinite(Q)?Q:null}function vt(lt){if(lt&&Array.isArray(lt.assignments))return lt.assignments.map(M=>{const at=M&&(M.resource??M.name??M.id);if(at==null||at==="")return null;const l=Vt(M.units)??Vt(M.allocation)??1;return{resource:String(at),units:l}}).filter(Boolean);const Q=lt?lt.assignee??lt.assignees??lt.owner:null;return(Array.isArray(Q)?Q:Q==null||Q===""?[]:[Q]).map(M=>String(M)).filter(M=>M!=="").map(M=>({resource:M,units:1}))}}),ae("packages/modules/gantt/schedule.js",function(m,bt){"use strict";Object.defineProperty(m,"LINK_TYPES",{enumerable:!0,get:function(){return J}}),Object.defineProperty(m,"CONSTRAINT_TYPES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(m,"resolveConstraintCode",{enumerable:!0,get:function(){return L}}),Object.defineProperty(m,"SCHEDULING_MODES",{enumerable:!0,get:function(){return A}}),Object.defineProperty(m,"resolveSchedulingMode",{enumerable:!0,get:function(){return G}}),Object.defineProperty(m,"effortRate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(m,"recomputeEffort",{enumerable:!0,get:function(){return g}}),Object.defineProperty(m,"reconcileEffort",{enumerable:!0,get:function(){return y}}),Object.defineProperty(m,"EPS",{enumerable:!0,get:function(){return H}}),Object.defineProperty(m,"SCHEDULE_ERROR",{enumerable:!0,get:function(){return F}}),Object.defineProperty(m,"TASK_FIELDS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(m,"taskIdReader",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(m,"taskFieldWriters",{enumerable:!0,get:function(){return pt}}),Object.defineProperty(m,"normalizeTasks",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(m,"buildTree",{enumerable:!0,get:function(){return _t}}),Object.defineProperty(m,"normalizeLinkSpec",{enumerable:!0,get:function(){return K}}),Object.defineProperty(m,"normalizeDependencies",{enumerable:!0,get:function(){return N}}),Object.defineProperty(m,"expandDependencies",{enumerable:!0,get:function(){return b}}),Object.defineProperty(m,"topoOrder",{enumerable:!0,get:function(){return x}}),Object.defineProperty(m,"computeSchedule",{enumerable:!0,get:function(){return St}}),Object.defineProperty(m,"findViolations",{enumerable:!0,get:function(){return It}});const vt=bt("packages/core/src/internal/util.js").warnOnce,Q=bt("packages/modules/gantt/calendar.js").createCalendar,M=bt("packages/modules/gantt/assignments.js").parseAssignments,l=bt("packages/modules/gantt/time.js").toDayNumber,J=["FS","SS","FF","SF"],f=["ASAP","MSO","MFO","ALAP","SNET","SNLT","FNET","FNLT"],S=Object.freeze({asap:"ASAP","as-soon-as-possible":"ASAP",assoonaspossible:"ASAP",mso:"MSO","must-start-on":"MSO",muststarton:"MSO","start-on":"MSO",mfo:"MFO","must-finish-on":"MFO",mustfinishon:"MFO","finish-on":"MFO",alap:"ALAP","as-late-as-possible":"ALAP",aslateaspossible:"ALAP",late:"ALAP",snet:"SNET","start-no-earlier-than":"SNET",startnoearlierthan:"SNET",snlt:"SNLT","start-no-later-than":"SNLT",startnolaterthan:"SNLT",fnet:"FNET","finish-no-earlier-than":"FNET",finishnoearlierthan:"FNET",fnlt:"FNLT","finish-no-later-than":"FNLT",finishnolaterthan:"FNLT"});function L(a){if(a==null||a===""||typeof a=="object"&&!Array.isArray(a)&&!(a instanceof Date)&&(a=a.type??a.constraint??a.code??null,a==null||a===""))return null;const h=String(a).toLowerCase().replace(/\s+/g,"-");return S[h]??(f.includes(String(a).toUpperCase())?String(a).toUpperCase():null)}const A=["fixedDuration","fixedEffort","fixedUnits"],B=Object.freeze({fixedduration:"fixedDuration","fixed-duration":"fixedDuration",duration:"fixedDuration",fixedeffort:"fixedEffort","fixed-effort":"fixedEffort",effort:"fixedEffort",work:"fixedEffort",fixedwork:"fixedEffort",fixedunits:"fixedUnits","fixed-units":"fixedUnits",units:"fixedUnits"});function G(a){if(a==null||a==="")return null;const h=String(a).toLowerCase().replace(/\s+/g,"-");if(B[h])return B[h];const k=h.replace(/-/g,"");return B[k]??null}const tt=8;function w(a,h){const k=h.hoursPerDay,_=h.resourceHours instanceof Map?h.resourceHours:new Map;if(!a||a.length===0)return{rate:k,units:1};let j=0,P=0;for(const I of a){const r=_.has(I.resource)?_.get(I.resource):k;j+=I.units*r,P+=I.units}return{rate:j,units:P}}function g(a,h){const k=a.schedulingMode||h.defaultMode||"fixedDuration",_=a.effortDriven!=null?!!a.effortDriven:!!h.defaultEffortDriven,{rate:j,units:P}=w(a.assignments,h),I=a.duration,r=a.statedEffort;let o=I,n=r??(I!=null?I*j:null);return k==="fixedEffort"?r!=null&&j>0?o=r/j:n=I!=null?I*j:null:k==="fixedUnits"?I!=null?(o=I,n=I*j):r!=null&&j>0&&(o=r/j,n=r):o=I,{duration:o,effort:n,units:P,schedulingMode:k,effortDriven:_}}function y(a,h){const k=G(a.mode)||a.mode||"fixedDuration",_=!!a.effortDriven,j=a.hoursPerDay>0?a.hoursPerDay:tt;let P=a.duration,I=a.units;const r=P*I*j,o=h.field,n=h.units!=null?h.units:1;if(o==="duration")P=h.value,k==="fixedEffort"&&(I=P>0?r/(P*j):I);else if(o==="effort"){const u=h.value;k==="fixedDuration"?I=P>0?u/(P*j):I:P=I>0?u/(I*j):P}else if(o==="units")I=h.value,k!=="fixedDuration"&&(P=I>0?r/(I*j):P);else if(o==="addResource"||o==="removeResource"){const u=o==="addResource"?n:-n;k==="fixedDuration"?_||(I=I+u):(I=I+u,P=I>0?r/(I*j):P)}return{duration:P,units:I,effort:P*I*j}}const H=1e-9,F={CYCLE:"cycle",DUPLICATE_ID:"duplicate-id",UNKNOWN_TASK:"unknown-task",BAD_DURATION:"bad-duration",BAD_LINK_TYPE:"bad-link-type",SELF_DEPENDENCY:"self-dependency",UNKNOWN_PARENT:"unknown-parent",PARENT_CYCLE:"parent-cycle",DEP_ACROSS_HIERARCHY:"dep-across-hierarchy"};function et(a){if(a==null||a==="")return null;const h=typeof a=="number"?a:Number(a);return Number.isFinite(h)?h:null}function it(a){if(!a)return null;const h=et(a.effort)??(Array.isArray(a.work)?null:et(a.work))??et(a.hours);if(h!=null)return h;if(Array.isArray(a.work)){let k=0,_=!1;for(const j of a.work){const P=et(j&&j.hours);P!=null&&(k+=P,_=!0)}return _?k:null}return null}function $(a){return a==null||a===""?null:l(a)}const Y=Object.freeze(["id","name","start","end","duration","milestone","percentComplete","parent","baselineStart","baselineEnd","constraint","constraintDate"]);function R(a){const h=a&&typeof a=="object"?a:{},k={};for(const _ of Y){const j=h[_];if(typeof j=="function")k[_]=j;else if(typeof j=="string"&&j!==""){const P=j;k[_]=I=>I[P]}else k[_]=P=>P[_]}return k}function dt(a){return R(a).id}function pt(a){const h=a&&typeof a=="object"?a:{},k={};for(const _ of Y){const j=h[_];typeof j=="string"&&j!==""?k[_]=j:typeof j=="function"?k[_]=null:k[_]=_}return k}function xt(a,h){const k=h.constraint(a);let _=k??(a&&a.constraintType),j=null;if(_&&typeof _=="object"&&!Array.isArray(_)&&!(_ instanceof Date)&&(j=_.date??_.at??_.constraintDate??null,_=_.type??_.constraint??_.code??null),_==null||_==="")return null;const P=L(_);if(!P)return null;const I=$(j??h.constraintDate(a)??a.constraintAt??a.at);return{type:P,at:I}}function ot(a,h){const k=new Map,_=[],j=R(h);if(!Array.isArray(a))return{ok:!1,error:{code:F.BAD_DURATION,message:"tasks must be an array"},order:_,byId:k};for(const P of a){const I=P?j.id(P):null,r=I!=null?String(I):null;if(r==null)return{ok:!1,error:{code:F.UNKNOWN_TASK,message:"every task needs an id"},order:_,byId:k};if(k.has(r))return{ok:!1,error:{code:F.DUPLICATE_ID,message:`duplicate task id "${r}"`,id:r},order:_,byId:k};const o=$(j.start(P)),n=$(j.end(P)),u=j.milestone(P)===!0;let t=u?0:et(j.duration(P));if(t==null&&o!=null&&n!=null&&(t=n-o),t!=null&&t<0)return{ok:!1,error:{code:F.BAD_DURATION,message:`task "${r}" has negative duration ${t}`,id:r},order:_,byId:k};const d=j.name(P),c=j.parent(P);k.set(r,{id:r,name:d!=null?String(d):r,duration:t,milestoneFlag:u,earliestStart:o,placedStart:o,placedEnd:n,percentComplete:et(j.percentComplete(P)),parent:c!=null?String(c):null,constraint:xt(P,j),baselineStart:$(j.baselineStart(P)??(P.baseline&&P.baseline.start)),baselineEnd:$(j.baselineEnd(P)??(P.baseline&&P.baseline.end)),schedulingMode:G(P.schedulingMode??P.taskType),effortDriven:P.effortDriven==null?null:!!P.effortDriven,statedEffort:it(P),assignments:M(P)}),_.push(r)}return{ok:!0,order:_,byId:k}}function _t(a,h){const k=new Map(a.map(r=>[r,[]]));for(const r of a){const o=h.get(r).parent;if(o!=null){if(!h.has(o))return{ok:!1,error:{code:F.UNKNOWN_PARENT,message:`task "${r}" names unknown parent "${o}"`,id:r}};k.get(o).push(r)}}for(const r of a){const o=new Set;let n=h.get(r).parent;for(;n!=null;){if(n===r||o.has(n))return{ok:!1,error:{code:F.PARENT_CYCLE,message:`parent cycle at "${r}"`,id:r}};o.add(n),n=h.get(n)?.parent??null}}const _=r=>k.get(r).length>0,j=new Map,P=r=>{if(j.has(r))return j.get(r);const o=k.get(r),n=o.length===0?[r]:o.flatMap(u=>P(u));return j.set(r,n),n};return{ok:!0,children:k,isSummary:_,descendantLeaves:P,ancestors:r=>{const o=new Set;let n=h.get(r).parent;for(;n!=null;)o.add(n),n=h.get(n).parent;return o}}}const D=/^\s*(FS|SS|FF|SF)\s*(?:([+-])\s*(\d+(?:\.\d+)?))?\s*$/i;function K(a){const h={...a||null};if(typeof h.type!="string")return h;const k=D.exec(h.type);if(!k||!k[2])return h;const _=(k[2]==="-"?-1:1)*Number(k[3]);h.type=k[1].toUpperCase();const j=et(a.lag);return j!=null&&j!==_?(vt(`gantt-link-shorthand-${String(a.type)}-${j}`,`[lattice] gantt: dependency type ${JSON.stringify(a.type)} carries a lag of ${_} but lag: ${j} was also given; the explicit lag wins. Give one or the other.`),h):(h.lag=_,h)}function N(a,h,k={}){const _=[];if(a==null)return{ok:!0,edges:_};if(!Array.isArray(a))return{ok:!1,error:{code:F.UNKNOWN_TASK,message:"dependencies must be an array"},edges:_};const j=typeof k.ancestors=="function"?k.ancestors:null;for(const P of a){const I=K(P),r=I&&I.from!=null?String(I.from):null,o=I&&I.to!=null?String(I.to):null,n=I&&I.type!=null?String(I.type).toUpperCase():"FS",u=et(I.lag)??0;if(r==null||o==null)return{ok:!1,error:{code:F.UNKNOWN_TASK,message:"a dependency needs both `from` and `to`"},edges:_};if(!h.has(r))return{ok:!1,error:{code:F.UNKNOWN_TASK,message:`dependency references unknown task "${r}"`,id:r},edges:_};if(!h.has(o))return{ok:!1,error:{code:F.UNKNOWN_TASK,message:`dependency references unknown task "${o}"`,id:o},edges:_};if(r===o)return{ok:!1,error:{code:F.SELF_DEPENDENCY,message:`task "${r}" depends on itself`,id:r},edges:_};if(!J.includes(n))return{ok:!1,error:{code:F.BAD_LINK_TYPE,message:`unknown link type "${n}" (expected one of ${J.join("/")})`},edges:_};if(j&&(j(r).has(o)||j(o).has(r)))return{ok:!1,error:{code:F.DEP_ACROSS_HIERARCHY,message:`dependency between "${r}" and "${o}" crosses their own parent/child hierarchy`,from:r,to:o},edges:_};_.push({from:r,to:o,type:n,lag:u})}return{ok:!0,edges:_}}function b(a,h){const k=new Set,_=[];for(const j of a){(h.isSummary(j.from)||h.isSummary(j.to))&&j.type!=="FS"&&vt(`gantt-summary-link-${j.type}-${j.from}-${j.to}`,`[lattice] gantt: ${j.type} link with a summary endpoint (${j.from} -> ${j.to}) is expanded to descendant leaves — a conservative v1 reading; only FS is exact for summary endpoints.`);for(const I of h.descendantLeaves(j.from))for(const r of h.descendantLeaves(j.to)){if(I===r)continue;const o=[I,r,j.type,j.lag].join("");k.has(o)||(k.add(o),_.push({from:I,to:r,type:j.type,lag:j.lag}))}}return _}function x(a,h){const k=new Map(a.map(I=>[I,0])),_=new Map(a.map(I=>[I,[]]));for(const I of h)z(k,I.to),_.get(I.from).push(I.to);const j=a.filter(I=>k.get(I)===0),P=[];for(;j.length;){const I=j.shift();P.push(I);for(const r of _.get(I)){const o=k.get(r)-1;k.set(r,o),o===0&&j.push(r)}}return P.length===a.length?{ok:!0,sorted:P}:{ok:!1,cycle:X(a,_,new Set(P))}}function z(a,h){a.set(h,a.get(h)+1)}function X(a,h,k){const _=a.find(r=>!k.has(r)),j=[],P=new Map;let I=_;for(;I!=null&&!P.has(I);)P.set(I,j.length),j.push(I),I=h.get(I).find(r=>!k.has(r));return I==null?j:j.slice(P.get(I)).concat(I)}function p(a,h,k,_,j,P=new Map,I=!1){const r=x(a,k);if(!r.ok)return vt(`gantt-cycle-${r.cycle.join(">")}`,`[lattice] gantt: dependency cycle detected (${r.cycle.join(" -> ")}); schedule refused.`),{ok:!1,error:{code:F.CYCLE,message:`dependency cycle: ${r.cycle.join(" -> ")}`,cycle:r.cycle}};const o=r.sorted,n=new Map(a.map(ut=>[ut,[]])),u=new Map(a.map(ut=>[ut,[]]));for(const ut of k)n.get(ut.to).push(ut),u.get(ut.from).push(ut);const t=new Map;for(const ut of a){const kt=h.get(ut);t.set(ut,{id:ut,name:kt.name,duration:kt.duration,es:0,ef:0,ls:0,lf:0,totalFloat:0,critical:!1,percentComplete:kt.percentComplete,parent:kt.parent,isSummary:!1,isMilestone:kt.duration===0,children:[]})}const d=[];for(const ut of o){const kt=h.get(ut),ct=t.get(ut);let wt=Math.max(_,kt.earliestStart??_);for(const nt of n.get(ut)){const Rt=t.get(nt.from);let Bt;switch(nt.type){case"FS":Bt=Rt.ef+nt.lag;break;case"SS":Bt=Rt.es+nt.lag;break;case"FF":Bt=Rt.ef+nt.lag-ct.duration;break;case"SF":Bt=Rt.es+nt.lag-ct.duration;break;default:Bt=-1/0}Bt>wt&&(wt=Bt)}const T=P.get(ut);if(T&&T.at!=null)switch(T.type){case"MSO":T.at<wt-H?d.push({id:ut,type:T.type,date:T.at,scheduled:wt,at:T.at,earliestFeasible:wt}):wt=T.at,ct.pinned=!0;break;case"MFO":{const nt=T.at-ct.duration;nt<wt-H?d.push({id:ut,type:T.type,date:T.at,scheduled:wt+ct.duration,at:T.at,earliestFeasible:wt}):wt=nt,ct.pinned=!0;break}case"SNET":T.at>wt+H&&(wt=T.at);break;case"SNLT":wt>T.at+H&&d.push({id:ut,type:T.type,date:T.at,scheduled:wt,at:T.at,earliestFeasible:wt});break;case"FNET":{const nt=T.at-ct.duration;nt>wt+H&&(wt=nt);break}case"FNLT":{const nt=wt+ct.duration;nt>T.at+H&&d.push({id:ut,type:T.type,date:T.at,scheduled:nt,at:T.at,earliestFeasible:wt});break}default:break}ct.es=wt,ct.ef=wt+ct.duration}const c=a.length?Math.max(...a.map(ut=>t.get(ut).ef)):_,q=Number.isFinite(j)?j:c;for(let ut=o.length-1;ut>=0;ut-=1){const kt=o[ut],ct=t.get(kt);let wt=q;for(const T of u.get(kt)){const nt=t.get(T.to);let Rt;switch(T.type){case"FS":Rt=nt.ls-T.lag;break;case"SS":Rt=nt.ls-T.lag+ct.duration;break;case"FF":Rt=nt.lf-T.lag;break;case"SF":Rt=nt.lf-T.lag+ct.duration;break;default:Rt=1/0}Rt<wt&&(wt=Rt)}ct.pinned&&(wt=ct.ef),ct.lf=wt,ct.ls=wt-ct.duration,ct.totalFloat=ct.ls-ct.es,ct.critical=ct.totalFloat<=H}for(const ut of a){const kt=P.get(ut);if(!kt||kt.type!=="ALAP")continue;const ct=t.get(ut);ct.es=ct.ls,ct.ef=ct.lf,ct.totalFloat=0,ct.critical=!0}const W=a.filter(ut=>t.get(ut).critical),ht=I?[]:zt(a,k,t);return{ok:!0,tasks:t,critical:W,criticalPaths:ht,projectFinish:c,conflicts:d}}function St(a,h=[],k={}){const _=$(k.projectStart)??0,j=$(k.deadline),P=Q(k.calendar,_),I=$t=>$t==null?null:P?P.indexOf($t):$t,r=$t=>P?P.dayOf($t):$t,o=ot(a,k.fields);if(!o.ok)return{ok:!1,error:o.error};const{order:n,byId:u}=o,t=_t(n,u);if(!t.ok)return{ok:!1,error:t.error};const d=N(h,u,t);if(!d.ok)return{ok:!1,error:d.error};const c={defaultMode:G(k.schedulingMode)||"fixedDuration",defaultEffortDriven:!!k.effortDriven,hoursPerDay:et(k.hoursPerDay)??tt,resourceHours:k.resourceHours instanceof Map?k.resourceHours:new Map},q=new Map;for(const $t of n){if(t.isSummary($t))continue;const gt=u.get($t);if(!(gt.schedulingMode!=null||gt.effortDriven!=null||gt.statedEffort!=null||k.schedulingMode!=null||k.effortDriven!=null))continue;const qt=g(gt,c);qt.duration!=null&&(gt.duration=qt.duration),q.set($t,{schedulingMode:qt.schedulingMode,effortDriven:qt.effortDriven,effort:qt.effort,units:qt.units})}for(const $t of n)if(!t.isSummary($t)&&u.get($t).duration==null)return{ok:!1,error:{code:F.BAD_DURATION,message:`task "${$t}" has no duration and no start+end to derive one`,id:$t}};const W=n.filter($t=>!t.isSummary($t)),ht=new Map(W.map($t=>{const gt=u.get($t);return[$t,{...gt,earliestStart:I(gt.earliestStart)}]})),ut=new Map;for(const $t of W){const gt=u.get($t).constraint;gt&&ut.set($t,{type:gt.type,at:I(gt.at)})}const kt=P?P.indexOf(_):_,ct=j==null?void 0:I(j),wt=b(d.edges,t),T=p(W,ht,wt,kt,ct,ut,!!k.skipCriticalPaths);if(!T.ok)return{ok:!1,error:T.error};const nt=T.tasks;for(const $t of W){const gt=nt.get($t);gt.es=r(gt.es),gt.ef=r(gt.ef),gt.ls=r(gt.ls),gt.lf=r(gt.lf),st(gt,u.get($t).baselineStart,u.get($t).baselineEnd);const Ft=q.get($t);Ft&&(gt.schedulingMode=Ft.schedulingMode,gt.effortDriven=Ft.effortDriven,gt.effort=Ft.effort,gt.units=Ft.units)}for(let $t=n.length-1;$t>=0;$t-=1){const gt=n[$t];t.isSummary(gt)&&nt.set(gt,At(gt,u.get(gt),t,nt))}for(const $t of n)t.isSummary($t)&&(nt.get($t).children=t.children.get($t).slice());const Rt=P?P.anchor:_,Bt=r(T.projectFinish);return{ok:!0,tasks:nt,order:n,critical:T.critical,criticalPaths:T.criticalPaths,projectStart:Rt,projectFinish:Bt,projectDuration:Bt-Rt,conflicts:(T.conflicts||[]).map($t=>({id:$t.id,type:$t.type,date:r($t.date),scheduled:r($t.scheduled),at:r($t.at),earliestFeasible:r($t.earliestFeasible)})),calendar:!!P}}function st(a,h,k){h==null&&k==null||(a.baselineStart=h??null,a.baselineEnd=k??null,a.startVariance=h==null?null:a.es-h,a.finishVariance=k==null?null:a.ef-k,a.durationVariance=h==null||k==null?null:a.ef-a.es-(k-h))}function At(a,h,k,_){const j=k.children.get(a).map(W=>_.get(W)),P=Math.min(...j.map(W=>W.es)),I=Math.max(...j.map(W=>W.ef)),r=Math.min(...j.map(W=>W.ls)),o=Math.max(...j.map(W=>W.lf)),n=k.descendantLeaves(a).map(W=>_.get(W)),u=n.reduce((W,ht)=>W+ht.duration,0),t=u>H?n.reduce((W,ht)=>W+ht.duration*(ht.percentComplete??0),0)/u:null,d={id:a,name:h.name,duration:I-P,es:P,ef:I,ls:r,lf:o,totalFloat:r-P,critical:j.some(W=>W.critical),percentComplete:t,parent:h.parent,isSummary:!0,isMilestone:!1,children:[]},c=n.map(W=>W.baselineStart).filter(W=>W!=null),q=n.map(W=>W.baselineEnd).filter(W=>W!=null);return(c.length||q.length)&&st(d,c.length?Math.min(...c):null,q.length?Math.max(...q):null),d}function zt(a,h,k){const _=new Map(a.map(o=>[o,[]])),j=new Set;for(const o of h){const n=k.get(o.from),u=k.get(o.to);if(!n.critical||!u.critical)continue;let t;switch(o.type){case"FS":t=n.ef+o.lag;break;case"SS":t=n.es+o.lag;break;case"FF":t=n.ef+o.lag-u.duration;break;case"SF":t=n.es+o.lag-u.duration;break;default:t=-1/0}Math.abs(t-u.es)<=H&&(_.get(o.from).push(o.to),j.add(o.to))}const P=a.filter(o=>k.get(o).critical&&!j.has(o)),I=[],r=(o,n)=>{const u=_.get(o);if(!u.length){I.push(n);return}for(const t of u)r(t,n.concat(t))};for(const o of P)r(o,[o]);return I}function It(a,h,k){if(!h||!h.ok)return[];const _=[],j=R(k);for(const P of a){const I=P?j.id(P):null,r=I!=null?String(I):null;if(r==null||!h.tasks.has(r))continue;const o=h.tasks.get(r);if(o.isSummary)continue;const n=et(j.start(P));n!=null&&n<o.es-H&&_.push({id:r,placedStart:n,earliestStart:o.es,by:o.es-n})}return _}}),ae("packages/modules/gantt/resources.js",function(m,bt){"use strict";Object.defineProperty(m,"normalizeCapacities",{enumerable:!0,get:function(){return g}}),Object.defineProperty(m,"normalizeResources",{enumerable:!0,get:function(){return et}}),Object.defineProperty(m,"resourceDailyHours",{enumerable:!0,get:function(){return it}}),Object.defineProperty(m,"sweepLoad",{enumerable:!0,get:function(){return $}}),Object.defineProperty(m,"computeResourceLoad",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(m,"normalizeResourceRates",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(m,"rateOn",{enumerable:!0,get:function(){return pt}}),Object.defineProperty(m,"levelResources",{enumerable:!0,get:function(){return D}});const vt=bt("packages/core/src/internal/util.js").warnOnce,lt=bt("packages/modules/gantt/schedule.js"),Q=lt.computeSchedule,rt=lt.EPS,M=lt.taskIdReader,at=lt.resolveConstraintCode,l=bt("packages/modules/gantt/assignments.js"),J=l.parseAssignments,S=bt("packages/modules/gantt/calendar.js").createCalendar,L=bt("packages/modules/gantt/time.js"),A=L.fromDayNumber,B=L.toDayNumber;Object.defineProperty(m,"parseAssignments",{enumerable:!0,get:function(){return l.parseAssignments}});const G=Object.freeze([1,2,3,4,5]),tt=8;function w(N){if(N==null||N==="")return null;const b=typeof N=="number"?N:Number(N);return Number.isFinite(b)?b:null}function g(N,b){const x=new Map;if(Array.isArray(N))for(const z of N){const X=z&&(z.id??z.name??z.resource);if(X==null||X==="")continue;const p=w(z.capacity??z.maxUnits??z.max??z.units);x.set(String(X),p??b)}else if(N&&typeof N=="object")for(const[z,X]of Object.entries(N)){const p=w(X);x.set(String(z),p??b)}return x}function y(N){const b=new Set;for(const x of Array.isArray(N)?N:[]){if(x&&typeof x=="object"&&!(x instanceof Date)&&("from"in x||"to"in x)){const X=B(x.from),p=B(x.to??x.from);if(X==null)continue;const St=p??X;for(let st=Math.min(X,St);st<=Math.max(X,St);st+=1)b.add(st);continue}const z=B(x);z!=null&&b.add(z)}return b}function H(N){return N==null?{workdays:[0,1,2,3,4,5,6],holidays:new Set}:N==="weekends"?{workdays:[...G],holidays:new Set}:{workdays:Array.isArray(N.workdays)&&N.workdays.length?N.workdays.map(Number).filter(x=>x>=0&&x<=6):[...G],holidays:y(N.holidays)}}function F(N,b,x,z){const X=new Set(Array.isArray(N.workingDays)&&N.workingDays.length?N.workingDays.map(Number).filter(j=>j>=0&&j<=6):z.workdays),p=y(N.holidays);for(const j of z.holidays)p.add(j);const St=N.hoursPerDay,st=j=>{if(St!=null&&typeof St=="object"){const I=w(St[j]);return I??x}const P=w(St);return P??x},At=j=>{const P=A(j);return P?X.has(P.getUTCDay())&&!p.has(j):!1},zt=j=>At(j)?b??st(A(j).getUTCDay()):0,It=j=>x>0?zt(j)/x:0;let a=0;for(const j of X){const P=b??st(j);P>a&&(a=P)}const h=x>0?a/x:0;let k=0;for(const j of z.workdays)X.has(j)&&(k+=b??st(j));const _=z.workdays.length?k/z.workdays.length:x;return{hasCalendar:!0,capacityUnits:h,hoursPerWorkingDay:_,worksOn:At,capacityHoursOn:zt,capacityUnitsOn:It}}function et(N,b,x={}){const z=w(x.hoursPerDay)??tt,X=H(x.calendar),p=new Map,St=(st,At)=>{const zt=w(At.capacity??At.maxUnits??At.max??At.units);At.calendar&&typeof At.calendar=="object"?p.set(st,F(At.calendar,zt,z,X)):p.set(st,{hasCalendar:!1,capacityUnits:zt??b,hoursPerWorkingDay:z})};if(Array.isArray(N))for(const st of N){const At=st&&(st.id??st.name??st.resource);At==null||At===""||St(String(At),st)}else if(N&&typeof N=="object")for(const[st,At]of Object.entries(N))St(String(st),typeof At=="object"&&At?At:{capacity:At});return p}function it(N,b,x={}){const z=w(x.hoursPerDay)??tt,X=et(N,b,x),p=new Map;for(const[St,st]of X)p.set(St,st.hoursPerWorkingDay!=null?st.hoursPerWorkingDay:z);return p}function $(N){if(!N.length)return[];const b=new Set;for(const X of N)b.add(X.s),b.add(X.e);const x=[...b].sort((X,p)=>X-p),z=[];for(let X=0;X<x.length-1;X+=1){const p=x[X],St=x[X+1];if(St<=p)continue;let st=0;const At=[];for(const zt of N)zt.s<=p&&zt.e>=St&&(st+=zt.units,At.push(zt.taskId));At.length&&z.push({s:p,e:St,load:st,taskIds:At})}return z}function Y(N,b,x={}){const z={ok:!1,resources:[],overAllocations:[],byResource:new Map};if(!b||!b.ok)return z;const X=w(x.defaultCapacity)??1,p=g(x.resources,X),St=et(x.resources,X,{calendar:x.calendar,hoursPerDay:x.hoursPerDay}),st=x.calendar!=null?S(x.calendar,b.projectStart):null,At=I=>p.has(I)?p.get(I):X,zt=I=>st?st.indexOf(I):I,It=I=>st?st.dayOf(I):I,a=M(x.fields),h=new Map;for(const I of N){if(!I)continue;const r=a(I);if(r==null)continue;const o=String(r);h.has(o)||h.set(o,I)}const k=new Map;for(const I of b.order){const r=b.tasks.get(I);if(!r||r.isSummary)continue;const o=h.get(I);if(!o)continue;const n=J(o);if(!n.length)continue;const u=zt(r.es),t=zt(r.ef);if(!(t<=u))for(const d of n)k.has(d.resource)||k.set(d.resource,[]),k.get(d.resource).push({s:u,e:t,units:d.units,taskId:I})}const _=new Map,j=[],P=[];for(const[I,r]of k){const o=St.get(I),n=$(r);let u=0,t,d;if(o&&o.hasCalendar){d=o.capacityUnits,t=[];for(const q of n){q.load>u&&(u=q.load);let W=q.s,ht=o.capacityUnitsOn(It(q.s));const ut=kt=>{const ct={start:It(W),end:It(kt),load:q.load,taskIds:q.taskIds};t.push(ct),q.load>ht+rt&&P.push({resource:I,capacity:ht,start:ct.start,end:ct.end,load:q.load,taskIds:q.taskIds.slice()})};for(let kt=q.s+1;kt<q.e;kt+=1){const ct=o.capacityUnitsOn(It(kt));ct!==ht&&(ut(kt),W=kt,ht=ct)}ut(q.e)}}else d=At(I),t=n.map(q=>{q.load>u&&(u=q.load);const W={start:It(q.s),end:It(q.e),load:q.load,taskIds:q.taskIds};return q.load>d+rt&&P.push({resource:I,capacity:d,start:W.start,end:W.end,load:q.load,taskIds:q.taskIds.slice()}),W});const c={resource:I,capacity:d,peak:u,segments:t};_.set(I,c),j.push(c)}return j.sort((I,r)=>I.resource<r.resource?-1:I.resource>r.resource?1:0),P.sort((I,r)=>I.start-r.start||(I.resource<r.resource?-1:1)),{ok:!0,resources:j,overAllocations:P,byResource:_}}function R(N){const b=[];for(const x of Array.isArray(N)?N:[]){const z=B(x&&x.from),X=w(x&&x.rate);z==null||X==null||b.push({from:Math.round(z),rate:X})}return b.sort((x,z)=>x.from-z.from),b}function dt(N){const b=new Map,x=(z,X)=>{if(!X||typeof X!="object")return;const p=X.type==="material"||X.type==="cost"?X.type:"work",St=w(X.rate),st=R(X.rates),At=w(X.cost);St==null&&!st.length&&At==null||b.set(z,{type:p,rate:St,rates:st,cost:At})};if(Array.isArray(N))for(const z of N){const X=z&&(z.id??z.name??z.resource);X==null||X===""||x(String(X),z)}else if(N&&typeof N=="object")for(const[z,X]of Object.entries(N))X&&typeof X=="object"&&x(z,X);return b}function pt(N,b){if(!N)return null;let x=N.rate;for(const z of N.rates)if(z.from<=b)x=z.rate;else break;return x??null}function xt(N){if(!N)return!1;const b=N.constraint??N.constraintType;if(b==null||b==="")return!1;const x=String(b).toLowerCase().replace(/\s+/g,"-");return x==="mso"||x==="must-start-on"||x==="muststarton"||x==="start-on"||x==="mfo"||x==="must-finish-on"||x==="mustfinishon"||x==="finish-on"}function ot(N){if(!N)return null;const b=N.constraint??N.constraintType,x=at(b);if(x!=="SNLT"&&x!=="FNLT")return null;let z=N.constraintDate??N.constraintAt??N.at;if(b&&typeof b=="object"&&z==null&&(z=b.date),z==null||z==="")return null;const X=B(z);return Number.isFinite(X)?{type:x,date:X}:null}function _t(N,b){return N?w(N[b])??0:0}function D(N,b,x={}){const z={projectStart:x.projectStart,deadline:x.deadline,calendar:x.calendar,fields:x.fields,skipCriticalPaths:!0},X=x.priorityField||"priority",p=x.maxIterations!=null?x.maxIterations:Math.max(100,N.length*N.length*2),St=M(x.fields),st=N.map(d=>({...d})),At=st.map(d=>String(St(d))),zt=new Map(st.map(d=>[String(St(d)),d])),It=new Map(At.map((d,c)=>[d,c])),a=d=>It.has(d)?It.get(d):-1;let h=Q(st,b,z);if(!h.ok)return{ok:!1,error:h.error};const k=new Map;for(const d of h.order){const c=h.tasks.get(d);c&&!c.isSummary&&k.set(d,c.es)}const _=w(x.defaultCapacity)??1,j=et(x.resources,_,{calendar:x.calendar,hoursPerDay:x.hoursPerDay}),P=x.calendar!=null?S(x.calendar,h.projectStart):null,I=(d,c)=>{const q=J(c).map(ht=>j.get(ht.resource)).filter(ht=>ht&&ht.hasCalendar);let W=Math.round(d);for(let ht=0;ht<3660;ht+=1){if((!P||P.isWorking(W))&&q.every(ut=>ut.worksOn(W)))return W;W+=1}return Math.round(d)};let r=0;const o=Math.max(32,N.length*2);let n=1/0,u=0;for(;r<p;r+=1){const d=Y(st,h,x);d.overAllocations.length<n?(n=d.overAllocations.length,u=0):u+=1;const c=d.overAllocations.filter(ct=>new Set(ct.taskIds).size>=2);if(!c.length)return{ok:!0,resolved:d.overAllocations.length===0,tasks:st,schedule:h,moves:K(k,h),remaining:d.overAllocations,iterations:r};if(u>=o)return vt("gantt-level-unresolved",`[lattice] gantt: resource leveling could not clear ${d.overAllocations.length} over-allocation(s) after ${r} iterations; the plan cannot be fully levelled, returning the partial result.`),{ok:!0,resolved:!1,tasks:st,schedule:h,moves:K(k,h),remaining:d.overAllocations,iterations:r};const W=c.slice().sort((ct,wt)=>ct.start-wt.start||wt.load-ct.load)[0].taskIds.map(ct=>h.tasks.get(ct)).filter(Boolean),ht=W.filter(ct=>!xt(zt.get(ct.id)));if(!ht.length)return{ok:!0,resolved:!1,tasks:st,schedule:h,moves:K(k,h),remaining:d.overAllocations,iterations:r};ht.sort((ct,wt)=>{if(wt.totalFloat!==ct.totalFloat)return wt.totalFloat-ct.totalFloat;const T=_t(zt.get(ct.id),X),nt=_t(zt.get(wt.id),X);return T!==nt?T-nt:wt.es!==ct.es?wt.es-ct.es:a(wt.id)-a(ct.id)});let ut=null,kt=null;for(const ct of ht){const wt=W.filter(Bt=>Bt.id!==ct.id).map(Bt=>Bt.ef).filter(Bt=>Bt>ct.es+rt),T=wt.length?Math.min(...wt):ct.es+1,nt=I(T,zt.get(ct.id)),Rt=ot(zt.get(ct.id));if(!(Rt&&(Rt.type==="SNLT"?nt:nt+(ct.ef-ct.es))>Rt.date+rt)){ut=ct,kt=nt;break}}if(!ut)return{ok:!0,resolved:!1,tasks:st,schedule:h,moves:K(k,h),remaining:d.overAllocations,iterations:r};if(zt.get(ut.id).start=kt,h=Q(st,b,z),!h.ok)return{ok:!1,error:h.error}}const t=Y(st,h,x);return t.overAllocations.length&&vt("gantt-level-unresolved",`[lattice] gantt: resource leveling hit its ${p}-iteration cap with ${t.overAllocations.length} over-allocation(s) unresolved; returning the partial result.`),{ok:!0,resolved:t.overAllocations.length===0,tasks:st,schedule:h,moves:K(k,h),remaining:t.overAllocations,iterations:r}}function K(N,b){const x=[];for(const z of b.order){const X=b.tasks.get(z);if(!X||X.isSummary)continue;const p=N.get(z);p!=null&&X.es>p+rt&&x.push({id:z,from:p,to:X.es,delay:X.es-p})}return x}}),ae("packages/modules/gantt/workload.js",function(m,bt){"use strict";Object.defineProperty(m,"WORKLOAD_DEFAULTS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(m,"HISTOGRAM_DEFAULTS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(m,"statedHours",{enumerable:!0,get:function(){return B}}),Object.defineProperty(m,"taskContour",{enumerable:!0,get:function(){return G}}),Object.defineProperty(m,"contourTotal",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(m,"serializeContour",{enumerable:!0,get:function(){return w}}),Object.defineProperty(m,"contourSpan",{enumerable:!0,get:function(){return g}}),Object.defineProperty(m,"spanDuration",{enumerable:!0,get:function(){return y}}),Object.defineProperty(m,"spreadHours",{enumerable:!0,get:function(){return H}}),Object.defineProperty(m,"setContourBucket",{enumerable:!0,get:function(){return F}}),Object.defineProperty(m,"retimeContour",{enumerable:!0,get:function(){return et}}),Object.defineProperty(m,"recordWorkingDays",{enumerable:!0,get:function(){return it}}),Object.defineProperty(m,"workloadBuckets",{enumerable:!0,get:function(){return $}}),Object.defineProperty(m,"taskAssignmentEffort",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(m,"computeWorkload",{enumerable:!0,get:function(){return R}}),Object.defineProperty(m,"formatHours",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(m,"formatPercent",{enumerable:!0,get:function(){return pt}}),Object.defineProperty(m,"formatCost",{enumerable:!0,get:function(){return xt}});const Vt=bt("packages/modules/gantt/resources.js"),vt=Vt.parseAssignments,lt=Vt.rateOn,Q=bt("packages/modules/gantt/schedule.js"),rt=Q.EPS,M=Q.taskIdReader,at=bt("packages/modules/gantt/time.js"),l=at.fromDayNumber,J=at.toDayNumber,f=at.toISODate,S=Object.freeze({hoursPerDay:8,height:160,rowHeight:28,decimals:1,totals:!0,unit:"hours"}),L=Object.freeze({resources:null,unit:"hours",stacked:!1,height:160,rowHeight:48});function A(ot){if(ot==null||ot===""||typeof ot=="boolean")return null;const _t=typeof ot=="number"?ot:Number(ot);return Number.isFinite(_t)?_t:null}function B(ot){if(!ot||Array.isArray(ot.work))return null;const _t=A(ot.work);return _t??A(ot.hours)}function G(ot){if(!ot||!Array.isArray(ot.work))return null;const _t=[];for(const K of ot.work){if(!K||typeof K!="object")continue;const N=J(K.date),b=A(K.hours);N==null||b==null||_t.push({day:Math.round(N),hours:b})}_t.sort((K,N)=>K.day-N.day);const D=[];for(const K of _t){const N=D[D.length-1];N&&N.day===K.day?N.hours+=K.hours:D.push({day:K.day,hours:K.hours})}return D}function tt(ot){return(Array.isArray(ot)?ot:[]).reduce((_t,D)=>_t+(A(D.hours)??0),0)}function w(ot){const _t=[];for(const D of Array.isArray(ot)?ot:[]){const K=A(D.hours);if(K==null||!(Math.abs(K)>rt))continue;const N=f(D.day);N!=null&&_t.push({date:N,hours:Math.round(K*1e6)/1e6})}return _t}function g(ot){const _t=(Array.isArray(ot)?ot:[]).filter(D=>Math.abs(A(D.hours)??0)>rt);return _t.length?{first:_t[0].day,last:_t[_t.length-1].day}:null}function y(ot,_t,D=null){if(!Number.isFinite(ot)||!Number.isFinite(_t)||_t<ot)return 0;if(typeof D!="function")return Math.round(_t-ot)+1;let K=0;for(let N=Math.round(ot);N<=Math.round(_t);N+=1)D(N)&&(K+=1);return K}function H(ot,_t){if(!Array.isArray(ot)||!ot.length)return[];const D=_t/ot.length;return ot.map(K=>({day:K,hours:D}))}function F(ot,_t,D,K){const N=(Array.isArray(ot)?ot:[]).filter(x=>!(x.day>=_t.start&&x.day<_t.end)),b=Math.abs(K)>rt?H(D,K):[];return[...N,...b].sort((x,z)=>x.day-z.day)}function et(ot,_t,D){const K=Array.isArray(_t)?_t:[],N=Array.isArray(D)?D:[];if(!Array.isArray(ot)||!K.length||!N.length)return Array.isArray(ot)?ot:[];const b=new Map(ot.map(p=>[p.day,A(p.hours)??0])),x=K.map(p=>b.get(p)??0),z=x.length,X=[];for(let p=0;p<N.length;p+=1){const St=x[Math.min(z-1,Math.floor(p*z/N.length))];Math.abs(St)>rt&&X.push({day:N[p],hours:St})}return X}function it(ot,_t=null){const D=[];if(!ot||!Number.isFinite(ot.es)||!Number.isFinite(ot.ef))return D;for(let K=Math.floor(ot.es);K<Math.ceil(ot.ef);K+=1)(typeof _t!="function"||_t(K))&&D.push(K);return D}function $(ot,_t,D){const K=Math.floor(_t),N=Math.ceil(D),b=[];if(!(N>K))return b;if(ot==="day"){for(let X=K;X<N;X+=1)b.push({start:X,end:X+1});return b}if(ot==="month"||ot==="quarter"){const X=l(K);if(!X)return b;let p=Date.UTC(X.getUTCFullYear(),X.getUTCMonth(),1)/864e5;for(;p<N;){const St=l(p),st=Date.UTC(St.getUTCFullYear(),St.getUTCMonth()+1,1)/864e5;b.push({start:p,end:st}),p=st}return b}const x=l(K);let z=K-(x?x.getUTCDay():0);for(;z<N;z+=7)b.push({start:z,end:z+7});return b}function Y(ot,_t,D={}){const K=A(D.hoursPerDay)??S.hoursPerDay,N=typeof D.isWorking=="function"?D.isWorking:null,b=it(_t,N),x=G(ot);if(!x&&!b.length)return[];const z=vt(ot),X=z.length?z:[{resource:null,units:1}],p=X.reduce((st,At)=>st+(A(At.units)??0),0);if(!(p>0))return[];let St;if(x)St=x.filter(st=>Math.abs(st.hours)>rt);else{const st=B(ot),At=st??b.length*K*p;if(!(Math.abs(At)>rt))return[];St=H(b,At)}return St.length?X.map(st=>{const At=A(st.units)??0,zt=At/p;return{resource:st.resource,units:At,unitsTotal:p,perDay:zt>0?St.map(It=>({day:It.day,hours:It.hours*zt})):[]}}):[]}function R(ot,_t,D={}){const K=Array.isArray(D.buckets)?D.buckets:[],N={ok:!1,buckets:[],rows:[],totals:K.map(()=>null),totalsAvailable:K.map(()=>null),totalsCost:K.map(()=>null),grandTotal:0,grandAvailableTotal:null,grandCostTotal:null};if(!_t||!_t.ok)return N;const b=A(D.hoursPerDay)??S.hoursPerDay,x=typeof D.isWorking=="function"?D.isWorking:null,z=D.capacities instanceof Map?D.capacities:null,X=D.resourceModels instanceof Map?D.resourceModels:null,p=D.resourceRates instanceof Map?D.resourceRates:null,St=M(D.fields),st=new Map,At=(d,c,q,W)=>{st.has(d)||st.set(d,{days:new Map,costs:new Map,tasks:new Map});const ht=st.get(d);if(ht.days.set(c,(ht.days.get(c)||0)+q),p&&d!=null){const kt=lt(p.get(d),c);kt!=null&&ht.costs.set(c,(ht.costs.get(c)||0)+q*kt)}ht.tasks.has(W.id)||ht.tasks.set(W.id,{...W,days:new Map});const ut=ht.tasks.get(W.id);ut.days.set(c,(ut.days.get(c)||0)+q)},zt=new Map;for(const d of Array.isArray(ot)?ot:[]){const c=d?St(d):null;c!=null&&zt.set(String(c),d)}const It=Array.isArray(ot)&&_t.order.length===ot.length;for(let d=0;d<_t.order.length;d+=1){const c=_t.order[d],q=_t.tasks.get(c);if(!q||q.isSummary)continue;const W=zt.get(c)||(It?ot[d]:null);if(!W)continue;const ht=Y(W,q,{hoursPerDay:b,isWorking:x});for(const ut of ht){if(!ut.perDay.length)continue;const kt={id:c,name:q.name,units:ut.units,unitsTotal:ut.unitsTotal,raw:W};for(const ct of ut.perDay)At(ut.resource,ct.day,ct.hours,kt)}}const a=d=>{let c=0,q=K.length-1;for(;c<=q;){const W=c+q>>1;if(d<K[W].start)q=W-1;else if(d>=K[W].end)c=W+1;else return W}return-1},h=K.map(d=>{let c=0;for(let q=Math.floor(d.start);q<Math.ceil(d.end);q+=1)(!x||x(q))&&(c+=1);return{start:d.start,end:d.end,workingDays:c}}),k=d=>{const c=h.map(()=>0);for(const[q,W]of d){const ht=a(q);ht>=0&&(c[ht]+=W)}return c},_=[...st.keys()].filter(d=>d!=null).sort(),j=st.has(null)?[..._,null]:_,P=[],I=h.map(()=>0),r=h.map(()=>null),o=p?h.map(()=>0):h.map(()=>null);let n=0,u=p?0:null;for(const d of j){const c=st.get(d),q=k(c.days),W=p?k(c.costs):null,ht=d!=null&&z&&z.has(d)?z.get(d):null,ut=d!=null&&X?X.get(d):null,kt=q.map($t=>Math.abs($t)>rt?$t:null),ct=q.map(($t,gt)=>{if(ut&&ut.hasCalendar){let Ft=0;for(let qt=Math.floor(h[gt].start);qt<Math.ceil(h[gt].end);qt+=1)(!x||x(qt))&&(Ft+=ut.capacityHoursOn(qt));return Ft}return ht==null?null:ht*b*h[gt].workingDays}),wt=q.map(($t,gt)=>ct[gt]!=null&&$t>ct[gt]+rt);let T=0,nt=null,Rt=p?0:null;q.forEach(($t,gt)=>{T+=$t,I[gt]+=$t,ct[gt]!=null&&(nt=(nt??0)+ct[gt],r[gt]=(r[gt]??0)+ct[gt]),W&&(Rt+=W[gt],o[gt]+=W[gt])}),n+=T,p&&(u+=Rt);const Bt=[...c.tasks.values()].map($t=>{const gt=k($t.days);return{id:$t.id,name:$t.name,units:$t.units,unitsTotal:$t.unitsTotal,raw:$t.raw,cells:gt.map(Ft=>Math.abs(Ft)>rt?Ft:null),total:gt.reduce((Ft,qt)=>Ft+qt,0)}});P.push({resource:d,capacity:ht,available:ct,availableTotal:nt,cells:kt,over:wt,total:T,costCells:W?W.map($t=>Math.abs($t)>rt?$t:null):null,costTotal:Rt,tasks:Bt})}let t=null;for(const d of r)d!=null&&(t=(t??0)+d);return{ok:!0,buckets:h,rows:P,totals:I.map(d=>Math.abs(d)>rt?d:null),totalsAvailable:r,totalsCost:o,grandTotal:n,grandAvailableTotal:t,grandCostTotal:u}}function dt(ot,_t){if(ot==null||!Number.isFinite(ot))return"";const K=10**(Number.isFinite(_t)?Math.max(0,Math.min(6,Math.round(_t))):1),N=Math.round(ot*K)/K;return Object.is(N,-0)||N===0?"0":String(N)}function pt(ot,_t,D){if(_t==null||!(_t>rt))return"–";const K=Number.isFinite(ot)?ot:0;return dt(K/_t*100,D)}function xt(ot,_t=2){return dt(ot,_t)}}),ae("packages/modules/gantt/cost.js",function(m,bt){"use strict";Object.defineProperty(m,"computeCost",{enumerable:!0,get:function(){return S}});const Vt=bt("packages/modules/gantt/resources.js"),vt=Vt.parseAssignments,lt=Vt.normalizeResourceRates,Q=Vt.rateOn,M=bt("packages/modules/gantt/workload.js").taskAssignmentEffort,l=bt("packages/modules/gantt/schedule.js").taskIdReader;function J(L){if(L==null||L==="")return null;const A=typeof L=="number"?L:Number(L);return Number.isFinite(A)?A:null}function f(L,A,B,G){const tt=J(L?L[G.costField]:null)??0;let w=0,g=!1;const y=vt(L),F=y.some(et=>{const it=B.get(et.resource);return!it||it.type==="work"})?M(L,A,{hoursPerDay:G.hoursPerDay,isWorking:G.isWorking}):null;for(let et=0;et<y.length;et+=1){const it=y[et],$=B.get(it.resource);if($)if($.type==="cost")$.cost!=null&&(w+=$.cost,g=!0);else if($.type==="material"){const Y=Q($,Math.round(A.es));Y!=null&&(w+=(J(it.units)??0)*Y,g=!0)}else{const Y=F?F[et]:null;if(!Y)continue;for(const R of Y.perDay){const dt=Q($,R.day);dt!=null&&(w+=R.hours*dt,g=!0)}}}return{cost:tt+w,rateCost:w,fixedCost:tt,hasRate:g}}function S(L,A,B={}){if(!A||!A.ok||!A.tasks||!A.order)return{ok:!1,error:{code:"NO_SCHEDULE",message:"cost needs a successful schedule"}};const G=B.costField||"cost",tt=J(B.hoursPerDay)??8,w=typeof B.isWorking=="function"?B.isWorking:null,g=B.resourceRates instanceof Map?B.resourceRates:lt(B.resources),y=l(B.fields),H=new Map;for(const R of Array.isArray(L)?L:[]){const dt=y(R);dt!=null&&H.set(String(dt),R)}const F=()=>({cost:0,rateCost:0,fixedCost:0,hasRate:!1}),et=new Map;for(const R of A.order)et.set(R,F());const it=F();for(const R of A.order){const dt=A.tasks.get(R);if(!dt||dt.isSummary)continue;const pt=f(H.get(R),dt,g,{hoursPerDay:tt,isWorking:w,costField:G});let xt=R;for(;xt!=null&&et.has(xt);){const ot=et.get(xt);ot.cost+=pt.cost,ot.rateCost+=pt.rateCost,ot.fixedCost+=pt.fixedCost,pt.hasRate&&(ot.hasRate=!0),xt=A.tasks.get(xt).parent}it.cost+=pt.cost,it.rateCost+=pt.rateCost,it.fixedCost+=pt.fixedCost,pt.hasRate&&(it.hasRate=!0)}const $=new Map,Y=[];for(const R of A.order){const dt=A.tasks.get(R),pt=et.get(R),xt={id:dt.id,name:dt.name,isSummary:!!dt.isSummary,isMilestone:!!dt.isMilestone,cost:pt.cost,rateCost:pt.rateCost,fixedCost:pt.fixedCost,hasRate:pt.hasRate};$.set(R,xt),Y.push(xt)}return{ok:!0,byTask:$,rows:Y,project:{...it}}}}),ae("packages/modules/gantt/earned-value.js",function(m,bt){"use strict";Object.defineProperty(m,"computeEarnedValue",{enumerable:!0,get:function(){return f}});const vt=bt("packages/modules/gantt/time.js").toDayNumber,Q=bt("packages/modules/gantt/schedule.js").taskIdReader,rt=1e-9;function M(S){if(S==null||S==="")return null;const L=typeof S=="number"?S:Number(S);return Number.isFinite(L)?L:null}function at(S,L,A){return A-L<=rt?S>=A?1:0:S<=L?0:S>=A?1:(S-L)/(A-L)}function l(S,L,A,B,G,tt){const w=L?M(L[B]):null,g=w??(tt&&tt.hasRate?tt.cost:S.duration),y=L?M(L[G]):null,H=S.percentComplete==null?0:Math.max(0,Math.min(100,S.percentComplete))/100,F=S.baselineStart!=null||S.baselineEnd!=null,et=S.baselineStart!=null?S.baselineStart:S.es,it=S.baselineEnd!=null?S.baselineEnd:S.ef,$=g*at(A,et,it),Y=g*H;return{bac:g,pv:$,ev:Y,ac:y,hasBaseline:F}}function J(S){const L=S.ac;return{bac:S.bac,pv:S.pv,ev:S.ev,ac:L,sv:S.ev-S.pv,cv:L==null?null:S.ev-L,spi:Math.abs(S.pv)<rt?null:S.ev/S.pv,cpi:L==null||Math.abs(L)<rt?null:S.ev/L}}function f(S,L,A={}){if(!L||!L.ok||!L.tasks||!L.order)return{ok:!1,error:{code:"NO_SCHEDULE",message:"earned value needs a successful schedule"}};const B=A.costField||"cost",G=A.actualCostField||"actualCost",tt=A.statusDate==null?L.projectFinish:vt(A.statusDate)??L.projectFinish,w=A.rateCosts instanceof Map?A.rateCosts:null,g=Q(A.fields),y=new Map;for(const R of Array.isArray(S)?S:[]){const dt=g(R);dt!=null&&y.set(String(dt),R)}const H=()=>({bac:0,pv:0,ev:0,ac:0,acAny:!1,hasBaseline:!1}),F=new Map;for(const R of L.order)F.set(R,H());const et=H();for(const R of L.order){const dt=L.tasks.get(R);if(!dt||dt.isSummary)continue;const pt=l(dt,y.get(R),tt,B,G,w?w.get(R):null);let xt=R;for(;xt!=null&&F.has(xt);){const ot=F.get(xt);ot.bac+=pt.bac,ot.pv+=pt.pv,ot.ev+=pt.ev,pt.ac!=null&&(ot.ac+=pt.ac,ot.acAny=!0),pt.hasBaseline&&(ot.hasBaseline=!0),xt=L.tasks.get(xt).parent}et.bac+=pt.bac,et.pv+=pt.pv,et.ev+=pt.ev,pt.ac!=null&&(et.ac+=pt.ac,et.acAny=!0),pt.hasBaseline&&(et.hasBaseline=!0)}const it=R=>J({bac:R.bac,pv:R.pv,ev:R.ev,ac:R.acAny?R.ac:null}),$=new Map,Y=[];for(const R of L.order){const dt=L.tasks.get(R),pt=F.get(R),xt={id:dt.id,name:dt.name,isSummary:!!dt.isSummary,isMilestone:!!dt.isMilestone,percentComplete:dt.percentComplete??null,hasBaseline:pt.hasBaseline,hasActualCost:pt.acAny,...it(pt)};$.set(R,xt),Y.push(xt)}return{ok:!0,statusDate:tt,byTask:$,rows:Y,project:{hasActualCost:et.acAny,hasBaseline:et.hasBaseline,...it(et)}}}}),ae("packages/modules/gantt/mspdi.js",function(m,bt){"use strict";Object.defineProperty(m,"parseXml",{enumerable:!0,get:function(){return it}}),Object.defineProperty(m,"importMSPDI",{enumerable:!0,get:function(){return K}}),Object.defineProperty(m,"exportMSPDI",{enumerable:!0,get:function(){return z}});const vt=bt("packages/core/src/internal/util.js").warnOnce,lt=bt("packages/modules/gantt/time.js"),Q=lt.toDayNumber,rt=lt.toISODate,M=bt("packages/modules/gantt/schedule.js"),at=M.taskIdReader,l=M.resolveConstraintCode,J=M.resolveSchedulingMode,f=Object.freeze({0:"FF",1:"FS",2:"SF",3:"SS"}),S=Object.freeze({FF:0,FS:1,SF:2,SS:3}),L=Object.freeze({0:"ASAP",1:"as-late-as-possible",2:"must-start-on",3:"must-finish-on",4:"SNET",5:"SNLT",6:"FNET",7:"FNLT"}),A=Object.freeze({ASAP:0,ALAP:1,MSO:2,MFO:3,SNET:4,SNLT:5,FNET:6,FNLT:7}),B=Object.freeze({0:"fixedUnits",1:"fixedDuration",2:"fixedEffort"}),G=Object.freeze({fixedUnits:0,fixedDuration:1,fixedEffort:2}),tt=Object.freeze({0:"material",1:"work",2:"cost"}),w=Object.freeze({material:0,work:1,cost:2});function g(a){if(a==null)return null;const h=/^(-?[0-9.]+)/.exec(String(a).trim());if(!h)return null;const k=Number(h[1]);return Number.isFinite(k)?k:null}function y(a){if(a==null||a==="")return null;const h=typeof a=="number"?a:Number(a);return Number.isFinite(h)?h:null}function H(a){return String(a).replace(/&(#x?[0-9a-fA-F]+|lt|gt|amp|quot|apos);/g,(h,k)=>{if(k[0]==="#"){const _=k[1]==="x"||k[1]==="X"?parseInt(k.slice(2),16):parseInt(k.slice(1),10);return Number.isFinite(_)?String.fromCodePoint(_):h}return{lt:"<",gt:">",amp:"&",quot:'"',apos:"'"}[k]??h})}function F(a){return String(a??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function et(a){const h=a.indexOf(":");return h<0?a:a.slice(h+1)}function it(a){const h=String(a);let k=0;const _=[];let j=null;for(;k<h.length;){const P=h.indexOf("<",k);if(P<0)break;if(P>k&&_.length){const c=h.slice(k,P);c.trim()&&(_[_.length-1].text+=H(c))}if(h.startsWith("<?",P)){const c=h.indexOf("?>",P);k=c<0?h.length:c+2;continue}if(h.startsWith("<!--",P)){const c=h.indexOf("-->",P);k=c<0?h.length:c+3;continue}if(h.startsWith("<![CDATA[",P)){const c=h.indexOf("]]>",P);_.length&&(_[_.length-1].text+=h.slice(P+9,c<0?h.length:c)),k=c<0?h.length:c+3;continue}if(h.startsWith("<!",P)){const c=h.indexOf(">",P);k=c<0?h.length:c+1;continue}const I=h.indexOf(">",P);if(I<0)break;let r=h.slice(P+1,I).trim();if(r[0]==="/"){_.pop(),k=I+1;continue}const o=r.endsWith("/");o&&(r=r.slice(0,-1).trim());const n=r.search(/\s/),u=et(n<0?r:r.slice(0,n)),t={};if(n>=0)for(const c of r.slice(n).matchAll(/([\w:.-]+)\s*=\s*"([^"]*)"|([\w:.-]+)\s*=\s*'([^']*)'/g))t[et(c[1]??c[3])]=H(c[2]??c[4]??"");const d={name:u,attrs:t,children:[],text:""};_.length?_[_.length-1].children.push(d):j||(j=d),o||_.push(d),k=I+1}return j}function $(a,h){return a?a.children.find(k=>k.name===h):void 0}function Y(a,h){return a?a.children.filter(k=>k.name===h):[]}function R(a,h){const k=$(a,h);return k?k.text.trim():void 0}function dt(a){if(!a)return null;const h=String(a).match(/^\d{4}-\d{2}-\d{2}/);return Q(h?h[0]:a)}function pt(a,h){return`${rt(a)}T${String(h).padStart(2,"0")}:00:00`}function xt(a,h){if(!a)return null;const k=String(a).match(/PT?(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?/);return k?((Number(k[1])||0)+(Number(k[2])||0)/60+(Number(k[3])||0)/3600)/h:null}function ot(a,h){return`PT${Math.round((a||0)*h*1e3)/1e3}H0M0S`}function _t(a,h){return(Number(a)||0)/(600*h)}function D(a,h){return Math.round((a||0)*10*60*h)}function K(a,h={}){const k=h.hoursPerDay??8,_=it(a);if(!_||_.name!=="Project")return vt("gantt-mspdi-not-project","[lattice] gantt: importMSPDI input is not an MSPDI <Project> document."),{ok:!1,error:"not an MSPDI <Project> document",tasks:[],dependencies:[],resources:[]};const j=dt(R(_,"StartDate")),P=$(_,"Resources"),I=$(_,"Calendars"),r=Y(I,"Calendar"),o=new Map,n=[];for(const wt of Y(P,"Resource")){const T=R(wt,"UID"),nt=R(wt,"Name");if(T==null||nt==null||nt==="")continue;o.set(T,nt);const Rt=R(wt,"MaxUnits"),Bt=R(wt,"CalendarUID"),$t=Bt!=null?x(r,Bt,k):null,gt={id:nt,name:nt,capacity:Rt==null?1:Number(Rt)};$t&&(gt.calendar=$t.calendar,Rt==null||Math.abs(Number(Rt)-1)<1e-9?delete gt.capacity:gt.capacity=Number(Rt)*$t.fullDayHours);const Ft=tt[Number(R(wt,"Type"))];Ft&&Ft!=="work"&&(gt.type=Ft);const qt=g(R(wt,"StandardRate"));qt!=null&&(gt.rate=qt);const re=R(wt,"Cost"),Jt=re==null?null:Number(re);Jt!=null&&Number.isFinite(Jt)&&(gt.cost=Jt),n.push(gt)}const u=$(_,"Assignments"),t=new Map;for(const wt of Y(u,"Assignment")){const T=R(wt,"TaskUID"),nt=R(wt,"ResourceUID"),Rt=o.get(nt);if(T==null||Rt==null)continue;const Bt=R(wt,"Units");t.has(T)||t.set(T,[]),t.get(T).push({resource:Rt,units:Bt==null?1:Number(Bt)})}const d=$(_,"Tasks"),c=[],q=[],W=new Map,ht=[],ut=[];for(const wt of Y(d,"Task")){if(R(wt,"IsNull")==="1")continue;const T=R(wt,"UID");if(T==null||T==="0")continue;const nt=T;W.set(T,nt);const Rt=Number(R(wt,"OutlineLevel"))||1;for(;ht.length&&ht[ht.length-1].level>=Rt;)ht.pop();const Bt=ht.length?ht[ht.length-1].uid:null;ht.push({uid:T,level:Rt});const $t=R(wt,"Summary")==="1",gt=R(wt,"Milestone")==="1",Ft={id:nt,name:R(wt,"Name")??nt};if(Bt&&(Ft.parent=Bt),gt&&(Ft.milestone=!0),!$t&&!gt){const O=xt(R(wt,"Duration"),k);O!=null&&(Ft.duration=O)}const qt=dt(R(wt,"Start"));!$t&&qt!=null&&(Ft.start=qt);const re=R(wt,"PercentComplete");if(re!=null&&(Ft.percentComplete=Number(re)),!$t){const O=R(wt,"Type");O!=null&&B[Number(O)]&&(Ft.schedulingMode=B[Number(O)]);const e=R(wt,"EffortDriven");e!=null&&(Ft.effortDriven=e==="1");const i=xt(R(wt,"Work"),k);i!=null&&(Ft.effort=i*k)}const Jt=L[Number(R(wt,"ConstraintType"))];if(Jt){Ft.constraint=Jt;const O=dt(R(wt,"ConstraintDate"));O!=null&&(Ft.constraintDate=O)}const de=$(wt,"Baseline");if(de){const O=dt(R(de,"Start")),e=dt(R(de,"Finish"));O!=null&&(Ft.baselineStart=O),e!=null&&(Ft.baselineEnd=e)}const ie=t.get(T);ie&&ie.length&&(Ft.assignments=ie),c.push(Ft);for(const O of Y(wt,"PredecessorLink"))ut.push({raw:O,uid:T})}for(const{raw:wt,uid:T}of ut){const nt=R(wt,"PredecessorUID"),Rt=W.get(nt),Bt=W.get(T);if(Rt==null||Bt==null)continue;const $t=f[Number(R(wt,"Type")??1)]??"FS",gt=_t(R(wt,"LinkLag"),k),Ft={from:Rt,to:Bt,type:$t};gt&&(Ft.lag=gt),q.push(Ft)}const kt=N(_),ct={ok:!0,tasks:c,dependencies:q,resources:n};return j!=null&&(ct.projectStart=j),kt&&(ct.calendar=kt),ct}function N(a){const h=$(a,"Calendars"),k=Y(h,"Calendar"),_=R(a,"CalendarUID"),j=(_!=null?k.find(u=>R(u,"UID")===_):null)??k.find(u=>R(u,"IsBaseCalendar")!=="0");if(!j)return null;const P=$(j,"WeekDays"),I=[];let r=!1;for(const u of Y(P,"WeekDay")){const t=Number(R(u,"DayType"));t>=1&&t<=7&&(r=!0,R(u,"DayWorking")==="1"&&I.push(t-1))}const o=[],n=$(j,"Exceptions");for(const u of Y(n,"Exception")){if(R(u,"DayWorking")==="1")continue;const t=$(u,"TimePeriod"),d=dt(R(t,"FromDate")),c=dt(R(t,"ToDate"))??d;if(d!=null)for(let q=d;q<=c;q+=1)o.push(q)}return!r&&!o.length?null:{workdays:r?I:[1,2,3,4,5],holidays:o}}function b(a){if(a==null)return null;const h=/^(\d{1,2}):(\d{2})(?::(\d{2}))?$/.exec(String(a).trim());return h?Number(h[1])+Number(h[2])/60+Number(h[3]??0)/3600:null}function x(a,h,k){const _=a.find(t=>R(t,"UID")===h);if(!_)return null;const j=[],P={};for(const t of Y($(_,"WeekDays"),"WeekDay")){const d=Number(R(t,"DayType"));if(!(d>=1&&d<=7)||R(t,"DayWorking")!=="1")continue;const c=d-1;j.push(c);let q=0;for(const W of Y($(t,"WorkingTimes"),"WorkingTime")){const ht=b(R(W,"FromTime")),ut=b(R(W,"ToTime"));ht!=null&&ut!=null&&ut>ht&&(q+=ut-ht)}P[c]=q>0?q:k}const I=[];for(const t of Y($(_,"Exceptions"),"Exception")){if(R(t,"DayWorking")==="1")continue;const d=$(t,"TimePeriod"),c=dt(R(d,"FromDate")),q=dt(R(d,"ToDate"))??c;if(c!=null)for(let W=c;W<=q;W+=1)I.push(W)}if(!j.length&&!I.length)return null;const r=j.map(t=>P[t]),o=r.length&&r.every(t=>Math.abs(t-r[0])<1e-9),n={workingDays:j.slice().sort((t,d)=>t-d),hoursPerDay:o?r[0]:P};I.length&&(n.holidays=I);const u=r.reduce((t,d)=>Math.max(t,d),0)||k;return{calendar:n,fullDayHours:u}}function z(a,h={}){const k=h.hoursPerDay??8,_=Array.isArray(a.tasks)?a.tasks:[],j=Array.isArray(a.dependencies)?a.dependencies:[],P=Array.isArray(a.resources)?a.resources:a.resources&&typeof a.resources=="object"?Object.entries(a.resources).map(([T,nt])=>({id:T,name:T,capacity:nt})):[],I=a.schedule&&a.schedule.ok?a.schedule:null,r=at(a.fields),o=new Map;_.forEach((T,nt)=>{const Rt=String(r(T));o.set(Rt,/^\d+$/.test(Rt)?Rt:String(nt+1))});const n=new Map;for(const T of _){const nt=T.parent!=null?String(T.parent):null;nt&&(n.has(nt)||n.set(nt,[]),n.get(nt).push(String(r(T))))}const u=T=>n.has(T),t=T=>{let nt=1,Rt=_.find(Bt=>String(r(Bt))===T);for(;Rt&&Rt.parent!=null;)nt+=1,Rt=_.find(Bt=>String(r(Bt))===String(Rt.parent));return nt},d=new Map;for(const T of j){const nt=String(T.to);d.has(nt)||d.set(nt,[]),d.get(nt).push(T)}const c=[];c.push('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'),c.push('<Project xmlns="http://schemas.microsoft.com/project">'),c.push(` <Name>${F(h.projectName||"Lattice Gantt export")}</Name>`);const q=a.projectStart!=null?Q(a.projectStart):I?I.projectStart:null;q!=null&&c.push(` <StartDate>${pt(q,8)}</StartDate>`);const W=p(a.calendar);W&&c.push(" <CalendarUID>1</CalendarUID>");const ht=k;let ut=W?2:1;const kt=new Map;for(const T of P){const nt=T&&(T.name??T.id??T.resource);nt==null||nt===""||!T.calendar||typeof T.calendar!="object"||(kt.set(String(nt),{uid:ut,spec:St(T.calendar,ht)}),ut+=1)}if(W||kt.size){if(c.push(" <Calendars>"),W){c.push(" <Calendar>"),c.push(" <UID>1</UID>"),c.push(" <Name>Standard</Name>"),c.push(" <IsBaseCalendar>1</IsBaseCalendar>"),c.push(" <WeekDays>");for(let T=0;T<=6;T+=1){const nt=W.workdays.includes(T);c.push(" <WeekDay>"),c.push(` <DayType>${T+1}</DayType>`),c.push(` <DayWorking>${nt?1:0}</DayWorking>`),c.push(" </WeekDay>")}if(c.push(" </WeekDays>"),W.holidays.length){c.push(" <Exceptions>");for(const T of W.holidays)c.push(" <Exception>"),c.push(" <DayWorking>0</DayWorking>"),c.push(` <TimePeriod><FromDate>${pt(T,0)}</FromDate><ToDate>${pt(T,23)}</ToDate></TimePeriod>`),c.push(" </Exception>");c.push(" </Exceptions>")}c.push(" </Calendar>")}for(const[T,nt]of kt)for(const Rt of At(nt.uid,T,nt.spec))c.push(Rt);c.push(" </Calendars>")}c.push(" <Tasks>");for(const T of _){const nt=String(r(T)),Rt=o.get(nt),Bt=u(nt),$t=!!T.milestone||!Bt&&Number(T.duration)===0,gt=I?I.tasks.get(nt):null;c.push(" <Task>"),c.push(` <UID>${F(Rt)}</UID>`),c.push(` <ID>${F(Rt)}</ID>`),c.push(` <Name>${F(T.name!=null?T.name:nt)}</Name>`),c.push(` <OutlineLevel>${t(nt)}</OutlineLevel>`),c.push(` <Summary>${Bt?1:0}</Summary>`),c.push(` <Milestone>${$t?1:0}</Milestone>`);const Ft=gt?gt.duration:T.duration!=null?Number(T.duration):null;Ft!=null&&c.push(` <Duration>${ot(Ft,k)}</Duration>`),c.push(" <DurationFormat>7</DurationFormat>");const qt=gt?gt.es:T.start!=null?Q(T.start):null,re=gt?gt.ef:T.end!=null?Q(T.end):qt!=null&&Ft!=null?qt+Ft:null;qt!=null&&c.push(` <Start>${pt(qt,8)}</Start>`),re!=null&&c.push(` <Finish>${pt(re,17)}</Finish>`);const Jt=gt?gt.percentComplete:T.percentComplete;if(Jt!=null&&c.push(` <PercentComplete>${Math.round(Number(Jt))}</PercentComplete>`),!Bt&&!$t){const e=gt&>.schedulingMode||J(T.schedulingMode??T.taskType),i=gt&>.effortDriven!=null?gt.effortDriven:T.effortDriven!=null?!!T.effortDriven:null,s=gt&>.effort!=null?gt.effort:Number.isFinite(Number(T.effort))?Number(T.effort):typeof T.work=="number"?T.work:Number.isFinite(Number(T.hours))?Number(T.hours):null;(e!=null||i!=null||s!=null)&&(e!=null&&c.push(` <Type>${G[e]}</Type>`),c.push(` <EffortDriven>${i?1:0}</EffortDriven>`),s!=null&&c.push(` <Work>${ot(s/k,k)}</Work>`))}const de=zt(T.constraint??T.constraintType);if(de!=null){c.push(` <ConstraintType>${de}</ConstraintType>`);const e=It(T.constraintDate??T.constraintAt??T.at??(T.constraint&&typeof T.constraint=="object"?T.constraint.date:null));e!=null&&c.push(` <ConstraintDate>${pt(e,8)}</ConstraintDate>`)}const ie=It(T.baselineStart??(T.baseline&&T.baseline.start)),O=It(T.baselineEnd??(T.baseline&&T.baseline.end));(ie!=null||O!=null)&&(c.push(" <Baseline>"),c.push(" <Number>0</Number>"),ie!=null&&c.push(` <Start>${pt(ie,8)}</Start>`),O!=null&&c.push(` <Finish>${pt(O,17)}</Finish>`),ie!=null&&O!=null&&c.push(` <Duration>${ot(O-ie,k)}</Duration>`),c.push(" </Baseline>"));for(const e of d.get(nt)||[]){const i=o.get(String(e.from));i!=null&&(c.push(" <PredecessorLink>"),c.push(` <PredecessorUID>${F(i)}</PredecessorUID>`),c.push(` <Type>${S[e.type?String(e.type).toUpperCase():"FS"]??1}</Type>`),e.lag&&(c.push(` <LinkLag>${D(Number(e.lag),k)}</LinkLag>`),c.push(" <LagFormat>7</LagFormat>")),c.push(" </PredecessorLink>"))}c.push(" </Task>")}c.push(" </Tasks>");const ct=new Map;P.forEach((T,nt)=>{const Rt=String(T.name??T.id??`Resource ${nt+1}`),Bt=kt.get(Rt),$t=T.capacity??T.maxUnits??1,gt=Bt?T.capacity!=null?Number(T.capacity)/Bt.spec.fullDayHours:1:Number($t),Ft=y(T.rate),qt=y(T.cost),re=T.type==="material"||T.type==="cost"?T.type:null;ct.set(Rt,{uid:String(nt+1),maxUnits:gt,calUid:Bt?Bt.uid:null,rate:Ft,cost:qt,type:re})});const wt=[];for(const T of _)for(const nt of X(T))ct.has(nt.resource)||ct.set(nt.resource,{uid:String(ct.size+1),maxUnits:1,calUid:null}),wt.push({taskUid:o.get(String(r(T))),resUid:ct.get(nt.resource).uid,units:nt.units});c.push(" <Resources>");for(const[T,nt]of ct)c.push(" <Resource>"),c.push(` <UID>${F(nt.uid)}</UID>`),c.push(` <ID>${F(nt.uid)}</ID>`),c.push(` <Name>${F(T)}</Name>`),c.push(` <MaxUnits>${Number(nt.maxUnits)}</MaxUnits>`),nt.calUid!=null&&c.push(` <CalendarUID>${nt.calUid}</CalendarUID>`),nt.type!=null&&c.push(` <Type>${w[nt.type]}</Type>`),nt.rate!=null&&c.push(` <StandardRate>${nt.rate}/h</StandardRate>`),nt.cost!=null&&c.push(` <Cost>${nt.cost}</Cost>`),c.push(" </Resource>");return c.push(" </Resources>"),c.push(" <Assignments>"),wt.forEach((T,nt)=>{c.push(" <Assignment>"),c.push(` <UID>${nt+1}</UID>`),c.push(` <TaskUID>${F(T.taskUid)}</TaskUID>`),c.push(` <ResourceUID>${F(T.resUid)}</ResourceUID>`),c.push(` <Units>${Number(T.units)}</Units>`),c.push(" </Assignment>")}),c.push(" </Assignments>"),c.push("</Project>"),c.join(`
|
|
7
|
-
`)}function X(a){if(a&&Array.isArray(a.assignments))return a.assignments.map(_=>{const j=_&&(_.resource??_.name??_.id);if(j==null||j==="")return null;const P=Number(_.units??_.allocation??1);return{resource:String(j),units:Number.isFinite(P)?P:1}}).filter(Boolean);const h=a?a.assignee??a.assignees??a.owner:null;return(Array.isArray(h)?h:h==null||h===""?[]:[h]).map(_=>String(_)).filter(_=>_!=="").map(_=>({resource:_,units:1}))}function p(a){if(a==null)return null;if(a==="weekends")return{workdays:[1,2,3,4,5],holidays:[]};const h=Array.isArray(a.workdays)&&a.workdays.length?a.workdays.map(Number).filter(_=>_>=0&&_<=6):[1,2,3,4,5],k=(Array.isArray(a.holidays)?a.holidays:[]).map(_=>Q(_)).filter(_=>_!=null);return{workdays:h,holidays:k}}function St(a,h){const k=Array.isArray(a.workingDays)&&a.workingDays.length?[...new Set(a.workingDays.map(Number).filter(r=>r>=0&&r<=6))].sort((r,o)=>r-o):[1,2,3,4,5],_=a.hoursPerDay,j={};for(const r of k){const o=_!=null&&typeof _=="object"?Number(_[r]):Number(_);j[r]=Number.isFinite(o)&&o>0?o:h}const P=[];for(const r of Array.isArray(a.holidays)?a.holidays:[]){if(r&&typeof r=="object"&&!(r instanceof Date)&&("from"in r||"to"in r)){const n=Q(r.from),u=Q(r.to??r.from);if(n==null)continue;const t=u??n;for(let d=Math.min(n,t);d<=Math.max(n,t);d+=1)P.push(d);continue}const o=Q(r);o!=null&&P.push(o)}const I=k.reduce((r,o)=>Math.max(r,j[o]),0)||h;return{workingDays:k,holidays:P,hoursByWeekday:j,fullDayHours:I}}function st(a){const h=Math.round(a*60),k=Math.floor(h/60),_=h%60;return`${String(k).padStart(2,"0")}:${String(_).padStart(2,"0")}:00`}function At(a,h,k){const _=[],j=new Set(k.workingDays);_.push(" <Calendar>"),_.push(` <UID>${a}</UID>`),_.push(` <Name>${F(h)}</Name>`),_.push(" <IsBaseCalendar>0</IsBaseCalendar>"),_.push(" <WeekDays>");for(let P=0;P<=6;P+=1){const I=j.has(P);if(_.push(" <WeekDay>"),_.push(` <DayType>${P+1}</DayType>`),_.push(` <DayWorking>${I?1:0}</DayWorking>`),I){const r=k.hoursByWeekday[P];_.push(" <WorkingTimes>"),_.push(" <WorkingTime>"),_.push(` <FromTime>${st(8)}</FromTime>`),_.push(` <ToTime>${st(8+r)}</ToTime>`),_.push(" </WorkingTime>"),_.push(" </WorkingTimes>")}_.push(" </WeekDay>")}if(_.push(" </WeekDays>"),k.holidays.length){_.push(" <Exceptions>");for(const P of k.holidays)_.push(" <Exception>"),_.push(" <DayWorking>0</DayWorking>"),_.push(` <TimePeriod><FromDate>${pt(P,0)}</FromDate><ToDate>${pt(P,23)}</ToDate></TimePeriod>`),_.push(" </Exception>");_.push(" </Exceptions>")}return _.push(" </Calendar>"),_}function zt(a){if(a==null||a==="")return null;const h=l(a);return h?A[h]:null}function It(a){return a==null||a===""?null:Q(a)}}),ae("packages/modules/shared/autosize.js",function(m,bt){"use strict";Object.defineProperty(m,"contentWidth",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(m,"contentHeight",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(m,"firstMeasured",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(m,"watchSize",{enumerable:!0,get:function(){return M}}),Object.defineProperty(m,"watchBox",{enumerable:!0,get:function(){return at}});const vt=bt("packages/core/src/internal/util.js").warnOnce;function lt(l){if(!l||typeof l!="object")return null;const J=Number(l.clientWidth);if(Number.isFinite(J)&&J>0)return J;if(typeof l.getBoundingClientRect=="function"){const f=l.getBoundingClientRect(),S=f&&Number(f.width);if(Number.isFinite(S)&&S>0)return S}return null}function Q(l){if(!l||typeof l!="object")return null;const J=Number(l.clientHeight);if(Number.isFinite(J)&&J>0)return J;if(typeof l.getBoundingClientRect=="function"){const f=l.getBoundingClientRect(),S=f&&Number(f.height);if(Number.isFinite(S)&&S>0)return S}return null}function rt(l,J=lt){for(const f of l||[]){const S=J(f);if(Number.isFinite(S)&&S>0)return S}return null}function M(l){const J=(l&&Array.isArray(l.targets)?l.targets:[]).filter(Boolean),f=l&&typeof l.read=="function"?l.read:()=>null,S=l&&typeof l.apply=="function"?l.apply:()=>{},L=Number.isFinite(l&&l.epsilon)?Number(l.epsilon):1;let A=null,B=!1;const G=()=>{if(B)return!1;const H=f();if(!Number.isFinite(H)||H<=0||A!=null&&Math.abs(H-A)<L)return!1;A=H,B=!0;try{S(H)}finally{B=!1}return!0};G();const tt=J[0],w=l&&l.view||tt&&tt.ownerDocument&&tt.ownerDocument.defaultView||globalThis,g=w&&w.ResizeObserver;let y=null;if(typeof g=="function"&&J.length){y=new g(()=>{G()});for(const H of J)H&&typeof y.observe=="function"&&y.observe(H)}else J.length&&vt("shared.autosize.no-resize-observer","ResizeObserver is unavailable; this view was sized once at mount and will not follow its container.");return{refresh:G,get applied(){return A},release(){if(y&&typeof y.disconnect=="function")try{y.disconnect()}catch{}y=null}}}function at(l){const J=(l&&Array.isArray(l.targets)?l.targets:[]).filter(Boolean),f=l&&typeof l.read=="function"?l.read:()=>({}),S=l&&typeof l.apply=="function"?l.apply:()=>{},L=Number.isFinite(l&&l.epsilon)?Number(l.epsilon):1;let A=null,B=!1;const G=F=>{if(A==null)return!0;for(const[et,it]of Object.entries(F)){if(!Number.isFinite(it)||it<=0)continue;const $=A[et];if(!Number.isFinite($)||Math.abs(it-$)>=L)return!0}return!1},tt=()=>{if(B)return!1;const F=f();if(!F||typeof F!="object"||!Object.values(F).some(it=>Number.isFinite(it)&&it>0)||!G(F))return!1;A={...A,...F},B=!0;try{S(F)}finally{B=!1}return!0};tt();const w=J[0],g=l&&l.view||w&&w.ownerDocument&&w.ownerDocument.defaultView||globalThis,y=g&&g.ResizeObserver;let H=null;if(typeof y=="function"&&J.length){H=new y(()=>{tt()});for(const F of J)F&&typeof H.observe=="function"&&H.observe(F)}else J.length&&vt("shared.autosize.no-resize-observer","ResizeObserver is unavailable; this view was sized once at mount and will not follow its container.");return{refresh:tt,get applied(){return A},release(){if(H&&typeof H.disconnect=="function")try{H.disconnect()}catch{}H=null}}}}),ae("packages/modules/shared/axislabels.js",function(m,bt){"use strict";Object.defineProperty(m,"CHAR_RATIO",{enumerable:!0,get:function(){return Vt}}),Object.defineProperty(m,"BOLD_FACTOR",{enumerable:!0,get:function(){return vt}}),Object.defineProperty(m,"MIN_GAP",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(m,"estimateLabelWidth",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(m,"thinLabels",{enumerable:!0,get:function(){return rt}});const Vt=.62,vt=1.05,lt=6;function Q(M,at,l=!1){return String(M??"").length*at*Vt*(l?vt:1)}function rt(M,at){const l=Number.isFinite(at.gap)?Number(at.gap):lt,J=Number.isFinite(at.fontSize)?Number(at.fontSize):11,f=typeof at.measure=="function"?at.measure:G=>Q(G,J,!!at.bold),S=M.filter(G=>G&&Number.isFinite(G.at)).map(G=>({...G,width:f(String(G.text??""))})).sort((G,tt)=>G.at-tt.at);if(S.length<2)return{every:1,kept:S};const L=G=>{let tt=null;for(let w=0;w<S.length;w+=G){const g=S[w];if(tt&&g.at-tt.at<tt.width+l)return!1;tt=g}return!0};let A=1;for(;A<S.length&&!L(A);)A++;const B=[];for(let G=0;G<S.length;G+=A)B.push(S[G]);return{every:A,kept:B}}}),ae("packages/modules/charts/svg.js",function(m,bt){"use strict";Object.defineProperty(m,"SVG_NS",{enumerable:!0,get:function(){return Vt}}),Object.defineProperty(m,"el",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(m,"svg",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(m,"attr",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(m,"attrs",{enumerable:!0,get:function(){return M}}),Object.defineProperty(m,"setText",{enumerable:!0,get:function(){return at}}),Object.defineProperty(m,"clear",{enumerable:!0,get:function(){return l}}),Object.defineProperty(m,"append",{enumerable:!0,get:function(){return J}}),Object.defineProperty(m,"path",{enumerable:!0,get:function(){return f}}),Object.defineProperty(m,"ribbonPath",{enumerable:!0,get:function(){return S}}),Object.defineProperty(m,"round",{enumerable:!0,get:function(){return L}}),Object.defineProperty(m,"pathRings",{enumerable:!0,get:function(){return A}}),Object.defineProperty(m,"insideRings",{enumerable:!0,get:function(){return B}});const Vt="http://www.w3.org/2000/svg";function vt(G){const tt=G.indexOf(")");return tt<0?G:G.slice(tt+1).trim()||"#0072b2"}function lt(G,tt,w){const g=G.createElement(tt);return w&&g.setAttribute("class",w),g}function Q(G,tt,w){const g=G.createElementNS(Vt,tt);if(w)for(const y of Object.keys(w))g.setAttribute(y,String(w[y]));return g}function rt(G,tt,w){if(!G)return;if(w==null){G.removeAttribute(tt);return}let g=String(w);g.startsWith("url(#")&&(tt==="stroke"||tt==="fill"&&G.localName==="text")&&(g=vt(g)),G.setAttribute(tt,g)}function M(G,tt){if(G)for(const w of Object.keys(tt))rt(G,w,tt[w])}function at(G,tt){G&&(G.textContent=tt==null?"":String(tt))}function l(G){if(G)for(;G.firstChild;)G.removeChild(G.firstChild)}function J(G,tt){for(const w of tt)w&&G.appendChild(w);return G}function f(G){return G.join(" ")}function S(G){if(!G||G.length<2)return"";const tt=["M",G[0].x,G[0].upper];for(let w=1;w<G.length;w++)tt.push("L",G[w].x,G[w].upper);for(let w=G.length-1;w>=0;w--)tt.push("L",G[w].x,G[w].lower);return tt.push("Z"),f(tt)}function L(G){return Math.round(G*100)/100}function A(G){const tt=[];let w=[];const g=String(G||"").match(/[A-Za-z]|-?\d*\.?\d+(?:e[-+]?\d+)?/gi)||[];let y="",H=[];const F=()=>{if(!y||!H.length){H=[];return}if(y==="M"||y==="L")for(let et=0;et+1<H.length;et+=2)w.push([H[et],H[et+1]]);else y!=="Z"&&H.length>=2&&w.push([H[H.length-2],H[H.length-1]]);H=[]};for(const et of g){if(/[A-Za-z]/.test(et)){if(F(),et==="Z"||et==="z"){w.length>2&&tt.push(w),w=[],y="";continue}et==="M"&&w.length>2&&(tt.push(w),w=[]),y=et;continue}H.push(Number(et))}return F(),w.length>2&&tt.push(w),tt}function B(G,tt,w){let g=!1;for(const y of G)for(let H=0,F=y.length-1;H<y.length;F=H++){const[et,it]=y[H],[$,Y]=y[F];it>w!=Y>w&&tt<($-et)*(w-it)/(Y-it||1e-12)+et&&(g=!g)}return g}}),ae("packages/modules/charts/scale.js",function(m,bt){"use strict";Object.defineProperty(m,"isNumber",{enumerable:!0,get:function(){return l}}),Object.defineProperty(m,"toNumber",{enumerable:!0,get:function(){return J}}),Object.defineProperty(m,"toTime",{enumerable:!0,get:function(){return f}}),Object.defineProperty(m,"extent",{enumerable:!0,get:function(){return S}}),Object.defineProperty(m,"niceStep",{enumerable:!0,get:function(){return L}}),Object.defineProperty(m,"niceDomain",{enumerable:!0,get:function(){return A}}),Object.defineProperty(m,"measureDomain",{enumerable:!0,get:function(){return B}}),Object.defineProperty(m,"linearTicks",{enumerable:!0,get:function(){return G}}),Object.defineProperty(m,"timeStepFor",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(m,"timeTicks",{enumerable:!0,get:function(){return g}}),Object.defineProperty(m,"linearScale",{enumerable:!0,get:function(){return y}}),Object.defineProperty(m,"timeScale",{enumerable:!0,get:function(){return H}}),Object.defineProperty(m,"key",{enumerable:!0,get:function(){return F}}),Object.defineProperty(m,"bandScale",{enumerable:!0,get:function(){return et}}),Object.defineProperty(m,"sqrtScale",{enumerable:!0,get:function(){return it}});const Vt=[1,2,2.5,5,10],vt=6e4,lt=36e5,Q=864e5,rt=365.25*Q,M=[1,2,5,10,20,25,50,100],at=[1,5,10,25,50,100,250,500,1e3,5e3,15e3,3e4,vt,5*vt,15*vt,30*vt,lt,3*lt,6*lt,12*lt,Q,2*Q,7*Q,14*Q,30*Q,90*Q,180*Q,...M.map($=>$*rt)];function l($){return typeof $=="number"&&Number.isFinite($)}function J($){if($==null||$==="")return null;if($ instanceof Date){const R=$.getTime();return Number.isFinite(R)?R:null}if(typeof $=="boolean")return $?1:0;const Y=Number($);return Number.isFinite(Y)?Y:null}function f($){if($==null||$==="")return null;if($ instanceof Date){const R=$.getTime();return Number.isFinite(R)?R:null}if(typeof $=="number")return Number.isFinite($)?$:null;const Y=Date.parse(String($));return Number.isFinite(Y)?Y:null}function S($){let Y=1/0,R=-1/0;for(let dt=0;dt<$.length;dt++){const pt=$[dt];l(pt)&&(pt<Y&&(Y=pt),pt>R&&(R=pt))}return Y===1/0?null:{min:Y,max:R}}function L($){if(!($>0))return 1;const Y=10**Math.floor(Math.log10($));for(const R of Vt)if($<=R*Y)return R*Y;return 10*Y}function A($,Y=5){const R=L(($.max-$.min)/Math.max(1,Y));return{min:Math.floor($.min/R)*R,max:Math.ceil($.max/R)*R,step:R}}function B($,Y={}){const R=S($)||{min:0,max:1};let{min:dt,max:pt}=R;if(Y.zero&&(dt>0&&(dt=0),pt<0&&(pt=0)),dt===pt){const xt=Math.abs(dt)>0?Math.abs(dt)/10:1;dt-=xt,pt+=xt}if(Y.nice!==!1){const xt=A({min:dt,max:pt},Y.ticks||5);dt=xt.min,pt=xt.max}return l(Y.min)&&(dt=Y.min),l(Y.max)&&(pt=Y.max),dt===pt&&(pt=dt+1),{min:dt,max:pt}}function G($,Y=5){const R=L(($.max-$.min)/Math.max(1,Y)),dt=Math.ceil($.min/R),pt=Math.floor($.max/R),xt=[];for(let ot=dt;ot<=pt;ot++){const _t=ot*R;xt.push(Math.abs(_t)<R/1e6?0:Number(_t.toPrecision(12)))}return xt}function tt($,Y=5){const R=Math.max(1,Y),dt=$/R;let pt=at[at.length-1];for(const _t of at)if(_t>=dt){pt=_t;break}if(pt<rt)return pt;let xt=pt,ot=Math.abs($/pt-R);for(const _t of at){if(_t<rt)continue;const D=Math.abs($/_t-R);D<ot&&(ot=D,xt=_t)}return xt}function w($,Y){const R=new Date($.min).getUTCFullYear();let dt=Math.ceil(R/Y)*Y;Date.UTC(dt,0,1)<$.min&&(dt+=Y);const pt=[];for(;Date.UTC(dt,0,1)<=$.max;dt+=Y)pt.push(Date.UTC(dt,0,1));return pt}function g($,Y=5){const R=tt($.max-$.min,Y);if(R>=rt)return w($,Math.round(R/rt));const dt=[],pt=Math.ceil($.min/R)*R;for(let xt=pt;xt<=$.max;xt+=R)dt.push(xt);return dt}function y($,Y){const R=$.max-$.min||1,[dt,pt]=Y;return{kind:"linear",domain:$,range:Y,of(xt){return dt+(xt-$.min)/R*(pt-dt)},invert(xt){return $.min+(xt-dt)/(pt-dt||1)*R},ticks(xt=5){return G($,xt)}}}function H($,Y){return{...y($,Y),kind:"time",ticks(dt=5){return g($,dt)}}}function F($){if($==null)return" null";if($ instanceof Date)return` date:${$.getTime()}`;if(typeof $=="object"){const Y=$,R=Y.id??Y.key??Y.value;return R!==void 0&&typeof R!="object"?` obj:${String(R)}`:` obj:${String($)}`}return String($)}function et($,Y,R=.2){const dt=Math.min(.9,Math.max(0,R)),[pt,xt]=Y,ot=new Map;for(let K=0;K<$.length;K++){const N=F($[K]);ot.has(N)||ot.set(N,K)}const _t=$.length?(xt-pt)/$.length:xt-pt,D=Math.max(0,_t*(1-dt));return{kind:"band",domain:$,range:Y,bandwidth:D,step:_t,of(K){const N=ot.get(F(K));return N===void 0?NaN:pt+N*_t+(_t-D)/2},centre(K){const N=this.of(K);return Number.isNaN(N)?NaN:N+D/2},ticks(){return $}}}function it($,Y){const[R,dt]=Y,pt=Math.max(Math.abs($.max),Math.abs($.min),0)||1;return{kind:"sqrt",domain:$,range:Y,of(xt){const ot=Math.sqrt(Math.abs(xt)/pt);return R+ot*(dt-R)}}}}),ae("packages/modules/gantt/links.js",function(m,bt){"use strict";Object.defineProperty(m,"LINK_SIDES",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(m,"linkSides",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(m,"routeLink",{enumerable:!0,get:function(){return M}}),Object.defineProperty(m,"arrowheadPath",{enumerable:!0,get:function(){return at}});const Vt=bt("packages/modules/charts/svg.js"),vt=Vt.path,lt=Vt.round,Q=Object.freeze({FS:Object.freeze({depart:1,arrive:-1}),SS:Object.freeze({depart:-1,arrive:-1}),FF:Object.freeze({depart:1,arrive:1}),SF:Object.freeze({depart:-1,arrive:1})});function rt(l){return Q[String(l||"FS").toUpperCase()]||Q.FS}function M(l){const J=Number(l.sx),f=Number(l.sy),S=Number(l.ex),L=Number(l.ey),A=Number.isFinite(l.elbow)&&l.elbow>0?Number(l.elbow):8,B=Number.isFinite(l.rowGap)&&l.rowGap>0?Number(l.rowGap):A,G=rt(l.type),tt=-G.arrive,w=Math.abs(L-f)<.5,g=(S-J)*tt;if(w&&g>0)return{d:vt(["M",lt(J),lt(f),"H",lt(S)]),arrowDir:tt,route:"straight"};if(g>=0)return{d:vt(["M",lt(J),lt(f),"V",lt(L),"H",lt(S)]),arrowDir:tt,route:"drop"};const y=w?f+B:(f+L)/2,H=J+G.depart*A,F=S+G.arrive*A;return{d:vt(["M",lt(J),lt(f),"H",lt(H),"V",lt(y),"H",lt(F),"V",lt(L),"H",lt(S)]),arrowDir:tt,route:"detour"}}function at(l,J,f,S=4){return vt(["M",lt(l),lt(J),"L",lt(l-f*S),lt(J-S),"L",lt(l-f*S),lt(J+S),"Z"])}}),ae("packages/modules/gantt/messages.js",function(m,bt){"use strict";Object.defineProperty(m,"FALLBACK_EN",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(m,"createTranslator",{enumerable:!0,get:function(){return Q}});const vt=bt("packages/core/src/internal/util.js").isFunction,lt=Object.freeze({"gantt.lag":"+{days}d","gantt.lead":"{days}d","gantt.a11y.moved":"{name} moved to {date}","gantt.a11y.day":"day {day}","gantt.a11y.resized":"{name} resized to {days} days","gantt.a11y.linkFrom":"Linking from {name}. Focus the successor and press L.","gantt.a11y.linked":"Linked {from} to {to}, finish to start.","gantt.a11y.linkCancelled":"Link cancelled.","gantt.a11y.deleted":"{name} deleted.","gantt.a11y.undone":"Undone.","gantt.a11y.redone":"Redone.","gantt.a11y.nothingToUndo":"Nothing to undo.","gantt.a11y.nothingToRedo":"Nothing to redo.","gantt.workload.title":"Resource workload","gantt.workload.resource":"Resource","gantt.workload.total":"Total","gantt.workload.unassigned":"Unassigned","gantt.workload.cell":"{hours} h from {date}","gantt.workload.over":"{hours} h from {date}, over a capacity of {capacity} h","gantt.workload.expand":"Show {name}’s tasks","gantt.workload.collapse":"Hide {name}’s tasks","gantt.workload.unitToggle":"Hours / % / Cost","gantt.workload.unitHours":"Showing hours","gantt.workload.unitPercent":"Showing percent of capacity","gantt.workload.unitCost":"Showing cost","gantt.workload.cellPercent":"{percent}% from {date}","gantt.workload.overPercent":"{percent}% from {date}, over capacity","gantt.workload.cellNoCapacity":"No available hours from {date}","gantt.workload.cellCost":"{cost} from {date}","gantt.row.expand":"Expand {name}","gantt.row.collapse":"Collapse {name}","gantt.resource.over":"{name} — over-allocated","gantt.a11y.hoursSet":"{name}: {hours} h from {date}","gantt.a11y.hoursCleared":"{name}: no hours from {date}","gantt.a11y.hoursRefused":"{date} is not a working day; {name} was not changed.","gantt.tip.range":"{from} to {to}","gantt.tip.duration":"{days}d","gantt.tip.slack":"slack {days}d","gantt.tip.row":"{label}: {value}","gantt.tip.start":"Start","gantt.tip.end":"End","gantt.tip.date":"Date","gantt.tip.durationLabel":"Duration","gantt.tip.durationValue":"{days} days","gantt.tip.complete":"Complete","gantt.tip.effortLabel":"Effort","gantt.tip.effortValue":"{hours} h","gantt.tip.assigned":"Assigned","gantt.tip.cost":"Cost","gantt.tip.slackLabel":"Slack","gantt.tip.slackValue":"{days} days","gantt.histogram.title":"Resource histogram","gantt.histogram.tableTitle":"Resource histogram data","gantt.histogram.resource":"Resource","gantt.histogram.period":"Period","gantt.histogram.hours":"Hours","gantt.histogram.percent":"Percent of capacity","gantt.histogram.cost":"Cost","gantt.histogram.capacity":"Capacity","gantt.histogram.overAllocated":"Over-allocated","gantt.histogram.yes":"Yes","gantt.histogram.no":"No","gantt.histogram.tip":"{name}, {from} to {to}: {value}{capacity}{tasks}","gantt.histogram.tipHours":"{hours} h","gantt.histogram.tipPercent":"{percent}% of capacity","gantt.histogram.tipCost":"{cost}","gantt.histogram.tipCapacity":", capacity {hours} h","gantt.histogram.tipTasks":" ({tasks})","gantt.histogram.tipOver":", over capacity","gantt.histogram.tipNoCapacity":"no available hours","gantt.scurve.spi":"SPI {index}","gantt.scurve.cpi":"CPI {index}","gantt.picker.title":"Assign resources to {name}","gantt.picker.open":"Edit assignments for {name}","gantt.picker.search":"Search resources","gantt.picker.list":"Resources","gantt.picker.selected":"Assigned resources","gantt.picker.load":"{load}% booked of {capacity}% over these dates","gantt.picker.none":"No matching resources","gantt.picker.units":"{name}, units in percent","gantt.picker.remove":"Remove {name}","gantt.picker.apply":"Apply","gantt.picker.cancel":"Cancel","gantt.picker.warn":"{name} would be over-allocated: {load}% booked of {capacity}%","gantt.picker.ok":"No resource would be over-allocated","gantt.picker.assign":"Assign","gantt.col.effort":"Effort","gantt.col.units":"Units","gantt.print.page":"Page {page} of {pages}","gantt.print.printed":"Printed {date}"});function Q(rt,M){return function(l,J){const f=vt(M)?M():null,S=rt&&rt.grid,L=f&&vt(f.t)&&f||S&&S.messages&&vt(S.messages.t)&&S.messages||null;if(L){let B;try{B=L.t(l,J)}catch{B=null}if(typeof B=="string"&&B&&B!==l)return B}const A=lt[l];return A?A.replace(/\{(\w+)\}/g,(B,G)=>J&&G in J?String(J[G]):B):l}}}),ae("packages/modules/gantt/gestures.js",function(m,bt){"use strict";Object.defineProperty(m,"describeTask",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(m,"GanttGestures",{enumerable:!0,get:function(){return Q}});const vt=bt("packages/modules/charts/svg.js").round;function lt(rt,M){const at=rt.isSummary?"summary":rt.isMilestone?"milestone":"task",l=M.dateAxis===!1?`day ${vt(rt.es)} to ${vt(rt.ef)}`:`${M.iso(rt.es)} to ${M.iso(rt.ef)}`,J=[`${rt.name}, ${at}`,l];return rt.isMilestone||J.push(`${vt(rt.duration)} days`),rt.percentComplete!=null&&J.push(`${Math.round(rt.percentComplete)}% complete`),J.push(`slack ${vt(rt.totalFloat)} days`),rt.critical&&J.push("on the critical path"),J.join(", ")}class Q{#n;#i=null;#t=null;#e=null;constructor(M){this.#n=M}#o(){return this.#n.options()||{}}get dragging(){return this.#i!==null}#r(){const M=this.#n.plot();if(M&&typeof M.getScreenCTM=="function"){let l=null;try{l=M.getScreenCTM()}catch{l=null}if(l&&Number.isFinite(l.a)&&l.a>0)return{scale:l.a,origin:Number.isFinite(l.e)?l.e:0}}const at=M&&M.getBoundingClientRect?M.getBoundingClientRect():null;return{scale:1,origin:at&&at.left||0}}#a(M){const{scale:at,origin:l}=this.#r();return((M.clientX||0)-l)/at}#c(M){const{scale:at}=this.#r();return Math.round(M/at/(this.#n.pxPerDay()||1))}onPointerDown(M){const at=this.#n.controller.schedule;if(!at||!at.ok)return;const l=this.#n.rowOf(M.target);if(!l)return;const J=l.getAttribute("data-task"),f=at.tasks.get(J);if(!f||f.isSummary)return;const S=this.#n.barOf(l);if(!S)return;const L=this.#a(M),A=Number.isFinite(this.#o().resizeZone)?Number(this.#o().resizeZone):6,B=!f.isMilestone&&L>=this.#u(S)-A?"resize":"move";this.#i={id:J,mode:B,startX:M.clientX||0,origStart:f.es,origDuration:f.duration,barEl:S},M.preventDefault&&M.preventDefault();const G=w=>this.#s(w),tt=w=>this.#y(w);this.#t={move:G,up:tt},this.#n.doc.addEventListener("pointermove",G),this.#n.doc.addEventListener("pointerup",tt)}#u(M){const at=parseFloat(M.getAttribute("x")),l=parseFloat(M.getAttribute("width"));return Number.isFinite(at)&&Number.isFinite(l)?at+l:Number.POSITIVE_INFINITY}#s(M){if(!this.#i)return;const at=this.#n.pxPerDay()||1,l=this.#c((M.clientX||0)-this.#i.startX),J=this.#i.barEl;if(this.#i.mode==="move")J.getAttribute("d")?this.#S(J,l*at):(J.setAttribute("x",vt(parseFloat(J.getAttribute("x"))+l*at-this.#d(J))),this.#g(J,l*at));else{const f=Math.max(1,parseFloat(J.getAttribute("width"))+(l*at-this.#d(J)));J.setAttribute("width",vt(f)),this.#g(J,l*at)}}#d(M){return parseFloat(M.getAttribute("data-preview")||"0")}#g(M,at){M.setAttribute("data-preview",String(at))}#S(M,at){const l=this.#d(M),J=M.getAttribute("d").split(" ");for(let f=1;f<J.length;f+=1){const S=parseFloat(J[f]);!Number.isNaN(S)&&f%3===1&&(J[f]=String(vt(S+(at-l))))}M.setAttribute("d",J.join(" ")),this.#g(M,at)}#y(M){const at=this.#i;if(this.#_(),this.#i=null,!at)return;const l=this.#c((M.clientX||0)-at.startX);if(l===0){this.#n.redraw();return}at.mode==="move"?this.#n.controller.applyEdit({id:at.id,start:at.origStart+l},{writeBack:!0}):this.#n.controller.applyEdit({id:at.id,duration:Math.max(0,at.origDuration+l)},{writeBack:!0}),this.#n.redraw()}#_(){this.#t&&(this.#n.doc.removeEventListener("pointermove",this.#t.move),this.#n.doc.removeEventListener("pointerup",this.#t.up),this.#t=null)}onKey(M){const at=this.#n.controller,l=at.schedule;if(!l||!l.ok)return;const J=this.#n.rowOf(M.target),f=J?J.getAttribute("data-task"):null,S=f?l.tasks.get(f):null;if(!S)return;const L=this.#o(),A=Number.isFinite(L.moveStep)?Number(L.moveStep):1,B=M.key,G=this.#n.t;if(B==="ArrowRight"||B==="ArrowLeft"){if(S.isSummary)return;const tt=B==="ArrowRight"?1:-1;if(this.#n.focusTask(f),M.shiftKey){if(S.isMilestone)return;const w=Math.max(0,S.duration+tt*A);at.applyEdit({id:f,duration:w},{writeBack:!0}),this.#n.announce(G("gantt.a11y.resized",{name:S.name,days:w}))}else{const w=S.es+tt*A,g=L.dateAxis===!1?G("gantt.a11y.day",{day:w}):this.#n.iso(w);at.applyEdit({id:f,start:w},{writeBack:!0}),this.#n.announce(G("gantt.a11y.moved",{name:S.name,date:g}))}M.preventDefault&&M.preventDefault()}else if(B==="l"||B==="L"){if(S.isSummary)return;if(!this.#e)this.#e=f,this.#n.announce(G("gantt.a11y.linkFrom",{name:S.name}));else if(this.#e!==f){const tt=this.#e;this.#e=null,this.#n.focusTask(f),at.setDependencies([...at.dependencies,{from:tt,to:f,type:"FS"}]),this.#n.announce(G("gantt.a11y.linked",{from:tt,to:S.name}))}M.preventDefault&&M.preventDefault()}else if(B==="Delete"||B==="Backspace"){if(S.isSummary)return;at.deleteTask(f),this.#n.announce(G("gantt.a11y.deleted",{name:S.name})),M.preventDefault&&M.preventDefault()}else B==="Escape"&&this.#e&&(this.#e=null,this.#n.announce(G("gantt.a11y.linkCancelled")))}onHistoryKey(M){if(!M||!(M.ctrlKey||M.metaKey))return;const at=this.#n;if(typeof at.editing=="function"&&at.editing())return;const l=M.target,J=l&&l.tagName?String(l.tagName).toLowerCase():"";if(J==="input"||J==="textarea"||J==="select"||l&&l.isContentEditable)return;const f=typeof M.key=="string"?M.key.toLowerCase():"";let S;if(f==="z"&&!M.shiftKey)S=at.controller.undo()?"gantt.a11y.undone":"gantt.a11y.nothingToUndo";else if(f==="z"&&M.shiftKey||f==="y")S=at.controller.redo()?"gantt.a11y.redone":"gantt.a11y.nothingToRedo";else return;at.announce(at.t(S)),M.preventDefault&&M.preventDefault()}destroy(){this.#_(),this.#i=null,this.#e=null}}}),ae("packages/modules/gantt/export.js",function(m,bt){"use strict";Object.defineProperty(m,"PRINT_NS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(m,"PAPERS",{enumerable:!0,get:function(){return at}}),Object.defineProperty(m,"PAGE_MARGIN",{enumerable:!0,get:function(){return l}}),Object.defineProperty(m,"PALETTE",{enumerable:!0,get:function(){return A}}),Object.defineProperty(m,"esc",{enumerable:!0,get:function(){return B}}),Object.defineProperty(m,"paperPx",{enumerable:!0,get:function(){return G}}),Object.defineProperty(m,"resolveRange",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(m,"cellText",{enumerable:!0,get:function(){return w}}),Object.defineProperty(m,"barMarkup",{enumerable:!0,get:function(){return g}}),Object.defineProperty(m,"timeHeadMarkup",{enumerable:!0,get:function(){return y}}),Object.defineProperty(m,"bandRowsMarkup",{enumerable:!0,get:function(){return H}}),Object.defineProperty(m,"buildSplitSVG",{enumerable:!0,get:function(){return F}}),Object.defineProperty(m,"inlineSvgStyles",{enumerable:!0,get:function(){return et}}),Object.defineProperty(m,"rasterizePNG",{enumerable:!0,get:function(){return it}}),Object.defineProperty(m,"buildPrintDocument",{enumerable:!0,get:function(){return xt}}),Object.defineProperty(m,"openPrintWindow",{enumerable:!0,get:function(){return _t}});const vt=bt("packages/modules/charts/scale.js").linearScale,lt=bt("packages/modules/gantt/time.js"),Q=lt.toISODate,rt=lt.toDayNumber,M="lat-gantt-print",at=Object.freeze({A4:{w:794,h:1123},Letter:{w:816,h:1056},A3:{w:1123,h:1587}}),l=36,J=26,f=20,S=24,L=28,A=Object.freeze({text:"#1f2933",muted:"#57606a",border:"#d0d7de",surface:"#f1f3f5",bar:"#4a90d9",critical:"#e2513b",summary:"#2c3e50",milestone:"#33404d",progress:"rgba(0,0,0,0.28)",today:"#e2513b",workload:"#4a90d9",histogram:"#2c7a7b",over:"#e2513b",pageBg:"#ffffff"});function B(D){return String(D??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function G(D,K){const N=at[D]||at.A4;return K==="portrait"?{w:N.w,h:N.h}:{w:N.h,h:N.w}}function tt(D,K){const N=K&&K.from!=null?rt(K.from):D.domainMin,b=K&&K.to!=null?rt(K.to):D.domainMax;return Number.isFinite(N)&&Number.isFinite(b)&&b>N?{from:N,to:b}:{from:D.domainMin,to:D.domainMax}}function w(D,K,N){switch(D.kind){case"name":return K.name??"";case"start":return Q(K.es)??String(K.es);case"end":return Q(K.ef)??String(K.ef);case"duration":return String(Math.round(K.ef-K.es));case"assignee":{const b=N?N.assignee??N.assignees??N.owner:null;return(Array.isArray(b)?b:b==null?[]:[b]).map(String).filter(Boolean).join(", ")}case"progress":return K.percentComplete==null?"":`${Math.round(K.percentComplete)}%`;default:return N&&D.key?String(N[D.key]??""):""}}function g(D,K,N,b){if(!Number.isFinite(D.es)||!Number.isFinite(D.ef))return"";const x=Math.max(2,Math.round(b*.18)),z=N+x,X=Math.max(2,b-x*2);if(D.milestone){const It=K(D.es),a=N+b/2,h=Math.max(4,Math.min(9,b*.3)),k=D.critical?A.critical:A.milestone;return`<path d="M ${It} ${a-h} L ${It+h} ${a} L ${It} ${a+h} L ${It-h} ${a} Z" fill="${k}"/>`}const p=K(D.es),St=K(D.ef),st=Math.max(1,St-p),At=D.isSummary?A.summary:D.critical?A.critical:A.bar;let zt=`<rect x="${p}" y="${z}" width="${st}" height="${X}" rx="3" fill="${At}"/>`;if(!D.isSummary&&D.percentComplete!=null&&D.percentComplete>0){const It=Math.max(0,Math.min(100,D.percentComplete)),a=Math.round(st*It/100);zt+=`<rect x="${p}" y="${z}" width="${a}" height="${X}" fill="${A.progress}"/>`}return zt}function y(D,K,N,b,x,z){const X=z==="month"||z==="quarter"?30:7;let p=`<rect x="0" y="0" width="${b}" height="${x}" fill="${A.surface}"/>`,St=Math.floor(D/X)*X;for(;St<K;St+=X){const st=N(St);p+=`<line x1="${st}" y1="0" x2="${st}" y2="${x}" stroke="${A.border}"/>`,p+=`<text x="${st+4}" y="${Math.round(x*.68)}" font-size="11" font-weight="600" fill="${A.muted}">${B(Q(St)??String(St))}</text>`}return p+=`<line x1="0" y1="${x}" x2="${b}" y2="${x}" stroke="${A.border}"/>`,p}function H(D,K,N,b,x,z){if(!D||!D.rows||!D.rows.length)return"";const X=Math.max(1,...D.rows.flatMap(St=>(St.cells||[]).filter(st=>st!=null)));let p="";return D.rows.forEach((St,st)=>{const At=x+st*b;p+=`<text x="4" y="${At+b/2+4}" font-size="11" fill="${A.text}">${B(St.label)}</text>`,p+=`<line x1="0" y1="${At+b}" x2="${N}" y2="${At+b}" stroke="${A.border}"/>`,(St.cells||[]).forEach((zt,It)=>{if(zt==null)return;const a=D.buckets[It];if(!a)return;const h=N+K(a.start),k=Math.max(1,K(a.end)-K(a.start)-2),_=Math.max(1,Math.round(zt/X*(b-8))),j=At+b-4-_,P=St.over&&St.over[It];p+=`<rect x="${h}" y="${j}" width="${k}" height="${_}" fill="${P?A.over:z}"/>`})}),p}function F(D,K={}){const N=tt(D,K.range),b=Math.max(1,Math.round(D.pxPerDay*(N.to-N.from))),x=vt({min:N.from,max:N.to},[0,b]),z=k=>Math.round(x.of(k)),X=D.columnWidths.reduce((k,_)=>k+_,0),p=X+b,St=Math.max(S,L),st=St;let At=0;D.workload&&(At+=D.workload.cfg.height),D.histogram&&(At+=D.histogram.cfg.height);const zt=st+D.totalHeight+At;let It="",a=0;for(let k=0;k<D.columns.length;k++){const _=D.columnWidths[k];It+=`<text x="${a+6}" y="${Math.round(St*.65)}" font-size="11" font-weight="600" fill="${A.muted}">${B(D.columns[k].title||D.columns[k].key)}</text>`,a+=_}It+=`<line x1="0" y1="${St}" x2="${X}" y2="${St}" stroke="${A.border}"/>`,It+=`<g transform="translate(${X},0)">${y(N.from,N.to,z,b,St,D.zoomLevel)}</g>`;for(const k of D.rows){const _=st+k.top;let j=0;for(let P=0;P<D.columns.length;P++){const I=D.columns[P],r=D.columnWidths[P],o=w(I,k.rec,D.rawById.get(String(k.id))),n=I.kind==="name"?k.depth*14+6:6;It+=`<text x="${j+n}" y="${_+k.height/2+4}" font-size="12" font-weight="${k.rec.isSummary?600:400}" fill="${k.rec.isSummary?A.summary:A.text}">${B(o)}</text>`,j+=r}It+=`<line x1="0" y1="${_+k.height}" x2="${p}" y2="${_+k.height}" stroke="${A.border}"/>`,It+=`<g transform="translate(${X},${_})">${g(k.rec,z,0,k.height)}</g>`}if(D.today!=null&&D.today>=N.from&&D.today<=N.to){const k=X+z(D.today);It+=`<line x1="${k}" y1="0" x2="${k}" y2="${st+D.totalHeight}" stroke="${A.today}" stroke-width="1.5" stroke-dasharray="4 3"/>`}let h=st+D.totalHeight;for(const[k,_]of[[D.workload,A.workload],[D.histogram,A.histogram]]){if(!k)continue;const j=Math.max(40,X);It+=`<rect x="0" y="${h}" width="${p}" height="${k.cfg.height}" fill="${A.pageBg}"/>`,It+=`<g transform="translate(${j},0)">${H(k.data,z,0,k.cfg.rowHeight,h,_)}</g>`,It+=`<line x1="0" y1="${h}" x2="${p}" y2="${h}" stroke="${A.border}" stroke-width="2"/>`,h+=k.cfg.height}return`<svg xmlns="http://www.w3.org/2000/svg" width="${p}" height="${zt}" viewBox="0 0 ${p} ${zt}" font-family="system-ui,sans-serif"><rect x="0" y="0" width="${p}" height="${zt}" fill="${A.pageBg}"/>${It}</svg>`}function et(D,K,N){const b=["fill","fill-opacity","stroke","stroke-width","stroke-opacity","stroke-dasharray","stroke-linejoin","stroke-linecap","font-size","font-family","font-weight","opacity","text-anchor","dominant-baseline","visibility"],x=[D,...D.querySelectorAll("*")],z=[K,...K.querySelectorAll("*")];for(let X=0;X<x.length&&X<z.length;X++){const p=N.getComputedStyle(x[X]),St=[];for(const st of b){const At=p.getPropertyValue(st);At&&St.push(`${st}:${At}`)}St.length&&z[X].setAttribute("style",St.join(";"))}}async function it(D,K,N,b,x,z){const X=D&&D.defaultView||globalThis;if(!X.Image||!D.createElement)return null;const p=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(K)}`,St=new X.Image;await new Promise((zt,It)=>{St.onload=zt,St.onerror=()=>It(new Error("the plan could not be rasterised")),St.src=p});const st=D.createElement("canvas");st.width=Math.max(1,Math.round(N*x)),st.height=Math.max(1,Math.round(b*x));const At=st.getContext("2d");return z&&(At.fillStyle=z,At.fillRect(0,0,st.width,st.height)),At.drawImage(St,0,0,st.width,st.height),new Promise(zt=>st.toBlob(zt,"image/png"))}function $(D,K){const N=[];let b=[],x=0;for(const z of D){const X=Math.max(1,z.height);b.length&&x+X>K&&(N.push(b),b=[],x=0),b.push(z),x+=X}return(b.length||!N.length)&&N.push(b),N}function Y(D){return`
|
|
6
|
+
(function(ze){"use strict";var Ee=Object.create(null),Fe=Object.create(null);function se(y,yt){Ee[y]=yt}function Le(y){var yt=Fe[y];if(yt)return yt;var Gt=Object.create(null);Fe[y]=Gt;var $t=Ee[y];if(!$t)throw new Error("[lattice] missing module: "+y);return $t(Gt,Le),Gt}se("packages/core/src/internal/util.js",function(y,yt){"use strict";Object.defineProperty(y,"VERSION",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(y,"reportedWarnings",{enumerable:!0,get:function(){return x}}),Object.defineProperty(y,"warnOnce",{enumerable:!0,get:function(){return M}}),Object.defineProperty(y,"infoOnce",{enumerable:!0,get:function(){return B}}),Object.defineProperty(y,"resetWarnings",{enumerable:!0,get:function(){return G}}),Object.defineProperty(y,"fail",{enumerable:!0,get:function(){return et}}),Object.defineProperty(y,"invariant",{enumerable:!0,get:function(){return $}}),Object.defineProperty(y,"DEV",{enumerable:!0,get:function(){return b}}),Object.defineProperty(y,"isObject",{enumerable:!0,get:function(){return w}}),Object.defineProperty(y,"isFunction",{enumerable:!0,get:function(){return H}}),Object.defineProperty(y,"isNil",{enumerable:!0,get:function(){return F}}),Object.defineProperty(y,"isBlank",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(y,"isCtor",{enumerable:!0,get:function(){return it}}),Object.defineProperty(y,"pathGetter",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(y,"pathSetter",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(y,"getPath",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(y,"setPath",{enumerable:!0,get:function(){return Ct}}),Object.defineProperty(y,"humanise",{enumerable:!0,get:function(){return at}}),Object.defineProperty(y,"escapeHtml",{enumerable:!0,get:function(){return D}}),Object.defineProperty(y,"titleCase",{enumerable:!0,get:function(){return X}}),Object.defineProperty(y,"expand",{enumerable:!0,get:function(){return T}}),Object.defineProperty(y,"toArray",{enumerable:!0,get:function(){return k}}),Object.defineProperty(y,"merge",{enumerable:!0,get:function(){return W}}),Object.defineProperty(y,"mergeRow",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(y,"Lru",{enumerable:!0,get:function(){return m}}),Object.defineProperty(y,"collator",{enumerable:!0,get:function(){return st}}),Object.defineProperty(y,"defaultCompare",{enumerable:!0,get:function(){return At}}),Object.defineProperty(y,"now",{enumerable:!0,get:function(){return Ut}}),Object.defineProperty(y,"nextFrame",{enumerable:!0,get:function(){return l}}),Object.defineProperty(y,"cancelFrame",{enumerable:!0,get:function(){return g}}),Object.defineProperty(y,"frameBatched",{enumerable:!0,get:function(){return v}}),Object.defineProperty(y,"settleDebounce",{enumerable:!0,get:function(){return C}}),Object.defineProperty(y,"whenIdle",{enumerable:!0,get:function(){return E}}),Object.defineProperty(y,"uid",{enumerable:!0,get:function(){return I}});const Gt="1.88.3";async function $t(){return Gt}const ct="1.88.3",tt=new Set,rt=2e3;function N(i){if(tt.add(i),tt.size>rt){const o=tt.values().next().value;o!==void 0&&tt.delete(o)}}const lt=[],c=500;function J(i,o,e){lt.push({key:i,level:o,message:e.map(d=>typeof d=="string"?d:p(d)).join(" "),at:Date.now()}),lt.length>c&<.shift()}function p(i){if(i instanceof Error)return i.message;try{return JSON.stringify(i)}catch{return String(i)}}function x(){return lt.map(i=>({...i}))}function L(i){if(i.length===0||typeof i[0]!="string")return i;const o=i[0].replace(/^\[lattice\]\s*/,"");return o===i[0]?i:[o,...i.slice(1)]}function M(i,...o){if(tt.has(i))return;N(i);const e=L(o);J(i,"warn",e),console.warn("[lattice]",...e)}function B(i,...o){if(tt.has(i))return;N(i);const e=L(o);J(i,"info",e),console.info("[lattice]",...e)}function G(){tt.clear(),lt.length=0}function et(i,o){const e=new Error(`[lattice] ${i}`);throw o!==void 0&&(e.cause=o),e}function $(i,o){i||et(o)}const b=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function w(i){return i!==null&&typeof i=="object"&&!Array.isArray(i)}function H(i){return typeof i=="function"}function F(i){return i==null}function nt(i){return i==null||i===""}function it(i){return typeof i!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(i))?!0:!!(i.prototype&&Object.getOwnPropertyNames(i.prototype).length>1)}const _=new Map;function Y(i){let o=_.get(i);if(o)return o;if(!i.includes("."))o=e=>e?.[i];else{const e=i.split("."),d=e.length;o=t=>{let h=t;for(let u=0;u<d;u++){if(h==null)return;h=h[e[u]]}return h}}return _.set(i,o),o}const R=new Map;function ft(i){let o=R.get(i);if(o)return o;if(!i.includes("."))o=(e,d)=>{e!=null&&(e[i]=d)};else{const e=i.split("."),d=e.length-1;o=(t,h)=>{let u=t;for(let q=0;q<d;q++){if(u==null)return;const U=e[q];u[U]==null&&(u[U]={}),u=u[U]}u!=null&&(u[e[d]]=h)}}return R.set(i,o),o}function mt(i,o){return Y(o)(i)}function Ct(i,o,e){ft(o)(i,e)}function at(i){return i?(i.includes(".")?i.slice(i.lastIndexOf(".")+1):i).replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,e=>e.toUpperCase()):""}const xt={"&":"&","<":"<",">":">",'"':""","'":"'"};function D(i){const o=i==null?"":String(i);return/[&<>"']/.test(o)?o.replace(/[&<>"']/g,e=>xt[e]):o}function X(i){return String(i).replace(/\w\S*/g,o=>o[0].toUpperCase()+o.slice(1).toLowerCase())}function T(i,o,e){if(i!==void 0)return i===!0?{enabled:!0,...e}:i===!1?{enabled:!1}:w(i)?i:{[o]:i,enabled:!0}}function k(i){return i==null?[]:Array.isArray(i)?i:[i]}const A=Object.freeze(new Set(["__proto__","constructor","prototype"]));function W(i,o){if(!w(i))return w(o)?{...o}:o;if(!w(o))return o===void 0?i:o;const e={...i};for(const d of Object.keys(o)){if(A.has(d))continue;const t=o[d];t!==void 0&&(e[d]=w(t)&&w(e[d])?W(e[d],t):t)}return e}function Z(i,o){if(!w(i)||!w(o)||i===o)return o;const e=Object.create(Object.getPrototypeOf(i));return Object.assign(e,i,o),e}class m{#n;#s=new Map;#t;constructor(o=256,e=null){this.#n=o,this.#t=e}get size(){return this.#s.size}get max(){return this.#n}set max(o){this.#n=o,this.#e()}has(o){return this.#s.has(o)}get(o){const e=this.#s;if(!e.has(o))return;const d=e.get(o);return e.delete(o),e.set(o,d),d}peek(o){return this.#s.get(o)}set(o,e){const d=this.#s;return d.has(o)&&d.delete(o),d.set(o,e),this.#e(),e}delete(o){const e=this.#s.get(o);return this.#s.delete(o)&&this.#t&&this.#t(e,o),e}clear(){if(this.#t)for(const[o,e]of this.#s)this.#t(e,o);this.#s.clear()}keys(){return this.#s.keys()}values(){return this.#s.values()}#e(){const o=this.#s;for(;o.size>this.#n;){const e=o.keys().next().value,d=o.get(e);o.delete(e),this.#t&&this.#t(d,e)}}}const St=new Map;function st(i,o){const e=`${i||""}|${o?JSON.stringify(o):""}`;let d=St.get(e);return d||(d=new Intl.Collator(i||void 0,{numeric:!0,sensitivity:"variant",...o}),St.set(e,d)),d}function At(i,o){if(i===o)return 0;if(i==null)return 1;if(o==null)return-1;if(typeof i=="number"&&typeof o=="number")return Number.isNaN(i)?Number.isNaN(o)?0:1:Number.isNaN(o)||i<o?-1:i>o?1:0;const e=String(i),d=String(o);return e<d?-1:e>d?1:0}function Ut(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const It=typeof requestAnimationFrame=="function";function l(i){return It?requestAnimationFrame(i):setTimeout(()=>i(Ut()),16)}function g(i){i!=null&&(It?cancelAnimationFrame(i):clearTimeout(i))}function v(i){let o=null,e=null;const d=()=>{o=null;const h=e;e=null,i(...h||[])},t=(...h)=>{e=h,o===null&&(o=l(d))};return t.cancel=()=>{g(o),o=null,e=null},t.flush=()=>{o!==null&&(g(o),d())},t}function C(i,o){let e=null,d=null;const t=()=>{if(e=null,d===null)return;const q=d;d=null,i(...q),h()},h=()=>{e=setTimeout(t,o),typeof e?.unref=="function"&&e.unref()},u=(...q)=>{e===null?(i(...q),h()):(d=q,clearTimeout(e),h())};return u.flush=()=>{if(e!==null&&clearTimeout(e),e=null,d===null)return;const q=d;d=null,i(...q)},u.cancel=()=>{e!==null&&clearTimeout(e),e=null,d=null},u.pending=()=>e!==null||d!==null,u}function E(i,o=50){return typeof requestIdleCallback=="function"?requestIdleCallback(i,{timeout:o}):setTimeout(()=>i({timeRemaining:()=>0,didTimeout:!0}),1)}let O=0;function I(i="l"){return`${i}${(++O).toString(36)}`}}),se("packages/modules/shared/emitter.js",function(y,yt){"use strict";Object.defineProperty(y,"WILDCARD",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(y,"Emitter",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(y,"gate",{enumerable:!0,get:function(){return c}});const Gt=yt("packages/core/src/internal/util.js"),$t=Gt.isFunction,ct=Gt.warnOnce,tt="*",rt=new Set(["api","user","init","ai"]);function N(J,p){return J&&J.name?J.name:`#${p}`}class lt{#n=new Map;#s;constructor(p="module"){this.#s=String(p)}on(p,x){if(!$t(x))return()=>{};let L=this.#n.get(p);return L||(L=new Set,this.#n.set(p,L)),L.add(x),()=>this.off(p,x)}off(p,x){const L=this.#n.get(p);L&&L.delete(x)}count(p){const x=this.#n.get(p);return x?x.size:0}emit(p,x){const L=this.#n.get(p),M=this.#n.get(tt);if((!L||L.size===0)&&(!M||M.size===0))return;const B={...x||null,type:p};L&&L.size&&this.#t([...L],B,p),M&&M.size&&this.#t([...M],B,tt)}#t(p,x,L){for(let M=0;M<p.length;M++)try{p[M](x)}catch(B){ct(`${this.#s}.emit.throw:${L}:${N(p[M],M)}`,`${this.#s}: a '${L}' handler threw; other handlers were unaffected.`,B)}}emitBefore(p,x,L){const M=L??(x&&x.origin),B=rt.has(M)?M:"user";let G=!1,et=null;const $=it=>{G=!0,it!=null&&et===null&&(et=String(it))},b={...x||null,type:p,origin:B,get defaultPrevented(){return G},get reason(){return et},preventDefault(it){$(it)}},w=this.#n.get(p);if(!w||w.size===0)return!0;const H=[...w],F=()=>(G&&et===null&&(et="prevented"),G&&x&&typeof x=="object"&&(x.reason=et),!G),nt=[];for(let it=0;it<H.length;it++){const _=H[it];try{const Y=_(b);Y&&$t(Y.then)?nt.push(Y):Y===!1&&$("prevented")}catch(Y){$("error"),ct(`${this.#s}.beforeThrow:${p}:${N(_,it)}`,`${this.#s}: a '${p}' before-handler threw; the action was cancelled.`,Y)}}return nt.length===0?F():Promise.allSettled(nt).then(it=>{for(const _ of it)_.status==="rejected"?($("error"),ct(`${this.#s}.beforeReject:${p}`,`${this.#s}: a '${p}' before-handler rejected; the action was cancelled.`,_.reason)):_.value===!1&&$("prevented");return F()})}clear(){this.#n.clear()}}function c(J,p,x,L,M){const B=J.emitBefore(p,L,L.origin),G=()=>(J.emit(x,{...L,reason:L.reason||"prevented"}),!1);return B===!1?G():B&&$t(B.then)?B.then(et=>et?M():G()):M()}}),se("packages/core/src/model/history.js",function(y,yt){"use strict";Object.defineProperty(y,"DEFAULT_HISTORY_DEPTH",{enumerable:!0,get:function(){return N}}),Object.defineProperty(y,"DEFAULT_COALESCE_MS",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(y,"HISTORY_TYPES",{enumerable:!0,get:function(){return c}}),Object.defineProperty(y,"COALESCING_TYPES",{enumerable:!0,get:function(){return J}}),Object.defineProperty(y,"HISTORY_LABELS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(y,"diffSlices",{enumerable:!0,get:function(){return G}}),Object.defineProperty(y,"HistoryModel",{enumerable:!0,get:function(){return et}});const Gt=yt("packages/core/src/internal/util.js"),$t=Gt.warnOnce,ct=Gt.isFunction,tt=Gt.isObject,rt=Gt.now,N=10,lt=400,c=["sort","filter","group","pivot","column:move","column:resize","column:visible","column:pin","column:decorate","page","edit","transaction"],J=new Set(["column:resize","column:move"]),p={sort:"sort",filter:"filter",group:"grouping",pivot:"pivot",formatting:"conditional formatting","column:move":"column move","column:resize":"column resize","column:visible":"column visibility","column:pin":"column pin","column:decorate":"column decoration",page:"page change",edit:"edit",transaction:"change"};function x($){if($===null||typeof $!="object")return $;try{return structuredClone($)}catch{try{return JSON.parse(JSON.stringify($))}catch{return $}}}function L($,b){if($===b)return!0;if($===null||b===null||typeof $!="object"||typeof b!="object")return $!==$&&b!==b;if($ instanceof Date||b instanceof Date)return $ instanceof Date&&b instanceof Date&&$.getTime()===b.getTime();if(Array.isArray($)||Array.isArray(b))return!Array.isArray($)||!Array.isArray(b)||$.length!==b.length?!1:$.every((F,nt)=>L(F,b[nt]));const w=Object.keys($),H=Object.keys(b);return w.length!==H.length?!1:w.every(F=>Object.prototype.hasOwnProperty.call(b,F)&&L($[F],b[F]))}function M($,b){const w=new Map;for(const it of b)tt(it)&&typeof it.id=="string"&&w.set(it.id,it);const H=new Set,F=[],nt=[];for(const it of $){if(!tt(it)||typeof it.id!="string")continue;H.add(it.id);const _=w.get(it.id);if(!_){F.push({...it});continue}const Y=new Set([...Object.keys(it),...Object.keys(_)]);Y.delete("id");const R={id:it.id},ft={id:it.id};let mt=!1;for(const Ct of Y)L(it[Ct],_[Ct])||(mt=!0,Ct in it&&(R[Ct]=it[Ct]),Ct in _&&(ft[Ct]=_[Ct]));mt&&(F.push(R),nt.push(ft))}for(const it of b)!tt(it)||typeof it.id!="string"||H.has(it.id)||nt.push({...it});return F.length===0&&nt.length===0?null:{before:F,after:nt}}function B($){if(typeof $=="string")return"";if(Array.isArray($))return[]}function G($,b){const w=tt($)?$:null,H=tt(b)?b:null;if(!w&&!H)return null;if(!w||!H)return{before:w?{...w}:null,after:H?{...H}:null};const F={},nt={};let it=!1;const _=new Set([...Object.keys(w),...Object.keys(H)]);_.delete("version");for(const Y of _){if(Y==="columns"&&Array.isArray(w.columns)&&Array.isArray(H.columns)){const mt=M(w.columns,H.columns);if(!mt)continue;F.columns=mt.before,nt.columns=mt.after,it=!0;continue}if(L(w[Y],H[Y]))continue;it=!0;const R=Y in w,ft=Y in H;R?F[Y]=w[Y]:B(H[Y])!==void 0&&(F[Y]=B(H[Y])),ft?nt[Y]=H[Y]:B(w[Y])!==void 0&&(nt[Y]=B(w[Y]))}return it?(F.columns&&Array.isArray(w.columnOrder)&&(F.columnOrder=w.columnOrder),nt.columns&&Array.isArray(H.columnOrder)&&(nt.columnOrder=H.columnOrder),w.version!==void 0&&(F.version=w.version),H.version!==void 0&&(nt.version=H.version),{before:F,after:nt}):null}class et{#n=[];#s=[];#t=N;#e=lt;#i=null;#r=null;#a=null;#c=rt;#u=!1;#o=0;#d=0;constructor(b={}){b.apply&&(this.#i=b.apply),b.capture&&(this.#r=b.capture),b.edit&&(this.#a=b.edit),ct(b.now)&&(this.#c=b.now),this.configure(b)}configure(b={}){typeof b.depth=="number"&&b.depth>=0&&(this.#t=Math.floor(b.depth),this.#y()),typeof b.coalesceMs=="number"&&b.coalesceMs>=0&&(this.#e=b.coalesceMs)}get depth(){return this.#t}set depth(b){this.configure({depth:b})}get coalesceMs(){return this.#e}set coalesceMs(b){this.configure({coalesceMs:b})}get size(){return this.#n.length}get redoSize(){return this.#s.length}get replaying(){return this.#u}canUndo(){return this.#n.length>0}canRedo(){return this.#s.length>0}push(b){if(this.#u||this.#o>0||this.#t===0||!tt(b)||typeof b.type!="string"||!b.type)return null;const w=b.type,H=w==="edit";let F=null,nt=null;if(!H){const Y=G(x(b.before??null),x(b.after??null));if(!Y)return null;F=Y.before,nt=Y.after}const it={seq:++this.#d,type:w,label:typeof b.label=="string"&&b.label?b.label:p[w]||w,target:b.target==null?null:String(b.target),before:F,after:nt,at:typeof b.at=="number"?b.at:this.#c(),delegated:H,mergeable:H?!1:b.coalesce===void 0?J.has(w):!!b.coalesce};this.#s.length=0;const _=this.#g(it);return _!==void 0?_:(this.#n.push(it),this.#y(),it)}recordEdit(b,w={}){return this.push({type:"edit",label:b,target:w.target,at:w.at})}transaction(b,w,H={}){if(!ct(w))return null;if(this.#u||this.#o>0){this.#o++;try{w()}finally{this.#o--}return null}const F=H.type||"transaction",nt=H.type?F:void 0,it=this.#_(nt,H.target);this.#o++;try{w()}finally{this.#o--}const _=this.#_(nt,H.target);return this.push({type:F,label:b,target:H.target,before:it,after:_,coalesce:H.coalesce===void 0?!1:H.coalesce})}#g(b){if(!b.mergeable)return;const w=this.#n[this.#n.length-1];if(!w||!w.mergeable||w.delegated||w.type!==b.type||w.target!==b.target||b.at-w.at>this.#e)return;const H=G(w.before,b.after);return H?(w.before=H.before,w.after=H.after,w.at=b.at,w.label=b.label,w):(this.#n.pop(),null)}#_(b,w){if(!this.#r)return null;try{return x(this.#r(b,w??null))}catch(H){return $t("history.capture.throw","history capture threw; the action was not recorded.",H),null}}#y(){for(;this.#n.length>this.#t;)this.#n.shift();for(;this.#s.length>this.#t;)this.#s.shift()}undo(){return this.#S("undo")}redo(){return this.#S("redo")}#S(b){if(this.#u)return null;const w=b==="undo"?this.#n:this.#s,H=b==="undo"?this.#s:this.#n;this.#u=!0;try{for(;w.length;){const F=w[w.length-1],nt=this.#C(F,b);if(F.delegated){if(!this.#x(b)){w.pop();continue}}else nt.patch&&this.#A(nt.patch,nt);return w.pop(),H.push(F),this.#y(),nt}return null}finally{this.#u=!1}}#x(b){const w=this.#a;if(!w||!ct(w[b]))return!1;try{return w[b]({origin:"history"})!=null}catch(H){return $t("history.edit.throw",`edit ${b} threw; the entry was dropped.`,H),!1}}#A(b,w){if(this.#i)try{this.#i(b,w)}catch(H){$t("history.apply.throw",`applying the ${w.direction} of '${w.label}' threw.`,H)}}#C(b,w){return{direction:w,seq:b.seq,type:b.type,label:b.label,target:b.target,at:b.at,delegated:b.delegated,patch:b.delegated?null:x(w==="undo"?b.before:b.after)}}peek(b="undo"){const w=b==="redo"?this.#s:this.#n,H=w[w.length-1];return H?{seq:H.seq,type:H.type,label:H.label,target:H.target,at:H.at,delegated:H.delegated}:null}list(){const b=(w,H)=>({seq:w.seq,type:w.type,label:w.label,target:w.target,at:w.at,delegated:w.delegated,undone:H});return[...this.#s.map(w=>b(w,!0)),...[...this.#n].reverse().map(w=>b(w,!1))]}clear(){this.#n.length=0,this.#s.length=0}destroy(){this.clear(),this.#a=null}}}),se("packages/modules/gantt/time.js",function(y,yt){"use strict";Object.defineProperty(y,"toDayNumber",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(y,"fromDayNumber",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(y,"toISODate",{enumerable:!0,get:function(){return N}}),Object.defineProperty(y,"resolveProjectEpoch",{enumerable:!0,get:function(){return lt}});const $t=yt("packages/core/src/internal/util.js").warnOnce,ct=864e5;function tt(c){if(c==null||c==="")return null;if(typeof c=="number")return Number.isFinite(c)?c:null;if(c instanceof Date)return Number.isFinite(c.getTime())?Math.floor(Date.UTC(c.getFullYear(),c.getMonth(),c.getDate())/ct):null;const J=Date.parse(c);return Number.isFinite(J)?Math.floor(J/ct):null}function rt(c){return Number.isFinite(c)?new Date(Math.round(c)*ct):null}function N(c){const J=rt(c);return J?J.toISOString().slice(0,10):null}function lt(c){if(c==null||c==="")return 0;const J=tt(c);return Number.isFinite(J)?J:($t(`gantt.projectEpoch:${String(c)}`,`[lattice] gantt: projectEpoch ${JSON.stringify(c)} is not a date or a day number; the plan is rendered against the Unix epoch (day 0 = 1970-01-01).`),0)}}),se("packages/modules/gantt/calendar.js",function(y,yt){"use strict";Object.defineProperty(y,"createCalendar",{enumerable:!0,get:function(){return tt}});const $t=yt("packages/modules/gantt/time.js").toDayNumber,ct=Object.freeze([1,2,3,4,5]);function tt(rt,N=0){if(rt==null)return null;let lt,c;rt==="weekends"?(lt=ct,c=new Set):(lt=Array.isArray(rt.workdays)&&rt.workdays.length?rt.workdays.map(Number).filter(b=>b>=0&&b<=6):ct,c=new Set((Array.isArray(rt.holidays)?rt.holidays:[]).map(b=>$t(b)).filter(b=>b!=null)));const J=new Set(lt);if(J.size===7&&c.size===0||J.size===0)return null;const p=b=>{let w=(b%7+4)%7;return w<0&&(w+=7),w},x=b=>{if(!Number.isFinite(b))return!1;const w=Math.round(b);return J.has(p(w))&&!c.has(w)},L=b=>{let w=b;for(;!x(w);)w+=1;return w},M=L(Math.round(Number.isFinite(N)?N:0)),B=J.size,G=(b,w)=>{if(w<b)return 0;const H=w-b+1,F=Math.floor(H/7);let nt=F*B;const it=p(b);for(let _=F*7;_<H;_+=1)J.has((it+_)%7)&&(nt+=1);for(const _ of c)_>=b&&_<=w&&J.has(p(_))&&(nt-=1);return nt};return{isWorking:x,nextWorking:L,dayOf:b=>{const w=Math.round(b);if(w===0)return M;if(w>0){const Y=Math.floor(w/B);let R=M+Y*7,ft=w-Y*B;for(;ft>0;)R+=1,J.has(p(R))&&(ft-=1);let mt=0;for(const Ct of c)Ct>M&&Ct<=R&&J.has(p(Ct))&&(mt+=1);for(;mt>0;)R+=1,x(R)&&(mt-=1);for(;!x(R);)R+=1;return R}const H=-w,F=Math.floor(H/B);let nt=M-F*7,it=H-F*B;for(;it>0;)nt-=1,J.has(p(nt))&&(it-=1);let _=0;for(const Y of c)Y>=nt&&Y<M&&J.has(p(Y))&&(_+=1);for(;_>0;)nt-=1,x(nt)&&(_-=1);for(;!x(nt);)nt-=1;return nt},indexOf:b=>{const w=L(Math.round(b));return w>=M?G(M,w)-1:-(G(w,M)-1)},anchor:M}}}),se("packages/modules/gantt/assignments.js",function(y,yt){"use strict";Object.defineProperty(y,"parseAssignments",{enumerable:!0,get:function(){return $t}});function Gt(ct){if(ct==null||ct==="")return null;const tt=typeof ct=="number"?ct:Number(ct);return Number.isFinite(tt)?tt:null}function $t(ct){if(ct&&Array.isArray(ct.assignments))return ct.assignments.map(N=>{const lt=N&&(N.resource??N.name??N.id);if(lt==null||lt==="")return null;const c=Gt(N.units)??Gt(N.allocation)??1;return{resource:String(lt),units:c}}).filter(Boolean);const tt=ct?ct.assignee??ct.assignees??ct.owner:null;return(Array.isArray(tt)?tt:tt==null||tt===""?[]:[tt]).map(N=>String(N)).filter(N=>N!=="").map(N=>({resource:N,units:1}))}}),se("packages/modules/gantt/schedule.js",function(y,yt){"use strict";Object.defineProperty(y,"LINK_TYPES",{enumerable:!0,get:function(){return J}}),Object.defineProperty(y,"CONSTRAINT_TYPES",{enumerable:!0,get:function(){return p}}),Object.defineProperty(y,"resolveConstraintCode",{enumerable:!0,get:function(){return L}}),Object.defineProperty(y,"SCHEDULING_MODES",{enumerable:!0,get:function(){return M}}),Object.defineProperty(y,"resolveSchedulingMode",{enumerable:!0,get:function(){return G}}),Object.defineProperty(y,"effortRate",{enumerable:!0,get:function(){return $}}),Object.defineProperty(y,"recomputeEffort",{enumerable:!0,get:function(){return b}}),Object.defineProperty(y,"reconcileEffort",{enumerable:!0,get:function(){return w}}),Object.defineProperty(y,"EPS",{enumerable:!0,get:function(){return H}}),Object.defineProperty(y,"SCHEDULE_ERROR",{enumerable:!0,get:function(){return F}}),Object.defineProperty(y,"TASK_FIELDS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(y,"taskIdReader",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(y,"taskFieldWriters",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(y,"normalizeTasks",{enumerable:!0,get:function(){return at}}),Object.defineProperty(y,"buildTree",{enumerable:!0,get:function(){return xt}}),Object.defineProperty(y,"normalizeLinkSpec",{enumerable:!0,get:function(){return X}}),Object.defineProperty(y,"normalizeDependencies",{enumerable:!0,get:function(){return T}}),Object.defineProperty(y,"expandDependencies",{enumerable:!0,get:function(){return k}}),Object.defineProperty(y,"topoOrder",{enumerable:!0,get:function(){return A}}),Object.defineProperty(y,"computeSchedule",{enumerable:!0,get:function(){return St}}),Object.defineProperty(y,"findViolations",{enumerable:!0,get:function(){return It}});const $t=yt("packages/core/src/internal/util.js").warnOnce,tt=yt("packages/modules/gantt/calendar.js").createCalendar,N=yt("packages/modules/gantt/assignments.js").parseAssignments,c=yt("packages/modules/gantt/time.js").toDayNumber,J=["FS","SS","FF","SF"],p=["ASAP","MSO","MFO","ALAP","SNET","SNLT","FNET","FNLT"],x=Object.freeze({asap:"ASAP","as-soon-as-possible":"ASAP",assoonaspossible:"ASAP",mso:"MSO","must-start-on":"MSO",muststarton:"MSO","start-on":"MSO",mfo:"MFO","must-finish-on":"MFO",mustfinishon:"MFO","finish-on":"MFO",alap:"ALAP","as-late-as-possible":"ALAP",aslateaspossible:"ALAP",late:"ALAP",snet:"SNET","start-no-earlier-than":"SNET",startnoearlierthan:"SNET",snlt:"SNLT","start-no-later-than":"SNLT",startnolaterthan:"SNLT",fnet:"FNET","finish-no-earlier-than":"FNET",finishnoearlierthan:"FNET",fnlt:"FNLT","finish-no-later-than":"FNLT",finishnolaterthan:"FNLT"});function L(l){if(l==null||l===""||typeof l=="object"&&!Array.isArray(l)&&!(l instanceof Date)&&(l=l.type??l.constraint??l.code??null,l==null||l===""))return null;const g=String(l).toLowerCase().replace(/\s+/g,"-");return x[g]??(p.includes(String(l).toUpperCase())?String(l).toUpperCase():null)}const M=["fixedDuration","fixedEffort","fixedUnits"],B=Object.freeze({fixedduration:"fixedDuration","fixed-duration":"fixedDuration",duration:"fixedDuration",fixedeffort:"fixedEffort","fixed-effort":"fixedEffort",effort:"fixedEffort",work:"fixedEffort",fixedwork:"fixedEffort",fixedunits:"fixedUnits","fixed-units":"fixedUnits",units:"fixedUnits"});function G(l){if(l==null||l==="")return null;const g=String(l).toLowerCase().replace(/\s+/g,"-");if(B[g])return B[g];const v=g.replace(/-/g,"");return B[v]??null}const et=8;function $(l,g){const v=g.hoursPerDay,C=g.resourceHours instanceof Map?g.resourceHours:new Map;if(!l||l.length===0)return{rate:v,units:1};let E=0,O=0;for(const I of l){const i=C.has(I.resource)?C.get(I.resource):v;E+=I.units*i,O+=I.units}return{rate:E,units:O}}function b(l,g){const v=l.schedulingMode||g.defaultMode||"fixedDuration",C=l.effortDriven!=null?!!l.effortDriven:!!g.defaultEffortDriven,{rate:E,units:O}=$(l.assignments,g),I=l.duration,i=l.statedEffort;let o=I,e=i??(I!=null?I*E:null);return v==="fixedEffort"?i!=null&&E>0?o=i/E:e=I!=null?I*E:null:v==="fixedUnits"?I!=null?(o=I,e=I*E):i!=null&&E>0&&(o=i/E,e=i):o=I,{duration:o,effort:e,units:O,schedulingMode:v,effortDriven:C}}function w(l,g){const v=G(l.mode)||l.mode||"fixedDuration",C=!!l.effortDriven,E=l.hoursPerDay>0?l.hoursPerDay:et;let O=l.duration,I=l.units;const i=O*I*E,o=g.field,e=g.units!=null?g.units:1;if(o==="duration")O=g.value,v==="fixedEffort"&&(I=O>0?i/(O*E):I);else if(o==="effort"){const d=g.value;v==="fixedDuration"?I=O>0?d/(O*E):I:O=I>0?d/(I*E):O}else if(o==="units")I=g.value,v!=="fixedDuration"&&(O=I>0?i/(I*E):O);else if(o==="addResource"||o==="removeResource"){const d=o==="addResource"?e:-e;v==="fixedDuration"?C||(I=I+d):(I=I+d,O=I>0?i/(I*E):O)}return{duration:O,units:I,effort:O*I*E}}const H=1e-9,F={CYCLE:"cycle",DUPLICATE_ID:"duplicate-id",UNKNOWN_TASK:"unknown-task",BAD_DURATION:"bad-duration",BAD_LINK_TYPE:"bad-link-type",SELF_DEPENDENCY:"self-dependency",UNKNOWN_PARENT:"unknown-parent",PARENT_CYCLE:"parent-cycle",DEP_ACROSS_HIERARCHY:"dep-across-hierarchy"};function nt(l){if(l==null||l==="")return null;const g=typeof l=="number"?l:Number(l);return Number.isFinite(g)?g:null}function it(l){if(!l)return null;const g=nt(l.effort)??(Array.isArray(l.work)?null:nt(l.work))??nt(l.hours);if(g!=null)return g;if(Array.isArray(l.work)){let v=0,C=!1;for(const E of l.work){const O=nt(E&&E.hours);O!=null&&(v+=O,C=!0)}return C?v:null}return null}function _(l){return l==null||l===""?null:c(l)}const Y=Object.freeze(["id","name","start","end","duration","milestone","percentComplete","parent","baselineStart","baselineEnd","constraint","constraintDate"]);function R(l){const g=l&&typeof l=="object"?l:{},v={};for(const C of Y){const E=g[C];if(typeof E=="function")v[C]=E;else if(typeof E=="string"&&E!==""){const O=E;v[C]=I=>I[O]}else v[C]=O=>O[C]}return v}function ft(l){return R(l).id}function mt(l){const g=l&&typeof l=="object"?l:{},v={};for(const C of Y){const E=g[C];typeof E=="string"&&E!==""?v[C]=E:typeof E=="function"?v[C]=null:v[C]=C}return v}function Ct(l,g){const v=g.constraint(l);let C=v??(l&&l.constraintType),E=null;if(C&&typeof C=="object"&&!Array.isArray(C)&&!(C instanceof Date)&&(E=C.date??C.at??C.constraintDate??null,C=C.type??C.constraint??C.code??null),C==null||C==="")return null;const O=L(C);if(!O)return null;const I=_(E??g.constraintDate(l)??l.constraintAt??l.at);return{type:O,at:I}}function at(l,g){const v=new Map,C=[],E=R(g);if(!Array.isArray(l))return{ok:!1,error:{code:F.BAD_DURATION,message:"tasks must be an array"},order:C,byId:v};for(const O of l){const I=O?E.id(O):null,i=I!=null?String(I):null;if(i==null)return{ok:!1,error:{code:F.UNKNOWN_TASK,message:"every task needs an id"},order:C,byId:v};if(v.has(i))return{ok:!1,error:{code:F.DUPLICATE_ID,message:`duplicate task id "${i}"`,id:i},order:C,byId:v};const o=_(E.start(O)),e=_(E.end(O)),d=E.milestone(O)===!0;let t=d?0:nt(E.duration(O));if(t==null&&o!=null&&e!=null&&(t=e-o),t!=null&&t<0)return{ok:!1,error:{code:F.BAD_DURATION,message:`task "${i}" has negative duration ${t}`,id:i},order:C,byId:v};const h=E.name(O),u=E.parent(O);v.set(i,{id:i,name:h!=null?String(h):i,duration:t,milestoneFlag:d,earliestStart:o,placedStart:o,placedEnd:e,percentComplete:nt(E.percentComplete(O)),parent:u!=null?String(u):null,constraint:Ct(O,E),baselineStart:_(E.baselineStart(O)??(O.baseline&&O.baseline.start)),baselineEnd:_(E.baselineEnd(O)??(O.baseline&&O.baseline.end)),schedulingMode:G(O.schedulingMode??O.taskType),effortDriven:O.effortDriven==null?null:!!O.effortDriven,statedEffort:it(O),assignments:N(O)}),C.push(i)}return{ok:!0,order:C,byId:v}}function xt(l,g){const v=new Map(l.map(i=>[i,[]]));for(const i of l){const o=g.get(i).parent;if(o!=null){if(!g.has(o))return{ok:!1,error:{code:F.UNKNOWN_PARENT,message:`task "${i}" names unknown parent "${o}"`,id:i}};v.get(o).push(i)}}for(const i of l){const o=new Set;let e=g.get(i).parent;for(;e!=null;){if(e===i||o.has(e))return{ok:!1,error:{code:F.PARENT_CYCLE,message:`parent cycle at "${i}"`,id:i}};o.add(e),e=g.get(e)?.parent??null}}const C=i=>v.get(i).length>0,E=new Map,O=i=>{if(E.has(i))return E.get(i);const o=v.get(i),e=o.length===0?[i]:o.flatMap(d=>O(d));return E.set(i,e),e};return{ok:!0,children:v,isSummary:C,descendantLeaves:O,ancestors:i=>{const o=new Set;let e=g.get(i).parent;for(;e!=null;)o.add(e),e=g.get(e).parent;return o}}}const D=/^\s*(FS|SS|FF|SF)\s*(?:([+-])\s*(\d+(?:\.\d+)?))?\s*$/i;function X(l){const g={...l||null};if(typeof g.type!="string")return g;const v=D.exec(g.type);if(!v||!v[2])return g;const C=(v[2]==="-"?-1:1)*Number(v[3]);g.type=v[1].toUpperCase();const E=nt(l.lag);return E!=null&&E!==C?($t(`gantt-link-shorthand-${String(l.type)}-${E}`,`[lattice] gantt: dependency type ${JSON.stringify(l.type)} carries a lag of ${C} but lag: ${E} was also given; the explicit lag wins. Give one or the other.`),g):(g.lag=C,g)}function T(l,g,v={}){const C=[];if(l==null)return{ok:!0,edges:C};if(!Array.isArray(l))return{ok:!1,error:{code:F.UNKNOWN_TASK,message:"dependencies must be an array"},edges:C};const E=typeof v.ancestors=="function"?v.ancestors:null;for(const O of l){const I=X(O),i=I&&I.from!=null?String(I.from):null,o=I&&I.to!=null?String(I.to):null,e=I&&I.type!=null?String(I.type).toUpperCase():"FS",d=nt(I.lag)??0;if(i==null||o==null)return{ok:!1,error:{code:F.UNKNOWN_TASK,message:"a dependency needs both `from` and `to`"},edges:C};if(!g.has(i))return{ok:!1,error:{code:F.UNKNOWN_TASK,message:`dependency references unknown task "${i}"`,id:i},edges:C};if(!g.has(o))return{ok:!1,error:{code:F.UNKNOWN_TASK,message:`dependency references unknown task "${o}"`,id:o},edges:C};if(i===o)return{ok:!1,error:{code:F.SELF_DEPENDENCY,message:`task "${i}" depends on itself`,id:i},edges:C};if(!J.includes(e))return{ok:!1,error:{code:F.BAD_LINK_TYPE,message:`unknown link type "${e}" (expected one of ${J.join("/")})`},edges:C};if(E&&(E(i).has(o)||E(o).has(i)))return{ok:!1,error:{code:F.DEP_ACROSS_HIERARCHY,message:`dependency between "${i}" and "${o}" crosses their own parent/child hierarchy`,from:i,to:o},edges:C};C.push({from:i,to:o,type:e,lag:d})}return{ok:!0,edges:C}}function k(l,g){const v=new Set,C=[];for(const E of l){(g.isSummary(E.from)||g.isSummary(E.to))&&E.type!=="FS"&&$t(`gantt-summary-link-${E.type}-${E.from}-${E.to}`,`[lattice] gantt: ${E.type} link with a summary endpoint (${E.from} -> ${E.to}) is expanded to descendant leaves — a conservative v1 reading; only FS is exact for summary endpoints.`);for(const I of g.descendantLeaves(E.from))for(const i of g.descendantLeaves(E.to)){if(I===i)continue;const o=[I,i,E.type,E.lag].join("");v.has(o)||(v.add(o),C.push({from:I,to:i,type:E.type,lag:E.lag}))}}return C}function A(l,g){const v=new Map(l.map(I=>[I,0])),C=new Map(l.map(I=>[I,[]]));for(const I of g)W(v,I.to),C.get(I.from).push(I.to);const E=l.filter(I=>v.get(I)===0),O=[];for(;E.length;){const I=E.shift();O.push(I);for(const i of C.get(I)){const o=v.get(i)-1;v.set(i,o),o===0&&E.push(i)}}return O.length===l.length?{ok:!0,sorted:O}:{ok:!1,cycle:Z(l,C,new Set(O))}}function W(l,g){l.set(g,l.get(g)+1)}function Z(l,g,v){const C=l.find(i=>!v.has(i)),E=[],O=new Map;let I=C;for(;I!=null&&!O.has(I);)O.set(I,E.length),E.push(I),I=g.get(I).find(i=>!v.has(i));return I==null?E:E.slice(O.get(I)).concat(I)}function m(l,g,v,C,E,O=new Map,I=!1){const i=A(l,v);if(!i.ok)return $t(`gantt-cycle-${i.cycle.join(">")}`,`[lattice] gantt: dependency cycle detected (${i.cycle.join(" -> ")}); schedule refused.`),{ok:!1,error:{code:F.CYCLE,message:`dependency cycle: ${i.cycle.join(" -> ")}`,cycle:i.cycle}};const o=i.sorted,e=new Map(l.map(ht=>[ht,[]])),d=new Map(l.map(ht=>[ht,[]]));for(const ht of v)e.get(ht.to).push(ht),d.get(ht.from).push(ht);const t=new Map;for(const ht of l){const kt=g.get(ht);t.set(ht,{id:ht,name:kt.name,duration:kt.duration,es:0,ef:0,ls:0,lf:0,totalFloat:0,critical:!1,percentComplete:kt.percentComplete,parent:kt.parent,isSummary:!1,isMilestone:kt.duration===0,children:[]})}const h=[];for(const ht of o){const kt=g.get(ht),dt=t.get(ht);let wt=Math.max(C,kt.earliestStart??C);for(const ot of e.get(ht)){const Lt=t.get(ot.from);let Bt;switch(ot.type){case"FS":Bt=Lt.ef+ot.lag;break;case"SS":Bt=Lt.es+ot.lag;break;case"FF":Bt=Lt.ef+ot.lag-dt.duration;break;case"SF":Bt=Lt.es+ot.lag-dt.duration;break;default:Bt=-1/0}Bt>wt&&(wt=Bt)}const P=O.get(ht);if(P&&P.at!=null)switch(P.type){case"MSO":P.at<wt-H?h.push({id:ht,type:P.type,date:P.at,scheduled:wt,at:P.at,earliestFeasible:wt}):wt=P.at,dt.pinned=!0;break;case"MFO":{const ot=P.at-dt.duration;ot<wt-H?h.push({id:ht,type:P.type,date:P.at,scheduled:wt+dt.duration,at:P.at,earliestFeasible:wt}):wt=ot,dt.pinned=!0;break}case"SNET":P.at>wt+H&&(wt=P.at);break;case"SNLT":wt>P.at+H&&h.push({id:ht,type:P.type,date:P.at,scheduled:wt,at:P.at,earliestFeasible:wt});break;case"FNET":{const ot=P.at-dt.duration;ot>wt+H&&(wt=ot);break}case"FNLT":{const ot=wt+dt.duration;ot>P.at+H&&h.push({id:ht,type:P.type,date:P.at,scheduled:ot,at:P.at,earliestFeasible:wt});break}default:break}dt.es=wt,dt.ef=wt+dt.duration}const u=l.length?Math.max(...l.map(ht=>t.get(ht).ef)):C,q=Number.isFinite(E)?E:u;for(let ht=o.length-1;ht>=0;ht-=1){const kt=o[ht],dt=t.get(kt);let wt=q;for(const P of d.get(kt)){const ot=t.get(P.to);let Lt;switch(P.type){case"FS":Lt=ot.ls-P.lag;break;case"SS":Lt=ot.ls-P.lag+dt.duration;break;case"FF":Lt=ot.lf-P.lag;break;case"SF":Lt=ot.lf-P.lag+dt.duration;break;default:Lt=1/0}Lt<wt&&(wt=Lt)}dt.pinned&&(wt=dt.ef),dt.lf=wt,dt.ls=wt-dt.duration,dt.totalFloat=dt.ls-dt.es,dt.critical=dt.totalFloat<=H}for(const ht of l){const kt=O.get(ht);if(!kt||kt.type!=="ALAP")continue;const dt=t.get(ht);dt.es=dt.ls,dt.ef=dt.lf,dt.totalFloat=0,dt.critical=!0}const U=l.filter(ht=>t.get(ht).critical),gt=I?[]:Ut(l,v,t);return{ok:!0,tasks:t,critical:U,criticalPaths:gt,projectFinish:u,conflicts:h}}function St(l,g=[],v={}){const C=_(v.projectStart)??0,E=_(v.deadline),O=tt(v.calendar,C),I=_t=>_t==null?null:O?O.indexOf(_t):_t,i=_t=>O?O.dayOf(_t):_t,o=at(l,v.fields);if(!o.ok)return{ok:!1,error:o.error};const{order:e,byId:d}=o,t=xt(e,d);if(!t.ok)return{ok:!1,error:t.error};const h=T(g,d,t);if(!h.ok)return{ok:!1,error:h.error};const u={defaultMode:G(v.schedulingMode)||"fixedDuration",defaultEffortDriven:!!v.effortDriven,hoursPerDay:nt(v.hoursPerDay)??et,resourceHours:v.resourceHours instanceof Map?v.resourceHours:new Map},q=new Map;for(const _t of e){if(t.isSummary(_t))continue;const bt=d.get(_t);if(!(bt.schedulingMode!=null||bt.effortDriven!=null||bt.statedEffort!=null||v.schedulingMode!=null||v.effortDriven!=null))continue;const Jt=b(bt,u);Jt.duration!=null&&(bt.duration=Jt.duration),q.set(_t,{schedulingMode:Jt.schedulingMode,effortDriven:Jt.effortDriven,effort:Jt.effort,units:Jt.units})}for(const _t of e)if(!t.isSummary(_t)&&d.get(_t).duration==null)return{ok:!1,error:{code:F.BAD_DURATION,message:`task "${_t}" has no duration and no start+end to derive one`,id:_t}};const U=e.filter(_t=>!t.isSummary(_t)),gt=new Map(U.map(_t=>{const bt=d.get(_t);return[_t,{...bt,earliestStart:I(bt.earliestStart)}]})),ht=new Map;for(const _t of U){const bt=d.get(_t).constraint;bt&&ht.set(_t,{type:bt.type,at:I(bt.at)})}const kt=O?O.indexOf(C):C,dt=E==null?void 0:I(E),wt=k(h.edges,t),P=m(U,gt,wt,kt,dt,ht,!!v.skipCriticalPaths);if(!P.ok)return{ok:!1,error:P.error};const ot=P.tasks;for(const _t of U){const bt=ot.get(_t);bt.es=i(bt.es),bt.ef=i(bt.ef),bt.ls=i(bt.ls),bt.lf=i(bt.lf),st(bt,d.get(_t).baselineStart,d.get(_t).baselineEnd);const Ft=q.get(_t);Ft&&(bt.schedulingMode=Ft.schedulingMode,bt.effortDriven=Ft.effortDriven,bt.effort=Ft.effort,bt.units=Ft.units)}for(let _t=e.length-1;_t>=0;_t-=1){const bt=e[_t];t.isSummary(bt)&&ot.set(bt,At(bt,d.get(bt),t,ot))}for(const _t of e)t.isSummary(_t)&&(ot.get(_t).children=t.children.get(_t).slice());const Lt=O?O.anchor:C,Bt=i(P.projectFinish);return{ok:!0,tasks:ot,order:e,critical:P.critical,criticalPaths:P.criticalPaths,projectStart:Lt,projectFinish:Bt,projectDuration:Bt-Lt,conflicts:(P.conflicts||[]).map(_t=>({id:_t.id,type:_t.type,date:i(_t.date),scheduled:i(_t.scheduled),at:i(_t.at),earliestFeasible:i(_t.earliestFeasible)})),calendar:!!O}}function st(l,g,v){g==null&&v==null||(l.baselineStart=g??null,l.baselineEnd=v??null,l.startVariance=g==null?null:l.es-g,l.finishVariance=v==null?null:l.ef-v,l.durationVariance=g==null||v==null?null:l.ef-l.es-(v-g))}function At(l,g,v,C){const E=v.children.get(l).map(U=>C.get(U)),O=Math.min(...E.map(U=>U.es)),I=Math.max(...E.map(U=>U.ef)),i=Math.min(...E.map(U=>U.ls)),o=Math.max(...E.map(U=>U.lf)),e=v.descendantLeaves(l).map(U=>C.get(U)),d=e.reduce((U,gt)=>U+gt.duration,0),t=d>H?e.reduce((U,gt)=>U+gt.duration*(gt.percentComplete??0),0)/d:null,h={id:l,name:g.name,duration:I-O,es:O,ef:I,ls:i,lf:o,totalFloat:i-O,critical:E.some(U=>U.critical),percentComplete:t,parent:g.parent,isSummary:!0,isMilestone:!1,children:[]},u=e.map(U=>U.baselineStart).filter(U=>U!=null),q=e.map(U=>U.baselineEnd).filter(U=>U!=null);return(u.length||q.length)&&st(h,u.length?Math.min(...u):null,q.length?Math.max(...q):null),h}function Ut(l,g,v){const C=new Map(l.map(o=>[o,[]])),E=new Set;for(const o of g){const e=v.get(o.from),d=v.get(o.to);if(!e.critical||!d.critical)continue;let t;switch(o.type){case"FS":t=e.ef+o.lag;break;case"SS":t=e.es+o.lag;break;case"FF":t=e.ef+o.lag-d.duration;break;case"SF":t=e.es+o.lag-d.duration;break;default:t=-1/0}Math.abs(t-d.es)<=H&&(C.get(o.from).push(o.to),E.add(o.to))}const O=l.filter(o=>v.get(o).critical&&!E.has(o)),I=[],i=(o,e)=>{const d=C.get(o);if(!d.length){I.push(e);return}for(const t of d)i(t,e.concat(t))};for(const o of O)i(o,[o]);return I}function It(l,g,v){if(!g||!g.ok)return[];const C=[],E=R(v);for(const O of l){const I=O?E.id(O):null,i=I!=null?String(I):null;if(i==null||!g.tasks.has(i))continue;const o=g.tasks.get(i);if(o.isSummary)continue;const e=nt(E.start(O));e!=null&&e<o.es-H&&C.push({id:i,placedStart:e,earliestStart:o.es,by:o.es-e})}return C}}),se("packages/modules/gantt/resources.js",function(y,yt){"use strict";Object.defineProperty(y,"normalizeCapacities",{enumerable:!0,get:function(){return b}}),Object.defineProperty(y,"normalizeResources",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(y,"resourceDailyHours",{enumerable:!0,get:function(){return it}}),Object.defineProperty(y,"sweepLoad",{enumerable:!0,get:function(){return _}}),Object.defineProperty(y,"computeResourceLoad",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(y,"normalizeResourceRates",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(y,"rateOn",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(y,"levelResources",{enumerable:!0,get:function(){return D}});const $t=yt("packages/core/src/internal/util.js").warnOnce,ct=yt("packages/modules/gantt/schedule.js"),tt=ct.computeSchedule,rt=ct.EPS,N=ct.taskIdReader,lt=ct.resolveConstraintCode,c=yt("packages/modules/gantt/assignments.js"),J=c.parseAssignments,x=yt("packages/modules/gantt/calendar.js").createCalendar,L=yt("packages/modules/gantt/time.js"),M=L.fromDayNumber,B=L.toDayNumber;Object.defineProperty(y,"parseAssignments",{enumerable:!0,get:function(){return c.parseAssignments}});const G=Object.freeze([1,2,3,4,5]),et=8;function $(T){if(T==null||T==="")return null;const k=typeof T=="number"?T:Number(T);return Number.isFinite(k)?k:null}function b(T,k){const A=new Map;if(Array.isArray(T))for(const W of T){const Z=W&&(W.id??W.name??W.resource);if(Z==null||Z==="")continue;const m=$(W.capacity??W.maxUnits??W.max??W.units);A.set(String(Z),m??k)}else if(T&&typeof T=="object")for(const[W,Z]of Object.entries(T)){const m=$(Z);A.set(String(W),m??k)}return A}function w(T){const k=new Set;for(const A of Array.isArray(T)?T:[]){if(A&&typeof A=="object"&&!(A instanceof Date)&&("from"in A||"to"in A)){const Z=B(A.from),m=B(A.to??A.from);if(Z==null)continue;const St=m??Z;for(let st=Math.min(Z,St);st<=Math.max(Z,St);st+=1)k.add(st);continue}const W=B(A);W!=null&&k.add(W)}return k}function H(T){return T==null?{workdays:[0,1,2,3,4,5,6],holidays:new Set}:T==="weekends"?{workdays:[...G],holidays:new Set}:{workdays:Array.isArray(T.workdays)&&T.workdays.length?T.workdays.map(Number).filter(A=>A>=0&&A<=6):[...G],holidays:w(T.holidays)}}function F(T,k,A,W){const Z=new Set(Array.isArray(T.workingDays)&&T.workingDays.length?T.workingDays.map(Number).filter(E=>E>=0&&E<=6):W.workdays),m=w(T.holidays);for(const E of W.holidays)m.add(E);const St=T.hoursPerDay,st=E=>{if(St!=null&&typeof St=="object"){const I=$(St[E]);return I??A}const O=$(St);return O??A},At=E=>{const O=M(E);return O?Z.has(O.getUTCDay())&&!m.has(E):!1},Ut=E=>At(E)?k??st(M(E).getUTCDay()):0,It=E=>A>0?Ut(E)/A:0;let l=0;for(const E of Z){const O=k??st(E);O>l&&(l=O)}const g=A>0?l/A:0;let v=0;for(const E of W.workdays)Z.has(E)&&(v+=k??st(E));const C=W.workdays.length?v/W.workdays.length:A;return{hasCalendar:!0,capacityUnits:g,hoursPerWorkingDay:C,worksOn:At,capacityHoursOn:Ut,capacityUnitsOn:It}}function nt(T,k,A={}){const W=$(A.hoursPerDay)??et,Z=H(A.calendar),m=new Map,St=(st,At)=>{const Ut=$(At.capacity??At.maxUnits??At.max??At.units);At.calendar&&typeof At.calendar=="object"?m.set(st,F(At.calendar,Ut,W,Z)):m.set(st,{hasCalendar:!1,capacityUnits:Ut??k,hoursPerWorkingDay:W})};if(Array.isArray(T))for(const st of T){const At=st&&(st.id??st.name??st.resource);At==null||At===""||St(String(At),st)}else if(T&&typeof T=="object")for(const[st,At]of Object.entries(T))St(String(st),typeof At=="object"&&At?At:{capacity:At});return m}function it(T,k,A={}){const W=$(A.hoursPerDay)??et,Z=nt(T,k,A),m=new Map;for(const[St,st]of Z)m.set(St,st.hoursPerWorkingDay!=null?st.hoursPerWorkingDay:W);return m}function _(T){if(!T.length)return[];const k=new Set;for(const Z of T)k.add(Z.s),k.add(Z.e);const A=[...k].sort((Z,m)=>Z-m),W=[];for(let Z=0;Z<A.length-1;Z+=1){const m=A[Z],St=A[Z+1];if(St<=m)continue;let st=0;const At=[];for(const Ut of T)Ut.s<=m&&Ut.e>=St&&(st+=Ut.units,At.push(Ut.taskId));At.length&&W.push({s:m,e:St,load:st,taskIds:At})}return W}function Y(T,k,A={}){const W={ok:!1,resources:[],overAllocations:[],byResource:new Map};if(!k||!k.ok)return W;const Z=$(A.defaultCapacity)??1,m=b(A.resources,Z),St=nt(A.resources,Z,{calendar:A.calendar,hoursPerDay:A.hoursPerDay}),st=A.calendar!=null?x(A.calendar,k.projectStart):null,At=I=>m.has(I)?m.get(I):Z,Ut=I=>st?st.indexOf(I):I,It=I=>st?st.dayOf(I):I,l=N(A.fields),g=new Map;for(const I of T){if(!I)continue;const i=l(I);if(i==null)continue;const o=String(i);g.has(o)||g.set(o,I)}const v=new Map;for(const I of k.order){const i=k.tasks.get(I);if(!i||i.isSummary)continue;const o=g.get(I);if(!o)continue;const e=J(o);if(!e.length)continue;const d=Ut(i.es),t=Ut(i.ef);if(!(t<=d))for(const h of e)v.has(h.resource)||v.set(h.resource,[]),v.get(h.resource).push({s:d,e:t,units:h.units,taskId:I})}const C=new Map,E=[],O=[];for(const[I,i]of v){const o=St.get(I),e=_(i);let d=0,t,h;if(o&&o.hasCalendar){h=o.capacityUnits,t=[];for(const q of e){q.load>d&&(d=q.load);let U=q.s,gt=o.capacityUnitsOn(It(q.s));const ht=kt=>{const dt={start:It(U),end:It(kt),load:q.load,taskIds:q.taskIds};t.push(dt),q.load>gt+rt&&O.push({resource:I,capacity:gt,start:dt.start,end:dt.end,load:q.load,taskIds:q.taskIds.slice()})};for(let kt=q.s+1;kt<q.e;kt+=1){const dt=o.capacityUnitsOn(It(kt));dt!==gt&&(ht(kt),U=kt,gt=dt)}ht(q.e)}}else h=At(I),t=e.map(q=>{q.load>d&&(d=q.load);const U={start:It(q.s),end:It(q.e),load:q.load,taskIds:q.taskIds};return q.load>h+rt&&O.push({resource:I,capacity:h,start:U.start,end:U.end,load:q.load,taskIds:q.taskIds.slice()}),U});const u={resource:I,capacity:h,peak:d,segments:t};C.set(I,u),E.push(u)}return E.sort((I,i)=>I.resource<i.resource?-1:I.resource>i.resource?1:0),O.sort((I,i)=>I.start-i.start||(I.resource<i.resource?-1:1)),{ok:!0,resources:E,overAllocations:O,byResource:C}}function R(T){const k=[];for(const A of Array.isArray(T)?T:[]){const W=B(A&&A.from),Z=$(A&&A.rate);W==null||Z==null||k.push({from:Math.round(W),rate:Z})}return k.sort((A,W)=>A.from-W.from),k}function ft(T){const k=new Map,A=(W,Z)=>{if(!Z||typeof Z!="object")return;const m=Z.type==="material"||Z.type==="cost"?Z.type:"work",St=$(Z.rate),st=R(Z.rates),At=$(Z.cost);St==null&&!st.length&&At==null||k.set(W,{type:m,rate:St,rates:st,cost:At})};if(Array.isArray(T))for(const W of T){const Z=W&&(W.id??W.name??W.resource);Z==null||Z===""||A(String(Z),W)}else if(T&&typeof T=="object")for(const[W,Z]of Object.entries(T))Z&&typeof Z=="object"&&A(W,Z);return k}function mt(T,k){if(!T)return null;let A=T.rate;for(const W of T.rates)if(W.from<=k)A=W.rate;else break;return A??null}function Ct(T){if(!T)return!1;const k=T.constraint??T.constraintType;if(k==null||k==="")return!1;const A=String(k).toLowerCase().replace(/\s+/g,"-");return A==="mso"||A==="must-start-on"||A==="muststarton"||A==="start-on"||A==="mfo"||A==="must-finish-on"||A==="mustfinishon"||A==="finish-on"}function at(T){if(!T)return null;const k=T.constraint??T.constraintType,A=lt(k);if(A!=="SNLT"&&A!=="FNLT")return null;let W=T.constraintDate??T.constraintAt??T.at;if(k&&typeof k=="object"&&W==null&&(W=k.date),W==null||W==="")return null;const Z=B(W);return Number.isFinite(Z)?{type:A,date:Z}:null}function xt(T,k){return T?$(T[k])??0:0}function D(T,k,A={}){const W={projectStart:A.projectStart,deadline:A.deadline,calendar:A.calendar,fields:A.fields,skipCriticalPaths:!0},Z=A.priorityField||"priority",m=A.maxIterations!=null?A.maxIterations:Math.max(100,T.length*T.length*2),St=N(A.fields),st=T.map(h=>({...h})),At=st.map(h=>String(St(h))),Ut=new Map(st.map(h=>[String(St(h)),h])),It=new Map(At.map((h,u)=>[h,u])),l=h=>It.has(h)?It.get(h):-1;let g=tt(st,k,W);if(!g.ok)return{ok:!1,error:g.error};const v=new Map;for(const h of g.order){const u=g.tasks.get(h);u&&!u.isSummary&&v.set(h,u.es)}const C=$(A.defaultCapacity)??1,E=nt(A.resources,C,{calendar:A.calendar,hoursPerDay:A.hoursPerDay}),O=A.calendar!=null?x(A.calendar,g.projectStart):null,I=(h,u)=>{const q=J(u).map(gt=>E.get(gt.resource)).filter(gt=>gt&>.hasCalendar);let U=Math.round(h);for(let gt=0;gt<3660;gt+=1){if((!O||O.isWorking(U))&&q.every(ht=>ht.worksOn(U)))return U;U+=1}return Math.round(h)};let i=0;const o=Math.max(32,T.length*2);let e=1/0,d=0;for(;i<m;i+=1){const h=Y(st,g,A);h.overAllocations.length<e?(e=h.overAllocations.length,d=0):d+=1;const u=h.overAllocations.filter(dt=>new Set(dt.taskIds).size>=2);if(!u.length)return{ok:!0,resolved:h.overAllocations.length===0,tasks:st,schedule:g,moves:X(v,g),remaining:h.overAllocations,iterations:i};if(d>=o)return $t("gantt-level-unresolved",`[lattice] gantt: resource leveling could not clear ${h.overAllocations.length} over-allocation(s) after ${i} iterations; the plan cannot be fully levelled, returning the partial result.`),{ok:!0,resolved:!1,tasks:st,schedule:g,moves:X(v,g),remaining:h.overAllocations,iterations:i};const U=u.slice().sort((dt,wt)=>dt.start-wt.start||wt.load-dt.load)[0].taskIds.map(dt=>g.tasks.get(dt)).filter(Boolean),gt=U.filter(dt=>!Ct(Ut.get(dt.id)));if(!gt.length)return{ok:!0,resolved:!1,tasks:st,schedule:g,moves:X(v,g),remaining:h.overAllocations,iterations:i};gt.sort((dt,wt)=>{if(wt.totalFloat!==dt.totalFloat)return wt.totalFloat-dt.totalFloat;const P=xt(Ut.get(dt.id),Z),ot=xt(Ut.get(wt.id),Z);return P!==ot?P-ot:wt.es!==dt.es?wt.es-dt.es:l(wt.id)-l(dt.id)});let ht=null,kt=null;for(const dt of gt){const wt=U.filter(Bt=>Bt.id!==dt.id).map(Bt=>Bt.ef).filter(Bt=>Bt>dt.es+rt),P=wt.length?Math.min(...wt):dt.es+1,ot=I(P,Ut.get(dt.id)),Lt=at(Ut.get(dt.id));if(!(Lt&&(Lt.type==="SNLT"?ot:ot+(dt.ef-dt.es))>Lt.date+rt)){ht=dt,kt=ot;break}}if(!ht)return{ok:!0,resolved:!1,tasks:st,schedule:g,moves:X(v,g),remaining:h.overAllocations,iterations:i};if(Ut.get(ht.id).start=kt,g=tt(st,k,W),!g.ok)return{ok:!1,error:g.error}}const t=Y(st,g,A);return t.overAllocations.length&&$t("gantt-level-unresolved",`[lattice] gantt: resource leveling hit its ${m}-iteration cap with ${t.overAllocations.length} over-allocation(s) unresolved; returning the partial result.`),{ok:!0,resolved:t.overAllocations.length===0,tasks:st,schedule:g,moves:X(v,g),remaining:t.overAllocations,iterations:i}}function X(T,k){const A=[];for(const W of k.order){const Z=k.tasks.get(W);if(!Z||Z.isSummary)continue;const m=T.get(W);m!=null&&Z.es>m+rt&&A.push({id:W,from:m,to:Z.es,delay:Z.es-m})}return A}}),se("packages/modules/gantt/workload.js",function(y,yt){"use strict";Object.defineProperty(y,"WORKLOAD_DEFAULTS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(y,"HISTOGRAM_DEFAULTS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(y,"statedHours",{enumerable:!0,get:function(){return B}}),Object.defineProperty(y,"taskContour",{enumerable:!0,get:function(){return G}}),Object.defineProperty(y,"contourTotal",{enumerable:!0,get:function(){return et}}),Object.defineProperty(y,"serializeContour",{enumerable:!0,get:function(){return $}}),Object.defineProperty(y,"contourSpan",{enumerable:!0,get:function(){return b}}),Object.defineProperty(y,"spanDuration",{enumerable:!0,get:function(){return w}}),Object.defineProperty(y,"spreadHours",{enumerable:!0,get:function(){return H}}),Object.defineProperty(y,"setContourBucket",{enumerable:!0,get:function(){return F}}),Object.defineProperty(y,"retimeContour",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(y,"recordWorkingDays",{enumerable:!0,get:function(){return it}}),Object.defineProperty(y,"workloadBuckets",{enumerable:!0,get:function(){return _}}),Object.defineProperty(y,"taskAssignmentEffort",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(y,"computeWorkload",{enumerable:!0,get:function(){return R}}),Object.defineProperty(y,"formatHours",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(y,"formatPercent",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(y,"formatCost",{enumerable:!0,get:function(){return Ct}});const Gt=yt("packages/modules/gantt/resources.js"),$t=Gt.parseAssignments,ct=Gt.rateOn,tt=yt("packages/modules/gantt/schedule.js"),rt=tt.EPS,N=tt.taskIdReader,lt=yt("packages/modules/gantt/time.js"),c=lt.fromDayNumber,J=lt.toDayNumber,p=lt.toISODate,x=Object.freeze({hoursPerDay:8,height:160,rowHeight:28,decimals:1,totals:!0,unit:"hours"}),L=Object.freeze({resources:null,unit:"hours",stacked:!1,height:160,rowHeight:48});function M(at){if(at==null||at===""||typeof at=="boolean")return null;const xt=typeof at=="number"?at:Number(at);return Number.isFinite(xt)?xt:null}function B(at){if(!at||Array.isArray(at.work))return null;const xt=M(at.work);return xt??M(at.hours)}function G(at){if(!at||!Array.isArray(at.work))return null;const xt=[];for(const X of at.work){if(!X||typeof X!="object")continue;const T=J(X.date),k=M(X.hours);T==null||k==null||xt.push({day:Math.round(T),hours:k})}xt.sort((X,T)=>X.day-T.day);const D=[];for(const X of xt){const T=D[D.length-1];T&&T.day===X.day?T.hours+=X.hours:D.push({day:X.day,hours:X.hours})}return D}function et(at){return(Array.isArray(at)?at:[]).reduce((xt,D)=>xt+(M(D.hours)??0),0)}function $(at){const xt=[];for(const D of Array.isArray(at)?at:[]){const X=M(D.hours);if(X==null||!(Math.abs(X)>rt))continue;const T=p(D.day);T!=null&&xt.push({date:T,hours:Math.round(X*1e6)/1e6})}return xt}function b(at){const xt=(Array.isArray(at)?at:[]).filter(D=>Math.abs(M(D.hours)??0)>rt);return xt.length?{first:xt[0].day,last:xt[xt.length-1].day}:null}function w(at,xt,D=null){if(!Number.isFinite(at)||!Number.isFinite(xt)||xt<at)return 0;if(typeof D!="function")return Math.round(xt-at)+1;let X=0;for(let T=Math.round(at);T<=Math.round(xt);T+=1)D(T)&&(X+=1);return X}function H(at,xt){if(!Array.isArray(at)||!at.length)return[];const D=xt/at.length;return at.map(X=>({day:X,hours:D}))}function F(at,xt,D,X){const T=(Array.isArray(at)?at:[]).filter(A=>!(A.day>=xt.start&&A.day<xt.end)),k=Math.abs(X)>rt?H(D,X):[];return[...T,...k].sort((A,W)=>A.day-W.day)}function nt(at,xt,D){const X=Array.isArray(xt)?xt:[],T=Array.isArray(D)?D:[];if(!Array.isArray(at)||!X.length||!T.length)return Array.isArray(at)?at:[];const k=new Map(at.map(m=>[m.day,M(m.hours)??0])),A=X.map(m=>k.get(m)??0),W=A.length,Z=[];for(let m=0;m<T.length;m+=1){const St=A[Math.min(W-1,Math.floor(m*W/T.length))];Math.abs(St)>rt&&Z.push({day:T[m],hours:St})}return Z}function it(at,xt=null){const D=[];if(!at||!Number.isFinite(at.es)||!Number.isFinite(at.ef))return D;for(let X=Math.floor(at.es);X<Math.ceil(at.ef);X+=1)(typeof xt!="function"||xt(X))&&D.push(X);return D}function _(at,xt,D){const X=Math.floor(xt),T=Math.ceil(D),k=[];if(!(T>X))return k;if(at==="day"){for(let Z=X;Z<T;Z+=1)k.push({start:Z,end:Z+1});return k}if(at==="month"||at==="quarter"){const Z=c(X);if(!Z)return k;let m=Date.UTC(Z.getUTCFullYear(),Z.getUTCMonth(),1)/864e5;for(;m<T;){const St=c(m),st=Date.UTC(St.getUTCFullYear(),St.getUTCMonth()+1,1)/864e5;k.push({start:m,end:st}),m=st}return k}const A=c(X);let W=X-(A?A.getUTCDay():0);for(;W<T;W+=7)k.push({start:W,end:W+7});return k}function Y(at,xt,D={}){const X=M(D.hoursPerDay)??x.hoursPerDay,T=typeof D.isWorking=="function"?D.isWorking:null,k=it(xt,T),A=G(at);if(!A&&!k.length)return[];const W=$t(at),Z=W.length?W:[{resource:null,units:1}],m=Z.reduce((st,At)=>st+(M(At.units)??0),0);if(!(m>0))return[];let St;if(A)St=A.filter(st=>Math.abs(st.hours)>rt);else{const st=B(at),At=st??k.length*X*m;if(!(Math.abs(At)>rt))return[];St=H(k,At)}return St.length?Z.map(st=>{const At=M(st.units)??0,Ut=At/m;return{resource:st.resource,units:At,unitsTotal:m,perDay:Ut>0?St.map(It=>({day:It.day,hours:It.hours*Ut})):[]}}):[]}function R(at,xt,D={}){const X=Array.isArray(D.buckets)?D.buckets:[],T={ok:!1,buckets:[],rows:[],totals:X.map(()=>null),totalsAvailable:X.map(()=>null),totalsCost:X.map(()=>null),grandTotal:0,grandAvailableTotal:null,grandCostTotal:null};if(!xt||!xt.ok)return T;const k=M(D.hoursPerDay)??x.hoursPerDay,A=typeof D.isWorking=="function"?D.isWorking:null,W=D.capacities instanceof Map?D.capacities:null,Z=D.resourceModels instanceof Map?D.resourceModels:null,m=D.resourceRates instanceof Map?D.resourceRates:null,St=N(D.fields),st=new Map,At=(h,u,q,U)=>{st.has(h)||st.set(h,{days:new Map,costs:new Map,tasks:new Map});const gt=st.get(h);if(gt.days.set(u,(gt.days.get(u)||0)+q),m&&h!=null){const kt=ct(m.get(h),u);kt!=null&>.costs.set(u,(gt.costs.get(u)||0)+q*kt)}gt.tasks.has(U.id)||gt.tasks.set(U.id,{...U,days:new Map});const ht=gt.tasks.get(U.id);ht.days.set(u,(ht.days.get(u)||0)+q)},Ut=new Map;for(const h of Array.isArray(at)?at:[]){const u=h?St(h):null;u!=null&&Ut.set(String(u),h)}const It=Array.isArray(at)&&xt.order.length===at.length;for(let h=0;h<xt.order.length;h+=1){const u=xt.order[h],q=xt.tasks.get(u);if(!q||q.isSummary)continue;const U=Ut.get(u)||(It?at[h]:null);if(!U)continue;const gt=Y(U,q,{hoursPerDay:k,isWorking:A});for(const ht of gt){if(!ht.perDay.length)continue;const kt={id:u,name:q.name,units:ht.units,unitsTotal:ht.unitsTotal,raw:U};for(const dt of ht.perDay)At(ht.resource,dt.day,dt.hours,kt)}}const l=h=>{let u=0,q=X.length-1;for(;u<=q;){const U=u+q>>1;if(h<X[U].start)q=U-1;else if(h>=X[U].end)u=U+1;else return U}return-1},g=X.map(h=>{let u=0;for(let q=Math.floor(h.start);q<Math.ceil(h.end);q+=1)(!A||A(q))&&(u+=1);return{start:h.start,end:h.end,workingDays:u}}),v=h=>{const u=g.map(()=>0);for(const[q,U]of h){const gt=l(q);gt>=0&&(u[gt]+=U)}return u},C=[...st.keys()].filter(h=>h!=null).sort(),E=st.has(null)?[...C,null]:C,O=[],I=g.map(()=>0),i=g.map(()=>null),o=m?g.map(()=>0):g.map(()=>null);let e=0,d=m?0:null;for(const h of E){const u=st.get(h),q=v(u.days),U=m?v(u.costs):null,gt=h!=null&&W&&W.has(h)?W.get(h):null,ht=h!=null&&Z?Z.get(h):null,kt=q.map(_t=>Math.abs(_t)>rt?_t:null),dt=q.map((_t,bt)=>{if(ht&&ht.hasCalendar){let Ft=0;for(let Jt=Math.floor(g[bt].start);Jt<Math.ceil(g[bt].end);Jt+=1)(!A||A(Jt))&&(Ft+=ht.capacityHoursOn(Jt));return Ft}return gt==null?null:gt*k*g[bt].workingDays}),wt=q.map((_t,bt)=>dt[bt]!=null&&_t>dt[bt]+rt);let P=0,ot=null,Lt=m?0:null;q.forEach((_t,bt)=>{P+=_t,I[bt]+=_t,dt[bt]!=null&&(ot=(ot??0)+dt[bt],i[bt]=(i[bt]??0)+dt[bt]),U&&(Lt+=U[bt],o[bt]+=U[bt])}),e+=P,m&&(d+=Lt);const Bt=[...u.tasks.values()].map(_t=>{const bt=v(_t.days);return{id:_t.id,name:_t.name,units:_t.units,unitsTotal:_t.unitsTotal,raw:_t.raw,cells:bt.map(Ft=>Math.abs(Ft)>rt?Ft:null),total:bt.reduce((Ft,Jt)=>Ft+Jt,0)}});O.push({resource:h,capacity:gt,available:dt,availableTotal:ot,cells:kt,over:wt,total:P,costCells:U?U.map(_t=>Math.abs(_t)>rt?_t:null):null,costTotal:Lt,tasks:Bt})}let t=null;for(const h of i)h!=null&&(t=(t??0)+h);return{ok:!0,buckets:g,rows:O,totals:I.map(h=>Math.abs(h)>rt?h:null),totalsAvailable:i,totalsCost:o,grandTotal:e,grandAvailableTotal:t,grandCostTotal:d}}function ft(at,xt){if(at==null||!Number.isFinite(at))return"";const X=10**(Number.isFinite(xt)?Math.max(0,Math.min(6,Math.round(xt))):1),T=Math.round(at*X)/X;return Object.is(T,-0)||T===0?"0":String(T)}function mt(at,xt,D){if(xt==null||!(xt>rt))return"–";const X=Number.isFinite(at)?at:0;return ft(X/xt*100,D)}function Ct(at,xt=2){return ft(at,xt)}}),se("packages/modules/gantt/cost.js",function(y,yt){"use strict";Object.defineProperty(y,"computeCost",{enumerable:!0,get:function(){return x}});const Gt=yt("packages/modules/gantt/resources.js"),$t=Gt.parseAssignments,ct=Gt.normalizeResourceRates,tt=Gt.rateOn,N=yt("packages/modules/gantt/workload.js").taskAssignmentEffort,c=yt("packages/modules/gantt/schedule.js").taskIdReader;function J(L){if(L==null||L==="")return null;const M=typeof L=="number"?L:Number(L);return Number.isFinite(M)?M:null}function p(L,M,B,G){const et=J(L?L[G.costField]:null)??0;let $=0,b=!1;const w=$t(L),F=w.some(nt=>{const it=B.get(nt.resource);return!it||it.type==="work"})?N(L,M,{hoursPerDay:G.hoursPerDay,isWorking:G.isWorking}):null;for(let nt=0;nt<w.length;nt+=1){const it=w[nt],_=B.get(it.resource);if(_)if(_.type==="cost")_.cost!=null&&($+=_.cost,b=!0);else if(_.type==="material"){const Y=tt(_,Math.round(M.es));Y!=null&&($+=(J(it.units)??0)*Y,b=!0)}else{const Y=F?F[nt]:null;if(!Y)continue;for(const R of Y.perDay){const ft=tt(_,R.day);ft!=null&&($+=R.hours*ft,b=!0)}}}return{cost:et+$,rateCost:$,fixedCost:et,hasRate:b}}function x(L,M,B={}){if(!M||!M.ok||!M.tasks||!M.order)return{ok:!1,error:{code:"NO_SCHEDULE",message:"cost needs a successful schedule"}};const G=B.costField||"cost",et=J(B.hoursPerDay)??8,$=typeof B.isWorking=="function"?B.isWorking:null,b=B.resourceRates instanceof Map?B.resourceRates:ct(B.resources),w=c(B.fields),H=new Map;for(const R of Array.isArray(L)?L:[]){const ft=w(R);ft!=null&&H.set(String(ft),R)}const F=()=>({cost:0,rateCost:0,fixedCost:0,hasRate:!1}),nt=new Map;for(const R of M.order)nt.set(R,F());const it=F();for(const R of M.order){const ft=M.tasks.get(R);if(!ft||ft.isSummary)continue;const mt=p(H.get(R),ft,b,{hoursPerDay:et,isWorking:$,costField:G});let Ct=R;for(;Ct!=null&&nt.has(Ct);){const at=nt.get(Ct);at.cost+=mt.cost,at.rateCost+=mt.rateCost,at.fixedCost+=mt.fixedCost,mt.hasRate&&(at.hasRate=!0),Ct=M.tasks.get(Ct).parent}it.cost+=mt.cost,it.rateCost+=mt.rateCost,it.fixedCost+=mt.fixedCost,mt.hasRate&&(it.hasRate=!0)}const _=new Map,Y=[];for(const R of M.order){const ft=M.tasks.get(R),mt=nt.get(R),Ct={id:ft.id,name:ft.name,isSummary:!!ft.isSummary,isMilestone:!!ft.isMilestone,cost:mt.cost,rateCost:mt.rateCost,fixedCost:mt.fixedCost,hasRate:mt.hasRate};_.set(R,Ct),Y.push(Ct)}return{ok:!0,byTask:_,rows:Y,project:{...it}}}}),se("packages/modules/gantt/earned-value.js",function(y,yt){"use strict";Object.defineProperty(y,"computeEarnedValue",{enumerable:!0,get:function(){return p}});const $t=yt("packages/modules/gantt/time.js").toDayNumber,tt=yt("packages/modules/gantt/schedule.js").taskIdReader,rt=1e-9;function N(x){if(x==null||x==="")return null;const L=typeof x=="number"?x:Number(x);return Number.isFinite(L)?L:null}function lt(x,L,M){return M-L<=rt?x>=M?1:0:x<=L?0:x>=M?1:(x-L)/(M-L)}function c(x,L,M,B,G,et){const $=L?N(L[B]):null,b=$??(et&&et.hasRate?et.cost:x.duration),w=L?N(L[G]):null,H=x.percentComplete==null?0:Math.max(0,Math.min(100,x.percentComplete))/100,F=x.baselineStart!=null||x.baselineEnd!=null,nt=x.baselineStart!=null?x.baselineStart:x.es,it=x.baselineEnd!=null?x.baselineEnd:x.ef,_=b*lt(M,nt,it),Y=b*H;return{bac:b,pv:_,ev:Y,ac:w,hasBaseline:F}}function J(x){const L=x.ac;return{bac:x.bac,pv:x.pv,ev:x.ev,ac:L,sv:x.ev-x.pv,cv:L==null?null:x.ev-L,spi:Math.abs(x.pv)<rt?null:x.ev/x.pv,cpi:L==null||Math.abs(L)<rt?null:x.ev/L}}function p(x,L,M={}){if(!L||!L.ok||!L.tasks||!L.order)return{ok:!1,error:{code:"NO_SCHEDULE",message:"earned value needs a successful schedule"}};const B=M.costField||"cost",G=M.actualCostField||"actualCost",et=M.statusDate==null?L.projectFinish:$t(M.statusDate)??L.projectFinish,$=M.rateCosts instanceof Map?M.rateCosts:null,b=tt(M.fields),w=new Map;for(const R of Array.isArray(x)?x:[]){const ft=b(R);ft!=null&&w.set(String(ft),R)}const H=()=>({bac:0,pv:0,ev:0,ac:0,acAny:!1,hasBaseline:!1}),F=new Map;for(const R of L.order)F.set(R,H());const nt=H();for(const R of L.order){const ft=L.tasks.get(R);if(!ft||ft.isSummary)continue;const mt=c(ft,w.get(R),et,B,G,$?$.get(R):null);let Ct=R;for(;Ct!=null&&F.has(Ct);){const at=F.get(Ct);at.bac+=mt.bac,at.pv+=mt.pv,at.ev+=mt.ev,mt.ac!=null&&(at.ac+=mt.ac,at.acAny=!0),mt.hasBaseline&&(at.hasBaseline=!0),Ct=L.tasks.get(Ct).parent}nt.bac+=mt.bac,nt.pv+=mt.pv,nt.ev+=mt.ev,mt.ac!=null&&(nt.ac+=mt.ac,nt.acAny=!0),mt.hasBaseline&&(nt.hasBaseline=!0)}const it=R=>J({bac:R.bac,pv:R.pv,ev:R.ev,ac:R.acAny?R.ac:null}),_=new Map,Y=[];for(const R of L.order){const ft=L.tasks.get(R),mt=F.get(R),Ct={id:ft.id,name:ft.name,isSummary:!!ft.isSummary,isMilestone:!!ft.isMilestone,percentComplete:ft.percentComplete??null,hasBaseline:mt.hasBaseline,hasActualCost:mt.acAny,...it(mt)};_.set(R,Ct),Y.push(Ct)}return{ok:!0,statusDate:et,byTask:_,rows:Y,project:{hasActualCost:nt.acAny,hasBaseline:nt.hasBaseline,...it(nt)}}}}),se("packages/modules/gantt/mspdi.js",function(y,yt){"use strict";Object.defineProperty(y,"parseXml",{enumerable:!0,get:function(){return it}}),Object.defineProperty(y,"importMSPDI",{enumerable:!0,get:function(){return X}}),Object.defineProperty(y,"exportMSPDI",{enumerable:!0,get:function(){return W}});const $t=yt("packages/core/src/internal/util.js").warnOnce,ct=yt("packages/modules/gantt/time.js"),tt=ct.toDayNumber,rt=ct.toISODate,N=yt("packages/modules/gantt/schedule.js"),lt=N.taskIdReader,c=N.resolveConstraintCode,J=N.resolveSchedulingMode,p=Object.freeze({0:"FF",1:"FS",2:"SF",3:"SS"}),x=Object.freeze({FF:0,FS:1,SF:2,SS:3}),L=Object.freeze({0:"ASAP",1:"as-late-as-possible",2:"must-start-on",3:"must-finish-on",4:"SNET",5:"SNLT",6:"FNET",7:"FNLT"}),M=Object.freeze({ASAP:0,ALAP:1,MSO:2,MFO:3,SNET:4,SNLT:5,FNET:6,FNLT:7}),B=Object.freeze({0:"fixedUnits",1:"fixedDuration",2:"fixedEffort"}),G=Object.freeze({fixedUnits:0,fixedDuration:1,fixedEffort:2}),et=Object.freeze({0:"material",1:"work",2:"cost"}),$=Object.freeze({material:0,work:1,cost:2});function b(l){if(l==null)return null;const g=/^(-?[0-9.]+)/.exec(String(l).trim());if(!g)return null;const v=Number(g[1]);return Number.isFinite(v)?v:null}function w(l){if(l==null||l==="")return null;const g=typeof l=="number"?l:Number(l);return Number.isFinite(g)?g:null}function H(l){return String(l).replace(/&(#x?[0-9a-fA-F]+|lt|gt|amp|quot|apos);/g,(g,v)=>{if(v[0]==="#"){const C=v[1]==="x"||v[1]==="X"?parseInt(v.slice(2),16):parseInt(v.slice(1),10);return Number.isFinite(C)?String.fromCodePoint(C):g}return{lt:"<",gt:">",amp:"&",quot:'"',apos:"'"}[v]??g})}function F(l){return String(l??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function nt(l){const g=l.indexOf(":");return g<0?l:l.slice(g+1)}function it(l){const g=String(l);let v=0;const C=[];let E=null;for(;v<g.length;){const O=g.indexOf("<",v);if(O<0)break;if(O>v&&C.length){const u=g.slice(v,O);u.trim()&&(C[C.length-1].text+=H(u))}if(g.startsWith("<?",O)){const u=g.indexOf("?>",O);v=u<0?g.length:u+2;continue}if(g.startsWith("<!--",O)){const u=g.indexOf("-->",O);v=u<0?g.length:u+3;continue}if(g.startsWith("<![CDATA[",O)){const u=g.indexOf("]]>",O);C.length&&(C[C.length-1].text+=g.slice(O+9,u<0?g.length:u)),v=u<0?g.length:u+3;continue}if(g.startsWith("<!",O)){const u=g.indexOf(">",O);v=u<0?g.length:u+1;continue}const I=g.indexOf(">",O);if(I<0)break;let i=g.slice(O+1,I).trim();if(i[0]==="/"){C.pop(),v=I+1;continue}const o=i.endsWith("/");o&&(i=i.slice(0,-1).trim());const e=i.search(/\s/),d=nt(e<0?i:i.slice(0,e)),t={};if(e>=0)for(const u of i.slice(e).matchAll(/([\w:.-]+)\s*=\s*"([^"]*)"|([\w:.-]+)\s*=\s*'([^']*)'/g))t[nt(u[1]??u[3])]=H(u[2]??u[4]??"");const h={name:d,attrs:t,children:[],text:""};C.length?C[C.length-1].children.push(h):E||(E=h),o||C.push(h),v=I+1}return E}function _(l,g){return l?l.children.find(v=>v.name===g):void 0}function Y(l,g){return l?l.children.filter(v=>v.name===g):[]}function R(l,g){const v=_(l,g);return v?v.text.trim():void 0}function ft(l){if(!l)return null;const g=String(l).match(/^\d{4}-\d{2}-\d{2}/);return tt(g?g[0]:l)}function mt(l,g){return`${rt(l)}T${String(g).padStart(2,"0")}:00:00`}function Ct(l,g){if(!l)return null;const v=String(l).match(/PT?(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?/);return v?((Number(v[1])||0)+(Number(v[2])||0)/60+(Number(v[3])||0)/3600)/g:null}function at(l,g){return`PT${Math.round((l||0)*g*1e3)/1e3}H0M0S`}function xt(l,g){return(Number(l)||0)/(600*g)}function D(l,g){return Math.round((l||0)*10*60*g)}function X(l,g={}){const v=g.hoursPerDay??8,C=it(l);if(!C||C.name!=="Project")return $t("gantt-mspdi-not-project","[lattice] gantt: importMSPDI input is not an MSPDI <Project> document."),{ok:!1,error:"not an MSPDI <Project> document",tasks:[],dependencies:[],resources:[]};const E=ft(R(C,"StartDate")),O=_(C,"Resources"),I=_(C,"Calendars"),i=Y(I,"Calendar"),o=new Map,e=[];for(const wt of Y(O,"Resource")){const P=R(wt,"UID"),ot=R(wt,"Name");if(P==null||ot==null||ot==="")continue;o.set(P,ot);const Lt=R(wt,"MaxUnits"),Bt=R(wt,"CalendarUID"),_t=Bt!=null?A(i,Bt,v):null,bt={id:ot,name:ot,capacity:Lt==null?1:Number(Lt)};_t&&(bt.calendar=_t.calendar,Lt==null||Math.abs(Number(Lt)-1)<1e-9?delete bt.capacity:bt.capacity=Number(Lt)*_t.fullDayHours);const Ft=et[Number(R(wt,"Type"))];Ft&&Ft!=="work"&&(bt.type=Ft);const Jt=b(R(wt,"StandardRate"));Jt!=null&&(bt.rate=Jt);const ie=R(wt,"Cost"),te=ie==null?null:Number(ie);te!=null&&Number.isFinite(te)&&(bt.cost=te),e.push(bt)}const d=_(C,"Assignments"),t=new Map;for(const wt of Y(d,"Assignment")){const P=R(wt,"TaskUID"),ot=R(wt,"ResourceUID"),Lt=o.get(ot);if(P==null||Lt==null)continue;const Bt=R(wt,"Units");t.has(P)||t.set(P,[]),t.get(P).push({resource:Lt,units:Bt==null?1:Number(Bt)})}const h=_(C,"Tasks"),u=[],q=[],U=new Map,gt=[],ht=[];for(const wt of Y(h,"Task")){if(R(wt,"IsNull")==="1")continue;const P=R(wt,"UID");if(P==null||P==="0")continue;const ot=P;U.set(P,ot);const Lt=Number(R(wt,"OutlineLevel"))||1;for(;gt.length&>[gt.length-1].level>=Lt;)gt.pop();const Bt=gt.length?gt[gt.length-1].uid:null;gt.push({uid:P,level:Lt});const _t=R(wt,"Summary")==="1",bt=R(wt,"Milestone")==="1",Ft={id:ot,name:R(wt,"Name")??ot};if(Bt&&(Ft.parent=Bt),bt&&(Ft.milestone=!0),!_t&&!bt){const ne=Ct(R(wt,"Duration"),v);ne!=null&&(Ft.duration=ne)}const Jt=ft(R(wt,"Start"));!_t&&Jt!=null&&(Ft.start=Jt);const ie=R(wt,"PercentComplete");if(ie!=null&&(Ft.percentComplete=Number(ie)),!_t){const ne=R(wt,"Type");ne!=null&&B[Number(ne)]&&(Ft.schedulingMode=B[Number(ne)]);const Dt=R(wt,"EffortDriven");Dt!=null&&(Ft.effortDriven=Dt==="1");const Zt=Ct(R(wt,"Work"),v);Zt!=null&&(Ft.effort=Zt*v)}const te=L[Number(R(wt,"ConstraintType"))];if(te){Ft.constraint=te;const ne=ft(R(wt,"ConstraintDate"));ne!=null&&(Ft.constraintDate=ne)}const de=_(wt,"Baseline");if(de){const ne=ft(R(de,"Start")),Dt=ft(R(de,"Finish"));ne!=null&&(Ft.baselineStart=ne),Dt!=null&&(Ft.baselineEnd=Dt)}const re=t.get(P);re&&re.length&&(Ft.assignments=re),u.push(Ft);for(const ne of Y(wt,"PredecessorLink"))ht.push({raw:ne,uid:P})}for(const{raw:wt,uid:P}of ht){const ot=R(wt,"PredecessorUID"),Lt=U.get(ot),Bt=U.get(P);if(Lt==null||Bt==null)continue;const _t=p[Number(R(wt,"Type")??1)]??"FS",bt=xt(R(wt,"LinkLag"),v),Ft={from:Lt,to:Bt,type:_t};bt&&(Ft.lag=bt),q.push(Ft)}const kt=T(C),dt={ok:!0,tasks:u,dependencies:q,resources:e};return E!=null&&(dt.projectStart=E),kt&&(dt.calendar=kt),dt}function T(l){const g=_(l,"Calendars"),v=Y(g,"Calendar"),C=R(l,"CalendarUID"),E=(C!=null?v.find(d=>R(d,"UID")===C):null)??v.find(d=>R(d,"IsBaseCalendar")!=="0");if(!E)return null;const O=_(E,"WeekDays"),I=[];let i=!1;for(const d of Y(O,"WeekDay")){const t=Number(R(d,"DayType"));t>=1&&t<=7&&(i=!0,R(d,"DayWorking")==="1"&&I.push(t-1))}const o=[],e=_(E,"Exceptions");for(const d of Y(e,"Exception")){if(R(d,"DayWorking")==="1")continue;const t=_(d,"TimePeriod"),h=ft(R(t,"FromDate")),u=ft(R(t,"ToDate"))??h;if(h!=null)for(let q=h;q<=u;q+=1)o.push(q)}return!i&&!o.length?null:{workdays:i?I:[1,2,3,4,5],holidays:o}}function k(l){if(l==null)return null;const g=/^(\d{1,2}):(\d{2})(?::(\d{2}))?$/.exec(String(l).trim());return g?Number(g[1])+Number(g[2])/60+Number(g[3]??0)/3600:null}function A(l,g,v){const C=l.find(t=>R(t,"UID")===g);if(!C)return null;const E=[],O={};for(const t of Y(_(C,"WeekDays"),"WeekDay")){const h=Number(R(t,"DayType"));if(!(h>=1&&h<=7)||R(t,"DayWorking")!=="1")continue;const u=h-1;E.push(u);let q=0;for(const U of Y(_(t,"WorkingTimes"),"WorkingTime")){const gt=k(R(U,"FromTime")),ht=k(R(U,"ToTime"));gt!=null&&ht!=null&&ht>gt&&(q+=ht-gt)}O[u]=q>0?q:v}const I=[];for(const t of Y(_(C,"Exceptions"),"Exception")){if(R(t,"DayWorking")==="1")continue;const h=_(t,"TimePeriod"),u=ft(R(h,"FromDate")),q=ft(R(h,"ToDate"))??u;if(u!=null)for(let U=u;U<=q;U+=1)I.push(U)}if(!E.length&&!I.length)return null;const i=E.map(t=>O[t]),o=i.length&&i.every(t=>Math.abs(t-i[0])<1e-9),e={workingDays:E.slice().sort((t,h)=>t-h),hoursPerDay:o?i[0]:O};I.length&&(e.holidays=I);const d=i.reduce((t,h)=>Math.max(t,h),0)||v;return{calendar:e,fullDayHours:d}}function W(l,g={}){const v=g.hoursPerDay??8,C=Array.isArray(l.tasks)?l.tasks:[],E=Array.isArray(l.dependencies)?l.dependencies:[],O=Array.isArray(l.resources)?l.resources:l.resources&&typeof l.resources=="object"?Object.entries(l.resources).map(([P,ot])=>({id:P,name:P,capacity:ot})):[],I=l.schedule&&l.schedule.ok?l.schedule:null,i=lt(l.fields),o=new Map;C.forEach((P,ot)=>{const Lt=String(i(P));o.set(Lt,/^\d+$/.test(Lt)?Lt:String(ot+1))});const e=new Map;for(const P of C){const ot=P.parent!=null?String(P.parent):null;ot&&(e.has(ot)||e.set(ot,[]),e.get(ot).push(String(i(P))))}const d=P=>e.has(P),t=P=>{let ot=1,Lt=C.find(Bt=>String(i(Bt))===P);for(;Lt&&Lt.parent!=null;)ot+=1,Lt=C.find(Bt=>String(i(Bt))===String(Lt.parent));return ot},h=new Map;for(const P of E){const ot=String(P.to);h.has(ot)||h.set(ot,[]),h.get(ot).push(P)}const u=[];u.push('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'),u.push('<Project xmlns="http://schemas.microsoft.com/project">'),u.push(` <Name>${F(g.projectName||"Lattice Gantt export")}</Name>`);const q=l.projectStart!=null?tt(l.projectStart):I?I.projectStart:null;q!=null&&u.push(` <StartDate>${mt(q,8)}</StartDate>`);const U=m(l.calendar);U&&u.push(" <CalendarUID>1</CalendarUID>");const gt=v;let ht=U?2:1;const kt=new Map;for(const P of O){const ot=P&&(P.name??P.id??P.resource);ot==null||ot===""||!P.calendar||typeof P.calendar!="object"||(kt.set(String(ot),{uid:ht,spec:St(P.calendar,gt)}),ht+=1)}if(U||kt.size){if(u.push(" <Calendars>"),U){u.push(" <Calendar>"),u.push(" <UID>1</UID>"),u.push(" <Name>Standard</Name>"),u.push(" <IsBaseCalendar>1</IsBaseCalendar>"),u.push(" <WeekDays>");for(let P=0;P<=6;P+=1){const ot=U.workdays.includes(P);u.push(" <WeekDay>"),u.push(` <DayType>${P+1}</DayType>`),u.push(` <DayWorking>${ot?1:0}</DayWorking>`),u.push(" </WeekDay>")}if(u.push(" </WeekDays>"),U.holidays.length){u.push(" <Exceptions>");for(const P of U.holidays)u.push(" <Exception>"),u.push(" <DayWorking>0</DayWorking>"),u.push(` <TimePeriod><FromDate>${mt(P,0)}</FromDate><ToDate>${mt(P,23)}</ToDate></TimePeriod>`),u.push(" </Exception>");u.push(" </Exceptions>")}u.push(" </Calendar>")}for(const[P,ot]of kt)for(const Lt of At(ot.uid,P,ot.spec))u.push(Lt);u.push(" </Calendars>")}u.push(" <Tasks>");for(const P of C){const ot=String(i(P)),Lt=o.get(ot),Bt=d(ot),_t=!!P.milestone||!Bt&&Number(P.duration)===0,bt=I?I.tasks.get(ot):null;u.push(" <Task>"),u.push(` <UID>${F(Lt)}</UID>`),u.push(` <ID>${F(Lt)}</ID>`),u.push(` <Name>${F(P.name!=null?P.name:ot)}</Name>`),u.push(` <OutlineLevel>${t(ot)}</OutlineLevel>`),u.push(` <Summary>${Bt?1:0}</Summary>`),u.push(` <Milestone>${_t?1:0}</Milestone>`);const Ft=bt?bt.duration:P.duration!=null?Number(P.duration):null;Ft!=null&&u.push(` <Duration>${at(Ft,v)}</Duration>`),u.push(" <DurationFormat>7</DurationFormat>");const Jt=bt?bt.es:P.start!=null?tt(P.start):null,ie=bt?bt.ef:P.end!=null?tt(P.end):Jt!=null&&Ft!=null?Jt+Ft:null;Jt!=null&&u.push(` <Start>${mt(Jt,8)}</Start>`),ie!=null&&u.push(` <Finish>${mt(ie,17)}</Finish>`);const te=bt?bt.percentComplete:P.percentComplete;if(te!=null&&u.push(` <PercentComplete>${Math.round(Number(te))}</PercentComplete>`),!Bt&&!_t){const Dt=bt&&bt.schedulingMode||J(P.schedulingMode??P.taskType),Zt=bt&&bt.effortDriven!=null?bt.effortDriven:P.effortDriven!=null?!!P.effortDriven:null,qt=bt&&bt.effort!=null?bt.effort:Number.isFinite(Number(P.effort))?Number(P.effort):typeof P.work=="number"?P.work:Number.isFinite(Number(P.hours))?Number(P.hours):null;(Dt!=null||Zt!=null||qt!=null)&&(Dt!=null&&u.push(` <Type>${G[Dt]}</Type>`),u.push(` <EffortDriven>${Zt?1:0}</EffortDriven>`),qt!=null&&u.push(` <Work>${at(qt/v,v)}</Work>`))}const de=Ut(P.constraint??P.constraintType);if(de!=null){u.push(` <ConstraintType>${de}</ConstraintType>`);const Dt=It(P.constraintDate??P.constraintAt??P.at??(P.constraint&&typeof P.constraint=="object"?P.constraint.date:null));Dt!=null&&u.push(` <ConstraintDate>${mt(Dt,8)}</ConstraintDate>`)}const re=It(P.baselineStart??(P.baseline&&P.baseline.start)),ne=It(P.baselineEnd??(P.baseline&&P.baseline.end));(re!=null||ne!=null)&&(u.push(" <Baseline>"),u.push(" <Number>0</Number>"),re!=null&&u.push(` <Start>${mt(re,8)}</Start>`),ne!=null&&u.push(` <Finish>${mt(ne,17)}</Finish>`),re!=null&&ne!=null&&u.push(` <Duration>${at(ne-re,v)}</Duration>`),u.push(" </Baseline>"));for(const Dt of h.get(ot)||[]){const Zt=o.get(String(Dt.from));Zt!=null&&(u.push(" <PredecessorLink>"),u.push(` <PredecessorUID>${F(Zt)}</PredecessorUID>`),u.push(` <Type>${x[Dt.type?String(Dt.type).toUpperCase():"FS"]??1}</Type>`),Dt.lag&&(u.push(` <LinkLag>${D(Number(Dt.lag),v)}</LinkLag>`),u.push(" <LagFormat>7</LagFormat>")),u.push(" </PredecessorLink>"))}u.push(" </Task>")}u.push(" </Tasks>");const dt=new Map;O.forEach((P,ot)=>{const Lt=String(P.name??P.id??`Resource ${ot+1}`),Bt=kt.get(Lt),_t=P.capacity??P.maxUnits??1,bt=Bt?P.capacity!=null?Number(P.capacity)/Bt.spec.fullDayHours:1:Number(_t),Ft=w(P.rate),Jt=w(P.cost),ie=P.type==="material"||P.type==="cost"?P.type:null;dt.set(Lt,{uid:String(ot+1),maxUnits:bt,calUid:Bt?Bt.uid:null,rate:Ft,cost:Jt,type:ie})});const wt=[];for(const P of C)for(const ot of Z(P))dt.has(ot.resource)||dt.set(ot.resource,{uid:String(dt.size+1),maxUnits:1,calUid:null}),wt.push({taskUid:o.get(String(i(P))),resUid:dt.get(ot.resource).uid,units:ot.units});u.push(" <Resources>");for(const[P,ot]of dt)u.push(" <Resource>"),u.push(` <UID>${F(ot.uid)}</UID>`),u.push(` <ID>${F(ot.uid)}</ID>`),u.push(` <Name>${F(P)}</Name>`),u.push(` <MaxUnits>${Number(ot.maxUnits)}</MaxUnits>`),ot.calUid!=null&&u.push(` <CalendarUID>${ot.calUid}</CalendarUID>`),ot.type!=null&&u.push(` <Type>${$[ot.type]}</Type>`),ot.rate!=null&&u.push(` <StandardRate>${ot.rate}/h</StandardRate>`),ot.cost!=null&&u.push(` <Cost>${ot.cost}</Cost>`),u.push(" </Resource>");return u.push(" </Resources>"),u.push(" <Assignments>"),wt.forEach((P,ot)=>{u.push(" <Assignment>"),u.push(` <UID>${ot+1}</UID>`),u.push(` <TaskUID>${F(P.taskUid)}</TaskUID>`),u.push(` <ResourceUID>${F(P.resUid)}</ResourceUID>`),u.push(` <Units>${Number(P.units)}</Units>`),u.push(" </Assignment>")}),u.push(" </Assignments>"),u.push("</Project>"),u.join(`
|
|
7
|
+
`)}function Z(l){if(l&&Array.isArray(l.assignments))return l.assignments.map(C=>{const E=C&&(C.resource??C.name??C.id);if(E==null||E==="")return null;const O=Number(C.units??C.allocation??1);return{resource:String(E),units:Number.isFinite(O)?O:1}}).filter(Boolean);const g=l?l.assignee??l.assignees??l.owner:null;return(Array.isArray(g)?g:g==null||g===""?[]:[g]).map(C=>String(C)).filter(C=>C!=="").map(C=>({resource:C,units:1}))}function m(l){if(l==null)return null;if(l==="weekends")return{workdays:[1,2,3,4,5],holidays:[]};const g=Array.isArray(l.workdays)&&l.workdays.length?l.workdays.map(Number).filter(C=>C>=0&&C<=6):[1,2,3,4,5],v=(Array.isArray(l.holidays)?l.holidays:[]).map(C=>tt(C)).filter(C=>C!=null);return{workdays:g,holidays:v}}function St(l,g){const v=Array.isArray(l.workingDays)&&l.workingDays.length?[...new Set(l.workingDays.map(Number).filter(i=>i>=0&&i<=6))].sort((i,o)=>i-o):[1,2,3,4,5],C=l.hoursPerDay,E={};for(const i of v){const o=C!=null&&typeof C=="object"?Number(C[i]):Number(C);E[i]=Number.isFinite(o)&&o>0?o:g}const O=[];for(const i of Array.isArray(l.holidays)?l.holidays:[]){if(i&&typeof i=="object"&&!(i instanceof Date)&&("from"in i||"to"in i)){const e=tt(i.from),d=tt(i.to??i.from);if(e==null)continue;const t=d??e;for(let h=Math.min(e,t);h<=Math.max(e,t);h+=1)O.push(h);continue}const o=tt(i);o!=null&&O.push(o)}const I=v.reduce((i,o)=>Math.max(i,E[o]),0)||g;return{workingDays:v,holidays:O,hoursByWeekday:E,fullDayHours:I}}function st(l){const g=Math.round(l*60),v=Math.floor(g/60),C=g%60;return`${String(v).padStart(2,"0")}:${String(C).padStart(2,"0")}:00`}function At(l,g,v){const C=[],E=new Set(v.workingDays);C.push(" <Calendar>"),C.push(` <UID>${l}</UID>`),C.push(` <Name>${F(g)}</Name>`),C.push(" <IsBaseCalendar>0</IsBaseCalendar>"),C.push(" <WeekDays>");for(let O=0;O<=6;O+=1){const I=E.has(O);if(C.push(" <WeekDay>"),C.push(` <DayType>${O+1}</DayType>`),C.push(` <DayWorking>${I?1:0}</DayWorking>`),I){const i=v.hoursByWeekday[O];C.push(" <WorkingTimes>"),C.push(" <WorkingTime>"),C.push(` <FromTime>${st(8)}</FromTime>`),C.push(` <ToTime>${st(8+i)}</ToTime>`),C.push(" </WorkingTime>"),C.push(" </WorkingTimes>")}C.push(" </WeekDay>")}if(C.push(" </WeekDays>"),v.holidays.length){C.push(" <Exceptions>");for(const O of v.holidays)C.push(" <Exception>"),C.push(" <DayWorking>0</DayWorking>"),C.push(` <TimePeriod><FromDate>${mt(O,0)}</FromDate><ToDate>${mt(O,23)}</ToDate></TimePeriod>`),C.push(" </Exception>");C.push(" </Exceptions>")}return C.push(" </Calendar>"),C}function Ut(l){if(l==null||l==="")return null;const g=c(l);return g?M[g]:null}function It(l){return l==null||l===""?null:tt(l)}}),se("packages/modules/shared/autosize.js",function(y,yt){"use strict";Object.defineProperty(y,"contentWidth",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(y,"contentHeight",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(y,"firstMeasured",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(y,"watchSize",{enumerable:!0,get:function(){return N}}),Object.defineProperty(y,"watchBox",{enumerable:!0,get:function(){return lt}});const $t=yt("packages/core/src/internal/util.js").warnOnce;function ct(c){if(!c||typeof c!="object")return null;const J=Number(c.clientWidth);if(Number.isFinite(J)&&J>0)return J;if(typeof c.getBoundingClientRect=="function"){const p=c.getBoundingClientRect(),x=p&&Number(p.width);if(Number.isFinite(x)&&x>0)return x}return null}function tt(c){if(!c||typeof c!="object")return null;const J=Number(c.clientHeight);if(Number.isFinite(J)&&J>0)return J;if(typeof c.getBoundingClientRect=="function"){const p=c.getBoundingClientRect(),x=p&&Number(p.height);if(Number.isFinite(x)&&x>0)return x}return null}function rt(c,J=ct){for(const p of c||[]){const x=J(p);if(Number.isFinite(x)&&x>0)return x}return null}function N(c){const J=(c&&Array.isArray(c.targets)?c.targets:[]).filter(Boolean),p=c&&typeof c.read=="function"?c.read:()=>null,x=c&&typeof c.apply=="function"?c.apply:()=>{},L=Number.isFinite(c&&c.epsilon)?Number(c.epsilon):1;let M=null,B=!1;const G=()=>{if(B)return!1;const H=p();if(!Number.isFinite(H)||H<=0||M!=null&&Math.abs(H-M)<L)return!1;M=H,B=!0;try{x(H)}finally{B=!1}return!0};G();const et=J[0],$=c&&c.view||et&&et.ownerDocument&&et.ownerDocument.defaultView||globalThis,b=$&&$.ResizeObserver;let w=null;if(typeof b=="function"&&J.length){w=new b(()=>{G()});for(const H of J)H&&typeof w.observe=="function"&&w.observe(H)}else J.length&&$t("shared.autosize.no-resize-observer","ResizeObserver is unavailable; this view was sized once at mount and will not follow its container.");return{refresh:G,get applied(){return M},release(){if(w&&typeof w.disconnect=="function")try{w.disconnect()}catch{}w=null}}}function lt(c){const J=(c&&Array.isArray(c.targets)?c.targets:[]).filter(Boolean),p=c&&typeof c.read=="function"?c.read:()=>({}),x=c&&typeof c.apply=="function"?c.apply:()=>{},L=Number.isFinite(c&&c.epsilon)?Number(c.epsilon):1;let M=null,B=!1;const G=F=>{if(M==null)return!0;for(const[nt,it]of Object.entries(F)){if(!Number.isFinite(it)||it<=0)continue;const _=M[nt];if(!Number.isFinite(_)||Math.abs(it-_)>=L)return!0}return!1},et=()=>{if(B)return!1;const F=p();if(!F||typeof F!="object"||!Object.values(F).some(it=>Number.isFinite(it)&&it>0)||!G(F))return!1;M={...M,...F},B=!0;try{x(F)}finally{B=!1}return!0};et();const $=J[0],b=c&&c.view||$&&$.ownerDocument&&$.ownerDocument.defaultView||globalThis,w=b&&b.ResizeObserver;let H=null;if(typeof w=="function"&&J.length){H=new w(()=>{et()});for(const F of J)F&&typeof H.observe=="function"&&H.observe(F)}else J.length&&$t("shared.autosize.no-resize-observer","ResizeObserver is unavailable; this view was sized once at mount and will not follow its container.");return{refresh:et,get applied(){return M},release(){if(H&&typeof H.disconnect=="function")try{H.disconnect()}catch{}H=null}}}}),se("packages/modules/shared/axislabels.js",function(y,yt){"use strict";Object.defineProperty(y,"CHAR_RATIO",{enumerable:!0,get:function(){return Gt}}),Object.defineProperty(y,"BOLD_FACTOR",{enumerable:!0,get:function(){return $t}}),Object.defineProperty(y,"MIN_GAP",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(y,"estimateLabelWidth",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(y,"thinLabels",{enumerable:!0,get:function(){return rt}});const Gt=.62,$t=1.05,ct=6;function tt(N,lt,c=!1){return String(N??"").length*lt*Gt*(c?$t:1)}function rt(N,lt){const c=Number.isFinite(lt.gap)?Number(lt.gap):ct,J=Number.isFinite(lt.fontSize)?Number(lt.fontSize):11,p=typeof lt.measure=="function"?lt.measure:G=>tt(G,J,!!lt.bold),x=N.filter(G=>G&&Number.isFinite(G.at)).map(G=>({...G,width:p(String(G.text??""))})).sort((G,et)=>G.at-et.at);if(x.length<2)return{every:1,kept:x};const L=G=>{let et=null;for(let $=0;$<x.length;$+=G){const b=x[$];if(et&&b.at-et.at<et.width+c)return!1;et=b}return!0};let M=1;for(;M<x.length&&!L(M);)M++;const B=[];for(let G=0;G<x.length;G+=M)B.push(x[G]);return{every:M,kept:B}}}),se("packages/modules/charts/svg.js",function(y,yt){"use strict";Object.defineProperty(y,"SVG_NS",{enumerable:!0,get:function(){return Gt}}),Object.defineProperty(y,"el",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(y,"svg",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(y,"attr",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(y,"attrs",{enumerable:!0,get:function(){return N}}),Object.defineProperty(y,"setText",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(y,"clear",{enumerable:!0,get:function(){return c}}),Object.defineProperty(y,"append",{enumerable:!0,get:function(){return J}}),Object.defineProperty(y,"path",{enumerable:!0,get:function(){return p}}),Object.defineProperty(y,"ribbonPath",{enumerable:!0,get:function(){return x}}),Object.defineProperty(y,"round",{enumerable:!0,get:function(){return L}}),Object.defineProperty(y,"pathRings",{enumerable:!0,get:function(){return M}}),Object.defineProperty(y,"insideRings",{enumerable:!0,get:function(){return B}});const Gt="http://www.w3.org/2000/svg";function $t(G){const et=G.indexOf(")");return et<0?G:G.slice(et+1).trim()||"#0072b2"}function ct(G,et,$){const b=G.createElement(et);return $&&b.setAttribute("class",$),b}function tt(G,et,$){const b=G.createElementNS(Gt,et);if($)for(const w of Object.keys($))b.setAttribute(w,String($[w]));return b}function rt(G,et,$){if(!G)return;if($==null){G.removeAttribute(et);return}let b=String($);b.startsWith("url(#")&&(et==="stroke"||et==="fill"&&G.localName==="text")&&(b=$t(b)),G.setAttribute(et,b)}function N(G,et){if(G)for(const $ of Object.keys(et))rt(G,$,et[$])}function lt(G,et){G&&(G.textContent=et==null?"":String(et))}function c(G){if(G)for(;G.firstChild;)G.removeChild(G.firstChild)}function J(G,et){for(const $ of et)$&&G.appendChild($);return G}function p(G){return G.join(" ")}function x(G){if(!G||G.length<2)return"";const et=["M",G[0].x,G[0].upper];for(let $=1;$<G.length;$++)et.push("L",G[$].x,G[$].upper);for(let $=G.length-1;$>=0;$--)et.push("L",G[$].x,G[$].lower);return et.push("Z"),p(et)}function L(G){return Math.round(G*100)/100}function M(G){const et=[];let $=[];const b=String(G||"").match(/[A-Za-z]|-?\d*\.?\d+(?:e[-+]?\d+)?/gi)||[];let w="",H=[];const F=()=>{if(!w||!H.length){H=[];return}if(w==="M"||w==="L")for(let nt=0;nt+1<H.length;nt+=2)$.push([H[nt],H[nt+1]]);else w!=="Z"&&H.length>=2&&$.push([H[H.length-2],H[H.length-1]]);H=[]};for(const nt of b){if(/[A-Za-z]/.test(nt)){if(F(),nt==="Z"||nt==="z"){$.length>2&&et.push($),$=[],w="";continue}nt==="M"&&$.length>2&&(et.push($),$=[]),w=nt;continue}H.push(Number(nt))}return F(),$.length>2&&et.push($),et}function B(G,et,$){let b=!1;for(const w of G)for(let H=0,F=w.length-1;H<w.length;F=H++){const[nt,it]=w[H],[_,Y]=w[F];it>$!=Y>$&&et<(_-nt)*($-it)/(Y-it||1e-12)+nt&&(b=!b)}return b}}),se("packages/modules/charts/scale.js",function(y,yt){"use strict";Object.defineProperty(y,"isNumber",{enumerable:!0,get:function(){return c}}),Object.defineProperty(y,"toNumber",{enumerable:!0,get:function(){return J}}),Object.defineProperty(y,"toTime",{enumerable:!0,get:function(){return p}}),Object.defineProperty(y,"extent",{enumerable:!0,get:function(){return x}}),Object.defineProperty(y,"niceStep",{enumerable:!0,get:function(){return L}}),Object.defineProperty(y,"niceDomain",{enumerable:!0,get:function(){return M}}),Object.defineProperty(y,"measureDomain",{enumerable:!0,get:function(){return B}}),Object.defineProperty(y,"linearTicks",{enumerable:!0,get:function(){return G}}),Object.defineProperty(y,"timeStepFor",{enumerable:!0,get:function(){return et}}),Object.defineProperty(y,"timeTicks",{enumerable:!0,get:function(){return b}}),Object.defineProperty(y,"linearScale",{enumerable:!0,get:function(){return w}}),Object.defineProperty(y,"timeScale",{enumerable:!0,get:function(){return H}}),Object.defineProperty(y,"key",{enumerable:!0,get:function(){return F}}),Object.defineProperty(y,"bandScale",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(y,"sqrtScale",{enumerable:!0,get:function(){return it}});const Gt=[1,2,2.5,5,10],$t=6e4,ct=36e5,tt=864e5,rt=365.25*tt,N=[1,2,5,10,20,25,50,100],lt=[1,5,10,25,50,100,250,500,1e3,5e3,15e3,3e4,$t,5*$t,15*$t,30*$t,ct,3*ct,6*ct,12*ct,tt,2*tt,7*tt,14*tt,30*tt,90*tt,180*tt,...N.map(_=>_*rt)];function c(_){return typeof _=="number"&&Number.isFinite(_)}function J(_){if(_==null||_==="")return null;if(_ instanceof Date){const R=_.getTime();return Number.isFinite(R)?R:null}if(typeof _=="boolean")return _?1:0;const Y=Number(_);return Number.isFinite(Y)?Y:null}function p(_){if(_==null||_==="")return null;if(_ instanceof Date){const R=_.getTime();return Number.isFinite(R)?R:null}if(typeof _=="number")return Number.isFinite(_)?_:null;const Y=Date.parse(String(_));return Number.isFinite(Y)?Y:null}function x(_){let Y=1/0,R=-1/0;for(let ft=0;ft<_.length;ft++){const mt=_[ft];c(mt)&&(mt<Y&&(Y=mt),mt>R&&(R=mt))}return Y===1/0?null:{min:Y,max:R}}function L(_){if(!(_>0))return 1;const Y=10**Math.floor(Math.log10(_));for(const R of Gt)if(_<=R*Y)return R*Y;return 10*Y}function M(_,Y=5){const R=L((_.max-_.min)/Math.max(1,Y));return{min:Math.floor(_.min/R)*R,max:Math.ceil(_.max/R)*R,step:R}}function B(_,Y={}){const R=x(_)||{min:0,max:1};let{min:ft,max:mt}=R;if(Y.zero&&(ft>0&&(ft=0),mt<0&&(mt=0)),ft===mt){const Ct=Math.abs(ft)>0?Math.abs(ft)/10:1;ft-=Ct,mt+=Ct}if(Y.nice!==!1){const Ct=M({min:ft,max:mt},Y.ticks||5);ft=Ct.min,mt=Ct.max}return c(Y.min)&&(ft=Y.min),c(Y.max)&&(mt=Y.max),ft===mt&&(mt=ft+1),{min:ft,max:mt}}function G(_,Y=5){const R=L((_.max-_.min)/Math.max(1,Y)),ft=Math.ceil(_.min/R),mt=Math.floor(_.max/R),Ct=[];for(let at=ft;at<=mt;at++){const xt=at*R;Ct.push(Math.abs(xt)<R/1e6?0:Number(xt.toPrecision(12)))}return Ct}function et(_,Y=5){const R=Math.max(1,Y),ft=_/R;let mt=lt[lt.length-1];for(const xt of lt)if(xt>=ft){mt=xt;break}if(mt<rt)return mt;let Ct=mt,at=Math.abs(_/mt-R);for(const xt of lt){if(xt<rt)continue;const D=Math.abs(_/xt-R);D<at&&(at=D,Ct=xt)}return Ct}function $(_,Y){const R=new Date(_.min).getUTCFullYear();let ft=Math.ceil(R/Y)*Y;Date.UTC(ft,0,1)<_.min&&(ft+=Y);const mt=[];for(;Date.UTC(ft,0,1)<=_.max;ft+=Y)mt.push(Date.UTC(ft,0,1));return mt}function b(_,Y=5){const R=et(_.max-_.min,Y);if(R>=rt)return $(_,Math.round(R/rt));const ft=[],mt=Math.ceil(_.min/R)*R;for(let Ct=mt;Ct<=_.max;Ct+=R)ft.push(Ct);return ft}function w(_,Y){const R=_.max-_.min||1,[ft,mt]=Y;return{kind:"linear",domain:_,range:Y,of(Ct){return ft+(Ct-_.min)/R*(mt-ft)},invert(Ct){return _.min+(Ct-ft)/(mt-ft||1)*R},ticks(Ct=5){return G(_,Ct)}}}function H(_,Y){return{...w(_,Y),kind:"time",ticks(ft=5){return b(_,ft)}}}function F(_){if(_==null)return" null";if(_ instanceof Date)return` date:${_.getTime()}`;if(typeof _=="object"){const Y=_,R=Y.id??Y.key??Y.value;return R!==void 0&&typeof R!="object"?` obj:${String(R)}`:` obj:${String(_)}`}return String(_)}function nt(_,Y,R=.2){const ft=Math.min(.9,Math.max(0,R)),[mt,Ct]=Y,at=new Map;for(let X=0;X<_.length;X++){const T=F(_[X]);at.has(T)||at.set(T,X)}const xt=_.length?(Ct-mt)/_.length:Ct-mt,D=Math.max(0,xt*(1-ft));return{kind:"band",domain:_,range:Y,bandwidth:D,step:xt,of(X){const T=at.get(F(X));return T===void 0?NaN:mt+T*xt+(xt-D)/2},centre(X){const T=this.of(X);return Number.isNaN(T)?NaN:T+D/2},ticks(){return _}}}function it(_,Y){const[R,ft]=Y,mt=Math.max(Math.abs(_.max),Math.abs(_.min),0)||1;return{kind:"sqrt",domain:_,range:Y,of(Ct){const at=Math.sqrt(Math.abs(Ct)/mt);return R+at*(ft-R)}}}}),se("packages/modules/gantt/links.js",function(y,yt){"use strict";Object.defineProperty(y,"LINK_SIDES",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(y,"linkSides",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(y,"routeLink",{enumerable:!0,get:function(){return N}}),Object.defineProperty(y,"arrowheadPath",{enumerable:!0,get:function(){return lt}});const Gt=yt("packages/modules/charts/svg.js"),$t=Gt.path,ct=Gt.round,tt=Object.freeze({FS:Object.freeze({depart:1,arrive:-1}),SS:Object.freeze({depart:-1,arrive:-1}),FF:Object.freeze({depart:1,arrive:1}),SF:Object.freeze({depart:-1,arrive:1})});function rt(c){return tt[String(c||"FS").toUpperCase()]||tt.FS}function N(c){const J=Number(c.sx),p=Number(c.sy),x=Number(c.ex),L=Number(c.ey),M=Number.isFinite(c.elbow)&&c.elbow>0?Number(c.elbow):8,B=Number.isFinite(c.rowGap)&&c.rowGap>0?Number(c.rowGap):M,G=rt(c.type),et=-G.arrive,$=Math.abs(L-p)<.5,b=(x-J)*et;if($&&b>0)return{d:$t(["M",ct(J),ct(p),"H",ct(x)]),arrowDir:et,route:"straight"};if(b>=0)return{d:$t(["M",ct(J),ct(p),"V",ct(L),"H",ct(x)]),arrowDir:et,route:"drop"};const w=$?p+B:(p+L)/2,H=J+G.depart*M,F=x+G.arrive*M;return{d:$t(["M",ct(J),ct(p),"H",ct(H),"V",ct(w),"H",ct(F),"V",ct(L),"H",ct(x)]),arrowDir:et,route:"detour"}}function lt(c,J,p,x=4){return $t(["M",ct(c),ct(J),"L",ct(c-p*x),ct(J-x),"L",ct(c-p*x),ct(J+x),"Z"])}}),se("packages/modules/gantt/messages.js",function(y,yt){"use strict";Object.defineProperty(y,"FALLBACK_EN",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(y,"createTranslator",{enumerable:!0,get:function(){return tt}});const $t=yt("packages/core/src/internal/util.js").isFunction,ct=Object.freeze({"gantt.lag":"+{days}d","gantt.lead":"{days}d","gantt.a11y.moved":"{name} moved to {date}","gantt.a11y.day":"day {day}","gantt.a11y.resized":"{name} resized to {days} days","gantt.a11y.linkFrom":"Linking from {name}. Focus the successor and press L.","gantt.a11y.linked":"Linked {from} to {to}, finish to start.","gantt.a11y.linkCancelled":"Link cancelled.","gantt.a11y.deleted":"{name} deleted.","gantt.a11y.undone":"Undone.","gantt.a11y.redone":"Redone.","gantt.a11y.nothingToUndo":"Nothing to undo.","gantt.a11y.nothingToRedo":"Nothing to redo.","gantt.workload.title":"Resource workload","gantt.workload.resource":"Resource","gantt.workload.total":"Total","gantt.workload.unassigned":"Unassigned","gantt.workload.cell":"{hours} h from {date}","gantt.workload.over":"{hours} h from {date}, over a capacity of {capacity} h","gantt.workload.expand":"Show {name}’s tasks","gantt.workload.collapse":"Hide {name}’s tasks","gantt.workload.unitToggle":"Hours / % / Cost","gantt.workload.unitHours":"Showing hours","gantt.workload.unitPercent":"Showing percent of capacity","gantt.workload.unitCost":"Showing cost","gantt.workload.cellPercent":"{percent}% from {date}","gantt.workload.overPercent":"{percent}% from {date}, over capacity","gantt.workload.cellNoCapacity":"No available hours from {date}","gantt.workload.cellCost":"{cost} from {date}","gantt.row.expand":"Expand {name}","gantt.row.collapse":"Collapse {name}","gantt.resource.over":"{name} — over-allocated","gantt.a11y.hoursSet":"{name}: {hours} h from {date}","gantt.a11y.hoursCleared":"{name}: no hours from {date}","gantt.a11y.hoursRefused":"{date} is not a working day; {name} was not changed.","gantt.tip.range":"{from} to {to}","gantt.tip.duration":"{days}d","gantt.tip.slack":"slack {days}d","gantt.tip.row":"{label}: {value}","gantt.tip.start":"Start","gantt.tip.end":"End","gantt.tip.date":"Date","gantt.tip.durationLabel":"Duration","gantt.tip.durationValue":"{days} days","gantt.tip.complete":"Complete","gantt.tip.effortLabel":"Effort","gantt.tip.effortValue":"{hours} h","gantt.tip.assigned":"Assigned","gantt.tip.cost":"Cost","gantt.tip.slackLabel":"Slack","gantt.tip.slackValue":"{days} days","gantt.histogram.title":"Resource histogram","gantt.histogram.tableTitle":"Resource histogram data","gantt.histogram.resource":"Resource","gantt.histogram.period":"Period","gantt.histogram.hours":"Hours","gantt.histogram.percent":"Percent of capacity","gantt.histogram.cost":"Cost","gantt.histogram.capacity":"Capacity","gantt.histogram.overAllocated":"Over-allocated","gantt.histogram.yes":"Yes","gantt.histogram.no":"No","gantt.histogram.tip":"{name}, {from} to {to}: {value}{capacity}{tasks}","gantt.histogram.tipHours":"{hours} h","gantt.histogram.tipPercent":"{percent}% of capacity","gantt.histogram.tipCost":"{cost}","gantt.histogram.tipCapacity":", capacity {hours} h","gantt.histogram.tipTasks":" ({tasks})","gantt.histogram.tipOver":", over capacity","gantt.histogram.tipNoCapacity":"no available hours","gantt.scurve.spi":"SPI {index}","gantt.scurve.cpi":"CPI {index}","gantt.picker.title":"Assign resources to {name}","gantt.picker.open":"Edit assignments for {name}","gantt.picker.search":"Search resources","gantt.picker.list":"Resources","gantt.picker.selected":"Assigned resources","gantt.picker.load":"{load}% booked of {capacity}% over these dates","gantt.picker.none":"No matching resources","gantt.picker.units":"{name}, units in percent","gantt.picker.remove":"Remove {name}","gantt.picker.apply":"Apply","gantt.picker.cancel":"Cancel","gantt.picker.warn":"{name} would be over-allocated: {load}% booked of {capacity}%","gantt.picker.ok":"No resource would be over-allocated","gantt.picker.assign":"Assign","gantt.col.effort":"Effort","gantt.col.units":"Units","gantt.print.page":"Page {page} of {pages}","gantt.print.printed":"Printed {date}"});function tt(rt,N){return function(c,J){const p=$t(N)?N():null,x=rt&&rt.grid,L=p&&$t(p.t)&&p||x&&x.messages&&$t(x.messages.t)&&x.messages||null;if(L){let B;try{B=L.t(c,J)}catch{B=null}if(typeof B=="string"&&B&&B!==c)return B}const M=ct[c];return M?M.replace(/\{(\w+)\}/g,(B,G)=>J&&G in J?String(J[G]):B):c}}}),se("packages/modules/gantt/gestures.js",function(y,yt){"use strict";Object.defineProperty(y,"describeTask",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(y,"GanttGestures",{enumerable:!0,get:function(){return tt}});const $t=yt("packages/modules/charts/svg.js").round;function ct(rt,N){const lt=rt.isSummary?"summary":rt.isMilestone?"milestone":"task",c=N.dateAxis===!1?`day ${$t(rt.es)} to ${$t(rt.ef)}`:`${N.iso(rt.es)} to ${N.iso(rt.ef)}`,J=[`${rt.name}, ${lt}`,c];return rt.isMilestone||J.push(`${$t(rt.duration)} days`),rt.percentComplete!=null&&J.push(`${Math.round(rt.percentComplete)}% complete`),J.push(`slack ${$t(rt.totalFloat)} days`),rt.critical&&J.push("on the critical path"),J.join(", ")}class tt{#n;#s=null;#t=null;#e=null;constructor(N){this.#n=N}#i(){return this.#n.options()||{}}get dragging(){return this.#s!==null}#r(){const N=this.#n.plot();if(N&&typeof N.getScreenCTM=="function"){let c=null;try{c=N.getScreenCTM()}catch{c=null}if(c&&Number.isFinite(c.a)&&c.a>0)return{scale:c.a,origin:Number.isFinite(c.e)?c.e:0}}const lt=N&&N.getBoundingClientRect?N.getBoundingClientRect():null;return{scale:1,origin:lt&<.left||0}}#a(N){const{scale:lt,origin:c}=this.#r();return((N.clientX||0)-c)/lt}#c(N){const{scale:lt}=this.#r();return Math.round(N/lt/(this.#n.pxPerDay()||1))}onPointerDown(N){const lt=this.#n.controller.schedule;if(!lt||!lt.ok)return;const c=this.#n.rowOf(N.target);if(!c)return;const J=c.getAttribute("data-task"),p=lt.tasks.get(J);if(!p||p.isSummary)return;const x=this.#n.barOf(c);if(!x)return;const L=this.#a(N),M=Number.isFinite(this.#i().resizeZone)?Number(this.#i().resizeZone):6,B=!p.isMilestone&&L>=this.#u(x)-M?"resize":"move";this.#s={id:J,mode:B,startX:N.clientX||0,origStart:p.es,origDuration:p.duration,barEl:x},N.preventDefault&&N.preventDefault();const G=$=>this.#o($),et=$=>this.#y($);this.#t={move:G,up:et},this.#n.doc.addEventListener("pointermove",G),this.#n.doc.addEventListener("pointerup",et)}#u(N){const lt=parseFloat(N.getAttribute("x")),c=parseFloat(N.getAttribute("width"));return Number.isFinite(lt)&&Number.isFinite(c)?lt+c:Number.POSITIVE_INFINITY}#o(N){if(!this.#s)return;const lt=this.#n.pxPerDay()||1,c=this.#c((N.clientX||0)-this.#s.startX),J=this.#s.barEl;if(this.#s.mode==="move")J.getAttribute("d")?this.#_(J,c*lt):(J.setAttribute("x",$t(parseFloat(J.getAttribute("x"))+c*lt-this.#d(J))),this.#g(J,c*lt));else{const p=Math.max(1,parseFloat(J.getAttribute("width"))+(c*lt-this.#d(J)));J.setAttribute("width",$t(p)),this.#g(J,c*lt)}}#d(N){return parseFloat(N.getAttribute("data-preview")||"0")}#g(N,lt){N.setAttribute("data-preview",String(lt))}#_(N,lt){const c=this.#d(N),J=N.getAttribute("d").split(" ");for(let p=1;p<J.length;p+=1){const x=parseFloat(J[p]);!Number.isNaN(x)&&p%3===1&&(J[p]=String($t(x+(lt-c))))}N.setAttribute("d",J.join(" ")),this.#g(N,lt)}#y(N){const lt=this.#s;if(this.#S(),this.#s=null,!lt)return;const c=this.#c((N.clientX||0)-lt.startX);if(c===0){this.#n.redraw();return}lt.mode==="move"?this.#n.controller.applyEdit({id:lt.id,start:lt.origStart+c},{writeBack:!0}):this.#n.controller.applyEdit({id:lt.id,duration:Math.max(0,lt.origDuration+c)},{writeBack:!0}),this.#n.redraw()}#S(){this.#t&&(this.#n.doc.removeEventListener("pointermove",this.#t.move),this.#n.doc.removeEventListener("pointerup",this.#t.up),this.#t=null)}onKey(N){const lt=this.#n.controller,c=lt.schedule;if(!c||!c.ok)return;const J=this.#n.rowOf(N.target),p=J?J.getAttribute("data-task"):null,x=p?c.tasks.get(p):null;if(!x)return;const L=this.#i(),M=Number.isFinite(L.moveStep)?Number(L.moveStep):1,B=N.key,G=this.#n.t;if(B==="ArrowRight"||B==="ArrowLeft"){if(x.isSummary)return;const et=B==="ArrowRight"?1:-1;if(this.#n.focusTask(p),N.shiftKey){if(x.isMilestone)return;const $=Math.max(0,x.duration+et*M);lt.applyEdit({id:p,duration:$},{writeBack:!0}),this.#n.announce(G("gantt.a11y.resized",{name:x.name,days:$}))}else{const $=x.es+et*M,b=L.dateAxis===!1?G("gantt.a11y.day",{day:$}):this.#n.iso($);lt.applyEdit({id:p,start:$},{writeBack:!0}),this.#n.announce(G("gantt.a11y.moved",{name:x.name,date:b}))}N.preventDefault&&N.preventDefault()}else if(B==="l"||B==="L"){if(x.isSummary)return;if(!this.#e)this.#e=p,this.#n.announce(G("gantt.a11y.linkFrom",{name:x.name}));else if(this.#e!==p){const et=this.#e;this.#e=null,this.#n.focusTask(p),lt.setDependencies([...lt.dependencies,{from:et,to:p,type:"FS"}]),this.#n.announce(G("gantt.a11y.linked",{from:et,to:x.name}))}N.preventDefault&&N.preventDefault()}else if(B==="Delete"||B==="Backspace"){if(x.isSummary)return;lt.deleteTask(p),this.#n.announce(G("gantt.a11y.deleted",{name:x.name})),N.preventDefault&&N.preventDefault()}else B==="Escape"&&this.#e&&(this.#e=null,this.#n.announce(G("gantt.a11y.linkCancelled")))}onHistoryKey(N){if(!N||!(N.ctrlKey||N.metaKey))return;const lt=this.#n;if(typeof lt.editing=="function"&<.editing())return;const c=N.target,J=c&&c.tagName?String(c.tagName).toLowerCase():"";if(J==="input"||J==="textarea"||J==="select"||c&&c.isContentEditable)return;const p=typeof N.key=="string"?N.key.toLowerCase():"";let x;if(p==="z"&&!N.shiftKey)x=lt.controller.undo()?"gantt.a11y.undone":"gantt.a11y.nothingToUndo";else if(p==="z"&&N.shiftKey||p==="y")x=lt.controller.redo()?"gantt.a11y.redone":"gantt.a11y.nothingToRedo";else return;lt.announce(lt.t(x)),N.preventDefault&&N.preventDefault()}destroy(){this.#S(),this.#s=null,this.#e=null}}}),se("packages/modules/gantt/export.js",function(y,yt){"use strict";Object.defineProperty(y,"PRINT_NS",{enumerable:!0,get:function(){return N}}),Object.defineProperty(y,"PAPERS",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(y,"PAGE_MARGIN",{enumerable:!0,get:function(){return c}}),Object.defineProperty(y,"PALETTE",{enumerable:!0,get:function(){return M}}),Object.defineProperty(y,"esc",{enumerable:!0,get:function(){return B}}),Object.defineProperty(y,"paperPx",{enumerable:!0,get:function(){return G}}),Object.defineProperty(y,"resolveRange",{enumerable:!0,get:function(){return et}}),Object.defineProperty(y,"cellText",{enumerable:!0,get:function(){return $}}),Object.defineProperty(y,"barMarkup",{enumerable:!0,get:function(){return b}}),Object.defineProperty(y,"timeHeadMarkup",{enumerable:!0,get:function(){return w}}),Object.defineProperty(y,"bandRowsMarkup",{enumerable:!0,get:function(){return H}}),Object.defineProperty(y,"buildSplitSVG",{enumerable:!0,get:function(){return F}}),Object.defineProperty(y,"inlineSvgStyles",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(y,"rasterizePNG",{enumerable:!0,get:function(){return it}}),Object.defineProperty(y,"buildPrintDocument",{enumerable:!0,get:function(){return Ct}}),Object.defineProperty(y,"openPrintWindow",{enumerable:!0,get:function(){return xt}});const $t=yt("packages/modules/charts/scale.js").linearScale,ct=yt("packages/modules/gantt/time.js"),tt=ct.toISODate,rt=ct.toDayNumber,N="lat-gantt-print",lt=Object.freeze({A4:{w:794,h:1123},Letter:{w:816,h:1056},A3:{w:1123,h:1587}}),c=36,J=26,p=20,x=24,L=28,M=Object.freeze({text:"#1f2933",muted:"#57606a",border:"#d0d7de",surface:"#f1f3f5",bar:"#4a90d9",critical:"#e2513b",summary:"#2c3e50",milestone:"#33404d",progress:"rgba(0,0,0,0.28)",today:"#e2513b",workload:"#4a90d9",histogram:"#2c7a7b",over:"#e2513b",pageBg:"#ffffff"});function B(D){return String(D??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function G(D,X){const T=lt[D]||lt.A4;return X==="portrait"?{w:T.w,h:T.h}:{w:T.h,h:T.w}}function et(D,X){const T=X&&X.from!=null?rt(X.from):D.domainMin,k=X&&X.to!=null?rt(X.to):D.domainMax;return Number.isFinite(T)&&Number.isFinite(k)&&k>T?{from:T,to:k}:{from:D.domainMin,to:D.domainMax}}function $(D,X,T){switch(D.kind){case"name":return X.name??"";case"start":return tt(X.es)??String(X.es);case"end":return tt(X.ef)??String(X.ef);case"duration":return String(Math.round(X.ef-X.es));case"assignee":{const k=T?T.assignee??T.assignees??T.owner:null;return(Array.isArray(k)?k:k==null?[]:[k]).map(String).filter(Boolean).join(", ")}case"progress":return X.percentComplete==null?"":`${Math.round(X.percentComplete)}%`;default:return T&&D.key?String(T[D.key]??""):""}}function b(D,X,T,k){if(!Number.isFinite(D.es)||!Number.isFinite(D.ef))return"";const A=Math.max(2,Math.round(k*.18)),W=T+A,Z=Math.max(2,k-A*2);if(D.milestone){const It=X(D.es),l=T+k/2,g=Math.max(4,Math.min(9,k*.3)),v=D.critical?M.critical:M.milestone;return`<path d="M ${It} ${l-g} L ${It+g} ${l} L ${It} ${l+g} L ${It-g} ${l} Z" fill="${v}"/>`}const m=X(D.es),St=X(D.ef),st=Math.max(1,St-m),At=D.isSummary?M.summary:D.critical?M.critical:M.bar;let Ut=`<rect x="${m}" y="${W}" width="${st}" height="${Z}" rx="3" fill="${At}"/>`;if(!D.isSummary&&D.percentComplete!=null&&D.percentComplete>0){const It=Math.max(0,Math.min(100,D.percentComplete)),l=Math.round(st*It/100);Ut+=`<rect x="${m}" y="${W}" width="${l}" height="${Z}" fill="${M.progress}"/>`}return Ut}function w(D,X,T,k,A,W){const Z=W==="month"||W==="quarter"?30:7;let m=`<rect x="0" y="0" width="${k}" height="${A}" fill="${M.surface}"/>`,St=Math.floor(D/Z)*Z;for(;St<X;St+=Z){const st=T(St);m+=`<line x1="${st}" y1="0" x2="${st}" y2="${A}" stroke="${M.border}"/>`,m+=`<text x="${st+4}" y="${Math.round(A*.68)}" font-size="11" font-weight="600" fill="${M.muted}">${B(tt(St)??String(St))}</text>`}return m+=`<line x1="0" y1="${A}" x2="${k}" y2="${A}" stroke="${M.border}"/>`,m}function H(D,X,T,k,A,W){if(!D||!D.rows||!D.rows.length)return"";const Z=Math.max(1,...D.rows.flatMap(St=>(St.cells||[]).filter(st=>st!=null)));let m="";return D.rows.forEach((St,st)=>{const At=A+st*k;m+=`<text x="4" y="${At+k/2+4}" font-size="11" fill="${M.text}">${B(St.label)}</text>`,m+=`<line x1="0" y1="${At+k}" x2="${T}" y2="${At+k}" stroke="${M.border}"/>`,(St.cells||[]).forEach((Ut,It)=>{if(Ut==null)return;const l=D.buckets[It];if(!l)return;const g=T+X(l.start),v=Math.max(1,X(l.end)-X(l.start)-2),C=Math.max(1,Math.round(Ut/Z*(k-8))),E=At+k-4-C,O=St.over&&St.over[It];m+=`<rect x="${g}" y="${E}" width="${v}" height="${C}" fill="${O?M.over:W}"/>`})}),m}function F(D,X={}){const T=et(D,X.range),k=Math.max(1,Math.round(D.pxPerDay*(T.to-T.from))),A=$t({min:T.from,max:T.to},[0,k]),W=v=>Math.round(A.of(v)),Z=D.columnWidths.reduce((v,C)=>v+C,0),m=Z+k,St=Math.max(x,L),st=St;let At=0;D.workload&&(At+=D.workload.cfg.height),D.histogram&&(At+=D.histogram.cfg.height);const Ut=st+D.totalHeight+At;let It="",l=0;for(let v=0;v<D.columns.length;v++){const C=D.columnWidths[v];It+=`<text x="${l+6}" y="${Math.round(St*.65)}" font-size="11" font-weight="600" fill="${M.muted}">${B(D.columns[v].title||D.columns[v].key)}</text>`,l+=C}It+=`<line x1="0" y1="${St}" x2="${Z}" y2="${St}" stroke="${M.border}"/>`,It+=`<g transform="translate(${Z},0)">${w(T.from,T.to,W,k,St,D.zoomLevel)}</g>`;for(const v of D.rows){const C=st+v.top;let E=0;for(let O=0;O<D.columns.length;O++){const I=D.columns[O],i=D.columnWidths[O],o=$(I,v.rec,D.rawById.get(String(v.id))),e=I.kind==="name"?v.depth*14+6:6;It+=`<text x="${E+e}" y="${C+v.height/2+4}" font-size="12" font-weight="${v.rec.isSummary?600:400}" fill="${v.rec.isSummary?M.summary:M.text}">${B(o)}</text>`,E+=i}It+=`<line x1="0" y1="${C+v.height}" x2="${m}" y2="${C+v.height}" stroke="${M.border}"/>`,It+=`<g transform="translate(${Z},${C})">${b(v.rec,W,0,v.height)}</g>`}if(D.today!=null&&D.today>=T.from&&D.today<=T.to){const v=Z+W(D.today);It+=`<line x1="${v}" y1="0" x2="${v}" y2="${st+D.totalHeight}" stroke="${M.today}" stroke-width="1.5" stroke-dasharray="4 3"/>`}let g=st+D.totalHeight;for(const[v,C]of[[D.workload,M.workload],[D.histogram,M.histogram]]){if(!v)continue;const E=Math.max(40,Z);It+=`<rect x="0" y="${g}" width="${m}" height="${v.cfg.height}" fill="${M.pageBg}"/>`,It+=`<g transform="translate(${E},0)">${H(v.data,W,0,v.cfg.rowHeight,g,C)}</g>`,It+=`<line x1="0" y1="${g}" x2="${m}" y2="${g}" stroke="${M.border}" stroke-width="2"/>`,g+=v.cfg.height}return`<svg xmlns="http://www.w3.org/2000/svg" width="${m}" height="${Ut}" viewBox="0 0 ${m} ${Ut}" font-family="system-ui,sans-serif"><rect x="0" y="0" width="${m}" height="${Ut}" fill="${M.pageBg}"/>${It}</svg>`}function nt(D,X,T){const k=["fill","fill-opacity","stroke","stroke-width","stroke-opacity","stroke-dasharray","stroke-linejoin","stroke-linecap","font-size","font-family","font-weight","opacity","text-anchor","dominant-baseline","visibility"],A=[D,...D.querySelectorAll("*")],W=[X,...X.querySelectorAll("*")];for(let Z=0;Z<A.length&&Z<W.length;Z++){const m=T.getComputedStyle(A[Z]),St=[];for(const st of k){const At=m.getPropertyValue(st);At&&St.push(`${st}:${At}`)}St.length&&W[Z].setAttribute("style",St.join(";"))}}async function it(D,X,T,k,A,W){const Z=D&&D.defaultView||globalThis;if(!Z.Image||!D.createElement)return null;const m=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(X)}`,St=new Z.Image;await new Promise((Ut,It)=>{St.onload=Ut,St.onerror=()=>It(new Error("the plan could not be rasterised")),St.src=m});const st=D.createElement("canvas");st.width=Math.max(1,Math.round(T*A)),st.height=Math.max(1,Math.round(k*A));const At=st.getContext("2d");return W&&(At.fillStyle=W,At.fillRect(0,0,st.width,st.height)),At.drawImage(St,0,0,st.width,st.height),new Promise(Ut=>st.toBlob(Ut,"image/png"))}function _(D,X){const T=[];let k=[],A=0;for(const W of D){const Z=Math.max(1,W.height);k.length&&A+Z>X&&(T.push(k),k=[],A=0),k.push(W),A+=Z}return(k.length||!T.length)&&T.push(k),T}function Y(D){return`
|
|
8
8
|
@page { size: ${D.w}px ${D.h}px; margin: 0; }
|
|
9
9
|
*{box-sizing:border-box}
|
|
10
|
-
body{margin:0;font:12px/1.4 system-ui,sans-serif;color:${
|
|
11
|
-
.${
|
|
12
|
-
.${
|
|
13
|
-
.${
|
|
14
|
-
.${
|
|
15
|
-
table.${
|
|
16
|
-
.${
|
|
17
|
-
.${
|
|
18
|
-
.${
|
|
19
|
-
.${
|
|
10
|
+
body{margin:0;font:12px/1.4 system-ui,sans-serif;color:${M.text};background:${M.pageBg}}
|
|
11
|
+
.${N}__page{width:${D.w}px;height:${D.h}px;padding:${c}px;break-after:page;page-break-after:always;overflow:hidden;position:relative}
|
|
12
|
+
.${N}__page:last-child{break-after:auto;page-break-after:auto}
|
|
13
|
+
.${N}__title{font-size:14px;font-weight:600;margin:0 0 6px 0}
|
|
14
|
+
.${N}__foot{position:absolute;left:${c}px;right:${c}px;bottom:${c-p}px;height:${p}px;font-size:10px;color:${M.muted};display:flex;justify-content:space-between}
|
|
15
|
+
table.${N}__table{border-collapse:collapse;width:100%}
|
|
16
|
+
.${N}__table th,.${N}__table td{border-bottom:1px solid ${M.border};padding:2px 6px;text-align:left;font-weight:400;vertical-align:middle}
|
|
17
|
+
.${N}__table thead th{background:${M.surface};color:${M.muted};font-weight:600;font-size:11px}
|
|
18
|
+
.${N}__table tr{break-inside:avoid;page-break-inside:avoid}
|
|
19
|
+
.${N}__bandtitle{font-size:12px;font-weight:600;margin:10px 0 4px 0}
|
|
20
20
|
svg{display:block}
|
|
21
|
-
`.trim()}function R(D,
|
|
22
|
-
`)}function
|
|
23
|
-
.${
|
|
21
|
+
`.trim()}function R(D,X,T,k,A,W){const Z=D?`<p class="${N}__title">${B(D)}</p>`:"",m=w(k.from,k.to,T,W,L,X.zoomLevel),St=X.columns.map((st,At)=>`<th style="width:${X.columnWidths[At]}px">${B(st.title||st.key)}</th>`).join("");return`${Z}<table class="${N}__table"><thead><tr>${St}<th style="width:${W}px;padding:0"><svg width="${W}" height="${L}" viewBox="0 0 ${W} ${L}">${m}</svg></th></tr></thead><tbody>`}function ft(D,X,T,k){const A=D.columns.map(Z=>{const m=$(Z,X.rec,D.rawById.get(String(X.id)));return`<td style="padding-left:${6+(Z.kind==="name"?X.depth*14:0)}px;font-weight:${X.rec.isSummary?600:400}">${B(m)}</td>`}).join(""),W=b(X.rec,T,0,X.height);return`<tr style="height:${X.height}px">${A}<td style="padding:0;width:${k}px"><svg width="${k}" height="${X.height}" viewBox="0 0 ${k} ${X.height}">${W}</svg></td></tr>`}function mt(D,X,T,k){return D===!1?null:typeof D=="function"?String(D(X,T)):typeof D=="string"?D:k}function Ct(D,X={}){const T=G(X.paper||"A4",X.orientation||"landscape"),k=T.w-c*2,A=T.h-c*2,W=Math.min(k-80,D.columnWidths.reduce((U,gt)=>U+gt,0)),Z=Math.max(40,k-W),m=Math.max(1,D.domainMax-D.domainMin),St=X.fitToWidth!==!1?Z/m:X.scale||D.pxPerDay,st=$t({min:D.domainMin,max:D.domainMax},[0,St*m]),At=U=>Math.round(st.of(U)),Ut=X.fitToWidth!==!1?Z:Math.round(St*m),It=typeof X.t=="function"?X.t:(U=>U),l=X.title===!1?null:X.title||D.title||null,g=X.locale||"en-GB",v=X.printDate instanceof Date?X.printDate:new Date;let C="";try{C=new Intl.DateTimeFormat(g).format(v)}catch{C=v.toISOString().slice(0,10)}const E=L,O=l?J:0,I=X.footer!==!1,i=I?p:0,o=Math.max(D.rowHeight||24,A-O-E-i-8),e=D.rowHeight||24,d=_(D.rows.map(U=>({...U,height:Math.max(e,U.height)})),o),t=[];for(const[U,gt,ht]of[[D.workload,M.workload,"gantt.workload.title"],[D.histogram,M.histogram,"gantt.histogram.title"]]){if(!U||!U.data||!U.data.rows.length)continue;const kt=U.data.rows.map(wt=>({...wt,height:U.cfg.rowHeight})),dt=_(kt,o);t.push({title:It(ht),rows:dt,color:gt,band:U})}const h=d.length+t.reduce((U,gt)=>U+gt.rows.length,0);let u=0,q="";for(const U of d)u+=1,q+=at({title:l,header:R(l,D,At,{from:D.domainMin,to:D.domainMax},W,Ut),body:U.map(gt=>ft(D,gt,At,Ut)).join(""),pageIndex:u,totalPages:h,opts:X,t:It,locale:g,dateText:C,footerOn:I});for(const U of t)for(const gt of U.rows){u+=1;const ht=140,kt=k-ht,dt=P=>Math.round((P-D.domainMin)/m*kt),wt=gt.map(P=>{const ot=H({rows:[P],buckets:U.band.data.buckets},dt,0,P.height,0,U.color);return`<tr style="height:${P.height}px"><td style="width:${ht}px"></td><td style="padding:0;width:${kt}px"><svg width="${kt}" height="${P.height}" viewBox="0 0 ${kt} ${P.height}">${ot}</svg></td></tr>`}).join("");q+=at({title:l?`${l} — ${U.title}`:U.title,header:`<p class="${N}__title">${B(l?`${l} — ${U.title}`:U.title)}</p><table class="${N}__table"><thead><tr><th style="width:${ht}px"></th><th style="width:${kt}px"></th></tr></thead><tbody>`,body:wt,pageIndex:u,totalPages:h,opts:X,t:It,locale:g,dateText:C,footerOn:I})}return`<!DOCTYPE html><html><head><meta charset="utf-8"><title>${B(l||"Gantt")}</title><style>${Y(T)}</style></head><body>${q}</body></html>`}function at(D){const X=D.footerOn?mt(D.opts.footer,D.pageIndex,D.totalPages,`${D.t("gantt.print.page",{page:D.pageIndex,pages:D.totalPages})} · ${D.t("gantt.print.printed",{date:D.dateText})}`):null,T=D.opts.header===!1?null:typeof D.opts.header=="function"||typeof D.opts.header=="string"?mt(D.opts.header,D.pageIndex,D.totalPages,null):null,k=T?`<p class="${N}__title">${B(T)}</p>`:"";return`<div class="${N}__page">${k}${D.header}${D.body}</tbody></table>`+(X?`<div class="${N}__foot"><span>${B(X)}</span></div>`:"")+"</div>"}function xt(D,X){const T=D&&D.defaultView||globalThis;if(typeof T.open!="function")return!1;const k=T.open("","_blank");if(!k||!k.document)return!1;k.document.open(),k.document.write(X),k.document.close();const A=()=>{try{k.focus(),k.print()}catch{}};return k.document.readyState==="complete"?A():k.addEventListener("load",A,{once:!0}),!0}}),se("packages/modules/gantt/tooltip.js",function(y,yt){"use strict";Object.defineProperty(y,"taskTooltipRows",{enumerable:!0,get:function(){return x}}),Object.defineProperty(y,"taskTooltipText",{enumerable:!0,get:function(){return L}}),Object.defineProperty(y,"buildTooltipCard",{enumerable:!0,get:function(){return M}}),Object.defineProperty(y,"resolveTaskTooltip",{enumerable:!0,get:function(){return B}}),Object.defineProperty(y,"positionTooltip",{enumerable:!0,get:function(){return G}}),Object.defineProperty(y,"tooltipCss",{enumerable:!0,get:function(){return et}});const Gt=yt("packages/modules/charts/svg.js"),$t=Gt.el,ct=Gt.setText,tt=Gt.round,N=yt("packages/modules/gantt/assignments.js").parseAssignments,c=yt("packages/modules/gantt/workload.js").formatCost,J=["start","end","duration","percentComplete","effort","resources","cost","slack"];function p($,b,w,H){const{t:F,formatDate:nt}=H;switch($){case"start":return{label:F("gantt.tip.start"),value:nt(b.es)};case"end":return{label:F("gantt.tip.end"),value:nt(b.ef)};case"duration":return{label:F("gantt.tip.durationLabel"),value:F("gantt.tip.durationValue",{days:tt(b.duration)})};case"percentComplete":return b.percentComplete==null?null:{label:F("gantt.tip.complete"),value:`${Math.round(b.percentComplete)}%`};case"effort":return b.effort==null?null:{label:F("gantt.tip.effortLabel"),value:F("gantt.tip.effortValue",{hours:tt(b.effort)})};case"resources":{const it=N(w).map(_=>_.resource);return it.length?{label:F("gantt.tip.assigned"),value:it.join(", ")}:null}case"cost":{const it=w&&w.cost!=null?Number(w.cost):NaN;return Number.isFinite(it)?{label:F("gantt.tip.cost"),value:c(it)}:null}case"slack":return Number.isFinite(b.totalFloat)?{label:F("gantt.tip.slackLabel"),value:F("gantt.tip.slackValue",{days:tt(b.totalFloat)})}:null;default:return null}}function x($,b,w,H){if($.isMilestone)return[{label:H.t("gantt.tip.date"),value:H.formatDate($.es)}];const F=Array.isArray(w)&&w.length?w:J,nt=[];for(const it of F){const _=p(it,$,b,H);_&&nt.push(_)}return nt}function L($,b,w){return[$.name,...b.map(H=>w("gantt.tip.row",{label:H.label,value:H.value}))].join(`
|
|
22
|
+
`)}function M($,b,w,H){const F=$t($,"div",`${b}__tip-card`),nt=$t($,"div",`${b}__tip-title`);ct(nt,w.name),F.appendChild(nt);for(const it of H){const _=$t($,"div",`${b}__tip-row`),Y=$t($,"span",`${b}__tip-label`);ct(Y,it.label);const R=$t($,"span",`${b}__tip-value`);ct(R,it.value),_.appendChild(Y),_.appendChild(R),F.appendChild(_)}return F}function B($,b,w,H,F,nt){if(typeof F=="function"){const Y=F(w,{...nt,rawTask:H});return Y==null||Y===""?null:typeof Y=="string"?{node:null,text:Y}:{node:Y,text:Y.textContent||""}}const it=F&&typeof F=="object"&&Array.isArray(F.fields)?F.fields:null,_=x(w,H,it,nt);return{node:M($,b,w,_),text:L(w,_,nt.t)}}function G($,b,w,H,F,nt={}){const it=Number.isFinite(nt.gap)?nt.gap:8,_=$.offsetWidth||0,Y=$.offsetHeight||0,R=w.left+w.width/2,ft=w.top+w.height/2;let mt="top",Ct=R-_/2,at=w.top-Y-it;if(at<H.top&&(mt="bottom",at=w.bottom+it),mt==="bottom"&&at+Y>H.bottom&&(at=ft-Y/2,mt=w.right+it+_<=H.right?"right":"left",Ct=mt==="right"?w.right+it:w.left-_-it),Ct=Math.min(Math.max(Ct,H.left),Math.max(H.left,H.right-_)),at=Math.min(Math.max(at,H.top),Math.max(H.top,H.bottom-Y)),$.setAttribute("data-placement",mt),$.style.left=`${tt(Ct-F.left)}px`,$.style.top=`${tt(at-F.top)}px`,!b)return;const xt=(b.offsetWidth||0)/2,D=(b.offsetHeight||0)/2;if(mt==="top"||mt==="bottom"){const X=Math.min(Math.max(R-Ct-xt,10-xt),Math.max(10-xt,_-10-xt));b.style.left=`${tt(X)}px`,b.style.top=""}else{const X=Math.min(Math.max(ft-at-D,10-D),Math.max(10-D,Y-10-D));b.style.top=`${tt(X)}px`,b.style.left=""}}function et($){return`
|
|
23
|
+
.${$}__tip-card{position:relative;max-width:280px;padding:6px 10px;border-radius:6px;font-size:11px;line-height:1.5;
|
|
24
24
|
background:var(--lattice-surface,#242b33);color:var(--lattice-foreground,#fff);
|
|
25
25
|
border:1px solid var(--lattice-border-color,#3a4552);
|
|
26
26
|
box-shadow:var(--lattice-popup-shadow,0 6px 16px -4px rgb(16 20 24/35%))}
|
|
27
|
-
.${
|
|
28
|
-
.${
|
|
29
|
-
.${
|
|
30
|
-
.${
|
|
31
|
-
.${
|
|
27
|
+
.${$}__tip-title{font-weight:600;margin-bottom:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
28
|
+
.${$}__tip-row{display:flex;gap:10px;white-space:nowrap}
|
|
29
|
+
.${$}__tip-label{color:var(--lattice-foreground-muted,#9aa5b1)}
|
|
30
|
+
.${$}__tip-value{margin-inline-start:auto;font-weight:600}
|
|
31
|
+
.${$}__tip-arrow{position:absolute;width:9px;height:9px;transform:rotate(45deg);
|
|
32
32
|
background:var(--lattice-surface,#242b33);border:1px solid var(--lattice-border-color,#3a4552);z-index:-1}
|
|
33
|
-
.${
|
|
34
|
-
.${
|
|
35
|
-
.${
|
|
36
|
-
.${
|
|
37
|
-
`.trim()}}),
|
|
38
|
-
.${
|
|
39
|
-
.${
|
|
40
|
-
.${
|
|
41
|
-
.${
|
|
42
|
-
.${
|
|
43
|
-
.${
|
|
44
|
-
.${
|
|
45
|
-
.${
|
|
46
|
-
.${
|
|
47
|
-
.${
|
|
48
|
-
.${
|
|
49
|
-
.${
|
|
50
|
-
.${
|
|
51
|
-
.${
|
|
52
|
-
.${
|
|
53
|
-
.${
|
|
54
|
-
.${
|
|
55
|
-
.${
|
|
56
|
-
.${
|
|
57
|
-
.${
|
|
58
|
-
.${
|
|
59
|
-
.${
|
|
60
|
-
.${
|
|
61
|
-
.${
|
|
62
|
-
.${
|
|
63
|
-
.${
|
|
64
|
-
.${
|
|
65
|
-
.${
|
|
66
|
-
.${
|
|
67
|
-
.${
|
|
68
|
-
.${
|
|
69
|
-
.${
|
|
70
|
-
.${
|
|
71
|
-
${
|
|
72
|
-
.${
|
|
73
|
-
.${
|
|
33
|
+
.${$}__tooltip[data-placement="top"] .${$}__tip-arrow{bottom:-5px;border-top:none;border-left:none}
|
|
34
|
+
.${$}__tooltip[data-placement="bottom"] .${$}__tip-arrow{top:-5px;border-bottom:none;border-right:none}
|
|
35
|
+
.${$}__tooltip[data-placement="right"] .${$}__tip-arrow{left:-5px;border-top:none;border-right:none}
|
|
36
|
+
.${$}__tooltip[data-placement="left"] .${$}__tip-arrow{right:-5px;border-bottom:none;border-left:none}
|
|
37
|
+
`.trim()}}),se("packages/modules/gantt/render.js",function(y,yt){"use strict";Object.defineProperty(y,"NS",{enumerable:!0,get:function(){return m}}),Object.defineProperty(y,"GanttView",{enumerable:!0,get:function(){return I}}),Object.defineProperty(y,"mountGantt",{enumerable:!0,get:function(){return i}});const $t=yt("packages/core/src/internal/util.js").warnOnce,ct=yt("packages/modules/shared/autosize.js"),tt=ct.contentWidth,rt=ct.firstMeasured,N=ct.watchSize,c=yt("packages/modules/shared/axislabels.js").thinLabels,J=yt("packages/modules/charts/svg.js"),p=J.svg,x=J.el,L=J.setText,M=J.path,B=J.round,et=yt("packages/modules/charts/scale.js").linearScale,$=yt("packages/modules/gantt/time.js"),b=$.toISODate,w=$.fromDayNumber,H=$.toDayNumber,F=$.resolveProjectEpoch,nt=yt("packages/modules/gantt/links.js"),it=nt.routeLink,_=nt.arrowheadPath,R=yt("packages/modules/gantt/schedule.js").EPS,ft=yt("packages/modules/gantt/messages.js"),mt=ft.createTranslator,Ct=yt("packages/modules/gantt/gestures.js"),at=Ct.GanttGestures,xt=Ct.describeTask,D=yt("packages/modules/gantt/export.js"),X=D.inlineSvgStyles,T=D.rasterizePNG,k=yt("packages/modules/gantt/tooltip.js"),A=k.resolveTaskTooltip,W=k.positionTooltip,Z=k.tooltipCss;Object.defineProperty(y,"FALLBACK_EN",{enumerable:!0,get:function(){return ft.FALLBACK_EN}});const m="lat-gantt",St="data-lat-gantt-styles",st=720,At=Object.freeze({messages:null,width:"container",rowHeight:26,barPadding:4,labelWidth:160,axisHeight:22,rightPadding:16,rowLabels:!0,showArrows:!0,showCritical:!0,showProgress:!0,hoverChain:!0,dateAxis:!0,label:"name",today:null,nonWorking:null,editable:!0,resizeZone:6,zoom:null,projectEpoch:null,scrollToToday:!1,tooltip:!0,groupBy:null,keyboard:!0,moveStep:1}),Ut=11,It=Object.freeze({day:{px:28,step:1,level:"day"},week:{px:12,step:7,level:"week"},month:{px:4,step:30,level:"month"},quarter:{px:1.6,step:91,level:"quarter"}});function l(){return`
|
|
38
|
+
.${m}{position:relative;font:12px/1.4 system-ui,sans-serif;color:var(--lattice-foreground,#1f2933);overflow:auto}
|
|
39
|
+
.${m}__plot{max-width:100%;height:auto;display:block}
|
|
40
|
+
.${m}__shade{fill:var(--lattice-surface,#f1f3f5)}
|
|
41
|
+
.${m}__gridline{stroke:var(--lattice-border-color,#e6e8eb);stroke-width:1}
|
|
42
|
+
.${m}__tick{fill:var(--lattice-foreground-muted,#6b7280);font-size:11px}
|
|
43
|
+
.${m}__lane-band{fill:var(--lattice-surface,#eef1f4)}
|
|
44
|
+
.${m}__lane-label{fill:var(--lattice-foreground,#374151);font-size:12px;font-weight:600}
|
|
45
|
+
.${m}__rowlabel{fill:var(--lattice-foreground,#1f2933);font-size:12px}
|
|
46
|
+
.${m}__rowlabel--summary{font-weight:600}
|
|
47
|
+
.${m}__bar{fill:var(--lattice-accent,#4a90d9);rx:3}
|
|
48
|
+
.${m}__bar--critical{fill:var(--lattice-variant-danger-solid,#e2513b)}
|
|
49
|
+
.${m}__bar--violation{stroke:var(--lattice-variant-warning-solid,#d97706);stroke-width:2}
|
|
50
|
+
.${m}__bar--conflict{stroke:var(--lattice-variant-warning-solid,#d97706);stroke-width:2}
|
|
51
|
+
.${m}__bar--overdue{stroke:var(--lattice-variant-danger-solid,#b91c1c);stroke-width:2;stroke-dasharray:3 2}
|
|
52
|
+
.${m}__bar--atrisk{stroke:var(--lattice-variant-warning-solid,#f59e0b);stroke-width:2}
|
|
53
|
+
.${m}__summary{fill:var(--lattice-header-foreground,#2c3e50)}
|
|
54
|
+
.${m}__milestone{fill:var(--lattice-header-foreground,#33404d)}
|
|
55
|
+
.${m}__milestone--critical{fill:var(--lattice-variant-danger-solid,#e2513b)}
|
|
56
|
+
.${m}__progress{fill:rgba(0,0,0,0.28)}
|
|
57
|
+
.${m}__label{fill:var(--lattice-foreground,#374151);font-size:11px;dominant-baseline:middle}
|
|
58
|
+
.${m}__link{fill:none;stroke:var(--lattice-foreground-muted,#9aa5b1);stroke-width:1.5}
|
|
59
|
+
.${m}__link--critical{stroke:var(--lattice-variant-danger-solid,#e2513b)}
|
|
60
|
+
.${m}__link--chain{stroke:var(--lattice-link-color,#2563eb);stroke-width:2.5}
|
|
61
|
+
.${m}__arrowhead{fill:var(--lattice-foreground-muted,#9aa5b1)}
|
|
62
|
+
.${m}__arrowhead--critical{fill:var(--lattice-variant-danger-solid,#e2513b)}
|
|
63
|
+
.${m}__arrowhead--chain{fill:var(--lattice-link-color,#2563eb)}
|
|
64
|
+
.${m}__bar--chain{stroke:var(--lattice-link-color,#2563eb);stroke-width:2}
|
|
65
|
+
.${m}__milestone--chain{stroke:var(--lattice-link-color,#2563eb);stroke-width:2}
|
|
66
|
+
.${m}__summary--chain{stroke:var(--lattice-link-color,#2563eb);stroke-width:2}
|
|
67
|
+
.${m}__lag{fill:var(--lattice-foreground-muted,#6b7280);font-size:10px}
|
|
68
|
+
.${m}__today{stroke:var(--lattice-variant-danger-solid,#e2513b);stroke-width:1.5;stroke-dasharray:4 3}
|
|
69
|
+
.${m}__tooltip{position:absolute;pointer-events:none;z-index:5}
|
|
70
|
+
.${m}__tooltip[hidden]{display:none}
|
|
71
|
+
${Z(m)}
|
|
72
|
+
.${m}__live{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
|
|
73
|
+
.${m}__row:focus{outline:2px solid var(--lattice-focus-color,#2563eb);outline-offset:1px}
|
|
74
74
|
/* Native scrollbars follow the nearest data-theme (BACKLOG-0001462). */
|
|
75
|
-
@scope ([data-theme="dark"]){:scope.${
|
|
76
|
-
@scope ([data-theme="light"],[data-theme="auto"]){:scope.${
|
|
77
|
-
@media (prefers-color-scheme:dark){@scope ([data-theme="auto"]){:scope.${
|
|
78
|
-
`.trim()}function h(o){const n=o.documentElement;if(!n||n.getAttribute(St))return;n.setAttribute(St,"1");const u=o.createElement("style");u.textContent=a(),(o.head||o.body||n).appendChild(u)}function k(o,n=0){return o==="weekends"?u=>{const t=y(u+n),d=t?t.getUTCDay():0;return d===0||d===6}:typeof o=="function"?o:null}function _(o){return String(o??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function j(o){const n=o.attributes;if(!n)return[];if(n instanceof Map)return[...n.entries()];const u=[];for(let t=0;t<n.length;t+=1)u.push([n[t].name,n[t].value]);return u}function P(o){const n=o.tagName?o.tagName.toLowerCase():null;if(!n)return"";const u=j(o).map(([c,q])=>` ${c}="${_(q)}"`).join(""),t=o.children||[];if(t.length)return`<${n}${u}>${[...t].map(P).join("")}</${n}>`;const d=o.textContent?_(o.textContent):"";return d?`<${n}${u}>${d}</${n}>`:`<${n}${u}></${n}>`}class I{#n;#i;#t;#e;#o=null;#r=null;#a=null;#c=null;#u=null;#s=null;#d=null;#g="";#S=null;#y=null;#_=null;#x=!1;#A=1;#C=null;#F=null;#T=null;#v;#b;#D=0;#M=null;#P=st;#O=null;#j=8;constructor(n,u,t={}){this.#n=n,this.#i=u,this.#t=u.ownerDocument,this.#e={...At,...t},this.#D=F(this.#e.projectEpoch),this.#M=this.#J(this.#e.today),this.#k(t),this.#P=Number.isFinite(this.#e.width)?Number(this.#e.width):st,h(this.#t),this.#o=S(this.#t,"div",p),this.#i.appendChild(this.#o),this.#e.tooltip&&(this.#a=S(this.#t,"div",`${p}__tooltip`),this.#a.setAttribute("hidden",""),this.#c=S(this.#t,"div",`${p}__tip-arrow`),this.#a.appendChild(this.#c),this.#o.appendChild(this.#a),this.#o.addEventListener("scroll",()=>this.#U())),this.#d=S(this.#t,"div",`${p}__live`),this.#d.setAttribute("role","status"),this.#d.setAttribute("aria-live","polite"),this.#o.appendChild(this.#d),this.#b=pt(n,()=>this.#e.messages),this.#v=new ot({doc:this.#t,controller:n,options:()=>this.#e,plot:()=>this.#r,rowOf:d=>d&&d.closest?d.closest(`.${p}__row`):null,barOf:d=>d.querySelector(`.${p}__bar`)||d.querySelector(`.${p}__milestone`),pxPerDay:()=>this.#A,announce:d=>this.#q(d,{repeat:!0}),t:(d,c)=>this.#b(d,c),iso:d=>this.#I(d),redraw:()=>this.draw(),focusTask:d=>{this.#S=d},editing:()=>!1}),this.#N(),this.#_=n.on("schedule",()=>this.draw()),this.draw()}#N(){this.#e.width==="container"&&(this.#B(this.#e.zoom)||(this.#O=M({targets:[this.#o,this.#i],read:()=>rt([this.#o,this.#i],Q),apply:n=>{this.#P=n,this.#r&&this.draw()}})))}#k(n){!n||!Number.isFinite(n.width)||this.#B(this.#e.zoom)&&vt(`gantt.zoomWidth:${String(this.#e.zoom)}`,`[lattice] gantt: mount was given both zoom (${JSON.stringify(this.#e.zoom)}) and width (${n.width}); zoom fixes the pixels-per-day, so the width is ignored and the plot scrolls. Drop one of the two.`)}#J(n){if(n==null||n==="")return null;if(Number.isFinite(n))return Number(n);const u=H(n);return Number.isFinite(u)?u-this.#D:(vt(`gantt.today:${String(n)}`,`[lattice] gantt: today ${JSON.stringify(n)} is not a date or a day number; no today line is drawn.`),null)}#L(n){return n+this.#D}#I(n){return g(this.#L(n))}get element(){return this.#o}get options(){return{...this.#e}}draw(){if(this.#x)return;const n=this.#n.schedule;if(!n||!n.ok)return;const u=this.#e,t=n.order,d=u.rowLabels?u.labelWidth:0,c=this.#G(n),q=u.axisHeight+c.count*u.rowHeight,W=n.projectStart,ht=n.projectFinish,ut=this.#M,kt=[W,ht];Number.isFinite(ut)&&kt.push(ut);const ct=Math.min(...kt),wt=Math.max(...kt),T=Math.max(1,(wt-ct)*.04),nt=ct-T,Rt=wt+T,Bt=this.#B(u.zoom),$t=this.#P,gt=Bt?Math.max(1,(Rt-nt)*Bt.px):Math.max(1,$t-d-u.rightPadding),Ft=Bt?d+gt+u.rightPadding:$t,qt=tt({min:nt,max:Rt},[0,gt]);this.#A=qt.of(1)-qt.of(0),this.#C=Bt?Bt.step:null,this.#j=this.#e.width==="container"?Math.max(2,Math.min(8,Math.floor(gt/(this.#e.dateAxis?78:44)))):8,this.#F=Bt?Bt.level:null,this.#T=Number.isFinite(ut)?B(d+qt.of(ut)):null;const re=i=>B(d+qt.of(i)),Jt=f(this.#t,"svg",{class:`${p}__plot`,width:Ft,height:q,viewBox:`0 0 ${Ft} ${q}`,preserveAspectRatio:"xMinYMin meet",role:"img","aria-label":"Gantt chart"}),de=c.rowIndexById,ie=this.#Q(n),O=new Set(this.#n.findViolations().map(i=>i.id)),e=new Set((n.conflicts||[]).map(i=>i.id));if(this.#s=u.tooltip?new Map(this.#n.tasks.map(i=>[String(this.#n.readId(i)),i])):null,this.#tt(Jt,qt,re,ct,wt,d,u.axisHeight,q),this.#l(Jt,qt,re,q),this.#at(Jt,n,c,ie,re,O,e),u.showArrows&&this.#ct(Jt,n,de,re),Number.isFinite(ut)&&this.#z(Jt,re,ut,u.axisHeight,q),u.editable&&Jt.addEventListener("pointerdown",i=>this.#v.onPointerDown(i)),u.tooltip&&(Jt.addEventListener("pointermove",i=>this.#E(i)),Jt.addEventListener("pointerleave",()=>this.#U()),Jt.addEventListener("focus",i=>this.#Z(i),!0),Jt.addEventListener("blur",()=>this.#U(),!0),Jt.addEventListener("keydown",i=>{i.key==="Escape"&&this.#U()})),u.keyboard&&(Jt.addEventListener("keydown",i=>this.#v.onKey(i)),Jt.addEventListener("keydown",i=>this.#v.onHistoryKey(i))),u.showArrows&&u.hoverChain&&(Jt.addEventListener("pointerover",i=>this.#W(i)),Jt.addEventListener("pointerleave",()=>this.#m())),this.#r&&this.#o.removeChild(this.#r),this.#o.appendChild(Jt),this.#r=Jt,u.scrollToToday&&this.scrollToToday(),this.#S){const i=Jt.querySelector(`.${p}__row[data-task="${this.#S}"]`);i&&i.focus&&i.focus()}}#B(n){return Number.isFinite(n)?{px:Number(n),step:1,level:"custom"}:typeof n=="string"&&It[n]?It[n]:null}linkVerticalScroll(n){if(this.#y&&(this.#y(),this.#y=null),!n||!this.#o||!n.addEventListener)return()=>{};const u=this.#o,t=n;let d=!1;const c=(ut,kt)=>{d||(d=!0,kt.scrollTop=ut.scrollTop,d=!1)},q=()=>c(u,t),W=()=>c(t,u);u.addEventListener("scroll",q),t.addEventListener("scroll",W);const ht=()=>{u.removeEventListener("scroll",q),t.removeEventListener("scroll",W)};return this.#y=ht,ht}scrollToToday(){if(this.#T==null||!this.#o)return;const n=this.#e.rowLabels?this.#e.labelWidth:0;this.#o.scrollLeft=Math.max(0,this.#T-n-40)}#G(n){const u=n.order,t=new Map;if(!this.#e.groupBy){const ut=u.map(kt=>({kind:"task",id:kt}));return u.forEach((kt,ct)=>t.set(kt,ct)),{rows:ut,rowIndexById:t,count:ut.length}}const d=new Map(this.#n.tasks.map(ut=>[String(this.#n.readId(ut)),ut])),c=this.#e.groupBy,q=ut=>{const kt=d.get(ut)||{},ct=typeof c=="function"?c(kt):kt[c];return ct==null||ct===""?"Ungrouped":String(ct)},W=new Map;for(const ut of u){const kt=q(ut);W.has(kt)||W.set(kt,[]),W.get(kt).push(ut)}const ht=[];for(const[ut,kt]of W){ht.push({kind:"header",key:ut});for(const ct of kt)ht.push({kind:"task",id:ct})}return ht.forEach((ut,kt)=>{ut.kind==="task"&&t.set(ut.id,kt)}),{rows:ht,rowIndexById:t,count:ht.length}}#Q(n){const u=new Map;for(const t of n.order){let d=0,c=n.tasks.get(t).parent;for(;c!=null&&n.tasks.has(c);)d+=1,c=n.tasks.get(c).parent;u.set(t,d)}return u}#tt(n,u,t,d,c,q,W,ht){const ut=k(this.#e.nonWorking,this.#D);if(!ut)return;const kt=Math.floor(d),ct=Math.ceil(c);if(ct-kt>3660)return;const wt=f(this.#t,"g",{class:`${p}__shading`});for(let T=kt;T<ct;T+=1){if(!ut(T))continue;const nt=Math.max(q,t(T)),Rt=t(T+1);wt.appendChild(f(this.#t,"rect",{class:`${p}__shade`,"data-day":String(T),x:nt,y:W,width:B(Math.max(0,Rt-nt)),height:ht-W}))}n.appendChild(wt)}#l(n,u,t,d){const c=f(this.#t,"g",{class:`${p}__axis`}),q=this.#e.axisHeight,W=this.#R(u);for(const kt of W){const ct=t(kt);c.appendChild(f(this.#t,"line",{class:`${p}__gridline`,x1:ct,y1:q,x2:ct,y2:d}))}const ht=W.map(kt=>({at:t(kt),text:this.#ot(kt)})),{kept:ut}=this.#C?l(ht,{fontSize:zt}):{kept:ht};for(const kt of ut){const ct=f(this.#t,"text",{class:`${p}__tick`,x:kt.at+2,y:q-6});L(ct,kt.text),c.appendChild(ct)}n.appendChild(c)}#R(n){if(!this.#C)return n.ticks(this.#j);const{min:u,max:t}=n.domain,d=this.#C,c=[];for(let q=Math.ceil(u/d)*d;q<=t;q+=d)c.push(q);return c.length?c:n.ticks(this.#j)}#ot(n){if(!this.#e.dateAxis)return String(B(n));const u=this.#I(Math.round(n));return u?this.#F==="month"||this.#F==="quarter"?u.slice(0,7):u:String(B(n))}#at(n,u,t,d,c,q,W){const ht=this.#e,ut=f(this.#t,"g",{class:`${p}__rows`});t.rows.forEach((kt,ct)=>{const wt=ht.axisHeight+ct*ht.rowHeight;if(kt.kind==="header"){this.#lt(ut,kt.key,wt,ht.rowHeight);return}const T=kt.id,nt=u.tasks.get(T),Rt=wt+ht.barPadding,Bt=ht.rowHeight-2*ht.barPadding,$t=wt+ht.rowHeight/2,gt=ht.showCritical&&nt.critical,Ft=q.has(T),qt=W.has(T),re=nt.percentComplete==null||nt.percentComplete<100,Jt=Number.isFinite(this.#M)&&re&&!nt.isSummary&&nt.ef<this.#M,de=nt.totalFloat<-R,ie=f(this.#t,"g",{class:`${p}__row`});if(ie.setAttribute("data-task",T),ie.setAttribute("tabindex",ht.keyboard?"0":"-1"),ie.setAttribute("role",nt.isSummary?"group":"button"),ie.setAttribute("aria-label",_t(nt,{dateAxis:ht.dateAxis,iso:O=>this.#I(O)})),gt&&ie.setAttribute("data-critical","true"),Ft&&ie.setAttribute("data-violation","true"),Jt&&ie.setAttribute("data-overdue","true"),de&&ie.setAttribute("data-atrisk","true"),ht.rowLabels){const O=f(this.#t,"text",{class:`${p}__rowlabel${nt.isSummary?` ${p}__rowlabel--summary`:""}`,x:6+(d.get(T)||0)*12,y:$t,"dominant-baseline":"middle"});L(O,nt.name),ie.appendChild(O)}if(nt.isMilestone)this.#V(ie,c(nt.es),$t,Bt/2,gt);else{const O=c(nt.es),e=Math.max(1,c(nt.ef)-O),i=nt.isSummary?`${p}__summary`:`${p}__bar${gt?` ${p}__bar--critical`:""}${Ft?` ${p}__bar--violation`:""}${qt?` ${p}__bar--conflict`:""}${Jt?` ${p}__bar--overdue`:""}${de?` ${p}__bar--atrisk`:""}`;ie.appendChild(f(this.#t,"rect",{class:i,x:O,y:Rt,width:B(e),height:Bt,rx:3})),ht.showProgress&&nt.percentComplete!=null&&nt.percentComplete>0&&ie.appendChild(f(this.#t,"rect",{class:`${p}__progress`,x:O,y:Rt,width:B(e*Math.min(1,nt.percentComplete/100)),height:Bt,rx:3}));const s=this.#H(nt);if(s){const v=f(this.#t,"text",{class:`${p}__label`,x:B(O+e+4),y:$t});L(v,s),ie.appendChild(v)}}ut.appendChild(ie)}),n.appendChild(ut)}#lt(n,u,t,d){const c=f(this.#t,"g",{class:`${p}__lane`});c.setAttribute("data-group",u),c.appendChild(f(this.#t,"rect",{class:`${p}__lane-band`,x:0,y:t,width:"100%",height:d}));const q=f(this.#t,"text",{class:`${p}__lane-label`,x:6,y:t+d/2,"dominant-baseline":"middle"});L(q,u),c.appendChild(q),n.appendChild(c)}#H(n){const u=this.#e.label;if(typeof u=="function")return String(u(n)??"");switch(u){case"none":return"";case"percent":return n.percentComplete==null?"":`${Math.round(n.percentComplete)}%`;case"dates":return this.#e.dateAxis?`${this.#I(n.es)} – ${this.#I(n.ef)}`:`${B(n.es)} – ${B(n.ef)}`;default:return n.name}}#V(n,u,t,d,c){const q=A(["M",B(u-d),B(t),"L",B(u),B(t-d),"L",B(u+d),B(t),"L",B(u),B(t+d),"Z"]);n.appendChild(f(this.#t,"path",{class:`${p}__milestone${c?` ${p}__milestone--critical`:""}`,d:q}))}#ct(n,u,t,d){const c=this.#e,q=f(this.#t,"g",{class:`${p}__links`});for(const W of this.#n.dependencies){const ht=String(W.from),ut=String(W.to),kt=u.tasks.get(ht),ct=u.tasks.get(ut);if(!kt||!ct||!t.has(ht)||!t.has(ut))continue;const wt=W.type?String(W.type).toUpperCase():"FS",T=wt==="FS"||wt==="FF"?kt.ef:kt.es,nt=wt==="FF"||wt==="SF"?ct.ef:ct.es,Rt=d(T),Bt=c.axisHeight+t.get(ht)*c.rowHeight+c.rowHeight/2,$t=d(nt),gt=c.axisHeight+t.get(ut)*c.rowHeight+c.rowHeight/2,Ft=c.showCritical&&kt.critical&&ct.critical,qt=Math.max(8,c.rowHeight/2),re=it({sx:Rt,sy:Bt,ex:$t,ey:gt,type:wt,elbow:qt,rowGap:c.rowHeight/2}),Jt=f(this.#t,"path",{class:`${p}__link${Ft?` ${p}__link--critical`:""}`,d:re.d});if(Jt.setAttribute("data-from",ht),Jt.setAttribute("data-to",ut),Jt.setAttribute("data-type",wt),Jt.setAttribute("data-route",re.route),Ft&&Jt.setAttribute("data-critical","true"),q.appendChild(Jt),q.appendChild(this.#h($t,gt,re.arrowDir,Ft)),W.lag){const de=f(this.#t,"text",{class:`${p}__lag`,x:B((Rt+$t)/2),y:B((Bt+gt)/2)-2});L(de,this.#b(W.lag>0?"gantt.lag":"gantt.lead",{days:W.lag})),q.appendChild(de)}}n.appendChild(q)}#h(n,u,t,d){return f(this.#t,"path",{class:`${p}__arrowhead${d?` ${p}__arrowhead--critical`:""}`,d:$(n,u,t)})}#z(n,u,t,d,c){const q=u(t);n.appendChild(f(this.#t,"line",{class:`${p}__today`,x1:q,y1:d,x2:q,y2:c,"data-today":String(t)}))}#E(n){if(this.#v.dragging||!this.#a)return;const u=this.#n.schedule;if(!u||!u.ok){this.#U();return}const t=n.target,d=t&&t.closest?t.closest(`.${p}__row`):null,c=d?d.getAttribute("data-task"):null,q=c?u.tasks.get(c):null;if(!q){this.#U();return}this.#$(d,q)}#Z(n){if(this.#v.dragging||!this.#a)return;const u=this.#n.schedule;if(!u||!u.ok)return;const t=n.target,d=t&&t.closest?t.closest(`.${p}__row`):null,c=d?d.getAttribute("data-task"):null,q=c?u.tasks.get(c):null;q&&this.#$(d,q)}#$(n,u){const t=this.#s&&this.#s.get(String(u.id))||null,d=x(this.#t,p,u,t,this.#e.tooltip,this.#et());if(!d){this.#U();return}for(const c of[...this.#a.children])c!==this.#c&&this.#a.removeChild(c);if(d.node)this.#a.appendChild(d.node);else{const c=S(this.#t,"div",`${p}__tip-card`);L(c,d.text),this.#a.appendChild(c)}this.#a.removeAttribute("hidden"),this.#a.setAttribute("data-task",u.id),this.#u&&this.#u!==n&&this.#u.removeAttribute("aria-description"),n.setAttribute("aria-description",d.text),this.#u=n,this.#Y(n)}#et(){return{t:this.#b,formatDate:n=>this.#nt(n),dateAxis:this.#e.dateAxis}}#nt(n){if(this.#e.dateAxis===!1)return this.#b("gantt.a11y.day",{day:B(n)});const u=y(this.#L(n));if(!u)return"";try{return new Intl.DateTimeFormat(this.#X(),{year:"numeric",month:"long",day:"numeric",timeZone:"UTC"}).format(u)}catch{return this.#I(n)||""}}#X(){const n=this.#n.grid,u=n&&n.messages;return u&&u.locale||void 0}#Y(n){if(!this.#a||!this.#o)return;const u=n.querySelector(`.${p}__bar`)||n.querySelector(`.${p}__milestone`)||n.querySelector(`.${p}__summary`);if(!u||typeof u.getBoundingClientRect!="function")return;const t=u.getBoundingClientRect(),d=this.#o.getBoundingClientRect(),c=this.#t.defaultView||globalThis,q=Number.isFinite(c.innerWidth)?c.innerWidth:1/0,W=Number.isFinite(c.innerHeight)?c.innerHeight:1/0,ht={left:Math.max(0,d.left),top:Math.max(0,d.top),right:Math.min(q,d.right),bottom:Math.min(W,d.bottom)};z(this.#a,this.#c,t,ht,d)}#U(){this.#a&&(this.#a.setAttribute("hidden",""),this.#u&&(this.#u.removeAttribute("aria-description"),this.#u=null))}#it(n){const u=new Map,t=new Map;for(const q of this.#n.dependencies){const W=String(q.from),ht=String(q.to);(t.get(W)||t.set(W,[]).get(W)).push(ht),(u.get(ht)||u.set(ht,[]).get(ht)).push(W)}const d=new Set([n]),c=(q,W)=>{const ht=[W];for(;ht.length;){const ut=ht.pop();for(const kt of q.get(ut)||[])d.has(kt)||(d.add(kt),ht.push(kt))}};return c(u,n),c(t,n),d}#f(n){if(!this.#r)return;this.#m();const u=this.#it(n);for(const t of this.#r.querySelectorAll(`.${p}__link`)){const d=t.getAttribute("data-from"),c=t.getAttribute("data-to");u.has(d)&&u.has(c)&&t.classList.add(`${p}__link--chain`)}for(const t of u){const d=this.#r.querySelector(`.${p}__row[data-task="${t}"]`);if(!d)continue;const c=d.querySelector(`.${p}__bar`)||d.querySelector(`.${p}__milestone`)||d.querySelector(`.${p}__summary`);if(!c)continue;const q=c.getAttribute("class")||"";q.includes(`${p}__milestone`)?c.classList.add(`${p}__milestone--chain`):q.includes(`${p}__summary`)?c.classList.add(`${p}__summary--chain`):c.classList.add(`${p}__bar--chain`)}}#m(){if(this.#r)for(const n of["__link--chain","__bar--chain","__milestone--chain","__summary--chain"])for(const u of this.#r.querySelectorAll(`.${p}${n}`))u.classList.remove(`${p}${n}`)}#W(n){if(this.#v.dragging)return;const u=n.target,t=u&&u.closest?u.closest(`.${p}__row`):null,d=t?t.getAttribute("data-task"):null;d?this.#f(d):this.#m()}#q(n,u){if(!this.#d||!n)return;if(!!!(u&&u.repeat)){if(n===this.#g)return;this.#g=n,L(this.#d,n);return}this.#g=n,L(this.#d,""),L(this.#d,n)}toSVG(){return this.#r?P(this.#r):""}async toPNG(n={}){if(!this.#r)return null;const u=this.#t.defaultView||globalThis,t=this.#r.getBoundingClientRect?this.#r.getBoundingClientRect():null,d=Math.max(1,Math.round(t&&t.width||Number(this.#r.getAttribute("width"))||st)),c=Math.max(1,Math.round(t&&t.height||Number(this.#r.getAttribute("height"))||1));let q=this.#r;u.getComputedStyle&&this.#r.cloneNode&&(q=this.#r.cloneNode(!0),K(this.#r,q,u),q.setAttribute("xmlns","http://www.w3.org/2000/svg"));const W=typeof u.XMLSerializer=="function"?new u.XMLSerializer().serializeToString(q):P(q),ht=n.scale||u.devicePixelRatio||1,ut="background"in n?n.background:"#ffffff";return N(this.#t,W,d,c,ht,ut)}destroy(){this.#x||(this.#x=!0,this.#v.destroy(),this.#O&&(this.#O.release(),this.#O=null),this.#y&&(this.#y(),this.#y=null),this.#_&&this.#_(),this.#o&&this.#o.parentNode&&this.#o.parentNode.removeChild(this.#o),this.#o=null,this.#r=null)}}function r(o,n,u={}){return new I(o,n,u)}}),ae("packages/modules/gantt/assignment-picker.js",function(m,bt){"use strict";Object.defineProperty(m,"resourceLoadOver",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(m,"pickerWarnings",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(m,"AssignmentPicker",{enumerable:!0,get:function(){return l}});const vt=bt("packages/modules/gantt/resources.js").parseAssignments,lt="lat-gantt-split";function Q(J,f,S,L,A=1){const B=J&&J.byResource?J.byResource.get(f):null;if(!B)return{load:0,capacity:A};let G=0;for(const w of B.segments)w.end>S&&w.start<L&&w.load>G&&(G=w.load);const tt=(J.overAllocations||[]).find(w=>w.resource===f&&w.end>S&&w.start<L);return{load:G,capacity:tt?tt.capacity:B.capacity}}function rt(J,f){const S=new Map;for(const L of J&&J.overAllocations||[]){if(!L.taskIds.includes(f))continue;const A=S.get(L.resource);(!A||L.load>A.load)&&S.set(L.resource,{resource:L.resource,load:L.load,capacity:L.capacity})}return[...S.values()]}const M=J=>Math.round(J*100);function at(J,f,S,L){const A=J.createElement(f);return S&&A.setAttribute("class",`${lt}__${S}`),L!=null&&(A.textContent=L),A}class l{#n;#i;#t;#e;#o;#r;#a=new Map;#c=[];#u=0;#s="";#d=null;#g=null;#S=null;#y=null;#_=null;#x=null;constructor(f,S,L,A,B,G){this.#n=f,this.#i=S,this.#t=L,this.#e=String(A),this.#o=B,this.#r=G,this.#A=B}#A;#C(){const f=this.#n.schedule;return f&&f.ok&&f.tasks.get(this.#e)||null}open(){const f=this.#i,S=this.#n.taskById(this.#e)||{};for(const it of vt(S))this.#a.set(it.resource,it.units);const L=new Set(this.#a.keys());for(const it of this.#n.resourceModels.keys())L.add(it);const A=this.#n.resources();for(const it of A.resources)L.add(it.resource);this.#c=[...L].sort((it,$)=>it.localeCompare($));const B=this.#C(),G=at(f,"div","picker");G.setAttribute("role","dialog"),G.setAttribute("aria-label",this.#t("gantt.picker.title",{name:B?B.name:this.#e}));const tt=at(f,"input","picker-search");tt.setAttribute("type","search"),tt.setAttribute("role","combobox"),tt.setAttribute("aria-expanded","true"),tt.setAttribute("aria-autocomplete","list"),tt.setAttribute("aria-label",this.#t("gantt.picker.search")),this.#g=tt;const w=at(f,"div","picker-list");w.setAttribute("role","listbox"),w.setAttribute("aria-multiselectable","true"),w.setAttribute("aria-label",this.#t("gantt.picker.list")),w.setAttribute("id",`${lt}-picker-list-${this.#e}`),w.setAttribute("tabindex","-1"),tt.setAttribute("aria-controls",w.getAttribute("id")),this.#S=w;const g=at(f,"div","picker-chosen");g.setAttribute("role","group"),g.setAttribute("aria-label",this.#t("gantt.picker.selected")),this.#y=g;const y=at(f,"div","picker-warn");y.setAttribute("role","status"),y.setAttribute("aria-live","polite"),y.setAttribute("aria-atomic","true"),this.#_=y;const H=at(f,"div","picker-actions"),F=at(f,"button","picker-apply",this.#t("gantt.picker.apply"));F.setAttribute("type","button"),F.addEventListener("click",()=>this.#j());const et=at(f,"button","picker-cancel",this.#t("gantt.picker.cancel"));et.setAttribute("type","button"),et.addEventListener("click",()=>this.close()),H.append(F,et),G.append(tt,w,g,y,H),G.addEventListener("keydown",it=>this.#O(it)),tt.addEventListener("input",()=>{this.#s=tt.value,this.#u=0,this.#b()}),this.#d=G,(f.body||f.documentElement).appendChild(G),this.#x=it=>{this.#d&&!this.#d.contains(it.target)&&this.close()},f.addEventListener("pointerdown",this.#x,!0),this.#b(),tt.focus()}#F(){const f=this.#d;if(!f)return;const S=this.#i.defaultView,L=S&&S.innerWidth||this.#i.documentElement.clientWidth,A=S&&S.innerHeight||this.#i.documentElement.clientHeight,B=4,G=this.#A.getBoundingClientRect();f.style.maxHeight=`${Math.max(120,Math.min(420,A-2*B))}px`;const tt=f.offsetWidth,w=f.offsetHeight;let g=Math.round(G.left);g=Math.max(B,Math.min(g,L-tt-B));let y=Math.round(G.bottom+2);if(y+w>A-B){const H=Math.round(G.top-2-w);y=H>=B?H:Math.max(B,A-w-B)}f.style.left=`${g}px`,f.style.top=`${y}px`}#T(){const f=this.#s.trim().toLowerCase();return f?this.#c.filter(S=>S.toLowerCase().includes(f)):this.#c}#v(){return[...this.#a].map(([f,S])=>({resource:f,units:S}))}#b(){const f=this.#i,S=this.#C(),L=S?S.es:0,A=S?S.ef:0,B=this.#v(),G=this.#n.previewAssignments(this.#e,B),tt=this.#n.resourceModels,w=this.#S;for(;w.firstChild;)w.removeChild(w.firstChild);const g=this.#T();if(this.#u>=g.length&&(this.#u=Math.max(0,g.length-1)),g.forEach((F,et)=>{const{load:it,capacity:$}=Q(G,F,L,A,tt.has(F)?tt.get(F).capacityUnits:1),Y=this.#a.has(F),R=it>$+1e-9,dt=at(f,"div",`picker-option${R?` ${lt}__picker-option--over`:""}`);dt.setAttribute("role","option"),dt.setAttribute("id",`${lt}-picker-opt-${this.#e}-${et}`),dt.setAttribute("aria-selected",Y?"true":"false"),dt.setAttribute("data-resource",F),dt.setAttribute("data-load",String(it)),dt.setAttribute("data-capacity",String($)),et===this.#u&&dt.setAttribute("data-active","true"),dt.textContent=`${F} — ${this.#t("gantt.picker.load",{load:M(it),capacity:M($)})}`,dt.addEventListener("click",()=>{this.#u=et,this.#P(F)}),w.appendChild(dt)}),!g.length){const F=at(f,"div","picker-none",this.#t("gantt.picker.none"));F.setAttribute("role","presentation"),w.appendChild(F)}this.#g&&(g.length?this.#g.setAttribute("aria-activedescendant",`${lt}-picker-opt-${this.#e}-${this.#u}`):this.#g.removeAttribute("aria-activedescendant"));const y=this.#y,H=f.activeElement&&y.contains(f.activeElement)?f.activeElement.getAttribute("data-for"):null;for(;y.firstChild;)y.removeChild(y.firstChild);for(const[F,et]of this.#a){const it=at(f,"div","picker-row");it.setAttribute("data-resource",F),it.appendChild(at(f,"span","picker-row-name",F));const $=at(f,"input","picker-units");$.setAttribute("type","number"),$.setAttribute("min","0"),$.setAttribute("max","1000"),$.setAttribute("step","5"),$.setAttribute("aria-label",this.#t("gantt.picker.units",{name:F})),$.setAttribute("data-for",F),$.value=String(M(et)),$.addEventListener("input",()=>{const R=Number($.value);$.value===""||!Number.isFinite(R)||R<0||(this.#a.set(F,R/100),this.#D())});const Y=at(f,"button","picker-remove","×");Y.setAttribute("type","button"),Y.setAttribute("aria-label",this.#t("gantt.picker.remove",{name:F})),Y.addEventListener("click",()=>{this.#a.delete(F),this.#b(),this.#g&&this.#g.focus()}),it.append($,Y),y.appendChild(it),H===F&&$.focus()}this.#M(G,B)}#D(){const f=this.#C(),S=f?f.es:0,L=f?f.ef:0,A=this.#v(),B=this.#n.previewAssignments(this.#e,A),G=this.#n.resourceModels;for(const tt of this.#S.querySelectorAll('[role="option"]')){const w=tt.getAttribute("data-resource"),{load:g,capacity:y}=Q(B,w,S,L,G.has(w)?G.get(w).capacityUnits:1);tt.setAttribute("data-load",String(g)),tt.setAttribute("data-capacity",String(y)),tt.textContent=`${w} — ${this.#t("gantt.picker.load",{load:M(g),capacity:M(y)})}`,tt.setAttribute("class",`${lt}__picker-option${g>y+1e-9?` ${lt}__picker-option--over`:""}`)}this.#M(B,A)}#M(f,S){const L=rt(f,this.#e),A=this.#_;A.setAttribute("data-over",L.length?"true":"false"),A.setAttribute("class",`${lt}__picker-warn${L.length?` ${lt}__picker-warn--over`:""}`),A.textContent=L.length?L.map(B=>this.#t("gantt.picker.warn",{name:B.resource,load:M(B.load),capacity:M(B.capacity)})).join(". "):S.length?this.#t("gantt.picker.ok"):"",this.#F()}#P(f){this.#a.has(f)?this.#a.delete(f):this.#a.set(f,1),this.#b(),this.#g&&this.#g.focus()}#O(f){const S=this.#T(),L=f.target instanceof Element&&f.target.classList.contains(`${lt}__picker-units`);if(f.key==="Escape"){f.preventDefault(),f.stopPropagation(),this.close();return}if(f.key==="Tab"&&this.#d){const A=[...this.#d.querySelectorAll("input, button")].filter(tt=>!tt.disabled),B=A[0],G=A[A.length-1];f.shiftKey&&this.#i.activeElement===B?(f.preventDefault(),G.focus()):!f.shiftKey&&this.#i.activeElement===G&&(f.preventDefault(),B.focus());return}if(L){f.key==="Enter"&&(f.preventDefault(),this.#j());return}if(!(f.target instanceof Element&&f.target.tagName==="BUTTON")){if(f.key==="ArrowDown"||f.key==="ArrowUp"){if(f.preventDefault(),!S.length)return;this.#u=(this.#u+(f.key==="ArrowDown"?1:-1)+S.length)%S.length,this.#b()}else if(f.key==="Home"||f.key==="End"){if(f.target===this.#g&&this.#s)return;f.preventDefault(),this.#u=f.key==="Home"?0:Math.max(0,S.length-1),this.#b()}else if((f.key==="Enter"||f.key===" ")&&S.length){if(f.key===" "&&this.#s)return;f.preventDefault(),this.#P(S[this.#u])}}}#j(){const f=vt(this.#n.taskById(this.#e)||{}),S=this.#v();f.length===S.length&&f.every(A=>this.#a.has(A.resource)&&Math.abs(this.#a.get(A.resource)-A.units)<1e-9)||this.#n.applyEdit({id:this.#e,assignments:S},{writeBack:!0}),this.close()}close(){if(!this.#d)return;this.#x&&this.#i.removeEventListener("pointerdown",this.#x,!0),this.#d.remove(),this.#d=null;const f=this.#o;this.#r();const S=f&&f.isConnected?f:this.#i.querySelector(`[data-picker-for="${this.#e}"]`);S&&S.focus&&S.focus()}get element(){return this.#d}}}),ae("packages/modules/gantt/split.js",function(m,bt){"use strict";Object.defineProperty(m,"SPLIT_NS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(m,"GanttSplitView",{enumerable:!0,get:function(){return de}}),Object.defineProperty(m,"mountGanttSplit",{enumerable:!0,get:function(){return ie}});const vt=bt("packages/modules/shared/axislabels.js").thinLabels,lt=bt("packages/modules/charts/svg.js"),Q=lt.svg,rt=lt.el,M=lt.setText,at=lt.path,l=lt.round,f=bt("packages/modules/charts/scale.js").linearScale,S=bt("packages/modules/gantt/time.js"),L=S.fromDayNumber,A=S.toISODate,B=S.toDayNumber,tt=bt("packages/modules/gantt/calendar.js").createCalendar,w=bt("packages/modules/gantt/links.js"),g=w.routeLink,y=w.arrowheadPath,F=bt("packages/modules/gantt/messages.js").createTranslator,it=bt("packages/modules/gantt/resources.js").parseAssignments,$=bt("packages/modules/gantt/gestures.js"),Y=$.GanttGestures,R=$.describeTask,pt=bt("packages/modules/gantt/assignment-picker.js").AssignmentPicker,xt=bt("packages/modules/gantt/workload.js"),ot=xt.WORKLOAD_DEFAULTS,_t=xt.HISTOGRAM_DEFAULTS,D=xt.computeWorkload,K=xt.workloadBuckets,N=xt.formatHours,b=xt.formatPercent,x=xt.formatCost,z=xt.statedHours,X=xt.taskContour,p=xt.setContourBucket,St=xt.serializeContour,st=xt.spreadHours,At=xt.recordWorkingDays,It=bt("packages/core/src/internal/util.js").warnOnce,a=bt("packages/modules/gantt/export.js"),h=a.buildSplitSVG,k=a.buildPrintDocument,_=a.rasterizePNG,j=a.openPrintWindow,P=bt("packages/modules/gantt/tooltip.js"),I=P.resolveTaskTooltip,r=P.positionTooltip,o=P.tooltipCss,n=60,u=.5,t="lat-gantt-split",d="data-lat-gantt-split-styles",c=Object.freeze({height:420,rowHeight:34,headerHeight:44,gridWidth:620,indent:16,zoom:"day",today:null,nonWorking:null,calendar:null,showArrows:!0,showProgress:!0,showBaseline:!0,barLabel:"name",columns:null,progressLine:null,hoverChain:!0,editable:!0,keyboard:!0,resizeZone:6,tooltip:!0,workload:null,histogram:null}),q=11,W=Object.freeze(new Set(["hours","percent","cost"])),ht=Object.freeze({hours:"percent",percent:"cost",cost:"hours"}),ut=Object.freeze({day:{px:26,step:1,level:"day"},week:{px:12,step:7,level:"week"},month:{px:4,step:30,level:"month"},quarter:{px:1.8,step:91,level:"quarter"}}),kt=["S","M","T","W","T","F","S"],ct=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],T=new Set(["start","end","duration"]),nt=new Set(["effort","units"]);function Rt(O,e,i){return i-e<=1e-9?O>=i?1:0:O<=e?0:O>=i?1:(O-e)/(i-e)}const Bt=["#4a90d9","#e2513b","#2c9c6a","#8b5cf6","#d97706","#0891b2","#be185d"];function $t(){const O=t;return`
|
|
79
|
-
.${
|
|
80
|
-
.${
|
|
81
|
-
.${
|
|
82
|
-
.${
|
|
83
|
-
.${
|
|
84
|
-
.${
|
|
85
|
-
.${
|
|
86
|
-
.${
|
|
87
|
-
.${
|
|
75
|
+
@scope ([data-theme="dark"]){:scope.${m},.${m}{color-scheme:dark}}
|
|
76
|
+
@scope ([data-theme="light"],[data-theme="auto"]){:scope.${m},.${m}{color-scheme:light}}
|
|
77
|
+
@media (prefers-color-scheme:dark){@scope ([data-theme="auto"]){:scope.${m},.${m}{color-scheme:dark}}}
|
|
78
|
+
`.trim()}function g(o){const e=o.documentElement;if(!e||e.getAttribute(St))return;e.setAttribute(St,"1");const d=o.createElement("style");d.textContent=l(),(o.head||o.body||e).appendChild(d)}function v(o,e=0){return o==="weekends"?d=>{const t=w(d+e),h=t?t.getUTCDay():0;return h===0||h===6}:typeof o=="function"?o:null}function C(o){return String(o??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function E(o){const e=o.attributes;if(!e)return[];if(e instanceof Map)return[...e.entries()];const d=[];for(let t=0;t<e.length;t+=1)d.push([e[t].name,e[t].value]);return d}function O(o){const e=o.tagName?o.tagName.toLowerCase():null;if(!e)return"";const d=E(o).map(([u,q])=>` ${u}="${C(q)}"`).join(""),t=o.children||[];if(t.length)return`<${e}${d}>${[...t].map(O).join("")}</${e}>`;const h=o.textContent?C(o.textContent):"";return h?`<${e}${d}>${h}</${e}>`:`<${e}${d}></${e}>`}class I{#n;#s;#t;#e;#i=null;#r=null;#a=null;#c=null;#u=null;#o=null;#d=null;#g="";#_=null;#y=null;#S=null;#x=!1;#A=1;#C=null;#I=null;#T=null;#v;#b;#M=0;#D=null;#P=st;#O=null;#j=8;constructor(e,d,t={}){this.#n=e,this.#s=d,this.#t=d.ownerDocument,this.#e={...At,...t},this.#M=F(this.#e.projectEpoch),this.#D=this.#et(this.#e.today),this.#k(t),this.#P=Number.isFinite(this.#e.width)?Number(this.#e.width):st,g(this.#t),this.#i=x(this.#t,"div",m),this.#s.appendChild(this.#i),this.#e.tooltip&&(this.#a=x(this.#t,"div",`${m}__tooltip`),this.#a.setAttribute("hidden",""),this.#c=x(this.#t,"div",`${m}__tip-arrow`),this.#a.appendChild(this.#c),this.#i.appendChild(this.#a),this.#i.addEventListener("scroll",()=>this.#U())),this.#d=x(this.#t,"div",`${m}__live`),this.#d.setAttribute("role","status"),this.#d.setAttribute("aria-live","polite"),this.#i.appendChild(this.#d),this.#b=mt(e,()=>this.#e.messages),this.#v=new at({doc:this.#t,controller:e,options:()=>this.#e,plot:()=>this.#r,rowOf:h=>h&&h.closest?h.closest(`.${m}__row`):null,barOf:h=>h.querySelector(`.${m}__bar`)||h.querySelector(`.${m}__milestone`),pxPerDay:()=>this.#A,announce:h=>this.#K(h,{repeat:!0}),t:(h,u)=>this.#b(h,u),iso:h=>this.#z(h),redraw:()=>this.draw(),focusTask:h=>{this.#_=h},editing:()=>!1}),this.#N(),this.#S=e.on("schedule",()=>this.draw()),this.draw()}#N(){this.#e.width==="container"&&(this.#Y(this.#e.zoom)||(this.#O=N({targets:[this.#i,this.#s],read:()=>rt([this.#i,this.#s],tt),apply:e=>{this.#P=e,this.#r&&this.draw()}})))}#k(e){!e||!Number.isFinite(e.width)||this.#Y(this.#e.zoom)&&$t(`gantt.zoomWidth:${String(this.#e.zoom)}`,`[lattice] gantt: mount was given both zoom (${JSON.stringify(this.#e.zoom)}) and width (${e.width}); zoom fixes the pixels-per-day, so the width is ignored and the plot scrolls. Drop one of the two.`)}#et(e){if(e==null||e==="")return null;if(Number.isFinite(e))return Number(e);const d=H(e);return Number.isFinite(d)?d-this.#M:($t(`gantt.today:${String(e)}`,`[lattice] gantt: today ${JSON.stringify(e)} is not a date or a day number; no today line is drawn.`),null)}#R(e){return e+this.#M}#z(e){return b(this.#R(e))}get element(){return this.#i}get options(){return{...this.#e}}draw(){if(this.#x)return;const e=this.#n.schedule;if(!e||!e.ok)return;const d=this.#e,t=e.order,h=d.rowLabels?d.labelWidth:0,u=this.#X(e),q=d.axisHeight+u.count*d.rowHeight,U=e.projectStart,gt=e.projectFinish,ht=this.#D,kt=[U,gt];Number.isFinite(ht)&&kt.push(ht);const dt=Math.min(...kt),wt=Math.max(...kt),P=Math.max(1,(wt-dt)*.04),ot=dt-P,Lt=wt+P,Bt=this.#Y(d.zoom),_t=this.#P,bt=Bt?Math.max(1,(Lt-ot)*Bt.px):Math.max(1,_t-h-d.rightPadding),Ft=Bt?h+bt+d.rightPadding:_t,Jt=et({min:ot,max:Lt},[0,bt]);this.#A=Jt.of(1)-Jt.of(0),this.#C=Bt?Bt.step:null,this.#j=this.#e.width==="container"?Math.max(2,Math.min(8,Math.floor(bt/(this.#e.dateAxis?78:44)))):8,this.#I=Bt?Bt.level:null,this.#T=Number.isFinite(ht)?B(h+Jt.of(ht)):null;const ie=Zt=>B(h+Jt.of(Zt)),te=p(this.#t,"svg",{class:`${m}__plot`,width:Ft,height:q,viewBox:`0 0 ${Ft} ${q}`,preserveAspectRatio:"xMinYMin meet",role:"img","aria-label":"Gantt chart"}),de=u.rowIndexById,re=this.#nt(e),ne=new Set(this.#n.findViolations().map(Zt=>Zt.id)),Dt=new Set((e.conflicts||[]).map(Zt=>Zt.id));if(this.#o=d.tooltip?new Map(this.#n.tasks.map(Zt=>[String(this.#n.readId(Zt)),Zt])):null,this.#rt(te,Jt,ie,dt,wt,h,d.axisHeight,q),this.#l(te,Jt,ie,q),this.#dt(te,e,u,re,ie,ne,Dt),d.showArrows&&this.#ft(te,e,de,ie),Number.isFinite(ht)&&this.#G(te,ie,ht,d.axisHeight,q),d.editable&&te.addEventListener("pointerdown",Zt=>this.#v.onPointerDown(Zt)),d.tooltip&&(te.addEventListener("pointermove",Zt=>this.#E(Zt)),te.addEventListener("pointerleave",()=>this.#U()),te.addEventListener("focus",Zt=>this.#V(Zt),!0),te.addEventListener("blur",()=>this.#U(),!0),te.addEventListener("keydown",Zt=>{Zt.key==="Escape"&&this.#U()})),d.keyboard&&(te.addEventListener("keydown",Zt=>this.#v.onKey(Zt)),te.addEventListener("keydown",Zt=>this.#v.onHistoryKey(Zt))),d.showArrows&&d.hoverChain&&(te.addEventListener("pointerover",Zt=>this.#B(Zt)),te.addEventListener("pointerleave",()=>this.#m())),this.#r&&this.#i.removeChild(this.#r),this.#i.appendChild(te),this.#r=te,d.scrollToToday&&this.scrollToToday(),this.#_){const Zt=te.querySelector(`.${m}__row[data-task="${this.#_}"]`);Zt&&Zt.focus&&Zt.focus()}}#Y(e){return Number.isFinite(e)?{px:Number(e),step:1,level:"custom"}:typeof e=="string"&&It[e]?It[e]:null}linkVerticalScroll(e){if(this.#y&&(this.#y(),this.#y=null),!e||!this.#i||!e.addEventListener)return()=>{};const d=this.#i,t=e;let h=!1;const u=(ht,kt)=>{h||(h=!0,kt.scrollTop=ht.scrollTop,h=!1)},q=()=>u(d,t),U=()=>u(t,d);d.addEventListener("scroll",q),t.addEventListener("scroll",U);const gt=()=>{d.removeEventListener("scroll",q),t.removeEventListener("scroll",U)};return this.#y=gt,gt}scrollToToday(){if(this.#T==null||!this.#i)return;const e=this.#e.rowLabels?this.#e.labelWidth:0;this.#i.scrollLeft=Math.max(0,this.#T-e-40)}#X(e){const d=e.order,t=new Map;if(!this.#e.groupBy){const ht=d.map(kt=>({kind:"task",id:kt}));return d.forEach((kt,dt)=>t.set(kt,dt)),{rows:ht,rowIndexById:t,count:ht.length}}const h=new Map(this.#n.tasks.map(ht=>[String(this.#n.readId(ht)),ht])),u=this.#e.groupBy,q=ht=>{const kt=h.get(ht)||{},dt=typeof u=="function"?u(kt):kt[u];return dt==null||dt===""?"Ungrouped":String(dt)},U=new Map;for(const ht of d){const kt=q(ht);U.has(kt)||U.set(kt,[]),U.get(kt).push(ht)}const gt=[];for(const[ht,kt]of U){gt.push({kind:"header",key:ht});for(const dt of kt)gt.push({kind:"task",id:dt})}return gt.forEach((ht,kt)=>{ht.kind==="task"&&t.set(ht.id,kt)}),{rows:gt,rowIndexById:t,count:gt.length}}#nt(e){const d=new Map;for(const t of e.order){let h=0,u=e.tasks.get(t).parent;for(;u!=null&&e.tasks.has(u);)h+=1,u=e.tasks.get(u).parent;d.set(t,h)}return d}#rt(e,d,t,h,u,q,U,gt){const ht=v(this.#e.nonWorking,this.#M);if(!ht)return;const kt=Math.floor(h),dt=Math.ceil(u);if(dt-kt>3660)return;const wt=p(this.#t,"g",{class:`${m}__shading`});for(let P=kt;P<dt;P+=1){if(!ht(P))continue;const ot=Math.max(q,t(P)),Lt=t(P+1);wt.appendChild(p(this.#t,"rect",{class:`${m}__shade`,"data-day":String(P),x:ot,y:U,width:B(Math.max(0,Lt-ot)),height:gt-U}))}e.appendChild(wt)}#l(e,d,t,h){const u=p(this.#t,"g",{class:`${m}__axis`}),q=this.#e.axisHeight,U=this.#H(d);for(const kt of U){const dt=t(kt);u.appendChild(p(this.#t,"line",{class:`${m}__gridline`,x1:dt,y1:q,x2:dt,y2:h}))}const gt=U.map(kt=>({at:t(kt),text:this.#ut(kt)})),{kept:ht}=this.#C?c(gt,{fontSize:Ut}):{kept:gt};for(const kt of ht){const dt=p(this.#t,"text",{class:`${m}__tick`,x:kt.at+2,y:q-6});L(dt,kt.text),u.appendChild(dt)}e.appendChild(u)}#H(e){if(!this.#C)return e.ticks(this.#j);const{min:d,max:t}=e.domain,h=this.#C,u=[];for(let q=Math.ceil(d/h)*h;q<=t;q+=h)u.push(q);return u.length?u:e.ticks(this.#j)}#ut(e){if(!this.#e.dateAxis)return String(B(e));const d=this.#z(Math.round(e));return d?this.#I==="month"||this.#I==="quarter"?d.slice(0,7):d:String(B(e))}#dt(e,d,t,h,u,q,U){const gt=this.#e,ht=p(this.#t,"g",{class:`${m}__rows`});t.rows.forEach((kt,dt)=>{const wt=gt.axisHeight+dt*gt.rowHeight;if(kt.kind==="header"){this.#ht(ht,kt.key,wt,gt.rowHeight);return}const P=kt.id,ot=d.tasks.get(P),Lt=wt+gt.barPadding,Bt=gt.rowHeight-2*gt.barPadding,_t=wt+gt.rowHeight/2,bt=gt.showCritical&&ot.critical,Ft=q.has(P),Jt=U.has(P),ie=ot.percentComplete==null||ot.percentComplete<100,te=Number.isFinite(this.#D)&&ie&&!ot.isSummary&&ot.ef<this.#D,de=ot.totalFloat<-R,re=p(this.#t,"g",{class:`${m}__row`});if(re.setAttribute("data-task",P),re.setAttribute("tabindex",gt.keyboard?"0":"-1"),re.setAttribute("role",ot.isSummary?"group":"button"),re.setAttribute("aria-label",xt(ot,{dateAxis:gt.dateAxis,iso:ne=>this.#z(ne)})),bt&&re.setAttribute("data-critical","true"),Ft&&re.setAttribute("data-violation","true"),te&&re.setAttribute("data-overdue","true"),de&&re.setAttribute("data-atrisk","true"),gt.rowLabels){const ne=p(this.#t,"text",{class:`${m}__rowlabel${ot.isSummary?` ${m}__rowlabel--summary`:""}`,x:6+(h.get(P)||0)*12,y:_t,"dominant-baseline":"middle"});L(ne,ot.name),re.appendChild(ne)}if(ot.isMilestone)this.#Z(re,u(ot.es),_t,Bt/2,bt);else{const ne=u(ot.es),Dt=Math.max(1,u(ot.ef)-ne),Zt=ot.isSummary?`${m}__summary`:`${m}__bar${bt?` ${m}__bar--critical`:""}${Ft?` ${m}__bar--violation`:""}${Jt?` ${m}__bar--conflict`:""}${te?` ${m}__bar--overdue`:""}${de?` ${m}__bar--atrisk`:""}`;re.appendChild(p(this.#t,"rect",{class:Zt,x:ne,y:Lt,width:B(Dt),height:Bt,rx:3})),gt.showProgress&&ot.percentComplete!=null&&ot.percentComplete>0&&re.appendChild(p(this.#t,"rect",{class:`${m}__progress`,x:ne,y:Lt,width:B(Dt*Math.min(1,ot.percentComplete/100)),height:Bt,rx:3}));const qt=this.#W(ot);if(qt){const pe=p(this.#t,"text",{class:`${m}__label`,x:B(ne+Dt+4),y:_t});L(pe,qt),re.appendChild(pe)}}ht.appendChild(re)}),e.appendChild(ht)}#ht(e,d,t,h){const u=p(this.#t,"g",{class:`${m}__lane`});u.setAttribute("data-group",d),u.appendChild(p(this.#t,"rect",{class:`${m}__lane-band`,x:0,y:t,width:"100%",height:h}));const q=p(this.#t,"text",{class:`${m}__lane-label`,x:6,y:t+h/2,"dominant-baseline":"middle"});L(q,d),u.appendChild(q),e.appendChild(u)}#W(e){const d=this.#e.label;if(typeof d=="function")return String(d(e)??"");switch(d){case"none":return"";case"percent":return e.percentComplete==null?"":`${Math.round(e.percentComplete)}%`;case"dates":return this.#e.dateAxis?`${this.#z(e.es)} – ${this.#z(e.ef)}`:`${B(e.es)} – ${B(e.ef)}`;default:return e.name}}#Z(e,d,t,h,u){const q=M(["M",B(d-h),B(t),"L",B(d),B(t-h),"L",B(d+h),B(t),"L",B(d),B(t+h),"Z"]);e.appendChild(p(this.#t,"path",{class:`${m}__milestone${u?` ${m}__milestone--critical`:""}`,d:q}))}#ft(e,d,t,h){const u=this.#e,q=p(this.#t,"g",{class:`${m}__links`});for(const U of this.#n.dependencies){const gt=String(U.from),ht=String(U.to),kt=d.tasks.get(gt),dt=d.tasks.get(ht);if(!kt||!dt||!t.has(gt)||!t.has(ht))continue;const wt=U.type?String(U.type).toUpperCase():"FS",P=wt==="FS"||wt==="FF"?kt.ef:kt.es,ot=wt==="FF"||wt==="SF"?dt.ef:dt.es,Lt=h(P),Bt=u.axisHeight+t.get(gt)*u.rowHeight+u.rowHeight/2,_t=h(ot),bt=u.axisHeight+t.get(ht)*u.rowHeight+u.rowHeight/2,Ft=u.showCritical&&kt.critical&&dt.critical,Jt=Math.max(8,u.rowHeight/2),ie=it({sx:Lt,sy:Bt,ex:_t,ey:bt,type:wt,elbow:Jt,rowGap:u.rowHeight/2}),te=p(this.#t,"path",{class:`${m}__link${Ft?` ${m}__link--critical`:""}`,d:ie.d});if(te.setAttribute("data-from",gt),te.setAttribute("data-to",ht),te.setAttribute("data-type",wt),te.setAttribute("data-route",ie.route),Ft&&te.setAttribute("data-critical","true"),q.appendChild(te),q.appendChild(this.#f(_t,bt,ie.arrowDir,Ft)),U.lag){const de=p(this.#t,"text",{class:`${m}__lag`,x:B((Lt+_t)/2),y:B((Bt+bt)/2)-2});L(de,this.#b(U.lag>0?"gantt.lag":"gantt.lead",{days:U.lag})),q.appendChild(de)}}e.appendChild(q)}#f(e,d,t,h){return p(this.#t,"path",{class:`${m}__arrowhead${h?` ${m}__arrowhead--critical`:""}`,d:_(e,d,t)})}#G(e,d,t,h,u){const q=d(t);e.appendChild(p(this.#t,"line",{class:`${m}__today`,x1:q,y1:h,x2:q,y2:u,"data-today":String(t)}))}#E(e){if(this.#v.dragging||!this.#a)return;const d=this.#n.schedule;if(!d||!d.ok){this.#U();return}const t=e.target,h=t&&t.closest?t.closest(`.${m}__row`):null,u=h?h.getAttribute("data-task"):null,q=u?d.tasks.get(u):null;if(!q){this.#U();return}this.#$(h,q)}#V(e){if(this.#v.dragging||!this.#a)return;const d=this.#n.schedule;if(!d||!d.ok)return;const t=e.target,h=t&&t.closest?t.closest(`.${m}__row`):null,u=h?h.getAttribute("data-task"):null,q=u?d.tasks.get(u):null;q&&this.#$(h,q)}#$(e,d){const t=this.#o&&this.#o.get(String(d.id))||null,h=A(this.#t,m,d,t,this.#e.tooltip,this.#it());if(!h){this.#U();return}for(const u of[...this.#a.children])u!==this.#c&&this.#a.removeChild(u);if(h.node)this.#a.appendChild(h.node);else{const u=x(this.#t,"div",`${m}__tip-card`);L(u,h.text),this.#a.appendChild(u)}this.#a.removeAttribute("hidden"),this.#a.setAttribute("data-task",d.id),this.#u&&this.#u!==e&&this.#u.removeAttribute("aria-description"),e.setAttribute("aria-description",h.text),this.#u=e,this.#q(e)}#it(){return{t:this.#b,formatDate:e=>this.#st(e),dateAxis:this.#e.dateAxis}}#st(e){if(this.#e.dateAxis===!1)return this.#b("gantt.a11y.day",{day:B(e)});const d=w(this.#R(e));if(!d)return"";try{return new Intl.DateTimeFormat(this.#J(),{year:"numeric",month:"long",day:"numeric",timeZone:"UTC"}).format(d)}catch{return this.#z(e)||""}}#J(){const e=this.#n.grid,d=e&&e.messages;return d&&d.locale||void 0}#q(e){if(!this.#a||!this.#i)return;const d=e.querySelector(`.${m}__bar`)||e.querySelector(`.${m}__milestone`)||e.querySelector(`.${m}__summary`);if(!d||typeof d.getBoundingClientRect!="function")return;const t=d.getBoundingClientRect(),h=this.#i.getBoundingClientRect(),u=this.#t.defaultView||globalThis,q=Number.isFinite(u.innerWidth)?u.innerWidth:1/0,U=Number.isFinite(u.innerHeight)?u.innerHeight:1/0,gt={left:Math.max(0,h.left),top:Math.max(0,h.top),right:Math.min(q,h.right),bottom:Math.min(U,h.bottom)};W(this.#a,this.#c,t,gt,h)}#U(){this.#a&&(this.#a.setAttribute("hidden",""),this.#u&&(this.#u.removeAttribute("aria-description"),this.#u=null))}#at(e){const d=new Map,t=new Map;for(const q of this.#n.dependencies){const U=String(q.from),gt=String(q.to);(t.get(U)||t.set(U,[]).get(U)).push(gt),(d.get(gt)||d.set(gt,[]).get(gt)).push(U)}const h=new Set([e]),u=(q,U)=>{const gt=[U];for(;gt.length;){const ht=gt.pop();for(const kt of q.get(ht)||[])h.has(kt)||(h.add(kt),gt.push(kt))}};return u(d,e),u(t,e),h}#h(e){if(!this.#r)return;this.#m();const d=this.#at(e);for(const t of this.#r.querySelectorAll(`.${m}__link`)){const h=t.getAttribute("data-from"),u=t.getAttribute("data-to");d.has(h)&&d.has(u)&&t.classList.add(`${m}__link--chain`)}for(const t of d){const h=this.#r.querySelector(`.${m}__row[data-task="${t}"]`);if(!h)continue;const u=h.querySelector(`.${m}__bar`)||h.querySelector(`.${m}__milestone`)||h.querySelector(`.${m}__summary`);if(!u)continue;const q=u.getAttribute("class")||"";q.includes(`${m}__milestone`)?u.classList.add(`${m}__milestone--chain`):q.includes(`${m}__summary`)?u.classList.add(`${m}__summary--chain`):u.classList.add(`${m}__bar--chain`)}}#m(){if(this.#r)for(const e of["__link--chain","__bar--chain","__milestone--chain","__summary--chain"])for(const d of this.#r.querySelectorAll(`.${m}${e}`))d.classList.remove(`${m}${e}`)}#B(e){if(this.#v.dragging)return;const d=e.target,t=d&&d.closest?d.closest(`.${m}__row`):null,h=t?t.getAttribute("data-task"):null;h?this.#h(h):this.#m()}#K(e,d){if(!this.#d||!e)return;if(!!!(d&&d.repeat)){if(e===this.#g)return;this.#g=e,L(this.#d,e);return}this.#g=e,L(this.#d,""),L(this.#d,e)}toSVG(){return this.#r?O(this.#r):""}async toPNG(e={}){if(!this.#r)return null;const d=this.#t.defaultView||globalThis,t=this.#r.getBoundingClientRect?this.#r.getBoundingClientRect():null,h=Math.max(1,Math.round(t&&t.width||Number(this.#r.getAttribute("width"))||st)),u=Math.max(1,Math.round(t&&t.height||Number(this.#r.getAttribute("height"))||1));let q=this.#r;d.getComputedStyle&&this.#r.cloneNode&&(q=this.#r.cloneNode(!0),X(this.#r,q,d),q.setAttribute("xmlns","http://www.w3.org/2000/svg"));const U=typeof d.XMLSerializer=="function"?new d.XMLSerializer().serializeToString(q):O(q),gt=e.scale||d.devicePixelRatio||1,ht="background"in e?e.background:"#ffffff";return T(this.#t,U,h,u,gt,ht)}destroy(){this.#x||(this.#x=!0,this.#v.destroy(),this.#O&&(this.#O.release(),this.#O=null),this.#y&&(this.#y(),this.#y=null),this.#S&&this.#S(),this.#i&&this.#i.parentNode&&this.#i.parentNode.removeChild(this.#i),this.#i=null,this.#r=null)}}function i(o,e,d={}){return new I(o,e,d)}}),se("packages/modules/gantt/assignment-picker.js",function(y,yt){"use strict";Object.defineProperty(y,"resourceLoadOver",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(y,"pickerWarnings",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(y,"AssignmentPicker",{enumerable:!0,get:function(){return c}});const $t=yt("packages/modules/gantt/resources.js").parseAssignments,ct="lat-gantt-split";function tt(J,p,x,L,M=1){const B=J&&J.byResource?J.byResource.get(p):null;if(!B)return{load:0,capacity:M};let G=0;for(const $ of B.segments)$.end>x&&$.start<L&&$.load>G&&(G=$.load);const et=(J.overAllocations||[]).find($=>$.resource===p&&$.end>x&&$.start<L);return{load:G,capacity:et?et.capacity:B.capacity}}function rt(J,p){const x=new Map;for(const L of J&&J.overAllocations||[]){if(!L.taskIds.includes(p))continue;const M=x.get(L.resource);(!M||L.load>M.load)&&x.set(L.resource,{resource:L.resource,load:L.load,capacity:L.capacity})}return[...x.values()]}const N=J=>Math.round(J*100);function lt(J,p,x,L){const M=J.createElement(p);return x&&M.setAttribute("class",`${ct}__${x}`),L!=null&&(M.textContent=L),M}class c{#n;#s;#t;#e;#i;#r;#a=new Map;#c=[];#u=0;#o="";#d=null;#g=null;#_=null;#y=null;#S=null;#x=null;constructor(p,x,L,M,B,G){this.#n=p,this.#s=x,this.#t=L,this.#e=String(M),this.#i=B,this.#r=G,this.#A=B}#A;#C(){const p=this.#n.schedule;return p&&p.ok&&p.tasks.get(this.#e)||null}open(){const p=this.#s,x=this.#n.taskById(this.#e)||{};for(const it of $t(x))this.#a.set(it.resource,it.units);const L=new Set(this.#a.keys());for(const it of this.#n.resourceModels.keys())L.add(it);const M=this.#n.resources();for(const it of M.resources)L.add(it.resource);this.#c=[...L].sort((it,_)=>it.localeCompare(_));const B=this.#C(),G=lt(p,"div","picker");G.setAttribute("role","dialog"),G.setAttribute("aria-label",this.#t("gantt.picker.title",{name:B?B.name:this.#e}));const et=lt(p,"input","picker-search");et.setAttribute("type","search"),et.setAttribute("role","combobox"),et.setAttribute("aria-expanded","true"),et.setAttribute("aria-autocomplete","list"),et.setAttribute("aria-label",this.#t("gantt.picker.search")),this.#g=et;const $=lt(p,"div","picker-list");$.setAttribute("role","listbox"),$.setAttribute("aria-multiselectable","true"),$.setAttribute("aria-label",this.#t("gantt.picker.list")),$.setAttribute("id",`${ct}-picker-list-${this.#e}`),$.setAttribute("tabindex","-1"),et.setAttribute("aria-controls",$.getAttribute("id")),this.#_=$;const b=lt(p,"div","picker-chosen");b.setAttribute("role","group"),b.setAttribute("aria-label",this.#t("gantt.picker.selected")),this.#y=b;const w=lt(p,"div","picker-warn");w.setAttribute("role","status"),w.setAttribute("aria-live","polite"),w.setAttribute("aria-atomic","true"),this.#S=w;const H=lt(p,"div","picker-actions"),F=lt(p,"button","picker-apply",this.#t("gantt.picker.apply"));F.setAttribute("type","button"),F.addEventListener("click",()=>this.#j());const nt=lt(p,"button","picker-cancel",this.#t("gantt.picker.cancel"));nt.setAttribute("type","button"),nt.addEventListener("click",()=>this.close()),H.append(F,nt),G.append(et,$,b,w,H),G.addEventListener("keydown",it=>this.#O(it)),et.addEventListener("input",()=>{this.#o=et.value,this.#u=0,this.#b()}),this.#d=G,(p.body||p.documentElement).appendChild(G),this.#x=it=>{this.#d&&!this.#d.contains(it.target)&&this.close()},p.addEventListener("pointerdown",this.#x,!0),this.#b(),et.focus()}#I(){const p=this.#d;if(!p)return;const x=this.#s.defaultView,L=x&&x.innerWidth||this.#s.documentElement.clientWidth,M=x&&x.innerHeight||this.#s.documentElement.clientHeight,B=4,G=this.#A.getBoundingClientRect();p.style.maxHeight=`${Math.max(120,Math.min(420,M-2*B))}px`;const et=p.offsetWidth,$=p.offsetHeight;let b=Math.round(G.left);b=Math.max(B,Math.min(b,L-et-B));let w=Math.round(G.bottom+2);if(w+$>M-B){const H=Math.round(G.top-2-$);w=H>=B?H:Math.max(B,M-$-B)}p.style.left=`${b}px`,p.style.top=`${w}px`}#T(){const p=this.#o.trim().toLowerCase();return p?this.#c.filter(x=>x.toLowerCase().includes(p)):this.#c}#v(){return[...this.#a].map(([p,x])=>({resource:p,units:x}))}#b(){const p=this.#s,x=this.#C(),L=x?x.es:0,M=x?x.ef:0,B=this.#v(),G=this.#n.previewAssignments(this.#e,B),et=this.#n.resourceModels,$=this.#_;for(;$.firstChild;)$.removeChild($.firstChild);const b=this.#T();if(this.#u>=b.length&&(this.#u=Math.max(0,b.length-1)),b.forEach((F,nt)=>{const{load:it,capacity:_}=tt(G,F,L,M,et.has(F)?et.get(F).capacityUnits:1),Y=this.#a.has(F),R=it>_+1e-9,ft=lt(p,"div",`picker-option${R?` ${ct}__picker-option--over`:""}`);ft.setAttribute("role","option"),ft.setAttribute("id",`${ct}-picker-opt-${this.#e}-${nt}`),ft.setAttribute("aria-selected",Y?"true":"false"),ft.setAttribute("data-resource",F),ft.setAttribute("data-load",String(it)),ft.setAttribute("data-capacity",String(_)),nt===this.#u&&ft.setAttribute("data-active","true"),ft.textContent=`${F} — ${this.#t("gantt.picker.load",{load:N(it),capacity:N(_)})}`,ft.addEventListener("click",()=>{this.#u=nt,this.#P(F)}),$.appendChild(ft)}),!b.length){const F=lt(p,"div","picker-none",this.#t("gantt.picker.none"));F.setAttribute("role","presentation"),$.appendChild(F)}this.#g&&(b.length?this.#g.setAttribute("aria-activedescendant",`${ct}-picker-opt-${this.#e}-${this.#u}`):this.#g.removeAttribute("aria-activedescendant"));const w=this.#y,H=p.activeElement&&w.contains(p.activeElement)?p.activeElement.getAttribute("data-for"):null;for(;w.firstChild;)w.removeChild(w.firstChild);for(const[F,nt]of this.#a){const it=lt(p,"div","picker-row");it.setAttribute("data-resource",F),it.appendChild(lt(p,"span","picker-row-name",F));const _=lt(p,"input","picker-units");_.setAttribute("type","number"),_.setAttribute("min","0"),_.setAttribute("max","1000"),_.setAttribute("step","5"),_.setAttribute("aria-label",this.#t("gantt.picker.units",{name:F})),_.setAttribute("data-for",F),_.value=String(N(nt)),_.addEventListener("input",()=>{const R=Number(_.value);_.value===""||!Number.isFinite(R)||R<0||(this.#a.set(F,R/100),this.#M())});const Y=lt(p,"button","picker-remove","×");Y.setAttribute("type","button"),Y.setAttribute("aria-label",this.#t("gantt.picker.remove",{name:F})),Y.addEventListener("click",()=>{this.#a.delete(F),this.#b(),this.#g&&this.#g.focus()}),it.append(_,Y),w.appendChild(it),H===F&&_.focus()}this.#D(G,B)}#M(){const p=this.#C(),x=p?p.es:0,L=p?p.ef:0,M=this.#v(),B=this.#n.previewAssignments(this.#e,M),G=this.#n.resourceModels;for(const et of this.#_.querySelectorAll('[role="option"]')){const $=et.getAttribute("data-resource"),{load:b,capacity:w}=tt(B,$,x,L,G.has($)?G.get($).capacityUnits:1);et.setAttribute("data-load",String(b)),et.setAttribute("data-capacity",String(w)),et.textContent=`${$} — ${this.#t("gantt.picker.load",{load:N(b),capacity:N(w)})}`,et.setAttribute("class",`${ct}__picker-option${b>w+1e-9?` ${ct}__picker-option--over`:""}`)}this.#D(B,M)}#D(p,x){const L=rt(p,this.#e),M=this.#S;M.setAttribute("data-over",L.length?"true":"false"),M.setAttribute("class",`${ct}__picker-warn${L.length?` ${ct}__picker-warn--over`:""}`),M.textContent=L.length?L.map(B=>this.#t("gantt.picker.warn",{name:B.resource,load:N(B.load),capacity:N(B.capacity)})).join(". "):x.length?this.#t("gantt.picker.ok"):"",this.#I()}#P(p){this.#a.has(p)?this.#a.delete(p):this.#a.set(p,1),this.#b(),this.#g&&this.#g.focus()}#O(p){const x=this.#T(),L=p.target instanceof Element&&p.target.classList.contains(`${ct}__picker-units`);if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),this.close();return}if(p.key==="Tab"&&this.#d){const M=[...this.#d.querySelectorAll("input, button")].filter(et=>!et.disabled),B=M[0],G=M[M.length-1];p.shiftKey&&this.#s.activeElement===B?(p.preventDefault(),G.focus()):!p.shiftKey&&this.#s.activeElement===G&&(p.preventDefault(),B.focus());return}if(L){p.key==="Enter"&&(p.preventDefault(),this.#j());return}if(!(p.target instanceof Element&&p.target.tagName==="BUTTON")){if(p.key==="ArrowDown"||p.key==="ArrowUp"){if(p.preventDefault(),!x.length)return;this.#u=(this.#u+(p.key==="ArrowDown"?1:-1)+x.length)%x.length,this.#b()}else if(p.key==="Home"||p.key==="End"){if(p.target===this.#g&&this.#o)return;p.preventDefault(),this.#u=p.key==="Home"?0:Math.max(0,x.length-1),this.#b()}else if((p.key==="Enter"||p.key===" ")&&x.length){if(p.key===" "&&this.#o)return;p.preventDefault(),this.#P(x[this.#u])}}}#j(){const p=$t(this.#n.taskById(this.#e)||{}),x=this.#v();p.length===x.length&&p.every(M=>this.#a.has(M.resource)&&Math.abs(this.#a.get(M.resource)-M.units)<1e-9)||this.#n.applyEdit({id:this.#e,assignments:x},{writeBack:!0}),this.close()}close(){if(!this.#d)return;this.#x&&this.#s.removeEventListener("pointerdown",this.#x,!0),this.#d.remove(),this.#d=null;const p=this.#i;this.#r();const x=p&&p.isConnected?p:this.#s.querySelector(`[data-picker-for="${this.#e}"]`);x&&x.focus&&x.focus()}get element(){return this.#d}}}),se("packages/modules/gantt/split.js",function(y,yt){"use strict";Object.defineProperty(y,"SPLIT_NS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(y,"GanttSplitView",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(y,"mountGanttSplit",{enumerable:!0,get:function(){return ke}});const $t=yt("packages/modules/shared/axislabels.js").thinLabels,ct=yt("packages/modules/charts/svg.js"),tt=ct.svg,rt=ct.el,N=ct.setText,lt=ct.path,c=ct.round,p=yt("packages/modules/charts/scale.js").linearScale,x=yt("packages/modules/gantt/time.js"),L=x.fromDayNumber,M=x.toISODate,B=x.toDayNumber,et=yt("packages/modules/gantt/calendar.js").createCalendar,$=yt("packages/modules/gantt/links.js"),b=$.routeLink,w=$.arrowheadPath,F=yt("packages/modules/gantt/messages.js").createTranslator,it=yt("packages/modules/gantt/resources.js").parseAssignments,_=yt("packages/modules/gantt/gestures.js"),Y=_.GanttGestures,R=_.describeTask,mt=yt("packages/modules/gantt/assignment-picker.js").AssignmentPicker,Ct=yt("packages/modules/gantt/workload.js"),at=Ct.WORKLOAD_DEFAULTS,xt=Ct.HISTOGRAM_DEFAULTS,D=Ct.computeWorkload,X=Ct.workloadBuckets,T=Ct.formatHours,k=Ct.formatPercent,A=Ct.formatCost,W=Ct.statedHours,Z=Ct.taskContour,m=Ct.setContourBucket,St=Ct.serializeContour,st=Ct.spreadHours,At=Ct.recordWorkingDays,It=yt("packages/core/src/internal/util.js").warnOnce,l=yt("packages/modules/gantt/export.js"),g=l.buildSplitSVG,v=l.buildPrintDocument,C=l.rasterizePNG,E=l.openPrintWindow,O=yt("packages/modules/gantt/tooltip.js"),I=O.resolveTaskTooltip,i=O.positionTooltip,o=O.tooltipCss,e=60,d=.5,t="lat-gantt-split",h="data-lat-gantt-split-styles",u=8,q=32,U=40,gt=80,ht=80,kt=120,dt=Object.freeze({height:420,rowHeight:34,headerHeight:44,gridWidth:620,indent:16,zoom:"day",today:null,nonWorking:null,calendar:null,showArrows:!0,showProgress:!0,showBaseline:!0,barLabel:"name",columns:null,progressLine:null,hoverChain:!0,editable:!0,keyboard:!0,resizeZone:6,tooltip:!0,workload:null,histogram:null}),wt=11,P=Object.freeze(new Set(["hours","percent","cost"])),ot=Object.freeze({hours:"percent",percent:"cost",cost:"hours"}),Lt=Object.freeze({day:{px:26,step:1,level:"day"},week:{px:12,step:7,level:"week"},month:{px:4,step:30,level:"month"},quarter:{px:1.8,step:91,level:"quarter"}}),Bt=["S","M","T","W","T","F","S"],_t=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],bt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ft=new Set(["start","end","duration"]),Jt=new Set(["effort","units"]);function ie(K,n,r){return r-n<=1e-9?K>=r?1:0:K<=n?0:K>=r?1:(K-n)/(r-n)}const te=["#4a90d9","#e2513b","#2c9c6a","#8b5cf6","#d97706","#0891b2","#be185d"];function de(){const K=t;return`
|
|
79
|
+
.${K}{position:relative;font:13px/1.4 system-ui,sans-serif;color:var(--lattice-foreground,#1f2933);display:flex;flex-direction:column;border:1px solid var(--lattice-border-color,#d7dbe0);border-radius:6px;overflow:hidden;box-sizing:border-box}
|
|
80
|
+
.${K} *{box-sizing:border-box}
|
|
81
|
+
.${K}__head{display:flex;flex:0 0 auto;overflow:hidden;background:var(--lattice-surface,#f6f8fa);border-bottom:1px solid var(--lattice-border-color,#d0d7de)}
|
|
82
|
+
.${K}__body{display:flex;flex:1 1 auto;overflow:hidden}
|
|
83
|
+
.${K}__grid-head,.${K}__grid-body{flex:0 0 auto}
|
|
84
|
+
.${K}__grid-head{display:flex;align-items:stretch}
|
|
85
|
+
.${K}__colhead{position:relative;display:flex;align-items:center;padding:0 8px;font-weight:600;color:var(--lattice-foreground-muted,#57606a);border-right:1px solid var(--lattice-border-color,#eaeef2);overflow:hidden;white-space:nowrap}
|
|
86
|
+
.${K}__colresize{position:absolute;top:0;right:0;bottom:0;width:6px;cursor:col-resize;touch-action:none}
|
|
87
|
+
.${K}__colresize:focus{outline:2px solid var(--lattice-focus-color,#2563eb);outline-offset:-2px}
|
|
88
|
+
.${K}__divider{flex:0 0 1px;width:1px;background:var(--lattice-border-strong,#c4ccd4);align-self:stretch}
|
|
89
|
+
/* The divider is a 1px line, too thin a target for a real mouse; this pseudo widens its HIT area to 7px without widening the line itself. z-index:1 keeps that widened area above __time-body (also position:relative), which would otherwise paint over its right half -- the two are positioned siblings, and __time-body comes later in document order. */
|
|
90
|
+
.${K}__divider--resize{position:relative;z-index:1;cursor:col-resize;touch-action:none}
|
|
91
|
+
.${K}__divider--resize::before{content:'';position:absolute;top:0;bottom:0;left:-3px;right:-3px;cursor:col-resize;touch-action:none}
|
|
92
|
+
.${K}__divider--resize:focus{outline:2px solid var(--lattice-focus-color,#2563eb);outline-offset:0}
|
|
93
|
+
.${K}__time-head{flex:1 1 auto;overflow:hidden;position:relative}
|
|
88
94
|
/*
|
|
89
95
|
* The grid body and the time body are each their OWN vertical scroller
|
|
90
96
|
* (BACKLOG-0001923), not ink-overflowing children of __body. A flex item
|
|
@@ -105,147 +111,147 @@ ${X(p)}
|
|
|
105
111
|
* own right edge, where a native vertical scrollbar already reads as the
|
|
106
112
|
* view's main one).
|
|
107
113
|
*/
|
|
108
|
-
.${
|
|
109
|
-
.${
|
|
110
|
-
.${
|
|
111
|
-
.${
|
|
112
|
-
.${
|
|
113
|
-
.${
|
|
114
|
-
.${
|
|
115
|
-
.${
|
|
116
|
-
.${
|
|
117
|
-
.${
|
|
118
|
-
.${
|
|
119
|
-
.${
|
|
120
|
-
.${
|
|
121
|
-
.${
|
|
122
|
-
.${
|
|
123
|
-
.${
|
|
124
|
-
.${
|
|
125
|
-
.${
|
|
126
|
-
.${
|
|
127
|
-
.${
|
|
128
|
-
.${
|
|
129
|
-
.${
|
|
130
|
-
.${
|
|
131
|
-
.${
|
|
132
|
-
.${
|
|
133
|
-
.${
|
|
134
|
-
.${
|
|
135
|
-
.${
|
|
136
|
-
.${
|
|
137
|
-
.${
|
|
138
|
-
.${
|
|
139
|
-
.${
|
|
140
|
-
.${
|
|
141
|
-
.${
|
|
142
|
-
.${
|
|
143
|
-
.${
|
|
144
|
-
.${
|
|
145
|
-
.${
|
|
146
|
-
.${
|
|
147
|
-
.${
|
|
148
|
-
.${
|
|
149
|
-
.${
|
|
150
|
-
.${
|
|
151
|
-
.${
|
|
152
|
-
.${
|
|
153
|
-
.${
|
|
154
|
-
.${
|
|
155
|
-
.${
|
|
156
|
-
.${
|
|
157
|
-
.${
|
|
158
|
-
.${
|
|
159
|
-
.${
|
|
160
|
-
.${
|
|
161
|
-
.${
|
|
162
|
-
.${
|
|
163
|
-
.${
|
|
164
|
-
.${
|
|
165
|
-
.${
|
|
166
|
-
.${
|
|
167
|
-
.${
|
|
168
|
-
.${
|
|
169
|
-
.${
|
|
170
|
-
.${
|
|
171
|
-
${o(
|
|
172
|
-
.${
|
|
173
|
-
.${
|
|
174
|
-
.${
|
|
175
|
-
.${
|
|
176
|
-
.${
|
|
177
|
-
.${
|
|
178
|
-
.${
|
|
179
|
-
.${
|
|
180
|
-
.${
|
|
181
|
-
.${
|
|
182
|
-
.${
|
|
183
|
-
.${
|
|
184
|
-
.${
|
|
185
|
-
.${
|
|
186
|
-
.${
|
|
187
|
-
.${
|
|
188
|
-
.${
|
|
189
|
-
.${
|
|
190
|
-
.${
|
|
191
|
-
.${
|
|
192
|
-
.${
|
|
193
|
-
.${
|
|
194
|
-
.${
|
|
195
|
-
.${
|
|
196
|
-
.${
|
|
197
|
-
.${
|
|
198
|
-
.${
|
|
199
|
-
.${
|
|
200
|
-
.${
|
|
201
|
-
.${
|
|
202
|
-
.${
|
|
203
|
-
.${
|
|
204
|
-
.${
|
|
205
|
-
.${
|
|
206
|
-
.${
|
|
207
|
-
.${
|
|
208
|
-
.${
|
|
209
|
-
.${
|
|
210
|
-
.${
|
|
211
|
-
.${
|
|
212
|
-
.${
|
|
213
|
-
.${
|
|
214
|
-
.${
|
|
215
|
-
.${
|
|
216
|
-
.${
|
|
217
|
-
.${
|
|
218
|
-
.${
|
|
219
|
-
.${
|
|
220
|
-
.${
|
|
114
|
+
.${K}__grid-body{overflow-y:auto;overflow-x:hidden;scrollbar-width:none}
|
|
115
|
+
.${K}__grid-body::-webkit-scrollbar{width:0;height:0}
|
|
116
|
+
.${K}__time-body{flex:1 1 auto;overflow:auto;position:relative}
|
|
117
|
+
.${K}__row{display:flex;align-items:center;border-bottom:1px solid var(--lattice-border-color,#eef1f4);overflow:hidden}
|
|
118
|
+
.${K}__row--summary{background:var(--lattice-surface,#f3f6f9)}
|
|
119
|
+
.${K}__cell{display:flex;align-items:center;padding:0 8px;height:100%;overflow:hidden;border-right:1px solid var(--lattice-border-color,#f0f2f4)}
|
|
120
|
+
.${K}__cell--name{gap:2px}
|
|
121
|
+
.${K}__name-text{overflow:hidden;text-overflow:ellipsis}
|
|
122
|
+
.${K}__name-text--summary{font-weight:600}
|
|
123
|
+
.${K}__chevron{flex:0 0 auto;width:16px;height:16px;line-height:16px;text-align:center;cursor:pointer;color:var(--lattice-foreground-muted,#57606a);border:0;background:none;padding:0;font-size:11px}
|
|
124
|
+
.${K}__chevron[aria-hidden="true"]{visibility:hidden}
|
|
125
|
+
.${K}__avatars{display:flex}
|
|
126
|
+
.${K}__picker-trigger{display:flex;align-items:center;width:100%;height:100%;padding:0 0 0 6px;border:0;background:none;font:inherit;color:inherit;cursor:pointer;text-align:left}
|
|
127
|
+
.${K}__picker{position:fixed;z-index:1000;width:300px;max-height:420px;overflow:auto;display:flex;flex-direction:column;gap:6px;padding:8px;font:13px/1.4 system-ui,sans-serif;color:var(--lattice-foreground,#1f2933);background:var(--lattice-background,#fff);border:1px solid var(--lattice-border-strong,#c4ccd4);border-radius:6px;box-shadow:0 6px 20px rgba(0,0,0,.18)}
|
|
128
|
+
.${K}__picker-search{height:26px;padding:0 6px;font:inherit;color:inherit;background:var(--lattice-background,#fff);border:1px solid var(--lattice-border-strong,#8a949e);border-radius:3px}
|
|
129
|
+
.${K}__picker-list{max-height:150px;overflow:auto;border:1px solid var(--lattice-border-color,#d7dbe0);border-radius:3px}
|
|
130
|
+
.${K}__picker-option{padding:4px 8px;cursor:pointer}
|
|
131
|
+
.${K}__picker-option[aria-selected="true"]{background:var(--lattice-selected-background,#dbeafe);font-weight:600}
|
|
132
|
+
.${K}__picker-option[data-active="true"]{outline:2px solid var(--lattice-focus-color,#2563eb);outline-offset:-2px}
|
|
133
|
+
.${K}__picker-option--over{color:var(--lattice-variant-danger-text,#a32a16)}
|
|
134
|
+
.${K}__picker-none{padding:4px 8px;color:var(--lattice-foreground-muted,#4b5560)}
|
|
135
|
+
.${K}__picker-row{display:flex;align-items:center;gap:6px;margin:2px 0}
|
|
136
|
+
.${K}__picker-row-name{flex:1 1 auto;overflow:hidden;text-overflow:ellipsis}
|
|
137
|
+
.${K}__picker-units{width:64px;height:24px;font:inherit;color:inherit;background:var(--lattice-background,#fff);border:1px solid var(--lattice-border-strong,#8a949e);border-radius:3px}
|
|
138
|
+
.${K}__picker-remove,.${K}__picker-apply,.${K}__picker-cancel{min-width:26px;height:26px;padding:0 8px;font:inherit;color:inherit;background:var(--lattice-surface,#f6f8fa);border:1px solid var(--lattice-border-strong,#8a949e);border-radius:3px;cursor:pointer}
|
|
139
|
+
.${K}__picker-warn{min-height:1.4em;color:var(--lattice-foreground-muted,#4b5560)}
|
|
140
|
+
.${K}__picker-warn--over{color:var(--lattice-variant-danger-text,#a32a16);font-weight:600}
|
|
141
|
+
.${K}__picker-actions{display:flex;justify-content:flex-end;gap:6px}
|
|
142
|
+
.${K}__avatar{width:22px;height:22px;border-radius:50%;color:#fff;font-size:10px;font-weight:600;display:flex;align-items:center;justify-content:center;margin-left:-6px;border:1.5px solid var(--lattice-background,#fff)}
|
|
143
|
+
.${K}__avatar:first-child{margin-left:0}
|
|
144
|
+
.${K}__avatar--overalloc{border-color:var(--lattice-variant-danger-solid,#e2513b);box-shadow:0 0 0 1.5px var(--lattice-variant-danger-solid,#e2513b)}
|
|
145
|
+
.${K}__ring{flex:0 0 auto}
|
|
146
|
+
.${K}__ring-track{stroke:var(--lattice-border-color,#e6e8eb)}
|
|
147
|
+
.${K}__ring-label{fill:var(--lattice-foreground-muted,#57606a)}
|
|
148
|
+
.${K}__plot{display:block}
|
|
149
|
+
.${K}__shade{fill:var(--lattice-surface,#f1f3f5)}
|
|
150
|
+
.${K}__rowsep{stroke:var(--lattice-border-color,#eef1f4);stroke-width:1}
|
|
151
|
+
.${K}__bar{fill:var(--lattice-accent,#4a90d9)}
|
|
152
|
+
.${K}__bar--critical{fill:var(--lattice-variant-danger-solid,#e2513b)}
|
|
153
|
+
.${K}__bar--overalloc{stroke:var(--lattice-variant-danger-solid,#e2513b);stroke-width:2;stroke-dasharray:3 2}
|
|
154
|
+
.${K}__bar--conflict{stroke:var(--lattice-variant-warning-solid,#d97706);stroke-width:2}
|
|
155
|
+
.${K}__progress{fill:rgba(0,0,0,0.26)}
|
|
156
|
+
.${K}__summary-bar{fill:var(--lattice-header-foreground,#33404d)}
|
|
157
|
+
.${K}__milestone{fill:var(--lattice-header-foreground,#33404d)}
|
|
158
|
+
.${K}__baseline{fill:var(--lattice-border-strong,#b9c2cc);opacity:0.7}
|
|
159
|
+
.${K}__barlabel{fill:var(--lattice-foreground,#3d4650);font-size:11px;dominant-baseline:middle}
|
|
160
|
+
.${K}__startlabel{fill:var(--lattice-foreground-muted,#57606a);font-size:10px;dominant-baseline:middle}
|
|
161
|
+
.${K}__link{fill:none;stroke:var(--lattice-foreground-muted,#8a94a0);stroke-width:1.5}
|
|
162
|
+
.${K}__link--critical{stroke:var(--lattice-variant-danger-solid,#e2513b)}
|
|
163
|
+
.${K}__link--chain{stroke:var(--lattice-link-color,#2563eb);stroke-width:2.5}
|
|
164
|
+
.${K}__arrowhead{fill:var(--lattice-foreground-muted,#8a94a0)}
|
|
165
|
+
.${K}__arrowhead--critical{fill:var(--lattice-variant-danger-solid,#e2513b)}
|
|
166
|
+
.${K}__arrowhead--chain{fill:var(--lattice-link-color,#2563eb)}
|
|
167
|
+
.${K}__bar--chain{stroke:var(--lattice-link-color,#2563eb);stroke-width:2}
|
|
168
|
+
.${K}__milestone--chain{stroke:var(--lattice-link-color,#2563eb);stroke-width:2}
|
|
169
|
+
.${K}__summary-bar--chain{stroke:var(--lattice-link-color,#2563eb);stroke-width:2}
|
|
170
|
+
.${K}__row--chain{background:var(--lattice-range-background,#eaf1fb)}
|
|
171
|
+
.${K}__cell--editable{cursor:text}
|
|
172
|
+
.${K}__editor{width:100%;height:22px;box-sizing:border-box;border:1px solid var(--lattice-focus-color,#2563eb);border-radius:3px;padding:0 4px;font:inherit;color:inherit;background:var(--lattice-background,#fff)}
|
|
173
|
+
.${K}__live{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
|
|
174
|
+
.${K}__barrow:focus{outline:2px solid var(--lattice-focus-color,#2563eb);outline-offset:1px}
|
|
175
|
+
.${K}__tooltip{position:absolute;pointer-events:none;z-index:5}
|
|
176
|
+
.${K}__tooltip[hidden]{display:none}
|
|
177
|
+
${o(K)}
|
|
178
|
+
.${K}__today{stroke:var(--lattice-variant-danger-solid,#e2513b);stroke-width:1.5;stroke-dasharray:4 3}
|
|
179
|
+
.${K}__progressline{stroke:var(--lattice-variant-info-solid,#2f6fb3);stroke-width:1.5}
|
|
180
|
+
.${K}__progressline--dot{fill:var(--lattice-variant-info-solid,#2f6fb3)}
|
|
181
|
+
.${K}__band{fill:var(--lattice-foreground-muted,#57606a);font-size:11px;font-weight:600}
|
|
182
|
+
.${K}__bandsep{stroke:var(--lattice-border-color,#d0d7de);stroke-width:1}
|
|
183
|
+
.${K}__dayletter{fill:var(--lattice-foreground-muted,#8a94a0);font-size:10px;text-anchor:middle}
|
|
184
|
+
.${K}__dayletter--nonwork{fill:var(--lattice-foreground-muted,#c4ccd4)}
|
|
185
|
+
.${K}__wl{display:flex;flex-direction:column;flex:0 0 auto;min-height:0;overflow:hidden;border-top:2px solid var(--lattice-border-strong,#c4ccd4);background:var(--lattice-surface-alt,#fbfcfd)}
|
|
186
|
+
.${K}__wl-head{display:flex;flex:0 0 auto;background:var(--lattice-surface,#f6f8fa);border-bottom:1px solid var(--lattice-border-color,#d0d7de)}
|
|
187
|
+
.${K}__wl-body{display:flex;flex:1 1 auto;overflow-y:auto;overflow-x:hidden}
|
|
188
|
+
.${K}__wl-grid{flex:0 0 auto}
|
|
189
|
+
.${K}__wl-time{flex:1 1 auto;overflow-x:auto;overflow-y:hidden}
|
|
190
|
+
.${K}__wl-head-spacer{flex:1 1 auto;overflow:hidden}
|
|
191
|
+
.${K}__wl-plot{position:relative;overflow:hidden}
|
|
192
|
+
.${K}__wl-row{display:flex;align-items:center;border-bottom:1px solid var(--lattice-border-color,#eef1f4)}
|
|
193
|
+
.${K}__wl-timerow{position:relative;border-bottom:1px solid var(--lattice-border-color,#eef1f4)}
|
|
194
|
+
.${K}__wl-cell{display:flex;align-items:center;padding:0 8px;height:100%;overflow:hidden;white-space:nowrap;border-right:1px solid var(--lattice-border-color,#f0f2f4)}
|
|
195
|
+
.${K}__wl-cell--name{overflow:hidden;text-overflow:ellipsis}
|
|
196
|
+
.${K}__wl-cell--total{justify-content:flex-end;font-variant-numeric:tabular-nums}
|
|
197
|
+
.${K}__wl-bucket{position:absolute;top:0;bottom:0;display:flex;align-items:center;justify-content:center;padding:0;font-variant-numeric:tabular-nums;border-right:1px solid var(--lattice-border-color,#f0f2f4);font-size:11px;color:var(--lattice-foreground,#3d4650)}
|
|
198
|
+
.${K}__wl-bucket--over{background:var(--lattice-variant-danger-fill,#fdecea);color:var(--lattice-variant-danger-text,#a4291b);font-weight:600}
|
|
199
|
+
.${K}__wl-row--total,.${K}__wl-timerow--total{background:var(--lattice-surface,#f1f4f7);font-weight:600}
|
|
200
|
+
.${K}__wl-toggle{flex:0 0 auto;width:14px;height:14px;line-height:14px;text-align:center;cursor:pointer;color:var(--lattice-foreground-muted,#57606a);border:0;background:none;padding:0;font-size:9px}
|
|
201
|
+
.${K}__wl-toggle::before{content:"\\25B8"}
|
|
202
|
+
.${K}__wl-toggle[aria-expanded="true"]::before{content:"\\25BE"}
|
|
203
|
+
.${K}__wl-name-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
204
|
+
.${K}__wl-row--task .${K}__wl-cell--name{padding-left:28px;color:var(--lattice-foreground-muted,#57606a)}
|
|
205
|
+
.${K}__wl-row--task,.${K}__wl-timerow--task{background:var(--lattice-background,#fff)}
|
|
206
|
+
.${K}__wl-bucket--editable{cursor:text}
|
|
207
|
+
.${K}__wl-editor{width:100%;height:20px;box-sizing:border-box;border:1px solid var(--lattice-focus-color,#2563eb);border-radius:3px;padding:0 2px;font:inherit;color:inherit;text-align:center;background:var(--lattice-background,#fff)}
|
|
208
|
+
.${K}__hg{display:flex;flex-direction:column;flex:0 0 auto;min-height:0;overflow:hidden;border-top:2px solid var(--lattice-border-strong,#c4ccd4);background:var(--lattice-surface-alt,#fbfcfd)}
|
|
209
|
+
.${K}__hg-head{display:flex;flex:0 0 auto;background:var(--lattice-surface,#f6f8fa);border-bottom:1px solid var(--lattice-border-color,#d0d7de)}
|
|
210
|
+
.${K}__hg-body{display:flex;flex:1 1 auto;overflow-y:auto;overflow-x:hidden;position:relative}
|
|
211
|
+
.${K}__hg-grid{flex:0 0 auto}
|
|
212
|
+
.${K}__hg-time{flex:1 1 auto;overflow-x:auto;overflow-y:hidden;position:relative}
|
|
213
|
+
.${K}__hg-head-spacer{flex:1 1 auto;overflow:hidden}
|
|
214
|
+
.${K}__hg-plot{display:block}
|
|
215
|
+
.${K}__hg-row{display:flex;align-items:center;border-bottom:1px solid var(--lattice-border-color,#eef1f4)}
|
|
216
|
+
.${K}__hg-cell{display:flex;align-items:center;padding:0 8px;height:100%;overflow:hidden;white-space:nowrap;border-right:1px solid var(--lattice-border-color,#f0f2f4)}
|
|
217
|
+
.${K}__hg-cell--name{overflow:hidden;text-overflow:ellipsis}
|
|
218
|
+
.${K}__hg-name-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
219
|
+
.${K}__hg-bar{fill:var(--lattice-accent,#4a90d9)}
|
|
220
|
+
.${K}__hg-bar--overalloc{fill:var(--lattice-variant-danger-solid,#e2513b)}
|
|
221
|
+
.${K}__hg-cap{stroke:var(--lattice-foreground-muted,#57606a);stroke-width:1.5;stroke-dasharray:4 3}
|
|
222
|
+
.${K}__hg-bargroup:focus{outline:2px solid var(--lattice-focus-color,#2563eb);outline-offset:1px}
|
|
223
|
+
.${K}__hg-tooltip{position:absolute;pointer-events:none;background:#1f2933;color:#fff;padding:4px 8px;border-radius:4px;font-size:11px;white-space:nowrap;z-index:5}
|
|
224
|
+
.${K}__hg-tooltip[hidden]{display:none}
|
|
225
|
+
.${K}__hg-table{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
|
|
226
|
+
.${K}__hg--collapsed .${K}__hg-body{display:none}
|
|
221
227
|
/* Native scrollbars follow the nearest data-theme (BACKLOG-0001462). */
|
|
222
|
-
@scope ([data-theme="dark"]){:scope.${
|
|
223
|
-
@scope ([data-theme="light"],[data-theme="auto"]){:scope.${
|
|
224
|
-
@media (prefers-color-scheme:dark){@scope ([data-theme="auto"]){:scope.${
|
|
225
|
-
`.trim()}function gt(O){const e=O.documentElement;if(!e||e.getAttribute(d))return;e.setAttribute(d,"1");const i=O.createElement("style");i.textContent=$t(),(O.head||O.body||e).appendChild(i)}function Ft(O){const e=String(O).trim().split(/\s+/).filter(Boolean);return e.length?e.length===1?e[0].slice(0,2).toUpperCase():(e[0][0]+e[e.length-1][0]).toUpperCase():"?"}function qt(O){let e=0;for(let i=0;i<O.length;i+=1)e=e*31+O.charCodeAt(i)>>>0;return Bt[e%Bt.length]}function re(){return[{key:"name",title:"Task name",width:0,kind:"name"},{key:"start",title:"Start",width:96,kind:"start"},{key:"end",title:"Finish",width:96,kind:"end"},{key:"duration",title:"Duration",width:84,kind:"duration"},{key:"assignee",title:"Assignee",width:96,kind:"assignee"},{key:"progress",title:"%",width:56,kind:"progress"}]}function Jt(O){if(!Array.isArray(O)||!O.length)return re();const e=new Map(re().map(s=>[s.key,s]));e.set("effort",{key:"effort",title:null,width:76,kind:"effort"}),e.set("units",{key:"units",title:null,width:76,kind:"units"});const i=O.map(s=>typeof s=="string"?e.get(s):s).filter(Boolean);return i.length?i:re()}class de{#n;#i;#t;#e;#o;#r=null;#a=null;#c=null;#u=null;#s=null;#d=new Set;#g=[];#S=new Set;#y=new Set;#_=new Set;#x=null;#A=null;#C=null;#F=null;#T=null;#v=!1;#b=null;#D=null;#M=null;#P=null;#O=null;#j=null;#N=null;#k=null;#J=null;#L=null;#I=null;#B=null;#G=null;#Q=null;#tt=null;#l=null;#R=null;#ot="";#at=null;#lt=1;#H=!1;#V=null;#ct=!1;#h=null;#z=null;#E=null;#Z=null;#$=null;#et=null;#nt=null;#X=new Set;#Y=null;#U=!1;#it=null;#f=null;#m=null;#W=null;#q=null;#p=null;#ut=null;#$t=null;#w=null;#dt=null;#ft=null;#ht=null;#pt=null;#gt=null;#mt=null;#kt=new Map;#rt=null;constructor(e,i,s={}){this.#n=e,this.#i=i,this.#t=i.ownerDocument,this.#e={...c,...s},this.#o=Jt(s.columns),gt(this.#t),this.#l=F(e,()=>this.#e.messages),this.#r=rt(this.#t,"div",t),this.#r.setAttribute("role","table"),Number.isFinite(this.#e.height)&&(this.#r.style.height=`${this.#e.height}px`);const v=rt(this.#t,"div",`${t}__head`);this.#a=rt(this.#t,"div",`${t}__grid-head`),this.#a.style.width=`${this.#K()}px`,this.#u=rt(this.#t,"div",`${t}__time-head`),v.appendChild(this.#a),v.appendChild(rt(this.#t,"div",`${t}__divider`)),v.appendChild(this.#u);const V=rt(this.#t,"div",`${t}__body`);this.#c=rt(this.#t,"div",`${t}__grid-body`),this.#c.style.width=`${this.#K()}px`,this.#s=rt(this.#t,"div",`${t}__time-body`),V.appendChild(this.#c),V.appendChild(rt(this.#t,"div",`${t}__divider`)),V.appendChild(this.#s),this.#r.appendChild(v),this.#r.appendChild(V),this.#h=this.#ae(),this.#f=this.#le(),this.#h&&this.#f&&(this.#f.unit=this.#h.unit),this.#ce(),this.#h&&this.#de(),this.#f&&this.#he(),this.#i.appendChild(this.#r),this.#F=()=>{this.#St(this.#s),this.#Tt(this.#s)},this.#s.addEventListener("scroll",this.#F),this.#T=()=>this.#Tt(this.#c),this.#c.addEventListener("scroll",this.#T),this.#e.hoverChain&&(this.#b=U=>this.#je(U),this.#D=()=>this.#Dt(),this.#c.addEventListener("pointerover",this.#b),this.#c.addEventListener("pointerleave",this.#D),this.#s.addEventListener("pointerover",this.#b),this.#s.addEventListener("pointerleave",this.#D)),this.#e.editable&&(this.#M=U=>this.#Ce(U),this.#c.addEventListener("dblclick",this.#M)),this.#R=rt(this.#t,"div",`${t}__live`),this.#R.setAttribute("role","status"),this.#R.setAttribute("aria-live","polite"),this.#r.appendChild(this.#R),this.#e.tooltip&&(this.#k=rt(this.#t,"div",`${t}__tooltip`),this.#k.setAttribute("hidden",""),this.#J=rt(this.#t,"div",`${t}__tip-arrow`),this.#k.appendChild(this.#J),this.#r.appendChild(this.#k),V.addEventListener("scroll",()=>this.#st()),this.#s.addEventListener("scroll",()=>this.#st())),this.#N=new Y({doc:this.#t,controller:e,options:()=>this.#e,plot:()=>this.#s?this.#s.querySelector(`.${t}__plot`):null,rowOf:U=>U&&U.closest?U.closest(`.${t}__barrow`):null,barOf:U=>U.querySelector(`.${t}__bar`)||U.querySelector(`.${t}__milestone`),pxPerDay:()=>this.#lt,announce:U=>this.#wt(U,{repeat:!0}),t:(U,Z)=>this.#l(U,Z),iso:U=>A(U),redraw:()=>this.draw(),focusTask:U=>{this.#at=U},editing:()=>this.#H}),this.#e.editable&&(this.#P=U=>this.#N.onPointerDown(U),this.#s.addEventListener("pointerdown",this.#P)),this.#e.keyboard&&(this.#O=U=>this.#N.onKey(U),this.#s.addEventListener("keydown",this.#O),this.#j=U=>this.#N.onHistoryKey(U),this.#r.addEventListener("keydown",this.#j)),this.#e.tooltip&&(this.#B=U=>this.#te(U),this.#G=()=>this.#st(),this.#s.addEventListener("pointermove",this.#B),this.#s.addEventListener("pointerleave",this.#G),this.#Q=U=>this.#ee(U),this.#s.addEventListener("focus",this.#Q,!0),this.#s.addEventListener("blur",this.#G,!0),this.#tt=U=>{U.key==="Escape"&&this.#st()},this.#s.addEventListener("keydown",this.#tt)),this.#C=e.on("schedule",()=>this.draw()),this.draw()}get element(){return this.#r}get options(){return{...this.#e}}get scroller(){return this.#r?this.#r.querySelector(`.${t}__time-body`):null}#K(){return Math.max(80,Number(this.#e.gridWidth)||620)}rowGeometry(){return this.#g.map(e=>({...e}))}get collapsed(){return new Set(this.#d)}toggle(e){const i=String(e);this.#d.has(i)?this.#d.delete(i):this.#d.add(i),this.draw()}draw(){if(this.#ct)return;const e=this.#n.schedule;if(!e||!e.ok)return;const i=e.overAllocations||[];if(this.#S=new Set(i.map(Pt=>Pt.resource)),this.#y=new Set(i.flatMap(Pt=>Pt.taskIds)),this.#_=new Set((e.conflicts||[]).map(Pt=>Pt.id)),this.#I=this.#e.tooltip?new Map(this.#n.tasks.map(Pt=>[String(this.#n.readId(Pt)),Pt])):null,this.#x=null,this.#e.evm){const Pt=this.#e.evm===!0?{}:this.#e.evm,Xt=Pt.statusDate!=null?Pt.statusDate:Number.isFinite(this.#e.today)?this.#e.today:void 0,Gt=this.#n.earnedValue({...Pt,statusDate:Xt});Gt&&Gt.ok&&(this.#x=Gt.byTask)}this.#A=this.#Lt(e);const s=this.#It(e),v=this.#Rt(s);this.#g=v;const V=v.length?v[v.length-1].top+v[v.length-1].height:0,U=this.#Ht(),Z=e.projectStart,ft=e.projectFinish,mt=[Z,ft];Number.isFinite(this.#e.today)&&mt.push(this.#e.today);const Mt=Math.floor(Math.min(...mt)),Dt=Math.ceil(Math.max(...mt)),Ot=Math.max(1,Math.round((Dt-Mt)*.04)),jt=Mt-Ot,Tt=Dt+Ot,Ht=Math.max(1,Math.round((Tt-jt)*U.px)),Et=f({min:jt,max:Tt},[0,Ht]);this.#lt=Et.of(1)-Et.of(0);const Lt=Pt=>l(Et.of(Pt));if(this.#Ut(),this.#Wt(e,s,v),this.#Jt(U,jt,Tt,Lt,Ht),this.#Qt(e,s,v,Lt,Ht,V,Mt,Dt),this.#it){const Pt=this.getWorkloadUnit();this.#it.setAttribute("aria-pressed",Pt==="hours"?"false":"true"),this.#it.setAttribute("data-unit",Pt)}this.#h&&this.#fe(e,U,jt,Tt,Lt,Ht),this.#f&&this.#ge(e,U,jt,Tt,Lt,Ht);const Ut=new Map(this.#n.tasks.map(Pt=>[String(Pt.id),Pt]));this.#rt={columns:this.#o,columnWidths:this.#yt(),rows:s.map(Pt=>({id:Pt.id,rec:Pt.rec,depth:Pt.depth,...v.find(Xt=>Xt.id===Pt.id)})),rawById:Ut,totalHeight:V,domainMin:jt,domainMax:Tt,pxPerDay:this.#lt,zoomLevel:U.level,today:Number.isFinite(this.#e.today)?this.#e.today:null,rowHeight:this.#e.rowHeight,title:this.#e.title||null,workload:this.#h?{cfg:this.#h,data:this.#Y}:null,histogram:this.#f?{cfg:this.#f,data:this.#$t}:null}}#Lt(e){const i=this.#e.progressLine;if(i&&typeof i=="object"&&i.statusDate!=null){const s=B(i.statusDate);if(Number.isFinite(s))return s}if(this.#e.evm&&this.#e.evm!==!0&&this.#e.evm.statusDate!=null){const s=B(this.#e.evm.statusDate);if(Number.isFinite(s))return s}return Number.isFinite(this.#e.today)?this.#e.today:Number.isFinite(e.projectFinish)?e.projectFinish:null}#It(e){const i=new Map;for(const V of e.order){const U=e.tasks.get(V),Z=U.parent==null?"__root__":String(U.parent);i.has(Z)||i.set(Z,[]),i.get(Z).push(V)}const s=[],v=(V,U)=>{for(const Z of i.get(V)||[]){const ft=e.tasks.get(Z),mt=!!ft.isSummary&&(i.get(Z)||[]).length>0;s.push({id:Z,rec:ft,depth:U,hasChildren:mt}),mt&&!this.#d.has(Z)&&v(Z,U+1)}};return v("__root__",0),s}#Rt(e){const i=Number(this.#e.rowHeight)||34,s=new Map(this.#n.tasks.map(ft=>[String(this.#n.readId(ft)),ft])),v=this.#o.find(ft=>ft.kind==="name"),V=v&&v.width?v.width:this.#K()-this.#o.filter(ft=>ft.kind!=="name").reduce((ft,mt)=>ft+(mt.width||0),0),U=[];let Z=0;for(const ft of e){const mt=s.get(ft.id)||{};let Mt=i;if(Number.isFinite(mt.height))Mt=Math.max(i,Number(mt.height));else{const Dt=Math.max(24,V-ft.depth*(this.#e.indent||16)-28),Ot=Math.max(4,Math.floor(Dt/7)),jt=Math.max(1,Math.ceil(String(ft.rec.name||"").length/Ot));jt>1&&(Mt=Math.max(i,jt*18+12))}U.push({id:ft.id,top:Z,height:Mt}),Z+=Mt}return U}#Ht(){const e=this.#e.zoom;return Number.isFinite(e)?{px:Number(e),step:1,level:"custom"}:typeof e=="string"&&ut[e]?ut[e]:ut.day}#bt(){if(this.#e.calendar){const e=tt(this.#e.calendar,0);if(e)return i=>!e.isWorking(i)}return this.#e.nonWorking==="weekends"?e=>{const i=L(e),s=i?i.getUTCDay():0;return s===0||s===6}:typeof this.#e.nonWorking=="function"?this.#e.nonWorking:null}#Ut(){const e=this.#a;for(;e.firstChild;)e.removeChild(e.firstChild);e.style.height=`${this.#e.headerHeight}px`;const i=this.#yt();this.#o.forEach((s,v)=>{const V=rt(this.#t,"div",`${t}__colhead`);V.style.width=`${i[v]}px`,V.style.flex=`0 0 ${i[v]}px`,M(V,s.title||(nt.has(s.kind)?this.#l(`gantt.col.${s.kind}`):s.key)),e.appendChild(V)})}#yt(){const e=this.#K(),i=this.#o.reduce((s,v)=>s+(v.kind==="name"?0:v.width||0),0);return this.#o.map(s=>s.kind==="name"?Math.max(80,e-i):s.width||80)}#Wt(e,i,s){const v=this.#c;for(;v.firstChild;)v.removeChild(v.firstChild);const V=new Map(this.#n.tasks.map(Z=>[String(this.#n.readId(Z)),Z])),U=this.#yt();i.forEach((Z,ft)=>{const mt=s[ft],Mt=rt(this.#t,"div",`${t}__row${Z.rec.isSummary?` ${t}__row--summary`:""}`);Mt.style.height=`${mt.height}px`,Mt.setAttribute("role","row"),Mt.setAttribute("data-task",Z.id),Mt.setAttribute("data-row-top",String(mt.top)),Mt.setAttribute("data-row-height",String(mt.height)),this.#o.forEach((Dt,Ot)=>{const jt=this.#e.editable&&!Z.rec.isSummary&&this.#Ft(Dt)!=null,Tt=rt(this.#t,"div",`${t}__cell${Dt.kind==="name"?` ${t}__cell--name`:""}${jt?` ${t}__cell--editable`:""}`);Tt.style.width=`${U[Ot]}px`,Tt.style.flex=`0 0 ${U[Ot]}px`,Tt.setAttribute("data-col",String(Ot)),this.#zt(Tt,Dt,Z,V.get(Z.id)||{}),Mt.appendChild(Tt)}),v.appendChild(Mt)})}#zt(e,i,s,v){if(typeof i.render=="function"){const U=i.render(s.rec,{rawTask:v,depth:s.depth});U!=null&&M(e,String(U));return}if(i.kind==="name"){this.#Kt(e,s);return}if(i.kind==="assignee"){this.#Zt(e,v,s);return}if(nt.has(i.kind)){M(e,this.#Mt(i.kind,s.rec));return}if(i.kind==="progress"){this.#qt(e,s.rec);return}if(i.kind==="evm"){this.#Bt(e,i,s);return}if(i.kind==="plannedPercentComplete"){this.#Gt(e,s);return}if(T.has(i.kind)){M(e,this.#Ct(i.kind,s.rec));return}const V=v[i.key];M(e,V==null?"":String(V))}#Bt(e,i,s){const v=i.metric||"spi",V=this.#x?this.#x.get(s.id):null,U=V?V[v]:null;if(U==null||!Number.isFinite(U)){M(e,"—");return}const Z=v==="spi"||v==="cpi"?2:Number.isFinite(i.digits)?i.digits:0;M(e,U.toFixed(Z))}#Gt(e,i){const s=this.#Vt(i.rec);if(s==null){M(e,"—");return}M(e,String(Math.round(s)))}#Vt(e){if(e.isSummary||!Number.isFinite(this.#A))return null;const i=e.baselineStart!=null?e.baselineStart:e.es,s=e.baselineEnd!=null?e.baselineEnd:e.ef;return Rt(this.#A,i,s)*100}#Yt(e,i){const s=e.percentComplete==null?0:Math.max(0,Math.min(100,e.percentComplete))/100;return i?i.dayOf(i.indexOf(e.es)+s*e.duration):e.es+s*e.duration}#Kt(e,i){e.style.paddingLeft=`${8+i.depth*(this.#e.indent||16)}px`;const s=this.#t.createElement("button");if(s.setAttribute("class",`${t}__chevron`),s.setAttribute("type","button"),i.hasChildren){const V=this.#d.has(i.id);M(s,V?"▸":"▾"),s.setAttribute("aria-label",this.#l(V?"gantt.row.expand":"gantt.row.collapse",{name:i.rec.name})),s.setAttribute("aria-expanded",V?"false":"true"),s.addEventListener("click",()=>this.toggle(i.id))}else s.setAttribute("aria-hidden","true");e.appendChild(s);const v=rt(this.#t,"span",`${t}__name-text${i.rec.isSummary?` ${t}__name-text--summary`:""}`);M(v,i.rec.name),e.appendChild(v)}#Zt(e,i,s){const v=it(i).map(Z=>Z.resource);let V=e;if(this.#e.editable&&s&&!s.rec.isSummary){const Z=rt(this.#t,"button",`${t}__picker-trigger`);Z.setAttribute("type","button"),Z.setAttribute("data-picker-for",s.id),Z.setAttribute("aria-haspopup","dialog"),Z.setAttribute("aria-label",this.#l("gantt.picker.open",{name:s.rec.name})),Z.addEventListener("click",()=>this.#Xt(s.id,Z)),e.appendChild(Z),V=Z,v.length||M(Z,"+")}if(!v.length)return;const U=rt(this.#t,"div",`${t}__avatars`);for(const Z of v.slice(0,3)){const ft=this.#S.has(Z),mt=rt(this.#t,"div",`${t}__avatar${ft?` ${t}__avatar--overalloc`:""}`);mt.style.background=qt(Z),mt.setAttribute("title",ft?this.#l("gantt.resource.over",{name:Z}):Z),M(mt,Ft(Z)),U.appendChild(mt)}V.appendChild(U)}#Xt(e,i){this.#H||(this.#V&&this.#V.close(),this.#V=new pt(this.#n,this.#t,this.#l,e,i,()=>{this.#V=null,this.draw()}),this.#V.open())}#Mt(e,i){return i.isSummary?"":e==="effort"?i.effort!=null&&i.effort>0?String(l(i.effort)):"":i.units>0?`${Math.round(i.units*100)}%`:""}#qt(e,i){const s=i.percentComplete==null?null:Math.max(0,Math.min(100,i.percentComplete));if(s==null)return;const v=26,V=10,U=2*Math.PI*V,Z=Q(this.#t,"svg",{class:`${t}__ring`,width:v,height:v,viewBox:`0 0 ${v} ${v}`});Z.appendChild(Q(this.#t,"circle",{class:`${t}__ring-track`,cx:v/2,cy:v/2,r:V,fill:"none",stroke:"#e6e8eb","stroke-width":3})),Z.appendChild(Q(this.#t,"circle",{cx:v/2,cy:v/2,r:V,fill:"none",stroke:s>=100?"#2c9c6a":"#4a90d9","stroke-width":3,"stroke-dasharray":`${l(U*s/100)} ${l(U)}`,"stroke-linecap":"round",transform:`rotate(-90 ${v/2} ${v/2})`}));const ft=Q(this.#t,"text",{class:`${t}__ring-label`,x:v/2,y:v/2+3,"text-anchor":"middle","font-size":8,fill:"#57606a"});M(ft,String(Math.round(s))),Z.appendChild(ft),e.appendChild(Z)}#Jt(e,i,s,v,V){const U=this.#u;for(;U.firstChild;)U.removeChild(U.firstChild);U.style.height=`${this.#e.headerHeight}px`;const Z=this.#e.headerHeight,ft=e.level==="day"?Math.round(Z*.55):Z,mt=Q(this.#t,"svg",{class:`${t}__plot`,width:V,height:Z,viewBox:`0 0 ${V} ${Z}`});mt.setAttribute("data-role","time-head");const Mt=Math.floor(i),Dt=Math.ceil(s),Ot=this.#bt(),jt=e.level==="month"||e.level==="quarter"?null:7;if(jt){const Tt=[];let Ht=Mt-(L(Mt)?.getUTCDay()??0);for(;Ht<Dt;Ht+=jt){const Et=v(Ht);mt.appendChild(Q(this.#t,"line",{class:`${t}__bandsep`,x1:Et,y1:0,x2:Et,y2:Z}));const Lt=L(Ht);Lt&&Tt.push({at:Et,text:`${ct[Lt.getUTCDay()]} ${String(Lt.getUTCDate()).padStart(2,"0")} ${wt[Lt.getUTCMonth()]} ${Lt.getUTCFullYear()}`})}for(const Et of vt(Tt,{fontSize:q,bold:!0}).kept){const Lt=Q(this.#t,"text",{class:`${t}__band`,x:Et.at+4,y:Math.round(ft*.62)});M(Lt,Et.text),mt.appendChild(Lt)}}else{let Tt=L(Mt);if(Tt){const Ht=[];let Et=Date.UTC(Tt.getUTCFullYear(),Tt.getUTCMonth(),1)/864e5;for(;Et<Dt;){const Lt=L(Et),Ut=v(Et);mt.appendChild(Q(this.#t,"line",{class:`${t}__bandsep`,x1:Ut,y1:0,x2:Ut,y2:Z})),Ht.push({at:Ut,text:`${wt[Lt.getUTCMonth()]} ${Lt.getUTCFullYear()}`}),Et=Date.UTC(Lt.getUTCFullYear(),Lt.getUTCMonth()+1,1)/864e5}for(const Lt of vt(Ht,{fontSize:q,bold:!0}).kept){const Ut=Q(this.#t,"text",{class:`${t}__band`,x:Lt.at+4,y:Math.round(Z*.6)});M(Ut,Lt.text),mt.appendChild(Ut)}}}if(e.level==="day"){mt.appendChild(Q(this.#t,"line",{class:`${t}__bandsep`,x1:0,y1:ft,x2:V,y2:ft}));for(let Tt=Mt;Tt<Dt;Tt+=1){const Ht=L(Tt);if(!Ht)continue;const Et=(v(Tt)+v(Tt+1))/2,Lt=Q(this.#t,"text",{class:`${t}__dayletter${Ot&&Ot(Tt)?` ${t}__dayletter--nonwork`:""}`,x:l(Et),y:ft+Math.round((Z-ft)*.62)});M(Lt,kt[Ht.getUTCDay()]),mt.appendChild(Lt)}}U.appendChild(mt),U.scrollLeft=this.#s?this.#s.scrollLeft:0}#Qt(e,i,s,v,V,U,Z,ft){const mt=this.#s;for(;mt.firstChild;)mt.removeChild(mt.firstChild);const Mt=Q(this.#t,"svg",{class:`${t}__plot`,width:V,height:U,viewBox:`0 0 ${V} ${U}`,role:"img","aria-label":"Gantt timeline"}),Dt=this.#bt();if(Dt&&ft-Z<=3660){const Ht=Q(this.#t,"g",{class:`${t}__shading`});for(let Et=Math.floor(Z);Et<Math.ceil(ft);Et+=1){if(!Dt(Et))continue;const Lt=v(Et),Ut=v(Et+1);Ht.appendChild(Q(this.#t,"rect",{class:`${t}__shade`,x:Lt,y:0,width:l(Math.max(0,Ut-Lt)),height:U}))}Mt.appendChild(Ht)}const Ot=new Map(i.map((Ht,Et)=>[Ht.id,Et])),jt=this.#e.showProgress,Tt=this.#e.showBaseline;if(i.forEach((Ht,Et)=>{const Lt=s[Et],Ut=Ht.rec,Pt=Math.min(18,Lt.height-12),Xt=Lt.top+(Lt.height-Pt)/2,Gt=Lt.top+Lt.height/2,Nt=Q(this.#t,"g",{class:`${t}__barrow`});if(Nt.setAttribute("data-task",Ht.id),Nt.setAttribute("data-y",String(Lt.top)),Nt.setAttribute("data-row-height",String(Lt.height)),Nt.setAttribute("tabindex",this.#e.keyboard?"0":"-1"),Nt.setAttribute("role",Ut.isSummary?"group":"button"),Nt.setAttribute("aria-label",R(Ut,{iso:Wt=>A(Wt)})),Nt.appendChild(Q(this.#t,"rect",{class:`${t}__rowbg`,x:0,y:l(Lt.top),width:V,height:l(Lt.height),fill:"transparent"})),Nt.appendChild(Q(this.#t,"line",{class:`${t}__rowsep`,x1:0,y1:l(Lt.top+Lt.height),x2:V,y2:l(Lt.top+Lt.height)})),Tt&&Ut.baselineStart!=null&&Ut.baselineEnd!=null){const Wt=v(Ut.baselineStart),Qt=Math.max(1,v(Ut.baselineEnd)-Wt);Nt.appendChild(Q(this.#t,"rect",{class:`${t}__baseline`,x:Wt,y:l(Xt+Pt),width:l(Qt),height:4,rx:2}))}if(Ut.isMilestone){const Wt=v(Ut.es),Qt=Pt/2;Nt.appendChild(Q(this.#t,"path",{class:`${t}__milestone`,d:at(["M",l(Wt-Qt),l(Gt),"L",l(Wt),l(Gt-Qt),"L",l(Wt+Qt),l(Gt),"L",l(Wt),l(Gt+Qt),"Z"])}))}else if(Ut.isSummary){const Wt=v(Ut.es),Qt=Math.max(2,v(Ut.ef)-Wt);Nt.appendChild(Q(this.#t,"rect",{class:`${t}__summary-bar`,x:Wt,y:l(Xt+Pt/3),width:l(Qt),height:l(Pt/3),rx:1})),Nt.appendChild(Q(this.#t,"path",{class:`${t}__summary-bar`,d:at(["M",l(Wt),l(Xt+Pt/3),"L",l(Wt),l(Xt+Pt),"L",l(Wt+5),l(Xt+Pt/3),"Z"])})),Nt.appendChild(Q(this.#t,"path",{class:`${t}__summary-bar`,d:at(["M",l(Wt+Qt),l(Xt+Pt/3),"L",l(Wt+Qt),l(Xt+Pt),"L",l(Wt+Qt-5),l(Xt+Pt/3),"Z"])}));const Zt=Q(this.#t,"text",{class:`${t}__startlabel`,x:l(Wt+Qt+6),y:l(Gt)});M(Zt,this.#xt(Ut.es)),Nt.appendChild(Zt)}else{const Wt=v(Ut.es),Qt=Math.max(1,v(Ut.ef)-Wt),Zt=Ut.critical,oe=this.#y.has(String(Ut.id)),se=this.#_.has(String(Ut.id));Nt.appendChild(Q(this.#t,"rect",{class:`${t}__bar${Zt?` ${t}__bar--critical`:""}${oe?` ${t}__bar--overalloc`:""}${se?` ${t}__bar--conflict`:""}`,x:Wt,y:l(Xt),width:l(Qt),height:l(Pt),rx:3})),jt&&Ut.percentComplete!=null&&Ut.percentComplete>0&&Nt.appendChild(Q(this.#t,"rect",{class:`${t}__progress`,x:Wt,y:l(Xt),width:l(Qt*Math.min(1,Ut.percentComplete/100)),height:l(Pt),rx:3}));const C=this.#_e(Ut);if(C){const E=Q(this.#t,"text",{class:`${t}__barlabel`,x:l(Wt+Qt+6),y:l(Gt)});M(E,C),Nt.appendChild(E)}}Mt.appendChild(Nt)}),this.#e.showArrows&&this.#Se(Mt,e,i,Ot,s,v),Number.isFinite(this.#e.today)){const Ht=v(this.#e.today);Mt.appendChild(Q(this.#t,"line",{class:`${t}__today`,x1:Ht,y1:0,x2:Ht,y2:U,"data-today":String(this.#e.today)}))}if(this.#e.progressLine&&Number.isFinite(this.#A)&&this.#oe(Mt,e,i,s,v,U),mt.appendChild(Mt),this.#at){const Ht=Mt.querySelector(`.${t}__barrow[data-task="${this.#at}"]`);Ht&&Ht.focus&&Ht.focus()}}#te(e){if(this.#N.dragging||!this.#k)return;const i=e.target,s=i&&i.closest?i.closest(`.${t}__barrow`):null,v=s?s.getAttribute("data-task"):null,V=this.#n.schedule,U=v&&V&&V.ok?V.tasks.get(v):null;if(!U){this.#st();return}this.#Nt(s,U)}#ee(e){if(this.#N.dragging||!this.#k)return;const i=e.target,s=i&&i.closest?i.closest(`.${t}__barrow`):null,v=s?s.getAttribute("data-task"):null,V=this.#n.schedule,U=v&&V&&V.ok?V.tasks.get(v):null;U&&this.#Nt(s,U)}#Nt(e,i){const s=this.#I&&this.#I.get(String(i.id))||null,v=I(this.#t,t,i,s,this.#e.tooltip,this.#ne());if(!v){this.#st();return}for(const V of[...this.#k.children])V!==this.#J&&this.#k.removeChild(V);if(v.node)this.#k.appendChild(v.node);else{const V=rt(this.#t,"div",`${t}__tip-card`);M(V,v.text),this.#k.appendChild(V)}this.#k.removeAttribute("hidden"),this.#k.setAttribute("data-task",i.id),this.#L&&this.#L!==e&&this.#L.removeAttribute("aria-description"),e.setAttribute("aria-description",v.text),this.#L=e,this.#se(e)}#ne(){return{t:this.#l,formatDate:e=>this.#re(e),dateAxis:!0}}#re(e){const i=L(e);if(!i)return"";try{return new Intl.DateTimeFormat(this.#ie(),{year:"numeric",month:"long",day:"numeric",timeZone:"UTC"}).format(i)}catch{return A(e)||""}}#ie(){const e=this.#n.grid,i=e&&e.messages;return i&&i.locale||void 0}#se(e){if(!this.#k||!this.#r)return;const i=e.querySelector(`.${t}__bar`)||e.querySelector(`.${t}__milestone`)||e.querySelector(`.${t}__summary-bar`);if(!i||typeof i.getBoundingClientRect!="function")return;const s=i.getBoundingClientRect(),v=this.#r.getBoundingClientRect(),V=this.#t.defaultView||globalThis,U=Number.isFinite(V.innerWidth)?V.innerWidth:1/0,Z=Number.isFinite(V.innerHeight)?V.innerHeight:1/0,ft={left:Math.max(0,v.left),top:Math.max(0,v.top),right:Math.min(U,v.right),bottom:Math.min(Z,v.bottom)};r(this.#k,this.#J,s,ft,v)}#st(){this.#k&&(this.#k.setAttribute("hidden",""),this.#L&&(this.#L.removeAttribute("aria-description"),this.#L=null))}#oe(e,i,s,v,V,U){const Z=this.#A,ft=V(Z);e.appendChild(Q(this.#t,"line",{class:`${t}__progressline`,x1:l(ft),y1:0,x2:l(ft),y2:l(U),"data-status":String(Z),"data-status-x":l(ft)}));const mt=this.#e.calendar?tt(this.#e.calendar,i.projectStart):null;for(let Mt=0;Mt<s.length;Mt+=1){const Dt=s[Mt];if(Dt.rec.isSummary)continue;const Ot=v[Mt],jt=Ot.top+Ot.height/2,Tt=V(this.#Yt(Dt.rec,mt));e.appendChild(Q(this.#t,"line",{class:`${t}__progressline`,x1:l(ft),y1:l(jt),x2:l(Tt),y2:l(jt),"data-task":Dt.id,"data-status-x":l(ft),"data-progress-x":l(Tt)})),e.appendChild(Q(this.#t,"circle",{class:`${t}__progressline--dot`,cx:l(Tt),cy:l(jt),r:2.5,"data-task":Dt.id,"data-progress-x":l(Tt)}))}}#wt(e,i){if(!this.#R||!e)return;if(!!!(i&&i.repeat)){if(e===this.#ot)return;this.#ot=e,M(this.#R,e);return}this.#ot=e,M(this.#R,""),M(this.#R,e)}#ae(){const e=this.#e.workload;if(e==null||e===!1)return null;const i=e&&typeof e=="object"?e:{},s={...ot,...i},v=Number(this.#n.hoursPerDay),V=Number.isFinite(v)&&v>0?v:ot.hoursPerDay;return s.hoursPerDay=i.hoursPerDay!=null&&Number.isFinite(Number(i.hoursPerDay))&&Number(i.hoursPerDay)>0?Number(i.hoursPerDay):V,s.rowHeight=Math.max(16,Number(s.rowHeight)||ot.rowHeight),s.height=Math.max(s.rowHeight,Number(s.height)||ot.height),s.totals=s.totals!==!1,s.unit=W.has(i.unit)?i.unit:"hours",s}#le(){const e=this.#e.histogram;if(e==null||e===!1)return null;const s={..._t,...e&&typeof e=="object"?e:{}};return s.resources=Array.isArray(s.resources)&&s.resources.length?s.resources.map(v=>String(v)):null,s.unit=W.has(s.unit)?s.unit:"hours",s.stacked=s.stacked==="task"?"task":!1,s.rowHeight=Math.max(16,Number(s.rowHeight)||_t.rowHeight),s.height=Math.max(s.rowHeight,Number(s.height)||_t.height),s.collapsed=!1,s}#ce(){const e=this.#e.height;if(!Number.isFinite(e))return;const i=this.#h?this.#h.height:0,s=this.#f?this.#f.height:0,v=i+s;if(v<=0)return;const V=Math.max(0,Math.floor(e-e*u)-4);if(v<=V)return;const U=V/v;let Z=Math.round(i*U),ft=Math.round(s*U);const mt=this.#f?this.#f.rowHeight+n:0;if(this.#f&&ft<mt){const Mt=Math.ceil((i+mt)/(1-u));It("gantt-histogram-squeeze",`[lattice] gantt: the histogram band needs the split view at least ${Mt}px tall to show its bars alongside the workload band (it is ${e}px); showing its header only until there is room.`),this.#f.collapsed=!0,ft=this.#f.rowHeight,Z=Math.min(i,Math.max(0,V-ft))}this.#h&&(this.#h.height=Math.max(this.#h.rowHeight,Z)),this.#f&&(this.#f.height=Math.max(this.#f.rowHeight,ft))}#ue(){return this.#h?this.#h.hoursPerDay:ot.hoursPerDay}#de(){const e=this.#h;this.#z=rt(this.#t,"div",`${t}__wl`),this.#z.style.flex=`0 0 ${e.height}px`,this.#z.setAttribute("role","table"),this.#z.setAttribute("aria-label",this.#l("gantt.workload.title")),this.#E=rt(this.#t,"div",`${t}__wl-head`),this.#E.style.height=`${e.rowHeight}px`,this.#E.appendChild(rt(this.#t,"div",`${t}__wl-cell ${t}__wl-cell--name`)),this.#E.appendChild(rt(this.#t,"div",`${t}__wl-cell ${t}__wl-cell--total`)),this.#E.appendChild(rt(this.#t,"div",`${t}__divider`));const i=rt(this.#t,"div",`${t}__wl-head-spacer`);i.appendChild(this.#Ot()),this.#E.appendChild(i),this.#z.appendChild(this.#E);const s=rt(this.#t,"div",`${t}__wl-body`);this.#Z=rt(this.#t,"div",`${t}__wl-grid`),this.#Z.style.width=`${this.#K()}px`,this.#$=rt(this.#t,"div",`${t}__wl-time`),s.appendChild(this.#Z),s.appendChild(rt(this.#t,"div",`${t}__divider`)),s.appendChild(this.#$),this.#z.appendChild(s),this.#r.appendChild(this.#z),this.#et=()=>this.#St(this.#$),this.#$.addEventListener("scroll",this.#et),this.#e.editable&&(this.#nt=v=>this.#Me(v),this.#$.addEventListener("dblclick",this.#nt))}#St(e){if(this.#U||!e)return;this.#U=!0;const i=e.scrollLeft;for(const s of[this.#u,this.#s,this.#$,this.#p])s&&s!==e&&s.scrollLeft!==i&&(s.scrollLeft=i);this.#U=!1}#Tt(e){if(this.#v||!e)return;this.#v=!0;const i=e.scrollTop;for(const s of[this.#c,this.#s])s&&s!==e&&s.scrollTop!==i&&(s.scrollTop=i);this.#v=!1}#Pt(){const e=new Map,i=this.#n.resourceLoad;if(i&&i.byResource instanceof Map)for(const[s,v]of i.byResource)v&&Number.isFinite(v.capacity)&&e.set(s,v.capacity);return e}#Ot(){const e=this.#t.createElement("button");e.setAttribute("type","button"),e.setAttribute("class",`${t}__unit-toggle`);const i=this.getWorkloadUnit();return e.setAttribute("aria-pressed",i==="hours"?"false":"true"),e.setAttribute("data-unit",i),M(e,this.#l("gantt.workload.unitToggle")),e.addEventListener("click",()=>this.setWorkloadUnit(ht[this.getWorkloadUnit()])),this.#it=e,e}#fe(e,i,s,v,V,U){const Z=this.#h;if(!Z||!this.#Z||!this.#$||!this.#E)return;const ft=this.#bt(),mt=K(i.level,Math.floor(s),Math.ceil(v)),Mt=this.#n.resourceModels,Dt=D(this.#n.tasks,e,{buckets:mt,hoursPerDay:Z.hoursPerDay,isWorking:ft?Nt=>!ft(Nt):null,capacities:this.#Pt(),resourceModels:Mt,resourceRates:this.#n.resourceRates}),Ot=this.#yt(),jt=Math.max(40,Ot[0]||this.#K()),Tt=Math.max(0,this.#K()-jt),Ht=this.#E.querySelectorAll(`.${t}__wl-cell`);Ht[0]&&(Ht[0].style.width=`${jt}px`,Ht[0].style.flex=`0 0 ${jt}px`,M(Ht[0],this.#l("gantt.workload.resource"))),Ht[1]&&(Ht[1].style.width=`${Tt}px`,Ht[1].style.flex=`0 0 ${Tt}px`,M(Ht[1],Z.totals?this.#l("gantt.workload.total"):""));const Et=Dt.rows.slice(),Lt=Dt.ok?Dt.buckets:mt.map(Nt=>({...Nt,workingDays:0}));this.#Y={buckets:Lt,rows:Et};const Ut=this.#Z,Pt=this.#$;for(;Ut.firstChild;)Ut.removeChild(Ut.firstChild);for(;Pt.firstChild;)Pt.removeChild(Pt.firstChild);const Xt=rt(this.#t,"div",`${t}__wl-plot`);Xt.style.width=`${U}px`;const Gt=Et.reduce((Nt,Wt)=>Nt+1+(this.#X.has(Wt.resource==null?"":Wt.resource)?(Wt.tasks||[]).length:0),0);Xt.style.height=`${(Gt+(Z.totals?1:0))*Z.rowHeight}px`;for(const Nt of Et){const Wt=Nt.resource==null?"":Nt.resource,Qt=Nt.resource==null?this.#l("gantt.workload.unassigned"):Nt.resource,Zt=Nt.tasks||[],oe=this.#X.has(Wt);if(this.#_t(Ut,Xt,{key:Wt,label:Qt,cells:Nt.cells,over:Nt.over,capacity:Nt.capacity,available:Nt.available,availableTotal:Nt.availableTotal,total:Nt.total,costCells:Nt.costCells,costTotal:Nt.costTotal,isTotal:!1,taskId:null,toggle:Zt.length?{expanded:oe,name:Qt}:null},Lt,V,jt,Tt,Z),!!oe)for(const se of Zt)this.#_t(Ut,Xt,{key:Wt,label:se.name,cells:se.cells,over:se.cells.map(()=>!1),capacity:null,available:Nt.available,availableTotal:Nt.availableTotal,total:se.total,costCells:null,costTotal:null,isTotal:!1,taskId:String(se.id),toggle:null},Lt,V,jt,Tt,Z)}Z.totals&&this.#_t(Ut,Xt,{key:"__total__",label:this.#l("gantt.workload.total"),cells:Dt.totals,over:Dt.totals.map(()=>!1),capacity:null,available:Dt.totalsAvailable,availableTotal:Dt.grandAvailableTotal,total:Dt.grandTotal,costCells:Dt.totalsCost,costTotal:Dt.grandCostTotal,isTotal:!0,taskId:null,toggle:null},Lt,V,jt,Tt,Z),Pt.appendChild(Xt),this.#s&&(Pt.scrollLeft=this.#s.scrollLeft)}#_t(e,i,s,v,V,U,Z,ft){const mt=s.taskId!=null,Mt=mt&&!!this.#e.editable,Dt=rt(this.#t,"div",`${t}__wl-row${s.isTotal?` ${t}__wl-row--total`:""}${mt?` ${t}__wl-row--task`:""}`);Dt.style.height=`${ft.rowHeight}px`,Dt.setAttribute("role","row"),Dt.setAttribute("data-resource",s.key),mt&&Dt.setAttribute("data-task",s.taskId);const Ot=rt(this.#t,"div",`${t}__wl-cell ${t}__wl-cell--name`);if(Ot.style.width=`${U}px`,Ot.style.flex=`0 0 ${U}px`,Ot.setAttribute("role","rowheader"),s.toggle){const Et=this.#t.createElement("button");Et.setAttribute("class",`${t}__wl-toggle`),Et.setAttribute("type","button"),Et.setAttribute("aria-expanded",s.toggle.expanded?"true":"false"),Et.setAttribute("aria-label",this.#l(s.toggle.expanded?"gantt.workload.collapse":"gantt.workload.expand",{name:s.toggle.name})),Et.addEventListener("click",()=>this.toggleResource(s.key)),Ot.appendChild(Et)}const jt=rt(this.#t,"span",`${t}__wl-name-text`);M(jt,s.label),Ot.appendChild(jt),Dt.appendChild(Ot);const Tt=rt(this.#t,"div",`${t}__wl-cell ${t}__wl-cell--total`);if(Tt.style.width=`${Z}px`,Tt.style.flex=`0 0 ${Z}px`,Tt.setAttribute("role","cell"),ft.totals)if(ft.unit==="percent"&&s.availableTotal!=null){const Et=b(s.total,s.availableTotal,ft.decimals);M(Tt,Et==="–"?Et:`${Et}%`)}else ft.unit==="cost"&&s.costTotal!=null?M(Tt,x(s.costTotal,ft.decimals)):M(Tt,N(s.total,ft.decimals));Dt.appendChild(Tt),e.appendChild(Dt);const Ht=rt(this.#t,"div",`${t}__wl-timerow${s.isTotal?` ${t}__wl-timerow--total`:""}${mt?` ${t}__wl-timerow--task`:""}`);Ht.style.height=`${ft.rowHeight}px`,Ht.setAttribute("role","row"),Ht.setAttribute("data-resource",s.key),mt&&Ht.setAttribute("data-task",s.taskId),v.forEach((Et,Lt)=>{const Ut=V(Et.start),Pt=V(Et.end),Xt=ft.unit!=="cost"&&!!s.over[Lt],Gt=rt(this.#t,"div",`${t}__wl-bucket${Xt?` ${t}__wl-bucket--over`:""}${Mt?` ${t}__wl-bucket--editable`:""}`);Gt.style.left=`${l(Ut)}px`,Gt.style.width=`${l(Math.max(0,Pt-Ut))}px`,Gt.setAttribute("role","cell");const Nt=A(Et.start)??String(Et.start);Gt.setAttribute("data-bucket",Nt),Mt&&Gt.setAttribute("data-bucket-index",String(Lt));const Wt=s.cells[Lt],Qt=s.available?s.available[Lt]:null,Zt=s.costCells?s.costCells[Lt]:null,oe=ft.unit==="percent"&&Qt!=null,se=ft.unit==="cost"&&s.costCells!=null,C=Wt==null&&!(oe&&!(Qt>0)),E=oe?C?"":(()=>{const Ct=b(Wt,Qt,ft.decimals);return Ct==="–"?Ct:`${Ct}%`})():se?x(Zt,ft.decimals):N(Wt,ft.decimals);if(E!=="")if(M(Gt,E),Gt.setAttribute("data-hours",String(Wt)),oe)Gt.setAttribute("aria-label",E==="–"?this.#l("gantt.workload.cellNoCapacity",{date:Nt}):this.#l(Xt?"gantt.workload.overPercent":"gantt.workload.cellPercent",{percent:E.slice(0,-1),date:Nt}));else if(se)Gt.setAttribute("aria-label",this.#l("gantt.workload.cellCost",{cost:E,date:Nt}));else{const Ct={hours:E,date:Nt};Gt.setAttribute("aria-label",Xt?this.#l("gantt.workload.over",{...Ct,capacity:N(Qt,ft.decimals)}):this.#l("gantt.workload.cell",Ct))}else Mt&&Gt.setAttribute("aria-label",oe?this.#l("gantt.workload.cellPercent",{percent:"0",date:Nt}):this.#l("gantt.workload.cell",{hours:"0",date:Nt}));Ht.appendChild(Gt)}),i.appendChild(Ht)}#he(){const e=this.#f;this.#m=rt(this.#t,"div",`${t}__hg${e.collapsed?` ${t}__hg--collapsed`:""}`),this.#m.style.flex=`0 0 ${e.height}px`,this.#m.setAttribute("role","table"),this.#m.setAttribute("aria-label",this.#l("gantt.histogram.title")),this.#W=rt(this.#t,"div",`${t}__hg-head`),this.#W.style.height=`${e.rowHeight}px`,this.#W.appendChild(rt(this.#t,"div",`${t}__hg-cell ${t}__hg-cell--name`)),this.#W.appendChild(rt(this.#t,"div",`${t}__divider`));const i=rt(this.#t,"div",`${t}__hg-head-spacer`);this.#h||i.appendChild(this.#Ot()),this.#W.appendChild(i),this.#m.appendChild(this.#W);const s=rt(this.#t,"div",`${t}__hg-body`);this.#q=rt(this.#t,"div",`${t}__hg-grid`),this.#q.style.width=`${this.#K()}px`,this.#p=rt(this.#t,"div",`${t}__hg-time`),s.appendChild(this.#q),s.appendChild(rt(this.#t,"div",`${t}__divider`)),s.appendChild(this.#p),this.#m.appendChild(s),this.#r.appendChild(this.#m),this.#ut=()=>this.#St(this.#p),this.#p.addEventListener("scroll",this.#ut),this.#w=rt(this.#t,"div",`${t}__hg-tooltip`),this.#w.setAttribute("hidden",""),this.#m.appendChild(this.#w),this.#dt=v=>this.#ke(v),this.#ft=v=>this.#jt(v),this.#ht=()=>this.#vt(),this.#p.addEventListener("pointerover",this.#dt),this.#p.addEventListener("pointermove",this.#ft),this.#p.addEventListener("pointerleave",this.#ht),this.#pt=v=>this.#we(v),this.#gt=()=>this.#vt(),this.#p.addEventListener("focus",this.#pt,!0),this.#p.addEventListener("blur",this.#gt,!0),this.#mt=v=>this.#ve(v),this.#p.addEventListener("keydown",this.#mt)}#pe(e){const i=this.#f;if(!i.resources)return e.rows.map(v=>v.resource);const s=new Map(e.rows.map(v=>[v.resource==null?"":v.resource,v]));return i.resources.filter(v=>s.has(v))}#ge(e,i,s,v,V,U){const Z=this.#f;if(!Z||!this.#q||!this.#p||!this.#W)return;const ft=this.#bt(),mt=K(i.level,Math.floor(s),Math.ceil(v)),Mt=this.#ue(),Dt=D(this.#n.tasks,e,{buckets:mt,hoursPerDay:Mt,isWorking:ft?Nt=>!ft(Nt):null,capacities:this.#Pt(),resourceModels:this.#n.resourceModels,resourceRates:this.#n.resourceRates}),Ot=this.#yt(),jt=Math.max(40,Ot[0]||this.#K()),Tt=this.#W.querySelectorAll(`.${t}__hg-cell`);Tt[0]&&(Tt[0].style.width=`${jt}px`,Tt[0].style.flex=`0 0 ${jt}px`,M(Tt[0],this.#l("gantt.histogram.resource")));const Ht=Dt.ok?Dt.buckets:mt.map(Nt=>({...Nt,workingDays:0})),Et=Dt.ok?this.#pe(Dt):[],Lt=new Map(Dt.rows.map(Nt=>[Nt.resource==null?"":Nt.resource,Nt]));this.#$t={resources:Et,buckets:Ht,rows:Dt.rows,hoursPerDay:Mt};const Ut=this.#q,Pt=this.#p;for(;Ut.firstChild;)Ut.removeChild(Ut.firstChild);for(;Pt.firstChild;)Pt.removeChild(Pt.firstChild);const Xt=Math.max(1,Et.length*Z.rowHeight),Gt=Q(this.#t,"svg",{class:`${t}__hg-plot`,width:U,height:Xt,viewBox:`0 0 ${U} ${Xt}`,role:"img","aria-label":this.#l("gantt.histogram.title")});Et.forEach((Nt,Wt)=>{const Qt=Nt??"",Zt=Lt.get(Qt),oe=Nt??this.#l("gantt.workload.unassigned");this.#be(Ut,Gt,Zt,Qt,oe,Ht,V,jt,Z,Wt,U)}),Pt.appendChild(Gt),this.#s&&(Pt.scrollLeft=this.#s.scrollLeft),this.#$e(Et,Lt,Ht,Z)}#me(e,i,s){const v=e.reduce((Z,ft)=>Math.max(Z,ft||0),0),V=i!=null?Math.max(i,v):v,U=Math.max(V*1.15,V>0?V:1);return f({min:0,max:U},[s,0])}#be(e,i,s,v,V,U,Z,ft,mt,Mt,Dt){const Ot=rt(this.#t,"div",`${t}__hg-row`);Ot.style.height=`${mt.rowHeight}px`,Ot.setAttribute("role","row"),Ot.setAttribute("data-resource",v);const jt=rt(this.#t,"div",`${t}__hg-cell ${t}__hg-cell--name`);jt.style.width=`${ft}px`,jt.style.flex=`0 0 ${ft}px`,jt.setAttribute("role","rowheader");const Tt=rt(this.#t,"span",`${t}__hg-name-text`);M(Tt,V),jt.appendChild(Tt),Ot.appendChild(jt),e.appendChild(Ot);const Ht=mt.unit==="cost"&&s&&s.costCells!=null,Et=U.map((Gt,Nt)=>s&&(Ht?s.costCells[Nt]:s.cells[Nt])||0),Lt=!Ht&&s&&s.available&&s.available.some(Gt=>Gt!=null)?s.available:null,Ut=Lt?Lt.reduce((Gt,Nt)=>Math.max(Gt,Nt),0):null,Pt=this.#me(Et,Ut,mt.rowHeight),Xt=Q(this.#t,"g",{class:`${t}__hg-plotrow`,transform:`translate(0, ${l(Mt*mt.rowHeight)})`});if(Xt.setAttribute("data-resource",v),Xt.setAttribute("data-row-top",String(Mt*mt.rowHeight)),Xt.setAttribute("data-row-height",String(mt.rowHeight)),Xt.setAttribute("role","row"),U.forEach((Gt,Nt)=>{const Wt=Z(Gt.start),Qt=Z(Gt.end),Zt=Et[Nt],oe=Lt?Lt[Nt]:null,se=oe!=null&&Zt>oe,C=oe!=null?Math.min(Zt,oe):Zt,E=Q(this.#t,"g",{class:`${t}__hg-bargroup`});E.setAttribute("data-resource",v),E.setAttribute("data-bucket",A(Gt.start)??String(Gt.start)),E.setAttribute("data-bucket-index",String(Nt));const Ct=this.#kt.has(v)?this.#kt.get(v):0;E.setAttribute("tabindex",Nt===Ct?"0":"-1"),E.setAttribute("role","button"),E.setAttribute("aria-label",this.#ye(V,Gt,Zt,oe,se,s,Nt,mt));const yt=l(Wt),Yt=l(Math.max(0,Qt-Wt));if(mt.stacked==="task"&&!Ht&&s&&s.tasks&&s.tasks.length){let Kt=0;for(const ee of s.tasks){const ue=ee.cells[Nt]||0;if(!(ue>0))continue;const fe=Math.min(Kt,C),ke=Math.min(Kt+ue,C);if(Kt+=ue,ke<=fe)continue;const pe=Q(this.#t,"rect",{class:`${t}__hg-bar`,x:yt,y:l(Pt.of(ke)),width:Yt,height:l(Pt.of(fe)-Pt.of(ke)),fill:qt(String(ee.id))});pe.setAttribute("data-resource",v),pe.setAttribute("data-bucket",A(Gt.start)??String(Gt.start)),pe.setAttribute("data-task",String(ee.id)),E.appendChild(pe)}}else C>0&&E.appendChild(Q(this.#t,"rect",{class:`${t}__hg-bar`,x:yt,y:l(Pt.of(C)),width:Yt,height:l(Pt.of(0)-Pt.of(C))}));if(se){const Kt=Q(this.#t,"rect",{class:`${t}__hg-bar ${t}__hg-bar--overalloc`,x:yt,y:l(Pt.of(Zt)),width:Yt,height:l(Pt.of(C)-Pt.of(Zt))});Kt.setAttribute("data-resource",v),Kt.setAttribute("data-bucket",A(Gt.start)??String(Gt.start)),E.appendChild(Kt)}const te=Q(this.#t,"rect",{x:yt,y:0,width:Yt,height:mt.rowHeight,fill:"transparent"});E.insertBefore(te,E.firstChild),Xt.appendChild(E)}),Ut!=null){const Gt=l(Pt.of(Ut)),Nt=Q(this.#t,"line",{class:`${t}__hg-cap`,x1:0,y1:Gt,x2:Dt,y2:Gt});Nt.setAttribute("data-resource",v),Nt.setAttribute("data-capacity",String(Ut)),Xt.appendChild(Nt)}i.appendChild(Xt)}#ye(e,i,s,v,V,U,Z,ft){const mt=A(i.start)??String(i.start),Mt=A(i.end-1)??String(i.end-1);let Dt;if(ft.unit==="cost"&&U&&U.costCells!=null)Dt=this.#l("gantt.histogram.tipCost",{cost:x(s,2)});else if(ft.unit!=="percent"||v==null)Dt=this.#l("gantt.histogram.tipHours",{hours:N(s,1)});else{const Et=b(s,v,0);Dt=Et==="–"?this.#l("gantt.histogram.tipNoCapacity"):this.#l("gantt.histogram.tipPercent",{percent:Et})}const Ot=v!=null?this.#l("gantt.histogram.tipCapacity",{hours:N(v,1)}):"",jt=U&&U.tasks?U.tasks.filter(Et=>(Et.cells[Z]||0)>0).map(Et=>Et.name):[],Tt=jt.length?this.#l("gantt.histogram.tipTasks",{tasks:jt.join(", ")}):"",Ht=V?this.#l("gantt.histogram.tipOver"):"";return this.#l("gantt.histogram.tip",{name:e,from:mt,to:Mt,value:Dt,capacity:`${Ot}${Ht}`,tasks:Tt})}#ke(e){const i=e.target&&e.target.closest?e.target.closest(`.${t}__hg-bargroup`):null;if(!i||!this.#w){this.#vt();return}const s=i.getAttribute("aria-label");if(!s){this.#vt();return}M(this.#w,s),this.#w.removeAttribute("hidden"),this.#jt(e)}#jt(e){if(!this.#w||this.#w.hasAttribute("hidden")||!this.#m)return;const i=this.#m.getBoundingClientRect?this.#m.getBoundingClientRect():{left:0,top:0},s=Number.isFinite(e.clientX)?e.clientX:0,v=Number.isFinite(e.clientY)?e.clientY:0;this.#w.style.left=`${s-i.left+12}px`,this.#w.style.top=`${v-i.top-28}px`}#we(e){const i=e.target&&e.target.closest?e.target.closest(`.${t}__hg-bargroup`):null;if(!i||!this.#w)return;const s=i.getAttribute("aria-label");if(!s||(M(this.#w,s),this.#w.removeAttribute("hidden"),!this.#m||!i.getBoundingClientRect))return;const v=this.#m.getBoundingClientRect(),V=i.getBoundingClientRect();this.#w.style.left=`${V.left-v.left}px`,this.#w.style.top=`${V.top-v.top-28}px`}#vt(){this.#w&&this.#w.setAttribute("hidden","")}#ve(e){const i=e.key;if(i!=="ArrowLeft"&&i!=="ArrowRight"&&i!=="ArrowUp"&&i!=="ArrowDown")return;const s=e.target&&e.target.closest?e.target.closest(`.${t}__hg-bargroup`):null;if(!s)return;const v=s.getAttribute("data-resource")||"",V=Number(s.getAttribute("data-bucket-index")),U=this.#p;if(U){if(i==="ArrowLeft"||i==="ArrowRight"){const Z=i==="ArrowRight"?1:-1,mt=[...U.querySelectorAll(`.${t}__hg-bargroup[data-resource="${v}"]`)].sort((Mt,Dt)=>Number(Mt.getAttribute("data-bucket-index"))-Number(Dt.getAttribute("data-bucket-index"))).find(Mt=>Number(Mt.getAttribute("data-bucket-index"))===V+Z);mt&&this.#Et(v,V+Z,mt)}else{const Z=[...new Set([...U.querySelectorAll(`.${t}__hg-bargroup`)].map(Ot=>Ot.getAttribute("data-resource")))],ft=Z.indexOf(v),Mt=Z[ft+(i==="ArrowDown"?1:-1)];if(Mt==null)return;const Dt=U.querySelector(`.${t}__hg-bargroup[data-resource="${Mt}"][data-bucket-index="${V}"]`);Dt&&this.#Et(Mt,V,Dt)}e.preventDefault&&e.preventDefault()}}#Et(e,i,s){this.#kt.set(e,i);const v=this.#p;if(v)for(const V of v.querySelectorAll(`.${t}__hg-bargroup[data-resource="${e}"]`))V.setAttribute("tabindex",V===s?"0":"-1");s.focus&&s.focus()}#$e(e,i,s,v){if(!this.#m)return;const V=this.#m.querySelector(`.${t}__hg-table`);V&&V.parentNode&&V.parentNode.removeChild(V);const U=rt(this.#t,"div",`${t}__hg-table`),Z=this.#t.createElement("table"),ft=this.#t.createElement("caption");M(ft,this.#l("gantt.histogram.tableTitle")),Z.appendChild(ft);const mt=this.#t.createElement("tr"),Mt=v.unit==="percent"?"gantt.histogram.percent":v.unit==="cost"?"gantt.histogram.cost":"gantt.histogram.hours";for(const Dt of["gantt.histogram.resource","gantt.histogram.period",Mt,"gantt.histogram.capacity","gantt.histogram.overAllocated"]){const Ot=this.#t.createElement("th");M(Ot,this.#l(Dt)),mt.appendChild(Ot)}Z.appendChild(mt);for(const Dt of e){const Ot=Dt??"",jt=Dt??this.#l("gantt.workload.unassigned"),Tt=i.get(Ot),Ht=v.unit==="cost"&&Tt&&Tt.costCells!=null;s.forEach((Et,Lt)=>{const Ut=Tt&&(Ht?Tt.costCells[Lt]:Tt.cells[Lt])||0,Pt=!Ht&&Tt&&Tt.available?Tt.available[Lt]:null,Xt=Pt!=null&&Ut>Pt,Gt=this.#t.createElement("tr"),Nt=this.#t.createElement("th");M(Nt,jt),Gt.appendChild(Nt);const Wt=this.#t.createElement("td");M(Wt,`${A(Et.start)??Et.start} – ${A(Et.end-1)??Et.end-1}`),Gt.appendChild(Wt);const Qt=this.#t.createElement("td");if(v.unit==="percent"&&Pt!=null){const se=b(Ut,Pt,0);M(Qt,se==="–"?se:`${se}%`)}else Ht?M(Qt,x(Ut,2)):M(Qt,N(Ut,1));Gt.appendChild(Qt);const Zt=this.#t.createElement("td");M(Zt,Pt!=null?N(Pt,1):""),Gt.appendChild(Zt);const oe=this.#t.createElement("td");M(oe,this.#l(Xt?"gantt.histogram.yes":"gantt.histogram.no")),Gt.appendChild(oe),Z.appendChild(Gt)})}U.appendChild(Z),this.#m.appendChild(U)}toggleResource(e){const i=String(e);this.#X.has(i)?this.#X.delete(i):this.#X.add(i),this.draw()}getWorkloadUnit(){return this.#h?this.#h.unit:this.#f?this.#f.unit:ot.unit}setWorkloadUnit(e){const i=W.has(e)?e:"hours";if(i===this.getWorkloadUnit()&&!(this.#h&&this.#f&&this.#h.unit!==this.#f.unit)||(this.#h&&(this.#h.unit=i),this.#f&&(this.#f.unit=i),!this.#h&&!this.#f))return;this.draw();const s=i==="percent"?"gantt.workload.unitPercent":i==="cost"?"gantt.workload.unitCost":"gantt.workload.unitHours";this.#wt(this.#l(s),{repeat:!0})}get expandedResources(){return new Set(this.#X)}#Se(e,i,s,v,V,U){const Z=Q(this.#t,"g",{class:`${t}__links`}),ft=mt=>{const Mt=V[v.get(mt)];return Mt.top+Mt.height/2};for(const mt of this.#n.dependencies){const Mt=String(mt.from),Dt=String(mt.to);if(!v.has(Mt)||!v.has(Dt))continue;const Ot=i.tasks.get(Mt),jt=i.tasks.get(Dt);if(!Ot||!jt)continue;const Tt=mt.type?String(mt.type).toUpperCase():"FS",Ht=Tt==="FS"||Tt==="FF"?Ot.ef:Ot.es,Et=Tt==="FF"||Tt==="SF"?jt.ef:jt.es,Lt=U(Ht),Ut=ft(Mt),Pt=U(Et),Xt=ft(Dt),Gt=Ot.critical&&jt.critical,Nt=g({sx:Lt,sy:Ut,ex:Pt,ey:Xt,type:Tt,elbow:10,rowGap:V[v.get(Mt)].height/2}),Wt=Q(this.#t,"path",{class:`${t}__link${Gt?` ${t}__link--critical`:""}`,d:Nt.d});Wt.setAttribute("data-from",Mt),Wt.setAttribute("data-to",Dt),Wt.setAttribute("data-type",Tt),Wt.setAttribute("data-route",Nt.route),Z.appendChild(Wt),Z.appendChild(Q(this.#t,"path",{class:`${t}__arrowhead${Gt?` ${t}__arrowhead--critical`:""}`,d:y(Pt,Xt,Nt.arrowDir)}))}e.appendChild(Z)}#_e(e){const i=this.#e.barLabel;if(typeof i=="function")return String(i(e)??"");switch(i){case"none":return"";case"percent":return e.percentComplete==null?"":`${Math.round(e.percentComplete)}%`;case"dates":return`${this.#xt(e.es)} – ${this.#xt(e.ef)}`;default:return e.name}}#xt(e){const i=L(e);return i?`${String(i.getUTCDate()).padStart(2,"0")} ${wt[i.getUTCMonth()]}`:A(e)??String(e)}#Ft(e){return!e||e.editable===!1?null:e.editField?String(e.editField):e.kind==="name"?"name":e.kind==="progress"?"percentComplete":T.has(e.kind)||nt.has(e.kind)?e.kind:e.editable===!0?e.key:null}#Ct(e,i){if(e==="duration")return String(l(i.duration));const s=e==="start"?i.es:i.ef;return A(s)??String(l(s))}#At(e){const i=this.#n.schedule;return i&&i.ok&&i.tasks.get(String(e))||null}#xe(e){const i=String(e??"").trim();if(i==="")return null;if(/^-?\d+(\.\d+)?$/.test(i))return Number(i);const s=B(i);return Number.isFinite(s)?s:null}#Ce(e){if(this.#H)return;const i=e.target,s=i&&i.closest?i.closest(`.${t}__cell`):null;if(!s)return;const v=s.closest(`.${t}__row`);if(!v)return;const V=v.getAttribute("data-task"),U=this.#o[Number(s.getAttribute("data-col"))],Z=this.#Ft(U);if(!V||!Z)return;const ft=this.#n.schedule&&this.#n.schedule.ok?this.#n.schedule.tasks.get(V):null;ft&&ft.isSummary||this.#Ae(s,V,Z,U)}#Ae(e,i,s,v){const V=this.#n.taskById(i)||{},U=this.#At(i),Z=s==="percentComplete"||s==="duration"||nt.has(s)||v.kind==="progress"||v.kind==="number";let ft;for(s==="duration"&&U?ft=l(U.duration):nt.has(s)&&U?ft=this.#Mt(s,U).replace("%",""):s==="start"&&U?ft=this.#Ct("start",U):s==="end"&&U?ft=this.#Ct("end",U):s==="percentComplete"&&U&&U.percentComplete!=null?ft=U.percentComplete:ft=V[s]==null?"":V[s];e.firstChild;)e.removeChild(e.firstChild);const mt=this.#t.createElement("input");mt.setAttribute("class",`${t}__editor`);const Mt=/^\d{4}-\d{2}-\d{2}$/.test(String(ft));mt.setAttribute("type",Z?"number":Mt?"date":"text"),mt.value=String(ft),e.appendChild(mt),this.#H=!0,mt.focus&&mt.focus();let Dt=!1;const Ot=jt=>{Dt||(Dt=!0,this.#H=!1,jt?this.#De(i,s,mt.value,Z):this.draw())};mt.addEventListener("keydown",jt=>{jt.key==="Enter"?(jt.preventDefault&&jt.preventDefault(),Ot(!0)):jt.key==="Escape"&&(jt.preventDefault&&jt.preventDefault(),Ot(!1))}),mt.addEventListener("blur",()=>Ot(!0))}#De(e,i,s,v){if(i==="start"||i==="end"){const U=this.#xe(s),Z=this.#At(e);if(U==null||!Z){this.draw();return}i==="start"?this.#n.applyEdit({id:e,start:U},{writeBack:!0}):this.#n.applyEdit({id:e,duration:Math.max(0,Z.duration+(U-Z.ef))},{writeBack:!0}),this.draw();return}let V=s;if(v){const U=Number(s);if(!Number.isFinite(U)){this.draw();return}i==="percentComplete"?V=Math.max(0,Math.min(100,U)):i==="duration"||i==="effort"?V=Math.max(0,U):i==="units"?V=Math.max(0,U)/100:V=U}this.#n.applyEdit({id:e,[i]:V},{writeBack:!0}),this.draw()}#Me(e){if(this.#H||!this.#e.editable)return;const i=e.target,s=i&&i.closest?i.closest(`.${t}__wl-bucket`):null;if(!s||!s.getAttribute("data-bucket-index"))return;const v=s.closest(`.${t}__wl-timerow`),V=v?v.getAttribute("data-task"):null;V&&this.#Ne(s,V,v.getAttribute("data-resource")||"",Number(s.getAttribute("data-bucket-index")))}#Ne(e,i,s,v){const V=e.getAttribute("data-hours"),U=this.#h;for(;e.firstChild;)e.removeChild(e.firstChild);const Z=this.#t.createElement("input");Z.setAttribute("class",`${t}__wl-editor`),Z.setAttribute("type","number");let ft=null;if(U.unit==="percent"){const Dt=this.#Y&&this.#Y.rows?this.#Y.rows.find(Ot=>(Ot.resource==null?"":Ot.resource)===s):null;ft=Dt&&Dt.available?Dt.available[v]:null}Z.value=V==null?"":ft!=null&&ft>0?b(Number(V),ft,U.decimals):N(Number(V),U.decimals),e.appendChild(Z),this.#H=!0,Z.focus&&Z.focus();let mt=!1;const Mt=Dt=>{mt||(mt=!0,this.#H=!1,Dt?this.#Te(i,s,v,Z.value):this.draw())};Z.addEventListener("keydown",Dt=>{Dt.key==="Enter"?(Dt.preventDefault&&Dt.preventDefault(),Mt(!0)):Dt.key==="Escape"&&(Dt.preventDefault&&Dt.preventDefault(),Mt(!1))}),Z.addEventListener("blur",()=>Mt(!0))}#Te(e,i,s,v){const V=this.#h,U=this.#Y,Z=U&&U.buckets?U.buckets[s]:null,ft=U&&U.rows?U.rows.find(Zt=>(Zt.resource==null?"":Zt.resource)===i):null,mt=ft&&ft.tasks?ft.tasks.find(Zt=>String(Zt.id)===String(e)):null,Mt=this.#At(e);if(!V||!Z||!mt||!Mt){this.draw();return}const Dt=String(v??"").trim(),Ot=Dt===""?0:Number(Dt);if(!Number.isFinite(Ot)||Ot<0){this.draw();return}let jt=Ot;if(V.unit==="percent"){const Zt=ft.available?ft.available[s]:null;Zt!=null&&Zt>0&&(jt=Ot/100*Zt)}const Tt=this.#bt(),Ht=Tt?Zt=>!Tt(Zt):null,Et=[];for(let Zt=Math.floor(Z.start);Zt<Math.ceil(Z.end);Zt+=1)(!Ht||Ht(Zt))&&Et.push(Zt);const Lt=A(Z.start)??String(Z.start);if(!Et.length){this.#wt(this.#l("gantt.a11y.hoursRefused",{name:mt.name,date:Lt}),{repeat:!0}),this.draw();return}const Ut=At(Mt,Ht),Pt=Et.filter(Zt=>Ut.includes(Zt)),Xt=Pt.length?Pt:Et,Gt=mt.raw||{};let Nt=X(Gt);if(!Nt){const Zt=z(Gt),oe=Zt??Ut.length*V.hoursPerDay*mt.unitsTotal;Nt=st(Ut,oe)}const Wt=mt.units>0?mt.unitsTotal/mt.units:1,Qt=p(Nt,Z,Xt,jt*Wt);this.#n.applyEdit({id:e,work:St(Qt)},{writeBack:!0}),this.#wt(jt>0?this.#l("gantt.a11y.hoursSet",{name:mt.name,hours:N(jt,V.decimals),date:Lt}):this.#l("gantt.a11y.hoursCleared",{name:mt.name,date:Lt}),{repeat:!0}),this.draw()}#Pe(e){const i=new Map,s=new Map;for(const U of this.#n.dependencies){const Z=String(U.from),ft=String(U.to);(s.get(Z)||s.set(Z,[]).get(Z)).push(ft),(i.get(ft)||i.set(ft,[]).get(ft)).push(Z)}const v=new Set([e]),V=U=>{const Z=[e];for(;Z.length;){const ft=Z.pop();for(const mt of U.get(ft)||[])v.has(mt)||(v.add(mt),Z.push(mt))}};return V(i),V(s),v}#Oe(e){if(!this.#r)return;this.#Dt();const i=this.#Pe(e);for(const v of i){const V=this.#c&&this.#c.querySelector(`.${t}__row[data-task="${v}"]`);V&&V.classList.add(`${t}__row--chain`)}const s=this.#s;if(s){for(const v of s.querySelectorAll(`.${t}__link`)){const V=v.getAttribute("data-from"),U=v.getAttribute("data-to");i.has(V)&&i.has(U)&&v.classList.add(`${t}__link--chain`)}for(const v of i){const V=s.querySelector(`.${t}__barrow[data-task="${v}"]`);if(!V)continue;const U=V.querySelector(`.${t}__bar`)||V.querySelector(`.${t}__milestone`)||V.querySelector(`.${t}__summary-bar`);if(!U)continue;const Z=U.getAttribute("class")||"";Z.includes(`${t}__milestone`)?U.classList.add(`${t}__milestone--chain`):Z.includes(`${t}__summary-bar`)?U.classList.add(`${t}__summary-bar--chain`):U.classList.add(`${t}__bar--chain`)}}}#Dt(){if(this.#r)for(const e of["__row--chain","__link--chain","__bar--chain","__milestone--chain","__summary-bar--chain"])for(const i of this.#r.querySelectorAll(`.${t}${e}`))i.classList.remove(`${t}${e}`)}#je(e){if(this.#H||this.#N&&this.#N.dragging)return;const i=e.target,s=i&&i.closest?i.closest(`.${t}__row`)||i.closest(`.${t}__barrow`):null,v=s?s.getAttribute("data-task"):null;v?this.#Oe(v):this.#Dt()}toSVG(e={}){return this.#rt?h(this.#rt,e):""}async toPNG(e={}){const i=this.toSVG(e);if(!i)return null;const s=/width="(\d+)" height="(\d+)"/.exec(i),v=s?Number(s[1]):0,V=s?Number(s[2]):0;if(!v||!V)return null;const U=this.#t&&this.#t.defaultView||globalThis,Z=e.scale||U.devicePixelRatio||1,ft="background"in e?e.background:"#ffffff";return _(this.#t,i,v,V,Z,ft)}print(e={}){if(!this.#rt)return It("gantt-print-not-drawn","[lattice] gantt: print() called before anything was drawn; nothing to print."),!1;const i=this.#n.grid,s=i&&i.messages,v=s&&s.locale||void 0,V=k(this.#rt,{...e,title:e.title===!1?!1:e.title||this.#rt.title||this.#n.title||null,locale:v,t:this.#l});return j(this.#t,V)}destroy(){this.#ct||(this.#ct=!0,this.#V&&this.#V.close(),this.#rt=null,this.#F&&this.#s&&this.#s.removeEventListener("scroll",this.#F),this.#F=null,this.#T&&this.#c&&this.#c.removeEventListener("scroll",this.#T),this.#T=null,this.#et&&this.#$&&this.#$.removeEventListener("scroll",this.#et),this.#et=null,this.#nt&&this.#$&&this.#$.removeEventListener("dblclick",this.#nt),this.#nt=null,this.#Y=null,this.#p&&(this.#ut&&this.#p.removeEventListener("scroll",this.#ut),this.#dt&&this.#p.removeEventListener("pointerover",this.#dt),this.#ft&&this.#p.removeEventListener("pointermove",this.#ft),this.#ht&&this.#p.removeEventListener("pointerleave",this.#ht),this.#pt&&this.#p.removeEventListener("focus",this.#pt,!0),this.#gt&&this.#p.removeEventListener("blur",this.#gt,!0),this.#mt&&this.#p.removeEventListener("keydown",this.#mt)),this.#ut=this.#dt=this.#ft=this.#ht=null,this.#pt=this.#gt=this.#mt=null,this.#$t=null,this.#w=null,this.#kt.clear(),this.#b&&(this.#c&&(this.#c.removeEventListener("pointerover",this.#b),this.#c.removeEventListener("pointerleave",this.#D)),this.#s&&(this.#s.removeEventListener("pointerover",this.#b),this.#s.removeEventListener("pointerleave",this.#D))),this.#b=this.#D=null,this.#M&&this.#c&&this.#c.removeEventListener("dblclick",this.#M),this.#M=null,this.#s&&(this.#P&&this.#s.removeEventListener("pointerdown",this.#P),this.#O&&this.#s.removeEventListener("keydown",this.#O)),this.#j&&this.#r&&this.#r.removeEventListener("keydown",this.#j),this.#P=this.#O=this.#j=null,this.#s&&(this.#B&&this.#s.removeEventListener("pointermove",this.#B),this.#G&&(this.#s.removeEventListener("pointerleave",this.#G),this.#s.removeEventListener("blur",this.#G,!0)),this.#Q&&this.#s.removeEventListener("focus",this.#Q,!0),this.#tt&&this.#s.removeEventListener("keydown",this.#tt)),this.#B=this.#G=this.#Q=this.#tt=null,this.#k=this.#J=this.#L=this.#I=null,this.#N&&(this.#N.destroy(),this.#N=null),this.#R=null,this.#C&&this.#C(),this.#C=null,this.#r&&this.#r.parentNode&&this.#r.parentNode.removeChild(this.#r),this.#r=null,this.#a=this.#c=this.#u=this.#s=null,this.#z=this.#E=this.#Z=this.#$=null,this.#m=this.#W=this.#q=this.#p=null)}}function ie(O,e,i={}){return new de(O,e,i)}}),ae("packages/modules/gantt/scurve.js",function(m,bt){"use strict";Object.defineProperty(m,"SCURVE_NS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(m,"computeSCurve",{enumerable:!0,get:function(){return pt}}),Object.defineProperty(m,"GanttSCurveView",{enumerable:!0,get:function(){return N}});const Vt=bt("packages/modules/charts/svg.js"),vt=Vt.svg,lt=Vt.el,Q=Vt.setText,rt=Vt.path,M=Vt.round,at=bt("packages/modules/charts/scale.js"),l=at.linearScale,J=at.measureDomain,f=bt("packages/modules/gantt/time.js"),S=f.toDayNumber,L=f.toISODate,A=f.fromDayNumber,G=bt("packages/modules/gantt/schedule.js").taskIdReader,w=bt("packages/modules/gantt/earned-value.js").computeEarnedValue,y=bt("packages/modules/gantt/messages.js").createTranslator,H=1e-9,F="lat-gantt-scurve",et="data-lat-gantt-scurve-styles",it=Object.freeze({width:640,height:220,bucket:"day",statusDate:null,costField:"cost",actualCostField:"actualCost"});function $(b){if(b==null||b==="")return null;const x=typeof b=="number"?b:Number(b);return Number.isFinite(x)?x:null}function Y(b,x,z){return z-x<=H?b>=z?1:0:b<=x?0:b>=z?1:(b-x)/(z-x)}function R(b,x,z){if(b.pct>=1){const X=Math.min(b.rec.ef,z);return x>=X?b.bac:0}return b.pct>0&&x>=z?b.bac*b.pct:0}function dt(b,x,z){const X=[];if(!(z>x))return X;if(b==="day"){for(let st=x;st<z;st+=1)X.push({start:st,end:st+1});return X}if(b==="week"){for(let st=x;st<z;st+=7)X.push({start:st,end:Math.min(z,st+7)});return X}const p=A(x);if(!p)return X;let St=Date.UTC(p.getUTCFullYear(),p.getUTCMonth(),1)/864e5;for(;St<z;){const st=A(St),At=Date.UTC(st.getUTCFullYear(),st.getUTCMonth()+1,1)/864e5;X.push({start:St,end:Math.min(z,At)}),St=At}return X}function pt(b,x,z={}){if(!x||!x.ok||!x.tasks||!x.order)return[];const X=z.costField||"cost",p=z.actualCostField||"actualCost",St=z.bucket==="week"||z.bucket==="month"?z.bucket:"day",st=z.statusDate==null?x.projectFinish:S(z.statusDate)??x.projectFinish,At=z.rateCosts instanceof Map?z.rateCosts:null,zt=G(z.fields),It=new Map;for(const j of Array.isArray(b)?b:[]){const P=zt(j);P!=null&&It.set(String(P),j)}const a=[];for(const j of x.order){const P=x.tasks.get(j);if(!P||P.isSummary)continue;const I=It.get(j),r=I?$(I[X]):null,o=At?At.get(j):null,n=r??(o&&o.hasRate?o.cost:P.duration),u=I?$(I[p]):null,t=P.percentComplete==null?0:Math.max(0,Math.min(100,P.percentComplete))/100,d=P.baselineStart!=null?P.baselineStart:P.es,c=P.baselineEnd!=null?P.baselineEnd:P.ef;a.push({rec:P,bac:n,pct:t,ac:u,bStart:d,bEnd:c})}const h=Math.floor(x.projectStart),k=Math.ceil(x.projectFinish),_=[];for(const j of dt(St,h,k)){const P=j.end;let I=0,r=0,o=0;for(const n of a)I+=n.bac*Y(P,n.bStart,n.bEnd),r+=R(n,P,st),n.ac!=null&&P>=st&&(o+=n.ac);_.push({date:P,pv:I,ev:r,ac:o})}return _}function xt(){const b=F;return`
|
|
226
|
-
.${
|
|
227
|
-
.${
|
|
228
|
-
.${
|
|
229
|
-
.${
|
|
230
|
-
.${
|
|
231
|
-
.${
|
|
232
|
-
.${
|
|
233
|
-
.${
|
|
234
|
-
.${
|
|
235
|
-
.${
|
|
236
|
-
.${
|
|
237
|
-
.${
|
|
238
|
-
.${
|
|
239
|
-
.${
|
|
240
|
-
.${
|
|
241
|
-
.${
|
|
242
|
-
.${
|
|
243
|
-
.${
|
|
244
|
-
.${
|
|
245
|
-
@scope ([data-theme="dark"]){:scope.${
|
|
246
|
-
@scope ([data-theme="light"],[data-theme="auto"]){:scope.${
|
|
247
|
-
@media (prefers-color-scheme:dark){@scope ([data-theme="auto"]){:scope.${
|
|
248
|
-
`.trim()}function ot(b){const x=b.documentElement;if(!x||x.getAttribute(et))return;x.setAttribute(et,"1");const z=b.createElement("style");z.textContent=xt(),(b.head||b.body||x).appendChild(z)}function _t(b){const x=Number.isFinite(b)?b:0,z=Math.abs(x-Math.round(x))<1e-9?Math.round(x):M(x);return String(z).replace(/\B(?=(\d{3})+(?!\d))/g,",")}function D(b){return L(b)??String(b)}function K(b){return b==null||!Number.isFinite(b)?"—":b.toFixed(2)}class N{#n;#i;#t;#e;#o=null;#r=null;#a=!1;#c;constructor(x,z,X={}){this.#n=x,this.#i=z,this.#t=z.ownerDocument,this.#e={...it,...X},this.#c=y(x,()=>this.#e.messages),ot(this.#t),this.#o=lt(this.#t,"div",F),this.#i.appendChild(this.#o),this.#r=x.on("schedule",()=>this.draw()),this.draw()}get element(){return this.#o}get options(){return{...this.#e}}#u(){if(this.#e.statusDate!=null){const z=S(this.#e.statusDate);if(Number.isFinite(z))return z}const x=this.#n.schedule;return x&&x.ok?x.projectFinish:0}draw(){if(this.#a||!this.#o)return;for(;this.#o.firstChild;)this.#o.removeChild(this.#o.firstChild);const x=this.#n.schedule;if(!x||!x.ok)return;const z=Math.max(80,Number(this.#e.width)||640),X=Math.max(80,Number(this.#e.height)||220),p={top:16,right:16,bottom:26,left:48},St=this.#u(),st=pt(this.#n.tasks,x,{statusDate:St,bucket:this.#e.bucket,costField:this.#e.costField,actualCostField:this.#e.actualCostField}),At=vt(this.#t,"svg",{class:`${F}__plot`,width:z,height:X,viewBox:`0 0 ${z} ${X}`,role:"img","aria-label":"S-curve: cumulative planned value, earned value and actual cost"});if(this.#o.appendChild(At),!st.length)return;const zt={min:Math.floor(x.projectStart),max:Math.ceil(x.projectFinish)},It=l(zt,[p.left,z-p.right]),a=J(st.flatMap(r=>[r.pv,r.ev,r.ac]),{zero:!0}),h=l(a,[X-p.bottom,p.top]),k=z-p.left-p.right;for(const r of h.ticks(5)){const o=M(h.of(r));At.appendChild(vt(this.#t,"line",{class:`${F}__grid`,x1:p.left,y1:o,x2:z-p.right,y2:o}));const n=vt(this.#t,"text",{class:`${F}__ticklabel`,x:p.left-6,y:o+3,"text-anchor":"end"});Q(n,_t(r)),At.appendChild(n)}const _=It.ticks(Math.max(2,Math.min(8,Math.floor(k/60))));for(const r of _){const o=M(It.of(r)),n=vt(this.#t,"text",{class:`${F}__ticklabel`,x:o,y:X-p.bottom+14,"text-anchor":"middle"});Q(n,D(r)),At.appendChild(n)}At.appendChild(vt(this.#t,"line",{class:`${F}__axis`,x1:p.left,y1:X-p.bottom,x2:z-p.right,y2:X-p.bottom})),At.appendChild(vt(this.#t,"line",{class:`${F}__axis`,x1:p.left,y1:p.top,x2:p.left,y2:X-p.bottom}));for(const r of["pv","ev","ac"]){const o=[];for(const u of st)o.push(o.length?"L":"M",M(It.of(u.date)),M(h.of(u[r])));const n=vt(this.#t,"path",{class:`${F}__series ${F}__series--${r}`,d:rt(o),"data-series":r});At.appendChild(n)}if(St>=zt.min&&St<=zt.max){const r=M(It.of(St));At.appendChild(vt(this.#t,"line",{class:`${F}__status`,x1:r,y1:p.top,x2:r,y2:X-p.bottom,"data-status":String(St)}))}const j=w(this.#n.tasks,x,{statusDate:St,costField:this.#e.costField,actualCostField:this.#e.actualCostField}),P=lt(this.#t,"div",`${F}__legend`);for(const[r,o]of[["pv","PV"],["ev","EV"],["ac","AC"]]){const n=lt(this.#t,"span",`${F}__legend-item`),u=lt(this.#t,"span",`${F}__swatch ${F}__swatch--${r}`);u.setAttribute("aria-hidden","true"),n.appendChild(u),n.appendChild(this.#t.createTextNode(o)),P.appendChild(n)}const I=lt(this.#t,"span",`${F}__index`);Q(I,`${this.#c("gantt.scurve.spi",{index:K(j.project.spi)})} · ${this.#c("gantt.scurve.cpi",{index:K(j.project.cpi)})}`),P.appendChild(I),this.#o.appendChild(P),this.#o.appendChild(this.#s(st))}#s(x){const z=lt(this.#t,"table",`${F}__table`),X=lt(this.#t,"thead",""),p=lt(this.#t,"tr","");for(const st of["Date","PV","EV","AC"]){const At=lt(this.#t,"th","");Q(At,st),p.appendChild(At)}X.appendChild(p),z.appendChild(X);const St=lt(this.#t,"tbody","");for(const st of x){const At=lt(this.#t,"tr","");for(const zt of[D(st.date),_t(st.pv),_t(st.ev),_t(st.ac)]){const It=lt(this.#t,"td","");Q(It,zt),At.appendChild(It)}St.appendChild(At)}return z.appendChild(St),z}refresh(){this.draw()}destroy(){this.#a||(this.#a=!0,this.#r&&this.#r(),this.#r=null,this.#o&&this.#o.parentNode&&this.#o.parentNode.removeChild(this.#o),this.#o=null)}}}),ae("packages/modules/gantt/index.js",function(m,bt){"use strict";Object.defineProperty(m,"GANTT_STATE_VERSION",{enumerable:!0,get:function(){return j}}),Object.defineProperty(m,"createGantt",{enumerable:!0,get:function(){return r}}),Object.defineProperty(m,"default",{enumerable:!0,get:function(){return o}});const Vt=bt("packages/core/src/internal/util.js"),vt=Vt.warnOnce,lt=Vt.isObject,rt=bt("packages/modules/shared/emitter.js").Emitter,at=bt("packages/core/src/model/history.js").HistoryModel,l=bt("packages/modules/gantt/schedule.js"),J=l.computeSchedule,f=l.findViolations,S=l.normalizeLinkSpec,L=l.taskIdReader,A=l.taskFieldWriters,B=l.resolveSchedulingMode,G=l.reconcileEffort,tt=bt("packages/modules/gantt/resources.js"),w=tt.computeResourceLoad,g=tt.levelResources,y=tt.normalizeResources,H=tt.resourceDailyHours,F=tt.parseAssignments,et=tt.normalizeResourceRates,it=bt("packages/modules/gantt/cost.js"),$=it.computeCost,Y=bt("packages/modules/gantt/earned-value.js"),R=Y.computeEarnedValue,dt=bt("packages/modules/gantt/mspdi.js"),pt=dt.importMSPDI,xt=dt.exportMSPDI,ot=bt("packages/modules/gantt/time.js"),_t=ot.toISODate,D=ot.toDayNumber,N=bt("packages/modules/gantt/calendar.js").createCalendar,b=bt("packages/modules/gantt/workload.js"),x=b.taskContour,z=b.contourSpan,X=b.spanDuration,p=b.retimeContour,St=b.recordWorkingDays,st=b.serializeContour,zt=bt("packages/modules/gantt/render.js").GanttView,a=bt("packages/modules/gantt/split.js").GanttSplitView,h=bt("packages/modules/gantt/scurve.js"),k=h.GanttSCurveView,_=h.computeSCurve;Object.defineProperty(m,"computeSchedule",{enumerable:!0,get:function(){return l.computeSchedule}}),Object.defineProperty(m,"findViolations",{enumerable:!0,get:function(){return l.findViolations}}),Object.defineProperty(m,"normalizeTasks",{enumerable:!0,get:function(){return l.normalizeTasks}}),Object.defineProperty(m,"normalizeDependencies",{enumerable:!0,get:function(){return l.normalizeDependencies}}),Object.defineProperty(m,"topoOrder",{enumerable:!0,get:function(){return l.topoOrder}}),Object.defineProperty(m,"LINK_TYPES",{enumerable:!0,get:function(){return l.LINK_TYPES}}),Object.defineProperty(m,"SCHEDULE_ERROR",{enumerable:!0,get:function(){return l.SCHEDULE_ERROR}}),Object.defineProperty(m,"EPS",{enumerable:!0,get:function(){return l.EPS}}),Object.defineProperty(m,"CONSTRAINT_TYPES",{enumerable:!0,get:function(){return l.CONSTRAINT_TYPES}}),Object.defineProperty(m,"SCHEDULING_MODES",{enumerable:!0,get:function(){return l.SCHEDULING_MODES}}),Object.defineProperty(m,"resolveSchedulingMode",{enumerable:!0,get:function(){return l.resolveSchedulingMode}}),Object.defineProperty(m,"reconcileEffort",{enumerable:!0,get:function(){return l.reconcileEffort}}),Object.defineProperty(m,"toDayNumber",{enumerable:!0,get:function(){return ot.toDayNumber}}),Object.defineProperty(m,"fromDayNumber",{enumerable:!0,get:function(){return ot.fromDayNumber}}),Object.defineProperty(m,"toISODate",{enumerable:!0,get:function(){return ot.toISODate}}),Object.defineProperty(m,"importMSPDI",{enumerable:!0,get:function(){return dt.importMSPDI}}),Object.defineProperty(m,"exportMSPDI",{enumerable:!0,get:function(){return dt.exportMSPDI}}),Object.defineProperty(m,"computeEarnedValue",{enumerable:!0,get:function(){return Y.computeEarnedValue}}),Object.defineProperty(m,"computeCost",{enumerable:!0,get:function(){return it.computeCost}}),Object.defineProperty(m,"computeSCurve",{enumerable:!0,get:function(){return h.computeSCurve}});const j=1;function P(n){return Array.isArray(n)?"array":n===null?"null":typeof n}function I(n){return u=>{const t=n(u);if(typeof t=="string"||typeof t=="number"&&Number.isFinite(t))return t;throw new Error(`lattice-gantt: rowKey function must return a string or number; got ${P(t)}.`)}}function r(n={}){const u=new rt("gantt");let t=Array.isArray(n.tasks)?n.tasks.map(C=>({...C})):[],d=Array.isArray(n.dependencies)?n.dependencies.map(S):[];const c=n.projectStart,q=n.deadline,W=n.calendar??null,ht=N(W,D(c)??0),ut=ht?C=>ht.isWorking(C):null,kt=n.resources??null,ct=n.defaultCapacity,wt=typeof n.title=="string"?n.title:null,T=Number.isFinite(Number(n.hoursPerDay))&&Number(n.hoursPerDay)>0?Number(n.hoursPerDay):8,nt=B(n.schedulingMode)||"fixedDuration",Rt=!!n.effortDriven,Bt=!!n.autoSchedule,$t=n.grid??null,gt=n.columns&&typeof n.columns=="object"?{...n.columns}:null,Ft=lt(n.fields)?{...n.fields}:{};if(n.rowKey!==void 0&&typeof n.rowKey!="function"&&!(typeof n.rowKey=="string"&&n.rowKey.length>0))throw new Error("lattice-gantt: rowKey must be a property name or a function; composite keys are not supported on tasks.");const qt=typeof n.rowKey=="function"?I(n.rowKey):n.rowKey??(typeof Ft.id=="string"?Ft.id:"id"),re=C=>String(typeof qt=="function"?qt(C):C[qt]);Ft.id===void 0&&(Ft.id=C=>C&&C.id!=null?C.id:C?typeof qt=="function"?qt(C):C[qt]:null);const Jt=L(Ft),de=A(Ft),ie=C=>de[C]||C,O=new Map;if(gt)for(const C of["start","end","duration","percentComplete","name"])gt[C]&&O.set(gt[C],C);let e=null,i=!1,s=null,v=null,V=null,U=null,Z=null;const ft=new Set,mt=[];function Mt(){const C=H(kt,ct,{calendar:W,hoursPerDay:T}),E=J(t,d,{projectStart:c,deadline:q,calendar:W,fields:Ft,schedulingMode:n.schedulingMode!=null?nt:void 0,effortDriven:n.effortDriven!=null?Rt:void 0,hoursPerDay:T,resourceHours:C});if(E.ok){const Ct=w(t,E,{resources:kt,defaultCapacity:ct,calendar:W,fields:Ft,hoursPerDay:T});E.resourceLoad=Ct,E.overAllocations=Ct.overAllocations,e=E,u.emit("schedule",E)}else u.emit("error",E.error);return E}function Dt(C,E,Ct,yt,Yt){const te=ee=>{u.emit(E,{...Ct,reason:ee})},Kt=u.emitBefore(C,Ct);return Kt===!0?yt():Kt===!1?te(Ct.reason||"prevented"):Kt.then(ee=>ee?typeof Yt=="function"&&!Yt()?te("stale"):yt():te(Ct.reason||"prevented"))}function Ot(C){return t.findIndex(E=>String(Jt(E))===C)}function jt(C,E,Ct){const yt=Ot(C);if(yt<0)return;const Yt={...t[yt],[ie(E)]:Ct};t=t.slice(),t[yt]=Yt}function Tt(C,E){return t[C][ie(E)]}function Ht(C){const E=new Map;for(const Ct of Array.isArray(C)?C:[]){const yt=String((Ct&&typeof Ct=="object"?Ct.resource??Ct.name??Ct.id:Ct)??"");if(yt==="")continue;const Yt=Ct&&typeof Ct=="object"&&Ct.units!=null?Number(Ct.units):1;E.set(yt,{resource:yt,units:Number.isFinite(Yt)&&Yt>=0?Yt:1})}return[...E.values()]}function Et(C){const E=Ot(C),Ct=E>=0?t[E]:{},yt=e&&e.ok?e.tasks.get(C):null,Yt=F(Ct),te=yt&&yt.schedulingMode||B(Ct.schedulingMode??Ct.taskType)||nt,Kt=yt&&yt.effortDriven!=null?!!yt.effortDriven:Ct.effortDriven!=null?!!Ct.effortDriven:Rt,ee=yt&&yt.units!=null?yt.units:Yt.reduce((ke,pe)=>ke+pe.units,0)||1,ue=yt&&yt.duration!=null?yt.duration:Number(Ct.duration)||0,fe=yt&&yt.effort!=null&&yt.duration>0&&ee>0?yt.effort/(yt.duration*ee):T;return{mode:te,effortDriven:Kt,duration:ue,units:ee,hoursPerDay:fe,assignments:Yt}}function Lt(C,E,Ct){if(!E.length)return;const yt=E.reduce((Yt,te)=>Yt+te.units,0)||1;jt(C,"assignments",E.map(Yt=>({resource:Yt.resource,units:Yt.units*Ct/yt})))}function Ut(C){if(!$t||!$t.edit||typeof $t.edit.setCells!="function"||!gt||!e||!e.ok)return 0;const E=[];for(const Ct of C){const yt=e.tasks.get(Ct);!yt||yt.isSummary||(gt.start&&E.push({key:Ct,colId:gt.start,value:yt.es}),gt.end&&E.push({key:Ct,colId:gt.end,value:yt.ef}),gt.duration&&E.push({key:Ct,colId:gt.duration,value:yt.duration}))}if(!E.length)return 0;for(const Ct of E)ft.add([Ct.key,Ct.colId].join(""));return $t.edit.setCells(E,"cell")}function Pt(C,E,Ct={}){if(!$t||!$t.edit||typeof $t.edit.setCells!="function"||!gt)return 0;const yt=Ot(C);if(yt<0)return 0;const Yt=[];for(const te of E){if(!gt[te])continue;const Kt=te in Ct?Ct[te]:Tt(yt,te);Kt!==void 0&&Yt.push({key:C,colId:gt[te],value:Kt})}if(!Yt.length)return 0;for(const te of Yt)ft.add([te.key,te.colId].join(""));return $t.edit.setCells(Yt,"cell")}function Xt(C,E){const Ct=O.get(E.colId);if(!Ct)return;const yt=[E.key,E.colId].join(""),Yt=ft.delete(yt),te=String(E.key);C==="confirmed"?E.value!==void 0&&Gt(te,Ct,E.value)&&Mt():C==="reverted"&&Yt&&E.restored!==void 0?Gt(te,Ct,E.restored)&&Mt():C==="conflict"&&Yt&&E.value!==void 0&&Gt(te,Ct,E.value)&&Mt()}function Gt(C,E,Ct){const yt=Ot(C);if(yt<0)return!1;const Yt=Tt(yt,E);return Yt===Ct||String(Yt)===String(Ct)?!1:(jt(C,E,Ct),!0)}$t&&typeof $t.on=="function"&&(mt.push($t.on("cell:changed",C=>Xt("confirmed",C))),mt.push($t.on("cell:confirmed",C=>Xt("confirmed",C))),mt.push($t.on("cell:reverted",C=>Xt("reverted",C))),mt.push($t.on("cell:conflict",C=>Xt("conflict",C))));const Nt=Number.isFinite(Number(n.historyDepth))&&Number(n.historyDepth)>=0?Math.floor(Number(n.historyDepth)):100,Wt=new at({depth:Nt,apply:C=>{C&&Array.isArray(C.tasks)&&(t=C.tasks.map(E=>({...E}))),C&&Array.isArray(C.dependencies)&&(d=C.dependencies.map(E=>({...E}))),Mt()}});function Qt(){return{tasks:t.slice(),dependencies:d.slice()}}function Zt(C){u.emit("history",{canUndo:Wt.canUndo(),canRedo:Wt.canRedo(),label:C??null})}function oe(C,E,Ct,yt,Yt){if(Wt.replaying)return;const te=Wt.push({type:C,label:E,target:Ct==null?null:String(Ct),before:yt,after:Qt(),coalesce:!!Yt});te&&Zt(te.label)}Mt();const se={get tasks(){return t.map(C=>({...C}))},get dependencies(){return d.map(C=>({...C}))},readId(C){return Jt(C)},taskById(C){const E=Ot(C);return E<0?null:{...t[E]}},get schedule(){return e},get hoursPerDay(){return T},get critical(){return e&&e.ok?e.critical:[]},get conflicts(){return e&&e.ok?e.conflicts||[]:[]},get autoSchedule(){return Bt},get resourceLoad(){return e&&e.ok&&e.resourceLoad||null},get resourceModels(){return y(kt,ct,{calendar:W,hoursPerDay:T})},get resourceRates(){return et(kt)},get overAllocations(){return e&&e.ok?e.overAllocations||[]:[]},setTasks(C){return i?(vt("gantt-destroyed","[lattice] gantt: setTasks on a destroyed controller ignored."),e):(t=Array.isArray(C)?C.map(E=>({...E})):[],Wt.clear(),Zt(null),Mt())},setDependencies(C){if(i)return vt("gantt-destroyed","[lattice] gantt: setDependencies on a destroyed controller ignored."),e;const E=Array.isArray(C)?C.map(S):[],Ct=Kt=>`${String(Kt.from)}${String(Kt.to)}${Kt.type?String(Kt.type).toUpperCase():"FS"}`,yt=new Set(d.map(Ct)),Yt=E.filter(Kt=>!yt.has(Ct(Kt))),te=()=>{const Kt=Qt();d=E;const ee=Mt();return oe("link","link",null,Kt,!1),ee};return Yt.length?Dt("beforeDependencyCreate","dependencyCreate:cancelled",{added:Yt,dependencies:E,origin:"user"},te):te()},applyEdit(C,E={}){if(i)return vt("gantt-destroyed","[lattice] gantt: applyEdit on a destroyed controller ignored."),e;const Ct=lt(n.fields)?["start","end","duration","percentComplete","name"].filter(ge=>typeof n.fields[ge]=="function"):[];Ct.length&&vt("gantt-edit-mapped-field",`[lattice] gantt: this plan reads ${Ct.join(", ")} through a \`fields\` FUNCTION, which has no inverse, so applyEdit writes the canonical property name and the edit will not be read back. Map those fields to a field NAME instead, or edit the host row through your own writer and feed the result in with rows.apply.`);const yt=C&&C.id!=null?String(C.id):null;if(Ot(yt)<0)return vt(`gantt-edit-unknown-${yt}`,`[lattice] gantt: applyEdit for unknown task "${yt}" ignored.`),e;const Yt=Object.keys(C).filter(ge=>ge!=="id"&&C[ge]!==void 0),te=Yt.filter(ge=>ge!=="start"&&ge!=="end"&&ge!=="duration"),Kt={...t[Ot(yt)]},ee=e&&e.ok?e.tasks.get(yt):null,ue=ee?!!ee.isMilestone:!!Kt.milestone,fe=C.start!==void 0||C.end!==void 0,ke=C.duration!==void 0,pe=C.percentComplete!==void 0;let be="beforeTaskEdit",$e="taskEdit:cancelled";ue&&fe?(be="beforeMilestoneMove",$e="milestoneMove:cancelled"):pe?(be="beforeProgressChange",$e="progressChange:cancelled"):ke?(be="beforeTaskResize",$e="taskResize:cancelled"):fe&&(be="beforeTaskMove",$e="taskMove:cancelled");const Ee=Tt(Ot(yt),"start"),Re={id:yt,task:Kt,patch:{...C},origin:"user",from:Ee??(ee?ee.es:void 0),to:C.start,duration:C.duration,value:pe?C.percentComplete:void 0,oldValue:pe?Tt(Ot(yt),"percentComplete"):void 0};return Dt(be,$e,Re,()=>{const ge=Qt(),He=e&&e.ok?new Map([...e.tasks].map(([ne,le])=>[ne,le.es])):new Map,Ae=C.work===void 0&&(fe||ke)&&ee&&!ee.isSummary?x(t[Ot(yt)]):null,De=Ae&&Ae.length?St(ee,ut):null,he=Et(yt),Se=C.effort!==void 0||C.units!==void 0||C.addResource!==void 0||C.removeResource!==void 0||C.assignments!==void 0||C.duration!==void 0&&he.mode==="fixedEffort",Me=[];if(Se){Me.push("effort","units","addResource","removeResource","assignments","duration");let ne;if(C.assignments!==void 0){let le=Ht(C.assignments);const ce=le.length===he.assignments.length&&le.every(ye=>he.assignments.some(we=>we.resource===ye.resource)),me=le.reduce((ye,we)=>ye+we.units,0);ne={duration:he.duration,units:he.units,effort:void 0},le.length&&(ne=G({...he},{field:"units",value:me}),he.mode==="fixedDuration"&&he.effortDriven&&!ce&&(le=le.map(ye=>({resource:ye.resource,units:ye.units*he.units/(me||1)})),ne=G({...he},{field:"units",value:he.units}))),jt(yt,"assignments",le)}else if(C.addResource!==void 0||C.removeResource!==void 0){const le=C.addResource!==void 0,ce=le?C.addResource:C.removeResource,me=String((ce&&typeof ce=="object"?ce.resource??ce.name??ce.id:ce)??""),ye=ce&&typeof ce=="object"&&Number.isFinite(Number(ce.units))?Number(ce.units):1;ne=G({...he},{field:le?"addResource":"removeResource",units:ye});let we=le?[...he.assignments,{resource:me,units:ye}]:he.assignments.filter(Te=>Te.resource!==me);if(he.mode==="fixedDuration"&&he.effortDriven){const Te=we.reduce((xe,Ue)=>xe+Ue.units,0)||1;we=we.map(xe=>({resource:xe.resource,units:xe.units*ne.units/Te}))}jt(yt,"assignments",we)}else{const le=C.units!==void 0?"units":C.effort!==void 0?"effort":"duration",ce=C.units!==void 0?C.units:C.effort!==void 0?C.effort:C.duration;ne=G({...he},{field:le,value:Number(ce)}),Math.abs(ne.units-he.units)>1e-9&&Lt(yt,he.assignments,ne.units)}ne.duration!=null&&Number.isFinite(ne.duration)&&jt(yt,"duration",ne.duration),ne.effort!=null&&Number.isFinite(ne.effort)&&jt(yt,"effort",ne.effort)}for(const ne of Yt)Me.includes(ne)||jt(yt,ne,C[ne]);const Fe=Array.isArray(C.work)?x({work:C.work}):null;if(Fe&&C.start===void 0&&C.end===void 0&&C.duration===void 0){const ne=z(Fe);ne&&(jt(yt,"start",ne.first),jt(yt,"duration",X(ne.first,ne.last,ut)))}Mt();let Le=!1;if(De&&De.length&&e.ok){const ne=e.tasks.get(yt),le=ne&&!ne.isSummary?St(ne,ut):[];le.length&&(jt(yt,"work",st(p(Ae,De,le))),Le=!0,Mt())}const Ne=[yt];if(Bt&&e.ok){for(const ne of e.order){if(ne===yt)continue;const le=e.tasks.get(ne);le.isSummary||He.get(ne)!==le.es&&(jt(ne,"start",le.es),Ne.push(ne))}Ne.length>1&&Mt()}if(E.writeBack){Ut(Ne);const ne=Se?te.filter(ce=>!Me.includes(ce)):te,le=Le&&!ne.includes("work")?[...ne,"work"]:ne;if(le.length&&Pt(yt,le),Se&&e.ok){const ce=e.tasks.get(yt),me=Ot(yt);Pt(yt,["assignments","effort","units"],{assignments:me>=0?Tt(me,"assignments"):void 0,effort:ce&&ce.effort!=null?ce.effort:me>=0?Tt(me,"effort"):void 0,units:ce?ce.units:void 0})}}let ve="field",_e=!1;return C.work!==void 0?(ve="workload",_e=!0):Se?ve="assignment":be==="beforeTaskMove"||be==="beforeMilestoneMove"?(ve="move",_e=!0):be==="beforeTaskResize"?(ve="resize",_e=!0):be==="beforeProgressChange"&&(ve="progress"),oe(ve,ve,yt,ge,_e),e},()=>Ot(yt)>=0)},deleteTask(C){if(i)return vt("gantt-destroyed","[lattice] gantt: deleteTask on a destroyed controller ignored."),e;const E=C!=null?String(C):null;if(Ot(E)<0)return vt(`gantt-delete-unknown-${E}`,`[lattice] gantt: deleteTask for unknown task "${E}" ignored.`),e;const Ct={...t[Ot(E)]};return Dt("beforeTaskDelete","taskDelete:cancelled",{id:E,task:Ct,origin:"user"},()=>{const Yt=Qt();t=t.filter(Kt=>String(Jt(Kt))!==E),d=d.filter(Kt=>String(Kt.from)!==E&&String(Kt.to)!==E);const te=Mt();return oe("delete","delete",E,Yt,!1),te},()=>Ot(E)>=0)},compute:Mt,rows:{apply(C){if(i||!C)return{added:[],updated:[],removed:[]};const E=Qt(),Ct=new Map;t.forEach((ue,fe)=>Ct.set(re(ue),fe));const yt=t.slice(),Yt=[],te=[],Kt=[];for(const ue of[...C.add||[],...C.update||[]]){const fe=re(ue);Ct.has(fe)?(yt[Ct.get(fe)]={...yt[Ct.get(fe)],...ue},te.push(ue)):(Ct.set(fe,yt.length),yt.push({...ue}),Yt.push(ue))}for(const ue of C.remove||[]){const fe=ue&&typeof ue=="object"?re(ue):String(ue);Ct.has(fe)&&(yt[Ct.get(fe)]=null,Kt.push(fe))}t=yt.filter(Boolean),Mt();const ee=Yt.length&&!te.length&&!Kt.length;return oe(ee?"add":"change",ee?"add":"change",Yt.length===1&&!te.length&&!Kt.length?re(Yt[0]):null,E,!1),{added:Yt,updated:te,removed:Kt}},forEach(C){if(typeof C=="function")for(const E of t)C(E,re(E))},get count(){return t.length}},toCSV(C={}){if(!e||!e.ok)return"";const E=!!C.dates,Ct=Kt=>E?_t(Kt)??String(Kt):String(Kt),yt=Kt=>{const ee=Kt==null?"":String(Kt);return/[",\n]/.test(ee)?`"${ee.replace(/"/g,'""')}"`:ee},te=[["id","name","start","end","duration","percentComplete","totalFloat","critical"].join(",")];for(const Kt of e.order){const ee=e.tasks.get(Kt);te.push([ee.id,ee.name,Ct(ee.es),Ct(ee.ef),ee.duration,ee.percentComplete==null?"":ee.percentComplete,ee.totalFloat,ee.critical].map(yt).join(","))}return te.join(`
|
|
249
|
-
`)},toMSPDI(
|
|
228
|
+
@scope ([data-theme="dark"]){:scope.${K},.${K}{color-scheme:dark}}
|
|
229
|
+
@scope ([data-theme="light"],[data-theme="auto"]){:scope.${K},.${K}{color-scheme:light}}
|
|
230
|
+
@media (prefers-color-scheme:dark){@scope ([data-theme="auto"]){:scope.${K},.${K}{color-scheme:dark}}}
|
|
231
|
+
`.trim()}function re(K){const n=K.documentElement;if(!n||n.getAttribute(h))return;n.setAttribute(h,"1");const r=K.createElement("style");r.textContent=de(),(K.head||K.body||n).appendChild(r)}function ne(K){const n=String(K).trim().split(/\s+/).filter(Boolean);return n.length?n.length===1?n[0].slice(0,2).toUpperCase():(n[0][0]+n[n.length-1][0]).toUpperCase():"?"}function Dt(K){let n=0;for(let r=0;r<K.length;r+=1)n=n*31+K.charCodeAt(r)>>>0;return te[n%te.length]}function Zt(){return[{key:"name",title:"Task name",width:0,kind:"name"},{key:"start",title:"Start",width:96,kind:"start"},{key:"end",title:"Finish",width:96,kind:"end"},{key:"duration",title:"Duration",width:84,kind:"duration"},{key:"assignee",title:"Assignee",width:96,kind:"assignee"},{key:"progress",title:"%",width:56,kind:"progress"}]}function qt(K){if(!Array.isArray(K)||!K.length)return Zt();const n=new Map(Zt().map(s=>[s.key,s]));n.set("effort",{key:"effort",title:null,width:76,kind:"effort"}),n.set("units",{key:"units",title:null,width:76,kind:"units"});const r=K.map(s=>typeof s=="string"?n.get(s):s).filter(Boolean);return r.length?r:Zt()}class pe{#n;#s;#t;#e;#i;#r=null;#a=null;#c=null;#u=null;#o=null;#d=new Set;#g=[];#_=new Set;#y=new Set;#S=new Set;#x=null;#A=null;#C=null;#I=null;#T=null;#v=!1;#b=null;#M=null;#D=null;#P=null;#O=null;#j=null;#N=null;#k=null;#et=null;#R=null;#z=null;#Y=null;#X=null;#nt=null;#rt=null;#l=null;#H=null;#ut="";#dt=null;#ht=1;#W=!1;#Z=null;#ft=!1;#f=null;#G=null;#E=null;#V=null;#$=null;#it=null;#st=null;#J=new Set;#q=null;#U=!1;#at=null;#h=null;#m=null;#B=null;#K=null;#p=null;#pt=null;#Dt=null;#w=null;#gt=null;#mt=null;#bt=null;#yt=null;#kt=null;#wt=null;#xt=new Map;#ot=null;#Ct=new Map;#Nt=null;#Q=null;#vt=null;#F=null;#$t=null;#_t=null;constructor(n,r,s={}){this.#n=n,this.#s=r,this.#t=r.ownerDocument,this.#e={...dt,...s},this.#i=qt(s.columns),re(this.#t),this.#l=F(n,()=>this.#e.messages),this.#r=rt(this.#t,"div",t),this.#r.setAttribute("role","table"),Number.isFinite(this.#e.height)&&(this.#r.style.height=`${this.#e.height}px`);const f=rt(this.#t,"div",`${t}__head`);this.#a=rt(this.#t,"div",`${t}__grid-head`),this.#a.style.width=`${this.#L()}px`,this.#u=rt(this.#t,"div",`${t}__time-head`),f.appendChild(this.#a),f.appendChild(rt(this.#t,"div",`${t}__divider`)),f.appendChild(this.#u);const z=rt(this.#t,"div",`${t}__body`);this.#c=rt(this.#t,"div",`${t}__grid-body`),this.#c.style.width=`${this.#L()}px`,this.#o=rt(this.#t,"div",`${t}__time-body`),z.appendChild(this.#c),this.#F=rt(this.#t,"div",`${t}__divider ${t}__divider--resize`),this.#F.setAttribute("tabindex","0"),this.#F.setAttribute("role","separator"),this.#F.setAttribute("aria-orientation","vertical"),this.#$t=j=>this.#Ht(j,"grid"),this.#_t=j=>this.#Ut(j,"grid"),this.#F.addEventListener("pointerdown",this.#$t),this.#F.addEventListener("keydown",this.#_t),z.appendChild(this.#F),z.appendChild(this.#o),this.#r.appendChild(f),this.#r.appendChild(z),this.#f=this.#De(),this.#h=this.#Ne(),this.#f&&this.#h&&(this.#h.unit=this.#f.unit),this.#Te(),this.#f&&this.#Oe(),this.#h&&this.#Ee(),this.#s.appendChild(this.#r),this.#I=()=>{this.#Ot(this.#o),this.#Vt(this.#o)},this.#o.addEventListener("scroll",this.#I),this.#T=()=>this.#Vt(this.#c),this.#c.addEventListener("scroll",this.#T),this.#e.hoverChain&&(this.#b=j=>this.#nn(j),this.#M=()=>this.#It(),this.#c.addEventListener("pointerover",this.#b),this.#c.addEventListener("pointerleave",this.#M),this.#o.addEventListener("pointerover",this.#b),this.#o.addEventListener("pointerleave",this.#M)),this.#e.editable&&(this.#D=j=>this.#Ye(j),this.#c.addEventListener("dblclick",this.#D)),this.#H=rt(this.#t,"div",`${t}__live`),this.#H.setAttribute("role","status"),this.#H.setAttribute("aria-live","polite"),this.#r.appendChild(this.#H),this.#e.tooltip&&(this.#k=rt(this.#t,"div",`${t}__tooltip`),this.#k.setAttribute("hidden",""),this.#et=rt(this.#t,"div",`${t}__tip-arrow`),this.#k.appendChild(this.#et),this.#r.appendChild(this.#k),z.addEventListener("scroll",()=>this.#lt()),this.#o.addEventListener("scroll",()=>this.#lt())),this.#N=new Y({doc:this.#t,controller:n,options:()=>this.#e,plot:()=>this.#o?this.#o.querySelector(`.${t}__plot`):null,rowOf:j=>j&&j.closest?j.closest(`.${t}__barrow`):null,barOf:j=>j.querySelector(`.${t}__bar`)||j.querySelector(`.${t}__milestone`),pxPerDay:()=>this.#ht,announce:j=>this.#ct(j,{repeat:!0}),t:(j,V)=>this.#l(j,V),iso:j=>M(j),redraw:()=>this.draw(),focusTask:j=>{this.#dt=j},editing:()=>this.#W}),this.#e.editable&&(this.#P=j=>this.#N.onPointerDown(j),this.#o.addEventListener("pointerdown",this.#P)),this.#e.keyboard&&(this.#O=j=>this.#N.onKey(j),this.#o.addEventListener("keydown",this.#O),this.#j=j=>this.#N.onHistoryKey(j),this.#r.addEventListener("keydown",this.#j)),this.#e.tooltip&&(this.#Y=j=>this.#$e(j),this.#X=()=>this.#lt(),this.#o.addEventListener("pointermove",this.#Y),this.#o.addEventListener("pointerleave",this.#X),this.#nt=j=>this.#_e(j),this.#o.addEventListener("focus",this.#nt,!0),this.#o.addEventListener("blur",this.#X,!0),this.#rt=j=>{j.key==="Escape"&&this.#lt()},this.#o.addEventListener("keydown",this.#rt)),this.#C=n.on("schedule",()=>this.draw()),this.draw()}get element(){return this.#r}get options(){return{...this.#e}}get scroller(){return this.#r?this.#r.querySelector(`.${t}__time-body`):null}#L(){return Math.max(80,Number(this.#e.gridWidth)||620)}#Jt(){const n=`${this.#L()}px`;this.#a&&(this.#a.style.width=n),this.#c&&(this.#c.style.width=n),this.#V&&(this.#V.style.width=n),this.#K&&(this.#K.style.width=n)}rowGeometry(){return this.#g.map(n=>({...n}))}get collapsed(){return new Set(this.#d)}toggle(n){const r=String(n);this.#d.has(r)?this.#d.delete(r):this.#d.add(r),this.draw()}draw(){if(this.#ft)return;const n=this.#n.schedule;if(!n||!n.ok)return;this.#Jt();const r=n.overAllocations||[];if(this.#_=new Set(r.map(Nt=>Nt.resource)),this.#y=new Set(r.flatMap(Nt=>Nt.taskIds)),this.#S=new Set((n.conflicts||[]).map(Nt=>Nt.id)),this.#z=this.#e.tooltip?new Map(this.#n.tasks.map(Nt=>[String(this.#n.readId(Nt)),Nt])):null,this.#x=null,this.#e.evm){const Nt=this.#e.evm===!0?{}:this.#e.evm,Qt=Nt.statusDate!=null?Nt.statusDate:Number.isFinite(this.#e.today)?this.#e.today:void 0,zt=this.#n.earnedValue({...Nt,statusDate:Qt});zt&&zt.ok&&(this.#x=zt.byTask)}this.#A=this.#Qt(n);const s=this.#te(n),f=this.#ee(s);this.#g=f;const z=f.length?f[f.length-1].top+f[f.length-1].height:0,j=this.#ne(),V=n.projectStart,ut=n.projectFinish,vt=[V,ut];Number.isFinite(this.#e.today)&&vt.push(this.#e.today);const Ot=Math.floor(Math.min(...vt)),Mt=Math.ceil(Math.max(...vt)),Vt=Math.max(1,Math.round((Mt-Ot)*.04)),Wt=Ot-Vt,Pt=Mt+Vt,Rt=Math.max(1,Math.round((Pt-Wt)*j.px)),Et=p({min:Wt,max:Pt},[0,Rt]);this.#ht=Et.of(1)-Et.of(0);const Tt=Nt=>c(Et.of(Nt));if(this.#re(),this.#ue(n,s,f),this.#we(j,Wt,Pt,Tt,Rt),this.#ve(n,s,f,Tt,Rt,z,Ot,Mt),this.#at){const Nt=this.getWorkloadUnit();this.#at.setAttribute("aria-pressed",Nt==="hours"?"false":"true"),this.#at.setAttribute("data-unit",Nt)}this.#f&&this.#je(n,j,Wt,Pt,Tt,Rt),this.#h&&this.#Le(n,j,Wt,Pt,Tt,Rt);const Ht=new Map(this.#n.tasks.map(Nt=>[String(Nt.id),Nt]));this.#ot={columns:this.#i,columnWidths:this.#tt(),rows:s.map(Nt=>({id:Nt.id,rec:Nt.rec,depth:Nt.depth,...f.find(Qt=>Qt.id===Nt.id)})),rawById:Ht,totalHeight:z,domainMin:Wt,domainMax:Pt,pxPerDay:this.#ht,zoomLevel:j.level,today:Number.isFinite(this.#e.today)?this.#e.today:null,rowHeight:this.#e.rowHeight,title:this.#e.title||null,workload:this.#f?{cfg:this.#f,data:this.#q}:null,histogram:this.#h?{cfg:this.#h,data:this.#Dt}:null}}#Qt(n){const r=this.#e.progressLine;if(r&&typeof r=="object"&&r.statusDate!=null){const s=B(r.statusDate);if(Number.isFinite(s))return s}if(this.#e.evm&&this.#e.evm!==!0&&this.#e.evm.statusDate!=null){const s=B(this.#e.evm.statusDate);if(Number.isFinite(s))return s}return Number.isFinite(this.#e.today)?this.#e.today:Number.isFinite(n.projectFinish)?n.projectFinish:null}#te(n){const r=new Map;for(const z of n.order){const j=n.tasks.get(z),V=j.parent==null?"__root__":String(j.parent);r.has(V)||r.set(V,[]),r.get(V).push(z)}const s=[],f=(z,j)=>{for(const V of r.get(z)||[]){const ut=n.tasks.get(V),vt=!!ut.isSummary&&(r.get(V)||[]).length>0;s.push({id:V,rec:ut,depth:j,hasChildren:vt}),vt&&!this.#d.has(V)&&f(V,j+1)}};return f("__root__",0),s}#ee(n){const r=Number(this.#e.rowHeight)||34,s=new Map(this.#n.tasks.map(ut=>[String(this.#n.readId(ut)),ut])),f=this.#i.find(ut=>ut.kind==="name"),z=f&&f.width?f.width:this.#L()-this.#i.filter(ut=>ut.kind!=="name").reduce((ut,vt)=>ut+(vt.width||0),0),j=[];let V=0;for(const ut of n){const vt=s.get(ut.id)||{};let Ot=r;if(Number.isFinite(vt.height))Ot=Math.max(r,Number(vt.height));else{const Mt=Math.max(24,z-ut.depth*(this.#e.indent||16)-28),Vt=Math.max(4,Math.floor(Mt/7)),Wt=Math.max(1,Math.ceil(String(ut.rec.name||"").length/Vt));Wt>1&&(Ot=Math.max(r,Wt*18+12))}j.push({id:ut.id,top:V,height:Ot}),V+=Ot}return j}#ne(){const n=this.#e.zoom;return Number.isFinite(n)?{px:Number(n),step:1,level:"custom"}:typeof n=="string"&&Lt[n]?Lt[n]:Lt.day}#St(){if(this.#e.calendar){const n=et(this.#e.calendar,0);if(n)return r=>!n.isWorking(r)}return this.#e.nonWorking==="weekends"?n=>{const r=L(n),s=r?r.getUTCDay():0;return s===0||s===6}:typeof this.#e.nonWorking=="function"?this.#e.nonWorking:null}#re(){const n=this.#a;for(;n.firstChild;)n.removeChild(n.firstChild);n.style.height=`${this.#e.headerHeight}px`;const r=this.#tt();if(this.#i.forEach((s,f)=>{const z=rt(this.#t,"div",`${t}__colhead`);z.style.width=`${r[f]}px`,z.style.flex=`0 0 ${r[f]}px`,N(z,s.title||(Jt.has(s.kind)?this.#l(`gantt.col.${s.kind}`):s.key)),s.resizable!==!1&&z.appendChild(this.#ie(s)),n.appendChild(z)}),this.#Nt){const s=n.querySelector(`.${t}__colresize[data-resize-key="${this.#Nt}"]`);s&&s.focus&&s.focus()}}#ie(n){const r=rt(this.#t,"div",`${t}__colresize`);return r.setAttribute("data-resize-key",n.key),r.setAttribute("tabindex","0"),r.setAttribute("role","separator"),r.setAttribute("aria-orientation","vertical"),r.addEventListener("pointerdown",s=>this.#Ht(s,n.key)),r.addEventListener("keydown",s=>this.#Ut(s,n.key)),r}#tt(){const n=this.#L(),r=this.#i.findIndex(f=>f.kind==="name"),s=this.#i.map((f,z)=>this.#Ct.has(f.key)?this.#Ct.get(f.key):z===r?null:f.width||80);if(r>=0&&s[r]==null){const f=s.reduce((z,j,V)=>V===r?z:z+j,0);s[r]=Math.max(this.#At(this.#i[r]),n-f)}return s}#At(n){return Number.isFinite(n.minWidth)?Math.max(1,Number(n.minWidth)):n.kind==="name"?gt:U}#Rt(n){return Number.isFinite(n.maxWidth)?Math.max(this.#At(n),Number(n.maxWidth)):1/0}#se(){const n=this.#r&&Number.isFinite(this.#r.clientWidth)?this.#r.clientWidth:0;return n>0?Math.max(ht,n-kt):1/0}#Tt(n){if(n==="grid")return this.#L();const r=this.#i.findIndex(s=>s.key===n);return r<0?0:this.#tt()[r]}#oe(n){if(n==="grid")return"The table/timeline divider";const r=this.#i.find(s=>s.key===n);return r?r.title||r.key:n}#Pt(n,r){if(n==="grid"){const z=Math.round(Math.max(ht,Math.min(this.#se(),r)));return this.#e.gridWidth=z,this.draw(),z}const s=this.#i.find(z=>z.key===n);if(!s||s.resizable===!1)return this.#Tt(n);const f=Math.round(Math.max(this.#At(s),Math.min(this.#Rt(s),r)));return this.#Ct.set(n,f),this.draw(),f}#ae(){const n=this.#tt(),r={grid:this.#L()};return this.#i.forEach((s,f)=>{r[s.key]=n[f]}),r}#zt(n,r){typeof this.#n.emitColumnResize=="function"&&this.#n.emitColumnResize({key:n,width:r,widths:this.#ae()})}#Ht(n,r){if(n&&n.button!=null&&n.button!==0)return;this.#Q={key:r,startX:n&&n.clientX||0,startWidth:this.#Tt(r)},n&&n.preventDefault&&n.preventDefault();const s=z=>this.#le(z),f=z=>this.#ce(z);this.#vt={move:s,up:f},this.#t.addEventListener("pointermove",s),this.#t.addEventListener("pointerup",f)}#le(n){if(!this.#Q)return;const r=(n&&n.clientX||0)-this.#Q.startX;this.#Pt(this.#Q.key,this.#Q.startWidth+r)}#ce(n){const r=this.#Q;if(this.#Wt(),this.#Q=null,!r)return;const s=(n&&n.clientX||0)-r.startX,f=this.#Pt(r.key,r.startWidth+s);f!==r.startWidth&&this.#zt(r.key,f)}#Wt(){this.#vt&&(this.#t.removeEventListener("pointermove",this.#vt.move),this.#t.removeEventListener("pointerup",this.#vt.up),this.#vt=null)}#Ut(n,r){if(!(n.key==="ArrowLeft"||n.key==="ArrowRight"))return;n.preventDefault&&n.preventDefault();const f=n.shiftKey?q:u,z=n.key==="ArrowRight"?f:-f,j=this.#Tt(r);this.#Nt=r;const V=this.#Pt(r,j+z),ut=this.#oe(r);V!==j?(this.#ct(`${ut} resized to ${V}px`,{repeat:!0}),this.#zt(r,V)):this.#ct(`${ut} is already at its ${z<0?"minimum":"maximum"} width`,{repeat:!0})}getColumnWidths(){const n=this.#tt(),r={};return this.#i.forEach((s,f)=>{r[s.key]=n[f]}),r}setColumnWidths(n){if(!(!n||typeof n!="object")){for(const r of this.#i){const s=n[r.key];!Number.isFinite(s)||r.resizable===!1||this.#Ct.set(r.key,Math.round(Math.max(this.#At(r),Math.min(this.#Rt(r),s))))}this.draw()}}#ue(n,r,s){const f=this.#c;for(;f.firstChild;)f.removeChild(f.firstChild);const z=new Map(this.#n.tasks.map(V=>[String(this.#n.readId(V)),V])),j=this.#tt();r.forEach((V,ut)=>{const vt=s[ut],Ot=rt(this.#t,"div",`${t}__row${V.rec.isSummary?` ${t}__row--summary`:""}`);Ot.style.height=`${vt.height}px`,Ot.setAttribute("role","row"),Ot.setAttribute("data-task",V.id),Ot.setAttribute("data-row-top",String(vt.top)),Ot.setAttribute("data-row-height",String(vt.height)),this.#i.forEach((Mt,Vt)=>{const Wt=this.#e.editable&&!V.rec.isSummary&&this.#qt(Mt)!=null,Pt=rt(this.#t,"div",`${t}__cell${Mt.kind==="name"?` ${t}__cell--name`:""}${Wt?` ${t}__cell--editable`:""}`);Pt.style.width=`${j[Vt]}px`,Pt.style.flex=`0 0 ${j[Vt]}px`,Pt.setAttribute("data-col",String(Vt)),this.#de(Pt,Mt,V,z.get(V.id)||{}),Ot.appendChild(Pt)}),f.appendChild(Ot)})}#de(n,r,s,f){if(typeof r.render=="function"){const j=r.render(s.rec,{rawTask:f,depth:s.depth});j!=null&&N(n,String(j));return}if(r.kind==="name"){this.#me(n,s);return}if(r.kind==="assignee"){this.#be(n,f,s);return}if(Jt.has(r.kind)){N(n,this.#Bt(r.kind,s.rec));return}if(r.kind==="progress"){this.#ke(n,s.rec);return}if(r.kind==="evm"){this.#he(n,r,s);return}if(r.kind==="plannedPercentComplete"){this.#fe(n,s);return}if(Ft.has(r.kind)){N(n,this.#Ft(r.kind,s.rec));return}const z=f[r.key];N(n,z==null?"":String(z))}#he(n,r,s){const f=r.metric||"spi",z=this.#x?this.#x.get(s.id):null,j=z?z[f]:null;if(j==null||!Number.isFinite(j)){N(n,"—");return}const V=f==="spi"||f==="cpi"?2:Number.isFinite(r.digits)?r.digits:0;N(n,j.toFixed(V))}#fe(n,r){const s=this.#pe(r.rec);if(s==null){N(n,"—");return}N(n,String(Math.round(s)))}#pe(n){if(n.isSummary||!Number.isFinite(this.#A))return null;const r=n.baselineStart!=null?n.baselineStart:n.es,s=n.baselineEnd!=null?n.baselineEnd:n.ef;return ie(this.#A,r,s)*100}#ge(n,r){const s=n.percentComplete==null?0:Math.max(0,Math.min(100,n.percentComplete))/100;return r?r.dayOf(r.indexOf(n.es)+s*n.duration):n.es+s*n.duration}#me(n,r){n.style.paddingLeft=`${8+r.depth*(this.#e.indent||16)}px`;const s=this.#t.createElement("button");if(s.setAttribute("class",`${t}__chevron`),s.setAttribute("type","button"),r.hasChildren){const z=this.#d.has(r.id);N(s,z?"▸":"▾"),s.setAttribute("aria-label",this.#l(z?"gantt.row.expand":"gantt.row.collapse",{name:r.rec.name})),s.setAttribute("aria-expanded",z?"false":"true"),s.addEventListener("click",()=>this.toggle(r.id))}else s.setAttribute("aria-hidden","true");n.appendChild(s);const f=rt(this.#t,"span",`${t}__name-text${r.rec.isSummary?` ${t}__name-text--summary`:""}`);N(f,r.rec.name),n.appendChild(f)}#be(n,r,s){const f=it(r).map(V=>V.resource);let z=n;if(this.#e.editable&&s&&!s.rec.isSummary){const V=rt(this.#t,"button",`${t}__picker-trigger`);V.setAttribute("type","button"),V.setAttribute("data-picker-for",s.id),V.setAttribute("aria-haspopup","dialog"),V.setAttribute("aria-label",this.#l("gantt.picker.open",{name:s.rec.name})),V.addEventListener("click",()=>this.#ye(s.id,V)),n.appendChild(V),z=V,f.length||N(V,"+")}if(!f.length)return;const j=rt(this.#t,"div",`${t}__avatars`);for(const V of f.slice(0,3)){const ut=this.#_.has(V),vt=rt(this.#t,"div",`${t}__avatar${ut?` ${t}__avatar--overalloc`:""}`);vt.style.background=Dt(V),vt.setAttribute("title",ut?this.#l("gantt.resource.over",{name:V}):V),N(vt,ne(V)),j.appendChild(vt)}z.appendChild(j)}#ye(n,r){this.#W||(this.#Z&&this.#Z.close(),this.#Z=new mt(this.#n,this.#t,this.#l,n,r,()=>{this.#Z=null,this.draw()}),this.#Z.open())}#Bt(n,r){return r.isSummary?"":n==="effort"?r.effort!=null&&r.effort>0?String(c(r.effort)):"":r.units>0?`${Math.round(r.units*100)}%`:""}#ke(n,r){const s=r.percentComplete==null?null:Math.max(0,Math.min(100,r.percentComplete));if(s==null)return;const f=26,z=10,j=2*Math.PI*z,V=tt(this.#t,"svg",{class:`${t}__ring`,width:f,height:f,viewBox:`0 0 ${f} ${f}`});V.appendChild(tt(this.#t,"circle",{class:`${t}__ring-track`,cx:f/2,cy:f/2,r:z,fill:"none",stroke:"#e6e8eb","stroke-width":3})),V.appendChild(tt(this.#t,"circle",{cx:f/2,cy:f/2,r:z,fill:"none",stroke:s>=100?"#2c9c6a":"#4a90d9","stroke-width":3,"stroke-dasharray":`${c(j*s/100)} ${c(j)}`,"stroke-linecap":"round",transform:`rotate(-90 ${f/2} ${f/2})`}));const ut=tt(this.#t,"text",{class:`${t}__ring-label`,x:f/2,y:f/2+3,"text-anchor":"middle","font-size":8,fill:"#57606a"});N(ut,String(Math.round(s))),V.appendChild(ut),n.appendChild(V)}#we(n,r,s,f,z){const j=this.#u;for(;j.firstChild;)j.removeChild(j.firstChild);j.style.height=`${this.#e.headerHeight}px`;const V=this.#e.headerHeight,ut=n.level==="day"?Math.round(V*.55):V,vt=tt(this.#t,"svg",{class:`${t}__plot`,width:z,height:V,viewBox:`0 0 ${z} ${V}`});vt.setAttribute("data-role","time-head");const Ot=Math.floor(r),Mt=Math.ceil(s),Vt=this.#St(),Wt=n.level==="month"||n.level==="quarter"?null:7;if(Wt){const Pt=[];let Rt=Ot-(L(Ot)?.getUTCDay()??0);for(;Rt<Mt;Rt+=Wt){const Et=f(Rt);vt.appendChild(tt(this.#t,"line",{class:`${t}__bandsep`,x1:Et,y1:0,x2:Et,y2:V}));const Tt=L(Rt);Tt&&Pt.push({at:Et,text:`${_t[Tt.getUTCDay()]} ${String(Tt.getUTCDate()).padStart(2,"0")} ${bt[Tt.getUTCMonth()]} ${Tt.getUTCFullYear()}`})}for(const Et of $t(Pt,{fontSize:wt,bold:!0}).kept){const Tt=tt(this.#t,"text",{class:`${t}__band`,x:Et.at+4,y:Math.round(ut*.62)});N(Tt,Et.text),vt.appendChild(Tt)}}else{let Pt=L(Ot);if(Pt){const Rt=[];let Et=Date.UTC(Pt.getUTCFullYear(),Pt.getUTCMonth(),1)/864e5;for(;Et<Mt;){const Tt=L(Et),Ht=f(Et);vt.appendChild(tt(this.#t,"line",{class:`${t}__bandsep`,x1:Ht,y1:0,x2:Ht,y2:V})),Rt.push({at:Ht,text:`${bt[Tt.getUTCMonth()]} ${Tt.getUTCFullYear()}`}),Et=Date.UTC(Tt.getUTCFullYear(),Tt.getUTCMonth()+1,1)/864e5}for(const Tt of $t(Rt,{fontSize:wt,bold:!0}).kept){const Ht=tt(this.#t,"text",{class:`${t}__band`,x:Tt.at+4,y:Math.round(V*.6)});N(Ht,Tt.text),vt.appendChild(Ht)}}}if(n.level==="day"){vt.appendChild(tt(this.#t,"line",{class:`${t}__bandsep`,x1:0,y1:ut,x2:z,y2:ut}));for(let Pt=Ot;Pt<Mt;Pt+=1){const Rt=L(Pt);if(!Rt)continue;const Et=(f(Pt)+f(Pt+1))/2,Tt=tt(this.#t,"text",{class:`${t}__dayletter${Vt&&Vt(Pt)?` ${t}__dayletter--nonwork`:""}`,x:c(Et),y:ut+Math.round((V-ut)*.62)});N(Tt,Bt[Rt.getUTCDay()]),vt.appendChild(Tt)}}j.appendChild(vt),j.scrollLeft=this.#o?this.#o.scrollLeft:0}#ve(n,r,s,f,z,j,V,ut){const vt=this.#o;for(;vt.firstChild;)vt.removeChild(vt.firstChild);const Ot=tt(this.#t,"svg",{class:`${t}__plot`,width:z,height:j,viewBox:`0 0 ${z} ${j}`,role:"img","aria-label":"Gantt timeline"}),Mt=this.#St();if(Mt&&ut-V<=3660){const Rt=tt(this.#t,"g",{class:`${t}__shading`});for(let Et=Math.floor(V);Et<Math.ceil(ut);Et+=1){if(!Mt(Et))continue;const Tt=f(Et),Ht=f(Et+1);Rt.appendChild(tt(this.#t,"rect",{class:`${t}__shade`,x:Tt,y:0,width:c(Math.max(0,Ht-Tt)),height:j}))}Ot.appendChild(Rt)}const Vt=new Map(r.map((Rt,Et)=>[Rt.id,Et])),Wt=this.#e.showProgress,Pt=this.#e.showBaseline;if(r.forEach((Rt,Et)=>{const Tt=s[Et],Ht=Rt.rec,Nt=Math.min(18,Tt.height-12),Qt=Tt.top+(Tt.height-Nt)/2,zt=Tt.top+Tt.height/2,a=tt(this.#t,"g",{class:`${t}__barrow`});if(a.setAttribute("data-task",Rt.id),a.setAttribute("data-y",String(Tt.top)),a.setAttribute("data-row-height",String(Tt.height)),a.setAttribute("tabindex",this.#e.keyboard?"0":"-1"),a.setAttribute("role",Ht.isSummary?"group":"button"),a.setAttribute("aria-label",R(Ht,{iso:S=>M(S)})),a.appendChild(tt(this.#t,"rect",{class:`${t}__rowbg`,x:0,y:c(Tt.top),width:z,height:c(Tt.height),fill:"transparent"})),a.appendChild(tt(this.#t,"line",{class:`${t}__rowsep`,x1:0,y1:c(Tt.top+Tt.height),x2:z,y2:c(Tt.top+Tt.height)})),Pt&&Ht.baselineStart!=null&&Ht.baselineEnd!=null){const S=f(Ht.baselineStart),pt=Math.max(1,f(Ht.baselineEnd)-S);a.appendChild(tt(this.#t,"rect",{class:`${t}__baseline`,x:S,y:c(Qt+Nt),width:c(pt),height:4,rx:2}))}if(Ht.isMilestone){const S=f(Ht.es),pt=Nt/2;a.appendChild(tt(this.#t,"path",{class:`${t}__milestone`,d:lt(["M",c(S-pt),c(zt),"L",c(S),c(zt-pt),"L",c(S+pt),c(zt),"L",c(S),c(zt+pt),"Z"])}))}else if(Ht.isSummary){const S=f(Ht.es),pt=Math.max(2,f(Ht.ef)-S);a.appendChild(tt(this.#t,"rect",{class:`${t}__summary-bar`,x:S,y:c(Qt+Nt/3),width:c(pt),height:c(Nt/3),rx:1})),a.appendChild(tt(this.#t,"path",{class:`${t}__summary-bar`,d:lt(["M",c(S),c(Qt+Nt/3),"L",c(S),c(Qt+Nt),"L",c(S+5),c(Qt+Nt/3),"Z"])})),a.appendChild(tt(this.#t,"path",{class:`${t}__summary-bar`,d:lt(["M",c(S+pt),c(Qt+Nt/3),"L",c(S+pt),c(Qt+Nt),"L",c(S+pt-5),c(Qt+Nt/3),"Z"])}));const Q=tt(this.#t,"text",{class:`${t}__startlabel`,x:c(S+pt+6),y:c(zt)});N(Q,this.#Et(Ht.es)),a.appendChild(Q)}else{const S=f(Ht.es),pt=Math.max(1,f(Ht.ef)-S),Q=Ht.critical,jt=this.#y.has(String(Ht.id)),Yt=this.#S.has(String(Ht.id));a.appendChild(tt(this.#t,"rect",{class:`${t}__bar${Q?` ${t}__bar--critical`:""}${jt?` ${t}__bar--overalloc`:""}${Yt?` ${t}__bar--conflict`:""}`,x:S,y:c(Qt),width:c(pt),height:c(Nt),rx:3})),Wt&&Ht.percentComplete!=null&&Ht.percentComplete>0&&a.appendChild(tt(this.#t,"rect",{class:`${t}__progress`,x:S,y:c(Qt),width:c(pt*Math.min(1,Ht.percentComplete/100)),height:c(Nt),rx:3}));const Xt=this.#Ve(Ht);if(Xt){const Kt=tt(this.#t,"text",{class:`${t}__barlabel`,x:c(S+pt+6),y:c(zt)});N(Kt,Xt),a.appendChild(Kt)}}Ot.appendChild(a)}),this.#e.showArrows&&this.#Ge(Ot,n,r,Vt,s,f),Number.isFinite(this.#e.today)){const Rt=f(this.#e.today);Ot.appendChild(tt(this.#t,"line",{class:`${t}__today`,x1:Rt,y1:0,x2:Rt,y2:j,"data-today":String(this.#e.today)}))}if(this.#e.progressLine&&Number.isFinite(this.#A)&&this.#Me(Ot,n,r,s,f,j),vt.appendChild(Ot),this.#dt){const Rt=Ot.querySelector(`.${t}__barrow[data-task="${this.#dt}"]`);Rt&&Rt.focus&&Rt.focus()}}#$e(n){if(this.#N.dragging||!this.#k)return;const r=n.target,s=r&&r.closest?r.closest(`.${t}__barrow`):null,f=s?s.getAttribute("data-task"):null,z=this.#n.schedule,j=f&&z&&z.ok?z.tasks.get(f):null;if(!j){this.#lt();return}this.#Gt(s,j)}#_e(n){if(this.#N.dragging||!this.#k)return;const r=n.target,s=r&&r.closest?r.closest(`.${t}__barrow`):null,f=s?s.getAttribute("data-task"):null,z=this.#n.schedule,j=f&&z&&z.ok?z.tasks.get(f):null;j&&this.#Gt(s,j)}#Gt(n,r){const s=this.#z&&this.#z.get(String(r.id))||null,f=I(this.#t,t,r,s,this.#e.tooltip,this.#Se());if(!f){this.#lt();return}for(const z of[...this.#k.children])z!==this.#et&&this.#k.removeChild(z);if(f.node)this.#k.appendChild(f.node);else{const z=rt(this.#t,"div",`${t}__tip-card`);N(z,f.text),this.#k.appendChild(z)}this.#k.removeAttribute("hidden"),this.#k.setAttribute("data-task",r.id),this.#R&&this.#R!==n&&this.#R.removeAttribute("aria-description"),n.setAttribute("aria-description",f.text),this.#R=n,this.#Ae(n)}#Se(){return{t:this.#l,formatDate:n=>this.#xe(n),dateAxis:!0}}#xe(n){const r=L(n);if(!r)return"";try{return new Intl.DateTimeFormat(this.#Ce(),{year:"numeric",month:"long",day:"numeric",timeZone:"UTC"}).format(r)}catch{return M(n)||""}}#Ce(){const n=this.#n.grid,r=n&&n.messages;return r&&r.locale||void 0}#Ae(n){if(!this.#k||!this.#r)return;const r=n.querySelector(`.${t}__bar`)||n.querySelector(`.${t}__milestone`)||n.querySelector(`.${t}__summary-bar`);if(!r||typeof r.getBoundingClientRect!="function")return;const s=r.getBoundingClientRect(),f=this.#r.getBoundingClientRect(),z=this.#t.defaultView||globalThis,j=Number.isFinite(z.innerWidth)?z.innerWidth:1/0,V=Number.isFinite(z.innerHeight)?z.innerHeight:1/0,ut={left:Math.max(0,f.left),top:Math.max(0,f.top),right:Math.min(j,f.right),bottom:Math.min(V,f.bottom)};i(this.#k,this.#et,s,ut,f)}#lt(){this.#k&&(this.#k.setAttribute("hidden",""),this.#R&&(this.#R.removeAttribute("aria-description"),this.#R=null))}#Me(n,r,s,f,z,j){const V=this.#A,ut=z(V);n.appendChild(tt(this.#t,"line",{class:`${t}__progressline`,x1:c(ut),y1:0,x2:c(ut),y2:c(j),"data-status":String(V),"data-status-x":c(ut)}));const vt=this.#e.calendar?et(this.#e.calendar,r.projectStart):null;for(let Ot=0;Ot<s.length;Ot+=1){const Mt=s[Ot];if(Mt.rec.isSummary)continue;const Vt=f[Ot],Wt=Vt.top+Vt.height/2,Pt=z(this.#ge(Mt.rec,vt));n.appendChild(tt(this.#t,"line",{class:`${t}__progressline`,x1:c(ut),y1:c(Wt),x2:c(Pt),y2:c(Wt),"data-task":Mt.id,"data-status-x":c(ut),"data-progress-x":c(Pt)})),n.appendChild(tt(this.#t,"circle",{class:`${t}__progressline--dot`,cx:c(Pt),cy:c(Wt),r:2.5,"data-task":Mt.id,"data-progress-x":c(Pt)}))}}#ct(n,r){if(!this.#H||!n)return;if(!!!(r&&r.repeat)){if(n===this.#ut)return;this.#ut=n,N(this.#H,n);return}this.#ut=n,N(this.#H,""),N(this.#H,n)}#De(){const n=this.#e.workload;if(n==null||n===!1)return null;const r=n&&typeof n=="object"?n:{},s={...at,...r},f=Number(this.#n.hoursPerDay),z=Number.isFinite(f)&&f>0?f:at.hoursPerDay;return s.hoursPerDay=r.hoursPerDay!=null&&Number.isFinite(Number(r.hoursPerDay))&&Number(r.hoursPerDay)>0?Number(r.hoursPerDay):z,s.rowHeight=Math.max(16,Number(s.rowHeight)||at.rowHeight),s.height=Math.max(s.rowHeight,Number(s.height)||at.height),s.totals=s.totals!==!1,s.unit=P.has(r.unit)?r.unit:"hours",s}#Ne(){const n=this.#e.histogram;if(n==null||n===!1)return null;const s={...xt,...n&&typeof n=="object"?n:{}};return s.resources=Array.isArray(s.resources)&&s.resources.length?s.resources.map(f=>String(f)):null,s.unit=P.has(s.unit)?s.unit:"hours",s.stacked=s.stacked==="task"?"task":!1,s.rowHeight=Math.max(16,Number(s.rowHeight)||xt.rowHeight),s.height=Math.max(s.rowHeight,Number(s.height)||xt.height),s.collapsed=!1,s}#Te(){const n=this.#e.height;if(!Number.isFinite(n))return;const r=this.#f?this.#f.height:0,s=this.#h?this.#h.height:0,f=r+s;if(f<=0)return;const z=Math.max(0,Math.floor(n-n*d)-4);if(f<=z)return;const j=z/f;let V=Math.round(r*j),ut=Math.round(s*j);const vt=this.#h?this.#h.rowHeight+e:0;if(this.#h&&ut<vt){const Ot=Math.ceil((r+vt)/(1-d));It("gantt-histogram-squeeze",`[lattice] gantt: the histogram band needs the split view at least ${Ot}px tall to show its bars alongside the workload band (it is ${n}px); showing its header only until there is room.`),this.#h.collapsed=!0,ut=this.#h.rowHeight,V=Math.min(r,Math.max(0,z-ut))}this.#f&&(this.#f.height=Math.max(this.#f.rowHeight,V)),this.#h&&(this.#h.height=Math.max(this.#h.rowHeight,ut))}#Pe(){return this.#f?this.#f.hoursPerDay:at.hoursPerDay}#Oe(){const n=this.#f;this.#G=rt(this.#t,"div",`${t}__wl`),this.#G.style.flex=`0 0 ${n.height}px`,this.#G.setAttribute("role","table"),this.#G.setAttribute("aria-label",this.#l("gantt.workload.title")),this.#E=rt(this.#t,"div",`${t}__wl-head`),this.#E.style.height=`${n.rowHeight}px`,this.#E.appendChild(rt(this.#t,"div",`${t}__wl-cell ${t}__wl-cell--name`)),this.#E.appendChild(rt(this.#t,"div",`${t}__wl-cell ${t}__wl-cell--total`)),this.#E.appendChild(rt(this.#t,"div",`${t}__divider`));const r=rt(this.#t,"div",`${t}__wl-head-spacer`);r.appendChild(this.#Yt()),this.#E.appendChild(r),this.#G.appendChild(this.#E);const s=rt(this.#t,"div",`${t}__wl-body`);this.#V=rt(this.#t,"div",`${t}__wl-grid`),this.#V.style.width=`${this.#L()}px`,this.#$=rt(this.#t,"div",`${t}__wl-time`),s.appendChild(this.#V),s.appendChild(rt(this.#t,"div",`${t}__divider`)),s.appendChild(this.#$),this.#G.appendChild(s),this.#r.appendChild(this.#G),this.#it=()=>this.#Ot(this.#$),this.#$.addEventListener("scroll",this.#it),this.#e.editable&&(this.#st=f=>this.#qe(f),this.#$.addEventListener("dblclick",this.#st))}#Ot(n){if(this.#U||!n)return;this.#U=!0;const r=n.scrollLeft;for(const s of[this.#u,this.#o,this.#$,this.#p])s&&s!==n&&s.scrollLeft!==r&&(s.scrollLeft=r);this.#U=!1}#Vt(n){if(this.#v||!n)return;this.#v=!0;const r=n.scrollTop;for(const s of[this.#c,this.#o])s&&s!==n&&s.scrollTop!==r&&(s.scrollTop=r);this.#v=!1}#Kt(){const n=new Map,r=this.#n.resourceLoad;if(r&&r.byResource instanceof Map)for(const[s,f]of r.byResource)f&&Number.isFinite(f.capacity)&&n.set(s,f.capacity);return n}#Yt(){const n=this.#t.createElement("button");n.setAttribute("type","button"),n.setAttribute("class",`${t}__unit-toggle`);const r=this.getWorkloadUnit();return n.setAttribute("aria-pressed",r==="hours"?"false":"true"),n.setAttribute("data-unit",r),N(n,this.#l("gantt.workload.unitToggle")),n.addEventListener("click",()=>this.setWorkloadUnit(ot[this.getWorkloadUnit()])),this.#at=n,n}#je(n,r,s,f,z,j){const V=this.#f;if(!V||!this.#V||!this.#$||!this.#E)return;const ut=this.#St(),vt=X(r.level,Math.floor(s),Math.ceil(f)),Ot=this.#n.resourceModels,Mt=D(this.#n.tasks,n,{buckets:vt,hoursPerDay:V.hoursPerDay,isWorking:ut?a=>!ut(a):null,capacities:this.#Kt(),resourceModels:Ot,resourceRates:this.#n.resourceRates}),Vt=this.#tt(),Wt=Math.max(40,Vt[0]||this.#L()),Pt=Math.max(0,this.#L()-Wt),Rt=this.#E.querySelectorAll(`.${t}__wl-cell`);Rt[0]&&(Rt[0].style.width=`${Wt}px`,Rt[0].style.flex=`0 0 ${Wt}px`,N(Rt[0],this.#l("gantt.workload.resource"))),Rt[1]&&(Rt[1].style.width=`${Pt}px`,Rt[1].style.flex=`0 0 ${Pt}px`,N(Rt[1],V.totals?this.#l("gantt.workload.total"):""));const Et=Mt.rows.slice(),Tt=Mt.ok?Mt.buckets:vt.map(a=>({...a,workingDays:0}));this.#q={buckets:Tt,rows:Et};const Ht=this.#V,Nt=this.#$;for(;Ht.firstChild;)Ht.removeChild(Ht.firstChild);for(;Nt.firstChild;)Nt.removeChild(Nt.firstChild);const Qt=rt(this.#t,"div",`${t}__wl-plot`);Qt.style.width=`${j}px`;const zt=Et.reduce((a,S)=>a+1+(this.#J.has(S.resource==null?"":S.resource)?(S.tasks||[]).length:0),0);Qt.style.height=`${(zt+(V.totals?1:0))*V.rowHeight}px`;for(const a of Et){const S=a.resource==null?"":a.resource,pt=a.resource==null?this.#l("gantt.workload.unassigned"):a.resource,Q=a.tasks||[],jt=this.#J.has(S);if(this.#jt(Ht,Qt,{key:S,label:pt,cells:a.cells,over:a.over,capacity:a.capacity,available:a.available,availableTotal:a.availableTotal,total:a.total,costCells:a.costCells,costTotal:a.costTotal,isTotal:!1,taskId:null,toggle:Q.length?{expanded:jt,name:pt}:null},Tt,z,Wt,Pt,V),!!jt)for(const Yt of Q)this.#jt(Ht,Qt,{key:S,label:Yt.name,cells:Yt.cells,over:Yt.cells.map(()=>!1),capacity:null,available:a.available,availableTotal:a.availableTotal,total:Yt.total,costCells:null,costTotal:null,isTotal:!1,taskId:String(Yt.id),toggle:null},Tt,z,Wt,Pt,V)}V.totals&&this.#jt(Ht,Qt,{key:"__total__",label:this.#l("gantt.workload.total"),cells:Mt.totals,over:Mt.totals.map(()=>!1),capacity:null,available:Mt.totalsAvailable,availableTotal:Mt.grandAvailableTotal,total:Mt.grandTotal,costCells:Mt.totalsCost,costTotal:Mt.grandCostTotal,isTotal:!0,taskId:null,toggle:null},Tt,z,Wt,Pt,V),Nt.appendChild(Qt),this.#o&&(Nt.scrollLeft=this.#o.scrollLeft)}#jt(n,r,s,f,z,j,V,ut){const vt=s.taskId!=null,Ot=vt&&!!this.#e.editable,Mt=rt(this.#t,"div",`${t}__wl-row${s.isTotal?` ${t}__wl-row--total`:""}${vt?` ${t}__wl-row--task`:""}`);Mt.style.height=`${ut.rowHeight}px`,Mt.setAttribute("role","row"),Mt.setAttribute("data-resource",s.key),vt&&Mt.setAttribute("data-task",s.taskId);const Vt=rt(this.#t,"div",`${t}__wl-cell ${t}__wl-cell--name`);if(Vt.style.width=`${j}px`,Vt.style.flex=`0 0 ${j}px`,Vt.setAttribute("role","rowheader"),s.toggle){const Et=this.#t.createElement("button");Et.setAttribute("class",`${t}__wl-toggle`),Et.setAttribute("type","button"),Et.setAttribute("aria-expanded",s.toggle.expanded?"true":"false"),Et.setAttribute("aria-label",this.#l(s.toggle.expanded?"gantt.workload.collapse":"gantt.workload.expand",{name:s.toggle.name})),Et.addEventListener("click",()=>this.toggleResource(s.key)),Vt.appendChild(Et)}const Wt=rt(this.#t,"span",`${t}__wl-name-text`);N(Wt,s.label),Vt.appendChild(Wt),Mt.appendChild(Vt);const Pt=rt(this.#t,"div",`${t}__wl-cell ${t}__wl-cell--total`);if(Pt.style.width=`${V}px`,Pt.style.flex=`0 0 ${V}px`,Pt.setAttribute("role","cell"),ut.totals)if(ut.unit==="percent"&&s.availableTotal!=null){const Et=k(s.total,s.availableTotal,ut.decimals);N(Pt,Et==="–"?Et:`${Et}%`)}else ut.unit==="cost"&&s.costTotal!=null?N(Pt,A(s.costTotal,ut.decimals)):N(Pt,T(s.total,ut.decimals));Mt.appendChild(Pt),n.appendChild(Mt);const Rt=rt(this.#t,"div",`${t}__wl-timerow${s.isTotal?` ${t}__wl-timerow--total`:""}${vt?` ${t}__wl-timerow--task`:""}`);Rt.style.height=`${ut.rowHeight}px`,Rt.setAttribute("role","row"),Rt.setAttribute("data-resource",s.key),vt&&Rt.setAttribute("data-task",s.taskId),f.forEach((Et,Tt)=>{const Ht=z(Et.start),Nt=z(Et.end),Qt=ut.unit!=="cost"&&!!s.over[Tt],zt=rt(this.#t,"div",`${t}__wl-bucket${Qt?` ${t}__wl-bucket--over`:""}${Ot?` ${t}__wl-bucket--editable`:""}`);zt.style.left=`${c(Ht)}px`,zt.style.width=`${c(Math.max(0,Nt-Ht))}px`,zt.setAttribute("role","cell");const a=M(Et.start)??String(Et.start);zt.setAttribute("data-bucket",a),Ot&&zt.setAttribute("data-bucket-index",String(Tt));const S=s.cells[Tt],pt=s.available?s.available[Tt]:null,Q=s.costCells?s.costCells[Tt]:null,jt=ut.unit==="percent"&&pt!=null,Yt=ut.unit==="cost"&&s.costCells!=null,Xt=S==null&&!(jt&&!(pt>0)),Kt=jt?Xt?"":(()=>{const oe=k(S,pt,ut.decimals);return oe==="–"?oe:`${oe}%`})():Yt?A(Q,ut.decimals):T(S,ut.decimals);if(Kt!=="")if(N(zt,Kt),zt.setAttribute("data-hours",String(S)),jt)zt.setAttribute("aria-label",Kt==="–"?this.#l("gantt.workload.cellNoCapacity",{date:a}):this.#l(Qt?"gantt.workload.overPercent":"gantt.workload.cellPercent",{percent:Kt.slice(0,-1),date:a}));else if(Yt)zt.setAttribute("aria-label",this.#l("gantt.workload.cellCost",{cost:Kt,date:a}));else{const oe={hours:Kt,date:a};zt.setAttribute("aria-label",Qt?this.#l("gantt.workload.over",{...oe,capacity:T(pt,ut.decimals)}):this.#l("gantt.workload.cell",oe))}else Ot&&zt.setAttribute("aria-label",jt?this.#l("gantt.workload.cellPercent",{percent:"0",date:a}):this.#l("gantt.workload.cell",{hours:"0",date:a}));Rt.appendChild(zt)}),r.appendChild(Rt)}#Ee(){const n=this.#h;this.#m=rt(this.#t,"div",`${t}__hg${n.collapsed?` ${t}__hg--collapsed`:""}`),this.#m.style.flex=`0 0 ${n.height}px`,this.#m.setAttribute("role","table"),this.#m.setAttribute("aria-label",this.#l("gantt.histogram.title")),this.#B=rt(this.#t,"div",`${t}__hg-head`),this.#B.style.height=`${n.rowHeight}px`,this.#B.appendChild(rt(this.#t,"div",`${t}__hg-cell ${t}__hg-cell--name`)),this.#B.appendChild(rt(this.#t,"div",`${t}__divider`));const r=rt(this.#t,"div",`${t}__hg-head-spacer`);this.#f||r.appendChild(this.#Yt()),this.#B.appendChild(r),this.#m.appendChild(this.#B);const s=rt(this.#t,"div",`${t}__hg-body`);this.#K=rt(this.#t,"div",`${t}__hg-grid`),this.#K.style.width=`${this.#L()}px`,this.#p=rt(this.#t,"div",`${t}__hg-time`),s.appendChild(this.#K),s.appendChild(rt(this.#t,"div",`${t}__divider`)),s.appendChild(this.#p),this.#m.appendChild(s),this.#r.appendChild(this.#m),this.#pt=()=>this.#Ot(this.#p),this.#p.addEventListener("scroll",this.#pt),this.#w=rt(this.#t,"div",`${t}__hg-tooltip`),this.#w.setAttribute("hidden",""),this.#m.appendChild(this.#w),this.#gt=f=>this.#He(f),this.#mt=f=>this.#Xt(f),this.#bt=()=>this.#Mt(),this.#p.addEventListener("pointerover",this.#gt),this.#p.addEventListener("pointermove",this.#mt),this.#p.addEventListener("pointerleave",this.#bt),this.#yt=f=>this.#We(f),this.#kt=()=>this.#Mt(),this.#p.addEventListener("focus",this.#yt,!0),this.#p.addEventListener("blur",this.#kt,!0),this.#wt=f=>this.#Ue(f),this.#p.addEventListener("keydown",this.#wt)}#Fe(n){const r=this.#h;if(!r.resources)return n.rows.map(f=>f.resource);const s=new Map(n.rows.map(f=>[f.resource==null?"":f.resource,f]));return r.resources.filter(f=>s.has(f))}#Le(n,r,s,f,z,j){const V=this.#h;if(!V||!this.#K||!this.#p||!this.#B)return;const ut=this.#St(),vt=X(r.level,Math.floor(s),Math.ceil(f)),Ot=this.#Pe(),Mt=D(this.#n.tasks,n,{buckets:vt,hoursPerDay:Ot,isWorking:ut?a=>!ut(a):null,capacities:this.#Kt(),resourceModels:this.#n.resourceModels,resourceRates:this.#n.resourceRates}),Vt=this.#tt(),Wt=Math.max(40,Vt[0]||this.#L()),Pt=this.#B.querySelectorAll(`.${t}__hg-cell`);Pt[0]&&(Pt[0].style.width=`${Wt}px`,Pt[0].style.flex=`0 0 ${Wt}px`,N(Pt[0],this.#l("gantt.histogram.resource")));const Rt=Mt.ok?Mt.buckets:vt.map(a=>({...a,workingDays:0})),Et=Mt.ok?this.#Fe(Mt):[],Tt=new Map(Mt.rows.map(a=>[a.resource==null?"":a.resource,a]));this.#Dt={resources:Et,buckets:Rt,rows:Mt.rows,hoursPerDay:Ot};const Ht=this.#K,Nt=this.#p;for(;Ht.firstChild;)Ht.removeChild(Ht.firstChild);for(;Nt.firstChild;)Nt.removeChild(Nt.firstChild);const Qt=Math.max(1,Et.length*V.rowHeight),zt=tt(this.#t,"svg",{class:`${t}__hg-plot`,width:j,height:Qt,viewBox:`0 0 ${j} ${Qt}`,role:"img","aria-label":this.#l("gantt.histogram.title")});Et.forEach((a,S)=>{const pt=a??"",Q=Tt.get(pt),jt=a??this.#l("gantt.workload.unassigned");this.#Re(Ht,zt,Q,pt,jt,Rt,z,Wt,V,S,j)}),Nt.appendChild(zt),this.#o&&(Nt.scrollLeft=this.#o.scrollLeft),this.#Be(Et,Tt,Rt,V)}#Ie(n,r,s){const f=n.reduce((V,ut)=>Math.max(V,ut||0),0),z=r!=null?Math.max(r,f):f,j=Math.max(z*1.15,z>0?z:1);return p({min:0,max:j},[s,0])}#Re(n,r,s,f,z,j,V,ut,vt,Ot,Mt){const Vt=rt(this.#t,"div",`${t}__hg-row`);Vt.style.height=`${vt.rowHeight}px`,Vt.setAttribute("role","row"),Vt.setAttribute("data-resource",f);const Wt=rt(this.#t,"div",`${t}__hg-cell ${t}__hg-cell--name`);Wt.style.width=`${ut}px`,Wt.style.flex=`0 0 ${ut}px`,Wt.setAttribute("role","rowheader");const Pt=rt(this.#t,"span",`${t}__hg-name-text`);N(Pt,z),Wt.appendChild(Pt),Vt.appendChild(Wt),n.appendChild(Vt);const Rt=vt.unit==="cost"&&s&&s.costCells!=null,Et=j.map((zt,a)=>s&&(Rt?s.costCells[a]:s.cells[a])||0),Tt=!Rt&&s&&s.available&&s.available.some(zt=>zt!=null)?s.available:null,Ht=Tt?Tt.reduce((zt,a)=>Math.max(zt,a),0):null,Nt=this.#Ie(Et,Ht,vt.rowHeight),Qt=tt(this.#t,"g",{class:`${t}__hg-plotrow`,transform:`translate(0, ${c(Ot*vt.rowHeight)})`});if(Qt.setAttribute("data-resource",f),Qt.setAttribute("data-row-top",String(Ot*vt.rowHeight)),Qt.setAttribute("data-row-height",String(vt.rowHeight)),Qt.setAttribute("role","row"),j.forEach((zt,a)=>{const S=V(zt.start),pt=V(zt.end),Q=Et[a],jt=Tt?Tt[a]:null,Yt=jt!=null&&Q>jt,Xt=jt!=null?Math.min(Q,jt):Q,Kt=tt(this.#t,"g",{class:`${t}__hg-bargroup`});Kt.setAttribute("data-resource",f),Kt.setAttribute("data-bucket",M(zt.start)??String(zt.start)),Kt.setAttribute("data-bucket-index",String(a));const oe=this.#xt.has(f)?this.#xt.get(f):0;Kt.setAttribute("tabindex",a===oe?"0":"-1"),Kt.setAttribute("role","button"),Kt.setAttribute("aria-label",this.#ze(z,zt,Q,jt,Yt,s,a,vt));const ce=c(S),me=c(Math.max(0,pt-S));if(vt.stacked==="task"&&!Rt&&s&&s.tasks&&s.tasks.length){let he=0;for(const be of s.tasks){const _e=be.cells[a]||0;if(!(_e>0))continue;const Se=Math.min(he,Xt),xe=Math.min(he+_e,Xt);if(he+=_e,xe<=Se)continue;const fe=tt(this.#t,"rect",{class:`${t}__hg-bar`,x:ce,y:c(Nt.of(xe)),width:me,height:c(Nt.of(Se)-Nt.of(xe)),fill:Dt(String(be.id))});fe.setAttribute("data-resource",f),fe.setAttribute("data-bucket",M(zt.start)??String(zt.start)),fe.setAttribute("data-task",String(be.id)),Kt.appendChild(fe)}}else Xt>0&&Kt.appendChild(tt(this.#t,"rect",{class:`${t}__hg-bar`,x:ce,y:c(Nt.of(Xt)),width:me,height:c(Nt.of(0)-Nt.of(Xt))}));if(Yt){const he=tt(this.#t,"rect",{class:`${t}__hg-bar ${t}__hg-bar--overalloc`,x:ce,y:c(Nt.of(Q)),width:me,height:c(Nt.of(Xt)-Nt.of(Q))});he.setAttribute("data-resource",f),he.setAttribute("data-bucket",M(zt.start)??String(zt.start)),Kt.appendChild(he)}const ve=tt(this.#t,"rect",{x:ce,y:0,width:me,height:vt.rowHeight,fill:"transparent"});Kt.insertBefore(ve,Kt.firstChild),Qt.appendChild(Kt)}),Ht!=null){const zt=c(Nt.of(Ht)),a=tt(this.#t,"line",{class:`${t}__hg-cap`,x1:0,y1:zt,x2:Mt,y2:zt});a.setAttribute("data-resource",f),a.setAttribute("data-capacity",String(Ht)),Qt.appendChild(a)}r.appendChild(Qt)}#ze(n,r,s,f,z,j,V,ut){const vt=M(r.start)??String(r.start),Ot=M(r.end-1)??String(r.end-1);let Mt;if(ut.unit==="cost"&&j&&j.costCells!=null)Mt=this.#l("gantt.histogram.tipCost",{cost:A(s,2)});else if(ut.unit!=="percent"||f==null)Mt=this.#l("gantt.histogram.tipHours",{hours:T(s,1)});else{const Et=k(s,f,0);Mt=Et==="–"?this.#l("gantt.histogram.tipNoCapacity"):this.#l("gantt.histogram.tipPercent",{percent:Et})}const Vt=f!=null?this.#l("gantt.histogram.tipCapacity",{hours:T(f,1)}):"",Wt=j&&j.tasks?j.tasks.filter(Et=>(Et.cells[V]||0)>0).map(Et=>Et.name):[],Pt=Wt.length?this.#l("gantt.histogram.tipTasks",{tasks:Wt.join(", ")}):"",Rt=z?this.#l("gantt.histogram.tipOver"):"";return this.#l("gantt.histogram.tip",{name:n,from:vt,to:Ot,value:Mt,capacity:`${Vt}${Rt}`,tasks:Pt})}#He(n){const r=n.target&&n.target.closest?n.target.closest(`.${t}__hg-bargroup`):null;if(!r||!this.#w){this.#Mt();return}const s=r.getAttribute("aria-label");if(!s){this.#Mt();return}N(this.#w,s),this.#w.removeAttribute("hidden"),this.#Xt(n)}#Xt(n){if(!this.#w||this.#w.hasAttribute("hidden")||!this.#m)return;const r=this.#m.getBoundingClientRect?this.#m.getBoundingClientRect():{left:0,top:0},s=Number.isFinite(n.clientX)?n.clientX:0,f=Number.isFinite(n.clientY)?n.clientY:0;this.#w.style.left=`${s-r.left+12}px`,this.#w.style.top=`${f-r.top-28}px`}#We(n){const r=n.target&&n.target.closest?n.target.closest(`.${t}__hg-bargroup`):null;if(!r||!this.#w)return;const s=r.getAttribute("aria-label");if(!s||(N(this.#w,s),this.#w.removeAttribute("hidden"),!this.#m||!r.getBoundingClientRect))return;const f=this.#m.getBoundingClientRect(),z=r.getBoundingClientRect();this.#w.style.left=`${z.left-f.left}px`,this.#w.style.top=`${z.top-f.top-28}px`}#Mt(){this.#w&&this.#w.setAttribute("hidden","")}#Ue(n){const r=n.key;if(r!=="ArrowLeft"&&r!=="ArrowRight"&&r!=="ArrowUp"&&r!=="ArrowDown")return;const s=n.target&&n.target.closest?n.target.closest(`.${t}__hg-bargroup`):null;if(!s)return;const f=s.getAttribute("data-resource")||"",z=Number(s.getAttribute("data-bucket-index")),j=this.#p;if(j){if(r==="ArrowLeft"||r==="ArrowRight"){const V=r==="ArrowRight"?1:-1,vt=[...j.querySelectorAll(`.${t}__hg-bargroup[data-resource="${f}"]`)].sort((Ot,Mt)=>Number(Ot.getAttribute("data-bucket-index"))-Number(Mt.getAttribute("data-bucket-index"))).find(Ot=>Number(Ot.getAttribute("data-bucket-index"))===z+V);vt&&this.#Zt(f,z+V,vt)}else{const V=[...new Set([...j.querySelectorAll(`.${t}__hg-bargroup`)].map(Vt=>Vt.getAttribute("data-resource")))],ut=V.indexOf(f),Ot=V[ut+(r==="ArrowDown"?1:-1)];if(Ot==null)return;const Mt=j.querySelector(`.${t}__hg-bargroup[data-resource="${Ot}"][data-bucket-index="${z}"]`);Mt&&this.#Zt(Ot,z,Mt)}n.preventDefault&&n.preventDefault()}}#Zt(n,r,s){this.#xt.set(n,r);const f=this.#p;if(f)for(const z of f.querySelectorAll(`.${t}__hg-bargroup[data-resource="${n}"]`))z.setAttribute("tabindex",z===s?"0":"-1");s.focus&&s.focus()}#Be(n,r,s,f){if(!this.#m)return;const z=this.#m.querySelector(`.${t}__hg-table`);z&&z.parentNode&&z.parentNode.removeChild(z);const j=rt(this.#t,"div",`${t}__hg-table`),V=this.#t.createElement("table"),ut=this.#t.createElement("caption");N(ut,this.#l("gantt.histogram.tableTitle")),V.appendChild(ut);const vt=this.#t.createElement("tr"),Ot=f.unit==="percent"?"gantt.histogram.percent":f.unit==="cost"?"gantt.histogram.cost":"gantt.histogram.hours";for(const Mt of["gantt.histogram.resource","gantt.histogram.period",Ot,"gantt.histogram.capacity","gantt.histogram.overAllocated"]){const Vt=this.#t.createElement("th");N(Vt,this.#l(Mt)),vt.appendChild(Vt)}V.appendChild(vt);for(const Mt of n){const Vt=Mt??"",Wt=Mt??this.#l("gantt.workload.unassigned"),Pt=r.get(Vt),Rt=f.unit==="cost"&&Pt&&Pt.costCells!=null;s.forEach((Et,Tt)=>{const Ht=Pt&&(Rt?Pt.costCells[Tt]:Pt.cells[Tt])||0,Nt=!Rt&&Pt&&Pt.available?Pt.available[Tt]:null,Qt=Nt!=null&&Ht>Nt,zt=this.#t.createElement("tr"),a=this.#t.createElement("th");N(a,Wt),zt.appendChild(a);const S=this.#t.createElement("td");N(S,`${M(Et.start)??Et.start} – ${M(Et.end-1)??Et.end-1}`),zt.appendChild(S);const pt=this.#t.createElement("td");if(f.unit==="percent"&&Nt!=null){const Yt=k(Ht,Nt,0);N(pt,Yt==="–"?Yt:`${Yt}%`)}else Rt?N(pt,A(Ht,2)):N(pt,T(Ht,1));zt.appendChild(pt);const Q=this.#t.createElement("td");N(Q,Nt!=null?T(Nt,1):""),zt.appendChild(Q);const jt=this.#t.createElement("td");N(jt,this.#l(Qt?"gantt.histogram.yes":"gantt.histogram.no")),zt.appendChild(jt),V.appendChild(zt)})}j.appendChild(V),this.#m.appendChild(j)}toggleResource(n){const r=String(n);this.#J.has(r)?this.#J.delete(r):this.#J.add(r),this.draw()}getWorkloadUnit(){return this.#f?this.#f.unit:this.#h?this.#h.unit:at.unit}setWorkloadUnit(n){const r=P.has(n)?n:"hours";if(r===this.getWorkloadUnit()&&!(this.#f&&this.#h&&this.#f.unit!==this.#h.unit)||(this.#f&&(this.#f.unit=r),this.#h&&(this.#h.unit=r),!this.#f&&!this.#h))return;this.draw();const s=r==="percent"?"gantt.workload.unitPercent":r==="cost"?"gantt.workload.unitCost":"gantt.workload.unitHours";this.#ct(this.#l(s),{repeat:!0})}get expandedResources(){return new Set(this.#J)}#Ge(n,r,s,f,z,j){const V=tt(this.#t,"g",{class:`${t}__links`}),ut=vt=>{const Ot=z[f.get(vt)];return Ot.top+Ot.height/2};for(const vt of this.#n.dependencies){const Ot=String(vt.from),Mt=String(vt.to);if(!f.has(Ot)||!f.has(Mt))continue;const Vt=r.tasks.get(Ot),Wt=r.tasks.get(Mt);if(!Vt||!Wt)continue;const Pt=vt.type?String(vt.type).toUpperCase():"FS",Rt=Pt==="FS"||Pt==="FF"?Vt.ef:Vt.es,Et=Pt==="FF"||Pt==="SF"?Wt.ef:Wt.es,Tt=j(Rt),Ht=ut(Ot),Nt=j(Et),Qt=ut(Mt),zt=Vt.critical&&Wt.critical,a=b({sx:Tt,sy:Ht,ex:Nt,ey:Qt,type:Pt,elbow:10,rowGap:z[f.get(Ot)].height/2}),S=tt(this.#t,"path",{class:`${t}__link${zt?` ${t}__link--critical`:""}`,d:a.d});S.setAttribute("data-from",Ot),S.setAttribute("data-to",Mt),S.setAttribute("data-type",Pt),S.setAttribute("data-route",a.route),V.appendChild(S),V.appendChild(tt(this.#t,"path",{class:`${t}__arrowhead${zt?` ${t}__arrowhead--critical`:""}`,d:w(Nt,Qt,a.arrowDir)}))}n.appendChild(V)}#Ve(n){const r=this.#e.barLabel;if(typeof r=="function")return String(r(n)??"");switch(r){case"none":return"";case"percent":return n.percentComplete==null?"":`${Math.round(n.percentComplete)}%`;case"dates":return`${this.#Et(n.es)} – ${this.#Et(n.ef)}`;default:return n.name}}#Et(n){const r=L(n);return r?`${String(r.getUTCDate()).padStart(2,"0")} ${bt[r.getUTCMonth()]}`:M(n)??String(n)}#qt(n){return!n||n.editable===!1?null:n.editField?String(n.editField):n.kind==="name"?"name":n.kind==="progress"?"percentComplete":Ft.has(n.kind)||Jt.has(n.kind)?n.kind:n.editable===!0?n.key:null}#Ft(n,r){if(n==="duration")return String(c(r.duration));const s=n==="start"?r.es:r.ef;return M(s)??String(c(s))}#Lt(n){const r=this.#n.schedule;return r&&r.ok&&r.tasks.get(String(n))||null}#Ke(n){const r=String(n??"").trim();if(r==="")return null;if(/^-?\d+(\.\d+)?$/.test(r))return Number(r);const s=B(r);return Number.isFinite(s)?s:null}#Ye(n){if(this.#W)return;const r=n.target,s=r&&r.closest?r.closest(`.${t}__cell`):null;if(!s)return;const f=s.closest(`.${t}__row`);if(!f)return;const z=f.getAttribute("data-task"),j=this.#i[Number(s.getAttribute("data-col"))],V=this.#qt(j);if(!z||!V)return;const ut=this.#n.schedule&&this.#n.schedule.ok?this.#n.schedule.tasks.get(z):null;ut&&ut.isSummary||this.#Xe(s,z,V,j)}#Xe(n,r,s,f){const z=this.#n.taskById(r)||{},j=this.#Lt(r),V=s==="percentComplete"||s==="duration"||Jt.has(s)||f.kind==="progress"||f.kind==="number";let ut;for(s==="duration"&&j?ut=c(j.duration):Jt.has(s)&&j?ut=this.#Bt(s,j).replace("%",""):s==="start"&&j?ut=this.#Ft("start",j):s==="end"&&j?ut=this.#Ft("end",j):s==="percentComplete"&&j&&j.percentComplete!=null?ut=j.percentComplete:ut=z[s]==null?"":z[s];n.firstChild;)n.removeChild(n.firstChild);const vt=this.#t.createElement("input");vt.setAttribute("class",`${t}__editor`);const Ot=/^\d{4}-\d{2}-\d{2}$/.test(String(ut));vt.setAttribute("type",V?"number":Ot?"date":"text"),vt.value=String(ut),n.appendChild(vt),this.#W=!0,vt.focus&&vt.focus();let Mt=!1;const Vt=Wt=>{Mt||(Mt=!0,this.#W=!1,Wt?this.#Ze(r,s,vt.value,V):this.draw())};vt.addEventListener("keydown",Wt=>{Wt.key==="Enter"?(Wt.preventDefault&&Wt.preventDefault(),Vt(!0)):Wt.key==="Escape"&&(Wt.preventDefault&&Wt.preventDefault(),Vt(!1))}),vt.addEventListener("blur",()=>Vt(!0))}#Ze(n,r,s,f){if(r==="start"||r==="end"){const j=this.#Ke(s),V=this.#Lt(n);if(j==null||!V){this.draw();return}r==="start"?this.#n.applyEdit({id:n,start:j},{writeBack:!0}):this.#n.applyEdit({id:n,duration:Math.max(0,V.duration+(j-V.ef))},{writeBack:!0}),this.draw();return}let z=s;if(f){const j=Number(s);if(!Number.isFinite(j)){this.draw();return}r==="percentComplete"?z=Math.max(0,Math.min(100,j)):r==="duration"||r==="effort"?z=Math.max(0,j):r==="units"?z=Math.max(0,j)/100:z=j}this.#n.applyEdit({id:n,[r]:z},{writeBack:!0}),this.draw()}#qe(n){if(this.#W||!this.#e.editable)return;const r=n.target,s=r&&r.closest?r.closest(`.${t}__wl-bucket`):null;if(!s||!s.getAttribute("data-bucket-index"))return;const f=s.closest(`.${t}__wl-timerow`),z=f?f.getAttribute("data-task"):null;z&&this.#Je(s,z,f.getAttribute("data-resource")||"",Number(s.getAttribute("data-bucket-index")))}#Je(n,r,s,f){const z=n.getAttribute("data-hours"),j=this.#f;for(;n.firstChild;)n.removeChild(n.firstChild);const V=this.#t.createElement("input");V.setAttribute("class",`${t}__wl-editor`),V.setAttribute("type","number");let ut=null;if(j.unit==="percent"){const Mt=this.#q&&this.#q.rows?this.#q.rows.find(Vt=>(Vt.resource==null?"":Vt.resource)===s):null;ut=Mt&&Mt.available?Mt.available[f]:null}V.value=z==null?"":ut!=null&&ut>0?k(Number(z),ut,j.decimals):T(Number(z),j.decimals),n.appendChild(V),this.#W=!0,V.focus&&V.focus();let vt=!1;const Ot=Mt=>{vt||(vt=!0,this.#W=!1,Mt?this.#Qe(r,s,f,V.value):this.draw())};V.addEventListener("keydown",Mt=>{Mt.key==="Enter"?(Mt.preventDefault&&Mt.preventDefault(),Ot(!0)):Mt.key==="Escape"&&(Mt.preventDefault&&Mt.preventDefault(),Ot(!1))}),V.addEventListener("blur",()=>Ot(!0))}#Qe(n,r,s,f){const z=this.#f,j=this.#q,V=j&&j.buckets?j.buckets[s]:null,ut=j&&j.rows?j.rows.find(Q=>(Q.resource==null?"":Q.resource)===r):null,vt=ut&&ut.tasks?ut.tasks.find(Q=>String(Q.id)===String(n)):null,Ot=this.#Lt(n);if(!z||!V||!vt||!Ot){this.draw();return}const Mt=String(f??"").trim(),Vt=Mt===""?0:Number(Mt);if(!Number.isFinite(Vt)||Vt<0){this.draw();return}let Wt=Vt;if(z.unit==="percent"){const Q=ut.available?ut.available[s]:null;Q!=null&&Q>0&&(Wt=Vt/100*Q)}const Pt=this.#St(),Rt=Pt?Q=>!Pt(Q):null,Et=[];for(let Q=Math.floor(V.start);Q<Math.ceil(V.end);Q+=1)(!Rt||Rt(Q))&&Et.push(Q);const Tt=M(V.start)??String(V.start);if(!Et.length){this.#ct(this.#l("gantt.a11y.hoursRefused",{name:vt.name,date:Tt}),{repeat:!0}),this.draw();return}const Ht=At(Ot,Rt),Nt=Et.filter(Q=>Ht.includes(Q)),Qt=Nt.length?Nt:Et,zt=vt.raw||{};let a=Z(zt);if(!a){const Q=W(zt),jt=Q??Ht.length*z.hoursPerDay*vt.unitsTotal;a=st(Ht,jt)}const S=vt.units>0?vt.unitsTotal/vt.units:1,pt=m(a,V,Qt,Wt*S);this.#n.applyEdit({id:n,work:St(pt)},{writeBack:!0}),this.#ct(Wt>0?this.#l("gantt.a11y.hoursSet",{name:vt.name,hours:T(Wt,z.decimals),date:Tt}):this.#l("gantt.a11y.hoursCleared",{name:vt.name,date:Tt}),{repeat:!0}),this.draw()}#tn(n){const r=new Map,s=new Map;for(const j of this.#n.dependencies){const V=String(j.from),ut=String(j.to);(s.get(V)||s.set(V,[]).get(V)).push(ut),(r.get(ut)||r.set(ut,[]).get(ut)).push(V)}const f=new Set([n]),z=j=>{const V=[n];for(;V.length;){const ut=V.pop();for(const vt of j.get(ut)||[])f.has(vt)||(f.add(vt),V.push(vt))}};return z(r),z(s),f}#en(n){if(!this.#r)return;this.#It();const r=this.#tn(n);for(const f of r){const z=this.#c&&this.#c.querySelector(`.${t}__row[data-task="${f}"]`);z&&z.classList.add(`${t}__row--chain`)}const s=this.#o;if(s){for(const f of s.querySelectorAll(`.${t}__link`)){const z=f.getAttribute("data-from"),j=f.getAttribute("data-to");r.has(z)&&r.has(j)&&f.classList.add(`${t}__link--chain`)}for(const f of r){const z=s.querySelector(`.${t}__barrow[data-task="${f}"]`);if(!z)continue;const j=z.querySelector(`.${t}__bar`)||z.querySelector(`.${t}__milestone`)||z.querySelector(`.${t}__summary-bar`);if(!j)continue;const V=j.getAttribute("class")||"";V.includes(`${t}__milestone`)?j.classList.add(`${t}__milestone--chain`):V.includes(`${t}__summary-bar`)?j.classList.add(`${t}__summary-bar--chain`):j.classList.add(`${t}__bar--chain`)}}}#It(){if(this.#r)for(const n of["__row--chain","__link--chain","__bar--chain","__milestone--chain","__summary-bar--chain"])for(const r of this.#r.querySelectorAll(`.${t}${n}`))r.classList.remove(`${t}${n}`)}#nn(n){if(this.#W||this.#N&&this.#N.dragging)return;const r=n.target,s=r&&r.closest?r.closest(`.${t}__row`)||r.closest(`.${t}__barrow`):null,f=s?s.getAttribute("data-task"):null;f?this.#en(f):this.#It()}toSVG(n={}){return this.#ot?g(this.#ot,n):""}async toPNG(n={}){const r=this.toSVG(n);if(!r)return null;const s=/width="(\d+)" height="(\d+)"/.exec(r),f=s?Number(s[1]):0,z=s?Number(s[2]):0;if(!f||!z)return null;const j=this.#t&&this.#t.defaultView||globalThis,V=n.scale||j.devicePixelRatio||1,ut="background"in n?n.background:"#ffffff";return C(this.#t,r,f,z,V,ut)}print(n={}){if(!this.#ot)return It("gantt-print-not-drawn","[lattice] gantt: print() called before anything was drawn; nothing to print."),!1;const r=this.#n.grid,s=r&&r.messages,f=s&&s.locale||void 0,z=v(this.#ot,{...n,title:n.title===!1?!1:n.title||this.#ot.title||this.#n.title||null,locale:f,t:this.#l});return E(this.#t,z)}destroy(){this.#ft||(this.#ft=!0,this.#Z&&this.#Z.close(),this.#ot=null,this.#Wt(),this.#Q=null,this.#$t&&this.#F&&this.#F.removeEventListener("pointerdown",this.#$t),this.#_t&&this.#F&&this.#F.removeEventListener("keydown",this.#_t),this.#$t=null,this.#_t=null,this.#F=null,this.#I&&this.#o&&this.#o.removeEventListener("scroll",this.#I),this.#I=null,this.#T&&this.#c&&this.#c.removeEventListener("scroll",this.#T),this.#T=null,this.#it&&this.#$&&this.#$.removeEventListener("scroll",this.#it),this.#it=null,this.#st&&this.#$&&this.#$.removeEventListener("dblclick",this.#st),this.#st=null,this.#q=null,this.#p&&(this.#pt&&this.#p.removeEventListener("scroll",this.#pt),this.#gt&&this.#p.removeEventListener("pointerover",this.#gt),this.#mt&&this.#p.removeEventListener("pointermove",this.#mt),this.#bt&&this.#p.removeEventListener("pointerleave",this.#bt),this.#yt&&this.#p.removeEventListener("focus",this.#yt,!0),this.#kt&&this.#p.removeEventListener("blur",this.#kt,!0),this.#wt&&this.#p.removeEventListener("keydown",this.#wt)),this.#pt=this.#gt=this.#mt=this.#bt=null,this.#yt=this.#kt=this.#wt=null,this.#Dt=null,this.#w=null,this.#xt.clear(),this.#b&&(this.#c&&(this.#c.removeEventListener("pointerover",this.#b),this.#c.removeEventListener("pointerleave",this.#M)),this.#o&&(this.#o.removeEventListener("pointerover",this.#b),this.#o.removeEventListener("pointerleave",this.#M))),this.#b=this.#M=null,this.#D&&this.#c&&this.#c.removeEventListener("dblclick",this.#D),this.#D=null,this.#o&&(this.#P&&this.#o.removeEventListener("pointerdown",this.#P),this.#O&&this.#o.removeEventListener("keydown",this.#O)),this.#j&&this.#r&&this.#r.removeEventListener("keydown",this.#j),this.#P=this.#O=this.#j=null,this.#o&&(this.#Y&&this.#o.removeEventListener("pointermove",this.#Y),this.#X&&(this.#o.removeEventListener("pointerleave",this.#X),this.#o.removeEventListener("blur",this.#X,!0)),this.#nt&&this.#o.removeEventListener("focus",this.#nt,!0),this.#rt&&this.#o.removeEventListener("keydown",this.#rt)),this.#Y=this.#X=this.#nt=this.#rt=null,this.#k=this.#et=this.#R=this.#z=null,this.#N&&(this.#N.destroy(),this.#N=null),this.#H=null,this.#C&&this.#C(),this.#C=null,this.#r&&this.#r.parentNode&&this.#r.parentNode.removeChild(this.#r),this.#r=null,this.#a=this.#c=this.#u=this.#o=null,this.#G=this.#E=this.#V=this.#$=null,this.#m=this.#B=this.#K=this.#p=null)}}function ke(K,n,r={}){return new pe(K,n,r)}}),se("packages/modules/gantt/scurve.js",function(y,yt){"use strict";Object.defineProperty(y,"SCURVE_NS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(y,"computeSCurve",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(y,"GanttSCurveView",{enumerable:!0,get:function(){return T}});const Gt=yt("packages/modules/charts/svg.js"),$t=Gt.svg,ct=Gt.el,tt=Gt.setText,rt=Gt.path,N=Gt.round,lt=yt("packages/modules/charts/scale.js"),c=lt.linearScale,J=lt.measureDomain,p=yt("packages/modules/gantt/time.js"),x=p.toDayNumber,L=p.toISODate,M=p.fromDayNumber,G=yt("packages/modules/gantt/schedule.js").taskIdReader,$=yt("packages/modules/gantt/earned-value.js").computeEarnedValue,w=yt("packages/modules/gantt/messages.js").createTranslator,H=1e-9,F="lat-gantt-scurve",nt="data-lat-gantt-scurve-styles",it=Object.freeze({width:640,height:220,bucket:"day",statusDate:null,costField:"cost",actualCostField:"actualCost"});function _(k){if(k==null||k==="")return null;const A=typeof k=="number"?k:Number(k);return Number.isFinite(A)?A:null}function Y(k,A,W){return W-A<=H?k>=W?1:0:k<=A?0:k>=W?1:(k-A)/(W-A)}function R(k,A,W){if(k.pct>=1){const Z=Math.min(k.rec.ef,W);return A>=Z?k.bac:0}return k.pct>0&&A>=W?k.bac*k.pct:0}function ft(k,A,W){const Z=[];if(!(W>A))return Z;if(k==="day"){for(let st=A;st<W;st+=1)Z.push({start:st,end:st+1});return Z}if(k==="week"){for(let st=A;st<W;st+=7)Z.push({start:st,end:Math.min(W,st+7)});return Z}const m=M(A);if(!m)return Z;let St=Date.UTC(m.getUTCFullYear(),m.getUTCMonth(),1)/864e5;for(;St<W;){const st=M(St),At=Date.UTC(st.getUTCFullYear(),st.getUTCMonth()+1,1)/864e5;Z.push({start:St,end:Math.min(W,At)}),St=At}return Z}function mt(k,A,W={}){if(!A||!A.ok||!A.tasks||!A.order)return[];const Z=W.costField||"cost",m=W.actualCostField||"actualCost",St=W.bucket==="week"||W.bucket==="month"?W.bucket:"day",st=W.statusDate==null?A.projectFinish:x(W.statusDate)??A.projectFinish,At=W.rateCosts instanceof Map?W.rateCosts:null,Ut=G(W.fields),It=new Map;for(const E of Array.isArray(k)?k:[]){const O=Ut(E);O!=null&&It.set(String(O),E)}const l=[];for(const E of A.order){const O=A.tasks.get(E);if(!O||O.isSummary)continue;const I=It.get(E),i=I?_(I[Z]):null,o=At?At.get(E):null,e=i??(o&&o.hasRate?o.cost:O.duration),d=I?_(I[m]):null,t=O.percentComplete==null?0:Math.max(0,Math.min(100,O.percentComplete))/100,h=O.baselineStart!=null?O.baselineStart:O.es,u=O.baselineEnd!=null?O.baselineEnd:O.ef;l.push({rec:O,bac:e,pct:t,ac:d,bStart:h,bEnd:u})}const g=Math.floor(A.projectStart),v=Math.ceil(A.projectFinish),C=[];for(const E of ft(St,g,v)){const O=E.end;let I=0,i=0,o=0;for(const e of l)I+=e.bac*Y(O,e.bStart,e.bEnd),i+=R(e,O,st),e.ac!=null&&O>=st&&(o+=e.ac);C.push({date:O,pv:I,ev:i,ac:o})}return C}function Ct(){const k=F;return`
|
|
232
|
+
.${k}{font:13px/1.4 system-ui,sans-serif;color:var(--lattice-foreground,#1f2933);box-sizing:border-box;border:1px solid var(--lattice-border-color,#d7dbe0);border-radius:6px;padding:8px;background:var(--lattice-background,#fff)}
|
|
233
|
+
.${k} *{box-sizing:border-box}
|
|
234
|
+
.${k}__plot{display:block;max-width:100%}
|
|
235
|
+
.${k}__axis{stroke:var(--lattice-border-strong,#c4ccd4);stroke-width:1}
|
|
236
|
+
.${k}__grid{stroke:var(--lattice-border-color,#eef1f4);stroke-width:1}
|
|
237
|
+
.${k}__ticklabel{fill:var(--lattice-foreground-muted,#57606a);font-size:10px}
|
|
238
|
+
.${k}__series{fill:none;stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
|
|
239
|
+
.${k}__series--pv{stroke:var(--lattice-accent,#4a90d9)}
|
|
240
|
+
.${k}__series--ev{stroke:var(--lattice-success,#2c9c6a)}
|
|
241
|
+
.${k}__series--ac{stroke:var(--lattice-variant-danger-solid,#e2513b)}
|
|
242
|
+
.${k}__status{stroke:var(--lattice-foreground-muted,#8a94a0);stroke-width:1.5;stroke-dasharray:4 3}
|
|
243
|
+
.${k}__legend{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin-top:6px}
|
|
244
|
+
.${k}__legend-item{white-space:nowrap}
|
|
245
|
+
.${k}__swatch{display:inline-block;width:10px;height:10px;border-radius:2px;margin-right:4px;vertical-align:middle}
|
|
246
|
+
.${k}__swatch--pv{background:var(--lattice-accent,#4a90d9)}
|
|
247
|
+
.${k}__swatch--ev{background:var(--lattice-success,#2c9c6a)}
|
|
248
|
+
.${k}__swatch--ac{background:var(--lattice-variant-danger-solid,#e2513b)}
|
|
249
|
+
.${k}__index{color:var(--lattice-foreground-muted,#57606a)}
|
|
250
|
+
.${k}__table{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}
|
|
251
|
+
@scope ([data-theme="dark"]){:scope.${k},.${k}{color-scheme:dark}}
|
|
252
|
+
@scope ([data-theme="light"],[data-theme="auto"]){:scope.${k},.${k}{color-scheme:light}}
|
|
253
|
+
@media (prefers-color-scheme:dark){@scope ([data-theme="auto"]){:scope.${k},.${k}{color-scheme:dark}}}
|
|
254
|
+
`.trim()}function at(k){const A=k.documentElement;if(!A||A.getAttribute(nt))return;A.setAttribute(nt,"1");const W=k.createElement("style");W.textContent=Ct(),(k.head||k.body||A).appendChild(W)}function xt(k){const A=Number.isFinite(k)?k:0,W=Math.abs(A-Math.round(A))<1e-9?Math.round(A):N(A);return String(W).replace(/\B(?=(\d{3})+(?!\d))/g,",")}function D(k){return L(k)??String(k)}function X(k){return k==null||!Number.isFinite(k)?"—":k.toFixed(2)}class T{#n;#s;#t;#e;#i=null;#r=null;#a=!1;#c;constructor(A,W,Z={}){this.#n=A,this.#s=W,this.#t=W.ownerDocument,this.#e={...it,...Z},this.#c=w(A,()=>this.#e.messages),at(this.#t),this.#i=ct(this.#t,"div",F),this.#s.appendChild(this.#i),this.#r=A.on("schedule",()=>this.draw()),this.draw()}get element(){return this.#i}get options(){return{...this.#e}}#u(){if(this.#e.statusDate!=null){const W=x(this.#e.statusDate);if(Number.isFinite(W))return W}const A=this.#n.schedule;return A&&A.ok?A.projectFinish:0}draw(){if(this.#a||!this.#i)return;for(;this.#i.firstChild;)this.#i.removeChild(this.#i.firstChild);const A=this.#n.schedule;if(!A||!A.ok)return;const W=Math.max(80,Number(this.#e.width)||640),Z=Math.max(80,Number(this.#e.height)||220),m={top:16,right:16,bottom:26,left:48},St=this.#u(),st=mt(this.#n.tasks,A,{statusDate:St,bucket:this.#e.bucket,costField:this.#e.costField,actualCostField:this.#e.actualCostField}),At=$t(this.#t,"svg",{class:`${F}__plot`,width:W,height:Z,viewBox:`0 0 ${W} ${Z}`,role:"img","aria-label":"S-curve: cumulative planned value, earned value and actual cost"});if(this.#i.appendChild(At),!st.length)return;const Ut={min:Math.floor(A.projectStart),max:Math.ceil(A.projectFinish)},It=c(Ut,[m.left,W-m.right]),l=J(st.flatMap(i=>[i.pv,i.ev,i.ac]),{zero:!0}),g=c(l,[Z-m.bottom,m.top]),v=W-m.left-m.right;for(const i of g.ticks(5)){const o=N(g.of(i));At.appendChild($t(this.#t,"line",{class:`${F}__grid`,x1:m.left,y1:o,x2:W-m.right,y2:o}));const e=$t(this.#t,"text",{class:`${F}__ticklabel`,x:m.left-6,y:o+3,"text-anchor":"end"});tt(e,xt(i)),At.appendChild(e)}const C=It.ticks(Math.max(2,Math.min(8,Math.floor(v/60))));for(const i of C){const o=N(It.of(i)),e=$t(this.#t,"text",{class:`${F}__ticklabel`,x:o,y:Z-m.bottom+14,"text-anchor":"middle"});tt(e,D(i)),At.appendChild(e)}At.appendChild($t(this.#t,"line",{class:`${F}__axis`,x1:m.left,y1:Z-m.bottom,x2:W-m.right,y2:Z-m.bottom})),At.appendChild($t(this.#t,"line",{class:`${F}__axis`,x1:m.left,y1:m.top,x2:m.left,y2:Z-m.bottom}));for(const i of["pv","ev","ac"]){const o=[];for(const d of st)o.push(o.length?"L":"M",N(It.of(d.date)),N(g.of(d[i])));const e=$t(this.#t,"path",{class:`${F}__series ${F}__series--${i}`,d:rt(o),"data-series":i});At.appendChild(e)}if(St>=Ut.min&&St<=Ut.max){const i=N(It.of(St));At.appendChild($t(this.#t,"line",{class:`${F}__status`,x1:i,y1:m.top,x2:i,y2:Z-m.bottom,"data-status":String(St)}))}const E=$(this.#n.tasks,A,{statusDate:St,costField:this.#e.costField,actualCostField:this.#e.actualCostField}),O=ct(this.#t,"div",`${F}__legend`);for(const[i,o]of[["pv","PV"],["ev","EV"],["ac","AC"]]){const e=ct(this.#t,"span",`${F}__legend-item`),d=ct(this.#t,"span",`${F}__swatch ${F}__swatch--${i}`);d.setAttribute("aria-hidden","true"),e.appendChild(d),e.appendChild(this.#t.createTextNode(o)),O.appendChild(e)}const I=ct(this.#t,"span",`${F}__index`);tt(I,`${this.#c("gantt.scurve.spi",{index:X(E.project.spi)})} · ${this.#c("gantt.scurve.cpi",{index:X(E.project.cpi)})}`),O.appendChild(I),this.#i.appendChild(O),this.#i.appendChild(this.#o(st))}#o(A){const W=ct(this.#t,"table",`${F}__table`),Z=ct(this.#t,"thead",""),m=ct(this.#t,"tr","");for(const st of["Date","PV","EV","AC"]){const At=ct(this.#t,"th","");tt(At,st),m.appendChild(At)}Z.appendChild(m),W.appendChild(Z);const St=ct(this.#t,"tbody","");for(const st of A){const At=ct(this.#t,"tr","");for(const Ut of[D(st.date),xt(st.pv),xt(st.ev),xt(st.ac)]){const It=ct(this.#t,"td","");tt(It,Ut),At.appendChild(It)}St.appendChild(At)}return W.appendChild(St),W}refresh(){this.draw()}destroy(){this.#a||(this.#a=!0,this.#r&&this.#r(),this.#r=null,this.#i&&this.#i.parentNode&&this.#i.parentNode.removeChild(this.#i),this.#i=null)}}}),se("packages/modules/gantt/index.js",function(y,yt){"use strict";Object.defineProperty(y,"GANTT_STATE_VERSION",{enumerable:!0,get:function(){return E}}),Object.defineProperty(y,"createGantt",{enumerable:!0,get:function(){return i}}),Object.defineProperty(y,"default",{enumerable:!0,get:function(){return o}});const Gt=yt("packages/core/src/internal/util.js"),$t=Gt.warnOnce,ct=Gt.isObject,rt=yt("packages/modules/shared/emitter.js").Emitter,lt=yt("packages/core/src/model/history.js").HistoryModel,c=yt("packages/modules/gantt/schedule.js"),J=c.computeSchedule,p=c.findViolations,x=c.normalizeLinkSpec,L=c.taskIdReader,M=c.taskFieldWriters,B=c.resolveSchedulingMode,G=c.reconcileEffort,et=yt("packages/modules/gantt/resources.js"),$=et.computeResourceLoad,b=et.levelResources,w=et.normalizeResources,H=et.resourceDailyHours,F=et.parseAssignments,nt=et.normalizeResourceRates,it=yt("packages/modules/gantt/cost.js"),_=it.computeCost,Y=yt("packages/modules/gantt/earned-value.js"),R=Y.computeEarnedValue,ft=yt("packages/modules/gantt/mspdi.js"),mt=ft.importMSPDI,Ct=ft.exportMSPDI,at=yt("packages/modules/gantt/time.js"),xt=at.toISODate,D=at.toDayNumber,T=yt("packages/modules/gantt/calendar.js").createCalendar,k=yt("packages/modules/gantt/workload.js"),A=k.taskContour,W=k.contourSpan,Z=k.spanDuration,m=k.retimeContour,St=k.recordWorkingDays,st=k.serializeContour,Ut=yt("packages/modules/gantt/render.js").GanttView,l=yt("packages/modules/gantt/split.js").GanttSplitView,g=yt("packages/modules/gantt/scurve.js"),v=g.GanttSCurveView,C=g.computeSCurve;Object.defineProperty(y,"computeSchedule",{enumerable:!0,get:function(){return c.computeSchedule}}),Object.defineProperty(y,"findViolations",{enumerable:!0,get:function(){return c.findViolations}}),Object.defineProperty(y,"normalizeTasks",{enumerable:!0,get:function(){return c.normalizeTasks}}),Object.defineProperty(y,"normalizeDependencies",{enumerable:!0,get:function(){return c.normalizeDependencies}}),Object.defineProperty(y,"topoOrder",{enumerable:!0,get:function(){return c.topoOrder}}),Object.defineProperty(y,"LINK_TYPES",{enumerable:!0,get:function(){return c.LINK_TYPES}}),Object.defineProperty(y,"SCHEDULE_ERROR",{enumerable:!0,get:function(){return c.SCHEDULE_ERROR}}),Object.defineProperty(y,"EPS",{enumerable:!0,get:function(){return c.EPS}}),Object.defineProperty(y,"CONSTRAINT_TYPES",{enumerable:!0,get:function(){return c.CONSTRAINT_TYPES}}),Object.defineProperty(y,"SCHEDULING_MODES",{enumerable:!0,get:function(){return c.SCHEDULING_MODES}}),Object.defineProperty(y,"resolveSchedulingMode",{enumerable:!0,get:function(){return c.resolveSchedulingMode}}),Object.defineProperty(y,"reconcileEffort",{enumerable:!0,get:function(){return c.reconcileEffort}}),Object.defineProperty(y,"toDayNumber",{enumerable:!0,get:function(){return at.toDayNumber}}),Object.defineProperty(y,"fromDayNumber",{enumerable:!0,get:function(){return at.fromDayNumber}}),Object.defineProperty(y,"toISODate",{enumerable:!0,get:function(){return at.toISODate}}),Object.defineProperty(y,"importMSPDI",{enumerable:!0,get:function(){return ft.importMSPDI}}),Object.defineProperty(y,"exportMSPDI",{enumerable:!0,get:function(){return ft.exportMSPDI}}),Object.defineProperty(y,"computeEarnedValue",{enumerable:!0,get:function(){return Y.computeEarnedValue}}),Object.defineProperty(y,"computeCost",{enumerable:!0,get:function(){return it.computeCost}}),Object.defineProperty(y,"computeSCurve",{enumerable:!0,get:function(){return g.computeSCurve}});const E=1;function O(e){return Array.isArray(e)?"array":e===null?"null":typeof e}function I(e){return d=>{const t=e(d);if(typeof t=="string"||typeof t=="number"&&Number.isFinite(t))return t;throw new Error(`lattice-gantt: rowKey function must return a string or number; got ${O(t)}.`)}}function i(e={}){const d=new rt("gantt");let t=Array.isArray(e.tasks)?e.tasks.map(a=>({...a})):[],h=Array.isArray(e.dependencies)?e.dependencies.map(x):[];const u=e.projectStart,q=e.deadline,U=e.calendar??null,gt=T(U,D(u)??0),ht=gt?a=>gt.isWorking(a):null,kt=e.resources??null,dt=e.defaultCapacity,wt=typeof e.title=="string"?e.title:null,P=Number.isFinite(Number(e.hoursPerDay))&&Number(e.hoursPerDay)>0?Number(e.hoursPerDay):8,ot=B(e.schedulingMode)||"fixedDuration",Lt=!!e.effortDriven,Bt=!!e.autoSchedule,_t=e.grid??null,bt=e.columns&&typeof e.columns=="object"?{...e.columns}:null,Ft=ct(e.fields)?{...e.fields}:{};if(e.rowKey!==void 0&&typeof e.rowKey!="function"&&!(typeof e.rowKey=="string"&&e.rowKey.length>0))throw new Error("lattice-gantt: rowKey must be a property name or a function; composite keys are not supported on tasks.");const Jt=typeof e.rowKey=="function"?I(e.rowKey):e.rowKey??(typeof Ft.id=="string"?Ft.id:"id"),ie=a=>String(typeof Jt=="function"?Jt(a):a[Jt]);Ft.id===void 0&&(Ft.id=a=>a&&a.id!=null?a.id:a?typeof Jt=="function"?Jt(a):a[Jt]:null);const te=L(Ft),de=M(Ft),re=a=>de[a]||a,ne=new Map;if(bt)for(const a of["start","end","duration","percentComplete","name"])bt[a]&&ne.set(bt[a],a);let Dt=null,Zt=!1,qt=null,pe=null,ke=null,K=null,n=null;const r=new Set,s=[];function f(){const a=H(kt,dt,{calendar:U,hoursPerDay:P}),S=J(t,h,{projectStart:u,deadline:q,calendar:U,fields:Ft,schedulingMode:e.schedulingMode!=null?ot:void 0,effortDriven:e.effortDriven!=null?Lt:void 0,hoursPerDay:P,resourceHours:a});if(S.ok){const pt=$(t,S,{resources:kt,defaultCapacity:dt,calendar:U,fields:Ft,hoursPerDay:P});S.resourceLoad=pt,S.overAllocations=pt.overAllocations,Dt=S,d.emit("schedule",S)}else d.emit("error",S.error);return S}function z(a,S,pt,Q,jt){const Yt=Kt=>{d.emit(S,{...pt,reason:Kt})},Xt=d.emitBefore(a,pt);return Xt===!0?Q():Xt===!1?Yt(pt.reason||"prevented"):Xt.then(Kt=>Kt?typeof jt=="function"&&!jt()?Yt("stale"):Q():Yt(pt.reason||"prevented"))}function j(a){return t.findIndex(S=>String(te(S))===a)}function V(a,S,pt){const Q=j(a);if(Q<0)return;const jt={...t[Q],[re(S)]:pt};t=t.slice(),t[Q]=jt}function ut(a,S){return t[a][re(S)]}function vt(a){const S=new Map;for(const pt of Array.isArray(a)?a:[]){const Q=String((pt&&typeof pt=="object"?pt.resource??pt.name??pt.id:pt)??"");if(Q==="")continue;const jt=pt&&typeof pt=="object"&&pt.units!=null?Number(pt.units):1;S.set(Q,{resource:Q,units:Number.isFinite(jt)&&jt>=0?jt:1})}return[...S.values()]}function Ot(a){const S=j(a),pt=S>=0?t[S]:{},Q=Dt&&Dt.ok?Dt.tasks.get(a):null,jt=F(pt),Yt=Q&&Q.schedulingMode||B(pt.schedulingMode??pt.taskType)||ot,Xt=Q&&Q.effortDriven!=null?!!Q.effortDriven:pt.effortDriven!=null?!!pt.effortDriven:Lt,Kt=Q&&Q.units!=null?Q.units:jt.reduce((me,ve)=>me+ve.units,0)||1,oe=Q&&Q.duration!=null?Q.duration:Number(pt.duration)||0,ce=Q&&Q.effort!=null&&Q.duration>0&&Kt>0?Q.effort/(Q.duration*Kt):P;return{mode:Yt,effortDriven:Xt,duration:oe,units:Kt,hoursPerDay:ce,assignments:jt}}function Mt(a,S,pt){if(!S.length)return;const Q=S.reduce((jt,Yt)=>jt+Yt.units,0)||1;V(a,"assignments",S.map(jt=>({resource:jt.resource,units:jt.units*pt/Q})))}function Vt(a){if(!_t||!_t.edit||typeof _t.edit.setCells!="function"||!bt||!Dt||!Dt.ok)return 0;const S=[];for(const pt of a){const Q=Dt.tasks.get(pt);!Q||Q.isSummary||(bt.start&&S.push({key:pt,colId:bt.start,value:Q.es}),bt.end&&S.push({key:pt,colId:bt.end,value:Q.ef}),bt.duration&&S.push({key:pt,colId:bt.duration,value:Q.duration}))}if(!S.length)return 0;for(const pt of S)r.add([pt.key,pt.colId].join(""));return _t.edit.setCells(S,"cell")}function Wt(a,S,pt={}){if(!_t||!_t.edit||typeof _t.edit.setCells!="function"||!bt)return 0;const Q=j(a);if(Q<0)return 0;const jt=[];for(const Yt of S){if(!bt[Yt])continue;const Xt=Yt in pt?pt[Yt]:ut(Q,Yt);Xt!==void 0&&jt.push({key:a,colId:bt[Yt],value:Xt})}if(!jt.length)return 0;for(const Yt of jt)r.add([Yt.key,Yt.colId].join(""));return _t.edit.setCells(jt,"cell")}function Pt(a,S){const pt=ne.get(S.colId);if(!pt)return;const Q=[S.key,S.colId].join(""),jt=r.delete(Q),Yt=String(S.key);a==="confirmed"?S.value!==void 0&&Rt(Yt,pt,S.value)&&f():a==="reverted"&&jt&&S.restored!==void 0?Rt(Yt,pt,S.restored)&&f():a==="conflict"&&jt&&S.value!==void 0&&Rt(Yt,pt,S.value)&&f()}function Rt(a,S,pt){const Q=j(a);if(Q<0)return!1;const jt=ut(Q,S);return jt===pt||String(jt)===String(pt)?!1:(V(a,S,pt),!0)}_t&&typeof _t.on=="function"&&(s.push(_t.on("cell:changed",a=>Pt("confirmed",a))),s.push(_t.on("cell:confirmed",a=>Pt("confirmed",a))),s.push(_t.on("cell:reverted",a=>Pt("reverted",a))),s.push(_t.on("cell:conflict",a=>Pt("conflict",a))));const Et=Number.isFinite(Number(e.historyDepth))&&Number(e.historyDepth)>=0?Math.floor(Number(e.historyDepth)):100,Tt=new lt({depth:Et,apply:a=>{a&&Array.isArray(a.tasks)&&(t=a.tasks.map(S=>({...S}))),a&&Array.isArray(a.dependencies)&&(h=a.dependencies.map(S=>({...S}))),f()}});function Ht(){return{tasks:t.slice(),dependencies:h.slice()}}function Nt(a){d.emit("history",{canUndo:Tt.canUndo(),canRedo:Tt.canRedo(),label:a??null})}function Qt(a,S,pt,Q,jt){if(Tt.replaying)return;const Yt=Tt.push({type:a,label:S,target:pt==null?null:String(pt),before:Q,after:Ht(),coalesce:!!jt});Yt&&Nt(Yt.label)}f();const zt={get tasks(){return t.map(a=>({...a}))},get dependencies(){return h.map(a=>({...a}))},readId(a){return te(a)},taskById(a){const S=j(a);return S<0?null:{...t[S]}},get schedule(){return Dt},get hoursPerDay(){return P},get critical(){return Dt&&Dt.ok?Dt.critical:[]},get conflicts(){return Dt&&Dt.ok?Dt.conflicts||[]:[]},get autoSchedule(){return Bt},get resourceLoad(){return Dt&&Dt.ok&&Dt.resourceLoad||null},get resourceModels(){return w(kt,dt,{calendar:U,hoursPerDay:P})},get resourceRates(){return nt(kt)},get overAllocations(){return Dt&&Dt.ok?Dt.overAllocations||[]:[]},setTasks(a){return Zt?($t("gantt-destroyed","[lattice] gantt: setTasks on a destroyed controller ignored."),Dt):(t=Array.isArray(a)?a.map(S=>({...S})):[],Tt.clear(),Nt(null),f())},setDependencies(a){if(Zt)return $t("gantt-destroyed","[lattice] gantt: setDependencies on a destroyed controller ignored."),Dt;const S=Array.isArray(a)?a.map(x):[],pt=Xt=>`${String(Xt.from)}${String(Xt.to)}${Xt.type?String(Xt.type).toUpperCase():"FS"}`,Q=new Set(h.map(pt)),jt=S.filter(Xt=>!Q.has(pt(Xt))),Yt=()=>{const Xt=Ht();h=S;const Kt=f();return Qt("link","link",null,Xt,!1),Kt};return jt.length?z("beforeDependencyCreate","dependencyCreate:cancelled",{added:jt,dependencies:S,origin:"user"},Yt):Yt()},applyEdit(a,S={}){if(Zt)return $t("gantt-destroyed","[lattice] gantt: applyEdit on a destroyed controller ignored."),Dt;const pt=ct(e.fields)?["start","end","duration","percentComplete","name"].filter(fe=>typeof e.fields[fe]=="function"):[];pt.length&&$t("gantt-edit-mapped-field",`[lattice] gantt: this plan reads ${pt.join(", ")} through a \`fields\` FUNCTION, which has no inverse, so applyEdit writes the canonical property name and the edit will not be read back. Map those fields to a field NAME instead, or edit the host row through your own writer and feed the result in with rows.apply.`);const Q=a&&a.id!=null?String(a.id):null;if(j(Q)<0)return $t(`gantt-edit-unknown-${Q}`,`[lattice] gantt: applyEdit for unknown task "${Q}" ignored.`),Dt;const jt=Object.keys(a).filter(fe=>fe!=="id"&&a[fe]!==void 0),Yt=jt.filter(fe=>fe!=="start"&&fe!=="end"&&fe!=="duration"),Xt={...t[j(Q)]},Kt=Dt&&Dt.ok?Dt.tasks.get(Q):null,oe=Kt?!!Kt.isMilestone:!!Xt.milestone,ce=a.start!==void 0||a.end!==void 0,me=a.duration!==void 0,ve=a.percentComplete!==void 0;let he="beforeTaskEdit",be="taskEdit:cancelled";oe&&ce?(he="beforeMilestoneMove",be="milestoneMove:cancelled"):ve?(he="beforeProgressChange",be="progressChange:cancelled"):me?(he="beforeTaskResize",be="taskResize:cancelled"):ce&&(he="beforeTaskMove",be="taskMove:cancelled");const _e=ut(j(Q),"start"),Se={id:Q,task:Xt,patch:{...a},origin:"user",from:_e??(Kt?Kt.es:void 0),to:a.start,duration:a.duration,value:ve?a.percentComplete:void 0,oldValue:ve?ut(j(Q),"percentComplete"):void 0};return z(he,be,Se,()=>{const fe=Ht(),He=Dt&&Dt.ok?new Map([...Dt.tasks].map(([ee,ae])=>[ee,ae.es])):new Map,Ne=a.work===void 0&&(ce||me)&&Kt&&!Kt.isSummary?A(t[j(Q)]):null,Te=Ne&&Ne.length?St(Kt,ht):null,ue=Ot(Q),Ce=a.effort!==void 0||a.units!==void 0||a.addResource!==void 0||a.removeResource!==void 0||a.assignments!==void 0||a.duration!==void 0&&ue.mode==="fixedEffort",Pe=[];if(Ce){Pe.push("effort","units","addResource","removeResource","assignments","duration");let ee;if(a.assignments!==void 0){let ae=vt(a.assignments);const le=ae.length===ue.assignments.length&&ae.every(ye=>ue.assignments.some(we=>we.resource===ye.resource)),ge=ae.reduce((ye,we)=>ye+we.units,0);ee={duration:ue.duration,units:ue.units,effort:void 0},ae.length&&(ee=G({...ue},{field:"units",value:ge}),ue.mode==="fixedDuration"&&ue.effortDriven&&!le&&(ae=ae.map(ye=>({resource:ye.resource,units:ye.units*ue.units/(ge||1)})),ee=G({...ue},{field:"units",value:ue.units}))),V(Q,"assignments",ae)}else if(a.addResource!==void 0||a.removeResource!==void 0){const ae=a.addResource!==void 0,le=ae?a.addResource:a.removeResource,ge=String((le&&typeof le=="object"?le.resource??le.name??le.id:le)??""),ye=le&&typeof le=="object"&&Number.isFinite(Number(le.units))?Number(le.units):1;ee=G({...ue},{field:ae?"addResource":"removeResource",units:ye});let we=ae?[...ue.assignments,{resource:ge,units:ye}]:ue.assignments.filter(je=>je.resource!==ge);if(ue.mode==="fixedDuration"&&ue.effortDriven){const je=we.reduce((Me,We)=>Me+We.units,0)||1;we=we.map(Me=>({resource:Me.resource,units:Me.units*ee.units/je}))}V(Q,"assignments",we)}else{const ae=a.units!==void 0?"units":a.effort!==void 0?"effort":"duration",le=a.units!==void 0?a.units:a.effort!==void 0?a.effort:a.duration;ee=G({...ue},{field:ae,value:Number(le)}),Math.abs(ee.units-ue.units)>1e-9&&Mt(Q,ue.assignments,ee.units)}ee.duration!=null&&Number.isFinite(ee.duration)&&V(Q,"duration",ee.duration),ee.effort!=null&&Number.isFinite(ee.effort)&&V(Q,"effort",ee.effort)}for(const ee of jt)Pe.includes(ee)||V(Q,ee,a[ee]);const Ie=Array.isArray(a.work)?A({work:a.work}):null;if(Ie&&a.start===void 0&&a.end===void 0&&a.duration===void 0){const ee=W(Ie);ee&&(V(Q,"start",ee.first),V(Q,"duration",Z(ee.first,ee.last,ht)))}f();let Re=!1;if(Te&&Te.length&&Dt.ok){const ee=Dt.tasks.get(Q),ae=ee&&!ee.isSummary?St(ee,ht):[];ae.length&&(V(Q,"work",st(m(Ne,Te,ae))),Re=!0,f())}const Oe=[Q];if(Bt&&Dt.ok){for(const ee of Dt.order){if(ee===Q)continue;const ae=Dt.tasks.get(ee);ae.isSummary||He.get(ee)!==ae.es&&(V(ee,"start",ae.es),Oe.push(ee))}Oe.length>1&&f()}if(S.writeBack){Vt(Oe);const ee=Ce?Yt.filter(le=>!Pe.includes(le)):Yt,ae=Re&&!ee.includes("work")?[...ee,"work"]:ee;if(ae.length&&Wt(Q,ae),Ce&&Dt.ok){const le=Dt.tasks.get(Q),ge=j(Q);Wt(Q,["assignments","effort","units"],{assignments:ge>=0?ut(ge,"assignments"):void 0,effort:le&&le.effort!=null?le.effort:ge>=0?ut(ge,"effort"):void 0,units:le?le.units:void 0})}}let $e="field",Ae=!1;return a.work!==void 0?($e="workload",Ae=!0):Ce?$e="assignment":he==="beforeTaskMove"||he==="beforeMilestoneMove"?($e="move",Ae=!0):he==="beforeTaskResize"?($e="resize",Ae=!0):he==="beforeProgressChange"&&($e="progress"),Qt($e,$e,Q,fe,Ae),Dt},()=>j(Q)>=0)},deleteTask(a){if(Zt)return $t("gantt-destroyed","[lattice] gantt: deleteTask on a destroyed controller ignored."),Dt;const S=a!=null?String(a):null;if(j(S)<0)return $t(`gantt-delete-unknown-${S}`,`[lattice] gantt: deleteTask for unknown task "${S}" ignored.`),Dt;const pt={...t[j(S)]};return z("beforeTaskDelete","taskDelete:cancelled",{id:S,task:pt,origin:"user"},()=>{const jt=Ht();t=t.filter(Xt=>String(te(Xt))!==S),h=h.filter(Xt=>String(Xt.from)!==S&&String(Xt.to)!==S);const Yt=f();return Qt("delete","delete",S,jt,!1),Yt},()=>j(S)>=0)},compute:f,rows:{apply(a){if(Zt||!a)return{added:[],updated:[],removed:[]};const S=Ht(),pt=new Map;t.forEach((oe,ce)=>pt.set(ie(oe),ce));const Q=t.slice(),jt=[],Yt=[],Xt=[];for(const oe of[...a.add||[],...a.update||[]]){const ce=ie(oe);pt.has(ce)?(Q[pt.get(ce)]={...Q[pt.get(ce)],...oe},Yt.push(oe)):(pt.set(ce,Q.length),Q.push({...oe}),jt.push(oe))}for(const oe of a.remove||[]){const ce=oe&&typeof oe=="object"?ie(oe):String(oe);pt.has(ce)&&(Q[pt.get(ce)]=null,Xt.push(ce))}t=Q.filter(Boolean),f();const Kt=jt.length&&!Yt.length&&!Xt.length;return Qt(Kt?"add":"change",Kt?"add":"change",jt.length===1&&!Yt.length&&!Xt.length?ie(jt[0]):null,S,!1),{added:jt,updated:Yt,removed:Xt}},forEach(a){if(typeof a=="function")for(const S of t)a(S,ie(S))},get count(){return t.length}},toCSV(a={}){if(!Dt||!Dt.ok)return"";const S=!!a.dates,pt=Xt=>S?xt(Xt)??String(Xt):String(Xt),Q=Xt=>{const Kt=Xt==null?"":String(Xt);return/[",\n]/.test(Kt)?`"${Kt.replace(/"/g,'""')}"`:Kt},Yt=[["id","name","start","end","duration","percentComplete","totalFloat","critical"].join(",")];for(const Xt of Dt.order){const Kt=Dt.tasks.get(Xt);Yt.push([Kt.id,Kt.name,pt(Kt.es),pt(Kt.ef),Kt.duration,Kt.percentComplete==null?"":Kt.percentComplete,Kt.totalFloat,Kt.critical].map(Q).join(","))}return Yt.join(`
|
|
255
|
+
`)},toMSPDI(a={}){return Ct({tasks:t,dependencies:h,resources:kt,projectStart:u,calendar:U,schedule:Dt,fields:Ft},{hoursPerDay:P,...a})},findViolations(){return p(t,Dt,Ft)},resources(a={}){return $(t,Dt,{resources:a.resources??kt,defaultCapacity:a.defaultCapacity??dt,calendar:U,fields:Ft,hoursPerDay:P})},previewAssignments(a,S){const pt=j(String(a)),Q=t.slice();return pt>=0&&(Q[pt]={...t[pt],assignments:vt(S)}),$(Q,Dt,{resources:kt,defaultCapacity:dt,calendar:U,fields:Ft,hoursPerDay:P})},level(a={}){if(Zt)return $t("gantt-destroyed","[lattice] gantt: level on a destroyed controller ignored."),{ok:!1};if(ct(e.fields)&&e.fields.start!==void 0)return $t("gantt-level-mapped-start","[lattice] gantt: level() is not available on a plan that maps `fields.start`, because leveling has to write a new start back and a field mapping only says how to READ one. Level the plan with its own `start` field, or apply the returned moves yourself."),{ok:!1,error:{code:"mapped-start",message:"level() cannot write back through fields.start"}};const S=b(t,h,{projectStart:u,deadline:q,calendar:U,fields:Ft,hoursPerDay:P,resources:a.resources??kt,defaultCapacity:a.defaultCapacity??dt,priorityField:a.priorityField,maxIterations:a.maxIterations});if(!S.ok||a.dryRun)return S;const pt=Ht();return t=S.tasks.map(Q=>({...Q})),f(),Qt("level","level",null,pt,!1),a.writeBack&&S.moves&&S.moves.length&&Vt(S.moves.map(Q=>Q.id)),{...S,schedule:Dt}},on(a,S){return d.on(a,S)},off(a,S){d.off(a,S)},emitColumnResize(a){d.emit("columnResize",a)},undo(){const a=Tt.undo();return a?(Nt(a.label),!0):!1},redo(){const a=Tt.redo();return a?(Nt(a.label),!0):!1},canUndo(){return Tt.canUndo()},canRedo(){return Tt.canRedo()},clearHistory(){Tt.clear(),Nt(null)},get grid(){return _t},get view(){return qt},get title(){return wt},toSVG(a){return qt&&typeof qt.toSVG=="function"?qt.toSVG(a):""},toPNG(a){return qt&&typeof qt.toPNG=="function"?qt.toPNG(a):Promise.resolve(null)},print(a){return Zt?($t("gantt-destroyed","[lattice] gantt: print on a destroyed controller ignored."),!1):n!=="split"||!qt||typeof qt.print!="function"?($t("gantt-print-no-split","[lattice] gantt: print() needs a mounted split view (mountSplit); the plain view has no table or bands to print."),!1):qt.print(a)},mount(a,S={}){return Zt?($t("gantt-destroyed","[lattice] gantt: mount on a destroyed controller ignored."),null):(qt&&qt.destroy(),qt=new Ut(zt,a,S),ke=a,K={...S},n="plain",qt)},mountSplit(a,S={}){return Zt?($t("gantt-destroyed","[lattice] gantt: mountSplit on a destroyed controller ignored."),null):(qt&&(qt.destroy(),qt=null),qt=new l(zt,a,S),ke=a,K={...S},n="split",qt)},captureBaseline(){if(!Dt||!Dt.ok)return[];const a=[];for(const S of Dt.order){const pt=Dt.tasks.get(S);pt.isSummary||a.push({id:pt.id,baselineStart:pt.es,baselineEnd:pt.ef,baselineDuration:pt.ef-pt.es})}return a},cost(a={}){return _(t,Dt,{resources:kt,hoursPerDay:P,isWorking:ht,fields:Ft,costField:a.costField})},earnedValue(a={}){const S=_(t,Dt,{resources:kt,hoursPerDay:P,isWorking:ht,fields:Ft,costField:a.costField});return R(t,Dt,{...a,fields:Ft,rateCosts:S.ok?S.byTask:null})},sCurve(a={}){const S=_(t,Dt,{resources:kt,hoursPerDay:P,isWorking:ht,fields:Ft,costField:a.costField});return C(t,Dt,{...a,fields:Ft,rateCosts:S.ok?S.byTask:null})},mountSCurve(a,S={}){return Zt?($t("gantt-destroyed","[lattice] gantt: mountSCurve on a destroyed controller ignored."),null):(pe&&pe.destroy(),pe=new v(zt,a,S),pe)},getState(){const a=n,S=qt?qt.options:{},pt=typeof S.zoom=="string"||Number.isFinite(S.zoom)?S.zoom:null,Q=S.calendar==null||typeof S.calendar=="string"||ct(S.calendar)?S.calendar??null:null;return{version:E,mounted:a,zoom:pt,showArrows:S.showArrows===void 0?!0:!!S.showArrows,showProgress:S.showProgress===void 0?!0:!!S.showProgress,showBaseline:a==="split"?!!S.showBaseline:null,calendar:Q,nonWorking:typeof S.nonWorking=="string"?S.nonWorking:null,groupBy:a==="plain"&&typeof S.groupBy=="string"?S.groupBy:null,gridWidth:a==="split"&&Number.isFinite(S.gridWidth)?S.gridWidth:null,columnWidths:a==="split"&&qt&&typeof qt.getColumnWidths=="function"?qt.getColumnWidths():null,collapsed:a==="split"&&qt?[...qt.collapsed]:[],workloadUnit:a==="split"&&qt&&typeof qt.getWorkloadUnit=="function"?qt.getWorkloadUnit():null}},setState(a){Tt.clear(),Nt(null);const S=ct(a)?a:{};typeof S.version=="number"&&S.version>E&&$t("gantt-state-version",`[lattice] gantt: setState received a state from a newer version (${S.version} > ${E}); unrecognised fields are ignored.`);const Q=S.mounted==="plain"||S.mounted==="split"||S.mounted===null?S.mounted:n;if(Q!=="plain"&&Q!=="split")return qt&&zt.unmount(),zt;if(!ke)return $t("gantt-state-no-container","[lattice] gantt: setState was asked to show a view but no container is known yet; call mount()/mountSplit() at least once first."),zt;const jt={};(typeof S.zoom=="string"||Number.isFinite(S.zoom))&&(jt.zoom=S.zoom),typeof S.showArrows=="boolean"&&(jt.showArrows=S.showArrows),typeof S.showProgress=="boolean"&&(jt.showProgress=S.showProgress),Q==="split"&&typeof S.showBaseline=="boolean"&&(jt.showBaseline=S.showBaseline),(S.calendar===null||typeof S.calendar=="string"||ct(S.calendar))&&(jt.calendar=S.calendar),typeof S.nonWorking=="string"&&(jt.nonWorking=S.nonWorking),Q==="plain"&&typeof S.groupBy=="string"&&(jt.groupBy=S.groupBy),Q==="split"&&Number.isFinite(S.gridWidth)&&(jt.gridWidth=S.gridWidth);const Xt={...n===Q&&K?K:{},...jt};if(Q==="split"?zt.mountSplit(ke,Xt):zt.mount(ke,Xt),Q==="split"&&Array.isArray(S.collapsed)&&qt)for(const Kt of new Set(S.collapsed.map(String)))qt.toggle(Kt);return Q==="split"&&qt&&typeof qt.setWorkloadUnit=="function"&&(S.workloadUnit==="hours"||S.workloadUnit==="percent"||S.workloadUnit==="cost")&&qt.setWorkloadUnit(S.workloadUnit),Q==="split"&&qt&&typeof qt.setColumnWidths=="function"&&ct(S.columnWidths)&&qt.setColumnWidths(S.columnWidths),zt},unmount(){qt&&(qt.destroy(),qt=null),n=null},destroy(){Zt=!0,qt&&(qt.destroy(),qt=null),pe&&(pe.destroy(),pe=null),ke=null,K=null,n=null;for(const a of s)a();s.length=0,r.clear(),Tt.destroy(),d.clear()}};return e.element&&zt.mount(e.element,e.render||{}),zt}const o=i});var De=Le("packages/modules/gantt/index.js");typeof module=="object"&&module.exports?module.exports=De:typeof define=="function"&&define.amd?define(function(){return De}):ze.LatticeGridGantt=De})(typeof globalThis<"u"?globalThis:this);
|
|
250
256
|
|
|
251
257
|
//# sourceMappingURL=gantt.min.js.map
|