@toclocoinc/lattice-grid 1.80.0 → 1.81.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/angular/package.json +1 -1
- package/docs/API.html +4 -4
- package/docs/THEMING.md +6 -3
- package/docs/api/adapters.html +1 -1
- package/docs/api/ai.html +1 -1
- package/docs/api/alarms.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 +1 -1
- package/docs/api/geometry.html +1 -1
- package/docs/api/grid.html +2 -2
- package/docs/api/index.html +1 -1
- 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/mock-socket.html +1 -1
- package/docs/api/presets.html +1 -1
- package/docs/api/tabs.html +1 -1
- package/docs/api/types.html +1 -1
- 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.css +1 -1
- 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/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-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-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-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-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-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-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-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/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 +1 -1
- package/modules/gantt.esm.min.js +2 -2
- package/modules/gantt.min.cjs +2 -2
- package/modules/gantt.min.js +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/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/antd5.css +23 -0
- package/modules/presets/bootstrap5.css +46 -5
- package/modules/presets/fluent2.css +31 -4
- package/modules/presets/material3.css +53 -5
- 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.min.cjs +2 -2
- package/modules/react.min.js +2 -2
- package/modules/svelte.d.ts +1 -1
- package/modules/svelte.esm.min.js +2 -2
- package/modules/svelte.min.cjs +2 -2
- package/modules/svelte.min.js +2 -2
- 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.min.cjs +2 -2
- package/modules/vue.min.js +2 -2
- package/modules/webcomponent.d.ts +1 -1
- package/modules/webcomponent.esm.min.js +3 -3
- package/modules/webcomponent.min.cjs +3 -3
- package/modules/webcomponent.min.js +3 -3
- package/package.json +1 -1
package/modules/gantt.esm.min.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.
|
|
2
|
+
* Lattice Grid 1.81.0, gantt module
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
6
|
-
var qt=Object.create(null),Jt=Object.create(null);function Et(h,pt){qt[h]=pt}function Qt(h){var pt=Jt[h];if(pt)return pt;var Dt=Object.create(null);Jt[h]=Dt;var dt=qt[h];if(!dt)throw new Error("[lattice] missing module: "+h);return dt(Dt,Qt),Dt}Et("packages/core/src/internal/util.js",function(h,pt){"use strict";Object.defineProperty(h,"VERSION",{enumerable:!0,get:function(){return at}}),Object.defineProperty(h,"reportedWarnings",{enumerable:!0,get:function(){return _}}),Object.defineProperty(h,"warnOnce",{enumerable:!0,get:function(){return et}}),Object.defineProperty(h,"infoOnce",{enumerable:!0,get:function(){return $}}),Object.defineProperty(h,"resetWarnings",{enumerable:!0,get:function(){return T}}),Object.defineProperty(h,"fail",{enumerable:!0,get:function(){return A}}),Object.defineProperty(h,"invariant",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(h,"DEV",{enumerable:!0,get:function(){return K}}),Object.defineProperty(h,"isObject",{enumerable:!0,get:function(){return R}}),Object.defineProperty(h,"isFunction",{enumerable:!0,get:function(){return F}}),Object.defineProperty(h,"isNil",{enumerable:!0,get:function(){return X}}),Object.defineProperty(h,"isBlank",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(h,"isCtor",{enumerable:!0,get:function(){return it}}),Object.defineProperty(h,"pathGetter",{enumerable:!0,get:function(){return f}}),Object.defineProperty(h,"pathSetter",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(h,"getPath",{enumerable:!0,get:function(){return I}}),Object.defineProperty(h,"setPath",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(h,"humanise",{enumerable:!0,get:function(){return j}}),Object.defineProperty(h,"escapeHtml",{enumerable:!0,get:function(){return u}}),Object.defineProperty(h,"titleCase",{enumerable:!0,get:function(){return L}}),Object.defineProperty(h,"expand",{enumerable:!0,get:function(){return k}}),Object.defineProperty(h,"toArray",{enumerable:!0,get:function(){return U}}),Object.defineProperty(h,"merge",{enumerable:!0,get:function(){return B}}),Object.defineProperty(h,"mergeRow",{enumerable:!0,get:function(){return W}}),Object.defineProperty(h,"Lru",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(h,"collator",{enumerable:!0,get:function(){return S}}),Object.defineProperty(h,"defaultCompare",{enumerable:!0,get:function(){return p}}),Object.defineProperty(h,"now",{enumerable:!0,get:function(){return M}}),Object.defineProperty(h,"nextFrame",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(h,"cancelFrame",{enumerable:!0,get:function(){return st}}),Object.defineProperty(h,"frameBatched",{enumerable:!0,get:function(){return r}}),Object.defineProperty(h,"settleDebounce",{enumerable:!0,get:function(){return c}}),Object.defineProperty(h,"whenIdle",{enumerable:!0,get:function(){return m}}),Object.defineProperty(h,"uid",{enumerable:!0,get:function(){return z}});const Dt="1.80.0";async function dt(){return Dt}const at="1.80.0",V=new Set,tt=2e3;function x(s){if(V.add(s),V.size>tt){const e=V.values().next().value;e!==void 0&&V.delete(e)}}const J=[],l=500;function v(s,e,t){J.push({key:s,level:e,message:t.map(n=>typeof n=="string"?n:g(n)).join(" "),at:Date.now()}),J.length>l&&J.shift()}function g(s){if(s instanceof Error)return s.message;try{return JSON.stringify(s)}catch{return String(s)}}function _(){return J.map(s=>({...s}))}function q(s){if(s.length===0||typeof s[0]!="string")return s;const e=s[0].replace(/^\[lattice\]\s*/,"");return e===s[0]?s:[e,...s.slice(1)]}function et(s,...e){if(V.has(s))return;x(s);const t=q(e);v(s,"warn",t),console.warn("[lattice]",...t)}function $(s,...e){if(V.has(s))return;x(s);const t=q(e);v(s,"info",t),console.info("[lattice]",...t)}function T(){V.clear(),J.length=0}function A(s,e){const t=new Error(`[lattice] ${s}`);throw e!==void 0&&(t.cause=e),t}function ot(s,e){s||A(e)}const K=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function R(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}function F(s){return typeof s=="function"}function X(s){return s==null}function Q(s){return s==null||s===""}function it(s){return typeof s!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(s))?!0:!!(s.prototype&&Object.getOwnPropertyNames(s.prototype).length>1)}const y=new Map;function f(s){let e=y.get(s);if(e)return e;if(!s.includes("."))e=t=>t?.[s];else{const t=s.split("."),n=t.length;e=i=>{let a=i;for(let b=0;b<n;b++){if(a==null)return;a=a[t[b]]}return a}}return y.set(s,e),e}const N=new Map;function Y(s){let e=N.get(s);if(e)return e;if(!s.includes("."))e=(t,n)=>{t!=null&&(t[s]=n)};else{const t=s.split("."),n=t.length-1;e=(i,a)=>{let b=i;for(let d=0;d<n;d++){if(b==null)return;const P=t[d];b[P]==null&&(b[P]={}),b=b[P]}b!=null&&(b[t[n]]=a)}}return N.set(s,e),e}function I(s,e){return f(e)(s)}function rt(s,e,t){Y(e)(s,t)}function j(s){return s?(s.includes(".")?s.slice(s.lastIndexOf(".")+1):s).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(/^./,t=>t.toUpperCase()):""}const H={"&":"&","<":"<",">":">",'"':""","'":"'"};function u(s){const e=s==null?"":String(s);return/[&<>"']/.test(e)?e.replace(/[&<>"']/g,t=>H[t]):e}function L(s){return String(s).replace(/\w\S*/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}function k(s,e,t){if(s!==void 0)return s===!0?{enabled:!0,...t}:s===!1?{enabled:!1}:R(s)?s:{[e]:s,enabled:!0}}function U(s){return s==null?[]:Array.isArray(s)?s:[s]}const o=Object.freeze(new Set(["__proto__","constructor","prototype"]));function B(s,e){if(!R(s))return R(e)?{...e}:e;if(!R(e))return e===void 0?s:e;const t={...s};for(const n of Object.keys(e)){if(o.has(n))continue;const i=e[n];i!==void 0&&(t[n]=R(i)&&R(t[n])?B(t[n],i):i)}return t}function W(s,e){if(!R(s)||!R(e)||s===e)return e;const t=Object.create(Object.getPrototypeOf(s));return Object.assign(t,s,e),t}class Z{#n;#r=new Map;#t;constructor(e=256,t=null){this.#n=e,this.#t=t}get size(){return this.#r.size}get max(){return this.#n}set max(e){this.#n=e,this.#e()}has(e){return this.#r.has(e)}get(e){const t=this.#r;if(!t.has(e))return;const n=t.get(e);return t.delete(e),t.set(e,n),n}peek(e){return this.#r.get(e)}set(e,t){const n=this.#r;return n.has(e)&&n.delete(e),n.set(e,t),this.#e(),t}delete(e){const t=this.#r.get(e);return this.#r.delete(e)&&this.#t&&this.#t(t,e),t}clear(){if(this.#t)for(const[e,t]of this.#r)this.#t(t,e);this.#r.clear()}keys(){return this.#r.keys()}values(){return this.#r.values()}#e(){const e=this.#r;for(;e.size>this.#n;){const t=e.keys().next().value,n=e.get(t);e.delete(t),this.#t&&this.#t(n,t)}}}const E=new Map;function S(s,e){const t=`${s||""}|${e?JSON.stringify(e):""}`;let n=E.get(t);return n||(n=new Intl.Collator(s||void 0,{numeric:!0,sensitivity:"variant",...e}),E.set(t,n)),n}function p(s,e){if(s===e)return 0;if(s==null)return 1;if(e==null)return-1;if(typeof s=="number"&&typeof e=="number")return Number.isNaN(s)?Number.isNaN(e)?0:1:Number.isNaN(e)||s<e?-1:s>e?1:0;const t=String(s),n=String(e);return t<n?-1:t>n?1:0}function M(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const lt=typeof requestAnimationFrame=="function";function wt(s){return lt?requestAnimationFrame(s):setTimeout(()=>s(M()),16)}function st(s){s!=null&&(lt?cancelAnimationFrame(s):clearTimeout(s))}function r(s){let e=null,t=null;const n=()=>{e=null;const a=t;t=null,s(...a||[])},i=(...a)=>{t=a,e===null&&(e=wt(n))};return i.cancel=()=>{st(e),e=null,t=null},i.flush=()=>{e!==null&&(st(e),n())},i}function c(s,e){let t=null,n=null;const i=()=>{if(t=null,n===null)return;const d=n;n=null,s(...d),a()},a=()=>{t=setTimeout(i,e),typeof t?.unref=="function"&&t.unref()},b=(...d)=>{t===null?(s(...d),a()):(n=d,clearTimeout(t),a())};return b.flush=()=>{if(t!==null&&clearTimeout(t),t=null,n===null)return;const d=n;n=null,s(...d)},b.cancel=()=>{t!==null&&clearTimeout(t),t=null,n=null},b.pending=()=>t!==null||n!==null,b}function m(s,e=50){return typeof requestIdleCallback=="function"?requestIdleCallback(s,{timeout:e}):setTimeout(()=>s({timeRemaining:()=>0,didTimeout:!0}),1)}let w=0;function z(s="l"){return`${s}${(++w).toString(36)}`}}),Et("packages/modules/shared/emitter.js",function(h,pt){"use strict";Object.defineProperty(h,"WILDCARD",{enumerable:!0,get:function(){return V}}),Object.defineProperty(h,"Emitter",{enumerable:!0,get:function(){return J}}),Object.defineProperty(h,"gate",{enumerable:!0,get:function(){return l}});const Dt=pt("packages/core/src/internal/util.js"),dt=Dt.isFunction,at=Dt.warnOnce,V="*",tt=new Set(["api","user","init","ai"]);function x(v,g){return v&&v.name?v.name:`#${g}`}class J{#n=new Map;#r;constructor(g="module"){this.#r=String(g)}on(g,_){if(!dt(_))return()=>{};let q=this.#n.get(g);return q||(q=new Set,this.#n.set(g,q)),q.add(_),()=>this.off(g,_)}off(g,_){const q=this.#n.get(g);q&&q.delete(_)}count(g){const _=this.#n.get(g);return _?_.size:0}emit(g,_){const q=this.#n.get(g),et=this.#n.get(V);if((!q||q.size===0)&&(!et||et.size===0))return;const $={..._||null,type:g};q&&q.size&&this.#t([...q],$,g),et&&et.size&&this.#t([...et],$,V)}#t(g,_,q){for(let et=0;et<g.length;et++)try{g[et](_)}catch($){at(`${this.#r}.emit.throw:${q}:${x(g[et],et)}`,`${this.#r}: a '${q}' handler threw; other handlers were unaffected.`,$)}}emitBefore(g,_,q){const et=q??(_&&_.origin),$=tt.has(et)?et:"user";let T=!1,A=null;const ot=it=>{T=!0,it!=null&&A===null&&(A=String(it))},K={..._||null,type:g,origin:$,get defaultPrevented(){return T},get reason(){return A},preventDefault(it){ot(it)}},R=this.#n.get(g);if(!R||R.size===0)return!0;const F=[...R],X=()=>(T&&A===null&&(A="prevented"),T&&_&&typeof _=="object"&&(_.reason=A),!T),Q=[];for(let it=0;it<F.length;it++){const y=F[it];try{const f=y(K);f&&dt(f.then)?Q.push(f):f===!1&&ot("prevented")}catch(f){ot("error"),at(`${this.#r}.beforeThrow:${g}:${x(y,it)}`,`${this.#r}: a '${g}' before-handler threw; the action was cancelled.`,f)}}return Q.length===0?X():Promise.allSettled(Q).then(it=>{for(const y of it)y.status==="rejected"?(ot("error"),at(`${this.#r}.beforeReject:${g}`,`${this.#r}: a '${g}' before-handler rejected; the action was cancelled.`,y.reason)):y.value===!1&&ot("prevented");return X()})}clear(){this.#n.clear()}}function l(v,g,_,q,et){const $=v.emitBefore(g,q,q.origin),T=()=>(v.emit(_,{...q,reason:q.reason||"prevented"}),!1);return $===!1?T():$&&dt($.then)?$.then(A=>A?et():T()):et()}}),Et("packages/modules/gantt/time.js",function(h,pt){"use strict";Object.defineProperty(h,"toDayNumber",{enumerable:!0,get:function(){return V}}),Object.defineProperty(h,"fromDayNumber",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(h,"toISODate",{enumerable:!0,get:function(){return x}}),Object.defineProperty(h,"resolveProjectEpoch",{enumerable:!0,get:function(){return J}});const dt=pt("packages/core/src/internal/util.js").warnOnce,at=864e5;function V(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())/at):null;const v=Date.parse(l);return Number.isFinite(v)?Math.floor(v/at):null}function tt(l){return Number.isFinite(l)?new Date(Math.round(l)*at):null}function x(l){const v=tt(l);return v?v.toISOString().slice(0,10):null}function J(l){if(l==null||l==="")return 0;const v=V(l);return Number.isFinite(v)?v:(dt(`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)}}),Et("packages/modules/gantt/calendar.js",function(h,pt){"use strict";Object.defineProperty(h,"createCalendar",{enumerable:!0,get:function(){return tt}});const Dt=pt("packages/modules/gantt/time.js"),dt=Dt.fromDayNumber,at=Dt.toDayNumber,V=Object.freeze([1,2,3,4,5]);function tt(x,J=0){if(x==null)return null;let l,v;x==="weekends"?(l=V,v=new Set):(l=Array.isArray(x.workdays)&&x.workdays.length?x.workdays.map(Number).filter(R=>R>=0&&R<=6):V,v=new Set((Array.isArray(x.holidays)?x.holidays:[]).map(R=>at(R)).filter(R=>R!=null)));const g=new Set(l);if(g.size===7&&v.size===0||g.size===0)return null;const _=R=>{const F=dt(R);return F?g.has(F.getUTCDay())&&!v.has(R):!1},q=R=>{let F=R;for(;!_(F);)F+=1;return F},et=R=>{let F=R;for(;!_(F);)F-=1;return F},$=q(Math.round(Number.isFinite(J)?J:0)),T=new Map([[0,$]]),A=new Map([[$,0]]);return{isWorking:_,nextWorking:q,dayOf:R=>{const F=Math.round(R);if(T.has(F))return T.get(F);if(F>0){let it=F-1;for(;!T.has(it);)it-=1;let y=T.get(it);for(let f=it+1;f<=F;f+=1)y=q(y+1),T.set(f,y),A.set(y,f);return T.get(F)}let X=F+1;for(;!T.has(X);)X+=1;let Q=T.get(X);for(let it=X-1;it>=F;it-=1)Q=et(Q-1),T.set(it,Q),A.set(Q,it);return T.get(F)},indexOf:R=>{const F=q(Math.round(R));if(A.has(F))return A.get(F);if(F>$){let it=0,y=$;for(;A.has(q(y+1))&&y<F;)y=q(y+1),it=A.get(y);for(;y<F;)y=q(y+1),it+=1,T.set(it,y),A.set(y,it);return it}let X=0,Q=$;for(;Q>F;)Q=et(Q-1),X-=1,T.set(X,Q),A.set(Q,X);return X},anchor:$}}}),Et("packages/modules/gantt/schedule.js",function(h,pt){"use strict";Object.defineProperty(h,"LINK_TYPES",{enumerable:!0,get:function(){return J}}),Object.defineProperty(h,"CONSTRAINT_TYPES",{enumerable:!0,get:function(){return l}}),Object.defineProperty(h,"EPS",{enumerable:!0,get:function(){return g}}),Object.defineProperty(h,"SCHEDULE_ERROR",{enumerable:!0,get:function(){return _}}),Object.defineProperty(h,"TASK_FIELDS",{enumerable:!0,get:function(){return $}}),Object.defineProperty(h,"taskIdReader",{enumerable:!0,get:function(){return A}}),Object.defineProperty(h,"taskFieldWriters",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(h,"normalizeTasks",{enumerable:!0,get:function(){return R}}),Object.defineProperty(h,"buildTree",{enumerable:!0,get:function(){return F}}),Object.defineProperty(h,"normalizeLinkSpec",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(h,"normalizeDependencies",{enumerable:!0,get:function(){return it}}),Object.defineProperty(h,"expandDependencies",{enumerable:!0,get:function(){return y}}),Object.defineProperty(h,"topoOrder",{enumerable:!0,get:function(){return f}}),Object.defineProperty(h,"computeSchedule",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(h,"findViolations",{enumerable:!0,get:function(){return L}});const dt=pt("packages/core/src/internal/util.js").warnOnce,V=pt("packages/modules/gantt/calendar.js").createCalendar,x=pt("packages/modules/gantt/time.js").toDayNumber,J=["FS","SS","FF","SF"],l=["MSO","MFO","ALAP"],v=Object.freeze({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"}),g=1e-9,_={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 q(k){if(k==null||k==="")return null;const U=typeof k=="number"?k:Number(k);return Number.isFinite(U)?U:null}function et(k){return k==null||k===""?null:x(k)}const $=Object.freeze(["id","name","start","end","duration","milestone","percentComplete","parent","baselineStart","baselineEnd","constraint","constraintDate"]);function T(k){const U=k&&typeof k=="object"?k:{},o={};for(const B of $){const W=U[B];if(typeof W=="function")o[B]=W;else if(typeof W=="string"&&W!==""){const Z=W;o[B]=E=>E[Z]}else o[B]=Z=>Z[B]}return o}function A(k){return T(k).id}function ot(k){const U=k&&typeof k=="object"?k:{},o={};for(const B of $){const W=U[B];typeof W=="string"&&W!==""?o[B]=W:typeof W=="function"?o[B]=null:o[B]=B}return o}function K(k,U){const o=U.constraint(k),B=o??(k&&k.constraintType);if(B==null||B==="")return null;const W=v[String(B).toLowerCase().replace(/\s+/g,"-")]??(l.includes(String(B).toUpperCase())?String(B).toUpperCase():null);if(!W)return null;const Z=et(U.constraintDate(k)??k.constraintAt??k.at);return{type:W,at:Z}}function R(k,U){const o=new Map,B=[],W=T(U);if(!Array.isArray(k))return{ok:!1,error:{code:_.BAD_DURATION,message:"tasks must be an array"},order:B,byId:o};for(const Z of k){const E=Z?W.id(Z):null,S=E!=null?String(E):null;if(S==null)return{ok:!1,error:{code:_.UNKNOWN_TASK,message:"every task needs an id"},order:B,byId:o};if(o.has(S))return{ok:!1,error:{code:_.DUPLICATE_ID,message:`duplicate task id "${S}"`,id:S},order:B,byId:o};const p=et(W.start(Z)),M=et(W.end(Z)),lt=W.milestone(Z)===!0;let wt=lt?0:q(W.duration(Z));if(wt==null&&p!=null&&M!=null&&(wt=M-p),wt!=null&&wt<0)return{ok:!1,error:{code:_.BAD_DURATION,message:`task "${S}" has negative duration ${wt}`,id:S},order:B,byId:o};const st=W.name(Z),r=W.parent(Z);o.set(S,{id:S,name:st!=null?String(st):S,duration:wt,milestoneFlag:lt,earliestStart:p,placedStart:p,placedEnd:M,percentComplete:q(W.percentComplete(Z)),parent:r!=null?String(r):null,constraint:K(Z,W),baselineStart:et(W.baselineStart(Z)??(Z.baseline&&Z.baseline.start)),baselineEnd:et(W.baselineEnd(Z)??(Z.baseline&&Z.baseline.end))}),B.push(S)}return{ok:!0,order:B,byId:o}}function F(k,U){const o=new Map(k.map(S=>[S,[]]));for(const S of k){const p=U.get(S).parent;if(p!=null){if(!U.has(p))return{ok:!1,error:{code:_.UNKNOWN_PARENT,message:`task "${S}" names unknown parent "${p}"`,id:S}};o.get(p).push(S)}}for(const S of k){const p=new Set;let M=U.get(S).parent;for(;M!=null;){if(M===S||p.has(M))return{ok:!1,error:{code:_.PARENT_CYCLE,message:`parent cycle at "${S}"`,id:S}};p.add(M),M=U.get(M)?.parent??null}}const B=S=>o.get(S).length>0,W=new Map,Z=S=>{if(W.has(S))return W.get(S);const p=o.get(S),M=p.length===0?[S]:p.flatMap(lt=>Z(lt));return W.set(S,M),M};return{ok:!0,children:o,isSummary:B,descendantLeaves:Z,ancestors:S=>{const p=new Set;let M=U.get(S).parent;for(;M!=null;)p.add(M),M=U.get(M).parent;return p}}}const X=/^\s*(FS|SS|FF|SF)\s*(?:([+-])\s*(\d+(?:\.\d+)?))?\s*$/i;function Q(k){const U={...k||null};if(typeof U.type!="string")return U;const o=X.exec(U.type);if(!o||!o[2])return U;const B=(o[2]==="-"?-1:1)*Number(o[3]);U.type=o[1].toUpperCase();const W=q(k.lag);return W!=null&&W!==B?(dt(`gantt-link-shorthand-${String(k.type)}-${W}`,`[lattice] gantt: dependency type ${JSON.stringify(k.type)} carries a lag of ${B} but lag: ${W} was also given; the explicit lag wins. Give one or the other.`),U):(U.lag=B,U)}function it(k,U,o={}){const B=[];if(k==null)return{ok:!0,edges:B};if(!Array.isArray(k))return{ok:!1,error:{code:_.UNKNOWN_TASK,message:"dependencies must be an array"},edges:B};const W=typeof o.ancestors=="function"?o.ancestors:null;for(const Z of k){const E=Q(Z),S=E&&E.from!=null?String(E.from):null,p=E&&E.to!=null?String(E.to):null,M=E&&E.type!=null?String(E.type).toUpperCase():"FS",lt=q(E.lag)??0;if(S==null||p==null)return{ok:!1,error:{code:_.UNKNOWN_TASK,message:"a dependency needs both `from` and `to`"},edges:B};if(!U.has(S))return{ok:!1,error:{code:_.UNKNOWN_TASK,message:`dependency references unknown task "${S}"`,id:S},edges:B};if(!U.has(p))return{ok:!1,error:{code:_.UNKNOWN_TASK,message:`dependency references unknown task "${p}"`,id:p},edges:B};if(S===p)return{ok:!1,error:{code:_.SELF_DEPENDENCY,message:`task "${S}" depends on itself`,id:S},edges:B};if(!J.includes(M))return{ok:!1,error:{code:_.BAD_LINK_TYPE,message:`unknown link type "${M}" (expected one of ${J.join("/")})`},edges:B};if(W&&(W(S).has(p)||W(p).has(S)))return{ok:!1,error:{code:_.DEP_ACROSS_HIERARCHY,message:`dependency between "${S}" and "${p}" crosses their own parent/child hierarchy`,from:S,to:p},edges:B};B.push({from:S,to:p,type:M,lag:lt})}return{ok:!0,edges:B}}function y(k,U){const o=new Set,B=[];for(const W of k){(U.isSummary(W.from)||U.isSummary(W.to))&&W.type!=="FS"&&dt(`gantt-summary-link-${W.type}-${W.from}-${W.to}`,`[lattice] gantt: ${W.type} link with a summary endpoint (${W.from} -> ${W.to}) is expanded to descendant leaves — a conservative v1 reading; only FS is exact for summary endpoints.`);for(const E of U.descendantLeaves(W.from))for(const S of U.descendantLeaves(W.to)){if(E===S)continue;const p=[E,S,W.type,W.lag].join("");o.has(p)||(o.add(p),B.push({from:E,to:S,type:W.type,lag:W.lag}))}}return B}function f(k,U){const o=new Map(k.map(E=>[E,0])),B=new Map(k.map(E=>[E,[]]));for(const E of U)N(o,E.to),B.get(E.from).push(E.to);const W=k.filter(E=>o.get(E)===0),Z=[];for(;W.length;){const E=W.shift();Z.push(E);for(const S of B.get(E)){const p=o.get(S)-1;o.set(S,p),p===0&&W.push(S)}}return Z.length===k.length?{ok:!0,sorted:Z}:{ok:!1,cycle:Y(k,B,new Set(Z))}}function N(k,U){k.set(U,k.get(U)+1)}function Y(k,U,o){const B=k.find(S=>!o.has(S)),W=[],Z=new Map;let E=B;for(;E!=null&&!Z.has(E);)Z.set(E,W.length),W.push(E),E=U.get(E).find(S=>!o.has(S));return E==null?W:W.slice(Z.get(E)).concat(E)}function I(k,U,o,B,W,Z=new Map){const E=f(k,o);if(!E.ok)return dt(`gantt-cycle-${E.cycle.join(">")}`,`[lattice] gantt: dependency cycle detected (${E.cycle.join(" -> ")}); schedule refused.`),{ok:!1,error:{code:_.CYCLE,message:`dependency cycle: ${E.cycle.join(" -> ")}`,cycle:E.cycle}};const S=E.sorted,p=new Map(k.map(w=>[w,[]])),M=new Map(k.map(w=>[w,[]]));for(const w of o)p.get(w.to).push(w),M.get(w.from).push(w);const lt=new Map;for(const w of k){const z=U.get(w);lt.set(w,{id:w,name:z.name,duration:z.duration,es:0,ef:0,ls:0,lf:0,totalFloat:0,critical:!1,percentComplete:z.percentComplete,parent:z.parent,isSummary:!1,isMilestone:z.duration===0,children:[]})}const wt=[];for(const w of S){const z=U.get(w),s=lt.get(w);let e=Math.max(B,z.earliestStart??B);for(const n of p.get(w)){const i=lt.get(n.from);let a;switch(n.type){case"FS":a=i.ef+n.lag;break;case"SS":a=i.es+n.lag;break;case"FF":a=i.ef+n.lag-s.duration;break;case"SF":a=i.es+n.lag-s.duration;break;default:a=-1/0}a>e&&(e=a)}const t=Z.get(w);if(t&&t.type!=="ALAP"&&t.at!=null){const n=t.type==="MFO"?t.at-s.duration:t.at;n<e-g?wt.push({id:w,type:t.type,at:t.at,earliestFeasible:e}):e=n,s.pinned=!0}s.es=e,s.ef=e+s.duration}const st=k.length?Math.max(...k.map(w=>lt.get(w).ef)):B,r=Number.isFinite(W)?W:st;for(let w=S.length-1;w>=0;w-=1){const z=S[w],s=lt.get(z);let e=r;for(const t of M.get(z)){const n=lt.get(t.to);let i;switch(t.type){case"FS":i=n.ls-t.lag;break;case"SS":i=n.ls-t.lag+s.duration;break;case"FF":i=n.lf-t.lag;break;case"SF":i=n.lf-t.lag+s.duration;break;default:i=1/0}i<e&&(e=i)}s.pinned&&(e=s.ef),s.lf=e,s.ls=e-s.duration,s.totalFloat=s.ls-s.es,s.critical=s.totalFloat<=g}for(const w of k){const z=Z.get(w);if(!z||z.type!=="ALAP")continue;const s=lt.get(w);s.es=s.ls,s.ef=s.lf,s.totalFloat=0,s.critical=!0}const c=k.filter(w=>lt.get(w).critical),m=u(k,o,lt);return{ok:!0,tasks:lt,critical:c,criticalPaths:m,projectFinish:st,conflicts:wt}}function rt(k,U=[],o={}){const B=et(o.projectStart)??0,W=et(o.deadline),Z=V(o.calendar,B),E=a=>a==null?null:Z?Z.indexOf(a):a,S=a=>Z?Z.dayOf(a):a,p=R(k,o.fields);if(!p.ok)return{ok:!1,error:p.error};const{order:M,byId:lt}=p,wt=F(M,lt);if(!wt.ok)return{ok:!1,error:wt.error};const st=it(U,lt,wt);if(!st.ok)return{ok:!1,error:st.error};for(const a of M)if(!wt.isSummary(a)&<.get(a).duration==null)return{ok:!1,error:{code:_.BAD_DURATION,message:`task "${a}" has no duration and no start+end to derive one`,id:a}};const r=M.filter(a=>!wt.isSummary(a)),c=new Map(r.map(a=>{const b=lt.get(a);return[a,{...b,earliestStart:E(b.earliestStart)}]})),m=new Map;for(const a of r){const b=lt.get(a).constraint;b&&m.set(a,{type:b.type,at:E(b.at)})}const w=Z?Z.indexOf(B):B,z=W==null?void 0:E(W),s=y(st.edges,wt),e=I(r,c,s,w,z,m);if(!e.ok)return{ok:!1,error:e.error};const t=e.tasks;for(const a of r){const b=t.get(a);b.es=S(b.es),b.ef=S(b.ef),b.ls=S(b.ls),b.lf=S(b.lf),j(b,lt.get(a).baselineStart,lt.get(a).baselineEnd)}for(let a=M.length-1;a>=0;a-=1){const b=M[a];wt.isSummary(b)&&t.set(b,H(b,lt.get(b),wt,t))}for(const a of M)wt.isSummary(a)&&(t.get(a).children=wt.children.get(a).slice());const n=Z?Z.anchor:B,i=S(e.projectFinish);return{ok:!0,tasks:t,order:M,critical:e.critical,criticalPaths:e.criticalPaths,projectStart:n,projectFinish:i,projectDuration:i-n,conflicts:e.conflicts||[],calendar:!!Z}}function j(k,U,o){U==null&&o==null||(k.baselineStart=U??null,k.baselineEnd=o??null,k.startVariance=U==null?null:k.es-U,k.finishVariance=o==null?null:k.ef-o,k.durationVariance=U==null||o==null?null:k.ef-k.es-(o-U))}function H(k,U,o,B){const W=o.children.get(k).map(m=>B.get(m)),Z=Math.min(...W.map(m=>m.es)),E=Math.max(...W.map(m=>m.ef)),S=Math.min(...W.map(m=>m.ls)),p=Math.max(...W.map(m=>m.lf)),M=o.descendantLeaves(k).map(m=>B.get(m)),lt=M.reduce((m,w)=>m+w.duration,0),wt=lt>g?M.reduce((m,w)=>m+w.duration*(w.percentComplete??0),0)/lt:null,st={id:k,name:U.name,duration:E-Z,es:Z,ef:E,ls:S,lf:p,totalFloat:S-Z,critical:W.some(m=>m.critical),percentComplete:wt,parent:U.parent,isSummary:!0,isMilestone:!1,children:[]},r=M.map(m=>m.baselineStart).filter(m=>m!=null),c=M.map(m=>m.baselineEnd).filter(m=>m!=null);return(r.length||c.length)&&j(st,r.length?Math.min(...r):null,c.length?Math.max(...c):null),st}function u(k,U,o){const B=new Map(k.map(p=>[p,[]])),W=new Set;for(const p of U){const M=o.get(p.from),lt=o.get(p.to);if(!M.critical||!lt.critical)continue;let wt;switch(p.type){case"FS":wt=M.ef+p.lag;break;case"SS":wt=M.es+p.lag;break;case"FF":wt=M.ef+p.lag-lt.duration;break;case"SF":wt=M.es+p.lag-lt.duration;break;default:wt=-1/0}Math.abs(wt-lt.es)<=g&&(B.get(p.from).push(p.to),W.add(p.to))}const Z=k.filter(p=>o.get(p).critical&&!W.has(p)),E=[],S=(p,M)=>{const lt=B.get(p);if(!lt.length){E.push(M);return}for(const wt of lt)S(wt,M.concat(wt))};for(const p of Z)S(p,[p]);return E}function L(k,U,o){if(!U||!U.ok)return[];const B=[],W=T(o);for(const Z of k){const E=Z?W.id(Z):null,S=E!=null?String(E):null;if(S==null||!U.tasks.has(S))continue;const p=U.tasks.get(S);if(p.isSummary)continue;const M=q(W.start(Z));M!=null&&M<p.es-g&&B.push({id:S,placedStart:M,earliestStart:p.es,by:p.es-M})}return B}}),Et("packages/modules/gantt/resources.js",function(h,pt){"use strict";Object.defineProperty(h,"parseAssignments",{enumerable:!0,get:function(){return g}}),Object.defineProperty(h,"normalizeCapacities",{enumerable:!0,get:function(){return _}}),Object.defineProperty(h,"sweepLoad",{enumerable:!0,get:function(){return q}}),Object.defineProperty(h,"computeResourceLoad",{enumerable:!0,get:function(){return et}}),Object.defineProperty(h,"levelResources",{enumerable:!0,get:function(){return A}});const dt=pt("packages/core/src/internal/util.js").warnOnce,at=pt("packages/modules/gantt/schedule.js"),V=at.computeSchedule,tt=at.EPS,x=at.taskIdReader,l=pt("packages/modules/gantt/calendar.js").createCalendar;function v(K){if(K==null||K==="")return null;const R=typeof K=="number"?K:Number(K);return Number.isFinite(R)?R:null}function g(K){if(K&&Array.isArray(K.assignments))return K.assignments.map(X=>{const Q=X&&(X.resource??X.name??X.id);if(Q==null||Q==="")return null;const it=v(X.units)??v(X.allocation)??1;return{resource:String(Q),units:it}}).filter(Boolean);const R=K?K.assignee??K.assignees??K.owner:null;return(Array.isArray(R)?R:R==null||R===""?[]:[R]).map(X=>String(X)).filter(X=>X!=="").map(X=>({resource:X,units:1}))}function _(K,R){const F=new Map;if(Array.isArray(K))for(const X of K){const Q=X&&(X.id??X.name??X.resource);if(Q==null||Q==="")continue;const it=v(X.capacity??X.maxUnits??X.max??X.units);F.set(String(Q),it??R)}else if(K&&typeof K=="object")for(const[X,Q]of Object.entries(K)){const it=v(Q);F.set(String(X),it??R)}return F}function q(K){if(!K.length)return[];const R=new Set;for(const Q of K)R.add(Q.s),R.add(Q.e);const F=[...R].sort((Q,it)=>Q-it),X=[];for(let Q=0;Q<F.length-1;Q+=1){const it=F[Q],y=F[Q+1];if(y<=it)continue;let f=0;const N=[];for(const Y of K)Y.s<=it&&Y.e>=y&&(f+=Y.units,N.push(Y.taskId));N.length&&X.push({s:it,e:y,load:f,taskIds:N})}return X}function et(K,R,F={}){const X={ok:!1,resources:[],overAllocations:[],byResource:new Map};if(!R||!R.ok)return X;const Q=v(F.defaultCapacity)??1,it=_(F.resources,Q),y=F.calendar!=null?l(F.calendar,R.projectStart):null,f=L=>it.has(L)?it.get(L):Q,N=L=>y?y.indexOf(L):L,Y=L=>y?y.dayOf(L):L,I=x(F.fields),rt=new Map;for(const L of R.order){const k=R.tasks.get(L);if(!k||k.isSummary)continue;const U=K.find(Z=>Z&&I(Z)!=null&&String(I(Z))===L);if(!U)continue;const o=g(U);if(!o.length)continue;const B=N(k.es),W=N(k.ef);if(!(W<=B))for(const Z of o)rt.has(Z.resource)||rt.set(Z.resource,[]),rt.get(Z.resource).push({s:B,e:W,units:Z.units,taskId:L})}const j=new Map,H=[],u=[];for(const[L,k]of rt){const U=f(L),o=q(k);let B=0;const W=o.map(E=>{E.load>B&&(B=E.load);const S={start:Y(E.s),end:Y(E.e),load:E.load,taskIds:E.taskIds};return E.load>U+tt&&u.push({resource:L,capacity:U,start:S.start,end:S.end,load:E.load,taskIds:E.taskIds.slice()}),S}),Z={resource:L,capacity:U,peak:B,segments:W};j.set(L,Z),H.push(Z)}return H.sort((L,k)=>L.resource<k.resource?-1:L.resource>k.resource?1:0),u.sort((L,k)=>L.start-k.start||(L.resource<k.resource?-1:1)),{ok:!0,resources:H,overAllocations:u,byResource:j}}function $(K){if(!K)return!1;const R=K.constraint??K.constraintType;if(R==null||R==="")return!1;const F=String(R).toLowerCase().replace(/\s+/g,"-");return F==="mso"||F==="must-start-on"||F==="muststarton"||F==="start-on"||F==="mfo"||F==="must-finish-on"||F==="mustfinishon"||F==="finish-on"}function T(K,R){return K?v(K[R])??0:0}function A(K,R,F={}){const X={projectStart:F.projectStart,deadline:F.deadline,calendar:F.calendar,fields:F.fields},Q=F.priorityField||"priority",it=F.maxIterations!=null?F.maxIterations:Math.max(100,K.length*K.length*2),y=x(F.fields),f=K.map(u=>({...u})),N=f.map(u=>String(y(u))),Y=u=>N.indexOf(u);let I=V(f,R,X);if(!I.ok)return{ok:!1,error:I.error};const rt=new Map;for(const u of I.order){const L=I.tasks.get(u);L&&!L.isSummary&&rt.set(u,L.es)}let j=0;for(;j<it;j+=1){const u=et(f,I,F);if(!u.overAllocations.length)return{ok:!0,resolved:!0,tasks:f,schedule:I,moves:ot(rt,I),iterations:j};const L=u.overAllocations.slice().sort((E,S)=>E.start-S.start||S.load-E.load)[0],k=new Map(f.map(E=>[String(y(E)),E])),U=L.taskIds.map(E=>I.tasks.get(E)).filter(Boolean),o=U.filter(E=>!$(k.get(E.id)));if(!o.length)return{ok:!0,resolved:!1,tasks:f,schedule:I,moves:ot(rt,I),remaining:u.overAllocations,iterations:j};o.sort((E,S)=>{if(S.totalFloat!==E.totalFloat)return S.totalFloat-E.totalFloat;const p=T(k.get(E.id),Q),M=T(k.get(S.id),Q);return p!==M?p-M:S.es!==E.es?S.es-E.es:Y(S.id)-Y(E.id)});const B=o[0],W=U.filter(E=>E.id!==B.id).map(E=>E.ef).filter(E=>E>B.es+tt),Z=W.length?Math.min(...W):B.es+1;if(k.get(B.id).start=Z,I=V(f,R,X),!I.ok)return{ok:!1,error:I.error}}const H=et(f,I,F);return H.overAllocations.length&&dt("gantt-level-unresolved",`[lattice] gantt: resource leveling hit its ${it}-iteration cap with ${H.overAllocations.length} over-allocation(s) unresolved; returning the partial result.`),{ok:!0,resolved:H.overAllocations.length===0,tasks:f,schedule:I,moves:ot(rt,I),remaining:H.overAllocations,iterations:j}}function ot(K,R){const F=[];for(const X of R.order){const Q=R.tasks.get(X);if(!Q||Q.isSummary)continue;const it=K.get(X);it!=null&&Q.es>it+tt&&F.push({id:X,from:it,to:Q.es,delay:Q.es-it})}return F}}),Et("packages/modules/gantt/earned-value.js",function(h,pt){"use strict";Object.defineProperty(h,"computeEarnedValue",{enumerable:!0,get:function(){return l}});const dt=pt("packages/modules/gantt/time.js").toDayNumber,at=1e-9;function V(v){if(v==null||v==="")return null;const g=typeof v=="number"?v:Number(v);return Number.isFinite(g)?g:null}function tt(v,g,_){return _-g<=at?v>=_?1:0:v<=g?0:v>=_?1:(v-g)/(_-g)}function x(v,g,_,q,et){const $=g?V(g[q]):null,T=$??v.duration,A=g?V(g[et]):null,ot=v.percentComplete==null?0:Math.max(0,Math.min(100,v.percentComplete))/100,K=v.baselineStart!=null||v.baselineEnd!=null,R=v.baselineStart!=null?v.baselineStart:v.es,F=v.baselineEnd!=null?v.baselineEnd:v.ef,X=T*tt(_,R,F),Q=T*ot;return{bac:T,pv:X,ev:Q,ac:A,hasBaseline:K}}function J(v){const g=v.ac;return{bac:v.bac,pv:v.pv,ev:v.ev,ac:g,sv:v.ev-v.pv,cv:g==null?null:v.ev-g,spi:Math.abs(v.pv)<at?null:v.ev/v.pv,cpi:g==null||Math.abs(g)<at?null:v.ev/g}}function l(v,g,_={}){if(!g||!g.ok||!g.tasks||!g.order)return{ok:!1,error:{code:"NO_SCHEDULE",message:"earned value needs a successful schedule"}};const q=_.costField||"cost",et=_.actualCostField||"actualCost",$=_.statusDate==null?g.projectFinish:dt(_.statusDate)??g.projectFinish,T=new Map;for(const Q of Array.isArray(v)?v:[])Q&&Q.id!=null&&T.set(String(Q.id),Q);const A=()=>({bac:0,pv:0,ev:0,ac:0,acAny:!1,hasBaseline:!1}),ot=new Map;for(const Q of g.order)ot.set(Q,A());const K=A();for(const Q of g.order){const it=g.tasks.get(Q);if(!it||it.isSummary)continue;const y=x(it,T.get(Q),$,q,et);let f=Q;for(;f!=null&&ot.has(f);){const N=ot.get(f);N.bac+=y.bac,N.pv+=y.pv,N.ev+=y.ev,y.ac!=null&&(N.ac+=y.ac,N.acAny=!0),y.hasBaseline&&(N.hasBaseline=!0),f=g.tasks.get(f).parent}K.bac+=y.bac,K.pv+=y.pv,K.ev+=y.ev,y.ac!=null&&(K.ac+=y.ac,K.acAny=!0),y.hasBaseline&&(K.hasBaseline=!0)}const R=Q=>J({bac:Q.bac,pv:Q.pv,ev:Q.ev,ac:Q.acAny?Q.ac:null}),F=new Map,X=[];for(const Q of g.order){const it=g.tasks.get(Q),y=ot.get(Q),f={id:it.id,name:it.name,isSummary:!!it.isSummary,isMilestone:!!it.isMilestone,percentComplete:it.percentComplete??null,hasBaseline:y.hasBaseline,hasActualCost:y.acAny,...R(y)};F.set(Q,f),X.push(f)}return{ok:!0,statusDate:$,byTask:F,rows:X,project:{hasActualCost:K.acAny,hasBaseline:K.hasBaseline,...R(K)}}}}),Et("packages/modules/gantt/mspdi.js",function(h,pt){"use strict";Object.defineProperty(h,"parseXml",{enumerable:!0,get:function(){return et}}),Object.defineProperty(h,"importMSPDI",{enumerable:!0,get:function(){return it}}),Object.defineProperty(h,"exportMSPDI",{enumerable:!0,get:function(){return f}});const dt=pt("packages/core/src/internal/util.js").warnOnce,at=pt("packages/modules/gantt/time.js"),V=at.toDayNumber,tt=at.toISODate,x=Object.freeze({0:"FF",1:"FS",2:"SF",3:"SS"}),J=Object.freeze({FF:0,FS:1,SF:2,SS:3}),l=Object.freeze({1:"as-late-as-possible",2:"must-start-on",3:"must-finish-on"}),v=Object.freeze({ALAP:1,MSO:2,MFO:3});function g(j){return String(j).replace(/&(#x?[0-9a-fA-F]+|lt|gt|amp|quot|apos);/g,(H,u)=>{if(u[0]==="#"){const L=u[1]==="x"||u[1]==="X"?parseInt(u.slice(2),16):parseInt(u.slice(1),10);return Number.isFinite(L)?String.fromCodePoint(L):H}return{lt:"<",gt:">",amp:"&",quot:'"',apos:"'"}[u]??H})}function _(j){return String(j??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function q(j){const H=j.indexOf(":");return H<0?j:j.slice(H+1)}function et(j){const H=String(j);let u=0;const L=[];let k=null;for(;u<H.length;){const U=H.indexOf("<",u);if(U<0)break;if(U>u&&L.length){const M=H.slice(u,U);M.trim()&&(L[L.length-1].text+=g(M))}if(H.startsWith("<?",U)){const M=H.indexOf("?>",U);u=M<0?H.length:M+2;continue}if(H.startsWith("<!--",U)){const M=H.indexOf("-->",U);u=M<0?H.length:M+3;continue}if(H.startsWith("<![CDATA[",U)){const M=H.indexOf("]]>",U);L.length&&(L[L.length-1].text+=H.slice(U+9,M<0?H.length:M)),u=M<0?H.length:M+3;continue}if(H.startsWith("<!",U)){const M=H.indexOf(">",U);u=M<0?H.length:M+1;continue}const o=H.indexOf(">",U);if(o<0)break;let B=H.slice(U+1,o).trim();if(B[0]==="/"){L.pop(),u=o+1;continue}const W=B.endsWith("/");W&&(B=B.slice(0,-1).trim());const Z=B.search(/\s/),E=q(Z<0?B:B.slice(0,Z)),S={};if(Z>=0)for(const M of B.slice(Z).matchAll(/([\w:.-]+)\s*=\s*"([^"]*)"|([\w:.-]+)\s*=\s*'([^']*)'/g))S[q(M[1]??M[3])]=g(M[2]??M[4]??"");const p={name:E,attrs:S,children:[],text:""};L.length?L[L.length-1].children.push(p):k||(k=p),W||L.push(p),u=o+1}return k}function $(j,H){return j?j.children.find(u=>u.name===H):void 0}function T(j,H){return j?j.children.filter(u=>u.name===H):[]}function A(j,H){const u=$(j,H);return u?u.text.trim():void 0}function ot(j){if(!j)return null;const H=String(j).match(/^\d{4}-\d{2}-\d{2}/);return V(H?H[0]:j)}function K(j,H){return`${tt(j)}T${String(H).padStart(2,"0")}:00:00`}function R(j,H){if(!j)return null;const u=String(j).match(/PT?(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?/);return u?((Number(u[1])||0)+(Number(u[2])||0)/60+(Number(u[3])||0)/3600)/H:null}function F(j,H){return`PT${Math.round((j||0)*H*1e3)/1e3}H0M0S`}function X(j,H){return(Number(j)||0)/(600*H)}function Q(j,H){return Math.round((j||0)*10*60*H)}function it(j,H={}){const u=H.hoursPerDay??8,L=et(j);if(!L||L.name!=="Project")return dt("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 k=ot(A(L,"StartDate")),U=$(L,"Resources"),o=new Map,B=[];for(const c of T(U,"Resource")){const m=A(c,"UID"),w=A(c,"Name");if(m==null||w==null||w==="")continue;o.set(m,w);const z=A(c,"MaxUnits");B.push({id:w,name:w,capacity:z==null?1:Number(z)})}const W=$(L,"Assignments"),Z=new Map;for(const c of T(W,"Assignment")){const m=A(c,"TaskUID"),w=A(c,"ResourceUID"),z=o.get(w);if(m==null||z==null)continue;const s=A(c,"Units");Z.has(m)||Z.set(m,[]),Z.get(m).push({resource:z,units:s==null?1:Number(s)})}const E=$(L,"Tasks"),S=[],p=[],M=new Map,lt=[],wt=[];for(const c of T(E,"Task")){if(A(c,"IsNull")==="1")continue;const m=A(c,"UID");if(m==null||m==="0")continue;const w=m;M.set(m,w);const z=Number(A(c,"OutlineLevel"))||1;for(;lt.length&<[lt.length-1].level>=z;)lt.pop();const s=lt.length?lt[lt.length-1].uid:null;lt.push({uid:m,level:z});const e=A(c,"Summary")==="1",t=A(c,"Milestone")==="1",n={id:w,name:A(c,"Name")??w};if(s&&(n.parent=s),t&&(n.milestone=!0),!e&&!t){const G=R(A(c,"Duration"),u);G!=null&&(n.duration=G)}const i=ot(A(c,"Start"));!e&&i!=null&&(n.start=i);const a=A(c,"PercentComplete");a!=null&&(n.percentComplete=Number(a));const b=l[Number(A(c,"ConstraintType"))];if(b){n.constraint=b;const G=ot(A(c,"ConstraintDate"));G!=null&&(n.constraintDate=G)}const d=$(c,"Baseline");if(d){const G=ot(A(d,"Start")),C=ot(A(d,"Finish"));G!=null&&(n.baselineStart=G),C!=null&&(n.baselineEnd=C)}const P=Z.get(m);P&&P.length&&(n.assignments=P),S.push(n);for(const G of T(c,"PredecessorLink"))wt.push({raw:G,uid:m})}for(const{raw:c,uid:m}of wt){const w=A(c,"PredecessorUID"),z=M.get(w),s=M.get(m);if(z==null||s==null)continue;const e=x[Number(A(c,"Type")??1)]??"FS",t=X(A(c,"LinkLag"),u),n={from:z,to:s,type:e};t&&(n.lag=t),p.push(n)}const st=y(L),r={ok:!0,tasks:S,dependencies:p,resources:B};return k!=null&&(r.projectStart=k),st&&(r.calendar=st),r}function y(j){const H=$(j,"Calendars"),u=T(H,"Calendar"),L=A(j,"CalendarUID"),k=u.find(E=>A(E,"UID")===L)??u[0];if(!k)return null;const U=$(k,"WeekDays"),o=[];let B=!1;for(const E of T(U,"WeekDay")){const S=Number(A(E,"DayType"));S>=1&&S<=7&&(B=!0,A(E,"DayWorking")==="1"&&o.push(S-1))}const W=[],Z=$(k,"Exceptions");for(const E of T(Z,"Exception")){if(A(E,"DayWorking")==="1")continue;const S=$(E,"TimePeriod"),p=ot(A(S,"FromDate")),M=ot(A(S,"ToDate"))??p;if(p!=null)for(let lt=p;lt<=M;lt+=1)W.push(lt)}return!B&&!W.length?null:{workdays:B?o:[1,2,3,4,5],holidays:W}}function f(j,H={}){const u=H.hoursPerDay??8,L=Array.isArray(j.tasks)?j.tasks:[],k=Array.isArray(j.dependencies)?j.dependencies:[],U=Array.isArray(j.resources)?j.resources:j.resources&&typeof j.resources=="object"?Object.entries(j.resources).map(([r,c])=>({id:r,name:r,capacity:c})):[],o=j.schedule&&j.schedule.ok?j.schedule:null,B=new Map;L.forEach((r,c)=>{const m=String(r.id);B.set(m,/^\d+$/.test(m)?m:String(c+1))});const W=new Map;for(const r of L){const c=r.parent!=null?String(r.parent):null;c&&(W.has(c)||W.set(c,[]),W.get(c).push(String(r.id)))}const Z=r=>W.has(r),E=r=>{let c=1,m=L.find(w=>String(w.id)===r);for(;m&&m.parent!=null;)c+=1,m=L.find(w=>String(w.id)===String(m.parent));return c},S=new Map;for(const r of k){const c=String(r.to);S.has(c)||S.set(c,[]),S.get(c).push(r)}const p=[];p.push('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'),p.push('<Project xmlns="http://schemas.microsoft.com/project">'),p.push(` <Name>${_(H.projectName||"Lattice Gantt export")}</Name>`);const M=j.projectStart!=null?V(j.projectStart):o?o.projectStart:null;M!=null&&p.push(` <StartDate>${K(M,8)}</StartDate>`);const lt=Y(j.calendar);if(lt&&p.push(" <CalendarUID>1</CalendarUID>"),lt){p.push(" <Calendars>"),p.push(" <Calendar>"),p.push(" <UID>1</UID>"),p.push(" <Name>Standard</Name>"),p.push(" <IsBaseCalendar>1</IsBaseCalendar>"),p.push(" <WeekDays>");for(let r=0;r<=6;r+=1){const c=lt.workdays.includes(r);p.push(" <WeekDay>"),p.push(` <DayType>${r+1}</DayType>`),p.push(` <DayWorking>${c?1:0}</DayWorking>`),p.push(" </WeekDay>")}if(p.push(" </WeekDays>"),lt.holidays.length){p.push(" <Exceptions>");for(const r of lt.holidays)p.push(" <Exception>"),p.push(" <DayWorking>0</DayWorking>"),p.push(` <TimePeriod><FromDate>${K(r,0)}</FromDate><ToDate>${K(r,23)}</ToDate></TimePeriod>`),p.push(" </Exception>");p.push(" </Exceptions>")}p.push(" </Calendar>"),p.push(" </Calendars>")}p.push(" <Tasks>");for(const r of L){const c=String(r.id),m=B.get(c),w=Z(c),z=!!r.milestone||!w&&Number(r.duration)===0,s=o?o.tasks.get(c):null;p.push(" <Task>"),p.push(` <UID>${_(m)}</UID>`),p.push(` <ID>${_(m)}</ID>`),p.push(` <Name>${_(r.name!=null?r.name:c)}</Name>`),p.push(` <OutlineLevel>${E(c)}</OutlineLevel>`),p.push(` <Summary>${w?1:0}</Summary>`),p.push(` <Milestone>${z?1:0}</Milestone>`);const e=s?s.duration:r.duration!=null?Number(r.duration):null;e!=null&&p.push(` <Duration>${F(e,u)}</Duration>`),p.push(" <DurationFormat>7</DurationFormat>");const t=s?s.es:r.start!=null?V(r.start):null,n=s?s.ef:r.end!=null?V(r.end):t!=null&&e!=null?t+e:null;t!=null&&p.push(` <Start>${K(t,8)}</Start>`),n!=null&&p.push(` <Finish>${K(n,17)}</Finish>`);const i=s?s.percentComplete:r.percentComplete;i!=null&&p.push(` <PercentComplete>${Math.round(Number(i))}</PercentComplete>`);const a=I(r.constraint??r.constraintType);if(a!=null){p.push(` <ConstraintType>${a}</ConstraintType>`);const P=rt(r.constraintDate??r.constraintAt??r.at);P!=null&&p.push(` <ConstraintDate>${K(P,8)}</ConstraintDate>`)}const b=rt(r.baselineStart??(r.baseline&&r.baseline.start)),d=rt(r.baselineEnd??(r.baseline&&r.baseline.end));(b!=null||d!=null)&&(p.push(" <Baseline>"),p.push(" <Number>0</Number>"),b!=null&&p.push(` <Start>${K(b,8)}</Start>`),d!=null&&p.push(` <Finish>${K(d,17)}</Finish>`),b!=null&&d!=null&&p.push(` <Duration>${F(d-b,u)}</Duration>`),p.push(" </Baseline>"));for(const P of S.get(c)||[]){const G=B.get(String(P.from));G!=null&&(p.push(" <PredecessorLink>"),p.push(` <PredecessorUID>${_(G)}</PredecessorUID>`),p.push(` <Type>${J[P.type?String(P.type).toUpperCase():"FS"]??1}</Type>`),P.lag&&(p.push(` <LinkLag>${Q(Number(P.lag),u)}</LinkLag>`),p.push(" <LagFormat>7</LagFormat>")),p.push(" </PredecessorLink>"))}p.push(" </Task>")}p.push(" </Tasks>");const wt=new Map;U.forEach((r,c)=>{const m=String(r.name??r.id??`Resource ${c+1}`);wt.set(m,{uid:String(c+1),capacity:r.capacity??r.maxUnits??1})});const st=[];for(const r of L)for(const c of N(r))wt.has(c.resource)||wt.set(c.resource,{uid:String(wt.size+1),capacity:1}),st.push({taskUid:B.get(String(r.id)),resUid:wt.get(c.resource).uid,units:c.units});p.push(" <Resources>");for(const[r,c]of wt)p.push(" <Resource>"),p.push(` <UID>${_(c.uid)}</UID>`),p.push(` <ID>${_(c.uid)}</ID>`),p.push(` <Name>${_(r)}</Name>`),p.push(` <MaxUnits>${Number(c.capacity)}</MaxUnits>`),p.push(" </Resource>");return p.push(" </Resources>"),p.push(" <Assignments>"),st.forEach((r,c)=>{p.push(" <Assignment>"),p.push(` <UID>${c+1}</UID>`),p.push(` <TaskUID>${_(r.taskUid)}</TaskUID>`),p.push(` <ResourceUID>${_(r.resUid)}</ResourceUID>`),p.push(` <Units>${Number(r.units)}</Units>`),p.push(" </Assignment>")}),p.push(" </Assignments>"),p.push("</Project>"),p.join(`
|
|
6
|
+
var qt=Object.create(null),Jt=Object.create(null);function Et(h,pt){qt[h]=pt}function Qt(h){var pt=Jt[h];if(pt)return pt;var Dt=Object.create(null);Jt[h]=Dt;var dt=qt[h];if(!dt)throw new Error("[lattice] missing module: "+h);return dt(Dt,Qt),Dt}Et("packages/core/src/internal/util.js",function(h,pt){"use strict";Object.defineProperty(h,"VERSION",{enumerable:!0,get:function(){return at}}),Object.defineProperty(h,"reportedWarnings",{enumerable:!0,get:function(){return _}}),Object.defineProperty(h,"warnOnce",{enumerable:!0,get:function(){return et}}),Object.defineProperty(h,"infoOnce",{enumerable:!0,get:function(){return $}}),Object.defineProperty(h,"resetWarnings",{enumerable:!0,get:function(){return T}}),Object.defineProperty(h,"fail",{enumerable:!0,get:function(){return A}}),Object.defineProperty(h,"invariant",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(h,"DEV",{enumerable:!0,get:function(){return K}}),Object.defineProperty(h,"isObject",{enumerable:!0,get:function(){return R}}),Object.defineProperty(h,"isFunction",{enumerable:!0,get:function(){return F}}),Object.defineProperty(h,"isNil",{enumerable:!0,get:function(){return X}}),Object.defineProperty(h,"isBlank",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(h,"isCtor",{enumerable:!0,get:function(){return it}}),Object.defineProperty(h,"pathGetter",{enumerable:!0,get:function(){return f}}),Object.defineProperty(h,"pathSetter",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(h,"getPath",{enumerable:!0,get:function(){return I}}),Object.defineProperty(h,"setPath",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(h,"humanise",{enumerable:!0,get:function(){return j}}),Object.defineProperty(h,"escapeHtml",{enumerable:!0,get:function(){return u}}),Object.defineProperty(h,"titleCase",{enumerable:!0,get:function(){return L}}),Object.defineProperty(h,"expand",{enumerable:!0,get:function(){return k}}),Object.defineProperty(h,"toArray",{enumerable:!0,get:function(){return U}}),Object.defineProperty(h,"merge",{enumerable:!0,get:function(){return B}}),Object.defineProperty(h,"mergeRow",{enumerable:!0,get:function(){return W}}),Object.defineProperty(h,"Lru",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(h,"collator",{enumerable:!0,get:function(){return S}}),Object.defineProperty(h,"defaultCompare",{enumerable:!0,get:function(){return p}}),Object.defineProperty(h,"now",{enumerable:!0,get:function(){return M}}),Object.defineProperty(h,"nextFrame",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(h,"cancelFrame",{enumerable:!0,get:function(){return st}}),Object.defineProperty(h,"frameBatched",{enumerable:!0,get:function(){return r}}),Object.defineProperty(h,"settleDebounce",{enumerable:!0,get:function(){return c}}),Object.defineProperty(h,"whenIdle",{enumerable:!0,get:function(){return m}}),Object.defineProperty(h,"uid",{enumerable:!0,get:function(){return z}});const Dt="1.81.0";async function dt(){return Dt}const at="1.81.0",V=new Set,tt=2e3;function x(s){if(V.add(s),V.size>tt){const e=V.values().next().value;e!==void 0&&V.delete(e)}}const J=[],l=500;function v(s,e,t){J.push({key:s,level:e,message:t.map(n=>typeof n=="string"?n:g(n)).join(" "),at:Date.now()}),J.length>l&&J.shift()}function g(s){if(s instanceof Error)return s.message;try{return JSON.stringify(s)}catch{return String(s)}}function _(){return J.map(s=>({...s}))}function q(s){if(s.length===0||typeof s[0]!="string")return s;const e=s[0].replace(/^\[lattice\]\s*/,"");return e===s[0]?s:[e,...s.slice(1)]}function et(s,...e){if(V.has(s))return;x(s);const t=q(e);v(s,"warn",t),console.warn("[lattice]",...t)}function $(s,...e){if(V.has(s))return;x(s);const t=q(e);v(s,"info",t),console.info("[lattice]",...t)}function T(){V.clear(),J.length=0}function A(s,e){const t=new Error(`[lattice] ${s}`);throw e!==void 0&&(t.cause=e),t}function ot(s,e){s||A(e)}const K=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function R(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}function F(s){return typeof s=="function"}function X(s){return s==null}function Q(s){return s==null||s===""}function it(s){return typeof s!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(s))?!0:!!(s.prototype&&Object.getOwnPropertyNames(s.prototype).length>1)}const y=new Map;function f(s){let e=y.get(s);if(e)return e;if(!s.includes("."))e=t=>t?.[s];else{const t=s.split("."),n=t.length;e=i=>{let a=i;for(let b=0;b<n;b++){if(a==null)return;a=a[t[b]]}return a}}return y.set(s,e),e}const N=new Map;function Y(s){let e=N.get(s);if(e)return e;if(!s.includes("."))e=(t,n)=>{t!=null&&(t[s]=n)};else{const t=s.split("."),n=t.length-1;e=(i,a)=>{let b=i;for(let d=0;d<n;d++){if(b==null)return;const P=t[d];b[P]==null&&(b[P]={}),b=b[P]}b!=null&&(b[t[n]]=a)}}return N.set(s,e),e}function I(s,e){return f(e)(s)}function rt(s,e,t){Y(e)(s,t)}function j(s){return s?(s.includes(".")?s.slice(s.lastIndexOf(".")+1):s).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(/^./,t=>t.toUpperCase()):""}const H={"&":"&","<":"<",">":">",'"':""","'":"'"};function u(s){const e=s==null?"":String(s);return/[&<>"']/.test(e)?e.replace(/[&<>"']/g,t=>H[t]):e}function L(s){return String(s).replace(/\w\S*/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}function k(s,e,t){if(s!==void 0)return s===!0?{enabled:!0,...t}:s===!1?{enabled:!1}:R(s)?s:{[e]:s,enabled:!0}}function U(s){return s==null?[]:Array.isArray(s)?s:[s]}const o=Object.freeze(new Set(["__proto__","constructor","prototype"]));function B(s,e){if(!R(s))return R(e)?{...e}:e;if(!R(e))return e===void 0?s:e;const t={...s};for(const n of Object.keys(e)){if(o.has(n))continue;const i=e[n];i!==void 0&&(t[n]=R(i)&&R(t[n])?B(t[n],i):i)}return t}function W(s,e){if(!R(s)||!R(e)||s===e)return e;const t=Object.create(Object.getPrototypeOf(s));return Object.assign(t,s,e),t}class Z{#n;#r=new Map;#t;constructor(e=256,t=null){this.#n=e,this.#t=t}get size(){return this.#r.size}get max(){return this.#n}set max(e){this.#n=e,this.#e()}has(e){return this.#r.has(e)}get(e){const t=this.#r;if(!t.has(e))return;const n=t.get(e);return t.delete(e),t.set(e,n),n}peek(e){return this.#r.get(e)}set(e,t){const n=this.#r;return n.has(e)&&n.delete(e),n.set(e,t),this.#e(),t}delete(e){const t=this.#r.get(e);return this.#r.delete(e)&&this.#t&&this.#t(t,e),t}clear(){if(this.#t)for(const[e,t]of this.#r)this.#t(t,e);this.#r.clear()}keys(){return this.#r.keys()}values(){return this.#r.values()}#e(){const e=this.#r;for(;e.size>this.#n;){const t=e.keys().next().value,n=e.get(t);e.delete(t),this.#t&&this.#t(n,t)}}}const E=new Map;function S(s,e){const t=`${s||""}|${e?JSON.stringify(e):""}`;let n=E.get(t);return n||(n=new Intl.Collator(s||void 0,{numeric:!0,sensitivity:"variant",...e}),E.set(t,n)),n}function p(s,e){if(s===e)return 0;if(s==null)return 1;if(e==null)return-1;if(typeof s=="number"&&typeof e=="number")return Number.isNaN(s)?Number.isNaN(e)?0:1:Number.isNaN(e)||s<e?-1:s>e?1:0;const t=String(s),n=String(e);return t<n?-1:t>n?1:0}function M(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const lt=typeof requestAnimationFrame=="function";function wt(s){return lt?requestAnimationFrame(s):setTimeout(()=>s(M()),16)}function st(s){s!=null&&(lt?cancelAnimationFrame(s):clearTimeout(s))}function r(s){let e=null,t=null;const n=()=>{e=null;const a=t;t=null,s(...a||[])},i=(...a)=>{t=a,e===null&&(e=wt(n))};return i.cancel=()=>{st(e),e=null,t=null},i.flush=()=>{e!==null&&(st(e),n())},i}function c(s,e){let t=null,n=null;const i=()=>{if(t=null,n===null)return;const d=n;n=null,s(...d),a()},a=()=>{t=setTimeout(i,e),typeof t?.unref=="function"&&t.unref()},b=(...d)=>{t===null?(s(...d),a()):(n=d,clearTimeout(t),a())};return b.flush=()=>{if(t!==null&&clearTimeout(t),t=null,n===null)return;const d=n;n=null,s(...d)},b.cancel=()=>{t!==null&&clearTimeout(t),t=null,n=null},b.pending=()=>t!==null||n!==null,b}function m(s,e=50){return typeof requestIdleCallback=="function"?requestIdleCallback(s,{timeout:e}):setTimeout(()=>s({timeRemaining:()=>0,didTimeout:!0}),1)}let w=0;function z(s="l"){return`${s}${(++w).toString(36)}`}}),Et("packages/modules/shared/emitter.js",function(h,pt){"use strict";Object.defineProperty(h,"WILDCARD",{enumerable:!0,get:function(){return V}}),Object.defineProperty(h,"Emitter",{enumerable:!0,get:function(){return J}}),Object.defineProperty(h,"gate",{enumerable:!0,get:function(){return l}});const Dt=pt("packages/core/src/internal/util.js"),dt=Dt.isFunction,at=Dt.warnOnce,V="*",tt=new Set(["api","user","init","ai"]);function x(v,g){return v&&v.name?v.name:`#${g}`}class J{#n=new Map;#r;constructor(g="module"){this.#r=String(g)}on(g,_){if(!dt(_))return()=>{};let q=this.#n.get(g);return q||(q=new Set,this.#n.set(g,q)),q.add(_),()=>this.off(g,_)}off(g,_){const q=this.#n.get(g);q&&q.delete(_)}count(g){const _=this.#n.get(g);return _?_.size:0}emit(g,_){const q=this.#n.get(g),et=this.#n.get(V);if((!q||q.size===0)&&(!et||et.size===0))return;const $={..._||null,type:g};q&&q.size&&this.#t([...q],$,g),et&&et.size&&this.#t([...et],$,V)}#t(g,_,q){for(let et=0;et<g.length;et++)try{g[et](_)}catch($){at(`${this.#r}.emit.throw:${q}:${x(g[et],et)}`,`${this.#r}: a '${q}' handler threw; other handlers were unaffected.`,$)}}emitBefore(g,_,q){const et=q??(_&&_.origin),$=tt.has(et)?et:"user";let T=!1,A=null;const ot=it=>{T=!0,it!=null&&A===null&&(A=String(it))},K={..._||null,type:g,origin:$,get defaultPrevented(){return T},get reason(){return A},preventDefault(it){ot(it)}},R=this.#n.get(g);if(!R||R.size===0)return!0;const F=[...R],X=()=>(T&&A===null&&(A="prevented"),T&&_&&typeof _=="object"&&(_.reason=A),!T),Q=[];for(let it=0;it<F.length;it++){const y=F[it];try{const f=y(K);f&&dt(f.then)?Q.push(f):f===!1&&ot("prevented")}catch(f){ot("error"),at(`${this.#r}.beforeThrow:${g}:${x(y,it)}`,`${this.#r}: a '${g}' before-handler threw; the action was cancelled.`,f)}}return Q.length===0?X():Promise.allSettled(Q).then(it=>{for(const y of it)y.status==="rejected"?(ot("error"),at(`${this.#r}.beforeReject:${g}`,`${this.#r}: a '${g}' before-handler rejected; the action was cancelled.`,y.reason)):y.value===!1&&ot("prevented");return X()})}clear(){this.#n.clear()}}function l(v,g,_,q,et){const $=v.emitBefore(g,q,q.origin),T=()=>(v.emit(_,{...q,reason:q.reason||"prevented"}),!1);return $===!1?T():$&&dt($.then)?$.then(A=>A?et():T()):et()}}),Et("packages/modules/gantt/time.js",function(h,pt){"use strict";Object.defineProperty(h,"toDayNumber",{enumerable:!0,get:function(){return V}}),Object.defineProperty(h,"fromDayNumber",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(h,"toISODate",{enumerable:!0,get:function(){return x}}),Object.defineProperty(h,"resolveProjectEpoch",{enumerable:!0,get:function(){return J}});const dt=pt("packages/core/src/internal/util.js").warnOnce,at=864e5;function V(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())/at):null;const v=Date.parse(l);return Number.isFinite(v)?Math.floor(v/at):null}function tt(l){return Number.isFinite(l)?new Date(Math.round(l)*at):null}function x(l){const v=tt(l);return v?v.toISOString().slice(0,10):null}function J(l){if(l==null||l==="")return 0;const v=V(l);return Number.isFinite(v)?v:(dt(`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)}}),Et("packages/modules/gantt/calendar.js",function(h,pt){"use strict";Object.defineProperty(h,"createCalendar",{enumerable:!0,get:function(){return tt}});const Dt=pt("packages/modules/gantt/time.js"),dt=Dt.fromDayNumber,at=Dt.toDayNumber,V=Object.freeze([1,2,3,4,5]);function tt(x,J=0){if(x==null)return null;let l,v;x==="weekends"?(l=V,v=new Set):(l=Array.isArray(x.workdays)&&x.workdays.length?x.workdays.map(Number).filter(R=>R>=0&&R<=6):V,v=new Set((Array.isArray(x.holidays)?x.holidays:[]).map(R=>at(R)).filter(R=>R!=null)));const g=new Set(l);if(g.size===7&&v.size===0||g.size===0)return null;const _=R=>{const F=dt(R);return F?g.has(F.getUTCDay())&&!v.has(R):!1},q=R=>{let F=R;for(;!_(F);)F+=1;return F},et=R=>{let F=R;for(;!_(F);)F-=1;return F},$=q(Math.round(Number.isFinite(J)?J:0)),T=new Map([[0,$]]),A=new Map([[$,0]]);return{isWorking:_,nextWorking:q,dayOf:R=>{const F=Math.round(R);if(T.has(F))return T.get(F);if(F>0){let it=F-1;for(;!T.has(it);)it-=1;let y=T.get(it);for(let f=it+1;f<=F;f+=1)y=q(y+1),T.set(f,y),A.set(y,f);return T.get(F)}let X=F+1;for(;!T.has(X);)X+=1;let Q=T.get(X);for(let it=X-1;it>=F;it-=1)Q=et(Q-1),T.set(it,Q),A.set(Q,it);return T.get(F)},indexOf:R=>{const F=q(Math.round(R));if(A.has(F))return A.get(F);if(F>$){let it=0,y=$;for(;A.has(q(y+1))&&y<F;)y=q(y+1),it=A.get(y);for(;y<F;)y=q(y+1),it+=1,T.set(it,y),A.set(y,it);return it}let X=0,Q=$;for(;Q>F;)Q=et(Q-1),X-=1,T.set(X,Q),A.set(Q,X);return X},anchor:$}}}),Et("packages/modules/gantt/schedule.js",function(h,pt){"use strict";Object.defineProperty(h,"LINK_TYPES",{enumerable:!0,get:function(){return J}}),Object.defineProperty(h,"CONSTRAINT_TYPES",{enumerable:!0,get:function(){return l}}),Object.defineProperty(h,"EPS",{enumerable:!0,get:function(){return g}}),Object.defineProperty(h,"SCHEDULE_ERROR",{enumerable:!0,get:function(){return _}}),Object.defineProperty(h,"TASK_FIELDS",{enumerable:!0,get:function(){return $}}),Object.defineProperty(h,"taskIdReader",{enumerable:!0,get:function(){return A}}),Object.defineProperty(h,"taskFieldWriters",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(h,"normalizeTasks",{enumerable:!0,get:function(){return R}}),Object.defineProperty(h,"buildTree",{enumerable:!0,get:function(){return F}}),Object.defineProperty(h,"normalizeLinkSpec",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(h,"normalizeDependencies",{enumerable:!0,get:function(){return it}}),Object.defineProperty(h,"expandDependencies",{enumerable:!0,get:function(){return y}}),Object.defineProperty(h,"topoOrder",{enumerable:!0,get:function(){return f}}),Object.defineProperty(h,"computeSchedule",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(h,"findViolations",{enumerable:!0,get:function(){return L}});const dt=pt("packages/core/src/internal/util.js").warnOnce,V=pt("packages/modules/gantt/calendar.js").createCalendar,x=pt("packages/modules/gantt/time.js").toDayNumber,J=["FS","SS","FF","SF"],l=["MSO","MFO","ALAP"],v=Object.freeze({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"}),g=1e-9,_={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 q(k){if(k==null||k==="")return null;const U=typeof k=="number"?k:Number(k);return Number.isFinite(U)?U:null}function et(k){return k==null||k===""?null:x(k)}const $=Object.freeze(["id","name","start","end","duration","milestone","percentComplete","parent","baselineStart","baselineEnd","constraint","constraintDate"]);function T(k){const U=k&&typeof k=="object"?k:{},o={};for(const B of $){const W=U[B];if(typeof W=="function")o[B]=W;else if(typeof W=="string"&&W!==""){const Z=W;o[B]=E=>E[Z]}else o[B]=Z=>Z[B]}return o}function A(k){return T(k).id}function ot(k){const U=k&&typeof k=="object"?k:{},o={};for(const B of $){const W=U[B];typeof W=="string"&&W!==""?o[B]=W:typeof W=="function"?o[B]=null:o[B]=B}return o}function K(k,U){const o=U.constraint(k),B=o??(k&&k.constraintType);if(B==null||B==="")return null;const W=v[String(B).toLowerCase().replace(/\s+/g,"-")]??(l.includes(String(B).toUpperCase())?String(B).toUpperCase():null);if(!W)return null;const Z=et(U.constraintDate(k)??k.constraintAt??k.at);return{type:W,at:Z}}function R(k,U){const o=new Map,B=[],W=T(U);if(!Array.isArray(k))return{ok:!1,error:{code:_.BAD_DURATION,message:"tasks must be an array"},order:B,byId:o};for(const Z of k){const E=Z?W.id(Z):null,S=E!=null?String(E):null;if(S==null)return{ok:!1,error:{code:_.UNKNOWN_TASK,message:"every task needs an id"},order:B,byId:o};if(o.has(S))return{ok:!1,error:{code:_.DUPLICATE_ID,message:`duplicate task id "${S}"`,id:S},order:B,byId:o};const p=et(W.start(Z)),M=et(W.end(Z)),lt=W.milestone(Z)===!0;let wt=lt?0:q(W.duration(Z));if(wt==null&&p!=null&&M!=null&&(wt=M-p),wt!=null&&wt<0)return{ok:!1,error:{code:_.BAD_DURATION,message:`task "${S}" has negative duration ${wt}`,id:S},order:B,byId:o};const st=W.name(Z),r=W.parent(Z);o.set(S,{id:S,name:st!=null?String(st):S,duration:wt,milestoneFlag:lt,earliestStart:p,placedStart:p,placedEnd:M,percentComplete:q(W.percentComplete(Z)),parent:r!=null?String(r):null,constraint:K(Z,W),baselineStart:et(W.baselineStart(Z)??(Z.baseline&&Z.baseline.start)),baselineEnd:et(W.baselineEnd(Z)??(Z.baseline&&Z.baseline.end))}),B.push(S)}return{ok:!0,order:B,byId:o}}function F(k,U){const o=new Map(k.map(S=>[S,[]]));for(const S of k){const p=U.get(S).parent;if(p!=null){if(!U.has(p))return{ok:!1,error:{code:_.UNKNOWN_PARENT,message:`task "${S}" names unknown parent "${p}"`,id:S}};o.get(p).push(S)}}for(const S of k){const p=new Set;let M=U.get(S).parent;for(;M!=null;){if(M===S||p.has(M))return{ok:!1,error:{code:_.PARENT_CYCLE,message:`parent cycle at "${S}"`,id:S}};p.add(M),M=U.get(M)?.parent??null}}const B=S=>o.get(S).length>0,W=new Map,Z=S=>{if(W.has(S))return W.get(S);const p=o.get(S),M=p.length===0?[S]:p.flatMap(lt=>Z(lt));return W.set(S,M),M};return{ok:!0,children:o,isSummary:B,descendantLeaves:Z,ancestors:S=>{const p=new Set;let M=U.get(S).parent;for(;M!=null;)p.add(M),M=U.get(M).parent;return p}}}const X=/^\s*(FS|SS|FF|SF)\s*(?:([+-])\s*(\d+(?:\.\d+)?))?\s*$/i;function Q(k){const U={...k||null};if(typeof U.type!="string")return U;const o=X.exec(U.type);if(!o||!o[2])return U;const B=(o[2]==="-"?-1:1)*Number(o[3]);U.type=o[1].toUpperCase();const W=q(k.lag);return W!=null&&W!==B?(dt(`gantt-link-shorthand-${String(k.type)}-${W}`,`[lattice] gantt: dependency type ${JSON.stringify(k.type)} carries a lag of ${B} but lag: ${W} was also given; the explicit lag wins. Give one or the other.`),U):(U.lag=B,U)}function it(k,U,o={}){const B=[];if(k==null)return{ok:!0,edges:B};if(!Array.isArray(k))return{ok:!1,error:{code:_.UNKNOWN_TASK,message:"dependencies must be an array"},edges:B};const W=typeof o.ancestors=="function"?o.ancestors:null;for(const Z of k){const E=Q(Z),S=E&&E.from!=null?String(E.from):null,p=E&&E.to!=null?String(E.to):null,M=E&&E.type!=null?String(E.type).toUpperCase():"FS",lt=q(E.lag)??0;if(S==null||p==null)return{ok:!1,error:{code:_.UNKNOWN_TASK,message:"a dependency needs both `from` and `to`"},edges:B};if(!U.has(S))return{ok:!1,error:{code:_.UNKNOWN_TASK,message:`dependency references unknown task "${S}"`,id:S},edges:B};if(!U.has(p))return{ok:!1,error:{code:_.UNKNOWN_TASK,message:`dependency references unknown task "${p}"`,id:p},edges:B};if(S===p)return{ok:!1,error:{code:_.SELF_DEPENDENCY,message:`task "${S}" depends on itself`,id:S},edges:B};if(!J.includes(M))return{ok:!1,error:{code:_.BAD_LINK_TYPE,message:`unknown link type "${M}" (expected one of ${J.join("/")})`},edges:B};if(W&&(W(S).has(p)||W(p).has(S)))return{ok:!1,error:{code:_.DEP_ACROSS_HIERARCHY,message:`dependency between "${S}" and "${p}" crosses their own parent/child hierarchy`,from:S,to:p},edges:B};B.push({from:S,to:p,type:M,lag:lt})}return{ok:!0,edges:B}}function y(k,U){const o=new Set,B=[];for(const W of k){(U.isSummary(W.from)||U.isSummary(W.to))&&W.type!=="FS"&&dt(`gantt-summary-link-${W.type}-${W.from}-${W.to}`,`[lattice] gantt: ${W.type} link with a summary endpoint (${W.from} -> ${W.to}) is expanded to descendant leaves — a conservative v1 reading; only FS is exact for summary endpoints.`);for(const E of U.descendantLeaves(W.from))for(const S of U.descendantLeaves(W.to)){if(E===S)continue;const p=[E,S,W.type,W.lag].join("");o.has(p)||(o.add(p),B.push({from:E,to:S,type:W.type,lag:W.lag}))}}return B}function f(k,U){const o=new Map(k.map(E=>[E,0])),B=new Map(k.map(E=>[E,[]]));for(const E of U)N(o,E.to),B.get(E.from).push(E.to);const W=k.filter(E=>o.get(E)===0),Z=[];for(;W.length;){const E=W.shift();Z.push(E);for(const S of B.get(E)){const p=o.get(S)-1;o.set(S,p),p===0&&W.push(S)}}return Z.length===k.length?{ok:!0,sorted:Z}:{ok:!1,cycle:Y(k,B,new Set(Z))}}function N(k,U){k.set(U,k.get(U)+1)}function Y(k,U,o){const B=k.find(S=>!o.has(S)),W=[],Z=new Map;let E=B;for(;E!=null&&!Z.has(E);)Z.set(E,W.length),W.push(E),E=U.get(E).find(S=>!o.has(S));return E==null?W:W.slice(Z.get(E)).concat(E)}function I(k,U,o,B,W,Z=new Map){const E=f(k,o);if(!E.ok)return dt(`gantt-cycle-${E.cycle.join(">")}`,`[lattice] gantt: dependency cycle detected (${E.cycle.join(" -> ")}); schedule refused.`),{ok:!1,error:{code:_.CYCLE,message:`dependency cycle: ${E.cycle.join(" -> ")}`,cycle:E.cycle}};const S=E.sorted,p=new Map(k.map(w=>[w,[]])),M=new Map(k.map(w=>[w,[]]));for(const w of o)p.get(w.to).push(w),M.get(w.from).push(w);const lt=new Map;for(const w of k){const z=U.get(w);lt.set(w,{id:w,name:z.name,duration:z.duration,es:0,ef:0,ls:0,lf:0,totalFloat:0,critical:!1,percentComplete:z.percentComplete,parent:z.parent,isSummary:!1,isMilestone:z.duration===0,children:[]})}const wt=[];for(const w of S){const z=U.get(w),s=lt.get(w);let e=Math.max(B,z.earliestStart??B);for(const n of p.get(w)){const i=lt.get(n.from);let a;switch(n.type){case"FS":a=i.ef+n.lag;break;case"SS":a=i.es+n.lag;break;case"FF":a=i.ef+n.lag-s.duration;break;case"SF":a=i.es+n.lag-s.duration;break;default:a=-1/0}a>e&&(e=a)}const t=Z.get(w);if(t&&t.type!=="ALAP"&&t.at!=null){const n=t.type==="MFO"?t.at-s.duration:t.at;n<e-g?wt.push({id:w,type:t.type,at:t.at,earliestFeasible:e}):e=n,s.pinned=!0}s.es=e,s.ef=e+s.duration}const st=k.length?Math.max(...k.map(w=>lt.get(w).ef)):B,r=Number.isFinite(W)?W:st;for(let w=S.length-1;w>=0;w-=1){const z=S[w],s=lt.get(z);let e=r;for(const t of M.get(z)){const n=lt.get(t.to);let i;switch(t.type){case"FS":i=n.ls-t.lag;break;case"SS":i=n.ls-t.lag+s.duration;break;case"FF":i=n.lf-t.lag;break;case"SF":i=n.lf-t.lag+s.duration;break;default:i=1/0}i<e&&(e=i)}s.pinned&&(e=s.ef),s.lf=e,s.ls=e-s.duration,s.totalFloat=s.ls-s.es,s.critical=s.totalFloat<=g}for(const w of k){const z=Z.get(w);if(!z||z.type!=="ALAP")continue;const s=lt.get(w);s.es=s.ls,s.ef=s.lf,s.totalFloat=0,s.critical=!0}const c=k.filter(w=>lt.get(w).critical),m=u(k,o,lt);return{ok:!0,tasks:lt,critical:c,criticalPaths:m,projectFinish:st,conflicts:wt}}function rt(k,U=[],o={}){const B=et(o.projectStart)??0,W=et(o.deadline),Z=V(o.calendar,B),E=a=>a==null?null:Z?Z.indexOf(a):a,S=a=>Z?Z.dayOf(a):a,p=R(k,o.fields);if(!p.ok)return{ok:!1,error:p.error};const{order:M,byId:lt}=p,wt=F(M,lt);if(!wt.ok)return{ok:!1,error:wt.error};const st=it(U,lt,wt);if(!st.ok)return{ok:!1,error:st.error};for(const a of M)if(!wt.isSummary(a)&<.get(a).duration==null)return{ok:!1,error:{code:_.BAD_DURATION,message:`task "${a}" has no duration and no start+end to derive one`,id:a}};const r=M.filter(a=>!wt.isSummary(a)),c=new Map(r.map(a=>{const b=lt.get(a);return[a,{...b,earliestStart:E(b.earliestStart)}]})),m=new Map;for(const a of r){const b=lt.get(a).constraint;b&&m.set(a,{type:b.type,at:E(b.at)})}const w=Z?Z.indexOf(B):B,z=W==null?void 0:E(W),s=y(st.edges,wt),e=I(r,c,s,w,z,m);if(!e.ok)return{ok:!1,error:e.error};const t=e.tasks;for(const a of r){const b=t.get(a);b.es=S(b.es),b.ef=S(b.ef),b.ls=S(b.ls),b.lf=S(b.lf),j(b,lt.get(a).baselineStart,lt.get(a).baselineEnd)}for(let a=M.length-1;a>=0;a-=1){const b=M[a];wt.isSummary(b)&&t.set(b,H(b,lt.get(b),wt,t))}for(const a of M)wt.isSummary(a)&&(t.get(a).children=wt.children.get(a).slice());const n=Z?Z.anchor:B,i=S(e.projectFinish);return{ok:!0,tasks:t,order:M,critical:e.critical,criticalPaths:e.criticalPaths,projectStart:n,projectFinish:i,projectDuration:i-n,conflicts:e.conflicts||[],calendar:!!Z}}function j(k,U,o){U==null&&o==null||(k.baselineStart=U??null,k.baselineEnd=o??null,k.startVariance=U==null?null:k.es-U,k.finishVariance=o==null?null:k.ef-o,k.durationVariance=U==null||o==null?null:k.ef-k.es-(o-U))}function H(k,U,o,B){const W=o.children.get(k).map(m=>B.get(m)),Z=Math.min(...W.map(m=>m.es)),E=Math.max(...W.map(m=>m.ef)),S=Math.min(...W.map(m=>m.ls)),p=Math.max(...W.map(m=>m.lf)),M=o.descendantLeaves(k).map(m=>B.get(m)),lt=M.reduce((m,w)=>m+w.duration,0),wt=lt>g?M.reduce((m,w)=>m+w.duration*(w.percentComplete??0),0)/lt:null,st={id:k,name:U.name,duration:E-Z,es:Z,ef:E,ls:S,lf:p,totalFloat:S-Z,critical:W.some(m=>m.critical),percentComplete:wt,parent:U.parent,isSummary:!0,isMilestone:!1,children:[]},r=M.map(m=>m.baselineStart).filter(m=>m!=null),c=M.map(m=>m.baselineEnd).filter(m=>m!=null);return(r.length||c.length)&&j(st,r.length?Math.min(...r):null,c.length?Math.max(...c):null),st}function u(k,U,o){const B=new Map(k.map(p=>[p,[]])),W=new Set;for(const p of U){const M=o.get(p.from),lt=o.get(p.to);if(!M.critical||!lt.critical)continue;let wt;switch(p.type){case"FS":wt=M.ef+p.lag;break;case"SS":wt=M.es+p.lag;break;case"FF":wt=M.ef+p.lag-lt.duration;break;case"SF":wt=M.es+p.lag-lt.duration;break;default:wt=-1/0}Math.abs(wt-lt.es)<=g&&(B.get(p.from).push(p.to),W.add(p.to))}const Z=k.filter(p=>o.get(p).critical&&!W.has(p)),E=[],S=(p,M)=>{const lt=B.get(p);if(!lt.length){E.push(M);return}for(const wt of lt)S(wt,M.concat(wt))};for(const p of Z)S(p,[p]);return E}function L(k,U,o){if(!U||!U.ok)return[];const B=[],W=T(o);for(const Z of k){const E=Z?W.id(Z):null,S=E!=null?String(E):null;if(S==null||!U.tasks.has(S))continue;const p=U.tasks.get(S);if(p.isSummary)continue;const M=q(W.start(Z));M!=null&&M<p.es-g&&B.push({id:S,placedStart:M,earliestStart:p.es,by:p.es-M})}return B}}),Et("packages/modules/gantt/resources.js",function(h,pt){"use strict";Object.defineProperty(h,"parseAssignments",{enumerable:!0,get:function(){return g}}),Object.defineProperty(h,"normalizeCapacities",{enumerable:!0,get:function(){return _}}),Object.defineProperty(h,"sweepLoad",{enumerable:!0,get:function(){return q}}),Object.defineProperty(h,"computeResourceLoad",{enumerable:!0,get:function(){return et}}),Object.defineProperty(h,"levelResources",{enumerable:!0,get:function(){return A}});const dt=pt("packages/core/src/internal/util.js").warnOnce,at=pt("packages/modules/gantt/schedule.js"),V=at.computeSchedule,tt=at.EPS,x=at.taskIdReader,l=pt("packages/modules/gantt/calendar.js").createCalendar;function v(K){if(K==null||K==="")return null;const R=typeof K=="number"?K:Number(K);return Number.isFinite(R)?R:null}function g(K){if(K&&Array.isArray(K.assignments))return K.assignments.map(X=>{const Q=X&&(X.resource??X.name??X.id);if(Q==null||Q==="")return null;const it=v(X.units)??v(X.allocation)??1;return{resource:String(Q),units:it}}).filter(Boolean);const R=K?K.assignee??K.assignees??K.owner:null;return(Array.isArray(R)?R:R==null||R===""?[]:[R]).map(X=>String(X)).filter(X=>X!=="").map(X=>({resource:X,units:1}))}function _(K,R){const F=new Map;if(Array.isArray(K))for(const X of K){const Q=X&&(X.id??X.name??X.resource);if(Q==null||Q==="")continue;const it=v(X.capacity??X.maxUnits??X.max??X.units);F.set(String(Q),it??R)}else if(K&&typeof K=="object")for(const[X,Q]of Object.entries(K)){const it=v(Q);F.set(String(X),it??R)}return F}function q(K){if(!K.length)return[];const R=new Set;for(const Q of K)R.add(Q.s),R.add(Q.e);const F=[...R].sort((Q,it)=>Q-it),X=[];for(let Q=0;Q<F.length-1;Q+=1){const it=F[Q],y=F[Q+1];if(y<=it)continue;let f=0;const N=[];for(const Y of K)Y.s<=it&&Y.e>=y&&(f+=Y.units,N.push(Y.taskId));N.length&&X.push({s:it,e:y,load:f,taskIds:N})}return X}function et(K,R,F={}){const X={ok:!1,resources:[],overAllocations:[],byResource:new Map};if(!R||!R.ok)return X;const Q=v(F.defaultCapacity)??1,it=_(F.resources,Q),y=F.calendar!=null?l(F.calendar,R.projectStart):null,f=L=>it.has(L)?it.get(L):Q,N=L=>y?y.indexOf(L):L,Y=L=>y?y.dayOf(L):L,I=x(F.fields),rt=new Map;for(const L of R.order){const k=R.tasks.get(L);if(!k||k.isSummary)continue;const U=K.find(Z=>Z&&I(Z)!=null&&String(I(Z))===L);if(!U)continue;const o=g(U);if(!o.length)continue;const B=N(k.es),W=N(k.ef);if(!(W<=B))for(const Z of o)rt.has(Z.resource)||rt.set(Z.resource,[]),rt.get(Z.resource).push({s:B,e:W,units:Z.units,taskId:L})}const j=new Map,H=[],u=[];for(const[L,k]of rt){const U=f(L),o=q(k);let B=0;const W=o.map(E=>{E.load>B&&(B=E.load);const S={start:Y(E.s),end:Y(E.e),load:E.load,taskIds:E.taskIds};return E.load>U+tt&&u.push({resource:L,capacity:U,start:S.start,end:S.end,load:E.load,taskIds:E.taskIds.slice()}),S}),Z={resource:L,capacity:U,peak:B,segments:W};j.set(L,Z),H.push(Z)}return H.sort((L,k)=>L.resource<k.resource?-1:L.resource>k.resource?1:0),u.sort((L,k)=>L.start-k.start||(L.resource<k.resource?-1:1)),{ok:!0,resources:H,overAllocations:u,byResource:j}}function $(K){if(!K)return!1;const R=K.constraint??K.constraintType;if(R==null||R==="")return!1;const F=String(R).toLowerCase().replace(/\s+/g,"-");return F==="mso"||F==="must-start-on"||F==="muststarton"||F==="start-on"||F==="mfo"||F==="must-finish-on"||F==="mustfinishon"||F==="finish-on"}function T(K,R){return K?v(K[R])??0:0}function A(K,R,F={}){const X={projectStart:F.projectStart,deadline:F.deadline,calendar:F.calendar,fields:F.fields},Q=F.priorityField||"priority",it=F.maxIterations!=null?F.maxIterations:Math.max(100,K.length*K.length*2),y=x(F.fields),f=K.map(u=>({...u})),N=f.map(u=>String(y(u))),Y=u=>N.indexOf(u);let I=V(f,R,X);if(!I.ok)return{ok:!1,error:I.error};const rt=new Map;for(const u of I.order){const L=I.tasks.get(u);L&&!L.isSummary&&rt.set(u,L.es)}let j=0;for(;j<it;j+=1){const u=et(f,I,F);if(!u.overAllocations.length)return{ok:!0,resolved:!0,tasks:f,schedule:I,moves:ot(rt,I),iterations:j};const L=u.overAllocations.slice().sort((E,S)=>E.start-S.start||S.load-E.load)[0],k=new Map(f.map(E=>[String(y(E)),E])),U=L.taskIds.map(E=>I.tasks.get(E)).filter(Boolean),o=U.filter(E=>!$(k.get(E.id)));if(!o.length)return{ok:!0,resolved:!1,tasks:f,schedule:I,moves:ot(rt,I),remaining:u.overAllocations,iterations:j};o.sort((E,S)=>{if(S.totalFloat!==E.totalFloat)return S.totalFloat-E.totalFloat;const p=T(k.get(E.id),Q),M=T(k.get(S.id),Q);return p!==M?p-M:S.es!==E.es?S.es-E.es:Y(S.id)-Y(E.id)});const B=o[0],W=U.filter(E=>E.id!==B.id).map(E=>E.ef).filter(E=>E>B.es+tt),Z=W.length?Math.min(...W):B.es+1;if(k.get(B.id).start=Z,I=V(f,R,X),!I.ok)return{ok:!1,error:I.error}}const H=et(f,I,F);return H.overAllocations.length&&dt("gantt-level-unresolved",`[lattice] gantt: resource leveling hit its ${it}-iteration cap with ${H.overAllocations.length} over-allocation(s) unresolved; returning the partial result.`),{ok:!0,resolved:H.overAllocations.length===0,tasks:f,schedule:I,moves:ot(rt,I),remaining:H.overAllocations,iterations:j}}function ot(K,R){const F=[];for(const X of R.order){const Q=R.tasks.get(X);if(!Q||Q.isSummary)continue;const it=K.get(X);it!=null&&Q.es>it+tt&&F.push({id:X,from:it,to:Q.es,delay:Q.es-it})}return F}}),Et("packages/modules/gantt/earned-value.js",function(h,pt){"use strict";Object.defineProperty(h,"computeEarnedValue",{enumerable:!0,get:function(){return l}});const dt=pt("packages/modules/gantt/time.js").toDayNumber,at=1e-9;function V(v){if(v==null||v==="")return null;const g=typeof v=="number"?v:Number(v);return Number.isFinite(g)?g:null}function tt(v,g,_){return _-g<=at?v>=_?1:0:v<=g?0:v>=_?1:(v-g)/(_-g)}function x(v,g,_,q,et){const $=g?V(g[q]):null,T=$??v.duration,A=g?V(g[et]):null,ot=v.percentComplete==null?0:Math.max(0,Math.min(100,v.percentComplete))/100,K=v.baselineStart!=null||v.baselineEnd!=null,R=v.baselineStart!=null?v.baselineStart:v.es,F=v.baselineEnd!=null?v.baselineEnd:v.ef,X=T*tt(_,R,F),Q=T*ot;return{bac:T,pv:X,ev:Q,ac:A,hasBaseline:K}}function J(v){const g=v.ac;return{bac:v.bac,pv:v.pv,ev:v.ev,ac:g,sv:v.ev-v.pv,cv:g==null?null:v.ev-g,spi:Math.abs(v.pv)<at?null:v.ev/v.pv,cpi:g==null||Math.abs(g)<at?null:v.ev/g}}function l(v,g,_={}){if(!g||!g.ok||!g.tasks||!g.order)return{ok:!1,error:{code:"NO_SCHEDULE",message:"earned value needs a successful schedule"}};const q=_.costField||"cost",et=_.actualCostField||"actualCost",$=_.statusDate==null?g.projectFinish:dt(_.statusDate)??g.projectFinish,T=new Map;for(const Q of Array.isArray(v)?v:[])Q&&Q.id!=null&&T.set(String(Q.id),Q);const A=()=>({bac:0,pv:0,ev:0,ac:0,acAny:!1,hasBaseline:!1}),ot=new Map;for(const Q of g.order)ot.set(Q,A());const K=A();for(const Q of g.order){const it=g.tasks.get(Q);if(!it||it.isSummary)continue;const y=x(it,T.get(Q),$,q,et);let f=Q;for(;f!=null&&ot.has(f);){const N=ot.get(f);N.bac+=y.bac,N.pv+=y.pv,N.ev+=y.ev,y.ac!=null&&(N.ac+=y.ac,N.acAny=!0),y.hasBaseline&&(N.hasBaseline=!0),f=g.tasks.get(f).parent}K.bac+=y.bac,K.pv+=y.pv,K.ev+=y.ev,y.ac!=null&&(K.ac+=y.ac,K.acAny=!0),y.hasBaseline&&(K.hasBaseline=!0)}const R=Q=>J({bac:Q.bac,pv:Q.pv,ev:Q.ev,ac:Q.acAny?Q.ac:null}),F=new Map,X=[];for(const Q of g.order){const it=g.tasks.get(Q),y=ot.get(Q),f={id:it.id,name:it.name,isSummary:!!it.isSummary,isMilestone:!!it.isMilestone,percentComplete:it.percentComplete??null,hasBaseline:y.hasBaseline,hasActualCost:y.acAny,...R(y)};F.set(Q,f),X.push(f)}return{ok:!0,statusDate:$,byTask:F,rows:X,project:{hasActualCost:K.acAny,hasBaseline:K.hasBaseline,...R(K)}}}}),Et("packages/modules/gantt/mspdi.js",function(h,pt){"use strict";Object.defineProperty(h,"parseXml",{enumerable:!0,get:function(){return et}}),Object.defineProperty(h,"importMSPDI",{enumerable:!0,get:function(){return it}}),Object.defineProperty(h,"exportMSPDI",{enumerable:!0,get:function(){return f}});const dt=pt("packages/core/src/internal/util.js").warnOnce,at=pt("packages/modules/gantt/time.js"),V=at.toDayNumber,tt=at.toISODate,x=Object.freeze({0:"FF",1:"FS",2:"SF",3:"SS"}),J=Object.freeze({FF:0,FS:1,SF:2,SS:3}),l=Object.freeze({1:"as-late-as-possible",2:"must-start-on",3:"must-finish-on"}),v=Object.freeze({ALAP:1,MSO:2,MFO:3});function g(j){return String(j).replace(/&(#x?[0-9a-fA-F]+|lt|gt|amp|quot|apos);/g,(H,u)=>{if(u[0]==="#"){const L=u[1]==="x"||u[1]==="X"?parseInt(u.slice(2),16):parseInt(u.slice(1),10);return Number.isFinite(L)?String.fromCodePoint(L):H}return{lt:"<",gt:">",amp:"&",quot:'"',apos:"'"}[u]??H})}function _(j){return String(j??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function q(j){const H=j.indexOf(":");return H<0?j:j.slice(H+1)}function et(j){const H=String(j);let u=0;const L=[];let k=null;for(;u<H.length;){const U=H.indexOf("<",u);if(U<0)break;if(U>u&&L.length){const M=H.slice(u,U);M.trim()&&(L[L.length-1].text+=g(M))}if(H.startsWith("<?",U)){const M=H.indexOf("?>",U);u=M<0?H.length:M+2;continue}if(H.startsWith("<!--",U)){const M=H.indexOf("-->",U);u=M<0?H.length:M+3;continue}if(H.startsWith("<![CDATA[",U)){const M=H.indexOf("]]>",U);L.length&&(L[L.length-1].text+=H.slice(U+9,M<0?H.length:M)),u=M<0?H.length:M+3;continue}if(H.startsWith("<!",U)){const M=H.indexOf(">",U);u=M<0?H.length:M+1;continue}const o=H.indexOf(">",U);if(o<0)break;let B=H.slice(U+1,o).trim();if(B[0]==="/"){L.pop(),u=o+1;continue}const W=B.endsWith("/");W&&(B=B.slice(0,-1).trim());const Z=B.search(/\s/),E=q(Z<0?B:B.slice(0,Z)),S={};if(Z>=0)for(const M of B.slice(Z).matchAll(/([\w:.-]+)\s*=\s*"([^"]*)"|([\w:.-]+)\s*=\s*'([^']*)'/g))S[q(M[1]??M[3])]=g(M[2]??M[4]??"");const p={name:E,attrs:S,children:[],text:""};L.length?L[L.length-1].children.push(p):k||(k=p),W||L.push(p),u=o+1}return k}function $(j,H){return j?j.children.find(u=>u.name===H):void 0}function T(j,H){return j?j.children.filter(u=>u.name===H):[]}function A(j,H){const u=$(j,H);return u?u.text.trim():void 0}function ot(j){if(!j)return null;const H=String(j).match(/^\d{4}-\d{2}-\d{2}/);return V(H?H[0]:j)}function K(j,H){return`${tt(j)}T${String(H).padStart(2,"0")}:00:00`}function R(j,H){if(!j)return null;const u=String(j).match(/PT?(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?/);return u?((Number(u[1])||0)+(Number(u[2])||0)/60+(Number(u[3])||0)/3600)/H:null}function F(j,H){return`PT${Math.round((j||0)*H*1e3)/1e3}H0M0S`}function X(j,H){return(Number(j)||0)/(600*H)}function Q(j,H){return Math.round((j||0)*10*60*H)}function it(j,H={}){const u=H.hoursPerDay??8,L=et(j);if(!L||L.name!=="Project")return dt("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 k=ot(A(L,"StartDate")),U=$(L,"Resources"),o=new Map,B=[];for(const c of T(U,"Resource")){const m=A(c,"UID"),w=A(c,"Name");if(m==null||w==null||w==="")continue;o.set(m,w);const z=A(c,"MaxUnits");B.push({id:w,name:w,capacity:z==null?1:Number(z)})}const W=$(L,"Assignments"),Z=new Map;for(const c of T(W,"Assignment")){const m=A(c,"TaskUID"),w=A(c,"ResourceUID"),z=o.get(w);if(m==null||z==null)continue;const s=A(c,"Units");Z.has(m)||Z.set(m,[]),Z.get(m).push({resource:z,units:s==null?1:Number(s)})}const E=$(L,"Tasks"),S=[],p=[],M=new Map,lt=[],wt=[];for(const c of T(E,"Task")){if(A(c,"IsNull")==="1")continue;const m=A(c,"UID");if(m==null||m==="0")continue;const w=m;M.set(m,w);const z=Number(A(c,"OutlineLevel"))||1;for(;lt.length&<[lt.length-1].level>=z;)lt.pop();const s=lt.length?lt[lt.length-1].uid:null;lt.push({uid:m,level:z});const e=A(c,"Summary")==="1",t=A(c,"Milestone")==="1",n={id:w,name:A(c,"Name")??w};if(s&&(n.parent=s),t&&(n.milestone=!0),!e&&!t){const G=R(A(c,"Duration"),u);G!=null&&(n.duration=G)}const i=ot(A(c,"Start"));!e&&i!=null&&(n.start=i);const a=A(c,"PercentComplete");a!=null&&(n.percentComplete=Number(a));const b=l[Number(A(c,"ConstraintType"))];if(b){n.constraint=b;const G=ot(A(c,"ConstraintDate"));G!=null&&(n.constraintDate=G)}const d=$(c,"Baseline");if(d){const G=ot(A(d,"Start")),C=ot(A(d,"Finish"));G!=null&&(n.baselineStart=G),C!=null&&(n.baselineEnd=C)}const P=Z.get(m);P&&P.length&&(n.assignments=P),S.push(n);for(const G of T(c,"PredecessorLink"))wt.push({raw:G,uid:m})}for(const{raw:c,uid:m}of wt){const w=A(c,"PredecessorUID"),z=M.get(w),s=M.get(m);if(z==null||s==null)continue;const e=x[Number(A(c,"Type")??1)]??"FS",t=X(A(c,"LinkLag"),u),n={from:z,to:s,type:e};t&&(n.lag=t),p.push(n)}const st=y(L),r={ok:!0,tasks:S,dependencies:p,resources:B};return k!=null&&(r.projectStart=k),st&&(r.calendar=st),r}function y(j){const H=$(j,"Calendars"),u=T(H,"Calendar"),L=A(j,"CalendarUID"),k=u.find(E=>A(E,"UID")===L)??u[0];if(!k)return null;const U=$(k,"WeekDays"),o=[];let B=!1;for(const E of T(U,"WeekDay")){const S=Number(A(E,"DayType"));S>=1&&S<=7&&(B=!0,A(E,"DayWorking")==="1"&&o.push(S-1))}const W=[],Z=$(k,"Exceptions");for(const E of T(Z,"Exception")){if(A(E,"DayWorking")==="1")continue;const S=$(E,"TimePeriod"),p=ot(A(S,"FromDate")),M=ot(A(S,"ToDate"))??p;if(p!=null)for(let lt=p;lt<=M;lt+=1)W.push(lt)}return!B&&!W.length?null:{workdays:B?o:[1,2,3,4,5],holidays:W}}function f(j,H={}){const u=H.hoursPerDay??8,L=Array.isArray(j.tasks)?j.tasks:[],k=Array.isArray(j.dependencies)?j.dependencies:[],U=Array.isArray(j.resources)?j.resources:j.resources&&typeof j.resources=="object"?Object.entries(j.resources).map(([r,c])=>({id:r,name:r,capacity:c})):[],o=j.schedule&&j.schedule.ok?j.schedule:null,B=new Map;L.forEach((r,c)=>{const m=String(r.id);B.set(m,/^\d+$/.test(m)?m:String(c+1))});const W=new Map;for(const r of L){const c=r.parent!=null?String(r.parent):null;c&&(W.has(c)||W.set(c,[]),W.get(c).push(String(r.id)))}const Z=r=>W.has(r),E=r=>{let c=1,m=L.find(w=>String(w.id)===r);for(;m&&m.parent!=null;)c+=1,m=L.find(w=>String(w.id)===String(m.parent));return c},S=new Map;for(const r of k){const c=String(r.to);S.has(c)||S.set(c,[]),S.get(c).push(r)}const p=[];p.push('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'),p.push('<Project xmlns="http://schemas.microsoft.com/project">'),p.push(` <Name>${_(H.projectName||"Lattice Gantt export")}</Name>`);const M=j.projectStart!=null?V(j.projectStart):o?o.projectStart:null;M!=null&&p.push(` <StartDate>${K(M,8)}</StartDate>`);const lt=Y(j.calendar);if(lt&&p.push(" <CalendarUID>1</CalendarUID>"),lt){p.push(" <Calendars>"),p.push(" <Calendar>"),p.push(" <UID>1</UID>"),p.push(" <Name>Standard</Name>"),p.push(" <IsBaseCalendar>1</IsBaseCalendar>"),p.push(" <WeekDays>");for(let r=0;r<=6;r+=1){const c=lt.workdays.includes(r);p.push(" <WeekDay>"),p.push(` <DayType>${r+1}</DayType>`),p.push(` <DayWorking>${c?1:0}</DayWorking>`),p.push(" </WeekDay>")}if(p.push(" </WeekDays>"),lt.holidays.length){p.push(" <Exceptions>");for(const r of lt.holidays)p.push(" <Exception>"),p.push(" <DayWorking>0</DayWorking>"),p.push(` <TimePeriod><FromDate>${K(r,0)}</FromDate><ToDate>${K(r,23)}</ToDate></TimePeriod>`),p.push(" </Exception>");p.push(" </Exceptions>")}p.push(" </Calendar>"),p.push(" </Calendars>")}p.push(" <Tasks>");for(const r of L){const c=String(r.id),m=B.get(c),w=Z(c),z=!!r.milestone||!w&&Number(r.duration)===0,s=o?o.tasks.get(c):null;p.push(" <Task>"),p.push(` <UID>${_(m)}</UID>`),p.push(` <ID>${_(m)}</ID>`),p.push(` <Name>${_(r.name!=null?r.name:c)}</Name>`),p.push(` <OutlineLevel>${E(c)}</OutlineLevel>`),p.push(` <Summary>${w?1:0}</Summary>`),p.push(` <Milestone>${z?1:0}</Milestone>`);const e=s?s.duration:r.duration!=null?Number(r.duration):null;e!=null&&p.push(` <Duration>${F(e,u)}</Duration>`),p.push(" <DurationFormat>7</DurationFormat>");const t=s?s.es:r.start!=null?V(r.start):null,n=s?s.ef:r.end!=null?V(r.end):t!=null&&e!=null?t+e:null;t!=null&&p.push(` <Start>${K(t,8)}</Start>`),n!=null&&p.push(` <Finish>${K(n,17)}</Finish>`);const i=s?s.percentComplete:r.percentComplete;i!=null&&p.push(` <PercentComplete>${Math.round(Number(i))}</PercentComplete>`);const a=I(r.constraint??r.constraintType);if(a!=null){p.push(` <ConstraintType>${a}</ConstraintType>`);const P=rt(r.constraintDate??r.constraintAt??r.at);P!=null&&p.push(` <ConstraintDate>${K(P,8)}</ConstraintDate>`)}const b=rt(r.baselineStart??(r.baseline&&r.baseline.start)),d=rt(r.baselineEnd??(r.baseline&&r.baseline.end));(b!=null||d!=null)&&(p.push(" <Baseline>"),p.push(" <Number>0</Number>"),b!=null&&p.push(` <Start>${K(b,8)}</Start>`),d!=null&&p.push(` <Finish>${K(d,17)}</Finish>`),b!=null&&d!=null&&p.push(` <Duration>${F(d-b,u)}</Duration>`),p.push(" </Baseline>"));for(const P of S.get(c)||[]){const G=B.get(String(P.from));G!=null&&(p.push(" <PredecessorLink>"),p.push(` <PredecessorUID>${_(G)}</PredecessorUID>`),p.push(` <Type>${J[P.type?String(P.type).toUpperCase():"FS"]??1}</Type>`),P.lag&&(p.push(` <LinkLag>${Q(Number(P.lag),u)}</LinkLag>`),p.push(" <LagFormat>7</LagFormat>")),p.push(" </PredecessorLink>"))}p.push(" </Task>")}p.push(" </Tasks>");const wt=new Map;U.forEach((r,c)=>{const m=String(r.name??r.id??`Resource ${c+1}`);wt.set(m,{uid:String(c+1),capacity:r.capacity??r.maxUnits??1})});const st=[];for(const r of L)for(const c of N(r))wt.has(c.resource)||wt.set(c.resource,{uid:String(wt.size+1),capacity:1}),st.push({taskUid:B.get(String(r.id)),resUid:wt.get(c.resource).uid,units:c.units});p.push(" <Resources>");for(const[r,c]of wt)p.push(" <Resource>"),p.push(` <UID>${_(c.uid)}</UID>`),p.push(` <ID>${_(c.uid)}</ID>`),p.push(` <Name>${_(r)}</Name>`),p.push(` <MaxUnits>${Number(c.capacity)}</MaxUnits>`),p.push(" </Resource>");return p.push(" </Resources>"),p.push(" <Assignments>"),st.forEach((r,c)=>{p.push(" <Assignment>"),p.push(` <UID>${c+1}</UID>`),p.push(` <TaskUID>${_(r.taskUid)}</TaskUID>`),p.push(` <ResourceUID>${_(r.resUid)}</ResourceUID>`),p.push(` <Units>${Number(r.units)}</Units>`),p.push(" </Assignment>")}),p.push(" </Assignments>"),p.push("</Project>"),p.join(`
|
|
7
7
|
`)}function N(j){if(j&&Array.isArray(j.assignments))return j.assignments.map(L=>{const k=L&&(L.resource??L.name??L.id);if(k==null||k==="")return null;const U=Number(L.units??L.allocation??1);return{resource:String(k),units:Number.isFinite(U)?U:1}}).filter(Boolean);const H=j?j.assignee??j.assignees??j.owner:null;return(Array.isArray(H)?H:H==null||H===""?[]:[H]).map(L=>String(L)).filter(L=>L!=="").map(L=>({resource:L,units:1}))}function Y(j){if(j==null)return null;if(j==="weekends")return{workdays:[1,2,3,4,5],holidays:[]};const H=Array.isArray(j.workdays)&&j.workdays.length?j.workdays.map(Number).filter(L=>L>=0&&L<=6):[1,2,3,4,5],u=(Array.isArray(j.holidays)?j.holidays:[]).map(L=>V(L)).filter(L=>L!=null);return{workdays:H,holidays:u}}function I(j){if(j==null||j==="")return null;const H=String(j).toLowerCase().replace(/\s+/g,"-"),L={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"}[H]??(["MSO","MFO","ALAP"].includes(String(j).toUpperCase())?String(j).toUpperCase():null);return L?v[L]:null}function rt(j){return j==null||j===""?null:V(j)}}),Et("packages/modules/gantt/workload.js",function(h,pt){"use strict";Object.defineProperty(h,"WORKLOAD_DEFAULTS",{enumerable:!0,get:function(){return g}}),Object.defineProperty(h,"statedHours",{enumerable:!0,get:function(){return q}}),Object.defineProperty(h,"taskContour",{enumerable:!0,get:function(){return et}}),Object.defineProperty(h,"contourTotal",{enumerable:!0,get:function(){return $}}),Object.defineProperty(h,"serializeContour",{enumerable:!0,get:function(){return T}}),Object.defineProperty(h,"contourSpan",{enumerable:!0,get:function(){return A}}),Object.defineProperty(h,"spanDuration",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(h,"spreadHours",{enumerable:!0,get:function(){return K}}),Object.defineProperty(h,"setContourBucket",{enumerable:!0,get:function(){return R}}),Object.defineProperty(h,"retimeContour",{enumerable:!0,get:function(){return F}}),Object.defineProperty(h,"recordWorkingDays",{enumerable:!0,get:function(){return X}}),Object.defineProperty(h,"workloadBuckets",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(h,"computeWorkload",{enumerable:!0,get:function(){return it}}),Object.defineProperty(h,"formatHours",{enumerable:!0,get:function(){return y}});const dt=pt("packages/modules/gantt/resources.js").parseAssignments,at=pt("packages/modules/gantt/schedule.js"),V=at.EPS,tt=at.taskIdReader,x=pt("packages/modules/gantt/time.js"),J=x.fromDayNumber,l=x.toDayNumber,v=x.toISODate,g=Object.freeze({hoursPerDay:8,height:160,rowHeight:28,decimals:1,totals:!0});function _(f){if(f==null||f===""||typeof f=="boolean")return null;const N=typeof f=="number"?f:Number(f);return Number.isFinite(N)?N:null}function q(f){if(!f||Array.isArray(f.work))return null;const N=_(f.work);return N??_(f.hours)}function et(f){if(!f||!Array.isArray(f.work))return null;const N=[];for(const I of f.work){if(!I||typeof I!="object")continue;const rt=l(I.date),j=_(I.hours);rt==null||j==null||N.push({day:Math.round(rt),hours:j})}N.sort((I,rt)=>I.day-rt.day);const Y=[];for(const I of N){const rt=Y[Y.length-1];rt&&rt.day===I.day?rt.hours+=I.hours:Y.push({day:I.day,hours:I.hours})}return Y}function $(f){return(Array.isArray(f)?f:[]).reduce((N,Y)=>N+(_(Y.hours)??0),0)}function T(f){const N=[];for(const Y of Array.isArray(f)?f:[]){const I=_(Y.hours);if(I==null||!(Math.abs(I)>V))continue;const rt=v(Y.day);rt!=null&&N.push({date:rt,hours:Math.round(I*1e6)/1e6})}return N}function A(f){const N=(Array.isArray(f)?f:[]).filter(Y=>Math.abs(_(Y.hours)??0)>V);return N.length?{first:N[0].day,last:N[N.length-1].day}:null}function ot(f,N,Y=null){if(!Number.isFinite(f)||!Number.isFinite(N)||N<f)return 0;if(typeof Y!="function")return Math.round(N-f)+1;let I=0;for(let rt=Math.round(f);rt<=Math.round(N);rt+=1)Y(rt)&&(I+=1);return I}function K(f,N){if(!Array.isArray(f)||!f.length)return[];const Y=N/f.length;return f.map(I=>({day:I,hours:Y}))}function R(f,N,Y,I){const rt=(Array.isArray(f)?f:[]).filter(H=>!(H.day>=N.start&&H.day<N.end)),j=Math.abs(I)>V?K(Y,I):[];return[...rt,...j].sort((H,u)=>H.day-u.day)}function F(f,N,Y){const I=Array.isArray(N)?N:[],rt=Array.isArray(Y)?Y:[];if(!Array.isArray(f)||!I.length||!rt.length)return Array.isArray(f)?f:[];const j=new Map(f.map(k=>[k.day,_(k.hours)??0])),H=I.map(k=>j.get(k)??0),u=H.length,L=[];for(let k=0;k<rt.length;k+=1){const U=H[Math.min(u-1,Math.floor(k*u/rt.length))];Math.abs(U)>V&&L.push({day:rt[k],hours:U})}return L}function X(f,N=null){const Y=[];if(!f||!Number.isFinite(f.es)||!Number.isFinite(f.ef))return Y;for(let I=Math.floor(f.es);I<Math.ceil(f.ef);I+=1)(typeof N!="function"||N(I))&&Y.push(I);return Y}function Q(f,N,Y){const I=Math.floor(N),rt=Math.ceil(Y),j=[];if(!(rt>I))return j;if(f==="day"){for(let L=I;L<rt;L+=1)j.push({start:L,end:L+1});return j}if(f==="month"||f==="quarter"){const L=J(I);if(!L)return j;let k=Date.UTC(L.getUTCFullYear(),L.getUTCMonth(),1)/864e5;for(;k<rt;){const U=J(k),o=Date.UTC(U.getUTCFullYear(),U.getUTCMonth()+1,1)/864e5;j.push({start:k,end:o}),k=o}return j}const H=J(I);let u=I-(H?H.getUTCDay():0);for(;u<rt;u+=7)j.push({start:u,end:u+7});return j}function it(f,N,Y={}){const I=Array.isArray(Y.buckets)?Y.buckets:[],rt={ok:!1,buckets:[],rows:[],totals:I.map(()=>null),grandTotal:0};if(!N||!N.ok)return rt;const j=_(Y.hoursPerDay)??g.hoursPerDay,H=typeof Y.isWorking=="function"?Y.isWorking:null,u=Y.capacities instanceof Map?Y.capacities:null,L=tt(Y.fields),k=new Map,U=(st,r,c,m)=>{k.has(st)||k.set(st,{days:new Map,tasks:new Map});const w=k.get(st);w.days.set(r,(w.days.get(r)||0)+c),w.tasks.has(m.id)||w.tasks.set(m.id,{...m,days:new Map});const z=w.tasks.get(m.id);z.days.set(r,(z.days.get(r)||0)+c)},o=new Map;for(const st of Array.isArray(f)?f:[]){const r=st?L(st):null;r!=null&&o.set(String(r),st)}const B=Array.isArray(f)&&N.order.length===f.length;for(let st=0;st<N.order.length;st+=1){const r=N.order[st],c=N.tasks.get(r);if(!c||c.isSummary)continue;const m=o.get(r)||(B?f[st]:null);if(!m)continue;const w=X(c,H),z=et(m);if(!z&&!w.length)continue;const s=dt(m),e=s.length?s:[{resource:null,units:1}],t=e.reduce((i,a)=>i+(_(a.units)??0),0);if(!(t>0))continue;let n;if(z)n=z.filter(i=>Math.abs(i.hours)>V);else{const i=q(m),a=i??w.length*j*t;if(!(Math.abs(a)>V))continue;n=K(w,a)}if(n.length)for(const i of e){const a=_(i.units)??0,b=a/t;if(!(Math.abs(b)>0))continue;const d={id:r,name:c.name,units:a,unitsTotal:t,raw:m};for(const P of n)U(i.resource,P.day,P.hours*b,d)}}const W=st=>{let r=0,c=I.length-1;for(;r<=c;){const m=r+c>>1;if(st<I[m].start)c=m-1;else if(st>=I[m].end)r=m+1;else return m}return-1},Z=I.map(st=>{let r=0;for(let c=Math.floor(st.start);c<Math.ceil(st.end);c+=1)(!H||H(c))&&(r+=1);return{start:st.start,end:st.end,workingDays:r}}),E=st=>{const r=Z.map(()=>0);for(const[c,m]of st){const w=W(c);w>=0&&(r[w]+=m)}return r},S=[...k.keys()].filter(st=>st!=null).sort(),p=k.has(null)?[...S,null]:S,M=[],lt=Z.map(()=>0);let wt=0;for(const st of p){const r=k.get(st),c=E(r.days),m=st!=null&&u&&u.has(st)?u.get(st):null,w=c.map(t=>Math.abs(t)>V?t:null),z=c.map((t,n)=>{if(m==null)return!1;const i=m*j*Z[n].workingDays;return t>i+V});let s=0;c.forEach((t,n)=>{s+=t,lt[n]+=t}),wt+=s;const e=[...r.tasks.values()].map(t=>{const n=E(t.days);return{id:t.id,name:t.name,units:t.units,unitsTotal:t.unitsTotal,raw:t.raw,cells:n.map(i=>Math.abs(i)>V?i:null),total:n.reduce((i,a)=>i+a,0)}});M.push({resource:st,capacity:m,cells:w,over:z,total:s,tasks:e})}return{ok:!0,buckets:Z,rows:M,totals:lt.map(st=>Math.abs(st)>V?st:null),grandTotal:wt}}function y(f,N){if(f==null||!Number.isFinite(f))return"";const I=10**(Number.isFinite(N)?Math.max(0,Math.min(6,Math.round(N))):1),rt=Math.round(f*I)/I;return Object.is(rt,-0)||rt===0?"0":String(rt)}}),Et("packages/modules/shared/autosize.js",function(h,pt){"use strict";Object.defineProperty(h,"contentWidth",{enumerable:!0,get:function(){return at}}),Object.defineProperty(h,"contentHeight",{enumerable:!0,get:function(){return V}}),Object.defineProperty(h,"firstMeasured",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(h,"watchSize",{enumerable:!0,get:function(){return x}}),Object.defineProperty(h,"watchBox",{enumerable:!0,get:function(){return J}});const dt=pt("packages/core/src/internal/util.js").warnOnce;function at(l){if(!l||typeof l!="object")return null;const v=Number(l.clientWidth);if(Number.isFinite(v)&&v>0)return v;if(typeof l.getBoundingClientRect=="function"){const g=l.getBoundingClientRect(),_=g&&Number(g.width);if(Number.isFinite(_)&&_>0)return _}return null}function V(l){if(!l||typeof l!="object")return null;const v=Number(l.clientHeight);if(Number.isFinite(v)&&v>0)return v;if(typeof l.getBoundingClientRect=="function"){const g=l.getBoundingClientRect(),_=g&&Number(g.height);if(Number.isFinite(_)&&_>0)return _}return null}function tt(l,v=at){for(const g of l||[]){const _=v(g);if(Number.isFinite(_)&&_>0)return _}return null}function x(l){const v=(l&&Array.isArray(l.targets)?l.targets:[]).filter(Boolean),g=l&&typeof l.read=="function"?l.read:()=>null,_=l&&typeof l.apply=="function"?l.apply:()=>{},q=Number.isFinite(l&&l.epsilon)?Number(l.epsilon):1;let et=null,$=!1;const T=()=>{if($)return!1;const F=g();if(!Number.isFinite(F)||F<=0||et!=null&&Math.abs(F-et)<q)return!1;et=F,$=!0;try{_(F)}finally{$=!1}return!0};T();const A=v[0],ot=l&&l.view||A&&A.ownerDocument&&A.ownerDocument.defaultView||globalThis,K=ot&&ot.ResizeObserver;let R=null;if(typeof K=="function"&&v.length){R=new K(()=>{T()});for(const F of v)F&&typeof R.observe=="function"&&R.observe(F)}else v.length&&dt("shared.autosize.no-resize-observer","ResizeObserver is unavailable; this view was sized once at mount and will not follow its container.");return{refresh:T,get applied(){return et},release(){if(R&&typeof R.disconnect=="function")try{R.disconnect()}catch{}R=null}}}function J(l){const v=(l&&Array.isArray(l.targets)?l.targets:[]).filter(Boolean),g=l&&typeof l.read=="function"?l.read:()=>({}),_=l&&typeof l.apply=="function"?l.apply:()=>{},q=Number.isFinite(l&&l.epsilon)?Number(l.epsilon):1;let et=null,$=!1;const T=X=>{if(et==null)return!0;for(const[Q,it]of Object.entries(X)){if(!Number.isFinite(it)||it<=0)continue;const y=et[Q];if(!Number.isFinite(y)||Math.abs(it-y)>=q)return!0}return!1},A=()=>{if($)return!1;const X=g();if(!X||typeof X!="object"||!Object.values(X).some(it=>Number.isFinite(it)&&it>0)||!T(X))return!1;et={...et,...X},$=!0;try{_(X)}finally{$=!1}return!0};A();const ot=v[0],K=l&&l.view||ot&&ot.ownerDocument&&ot.ownerDocument.defaultView||globalThis,R=K&&K.ResizeObserver;let F=null;if(typeof R=="function"&&v.length){F=new R(()=>{A()});for(const X of v)X&&typeof F.observe=="function"&&F.observe(X)}else v.length&&dt("shared.autosize.no-resize-observer","ResizeObserver is unavailable; this view was sized once at mount and will not follow its container.");return{refresh:A,get applied(){return et},release(){if(F&&typeof F.disconnect=="function")try{F.disconnect()}catch{}F=null}}}}),Et("packages/modules/shared/axislabels.js",function(h,pt){"use strict";Object.defineProperty(h,"CHAR_RATIO",{enumerable:!0,get:function(){return Dt}}),Object.defineProperty(h,"BOLD_FACTOR",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(h,"MIN_GAP",{enumerable:!0,get:function(){return at}}),Object.defineProperty(h,"estimateLabelWidth",{enumerable:!0,get:function(){return V}}),Object.defineProperty(h,"thinLabels",{enumerable:!0,get:function(){return tt}});const Dt=.62,dt=1.05,at=6;function V(x,J,l=!1){return String(x??"").length*J*Dt*(l?dt:1)}function tt(x,J){const l=Number.isFinite(J.gap)?Number(J.gap):at,v=Number.isFinite(J.fontSize)?Number(J.fontSize):11,g=typeof J.measure=="function"?J.measure:T=>V(T,v,!!J.bold),_=x.filter(T=>T&&Number.isFinite(T.at)).map(T=>({...T,width:g(String(T.text??""))})).sort((T,A)=>T.at-A.at);if(_.length<2)return{every:1,kept:_};const q=T=>{let A=null;for(let ot=0;ot<_.length;ot+=T){const K=_[ot];if(A&&K.at-A.at<A.width+l)return!1;A=K}return!0};let et=1;for(;et<_.length&&!q(et);)et++;const $=[];for(let T=0;T<_.length;T+=et)$.push(_[T]);return{every:et,kept:$}}}),Et("packages/modules/charts/svg.js",function(h,pt){"use strict";Object.defineProperty(h,"SVG_NS",{enumerable:!0,get:function(){return Dt}}),Object.defineProperty(h,"el",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(h,"svg",{enumerable:!0,get:function(){return at}}),Object.defineProperty(h,"attr",{enumerable:!0,get:function(){return V}}),Object.defineProperty(h,"attrs",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(h,"setText",{enumerable:!0,get:function(){return x}}),Object.defineProperty(h,"clear",{enumerable:!0,get:function(){return J}}),Object.defineProperty(h,"append",{enumerable:!0,get:function(){return l}}),Object.defineProperty(h,"path",{enumerable:!0,get:function(){return v}}),Object.defineProperty(h,"ribbonPath",{enumerable:!0,get:function(){return g}}),Object.defineProperty(h,"round",{enumerable:!0,get:function(){return _}}),Object.defineProperty(h,"pathRings",{enumerable:!0,get:function(){return q}}),Object.defineProperty(h,"insideRings",{enumerable:!0,get:function(){return et}});const Dt="http://www.w3.org/2000/svg";function dt($,T,A){const ot=$.createElement(T);return A&&ot.setAttribute("class",A),ot}function at($,T,A){const ot=$.createElementNS(Dt,T);if(A)for(const K of Object.keys(A))ot.setAttribute(K,String(A[K]));return ot}function V($,T,A){$&&(A==null?$.removeAttribute(T):$.setAttribute(T,String(A)))}function tt($,T){if($)for(const A of Object.keys(T))V($,A,T[A])}function x($,T){$&&($.textContent=T==null?"":String(T))}function J($){if($)for(;$.firstChild;)$.removeChild($.firstChild)}function l($,T){for(const A of T)A&&$.appendChild(A);return $}function v($){return $.join(" ")}function g($){if(!$||$.length<2)return"";const T=["M",$[0].x,$[0].upper];for(let A=1;A<$.length;A++)T.push("L",$[A].x,$[A].upper);for(let A=$.length-1;A>=0;A--)T.push("L",$[A].x,$[A].lower);return T.push("Z"),v(T)}function _($){return Math.round($*100)/100}function q($){const T=[];let A=[];const ot=String($||"").match(/[A-Za-z]|-?\d*\.?\d+(?:e[-+]?\d+)?/gi)||[];let K="",R=[];const F=()=>{if(!K||!R.length){R=[];return}if(K==="M"||K==="L")for(let X=0;X+1<R.length;X+=2)A.push([R[X],R[X+1]]);else K!=="Z"&&R.length>=2&&A.push([R[R.length-2],R[R.length-1]]);R=[]};for(const X of ot){if(/[A-Za-z]/.test(X)){if(F(),X==="Z"||X==="z"){A.length>2&&T.push(A),A=[],K="";continue}X==="M"&&A.length>2&&(T.push(A),A=[]),K=X;continue}R.push(Number(X))}return F(),A.length>2&&T.push(A),T}function et($,T,A){let ot=!1;for(const K of $)for(let R=0,F=K.length-1;R<K.length;F=R++){const[X,Q]=K[R],[it,y]=K[F];Q>A!=y>A&&T<(it-X)*(A-Q)/(y-Q||1e-12)+X&&(ot=!ot)}return ot}}),Et("packages/modules/charts/scale.js",function(h,pt){"use strict";Object.defineProperty(h,"isNumber",{enumerable:!0,get:function(){return l}}),Object.defineProperty(h,"toNumber",{enumerable:!0,get:function(){return v}}),Object.defineProperty(h,"toTime",{enumerable:!0,get:function(){return g}}),Object.defineProperty(h,"extent",{enumerable:!0,get:function(){return _}}),Object.defineProperty(h,"niceStep",{enumerable:!0,get:function(){return q}}),Object.defineProperty(h,"niceDomain",{enumerable:!0,get:function(){return et}}),Object.defineProperty(h,"measureDomain",{enumerable:!0,get:function(){return $}}),Object.defineProperty(h,"linearTicks",{enumerable:!0,get:function(){return T}}),Object.defineProperty(h,"timeStepFor",{enumerable:!0,get:function(){return A}}),Object.defineProperty(h,"timeTicks",{enumerable:!0,get:function(){return K}}),Object.defineProperty(h,"linearScale",{enumerable:!0,get:function(){return R}}),Object.defineProperty(h,"timeScale",{enumerable:!0,get:function(){return F}}),Object.defineProperty(h,"key",{enumerable:!0,get:function(){return X}}),Object.defineProperty(h,"bandScale",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(h,"sqrtScale",{enumerable:!0,get:function(){return it}});const Dt=[1,2,2.5,5,10],dt=6e4,at=36e5,V=864e5,tt=365.25*V,x=[1,2,5,10,20,25,50,100],J=[1,5,10,25,50,100,250,500,1e3,5e3,15e3,3e4,dt,5*dt,15*dt,30*dt,at,3*at,6*at,12*at,V,2*V,7*V,14*V,30*V,90*V,180*V,...x.map(y=>y*tt)];function l(y){return typeof y=="number"&&Number.isFinite(y)}function v(y){if(y==null||y==="")return null;if(y instanceof Date){const N=y.getTime();return Number.isFinite(N)?N:null}if(typeof y=="boolean")return y?1:0;const f=Number(y);return Number.isFinite(f)?f:null}function g(y){if(y==null||y==="")return null;if(y instanceof Date){const N=y.getTime();return Number.isFinite(N)?N:null}if(typeof y=="number")return Number.isFinite(y)?y:null;const f=Date.parse(String(y));return Number.isFinite(f)?f:null}function _(y){let f=1/0,N=-1/0;for(let Y=0;Y<y.length;Y++){const I=y[Y];l(I)&&(I<f&&(f=I),I>N&&(N=I))}return f===1/0?null:{min:f,max:N}}function q(y){if(!(y>0))return 1;const f=10**Math.floor(Math.log10(y));for(const N of Dt)if(y<=N*f)return N*f;return 10*f}function et(y,f=5){const N=q((y.max-y.min)/Math.max(1,f));return{min:Math.floor(y.min/N)*N,max:Math.ceil(y.max/N)*N,step:N}}function $(y,f={}){const N=_(y)||{min:0,max:1};let{min:Y,max:I}=N;if(f.zero&&(Y>0&&(Y=0),I<0&&(I=0)),Y===I){const rt=Math.abs(Y)>0?Math.abs(Y)/10:1;Y-=rt,I+=rt}if(f.nice!==!1){const rt=et({min:Y,max:I},f.ticks||5);Y=rt.min,I=rt.max}return l(f.min)&&(Y=f.min),l(f.max)&&(I=f.max),Y===I&&(I=Y+1),{min:Y,max:I}}function T(y,f=5){const N=q((y.max-y.min)/Math.max(1,f)),Y=Math.ceil(y.min/N),I=Math.floor(y.max/N),rt=[];for(let j=Y;j<=I;j++){const H=j*N;rt.push(Math.abs(H)<N/1e6?0:Number(H.toPrecision(12)))}return rt}function A(y,f=5){const N=Math.max(1,f),Y=y/N;let I=J[J.length-1];for(const H of J)if(H>=Y){I=H;break}if(I<tt)return I;let rt=I,j=Math.abs(y/I-N);for(const H of J){if(H<tt)continue;const u=Math.abs(y/H-N);u<j&&(j=u,rt=H)}return rt}function ot(y,f){const N=new Date(y.min).getUTCFullYear();let Y=Math.ceil(N/f)*f;Date.UTC(Y,0,1)<y.min&&(Y+=f);const I=[];for(;Date.UTC(Y,0,1)<=y.max;Y+=f)I.push(Date.UTC(Y,0,1));return I}function K(y,f=5){const N=A(y.max-y.min,f);if(N>=tt)return ot(y,Math.round(N/tt));const Y=[],I=Math.ceil(y.min/N)*N;for(let rt=I;rt<=y.max;rt+=N)Y.push(rt);return Y}function R(y,f){const N=y.max-y.min||1,[Y,I]=f;return{kind:"linear",domain:y,range:f,of(rt){return Y+(rt-y.min)/N*(I-Y)},invert(rt){return y.min+(rt-Y)/(I-Y||1)*N},ticks(rt=5){return T(y,rt)}}}function F(y,f){return{...R(y,f),kind:"time",ticks(Y=5){return K(y,Y)}}}function X(y){if(y==null)return" null";if(y instanceof Date)return` date:${y.getTime()}`;if(typeof y=="object"){const f=y,N=f.id??f.key??f.value;return N!==void 0&&typeof N!="object"?` obj:${String(N)}`:` obj:${String(y)}`}return String(y)}function Q(y,f,N=.2){const Y=Math.min(.9,Math.max(0,N)),[I,rt]=f,j=new Map;for(let L=0;L<y.length;L++){const k=X(y[L]);j.has(k)||j.set(k,L)}const H=y.length?(rt-I)/y.length:rt-I,u=Math.max(0,H*(1-Y));return{kind:"band",domain:y,range:f,bandwidth:u,step:H,of(L){const k=j.get(X(L));return k===void 0?NaN:I+k*H+(H-u)/2},centre(L){const k=this.of(L);return Number.isNaN(k)?NaN:k+u/2},ticks(){return y}}}function it(y,f){const[N,Y]=f,I=Math.max(Math.abs(y.max),Math.abs(y.min),0)||1;return{kind:"sqrt",domain:y,range:f,of(rt){const j=Math.sqrt(Math.abs(rt)/I);return N+j*(Y-N)}}}}),Et("packages/modules/gantt/links.js",function(h,pt){"use strict";Object.defineProperty(h,"LINK_SIDES",{enumerable:!0,get:function(){return V}}),Object.defineProperty(h,"linkSides",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(h,"routeLink",{enumerable:!0,get:function(){return x}}),Object.defineProperty(h,"arrowheadPath",{enumerable:!0,get:function(){return J}});const Dt=pt("packages/modules/charts/svg.js"),dt=Dt.path,at=Dt.round,V=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 tt(l){return V[String(l||"FS").toUpperCase()]||V.FS}function x(l){const v=Number(l.sx),g=Number(l.sy),_=Number(l.ex),q=Number(l.ey),et=Number.isFinite(l.elbow)&&l.elbow>0?Number(l.elbow):8,$=Number.isFinite(l.rowGap)&&l.rowGap>0?Number(l.rowGap):et,T=tt(l.type),A=-T.arrive,ot=Math.abs(q-g)<.5,K=(_-v)*A;if(ot&&K>0)return{d:dt(["M",at(v),at(g),"H",at(_)]),arrowDir:A,route:"straight"};if(K>=0)return{d:dt(["M",at(v),at(g),"V",at(q),"H",at(_)]),arrowDir:A,route:"drop"};const R=ot?g+$:(g+q)/2,F=v+T.depart*et,X=_+T.arrive*et;return{d:dt(["M",at(v),at(g),"H",at(F),"V",at(R),"H",at(X),"V",at(q),"H",at(_)]),arrowDir:A,route:"detour"}}function J(l,v,g,_=4){return dt(["M",at(l),at(v),"L",at(l-g*_),at(v-_),"L",at(l-g*_),at(v+_),"Z"])}}),Et("packages/modules/gantt/messages.js",function(h,pt){"use strict";Object.defineProperty(h,"FALLBACK_EN",{enumerable:!0,get:function(){return at}}),Object.defineProperty(h,"createTranslator",{enumerable:!0,get:function(){return V}});const dt=pt("packages/core/src/internal/util.js").isFunction,at=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.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.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"});function V(tt,x){return function(l,v){const g=dt(x)?x():null,_=tt&&tt.grid,q=g&&dt(g.t)&&g||_&&_.messages&&dt(_.messages.t)&&_.messages||null;if(q){let $;try{$=q.t(l,v)}catch{$=null}if(typeof $=="string"&&$&&$!==l)return $}const et=at[l];return et?et.replace(/\{(\w+)\}/g,($,T)=>v&&T in v?String(v[T]):$):l}}}),Et("packages/modules/gantt/gestures.js",function(h,pt){"use strict";Object.defineProperty(h,"describeTask",{enumerable:!0,get:function(){return at}}),Object.defineProperty(h,"GanttGestures",{enumerable:!0,get:function(){return V}});const dt=pt("packages/modules/charts/svg.js").round;function at(tt,x){const J=tt.isSummary?"summary":tt.isMilestone?"milestone":"task",l=x.dateAxis===!1?`day ${dt(tt.es)} to ${dt(tt.ef)}`:`${x.iso(tt.es)} to ${x.iso(tt.ef)}`,v=[`${tt.name}, ${J}`,l];return tt.isMilestone||v.push(`${dt(tt.duration)} days`),tt.percentComplete!=null&&v.push(`${Math.round(tt.percentComplete)}% complete`),v.push(`slack ${dt(tt.totalFloat)} days`),tt.critical&&v.push("on the critical path"),v.join(", ")}class V{#n;#r=null;#t=null;#e=null;constructor(x){this.#n=x}#o(){return this.#n.options()||{}}get dragging(){return this.#r!==null}#i(){const x=this.#n.plot();if(x&&typeof x.getScreenCTM=="function"){let l=null;try{l=x.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 J=x&&x.getBoundingClientRect?x.getBoundingClientRect():null;return{scale:1,origin:J&&J.left||0}}#u(x){const{scale:J,origin:l}=this.#i();return((x.clientX||0)-l)/J}#a(x){const{scale:J}=this.#i();return Math.round(x/J/(this.#n.pxPerDay()||1))}onPointerDown(x){const J=this.#n.controller.schedule;if(!J||!J.ok)return;const l=this.#n.rowOf(x.target);if(!l)return;const v=l.getAttribute("data-task"),g=J.tasks.get(v);if(!g||g.isSummary)return;const _=this.#n.barOf(l);if(!_)return;const q=this.#u(x),et=Number.isFinite(this.#o().resizeZone)?Number(this.#o().resizeZone):6,$=!g.isMilestone&&q>=this.#y(_)-et?"resize":"move";this.#r={id:v,mode:$,startX:x.clientX||0,origStart:g.es,origDuration:g.duration,barEl:_},x.preventDefault&&x.preventDefault();const T=ot=>this.#s(ot),A=ot=>this.#N(ot);this.#t={move:T,up:A},this.#n.doc.addEventListener("pointermove",T),this.#n.doc.addEventListener("pointerup",A)}#y(x){const J=parseFloat(x.getAttribute("x")),l=parseFloat(x.getAttribute("width"));return Number.isFinite(J)&&Number.isFinite(l)?J+l:Number.POSITIVE_INFINITY}#s(x){if(!this.#r)return;const J=this.#n.pxPerDay()||1,l=this.#a((x.clientX||0)-this.#r.startX),v=this.#r.barEl;if(this.#r.mode==="move")v.getAttribute("d")?this.#D(v,l*J):(v.setAttribute("x",dt(parseFloat(v.getAttribute("x"))+l*J-this.#c(v))),this.#w(v,l*J));else{const g=Math.max(1,parseFloat(v.getAttribute("width"))+(l*J-this.#c(v)));v.setAttribute("width",dt(g)),this.#w(v,l*J)}}#c(x){return parseFloat(x.getAttribute("data-preview")||"0")}#w(x,J){x.setAttribute("data-preview",String(J))}#D(x,J){const l=this.#c(x),v=x.getAttribute("d").split(" ");for(let g=1;g<v.length;g+=1){const _=parseFloat(v[g]);!Number.isNaN(_)&&g%3===1&&(v[g]=String(dt(_+(J-l))))}x.setAttribute("d",v.join(" ")),this.#w(x,J)}#N(x){const J=this.#r;if(this.#g(),this.#r=null,!J)return;const l=this.#a((x.clientX||0)-J.startX);if(l===0){this.#n.redraw();return}J.mode==="move"?this.#n.controller.applyEdit({id:J.id,start:J.origStart+l},{writeBack:!0}):this.#n.controller.applyEdit({id:J.id,duration:Math.max(0,J.origDuration+l)},{writeBack:!0}),this.#n.redraw()}#g(){this.#t&&(this.#n.doc.removeEventListener("pointermove",this.#t.move),this.#n.doc.removeEventListener("pointerup",this.#t.up),this.#t=null)}onKey(x){const J=this.#n.controller,l=J.schedule;if(!l||!l.ok)return;const v=this.#n.rowOf(x.target),g=v?v.getAttribute("data-task"):null,_=g?l.tasks.get(g):null;if(!_)return;const q=this.#o(),et=Number.isFinite(q.moveStep)?Number(q.moveStep):1,$=x.key,T=this.#n.t;if($==="ArrowRight"||$==="ArrowLeft"){if(_.isSummary)return;const A=$==="ArrowRight"?1:-1;if(this.#n.focusTask(g),x.shiftKey){if(_.isMilestone)return;const ot=Math.max(0,_.duration+A*et);J.applyEdit({id:g,duration:ot},{writeBack:!0}),this.#n.announce(T("gantt.a11y.resized",{name:_.name,days:ot}))}else{const ot=_.es+A*et,K=q.dateAxis===!1?T("gantt.a11y.day",{day:ot}):this.#n.iso(ot);J.applyEdit({id:g,start:ot},{writeBack:!0}),this.#n.announce(T("gantt.a11y.moved",{name:_.name,date:K}))}x.preventDefault&&x.preventDefault()}else if($==="l"||$==="L"){if(_.isSummary)return;if(!this.#e)this.#e=g,this.#n.announce(T("gantt.a11y.linkFrom",{name:_.name}));else if(this.#e!==g){const A=this.#e;this.#e=null,this.#n.focusTask(g),J.setDependencies([...J.dependencies,{from:A,to:g,type:"FS"}]),this.#n.announce(T("gantt.a11y.linked",{from:A,to:_.name}))}x.preventDefault&&x.preventDefault()}else if($==="Delete"||$==="Backspace"){if(_.isSummary)return;J.deleteTask(g),this.#n.announce(T("gantt.a11y.deleted",{name:_.name})),x.preventDefault&&x.preventDefault()}else $==="Escape"&&this.#e&&(this.#e=null,this.#n.announce(T("gantt.a11y.linkCancelled")))}destroy(){this.#g(),this.#r=null,this.#e=null}}}),Et("packages/modules/gantt/render.js",function(h,pt){"use strict";Object.defineProperty(h,"NS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(h,"GanttView",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(h,"mountGantt",{enumerable:!0,get:function(){return wt}});const dt=pt("packages/core/src/internal/util.js").warnOnce,at=pt("packages/modules/shared/autosize.js"),V=at.contentWidth,tt=at.firstMeasured,x=at.watchSize,l=pt("packages/modules/shared/axislabels.js").thinLabels,v=pt("packages/modules/charts/svg.js"),g=v.svg,_=v.el,q=v.setText,et=v.path,$=v.round,A=pt("packages/modules/charts/scale.js").linearScale,ot=pt("packages/modules/gantt/time.js"),K=ot.toISODate,R=ot.fromDayNumber,F=ot.toDayNumber,X=ot.resolveProjectEpoch,Q=pt("packages/modules/gantt/links.js"),it=Q.routeLink,y=Q.arrowheadPath,N=pt("packages/modules/gantt/schedule.js").EPS,Y=pt("packages/modules/gantt/messages.js"),I=Y.createTranslator,rt=pt("packages/modules/gantt/gestures.js"),j=rt.GanttGestures,H=rt.describeTask;Object.defineProperty(h,"FALLBACK_EN",{enumerable:!0,get:function(){return Y.FALLBACK_EN}});const u="lat-gantt",L="data-lat-gantt-styles",k=720,U=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}),o=11,B=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 W(){return`
|
|
8
8
|
.${u}{font:12px/1.4 system-ui,sans-serif;color:var(--lattice-foreground,#1f2933);overflow:auto}
|
|
9
9
|
.${u}__plot{max-width:100%;height:auto;display:block}
|