@toclocoinc/lattice-grid 1.74.0 → 1.75.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.
Files changed (225) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/angular/package.json +1 -1
  4. package/docs/API.html +44 -6
  5. package/docs/CHART-CODES.md +8 -0
  6. package/docs/api/adapters.html +1 -1
  7. package/docs/api/ai.html +1 -1
  8. package/docs/api/alarms.html +1 -1
  9. package/docs/api/charts.html +28 -2
  10. package/docs/api/data-router.html +1 -1
  11. package/docs/api/deckgl.html +2 -2
  12. package/docs/api/gantt.html +1 -1
  13. package/docs/api/geometry.html +1 -1
  14. package/docs/api/grid.html +2 -2
  15. package/docs/api/index.html +2 -2
  16. package/docs/api/kanban.html +1 -1
  17. package/docs/api/kpi.html +1 -1
  18. package/docs/api/layout.html +1 -1
  19. package/docs/api/list.html +1 -1
  20. package/docs/api/mock-socket.html +1 -1
  21. package/docs/api/tabs.html +1 -1
  22. package/docs/api/types.html +13 -1
  23. package/docs/api-detail.html +13 -4
  24. package/docs/warnings.json +36 -3
  25. package/lattice-grid.d.ts +37 -2
  26. package/lattice-grid.esm.min.js +3 -3
  27. package/lattice-grid.min.cjs +3 -3
  28. package/lattice-grid.min.js +3 -3
  29. package/modules/ai.d.ts +1 -1
  30. package/modules/ai.esm.min.js +2 -2
  31. package/modules/ai.min.cjs +2 -2
  32. package/modules/ai.min.js +2 -2
  33. package/modules/alarms.d.ts +1 -1
  34. package/modules/alarms.esm.min.js +2 -2
  35. package/modules/alarms.min.cjs +2 -2
  36. package/modules/alarms.min.js +2 -2
  37. package/modules/angular.d.ts +1 -1
  38. package/modules/angular.esm.min.js +2 -2
  39. package/modules/angular.min.cjs +2 -2
  40. package/modules/angular.min.js +2 -2
  41. package/modules/chart-alluvial.d.ts +1 -1
  42. package/modules/chart-alluvial.esm.min.js +1 -1
  43. package/modules/chart-alluvial.min.cjs +1 -1
  44. package/modules/chart-alluvial.min.js +1 -1
  45. package/modules/chart-arc.d.ts +1 -1
  46. package/modules/chart-arc.esm.min.js +1 -1
  47. package/modules/chart-arc.min.cjs +1 -1
  48. package/modules/chart-arc.min.js +1 -1
  49. package/modules/chart-bubblemap.d.ts +1 -1
  50. package/modules/chart-bubblemap.esm.min.js +1 -1
  51. package/modules/chart-bubblemap.min.cjs +1 -1
  52. package/modules/chart-bubblemap.min.js +1 -1
  53. package/modules/chart-bump.d.ts +1 -1
  54. package/modules/chart-bump.esm.min.js +1 -1
  55. package/modules/chart-bump.min.cjs +1 -1
  56. package/modules/chart-bump.min.js +1 -1
  57. package/modules/chart-calendar.d.ts +1 -1
  58. package/modules/chart-calendar.esm.min.js +2 -2
  59. package/modules/chart-calendar.esm.min.js.map +1 -1
  60. package/modules/chart-calendar.min.cjs +2 -2
  61. package/modules/chart-calendar.min.js +2 -2
  62. package/modules/chart-calendar.min.js.map +1 -1
  63. package/modules/chart-choropleth.d.ts +1 -1
  64. package/modules/chart-choropleth.esm.min.js +2 -2
  65. package/modules/chart-choropleth.esm.min.js.map +1 -1
  66. package/modules/chart-choropleth.min.cjs +2 -2
  67. package/modules/chart-choropleth.min.js +2 -2
  68. package/modules/chart-choropleth.min.js.map +1 -1
  69. package/modules/chart-decomposition.d.ts +1 -1
  70. package/modules/chart-decomposition.esm.min.js +1 -1
  71. package/modules/chart-decomposition.min.cjs +1 -1
  72. package/modules/chart-decomposition.min.js +1 -1
  73. package/modules/chart-diverging.d.ts +1 -1
  74. package/modules/chart-diverging.esm.min.js +1 -1
  75. package/modules/chart-diverging.min.cjs +1 -1
  76. package/modules/chart-diverging.min.js +1 -1
  77. package/modules/chart-dumbbell.d.ts +1 -1
  78. package/modules/chart-dumbbell.esm.min.js +1 -1
  79. package/modules/chart-dumbbell.min.cjs +1 -1
  80. package/modules/chart-dumbbell.min.js +1 -1
  81. package/modules/chart-fan.d.ts +1 -1
  82. package/modules/chart-fan.esm.min.js +1 -1
  83. package/modules/chart-fan.min.cjs +1 -1
  84. package/modules/chart-fan.min.js +1 -1
  85. package/modules/chart-hexbin.d.ts +1 -1
  86. package/modules/chart-hexbin.esm.min.js +2 -2
  87. package/modules/chart-hexbin.esm.min.js.map +1 -1
  88. package/modules/chart-hexbin.min.cjs +2 -2
  89. package/modules/chart-hexbin.min.js +2 -2
  90. package/modules/chart-hexbin.min.js.map +1 -1
  91. package/modules/chart-hexmap.d.ts +1 -1
  92. package/modules/chart-hexmap.esm.min.js +2 -2
  93. package/modules/chart-hexmap.esm.min.js.map +1 -1
  94. package/modules/chart-hexmap.min.cjs +2 -2
  95. package/modules/chart-hexmap.min.js +2 -2
  96. package/modules/chart-hexmap.min.js.map +1 -1
  97. package/modules/chart-icicle.d.ts +1 -1
  98. package/modules/chart-icicle.esm.min.js +1 -1
  99. package/modules/chart-icicle.min.cjs +1 -1
  100. package/modules/chart-icicle.min.js +1 -1
  101. package/modules/chart-markermap.d.ts +1 -1
  102. package/modules/chart-markermap.esm.min.js +1 -1
  103. package/modules/chart-markermap.min.cjs +1 -1
  104. package/modules/chart-markermap.min.js +1 -1
  105. package/modules/chart-parallel.d.ts +1 -1
  106. package/modules/chart-parallel.esm.min.js +1 -1
  107. package/modules/chart-parallel.min.cjs +1 -1
  108. package/modules/chart-parallel.min.js +1 -1
  109. package/modules/chart-ridgeline.d.ts +1 -1
  110. package/modules/chart-ridgeline.esm.min.js +1 -1
  111. package/modules/chart-ridgeline.min.cjs +1 -1
  112. package/modules/chart-ridgeline.min.js +1 -1
  113. package/modules/chart-roc.d.ts +1 -1
  114. package/modules/chart-roc.esm.min.js +1 -1
  115. package/modules/chart-roc.min.cjs +1 -1
  116. package/modules/chart-roc.min.js +1 -1
  117. package/modules/chart-slope.d.ts +1 -1
  118. package/modules/chart-slope.esm.min.js +1 -1
  119. package/modules/chart-slope.min.cjs +1 -1
  120. package/modules/chart-slope.min.js +1 -1
  121. package/modules/chart-splom.d.ts +1 -1
  122. package/modules/chart-splom.esm.min.js +1 -1
  123. package/modules/chart-splom.min.cjs +1 -1
  124. package/modules/chart-splom.min.js +1 -1
  125. package/modules/chart-waffle.d.ts +1 -1
  126. package/modules/chart-waffle.esm.min.js +1 -1
  127. package/modules/chart-waffle.min.cjs +1 -1
  128. package/modules/chart-waffle.min.js +1 -1
  129. package/modules/charts.d.ts +1 -1
  130. package/modules/charts.esm.min.js +185 -178
  131. package/modules/charts.esm.min.js.map +2 -2
  132. package/modules/charts.min.cjs +185 -178
  133. package/modules/charts.min.js +185 -178
  134. package/modules/charts.min.js.map +2 -2
  135. package/modules/data-router.d.ts +1 -1
  136. package/modules/data-router.esm.min.js +2 -2
  137. package/modules/data-router.min.cjs +2 -2
  138. package/modules/data-router.min.js +2 -2
  139. package/modules/deckgl.d.ts +9 -3
  140. package/modules/deckgl.esm.min.js +18 -11
  141. package/modules/deckgl.esm.min.js.map +2 -2
  142. package/modules/deckgl.min.cjs +18 -11
  143. package/modules/deckgl.min.js +18 -11
  144. package/modules/deckgl.min.js.map +2 -2
  145. package/modules/devtools.d.ts +1 -1
  146. package/modules/devtools.esm.min.js +1 -1
  147. package/modules/devtools.min.cjs +1 -1
  148. package/modules/devtools.min.js +1 -1
  149. package/modules/dhtmlx-compat.d.ts +1 -1
  150. package/modules/dhtmlx-compat.esm.min.js +2 -2
  151. package/modules/dhtmlx-compat.min.cjs +2 -2
  152. package/modules/dhtmlx-compat.min.js +2 -2
  153. package/modules/gantt.d.ts +1 -1
  154. package/modules/gantt.esm.min.js +2 -2
  155. package/modules/gantt.min.cjs +2 -2
  156. package/modules/gantt.min.js +2 -2
  157. package/modules/geo-europe-nuts.d.ts +1 -1
  158. package/modules/geo-europe-nuts.esm.min.js +1 -1
  159. package/modules/geo-europe-nuts.min.cjs +1 -1
  160. package/modules/geo-europe-nuts.min.js +1 -1
  161. package/modules/geo-uk.d.ts +1 -1
  162. package/modules/geo-uk.esm.min.js +1 -1
  163. package/modules/geo-uk.min.cjs +1 -1
  164. package/modules/geo-uk.min.js +1 -1
  165. package/modules/geo-us-states.d.ts +1 -1
  166. package/modules/geo-us-states.esm.min.js +1 -1
  167. package/modules/geo-us-states.min.cjs +1 -1
  168. package/modules/geo-us-states.min.js +1 -1
  169. package/modules/geo-world-110m.d.ts +1 -1
  170. package/modules/geo-world-110m.esm.min.js +1 -1
  171. package/modules/geo-world-110m.min.cjs +1 -1
  172. package/modules/geo-world-110m.min.js +1 -1
  173. package/modules/geo-world-50m.d.ts +1 -1
  174. package/modules/geo-world-50m.esm.min.js +1 -1
  175. package/modules/geo-world-50m.min.cjs +1 -1
  176. package/modules/geo-world-50m.min.js +1 -1
  177. package/modules/geometry.d.ts +1 -1
  178. package/modules/geometry.esm.min.js +2 -2
  179. package/modules/geometry.min.cjs +2 -2
  180. package/modules/geometry.min.js +2 -2
  181. package/modules/htmx.d.ts +1 -1
  182. package/modules/htmx.esm.min.js +3 -3
  183. package/modules/htmx.min.cjs +3 -3
  184. package/modules/htmx.min.js +3 -3
  185. package/modules/kanban.d.ts +1 -1
  186. package/modules/kanban.esm.min.js +2 -2
  187. package/modules/kanban.min.cjs +2 -2
  188. package/modules/kanban.min.js +2 -2
  189. package/modules/kpi.d.ts +1 -1
  190. package/modules/kpi.esm.min.js +2 -2
  191. package/modules/kpi.min.cjs +2 -2
  192. package/modules/kpi.min.js +2 -2
  193. package/modules/layout.d.ts +1 -1
  194. package/modules/layout.esm.min.js +2 -2
  195. package/modules/layout.min.cjs +2 -2
  196. package/modules/layout.min.js +2 -2
  197. package/modules/list.d.ts +1 -1
  198. package/modules/list.esm.min.js +2 -2
  199. package/modules/list.min.cjs +2 -2
  200. package/modules/list.min.js +2 -2
  201. package/modules/mock-socket.d.ts +1 -1
  202. package/modules/mock-socket.esm.min.js +1 -1
  203. package/modules/mock-socket.min.cjs +1 -1
  204. package/modules/mock-socket.min.js +1 -1
  205. package/modules/react.d.ts +1 -1
  206. package/modules/react.esm.min.js +2 -2
  207. package/modules/react.min.cjs +2 -2
  208. package/modules/react.min.js +2 -2
  209. package/modules/svelte.d.ts +1 -1
  210. package/modules/svelte.esm.min.js +2 -2
  211. package/modules/svelte.min.cjs +2 -2
  212. package/modules/svelte.min.js +2 -2
  213. package/modules/tabs.d.ts +1 -1
  214. package/modules/tabs.esm.min.js +2 -2
  215. package/modules/tabs.min.cjs +2 -2
  216. package/modules/tabs.min.js +2 -2
  217. package/modules/vue.d.ts +1 -1
  218. package/modules/vue.esm.min.js +2 -2
  219. package/modules/vue.min.cjs +2 -2
  220. package/modules/vue.min.js +2 -2
  221. package/modules/webcomponent.d.ts +1 -1
  222. package/modules/webcomponent.esm.min.js +3 -3
  223. package/modules/webcomponent.min.cjs +3 -3
  224. package/modules/webcomponent.min.js +3 -3
  225. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
1
  /*!
2
- * Lattice Grid 1.74.0, gantt module
2
+ * Lattice Grid 1.75.0, gantt module
3
3
  * Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
4
4
  * https://latticegrid.dev
5
5
  */
6
- (function(te){"use strict";var Vt=Object.create(null),Yt=Object.create(null);function Tt(p,pt){Vt[p]=pt}function Zt(p){var pt=Yt[p];if(pt)return pt;var xt=Object.create(null);Yt[p]=xt;var dt=Vt[p];if(!dt)throw new Error("[lattice] missing module: "+p);return dt(xt,Zt),xt}Tt("packages/core/src/internal/util.js",function(p,pt){"use strict";Object.defineProperty(p,"VERSION",{enumerable:!0,get:function(){return at}}),Object.defineProperty(p,"reportedWarnings",{enumerable:!0,get:function(){return _}}),Object.defineProperty(p,"warnOnce",{enumerable:!0,get:function(){return q}}),Object.defineProperty(p,"infoOnce",{enumerable:!0,get:function(){return et}}),Object.defineProperty(p,"resetWarnings",{enumerable:!0,get:function(){return C}}),Object.defineProperty(p,"fail",{enumerable:!0,get:function(){return F}}),Object.defineProperty(p,"invariant",{enumerable:!0,get:function(){return x}}),Object.defineProperty(p,"DEV",{enumerable:!0,get:function(){return it}}),Object.defineProperty(p,"isObject",{enumerable:!0,get:function(){return z}}),Object.defineProperty(p,"isFunction",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"isNil",{enumerable:!0,get:function(){return L}}),Object.defineProperty(p,"isBlank",{enumerable:!0,get:function(){return X}}),Object.defineProperty(p,"isCtor",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(p,"pathGetter",{enumerable:!0,get:function(){return y}}),Object.defineProperty(p,"pathSetter",{enumerable:!0,get:function(){return P}}),Object.defineProperty(p,"getPath",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(p,"setPath",{enumerable:!0,get:function(){return R}}),Object.defineProperty(p,"humanise",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(p,"escapeHtml",{enumerable:!0,get:function(){return H}}),Object.defineProperty(p,"titleCase",{enumerable:!0,get:function(){return d}}),Object.defineProperty(p,"expand",{enumerable:!0,get:function(){return I}}),Object.defineProperty(p,"toArray",{enumerable:!0,get:function(){return k}}),Object.defineProperty(p,"merge",{enumerable:!0,get:function(){return o}}),Object.defineProperty(p,"mergeRow",{enumerable:!0,get:function(){return B}}),Object.defineProperty(p,"Lru",{enumerable:!0,get:function(){return W}}),Object.defineProperty(p,"collator",{enumerable:!0,get:function(){return E}}),Object.defineProperty(p,"defaultCompare",{enumerable:!0,get:function(){return S}}),Object.defineProperty(p,"now",{enumerable:!0,get:function(){return m}}),Object.defineProperty(p,"nextFrame",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(p,"cancelFrame",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(p,"frameBatched",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(p,"settleDebounce",{enumerable:!0,get:function(){return r}}),Object.defineProperty(p,"whenIdle",{enumerable:!0,get:function(){return u}}),Object.defineProperty(p,"uid",{enumerable:!0,get:function(){return w}});const xt="1.74.0";async function dt(){return xt}const at="1.74.0",Y=new Set,tt=2e3;function j(i){if(Y.add(i),Y.size>tt){const l=Y.values().next().value;l!==void 0&&Y.delete(l)}}const J=[],c=500;function $(i,l,n){J.push({key:i,level:l,message:n.map(t=>typeof t=="string"?t:b(t)).join(" "),at:Date.now()}),J.length>c&&J.shift()}function b(i){if(i instanceof Error)return i.message;try{return JSON.stringify(i)}catch{return String(i)}}function _(){return J.map(i=>({...i}))}function q(i,...l){Y.has(i)||(j(i),$(i,"warn",l),console.warn("[lattice]",...l))}function et(i,...l){Y.has(i)||(j(i),$(i,"info",l),console.info("[lattice]",...l))}function C(){Y.clear(),J.length=0}function F(i,l){const n=new Error(`[lattice] ${i}`);throw l!==void 0&&(n.cause=l),n}function x(i,l){i||F(l)}const it=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function z(i){return i!==null&&typeof i=="object"&&!Array.isArray(i)}function K(i){return typeof i=="function"}function L(i){return i==null}function X(i){return i==null||i===""}function Q(i){return typeof i!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(i))?!0:!!(i.prototype&&Object.getOwnPropertyNames(i.prototype).length>1)}const st=new Map;function y(i){let l=st.get(i);if(l)return l;if(!i.includes("."))l=n=>n?.[i];else{const n=i.split("."),t=n.length;l=e=>{let s=e;for(let a=0;a<t;a++){if(s==null)return;s=s[n[a]]}return s}}return st.set(i,l),l}const h=new Map;function P(i){let l=h.get(i);if(l)return l;if(!i.includes("."))l=(n,t)=>{n!=null&&(n[i]=t)};else{const n=i.split("."),t=n.length-1;l=(e,s)=>{let a=e;for(let v=0;v<t;v++){if(a==null)return;const f=n[v];a[f]==null&&(a[f]={}),a=a[f]}a!=null&&(a[n[t]]=s)}}return h.set(i,l),l}function Z(i,l){return y(l)(i)}function R(i,l,n){P(l)(i,n)}function rt(i){return i?(i.includes(".")?i.slice(i.lastIndexOf(".")+1):i).replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,n=>n.toUpperCase()):""}const M={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function H(i){const l=i==null?"":String(i);return/[&<>"']/.test(l)?l.replace(/[&<>"']/g,n=>M[n]):l}function d(i){return String(i).replace(/\w\S*/g,l=>l[0].toUpperCase()+l.slice(1).toLowerCase())}function I(i,l,n){if(i!==void 0)return i===!0?{enabled:!0,...n}:i===!1?{enabled:!1}:z(i)?i:{[l]:i,enabled:!0}}function k(i){return i==null?[]:Array.isArray(i)?i:[i]}const U=Object.freeze(new Set(["__proto__","constructor","prototype"]));function o(i,l){if(!z(i))return z(l)?{...l}:l;if(!z(l))return l===void 0?i:l;const n={...i};for(const t of Object.keys(l)){if(U.has(t))continue;const e=l[t];e!==void 0&&(n[t]=z(e)&&z(n[t])?o(n[t],e):e)}return n}function B(i,l){if(!z(i)||!z(l)||i===l)return l;const n=Object.create(Object.getPrototypeOf(i));return Object.assign(n,i,l),n}class W{#n;#r=new Map;#t;constructor(l=256,n=null){this.#n=l,this.#t=n}get size(){return this.#r.size}get max(){return this.#n}set max(l){this.#n=l,this.#e()}has(l){return this.#r.has(l)}get(l){const n=this.#r;if(!n.has(l))return;const t=n.get(l);return n.delete(l),n.set(l,t),t}peek(l){return this.#r.get(l)}set(l,n){const t=this.#r;return t.has(l)&&t.delete(l),t.set(l,n),this.#e(),n}delete(l){const n=this.#r.get(l);return this.#r.delete(l)&&this.#t&&this.#t(n,l),n}clear(){if(this.#t)for(const[l,n]of this.#r)this.#t(n,l);this.#r.clear()}keys(){return this.#r.keys()}values(){return this.#r.values()}#e(){const l=this.#r;for(;l.size>this.#n;){const n=l.keys().next().value,t=l.get(n);l.delete(n),this.#t&&this.#t(t,n)}}}const V=new Map;function E(i,l){const n=`${i||""}|${l?JSON.stringify(l):""}`;let t=V.get(n);return t||(t=new Intl.Collator(i||void 0,{numeric:!0,sensitivity:"variant",...l}),V.set(n,t)),t}function S(i,l){if(i===l)return 0;if(i==null)return 1;if(l==null)return-1;if(typeof i=="number"&&typeof l=="number")return Number.isNaN(i)?Number.isNaN(l)?0:1:Number.isNaN(l)||i<l?-1:i>l?1:0;const n=String(i),t=String(l);return n<t?-1:n>t?1:0}function m(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const N=typeof requestAnimationFrame=="function";function lt(i){return N?requestAnimationFrame(i):setTimeout(()=>i(m()),16)}function wt(i){i!=null&&(N?cancelAnimationFrame(i):clearTimeout(i))}function ot(i){let l=null,n=null;const t=()=>{l=null;const s=n;n=null,i(...s||[])},e=(...s)=>{n=s,l===null&&(l=lt(t))};return e.cancel=()=>{wt(l),l=null,n=null},e.flush=()=>{l!==null&&(wt(l),t())},e}function r(i,l){let n=null,t=null;const e=()=>{if(n=null,t===null)return;const v=t;t=null,i(...v),s()},s=()=>{n=setTimeout(e,l),typeof n?.unref=="function"&&n.unref()},a=(...v)=>{n===null?(i(...v),s()):(t=v,clearTimeout(n),s())};return a.flush=()=>{if(n!==null&&clearTimeout(n),n=null,t===null)return;const v=t;t=null,i(...v)},a.cancel=()=>{n!==null&&clearTimeout(n),n=null,t=null},a.pending=()=>n!==null||t!==null,a}function u(i,l=50){return typeof requestIdleCallback=="function"?requestIdleCallback(i,{timeout:l}):setTimeout(()=>i({timeRemaining:()=>0,didTimeout:!0}),1)}let g=0;function w(i="l"){return`${i}${(++g).toString(36)}`}}),Tt("packages/modules/shared/emitter.js",function(p,pt){"use strict";Object.defineProperty(p,"WILDCARD",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"Emitter",{enumerable:!0,get:function(){return J}}),Object.defineProperty(p,"gate",{enumerable:!0,get:function(){return c}});const xt=pt("packages/core/src/internal/util.js"),dt=xt.isFunction,at=xt.warnOnce,Y="*",tt=new Set(["api","user","init","ai"]);function j($,b){return $&&$.name?$.name:`#${b}`}class J{#n=new Map;#r;constructor(b="module"){this.#r=String(b)}on(b,_){if(!dt(_))return()=>{};let q=this.#n.get(b);return q||(q=new Set,this.#n.set(b,q)),q.add(_),()=>this.off(b,_)}off(b,_){const q=this.#n.get(b);q&&q.delete(_)}count(b){const _=this.#n.get(b);return _?_.size:0}emit(b,_){const q=this.#n.get(b),et=this.#n.get(Y);if((!q||q.size===0)&&(!et||et.size===0))return;const C={..._||null,type:b};q&&q.size&&this.#t([...q],C,b),et&&et.size&&this.#t([...et],C,Y)}#t(b,_,q){for(let et=0;et<b.length;et++)try{b[et](_)}catch(C){at(`${this.#r}.emit.throw:${q}:${j(b[et],et)}`,`${this.#r}: a '${q}' handler threw; other handlers were unaffected.`,C)}}emitBefore(b,_,q){const et=q??(_&&_.origin),C=tt.has(et)?et:"user";let F=!1,x=null;const it=st=>{F=!0,st!=null&&x===null&&(x=String(st))},z={..._||null,type:b,origin:C,get defaultPrevented(){return F},get reason(){return x},preventDefault(st){it(st)}},K=this.#n.get(b);if(!K||K.size===0)return!0;const L=[...K],X=()=>(F&&x===null&&(x="prevented"),F&&_&&typeof _=="object"&&(_.reason=x),!F),Q=[];for(let st=0;st<L.length;st++){const y=L[st];try{const h=y(z);h&&dt(h.then)?Q.push(h):h===!1&&it("prevented")}catch(h){it("error"),at(`${this.#r}.beforeThrow:${b}:${j(y,st)}`,`${this.#r}: a '${b}' before-handler threw; the action was cancelled.`,h)}}return Q.length===0?X():Promise.allSettled(Q).then(st=>{for(const y of st)y.status==="rejected"?(it("error"),at(`${this.#r}.beforeReject:${b}`,`${this.#r}: a '${b}' before-handler rejected; the action was cancelled.`,y.reason)):y.value===!1&&it("prevented");return X()})}clear(){this.#n.clear()}}function c($,b,_,q,et){const C=$.emitBefore(b,q,q.origin),F=()=>($.emit(_,{...q,reason:q.reason||"prevented"}),!1);return C===!1?F():C&&dt(C.then)?C.then(x=>x?et():F()):et()}}),Tt("packages/modules/gantt/time.js",function(p,pt){"use strict";Object.defineProperty(p,"toDayNumber",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"fromDayNumber",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(p,"toISODate",{enumerable:!0,get:function(){return j}}),Object.defineProperty(p,"resolveProjectEpoch",{enumerable:!0,get:function(){return J}});const dt=pt("packages/core/src/internal/util.js").warnOnce,at=864e5;function Y(c){if(c==null||c==="")return null;if(typeof c=="number")return Number.isFinite(c)?c:null;if(c instanceof Date)return Number.isFinite(c.getTime())?Math.floor(Date.UTC(c.getFullYear(),c.getMonth(),c.getDate())/at):null;const $=Date.parse(c);return Number.isFinite($)?Math.floor($/at):null}function tt(c){return Number.isFinite(c)?new Date(Math.round(c)*at):null}function j(c){const $=tt(c);return $?$.toISOString().slice(0,10):null}function J(c){if(c==null||c==="")return 0;const $=Y(c);return Number.isFinite($)?$:(dt(`gantt.projectEpoch:${String(c)}`,`[lattice] gantt: projectEpoch ${JSON.stringify(c)} is not a date or a day number; the plan is rendered against the Unix epoch (day 0 = 1970-01-01).`),0)}}),Tt("packages/modules/gantt/calendar.js",function(p,pt){"use strict";Object.defineProperty(p,"createCalendar",{enumerable:!0,get:function(){return tt}});const xt=pt("packages/modules/gantt/time.js"),dt=xt.fromDayNumber,at=xt.toDayNumber,Y=Object.freeze([1,2,3,4,5]);function tt(j,J=0){if(j==null)return null;let c,$;j==="weekends"?(c=Y,$=new Set):(c=Array.isArray(j.workdays)&&j.workdays.length?j.workdays.map(Number).filter(K=>K>=0&&K<=6):Y,$=new Set((Array.isArray(j.holidays)?j.holidays:[]).map(K=>at(K)).filter(K=>K!=null)));const b=new Set(c);if(b.size===7&&$.size===0||b.size===0)return null;const _=K=>{const L=dt(K);return L?b.has(L.getUTCDay())&&!$.has(K):!1},q=K=>{let L=K;for(;!_(L);)L+=1;return L},et=K=>{let L=K;for(;!_(L);)L-=1;return L},C=q(Math.round(Number.isFinite(J)?J:0)),F=new Map([[0,C]]),x=new Map([[C,0]]);return{isWorking:_,nextWorking:q,dayOf:K=>{const L=Math.round(K);if(F.has(L))return F.get(L);if(L>0){let st=L-1;for(;!F.has(st);)st-=1;let y=F.get(st);for(let h=st+1;h<=L;h+=1)y=q(y+1),F.set(h,y),x.set(y,h);return F.get(L)}let X=L+1;for(;!F.has(X);)X+=1;let Q=F.get(X);for(let st=X-1;st>=L;st-=1)Q=et(Q-1),F.set(st,Q),x.set(Q,st);return F.get(L)},indexOf:K=>{const L=q(Math.round(K));if(x.has(L))return x.get(L);if(L>C){let st=0,y=C;for(;x.has(q(y+1))&&y<L;)y=q(y+1),st=x.get(y);for(;y<L;)y=q(y+1),st+=1,F.set(st,y),x.set(y,st);return st}let X=0,Q=C;for(;Q>L;)Q=et(Q-1),X-=1,F.set(X,Q),x.set(Q,X);return X},anchor:C}}}),Tt("packages/modules/gantt/schedule.js",function(p,pt){"use strict";Object.defineProperty(p,"LINK_TYPES",{enumerable:!0,get:function(){return J}}),Object.defineProperty(p,"CONSTRAINT_TYPES",{enumerable:!0,get:function(){return c}}),Object.defineProperty(p,"EPS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(p,"SCHEDULE_ERROR",{enumerable:!0,get:function(){return _}}),Object.defineProperty(p,"TASK_FIELDS",{enumerable:!0,get:function(){return C}}),Object.defineProperty(p,"taskIdReader",{enumerable:!0,get:function(){return x}}),Object.defineProperty(p,"taskFieldWriters",{enumerable:!0,get:function(){return it}}),Object.defineProperty(p,"normalizeTasks",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"buildTree",{enumerable:!0,get:function(){return L}}),Object.defineProperty(p,"normalizeLinkSpec",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(p,"normalizeDependencies",{enumerable:!0,get:function(){return st}}),Object.defineProperty(p,"expandDependencies",{enumerable:!0,get:function(){return y}}),Object.defineProperty(p,"topoOrder",{enumerable:!0,get:function(){return h}}),Object.defineProperty(p,"computeSchedule",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(p,"findViolations",{enumerable:!0,get:function(){return I}});const dt=pt("packages/core/src/internal/util.js").warnOnce,Y=pt("packages/modules/gantt/calendar.js").createCalendar,j=pt("packages/modules/gantt/time.js").toDayNumber,J=["FS","SS","FF","SF"],c=["MSO","MFO","ALAP"],$=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"}),b=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:j(k)}const C=Object.freeze(["id","name","start","end","duration","milestone","percentComplete","parent","baselineStart","baselineEnd","constraint","constraintDate"]);function F(k){const U=k&&typeof k=="object"?k:{},o={};for(const B of C){const W=U[B];if(typeof W=="function")o[B]=W;else if(typeof W=="string"&&W!==""){const V=W;o[B]=E=>E[V]}else o[B]=V=>V[B]}return o}function x(k){return F(k).id}function it(k){const U=k&&typeof k=="object"?k:{},o={};for(const B of C){const W=U[B];typeof W=="string"&&W!==""?o[B]=W:typeof W=="function"?o[B]=null:o[B]=B}return o}function z(k,U){const o=U.constraint(k),B=o??(k&&k.constraintType);if(B==null||B==="")return null;const W=$[String(B).toLowerCase().replace(/\s+/g,"-")]??(c.includes(String(B).toUpperCase())?String(B).toUpperCase():null);if(!W)return null;const V=et(U.constraintDate(k)??k.constraintAt??k.at);return{type:W,at:V}}function K(k,U){const o=new Map,B=[],W=F(U);if(!Array.isArray(k))return{ok:!1,error:{code:_.BAD_DURATION,message:"tasks must be an array"},order:B,byId:o};for(const V of k){const E=V?W.id(V):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 m=et(W.start(V)),N=et(W.end(V)),lt=W.milestone(V)===!0;let wt=lt?0:q(W.duration(V));if(wt==null&&m!=null&&N!=null&&(wt=N-m),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 ot=W.name(V),r=W.parent(V);o.set(S,{id:S,name:ot!=null?String(ot):S,duration:wt,milestoneFlag:lt,earliestStart:m,placedStart:m,placedEnd:N,percentComplete:q(W.percentComplete(V)),parent:r!=null?String(r):null,constraint:z(V,W),baselineStart:et(W.baselineStart(V)??(V.baseline&&V.baseline.start)),baselineEnd:et(W.baselineEnd(V)??(V.baseline&&V.baseline.end))}),B.push(S)}return{ok:!0,order:B,byId:o}}function L(k,U){const o=new Map(k.map(S=>[S,[]]));for(const S of k){const m=U.get(S).parent;if(m!=null){if(!U.has(m))return{ok:!1,error:{code:_.UNKNOWN_PARENT,message:`task "${S}" names unknown parent "${m}"`,id:S}};o.get(m).push(S)}}for(const S of k){const m=new Set;let N=U.get(S).parent;for(;N!=null;){if(N===S||m.has(N))return{ok:!1,error:{code:_.PARENT_CYCLE,message:`parent cycle at "${S}"`,id:S}};m.add(N),N=U.get(N)?.parent??null}}const B=S=>o.get(S).length>0,W=new Map,V=S=>{if(W.has(S))return W.get(S);const m=o.get(S),N=m.length===0?[S]:m.flatMap(lt=>V(lt));return W.set(S,N),N};return{ok:!0,children:o,isSummary:B,descendantLeaves:V,ancestors:S=>{const m=new Set;let N=U.get(S).parent;for(;N!=null;)m.add(N),N=U.get(N).parent;return m}}}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 st(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 V of k){const E=Q(V),S=E&&E.from!=null?String(E.from):null,m=E&&E.to!=null?String(E.to):null,N=E&&E.type!=null?String(E.type).toUpperCase():"FS",lt=q(E.lag)??0;if(S==null||m==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(m))return{ok:!1,error:{code:_.UNKNOWN_TASK,message:`dependency references unknown task "${m}"`,id:m},edges:B};if(S===m)return{ok:!1,error:{code:_.SELF_DEPENDENCY,message:`task "${S}" depends on itself`,id:S},edges:B};if(!J.includes(N))return{ok:!1,error:{code:_.BAD_LINK_TYPE,message:`unknown link type "${N}" (expected one of ${J.join("/")})`},edges:B};if(W&&(W(S).has(m)||W(m).has(S)))return{ok:!1,error:{code:_.DEP_ACROSS_HIERARCHY,message:`dependency between "${S}" and "${m}" crosses their own parent/child hierarchy`,from:S,to:m},edges:B};B.push({from:S,to:m,type:N,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 m=[E,S,W.type,W.lag].join("");o.has(m)||(o.add(m),B.push({from:E,to:S,type:W.type,lag:W.lag}))}}return B}function h(k,U){const o=new Map(k.map(E=>[E,0])),B=new Map(k.map(E=>[E,[]]));for(const E of U)P(o,E.to),B.get(E.from).push(E.to);const W=k.filter(E=>o.get(E)===0),V=[];for(;W.length;){const E=W.shift();V.push(E);for(const S of B.get(E)){const m=o.get(S)-1;o.set(S,m),m===0&&W.push(S)}}return V.length===k.length?{ok:!0,sorted:V}:{ok:!1,cycle:Z(k,B,new Set(V))}}function P(k,U){k.set(U,k.get(U)+1)}function Z(k,U,o){const B=k.find(S=>!o.has(S)),W=[],V=new Map;let E=B;for(;E!=null&&!V.has(E);)V.set(E,W.length),W.push(E),E=U.get(E).find(S=>!o.has(S));return E==null?W:W.slice(V.get(E)).concat(E)}function R(k,U,o,B,W,V=new Map){const E=h(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,m=new Map(k.map(w=>[w,[]])),N=new Map(k.map(w=>[w,[]]));for(const w of o)m.get(w.to).push(w),N.get(w.from).push(w);const lt=new Map;for(const w of k){const i=U.get(w);lt.set(w,{id:w,name:i.name,duration:i.duration,es:0,ef:0,ls:0,lf:0,totalFloat:0,critical:!1,percentComplete:i.percentComplete,parent:i.parent,isSummary:!1,isMilestone:i.duration===0,children:[]})}const wt=[];for(const w of S){const i=U.get(w),l=lt.get(w);let n=Math.max(B,i.earliestStart??B);for(const e of m.get(w)){const s=lt.get(e.from);let a;switch(e.type){case"FS":a=s.ef+e.lag;break;case"SS":a=s.es+e.lag;break;case"FF":a=s.ef+e.lag-l.duration;break;case"SF":a=s.es+e.lag-l.duration;break;default:a=-1/0}a>n&&(n=a)}const t=V.get(w);if(t&&t.type!=="ALAP"&&t.at!=null){const e=t.type==="MFO"?t.at-l.duration:t.at;e<n-b?wt.push({id:w,type:t.type,at:t.at,earliestFeasible:n}):n=e,l.pinned=!0}l.es=n,l.ef=n+l.duration}const ot=k.length?Math.max(...k.map(w=>lt.get(w).ef)):B,r=Number.isFinite(W)?W:ot;for(let w=S.length-1;w>=0;w-=1){const i=S[w],l=lt.get(i);let n=r;for(const t of N.get(i)){const e=lt.get(t.to);let s;switch(t.type){case"FS":s=e.ls-t.lag;break;case"SS":s=e.ls-t.lag+l.duration;break;case"FF":s=e.lf-t.lag;break;case"SF":s=e.lf-t.lag+l.duration;break;default:s=1/0}s<n&&(n=s)}l.pinned&&(n=l.ef),l.lf=n,l.ls=n-l.duration,l.totalFloat=l.ls-l.es,l.critical=l.totalFloat<=b}for(const w of k){const i=V.get(w);if(!i||i.type!=="ALAP")continue;const l=lt.get(w);l.es=l.ls,l.ef=l.lf,l.totalFloat=0,l.critical=!0}const u=k.filter(w=>lt.get(w).critical),g=d(k,o,lt);return{ok:!0,tasks:lt,critical:u,criticalPaths:g,projectFinish:ot,conflicts:wt}}function rt(k,U=[],o={}){const B=et(o.projectStart)??0,W=et(o.deadline),V=Y(o.calendar,B),E=a=>a==null?null:V?V.indexOf(a):a,S=a=>V?V.dayOf(a):a,m=K(k,o.fields);if(!m.ok)return{ok:!1,error:m.error};const{order:N,byId:lt}=m,wt=L(N,lt);if(!wt.ok)return{ok:!1,error:wt.error};const ot=st(U,lt,wt);if(!ot.ok)return{ok:!1,error:ot.error};for(const a of N)if(!wt.isSummary(a)&&lt.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=N.filter(a=>!wt.isSummary(a)),u=new Map(r.map(a=>{const v=lt.get(a);return[a,{...v,earliestStart:E(v.earliestStart)}]})),g=new Map;for(const a of r){const v=lt.get(a).constraint;v&&g.set(a,{type:v.type,at:E(v.at)})}const w=V?V.indexOf(B):B,i=W==null?void 0:E(W),l=y(ot.edges,wt),n=R(r,u,l,w,i,g);if(!n.ok)return{ok:!1,error:n.error};const t=n.tasks;for(const a of r){const v=t.get(a);v.es=S(v.es),v.ef=S(v.ef),v.ls=S(v.ls),v.lf=S(v.lf),M(v,lt.get(a).baselineStart,lt.get(a).baselineEnd)}for(let a=N.length-1;a>=0;a-=1){const v=N[a];wt.isSummary(v)&&t.set(v,H(v,lt.get(v),wt,t))}for(const a of N)wt.isSummary(a)&&(t.get(a).children=wt.children.get(a).slice());const e=V?V.anchor:B,s=S(n.projectFinish);return{ok:!0,tasks:t,order:N,critical:n.critical,criticalPaths:n.criticalPaths,projectStart:e,projectFinish:s,projectDuration:s-e,conflicts:n.conflicts||[],calendar:!!V}}function M(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(g=>B.get(g)),V=Math.min(...W.map(g=>g.es)),E=Math.max(...W.map(g=>g.ef)),S=Math.min(...W.map(g=>g.ls)),m=Math.max(...W.map(g=>g.lf)),N=o.descendantLeaves(k).map(g=>B.get(g)),lt=N.reduce((g,w)=>g+w.duration,0),wt=lt>b?N.reduce((g,w)=>g+w.duration*(w.percentComplete??0),0)/lt:null,ot={id:k,name:U.name,duration:E-V,es:V,ef:E,ls:S,lf:m,totalFloat:S-V,critical:W.some(g=>g.critical),percentComplete:wt,parent:U.parent,isSummary:!0,isMilestone:!1,children:[]},r=N.map(g=>g.baselineStart).filter(g=>g!=null),u=N.map(g=>g.baselineEnd).filter(g=>g!=null);return(r.length||u.length)&&M(ot,r.length?Math.min(...r):null,u.length?Math.max(...u):null),ot}function d(k,U,o){const B=new Map(k.map(m=>[m,[]])),W=new Set;for(const m of U){const N=o.get(m.from),lt=o.get(m.to);if(!N.critical||!lt.critical)continue;let wt;switch(m.type){case"FS":wt=N.ef+m.lag;break;case"SS":wt=N.es+m.lag;break;case"FF":wt=N.ef+m.lag-lt.duration;break;case"SF":wt=N.es+m.lag-lt.duration;break;default:wt=-1/0}Math.abs(wt-lt.es)<=b&&(B.get(m.from).push(m.to),W.add(m.to))}const V=k.filter(m=>o.get(m).critical&&!W.has(m)),E=[],S=(m,N)=>{const lt=B.get(m);if(!lt.length){E.push(N);return}for(const wt of lt)S(wt,N.concat(wt))};for(const m of V)S(m,[m]);return E}function I(k,U,o){if(!U||!U.ok)return[];const B=[],W=F(o);for(const V of k){const E=V?W.id(V):null,S=E!=null?String(E):null;if(S==null||!U.tasks.has(S))continue;const m=U.tasks.get(S);if(m.isSummary)continue;const N=q(W.start(V));N!=null&&N<m.es-b&&B.push({id:S,placedStart:N,earliestStart:m.es,by:m.es-N})}return B}}),Tt("packages/modules/gantt/resources.js",function(p,pt){"use strict";Object.defineProperty(p,"parseAssignments",{enumerable:!0,get:function(){return b}}),Object.defineProperty(p,"normalizeCapacities",{enumerable:!0,get:function(){return _}}),Object.defineProperty(p,"sweepLoad",{enumerable:!0,get:function(){return q}}),Object.defineProperty(p,"computeResourceLoad",{enumerable:!0,get:function(){return et}}),Object.defineProperty(p,"levelResources",{enumerable:!0,get:function(){return x}});const dt=pt("packages/core/src/internal/util.js").warnOnce,at=pt("packages/modules/gantt/schedule.js"),Y=at.computeSchedule,tt=at.EPS,j=at.taskIdReader,c=pt("packages/modules/gantt/calendar.js").createCalendar;function $(z){if(z==null||z==="")return null;const K=typeof z=="number"?z:Number(z);return Number.isFinite(K)?K:null}function b(z){if(z&&Array.isArray(z.assignments))return z.assignments.map(X=>{const Q=X&&(X.resource??X.name??X.id);if(Q==null||Q==="")return null;const st=$(X.units)??$(X.allocation)??1;return{resource:String(Q),units:st}}).filter(Boolean);const K=z?z.assignee??z.assignees??z.owner:null;return(Array.isArray(K)?K:K==null||K===""?[]:[K]).map(X=>String(X)).filter(X=>X!=="").map(X=>({resource:X,units:1}))}function _(z,K){const L=new Map;if(Array.isArray(z))for(const X of z){const Q=X&&(X.id??X.name??X.resource);if(Q==null||Q==="")continue;const st=$(X.capacity??X.maxUnits??X.max??X.units);L.set(String(Q),st??K)}else if(z&&typeof z=="object")for(const[X,Q]of Object.entries(z)){const st=$(Q);L.set(String(X),st??K)}return L}function q(z){if(!z.length)return[];const K=new Set;for(const Q of z)K.add(Q.s),K.add(Q.e);const L=[...K].sort((Q,st)=>Q-st),X=[];for(let Q=0;Q<L.length-1;Q+=1){const st=L[Q],y=L[Q+1];if(y<=st)continue;let h=0;const P=[];for(const Z of z)Z.s<=st&&Z.e>=y&&(h+=Z.units,P.push(Z.taskId));P.length&&X.push({s:st,e:y,load:h,taskIds:P})}return X}function et(z,K,L={}){const X={ok:!1,resources:[],overAllocations:[],byResource:new Map};if(!K||!K.ok)return X;const Q=$(L.defaultCapacity)??1,st=_(L.resources,Q),y=L.calendar!=null?c(L.calendar,K.projectStart):null,h=I=>st.has(I)?st.get(I):Q,P=I=>y?y.indexOf(I):I,Z=I=>y?y.dayOf(I):I,R=j(L.fields),rt=new Map;for(const I of K.order){const k=K.tasks.get(I);if(!k||k.isSummary)continue;const U=z.find(V=>V&&R(V)!=null&&String(R(V))===I);if(!U)continue;const o=b(U);if(!o.length)continue;const B=P(k.es),W=P(k.ef);if(!(W<=B))for(const V of o)rt.has(V.resource)||rt.set(V.resource,[]),rt.get(V.resource).push({s:B,e:W,units:V.units,taskId:I})}const M=new Map,H=[],d=[];for(const[I,k]of rt){const U=h(I),o=q(k);let B=0;const W=o.map(E=>{E.load>B&&(B=E.load);const S={start:Z(E.s),end:Z(E.e),load:E.load,taskIds:E.taskIds};return E.load>U+tt&&d.push({resource:I,capacity:U,start:S.start,end:S.end,load:E.load,taskIds:E.taskIds.slice()}),S}),V={resource:I,capacity:U,peak:B,segments:W};M.set(I,V),H.push(V)}return H.sort((I,k)=>I.resource<k.resource?-1:I.resource>k.resource?1:0),d.sort((I,k)=>I.start-k.start||(I.resource<k.resource?-1:1)),{ok:!0,resources:H,overAllocations:d,byResource:M}}function C(z){if(!z)return!1;const K=z.constraint??z.constraintType;if(K==null||K==="")return!1;const L=String(K).toLowerCase().replace(/\s+/g,"-");return L==="mso"||L==="must-start-on"||L==="muststarton"||L==="start-on"||L==="mfo"||L==="must-finish-on"||L==="mustfinishon"||L==="finish-on"}function F(z,K){return z?$(z[K])??0:0}function x(z,K,L={}){const X={projectStart:L.projectStart,deadline:L.deadline,calendar:L.calendar,fields:L.fields},Q=L.priorityField||"priority",st=L.maxIterations!=null?L.maxIterations:Math.max(100,z.length*z.length*2),y=j(L.fields),h=z.map(d=>({...d})),P=h.map(d=>String(y(d))),Z=d=>P.indexOf(d);let R=Y(h,K,X);if(!R.ok)return{ok:!1,error:R.error};const rt=new Map;for(const d of R.order){const I=R.tasks.get(d);I&&!I.isSummary&&rt.set(d,I.es)}let M=0;for(;M<st;M+=1){const d=et(h,R,L);if(!d.overAllocations.length)return{ok:!0,resolved:!0,tasks:h,schedule:R,moves:it(rt,R),iterations:M};const I=d.overAllocations.slice().sort((E,S)=>E.start-S.start||S.load-E.load)[0],k=new Map(h.map(E=>[String(y(E)),E])),U=I.taskIds.map(E=>R.tasks.get(E)).filter(Boolean),o=U.filter(E=>!C(k.get(E.id)));if(!o.length)return{ok:!0,resolved:!1,tasks:h,schedule:R,moves:it(rt,R),remaining:d.overAllocations,iterations:M};o.sort((E,S)=>{if(S.totalFloat!==E.totalFloat)return S.totalFloat-E.totalFloat;const m=F(k.get(E.id),Q),N=F(k.get(S.id),Q);return m!==N?m-N:S.es!==E.es?S.es-E.es:Z(S.id)-Z(E.id)});const B=o[0],W=U.filter(E=>E.id!==B.id).map(E=>E.ef).filter(E=>E>B.es+tt),V=W.length?Math.min(...W):B.es+1;if(k.get(B.id).start=V,R=Y(h,K,X),!R.ok)return{ok:!1,error:R.error}}const H=et(h,R,L);return H.overAllocations.length&&dt("gantt-level-unresolved",`[lattice] gantt: resource leveling hit its ${st}-iteration cap with ${H.overAllocations.length} over-allocation(s) unresolved; returning the partial result.`),{ok:!0,resolved:H.overAllocations.length===0,tasks:h,schedule:R,moves:it(rt,R),remaining:H.overAllocations,iterations:M}}function it(z,K){const L=[];for(const X of K.order){const Q=K.tasks.get(X);if(!Q||Q.isSummary)continue;const st=z.get(X);st!=null&&Q.es>st+tt&&L.push({id:X,from:st,to:Q.es,delay:Q.es-st})}return L}}),Tt("packages/modules/gantt/earned-value.js",function(p,pt){"use strict";Object.defineProperty(p,"computeEarnedValue",{enumerable:!0,get:function(){return c}});const dt=pt("packages/modules/gantt/time.js").toDayNumber,at=1e-9;function Y($){if($==null||$==="")return null;const b=typeof $=="number"?$:Number($);return Number.isFinite(b)?b:null}function tt($,b,_){return _-b<=at?$>=_?1:0:$<=b?0:$>=_?1:($-b)/(_-b)}function j($,b,_,q,et){const C=b?Y(b[q]):null,F=C??$.duration,x=b?Y(b[et]):null,it=$.percentComplete==null?0:Math.max(0,Math.min(100,$.percentComplete))/100,z=$.baselineStart!=null||$.baselineEnd!=null,K=$.baselineStart!=null?$.baselineStart:$.es,L=$.baselineEnd!=null?$.baselineEnd:$.ef,X=F*tt(_,K,L),Q=F*it;return{bac:F,pv:X,ev:Q,ac:x,hasBaseline:z}}function J($){const b=$.ac;return{bac:$.bac,pv:$.pv,ev:$.ev,ac:b,sv:$.ev-$.pv,cv:b==null?null:$.ev-b,spi:Math.abs($.pv)<at?null:$.ev/$.pv,cpi:b==null||Math.abs(b)<at?null:$.ev/b}}function c($,b,_={}){if(!b||!b.ok||!b.tasks||!b.order)return{ok:!1,error:{code:"NO_SCHEDULE",message:"earned value needs a successful schedule"}};const q=_.costField||"cost",et=_.actualCostField||"actualCost",C=_.statusDate==null?b.projectFinish:dt(_.statusDate)??b.projectFinish,F=new Map;for(const Q of Array.isArray($)?$:[])Q&&Q.id!=null&&F.set(String(Q.id),Q);const x=()=>({bac:0,pv:0,ev:0,ac:0,acAny:!1,hasBaseline:!1}),it=new Map;for(const Q of b.order)it.set(Q,x());const z=x();for(const Q of b.order){const st=b.tasks.get(Q);if(!st||st.isSummary)continue;const y=j(st,F.get(Q),C,q,et);let h=Q;for(;h!=null&&it.has(h);){const P=it.get(h);P.bac+=y.bac,P.pv+=y.pv,P.ev+=y.ev,y.ac!=null&&(P.ac+=y.ac,P.acAny=!0),y.hasBaseline&&(P.hasBaseline=!0),h=b.tasks.get(h).parent}z.bac+=y.bac,z.pv+=y.pv,z.ev+=y.ev,y.ac!=null&&(z.ac+=y.ac,z.acAny=!0),y.hasBaseline&&(z.hasBaseline=!0)}const K=Q=>J({bac:Q.bac,pv:Q.pv,ev:Q.ev,ac:Q.acAny?Q.ac:null}),L=new Map,X=[];for(const Q of b.order){const st=b.tasks.get(Q),y=it.get(Q),h={id:st.id,name:st.name,isSummary:!!st.isSummary,isMilestone:!!st.isMilestone,percentComplete:st.percentComplete??null,hasBaseline:y.hasBaseline,hasActualCost:y.acAny,...K(y)};L.set(Q,h),X.push(h)}return{ok:!0,statusDate:C,byTask:L,rows:X,project:{hasActualCost:z.acAny,hasBaseline:z.hasBaseline,...K(z)}}}}),Tt("packages/modules/gantt/mspdi.js",function(p,pt){"use strict";Object.defineProperty(p,"parseXml",{enumerable:!0,get:function(){return et}}),Object.defineProperty(p,"importMSPDI",{enumerable:!0,get:function(){return st}}),Object.defineProperty(p,"exportMSPDI",{enumerable:!0,get:function(){return h}});const dt=pt("packages/core/src/internal/util.js").warnOnce,at=pt("packages/modules/gantt/time.js"),Y=at.toDayNumber,tt=at.toISODate,j=Object.freeze({0:"FF",1:"FS",2:"SF",3:"SS"}),J=Object.freeze({FF:0,FS:1,SF:2,SS:3}),c=Object.freeze({1:"as-late-as-possible",2:"must-start-on",3:"must-finish-on"}),$=Object.freeze({ALAP:1,MSO:2,MFO:3});function b(M){return String(M).replace(/&(#x?[0-9a-fA-F]+|lt|gt|amp|quot|apos);/g,(H,d)=>{if(d[0]==="#"){const I=d[1]==="x"||d[1]==="X"?parseInt(d.slice(2),16):parseInt(d.slice(1),10);return Number.isFinite(I)?String.fromCodePoint(I):H}return{lt:"<",gt:">",amp:"&",quot:'"',apos:"'"}[d]??H})}function _(M){return String(M??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function q(M){const H=M.indexOf(":");return H<0?M:M.slice(H+1)}function et(M){const H=String(M);let d=0;const I=[];let k=null;for(;d<H.length;){const U=H.indexOf("<",d);if(U<0)break;if(U>d&&I.length){const N=H.slice(d,U);N.trim()&&(I[I.length-1].text+=b(N))}if(H.startsWith("<?",U)){const N=H.indexOf("?>",U);d=N<0?H.length:N+2;continue}if(H.startsWith("<!--",U)){const N=H.indexOf("-->",U);d=N<0?H.length:N+3;continue}if(H.startsWith("<![CDATA[",U)){const N=H.indexOf("]]>",U);I.length&&(I[I.length-1].text+=H.slice(U+9,N<0?H.length:N)),d=N<0?H.length:N+3;continue}if(H.startsWith("<!",U)){const N=H.indexOf(">",U);d=N<0?H.length:N+1;continue}const o=H.indexOf(">",U);if(o<0)break;let B=H.slice(U+1,o).trim();if(B[0]==="/"){I.pop(),d=o+1;continue}const W=B.endsWith("/");W&&(B=B.slice(0,-1).trim());const V=B.search(/\s/),E=q(V<0?B:B.slice(0,V)),S={};if(V>=0)for(const N of B.slice(V).matchAll(/([\w:.-]+)\s*=\s*"([^"]*)"|([\w:.-]+)\s*=\s*'([^']*)'/g))S[q(N[1]??N[3])]=b(N[2]??N[4]??"");const m={name:E,attrs:S,children:[],text:""};I.length?I[I.length-1].children.push(m):k||(k=m),W||I.push(m),d=o+1}return k}function C(M,H){return M?M.children.find(d=>d.name===H):void 0}function F(M,H){return M?M.children.filter(d=>d.name===H):[]}function x(M,H){const d=C(M,H);return d?d.text.trim():void 0}function it(M){if(!M)return null;const H=String(M).match(/^\d{4}-\d{2}-\d{2}/);return Y(H?H[0]:M)}function z(M,H){return`${tt(M)}T${String(H).padStart(2,"0")}:00:00`}function K(M,H){if(!M)return null;const d=String(M).match(/PT?(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?/);return d?((Number(d[1])||0)+(Number(d[2])||0)/60+(Number(d[3])||0)/3600)/H:null}function L(M,H){return`PT${Math.round((M||0)*H*1e3)/1e3}H0M0S`}function X(M,H){return(Number(M)||0)/(600*H)}function Q(M,H){return Math.round((M||0)*10*60*H)}function st(M,H={}){const d=H.hoursPerDay??8,I=et(M);if(!I||I.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=it(x(I,"StartDate")),U=C(I,"Resources"),o=new Map,B=[];for(const u of F(U,"Resource")){const g=x(u,"UID"),w=x(u,"Name");if(g==null||w==null||w==="")continue;o.set(g,w);const i=x(u,"MaxUnits");B.push({id:w,name:w,capacity:i==null?1:Number(i)})}const W=C(I,"Assignments"),V=new Map;for(const u of F(W,"Assignment")){const g=x(u,"TaskUID"),w=x(u,"ResourceUID"),i=o.get(w);if(g==null||i==null)continue;const l=x(u,"Units");V.has(g)||V.set(g,[]),V.get(g).push({resource:i,units:l==null?1:Number(l)})}const E=C(I,"Tasks"),S=[],m=[],N=new Map,lt=[],wt=[];for(const u of F(E,"Task")){if(x(u,"IsNull")==="1")continue;const g=x(u,"UID");if(g==null||g==="0")continue;const w=g;N.set(g,w);const i=Number(x(u,"OutlineLevel"))||1;for(;lt.length&&lt[lt.length-1].level>=i;)lt.pop();const l=lt.length?lt[lt.length-1].uid:null;lt.push({uid:g,level:i});const n=x(u,"Summary")==="1",t=x(u,"Milestone")==="1",e={id:w,name:x(u,"Name")??w};if(l&&(e.parent=l),t&&(e.milestone=!0),!n&&!t){const G=K(x(u,"Duration"),d);G!=null&&(e.duration=G)}const s=it(x(u,"Start"));!n&&s!=null&&(e.start=s);const a=x(u,"PercentComplete");a!=null&&(e.percentComplete=Number(a));const v=c[Number(x(u,"ConstraintType"))];if(v){e.constraint=v;const G=it(x(u,"ConstraintDate"));G!=null&&(e.constraintDate=G)}const f=C(u,"Baseline");if(f){const G=it(x(f,"Start")),A=it(x(f,"Finish"));G!=null&&(e.baselineStart=G),A!=null&&(e.baselineEnd=A)}const T=V.get(g);T&&T.length&&(e.assignments=T),S.push(e);for(const G of F(u,"PredecessorLink"))wt.push({raw:G,uid:g})}for(const{raw:u,uid:g}of wt){const w=x(u,"PredecessorUID"),i=N.get(w),l=N.get(g);if(i==null||l==null)continue;const n=j[Number(x(u,"Type")??1)]??"FS",t=X(x(u,"LinkLag"),d),e={from:i,to:l,type:n};t&&(e.lag=t),m.push(e)}const ot=y(I),r={ok:!0,tasks:S,dependencies:m,resources:B};return k!=null&&(r.projectStart=k),ot&&(r.calendar=ot),r}function y(M){const H=C(M,"Calendars"),d=F(H,"Calendar"),I=x(M,"CalendarUID"),k=d.find(E=>x(E,"UID")===I)??d[0];if(!k)return null;const U=C(k,"WeekDays"),o=[];let B=!1;for(const E of F(U,"WeekDay")){const S=Number(x(E,"DayType"));S>=1&&S<=7&&(B=!0,x(E,"DayWorking")==="1"&&o.push(S-1))}const W=[],V=C(k,"Exceptions");for(const E of F(V,"Exception")){if(x(E,"DayWorking")==="1")continue;const S=C(E,"TimePeriod"),m=it(x(S,"FromDate")),N=it(x(S,"ToDate"))??m;if(m!=null)for(let lt=m;lt<=N;lt+=1)W.push(lt)}return!B&&!W.length?null:{workdays:B?o:[1,2,3,4,5],holidays:W}}function h(M,H={}){const d=H.hoursPerDay??8,I=Array.isArray(M.tasks)?M.tasks:[],k=Array.isArray(M.dependencies)?M.dependencies:[],U=Array.isArray(M.resources)?M.resources:M.resources&&typeof M.resources=="object"?Object.entries(M.resources).map(([r,u])=>({id:r,name:r,capacity:u})):[],o=M.schedule&&M.schedule.ok?M.schedule:null,B=new Map;I.forEach((r,u)=>{const g=String(r.id);B.set(g,/^\d+$/.test(g)?g:String(u+1))});const W=new Map;for(const r of I){const u=r.parent!=null?String(r.parent):null;u&&(W.has(u)||W.set(u,[]),W.get(u).push(String(r.id)))}const V=r=>W.has(r),E=r=>{let u=1,g=I.find(w=>String(w.id)===r);for(;g&&g.parent!=null;)u+=1,g=I.find(w=>String(w.id)===String(g.parent));return u},S=new Map;for(const r of k){const u=String(r.to);S.has(u)||S.set(u,[]),S.get(u).push(r)}const m=[];m.push('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'),m.push('<Project xmlns="http://schemas.microsoft.com/project">'),m.push(` <Name>${_(H.projectName||"Lattice Gantt export")}</Name>`);const N=M.projectStart!=null?Y(M.projectStart):o?o.projectStart:null;N!=null&&m.push(` <StartDate>${z(N,8)}</StartDate>`);const lt=Z(M.calendar);if(lt&&m.push(" <CalendarUID>1</CalendarUID>"),lt){m.push(" <Calendars>"),m.push(" <Calendar>"),m.push(" <UID>1</UID>"),m.push(" <Name>Standard</Name>"),m.push(" <IsBaseCalendar>1</IsBaseCalendar>"),m.push(" <WeekDays>");for(let r=0;r<=6;r+=1){const u=lt.workdays.includes(r);m.push(" <WeekDay>"),m.push(` <DayType>${r+1}</DayType>`),m.push(` <DayWorking>${u?1:0}</DayWorking>`),m.push(" </WeekDay>")}if(m.push(" </WeekDays>"),lt.holidays.length){m.push(" <Exceptions>");for(const r of lt.holidays)m.push(" <Exception>"),m.push(" <DayWorking>0</DayWorking>"),m.push(` <TimePeriod><FromDate>${z(r,0)}</FromDate><ToDate>${z(r,23)}</ToDate></TimePeriod>`),m.push(" </Exception>");m.push(" </Exceptions>")}m.push(" </Calendar>"),m.push(" </Calendars>")}m.push(" <Tasks>");for(const r of I){const u=String(r.id),g=B.get(u),w=V(u),i=!!r.milestone||!w&&Number(r.duration)===0,l=o?o.tasks.get(u):null;m.push(" <Task>"),m.push(` <UID>${_(g)}</UID>`),m.push(` <ID>${_(g)}</ID>`),m.push(` <Name>${_(r.name!=null?r.name:u)}</Name>`),m.push(` <OutlineLevel>${E(u)}</OutlineLevel>`),m.push(` <Summary>${w?1:0}</Summary>`),m.push(` <Milestone>${i?1:0}</Milestone>`);const n=l?l.duration:r.duration!=null?Number(r.duration):null;n!=null&&m.push(` <Duration>${L(n,d)}</Duration>`),m.push(" <DurationFormat>7</DurationFormat>");const t=l?l.es:r.start!=null?Y(r.start):null,e=l?l.ef:r.end!=null?Y(r.end):t!=null&&n!=null?t+n:null;t!=null&&m.push(` <Start>${z(t,8)}</Start>`),e!=null&&m.push(` <Finish>${z(e,17)}</Finish>`);const s=l?l.percentComplete:r.percentComplete;s!=null&&m.push(` <PercentComplete>${Math.round(Number(s))}</PercentComplete>`);const a=R(r.constraint??r.constraintType);if(a!=null){m.push(` <ConstraintType>${a}</ConstraintType>`);const T=rt(r.constraintDate??r.constraintAt??r.at);T!=null&&m.push(` <ConstraintDate>${z(T,8)}</ConstraintDate>`)}const v=rt(r.baselineStart??(r.baseline&&r.baseline.start)),f=rt(r.baselineEnd??(r.baseline&&r.baseline.end));(v!=null||f!=null)&&(m.push(" <Baseline>"),m.push(" <Number>0</Number>"),v!=null&&m.push(` <Start>${z(v,8)}</Start>`),f!=null&&m.push(` <Finish>${z(f,17)}</Finish>`),v!=null&&f!=null&&m.push(` <Duration>${L(f-v,d)}</Duration>`),m.push(" </Baseline>"));for(const T of S.get(u)||[]){const G=B.get(String(T.from));G!=null&&(m.push(" <PredecessorLink>"),m.push(` <PredecessorUID>${_(G)}</PredecessorUID>`),m.push(` <Type>${J[T.type?String(T.type).toUpperCase():"FS"]??1}</Type>`),T.lag&&(m.push(` <LinkLag>${Q(Number(T.lag),d)}</LinkLag>`),m.push(" <LagFormat>7</LagFormat>")),m.push(" </PredecessorLink>"))}m.push(" </Task>")}m.push(" </Tasks>");const wt=new Map;U.forEach((r,u)=>{const g=String(r.name??r.id??`Resource ${u+1}`);wt.set(g,{uid:String(u+1),capacity:r.capacity??r.maxUnits??1})});const ot=[];for(const r of I)for(const u of P(r))wt.has(u.resource)||wt.set(u.resource,{uid:String(wt.size+1),capacity:1}),ot.push({taskUid:B.get(String(r.id)),resUid:wt.get(u.resource).uid,units:u.units});m.push(" <Resources>");for(const[r,u]of wt)m.push(" <Resource>"),m.push(` <UID>${_(u.uid)}</UID>`),m.push(` <ID>${_(u.uid)}</ID>`),m.push(` <Name>${_(r)}</Name>`),m.push(` <MaxUnits>${Number(u.capacity)}</MaxUnits>`),m.push(" </Resource>");return m.push(" </Resources>"),m.push(" <Assignments>"),ot.forEach((r,u)=>{m.push(" <Assignment>"),m.push(` <UID>${u+1}</UID>`),m.push(` <TaskUID>${_(r.taskUid)}</TaskUID>`),m.push(` <ResourceUID>${_(r.resUid)}</ResourceUID>`),m.push(` <Units>${Number(r.units)}</Units>`),m.push(" </Assignment>")}),m.push(" </Assignments>"),m.push("</Project>"),m.join(`
6
+ (function(te){"use strict";var Vt=Object.create(null),Yt=Object.create(null);function Tt(p,pt){Vt[p]=pt}function Zt(p){var pt=Yt[p];if(pt)return pt;var xt=Object.create(null);Yt[p]=xt;var dt=Vt[p];if(!dt)throw new Error("[lattice] missing module: "+p);return dt(xt,Zt),xt}Tt("packages/core/src/internal/util.js",function(p,pt){"use strict";Object.defineProperty(p,"VERSION",{enumerable:!0,get:function(){return at}}),Object.defineProperty(p,"reportedWarnings",{enumerable:!0,get:function(){return _}}),Object.defineProperty(p,"warnOnce",{enumerable:!0,get:function(){return q}}),Object.defineProperty(p,"infoOnce",{enumerable:!0,get:function(){return et}}),Object.defineProperty(p,"resetWarnings",{enumerable:!0,get:function(){return C}}),Object.defineProperty(p,"fail",{enumerable:!0,get:function(){return F}}),Object.defineProperty(p,"invariant",{enumerable:!0,get:function(){return x}}),Object.defineProperty(p,"DEV",{enumerable:!0,get:function(){return it}}),Object.defineProperty(p,"isObject",{enumerable:!0,get:function(){return z}}),Object.defineProperty(p,"isFunction",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"isNil",{enumerable:!0,get:function(){return L}}),Object.defineProperty(p,"isBlank",{enumerable:!0,get:function(){return X}}),Object.defineProperty(p,"isCtor",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(p,"pathGetter",{enumerable:!0,get:function(){return y}}),Object.defineProperty(p,"pathSetter",{enumerable:!0,get:function(){return P}}),Object.defineProperty(p,"getPath",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(p,"setPath",{enumerable:!0,get:function(){return R}}),Object.defineProperty(p,"humanise",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(p,"escapeHtml",{enumerable:!0,get:function(){return H}}),Object.defineProperty(p,"titleCase",{enumerable:!0,get:function(){return d}}),Object.defineProperty(p,"expand",{enumerable:!0,get:function(){return I}}),Object.defineProperty(p,"toArray",{enumerable:!0,get:function(){return k}}),Object.defineProperty(p,"merge",{enumerable:!0,get:function(){return o}}),Object.defineProperty(p,"mergeRow",{enumerable:!0,get:function(){return B}}),Object.defineProperty(p,"Lru",{enumerable:!0,get:function(){return W}}),Object.defineProperty(p,"collator",{enumerable:!0,get:function(){return E}}),Object.defineProperty(p,"defaultCompare",{enumerable:!0,get:function(){return S}}),Object.defineProperty(p,"now",{enumerable:!0,get:function(){return m}}),Object.defineProperty(p,"nextFrame",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(p,"cancelFrame",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(p,"frameBatched",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(p,"settleDebounce",{enumerable:!0,get:function(){return r}}),Object.defineProperty(p,"whenIdle",{enumerable:!0,get:function(){return u}}),Object.defineProperty(p,"uid",{enumerable:!0,get:function(){return w}});const xt="1.75.0";async function dt(){return xt}const at="1.75.0",Y=new Set,tt=2e3;function j(i){if(Y.add(i),Y.size>tt){const l=Y.values().next().value;l!==void 0&&Y.delete(l)}}const J=[],c=500;function $(i,l,n){J.push({key:i,level:l,message:n.map(t=>typeof t=="string"?t:b(t)).join(" "),at:Date.now()}),J.length>c&&J.shift()}function b(i){if(i instanceof Error)return i.message;try{return JSON.stringify(i)}catch{return String(i)}}function _(){return J.map(i=>({...i}))}function q(i,...l){Y.has(i)||(j(i),$(i,"warn",l),console.warn("[lattice]",...l))}function et(i,...l){Y.has(i)||(j(i),$(i,"info",l),console.info("[lattice]",...l))}function C(){Y.clear(),J.length=0}function F(i,l){const n=new Error(`[lattice] ${i}`);throw l!==void 0&&(n.cause=l),n}function x(i,l){i||F(l)}const it=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function z(i){return i!==null&&typeof i=="object"&&!Array.isArray(i)}function K(i){return typeof i=="function"}function L(i){return i==null}function X(i){return i==null||i===""}function Q(i){return typeof i!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(i))?!0:!!(i.prototype&&Object.getOwnPropertyNames(i.prototype).length>1)}const st=new Map;function y(i){let l=st.get(i);if(l)return l;if(!i.includes("."))l=n=>n?.[i];else{const n=i.split("."),t=n.length;l=e=>{let s=e;for(let a=0;a<t;a++){if(s==null)return;s=s[n[a]]}return s}}return st.set(i,l),l}const h=new Map;function P(i){let l=h.get(i);if(l)return l;if(!i.includes("."))l=(n,t)=>{n!=null&&(n[i]=t)};else{const n=i.split("."),t=n.length-1;l=(e,s)=>{let a=e;for(let v=0;v<t;v++){if(a==null)return;const f=n[v];a[f]==null&&(a[f]={}),a=a[f]}a!=null&&(a[n[t]]=s)}}return h.set(i,l),l}function Z(i,l){return y(l)(i)}function R(i,l,n){P(l)(i,n)}function rt(i){return i?(i.includes(".")?i.slice(i.lastIndexOf(".")+1):i).replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,n=>n.toUpperCase()):""}const M={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function H(i){const l=i==null?"":String(i);return/[&<>"']/.test(l)?l.replace(/[&<>"']/g,n=>M[n]):l}function d(i){return String(i).replace(/\w\S*/g,l=>l[0].toUpperCase()+l.slice(1).toLowerCase())}function I(i,l,n){if(i!==void 0)return i===!0?{enabled:!0,...n}:i===!1?{enabled:!1}:z(i)?i:{[l]:i,enabled:!0}}function k(i){return i==null?[]:Array.isArray(i)?i:[i]}const U=Object.freeze(new Set(["__proto__","constructor","prototype"]));function o(i,l){if(!z(i))return z(l)?{...l}:l;if(!z(l))return l===void 0?i:l;const n={...i};for(const t of Object.keys(l)){if(U.has(t))continue;const e=l[t];e!==void 0&&(n[t]=z(e)&&z(n[t])?o(n[t],e):e)}return n}function B(i,l){if(!z(i)||!z(l)||i===l)return l;const n=Object.create(Object.getPrototypeOf(i));return Object.assign(n,i,l),n}class W{#n;#r=new Map;#t;constructor(l=256,n=null){this.#n=l,this.#t=n}get size(){return this.#r.size}get max(){return this.#n}set max(l){this.#n=l,this.#e()}has(l){return this.#r.has(l)}get(l){const n=this.#r;if(!n.has(l))return;const t=n.get(l);return n.delete(l),n.set(l,t),t}peek(l){return this.#r.get(l)}set(l,n){const t=this.#r;return t.has(l)&&t.delete(l),t.set(l,n),this.#e(),n}delete(l){const n=this.#r.get(l);return this.#r.delete(l)&&this.#t&&this.#t(n,l),n}clear(){if(this.#t)for(const[l,n]of this.#r)this.#t(n,l);this.#r.clear()}keys(){return this.#r.keys()}values(){return this.#r.values()}#e(){const l=this.#r;for(;l.size>this.#n;){const n=l.keys().next().value,t=l.get(n);l.delete(n),this.#t&&this.#t(t,n)}}}const V=new Map;function E(i,l){const n=`${i||""}|${l?JSON.stringify(l):""}`;let t=V.get(n);return t||(t=new Intl.Collator(i||void 0,{numeric:!0,sensitivity:"variant",...l}),V.set(n,t)),t}function S(i,l){if(i===l)return 0;if(i==null)return 1;if(l==null)return-1;if(typeof i=="number"&&typeof l=="number")return Number.isNaN(i)?Number.isNaN(l)?0:1:Number.isNaN(l)||i<l?-1:i>l?1:0;const n=String(i),t=String(l);return n<t?-1:n>t?1:0}function m(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const N=typeof requestAnimationFrame=="function";function lt(i){return N?requestAnimationFrame(i):setTimeout(()=>i(m()),16)}function wt(i){i!=null&&(N?cancelAnimationFrame(i):clearTimeout(i))}function ot(i){let l=null,n=null;const t=()=>{l=null;const s=n;n=null,i(...s||[])},e=(...s)=>{n=s,l===null&&(l=lt(t))};return e.cancel=()=>{wt(l),l=null,n=null},e.flush=()=>{l!==null&&(wt(l),t())},e}function r(i,l){let n=null,t=null;const e=()=>{if(n=null,t===null)return;const v=t;t=null,i(...v),s()},s=()=>{n=setTimeout(e,l),typeof n?.unref=="function"&&n.unref()},a=(...v)=>{n===null?(i(...v),s()):(t=v,clearTimeout(n),s())};return a.flush=()=>{if(n!==null&&clearTimeout(n),n=null,t===null)return;const v=t;t=null,i(...v)},a.cancel=()=>{n!==null&&clearTimeout(n),n=null,t=null},a.pending=()=>n!==null||t!==null,a}function u(i,l=50){return typeof requestIdleCallback=="function"?requestIdleCallback(i,{timeout:l}):setTimeout(()=>i({timeRemaining:()=>0,didTimeout:!0}),1)}let g=0;function w(i="l"){return`${i}${(++g).toString(36)}`}}),Tt("packages/modules/shared/emitter.js",function(p,pt){"use strict";Object.defineProperty(p,"WILDCARD",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"Emitter",{enumerable:!0,get:function(){return J}}),Object.defineProperty(p,"gate",{enumerable:!0,get:function(){return c}});const xt=pt("packages/core/src/internal/util.js"),dt=xt.isFunction,at=xt.warnOnce,Y="*",tt=new Set(["api","user","init","ai"]);function j($,b){return $&&$.name?$.name:`#${b}`}class J{#n=new Map;#r;constructor(b="module"){this.#r=String(b)}on(b,_){if(!dt(_))return()=>{};let q=this.#n.get(b);return q||(q=new Set,this.#n.set(b,q)),q.add(_),()=>this.off(b,_)}off(b,_){const q=this.#n.get(b);q&&q.delete(_)}count(b){const _=this.#n.get(b);return _?_.size:0}emit(b,_){const q=this.#n.get(b),et=this.#n.get(Y);if((!q||q.size===0)&&(!et||et.size===0))return;const C={..._||null,type:b};q&&q.size&&this.#t([...q],C,b),et&&et.size&&this.#t([...et],C,Y)}#t(b,_,q){for(let et=0;et<b.length;et++)try{b[et](_)}catch(C){at(`${this.#r}.emit.throw:${q}:${j(b[et],et)}`,`${this.#r}: a '${q}' handler threw; other handlers were unaffected.`,C)}}emitBefore(b,_,q){const et=q??(_&&_.origin),C=tt.has(et)?et:"user";let F=!1,x=null;const it=st=>{F=!0,st!=null&&x===null&&(x=String(st))},z={..._||null,type:b,origin:C,get defaultPrevented(){return F},get reason(){return x},preventDefault(st){it(st)}},K=this.#n.get(b);if(!K||K.size===0)return!0;const L=[...K],X=()=>(F&&x===null&&(x="prevented"),F&&_&&typeof _=="object"&&(_.reason=x),!F),Q=[];for(let st=0;st<L.length;st++){const y=L[st];try{const h=y(z);h&&dt(h.then)?Q.push(h):h===!1&&it("prevented")}catch(h){it("error"),at(`${this.#r}.beforeThrow:${b}:${j(y,st)}`,`${this.#r}: a '${b}' before-handler threw; the action was cancelled.`,h)}}return Q.length===0?X():Promise.allSettled(Q).then(st=>{for(const y of st)y.status==="rejected"?(it("error"),at(`${this.#r}.beforeReject:${b}`,`${this.#r}: a '${b}' before-handler rejected; the action was cancelled.`,y.reason)):y.value===!1&&it("prevented");return X()})}clear(){this.#n.clear()}}function c($,b,_,q,et){const C=$.emitBefore(b,q,q.origin),F=()=>($.emit(_,{...q,reason:q.reason||"prevented"}),!1);return C===!1?F():C&&dt(C.then)?C.then(x=>x?et():F()):et()}}),Tt("packages/modules/gantt/time.js",function(p,pt){"use strict";Object.defineProperty(p,"toDayNumber",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"fromDayNumber",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(p,"toISODate",{enumerable:!0,get:function(){return j}}),Object.defineProperty(p,"resolveProjectEpoch",{enumerable:!0,get:function(){return J}});const dt=pt("packages/core/src/internal/util.js").warnOnce,at=864e5;function Y(c){if(c==null||c==="")return null;if(typeof c=="number")return Number.isFinite(c)?c:null;if(c instanceof Date)return Number.isFinite(c.getTime())?Math.floor(Date.UTC(c.getFullYear(),c.getMonth(),c.getDate())/at):null;const $=Date.parse(c);return Number.isFinite($)?Math.floor($/at):null}function tt(c){return Number.isFinite(c)?new Date(Math.round(c)*at):null}function j(c){const $=tt(c);return $?$.toISOString().slice(0,10):null}function J(c){if(c==null||c==="")return 0;const $=Y(c);return Number.isFinite($)?$:(dt(`gantt.projectEpoch:${String(c)}`,`[lattice] gantt: projectEpoch ${JSON.stringify(c)} is not a date or a day number; the plan is rendered against the Unix epoch (day 0 = 1970-01-01).`),0)}}),Tt("packages/modules/gantt/calendar.js",function(p,pt){"use strict";Object.defineProperty(p,"createCalendar",{enumerable:!0,get:function(){return tt}});const xt=pt("packages/modules/gantt/time.js"),dt=xt.fromDayNumber,at=xt.toDayNumber,Y=Object.freeze([1,2,3,4,5]);function tt(j,J=0){if(j==null)return null;let c,$;j==="weekends"?(c=Y,$=new Set):(c=Array.isArray(j.workdays)&&j.workdays.length?j.workdays.map(Number).filter(K=>K>=0&&K<=6):Y,$=new Set((Array.isArray(j.holidays)?j.holidays:[]).map(K=>at(K)).filter(K=>K!=null)));const b=new Set(c);if(b.size===7&&$.size===0||b.size===0)return null;const _=K=>{const L=dt(K);return L?b.has(L.getUTCDay())&&!$.has(K):!1},q=K=>{let L=K;for(;!_(L);)L+=1;return L},et=K=>{let L=K;for(;!_(L);)L-=1;return L},C=q(Math.round(Number.isFinite(J)?J:0)),F=new Map([[0,C]]),x=new Map([[C,0]]);return{isWorking:_,nextWorking:q,dayOf:K=>{const L=Math.round(K);if(F.has(L))return F.get(L);if(L>0){let st=L-1;for(;!F.has(st);)st-=1;let y=F.get(st);for(let h=st+1;h<=L;h+=1)y=q(y+1),F.set(h,y),x.set(y,h);return F.get(L)}let X=L+1;for(;!F.has(X);)X+=1;let Q=F.get(X);for(let st=X-1;st>=L;st-=1)Q=et(Q-1),F.set(st,Q),x.set(Q,st);return F.get(L)},indexOf:K=>{const L=q(Math.round(K));if(x.has(L))return x.get(L);if(L>C){let st=0,y=C;for(;x.has(q(y+1))&&y<L;)y=q(y+1),st=x.get(y);for(;y<L;)y=q(y+1),st+=1,F.set(st,y),x.set(y,st);return st}let X=0,Q=C;for(;Q>L;)Q=et(Q-1),X-=1,F.set(X,Q),x.set(Q,X);return X},anchor:C}}}),Tt("packages/modules/gantt/schedule.js",function(p,pt){"use strict";Object.defineProperty(p,"LINK_TYPES",{enumerable:!0,get:function(){return J}}),Object.defineProperty(p,"CONSTRAINT_TYPES",{enumerable:!0,get:function(){return c}}),Object.defineProperty(p,"EPS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(p,"SCHEDULE_ERROR",{enumerable:!0,get:function(){return _}}),Object.defineProperty(p,"TASK_FIELDS",{enumerable:!0,get:function(){return C}}),Object.defineProperty(p,"taskIdReader",{enumerable:!0,get:function(){return x}}),Object.defineProperty(p,"taskFieldWriters",{enumerable:!0,get:function(){return it}}),Object.defineProperty(p,"normalizeTasks",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"buildTree",{enumerable:!0,get:function(){return L}}),Object.defineProperty(p,"normalizeLinkSpec",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(p,"normalizeDependencies",{enumerable:!0,get:function(){return st}}),Object.defineProperty(p,"expandDependencies",{enumerable:!0,get:function(){return y}}),Object.defineProperty(p,"topoOrder",{enumerable:!0,get:function(){return h}}),Object.defineProperty(p,"computeSchedule",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(p,"findViolations",{enumerable:!0,get:function(){return I}});const dt=pt("packages/core/src/internal/util.js").warnOnce,Y=pt("packages/modules/gantt/calendar.js").createCalendar,j=pt("packages/modules/gantt/time.js").toDayNumber,J=["FS","SS","FF","SF"],c=["MSO","MFO","ALAP"],$=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"}),b=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:j(k)}const C=Object.freeze(["id","name","start","end","duration","milestone","percentComplete","parent","baselineStart","baselineEnd","constraint","constraintDate"]);function F(k){const U=k&&typeof k=="object"?k:{},o={};for(const B of C){const W=U[B];if(typeof W=="function")o[B]=W;else if(typeof W=="string"&&W!==""){const V=W;o[B]=E=>E[V]}else o[B]=V=>V[B]}return o}function x(k){return F(k).id}function it(k){const U=k&&typeof k=="object"?k:{},o={};for(const B of C){const W=U[B];typeof W=="string"&&W!==""?o[B]=W:typeof W=="function"?o[B]=null:o[B]=B}return o}function z(k,U){const o=U.constraint(k),B=o??(k&&k.constraintType);if(B==null||B==="")return null;const W=$[String(B).toLowerCase().replace(/\s+/g,"-")]??(c.includes(String(B).toUpperCase())?String(B).toUpperCase():null);if(!W)return null;const V=et(U.constraintDate(k)??k.constraintAt??k.at);return{type:W,at:V}}function K(k,U){const o=new Map,B=[],W=F(U);if(!Array.isArray(k))return{ok:!1,error:{code:_.BAD_DURATION,message:"tasks must be an array"},order:B,byId:o};for(const V of k){const E=V?W.id(V):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 m=et(W.start(V)),N=et(W.end(V)),lt=W.milestone(V)===!0;let wt=lt?0:q(W.duration(V));if(wt==null&&m!=null&&N!=null&&(wt=N-m),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 ot=W.name(V),r=W.parent(V);o.set(S,{id:S,name:ot!=null?String(ot):S,duration:wt,milestoneFlag:lt,earliestStart:m,placedStart:m,placedEnd:N,percentComplete:q(W.percentComplete(V)),parent:r!=null?String(r):null,constraint:z(V,W),baselineStart:et(W.baselineStart(V)??(V.baseline&&V.baseline.start)),baselineEnd:et(W.baselineEnd(V)??(V.baseline&&V.baseline.end))}),B.push(S)}return{ok:!0,order:B,byId:o}}function L(k,U){const o=new Map(k.map(S=>[S,[]]));for(const S of k){const m=U.get(S).parent;if(m!=null){if(!U.has(m))return{ok:!1,error:{code:_.UNKNOWN_PARENT,message:`task "${S}" names unknown parent "${m}"`,id:S}};o.get(m).push(S)}}for(const S of k){const m=new Set;let N=U.get(S).parent;for(;N!=null;){if(N===S||m.has(N))return{ok:!1,error:{code:_.PARENT_CYCLE,message:`parent cycle at "${S}"`,id:S}};m.add(N),N=U.get(N)?.parent??null}}const B=S=>o.get(S).length>0,W=new Map,V=S=>{if(W.has(S))return W.get(S);const m=o.get(S),N=m.length===0?[S]:m.flatMap(lt=>V(lt));return W.set(S,N),N};return{ok:!0,children:o,isSummary:B,descendantLeaves:V,ancestors:S=>{const m=new Set;let N=U.get(S).parent;for(;N!=null;)m.add(N),N=U.get(N).parent;return m}}}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 st(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 V of k){const E=Q(V),S=E&&E.from!=null?String(E.from):null,m=E&&E.to!=null?String(E.to):null,N=E&&E.type!=null?String(E.type).toUpperCase():"FS",lt=q(E.lag)??0;if(S==null||m==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(m))return{ok:!1,error:{code:_.UNKNOWN_TASK,message:`dependency references unknown task "${m}"`,id:m},edges:B};if(S===m)return{ok:!1,error:{code:_.SELF_DEPENDENCY,message:`task "${S}" depends on itself`,id:S},edges:B};if(!J.includes(N))return{ok:!1,error:{code:_.BAD_LINK_TYPE,message:`unknown link type "${N}" (expected one of ${J.join("/")})`},edges:B};if(W&&(W(S).has(m)||W(m).has(S)))return{ok:!1,error:{code:_.DEP_ACROSS_HIERARCHY,message:`dependency between "${S}" and "${m}" crosses their own parent/child hierarchy`,from:S,to:m},edges:B};B.push({from:S,to:m,type:N,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 m=[E,S,W.type,W.lag].join("");o.has(m)||(o.add(m),B.push({from:E,to:S,type:W.type,lag:W.lag}))}}return B}function h(k,U){const o=new Map(k.map(E=>[E,0])),B=new Map(k.map(E=>[E,[]]));for(const E of U)P(o,E.to),B.get(E.from).push(E.to);const W=k.filter(E=>o.get(E)===0),V=[];for(;W.length;){const E=W.shift();V.push(E);for(const S of B.get(E)){const m=o.get(S)-1;o.set(S,m),m===0&&W.push(S)}}return V.length===k.length?{ok:!0,sorted:V}:{ok:!1,cycle:Z(k,B,new Set(V))}}function P(k,U){k.set(U,k.get(U)+1)}function Z(k,U,o){const B=k.find(S=>!o.has(S)),W=[],V=new Map;let E=B;for(;E!=null&&!V.has(E);)V.set(E,W.length),W.push(E),E=U.get(E).find(S=>!o.has(S));return E==null?W:W.slice(V.get(E)).concat(E)}function R(k,U,o,B,W,V=new Map){const E=h(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,m=new Map(k.map(w=>[w,[]])),N=new Map(k.map(w=>[w,[]]));for(const w of o)m.get(w.to).push(w),N.get(w.from).push(w);const lt=new Map;for(const w of k){const i=U.get(w);lt.set(w,{id:w,name:i.name,duration:i.duration,es:0,ef:0,ls:0,lf:0,totalFloat:0,critical:!1,percentComplete:i.percentComplete,parent:i.parent,isSummary:!1,isMilestone:i.duration===0,children:[]})}const wt=[];for(const w of S){const i=U.get(w),l=lt.get(w);let n=Math.max(B,i.earliestStart??B);for(const e of m.get(w)){const s=lt.get(e.from);let a;switch(e.type){case"FS":a=s.ef+e.lag;break;case"SS":a=s.es+e.lag;break;case"FF":a=s.ef+e.lag-l.duration;break;case"SF":a=s.es+e.lag-l.duration;break;default:a=-1/0}a>n&&(n=a)}const t=V.get(w);if(t&&t.type!=="ALAP"&&t.at!=null){const e=t.type==="MFO"?t.at-l.duration:t.at;e<n-b?wt.push({id:w,type:t.type,at:t.at,earliestFeasible:n}):n=e,l.pinned=!0}l.es=n,l.ef=n+l.duration}const ot=k.length?Math.max(...k.map(w=>lt.get(w).ef)):B,r=Number.isFinite(W)?W:ot;for(let w=S.length-1;w>=0;w-=1){const i=S[w],l=lt.get(i);let n=r;for(const t of N.get(i)){const e=lt.get(t.to);let s;switch(t.type){case"FS":s=e.ls-t.lag;break;case"SS":s=e.ls-t.lag+l.duration;break;case"FF":s=e.lf-t.lag;break;case"SF":s=e.lf-t.lag+l.duration;break;default:s=1/0}s<n&&(n=s)}l.pinned&&(n=l.ef),l.lf=n,l.ls=n-l.duration,l.totalFloat=l.ls-l.es,l.critical=l.totalFloat<=b}for(const w of k){const i=V.get(w);if(!i||i.type!=="ALAP")continue;const l=lt.get(w);l.es=l.ls,l.ef=l.lf,l.totalFloat=0,l.critical=!0}const u=k.filter(w=>lt.get(w).critical),g=d(k,o,lt);return{ok:!0,tasks:lt,critical:u,criticalPaths:g,projectFinish:ot,conflicts:wt}}function rt(k,U=[],o={}){const B=et(o.projectStart)??0,W=et(o.deadline),V=Y(o.calendar,B),E=a=>a==null?null:V?V.indexOf(a):a,S=a=>V?V.dayOf(a):a,m=K(k,o.fields);if(!m.ok)return{ok:!1,error:m.error};const{order:N,byId:lt}=m,wt=L(N,lt);if(!wt.ok)return{ok:!1,error:wt.error};const ot=st(U,lt,wt);if(!ot.ok)return{ok:!1,error:ot.error};for(const a of N)if(!wt.isSummary(a)&&lt.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=N.filter(a=>!wt.isSummary(a)),u=new Map(r.map(a=>{const v=lt.get(a);return[a,{...v,earliestStart:E(v.earliestStart)}]})),g=new Map;for(const a of r){const v=lt.get(a).constraint;v&&g.set(a,{type:v.type,at:E(v.at)})}const w=V?V.indexOf(B):B,i=W==null?void 0:E(W),l=y(ot.edges,wt),n=R(r,u,l,w,i,g);if(!n.ok)return{ok:!1,error:n.error};const t=n.tasks;for(const a of r){const v=t.get(a);v.es=S(v.es),v.ef=S(v.ef),v.ls=S(v.ls),v.lf=S(v.lf),M(v,lt.get(a).baselineStart,lt.get(a).baselineEnd)}for(let a=N.length-1;a>=0;a-=1){const v=N[a];wt.isSummary(v)&&t.set(v,H(v,lt.get(v),wt,t))}for(const a of N)wt.isSummary(a)&&(t.get(a).children=wt.children.get(a).slice());const e=V?V.anchor:B,s=S(n.projectFinish);return{ok:!0,tasks:t,order:N,critical:n.critical,criticalPaths:n.criticalPaths,projectStart:e,projectFinish:s,projectDuration:s-e,conflicts:n.conflicts||[],calendar:!!V}}function M(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(g=>B.get(g)),V=Math.min(...W.map(g=>g.es)),E=Math.max(...W.map(g=>g.ef)),S=Math.min(...W.map(g=>g.ls)),m=Math.max(...W.map(g=>g.lf)),N=o.descendantLeaves(k).map(g=>B.get(g)),lt=N.reduce((g,w)=>g+w.duration,0),wt=lt>b?N.reduce((g,w)=>g+w.duration*(w.percentComplete??0),0)/lt:null,ot={id:k,name:U.name,duration:E-V,es:V,ef:E,ls:S,lf:m,totalFloat:S-V,critical:W.some(g=>g.critical),percentComplete:wt,parent:U.parent,isSummary:!0,isMilestone:!1,children:[]},r=N.map(g=>g.baselineStart).filter(g=>g!=null),u=N.map(g=>g.baselineEnd).filter(g=>g!=null);return(r.length||u.length)&&M(ot,r.length?Math.min(...r):null,u.length?Math.max(...u):null),ot}function d(k,U,o){const B=new Map(k.map(m=>[m,[]])),W=new Set;for(const m of U){const N=o.get(m.from),lt=o.get(m.to);if(!N.critical||!lt.critical)continue;let wt;switch(m.type){case"FS":wt=N.ef+m.lag;break;case"SS":wt=N.es+m.lag;break;case"FF":wt=N.ef+m.lag-lt.duration;break;case"SF":wt=N.es+m.lag-lt.duration;break;default:wt=-1/0}Math.abs(wt-lt.es)<=b&&(B.get(m.from).push(m.to),W.add(m.to))}const V=k.filter(m=>o.get(m).critical&&!W.has(m)),E=[],S=(m,N)=>{const lt=B.get(m);if(!lt.length){E.push(N);return}for(const wt of lt)S(wt,N.concat(wt))};for(const m of V)S(m,[m]);return E}function I(k,U,o){if(!U||!U.ok)return[];const B=[],W=F(o);for(const V of k){const E=V?W.id(V):null,S=E!=null?String(E):null;if(S==null||!U.tasks.has(S))continue;const m=U.tasks.get(S);if(m.isSummary)continue;const N=q(W.start(V));N!=null&&N<m.es-b&&B.push({id:S,placedStart:N,earliestStart:m.es,by:m.es-N})}return B}}),Tt("packages/modules/gantt/resources.js",function(p,pt){"use strict";Object.defineProperty(p,"parseAssignments",{enumerable:!0,get:function(){return b}}),Object.defineProperty(p,"normalizeCapacities",{enumerable:!0,get:function(){return _}}),Object.defineProperty(p,"sweepLoad",{enumerable:!0,get:function(){return q}}),Object.defineProperty(p,"computeResourceLoad",{enumerable:!0,get:function(){return et}}),Object.defineProperty(p,"levelResources",{enumerable:!0,get:function(){return x}});const dt=pt("packages/core/src/internal/util.js").warnOnce,at=pt("packages/modules/gantt/schedule.js"),Y=at.computeSchedule,tt=at.EPS,j=at.taskIdReader,c=pt("packages/modules/gantt/calendar.js").createCalendar;function $(z){if(z==null||z==="")return null;const K=typeof z=="number"?z:Number(z);return Number.isFinite(K)?K:null}function b(z){if(z&&Array.isArray(z.assignments))return z.assignments.map(X=>{const Q=X&&(X.resource??X.name??X.id);if(Q==null||Q==="")return null;const st=$(X.units)??$(X.allocation)??1;return{resource:String(Q),units:st}}).filter(Boolean);const K=z?z.assignee??z.assignees??z.owner:null;return(Array.isArray(K)?K:K==null||K===""?[]:[K]).map(X=>String(X)).filter(X=>X!=="").map(X=>({resource:X,units:1}))}function _(z,K){const L=new Map;if(Array.isArray(z))for(const X of z){const Q=X&&(X.id??X.name??X.resource);if(Q==null||Q==="")continue;const st=$(X.capacity??X.maxUnits??X.max??X.units);L.set(String(Q),st??K)}else if(z&&typeof z=="object")for(const[X,Q]of Object.entries(z)){const st=$(Q);L.set(String(X),st??K)}return L}function q(z){if(!z.length)return[];const K=new Set;for(const Q of z)K.add(Q.s),K.add(Q.e);const L=[...K].sort((Q,st)=>Q-st),X=[];for(let Q=0;Q<L.length-1;Q+=1){const st=L[Q],y=L[Q+1];if(y<=st)continue;let h=0;const P=[];for(const Z of z)Z.s<=st&&Z.e>=y&&(h+=Z.units,P.push(Z.taskId));P.length&&X.push({s:st,e:y,load:h,taskIds:P})}return X}function et(z,K,L={}){const X={ok:!1,resources:[],overAllocations:[],byResource:new Map};if(!K||!K.ok)return X;const Q=$(L.defaultCapacity)??1,st=_(L.resources,Q),y=L.calendar!=null?c(L.calendar,K.projectStart):null,h=I=>st.has(I)?st.get(I):Q,P=I=>y?y.indexOf(I):I,Z=I=>y?y.dayOf(I):I,R=j(L.fields),rt=new Map;for(const I of K.order){const k=K.tasks.get(I);if(!k||k.isSummary)continue;const U=z.find(V=>V&&R(V)!=null&&String(R(V))===I);if(!U)continue;const o=b(U);if(!o.length)continue;const B=P(k.es),W=P(k.ef);if(!(W<=B))for(const V of o)rt.has(V.resource)||rt.set(V.resource,[]),rt.get(V.resource).push({s:B,e:W,units:V.units,taskId:I})}const M=new Map,H=[],d=[];for(const[I,k]of rt){const U=h(I),o=q(k);let B=0;const W=o.map(E=>{E.load>B&&(B=E.load);const S={start:Z(E.s),end:Z(E.e),load:E.load,taskIds:E.taskIds};return E.load>U+tt&&d.push({resource:I,capacity:U,start:S.start,end:S.end,load:E.load,taskIds:E.taskIds.slice()}),S}),V={resource:I,capacity:U,peak:B,segments:W};M.set(I,V),H.push(V)}return H.sort((I,k)=>I.resource<k.resource?-1:I.resource>k.resource?1:0),d.sort((I,k)=>I.start-k.start||(I.resource<k.resource?-1:1)),{ok:!0,resources:H,overAllocations:d,byResource:M}}function C(z){if(!z)return!1;const K=z.constraint??z.constraintType;if(K==null||K==="")return!1;const L=String(K).toLowerCase().replace(/\s+/g,"-");return L==="mso"||L==="must-start-on"||L==="muststarton"||L==="start-on"||L==="mfo"||L==="must-finish-on"||L==="mustfinishon"||L==="finish-on"}function F(z,K){return z?$(z[K])??0:0}function x(z,K,L={}){const X={projectStart:L.projectStart,deadline:L.deadline,calendar:L.calendar,fields:L.fields},Q=L.priorityField||"priority",st=L.maxIterations!=null?L.maxIterations:Math.max(100,z.length*z.length*2),y=j(L.fields),h=z.map(d=>({...d})),P=h.map(d=>String(y(d))),Z=d=>P.indexOf(d);let R=Y(h,K,X);if(!R.ok)return{ok:!1,error:R.error};const rt=new Map;for(const d of R.order){const I=R.tasks.get(d);I&&!I.isSummary&&rt.set(d,I.es)}let M=0;for(;M<st;M+=1){const d=et(h,R,L);if(!d.overAllocations.length)return{ok:!0,resolved:!0,tasks:h,schedule:R,moves:it(rt,R),iterations:M};const I=d.overAllocations.slice().sort((E,S)=>E.start-S.start||S.load-E.load)[0],k=new Map(h.map(E=>[String(y(E)),E])),U=I.taskIds.map(E=>R.tasks.get(E)).filter(Boolean),o=U.filter(E=>!C(k.get(E.id)));if(!o.length)return{ok:!0,resolved:!1,tasks:h,schedule:R,moves:it(rt,R),remaining:d.overAllocations,iterations:M};o.sort((E,S)=>{if(S.totalFloat!==E.totalFloat)return S.totalFloat-E.totalFloat;const m=F(k.get(E.id),Q),N=F(k.get(S.id),Q);return m!==N?m-N:S.es!==E.es?S.es-E.es:Z(S.id)-Z(E.id)});const B=o[0],W=U.filter(E=>E.id!==B.id).map(E=>E.ef).filter(E=>E>B.es+tt),V=W.length?Math.min(...W):B.es+1;if(k.get(B.id).start=V,R=Y(h,K,X),!R.ok)return{ok:!1,error:R.error}}const H=et(h,R,L);return H.overAllocations.length&&dt("gantt-level-unresolved",`[lattice] gantt: resource leveling hit its ${st}-iteration cap with ${H.overAllocations.length} over-allocation(s) unresolved; returning the partial result.`),{ok:!0,resolved:H.overAllocations.length===0,tasks:h,schedule:R,moves:it(rt,R),remaining:H.overAllocations,iterations:M}}function it(z,K){const L=[];for(const X of K.order){const Q=K.tasks.get(X);if(!Q||Q.isSummary)continue;const st=z.get(X);st!=null&&Q.es>st+tt&&L.push({id:X,from:st,to:Q.es,delay:Q.es-st})}return L}}),Tt("packages/modules/gantt/earned-value.js",function(p,pt){"use strict";Object.defineProperty(p,"computeEarnedValue",{enumerable:!0,get:function(){return c}});const dt=pt("packages/modules/gantt/time.js").toDayNumber,at=1e-9;function Y($){if($==null||$==="")return null;const b=typeof $=="number"?$:Number($);return Number.isFinite(b)?b:null}function tt($,b,_){return _-b<=at?$>=_?1:0:$<=b?0:$>=_?1:($-b)/(_-b)}function j($,b,_,q,et){const C=b?Y(b[q]):null,F=C??$.duration,x=b?Y(b[et]):null,it=$.percentComplete==null?0:Math.max(0,Math.min(100,$.percentComplete))/100,z=$.baselineStart!=null||$.baselineEnd!=null,K=$.baselineStart!=null?$.baselineStart:$.es,L=$.baselineEnd!=null?$.baselineEnd:$.ef,X=F*tt(_,K,L),Q=F*it;return{bac:F,pv:X,ev:Q,ac:x,hasBaseline:z}}function J($){const b=$.ac;return{bac:$.bac,pv:$.pv,ev:$.ev,ac:b,sv:$.ev-$.pv,cv:b==null?null:$.ev-b,spi:Math.abs($.pv)<at?null:$.ev/$.pv,cpi:b==null||Math.abs(b)<at?null:$.ev/b}}function c($,b,_={}){if(!b||!b.ok||!b.tasks||!b.order)return{ok:!1,error:{code:"NO_SCHEDULE",message:"earned value needs a successful schedule"}};const q=_.costField||"cost",et=_.actualCostField||"actualCost",C=_.statusDate==null?b.projectFinish:dt(_.statusDate)??b.projectFinish,F=new Map;for(const Q of Array.isArray($)?$:[])Q&&Q.id!=null&&F.set(String(Q.id),Q);const x=()=>({bac:0,pv:0,ev:0,ac:0,acAny:!1,hasBaseline:!1}),it=new Map;for(const Q of b.order)it.set(Q,x());const z=x();for(const Q of b.order){const st=b.tasks.get(Q);if(!st||st.isSummary)continue;const y=j(st,F.get(Q),C,q,et);let h=Q;for(;h!=null&&it.has(h);){const P=it.get(h);P.bac+=y.bac,P.pv+=y.pv,P.ev+=y.ev,y.ac!=null&&(P.ac+=y.ac,P.acAny=!0),y.hasBaseline&&(P.hasBaseline=!0),h=b.tasks.get(h).parent}z.bac+=y.bac,z.pv+=y.pv,z.ev+=y.ev,y.ac!=null&&(z.ac+=y.ac,z.acAny=!0),y.hasBaseline&&(z.hasBaseline=!0)}const K=Q=>J({bac:Q.bac,pv:Q.pv,ev:Q.ev,ac:Q.acAny?Q.ac:null}),L=new Map,X=[];for(const Q of b.order){const st=b.tasks.get(Q),y=it.get(Q),h={id:st.id,name:st.name,isSummary:!!st.isSummary,isMilestone:!!st.isMilestone,percentComplete:st.percentComplete??null,hasBaseline:y.hasBaseline,hasActualCost:y.acAny,...K(y)};L.set(Q,h),X.push(h)}return{ok:!0,statusDate:C,byTask:L,rows:X,project:{hasActualCost:z.acAny,hasBaseline:z.hasBaseline,...K(z)}}}}),Tt("packages/modules/gantt/mspdi.js",function(p,pt){"use strict";Object.defineProperty(p,"parseXml",{enumerable:!0,get:function(){return et}}),Object.defineProperty(p,"importMSPDI",{enumerable:!0,get:function(){return st}}),Object.defineProperty(p,"exportMSPDI",{enumerable:!0,get:function(){return h}});const dt=pt("packages/core/src/internal/util.js").warnOnce,at=pt("packages/modules/gantt/time.js"),Y=at.toDayNumber,tt=at.toISODate,j=Object.freeze({0:"FF",1:"FS",2:"SF",3:"SS"}),J=Object.freeze({FF:0,FS:1,SF:2,SS:3}),c=Object.freeze({1:"as-late-as-possible",2:"must-start-on",3:"must-finish-on"}),$=Object.freeze({ALAP:1,MSO:2,MFO:3});function b(M){return String(M).replace(/&(#x?[0-9a-fA-F]+|lt|gt|amp|quot|apos);/g,(H,d)=>{if(d[0]==="#"){const I=d[1]==="x"||d[1]==="X"?parseInt(d.slice(2),16):parseInt(d.slice(1),10);return Number.isFinite(I)?String.fromCodePoint(I):H}return{lt:"<",gt:">",amp:"&",quot:'"',apos:"'"}[d]??H})}function _(M){return String(M??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function q(M){const H=M.indexOf(":");return H<0?M:M.slice(H+1)}function et(M){const H=String(M);let d=0;const I=[];let k=null;for(;d<H.length;){const U=H.indexOf("<",d);if(U<0)break;if(U>d&&I.length){const N=H.slice(d,U);N.trim()&&(I[I.length-1].text+=b(N))}if(H.startsWith("<?",U)){const N=H.indexOf("?>",U);d=N<0?H.length:N+2;continue}if(H.startsWith("<!--",U)){const N=H.indexOf("-->",U);d=N<0?H.length:N+3;continue}if(H.startsWith("<![CDATA[",U)){const N=H.indexOf("]]>",U);I.length&&(I[I.length-1].text+=H.slice(U+9,N<0?H.length:N)),d=N<0?H.length:N+3;continue}if(H.startsWith("<!",U)){const N=H.indexOf(">",U);d=N<0?H.length:N+1;continue}const o=H.indexOf(">",U);if(o<0)break;let B=H.slice(U+1,o).trim();if(B[0]==="/"){I.pop(),d=o+1;continue}const W=B.endsWith("/");W&&(B=B.slice(0,-1).trim());const V=B.search(/\s/),E=q(V<0?B:B.slice(0,V)),S={};if(V>=0)for(const N of B.slice(V).matchAll(/([\w:.-]+)\s*=\s*"([^"]*)"|([\w:.-]+)\s*=\s*'([^']*)'/g))S[q(N[1]??N[3])]=b(N[2]??N[4]??"");const m={name:E,attrs:S,children:[],text:""};I.length?I[I.length-1].children.push(m):k||(k=m),W||I.push(m),d=o+1}return k}function C(M,H){return M?M.children.find(d=>d.name===H):void 0}function F(M,H){return M?M.children.filter(d=>d.name===H):[]}function x(M,H){const d=C(M,H);return d?d.text.trim():void 0}function it(M){if(!M)return null;const H=String(M).match(/^\d{4}-\d{2}-\d{2}/);return Y(H?H[0]:M)}function z(M,H){return`${tt(M)}T${String(H).padStart(2,"0")}:00:00`}function K(M,H){if(!M)return null;const d=String(M).match(/PT?(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?/);return d?((Number(d[1])||0)+(Number(d[2])||0)/60+(Number(d[3])||0)/3600)/H:null}function L(M,H){return`PT${Math.round((M||0)*H*1e3)/1e3}H0M0S`}function X(M,H){return(Number(M)||0)/(600*H)}function Q(M,H){return Math.round((M||0)*10*60*H)}function st(M,H={}){const d=H.hoursPerDay??8,I=et(M);if(!I||I.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=it(x(I,"StartDate")),U=C(I,"Resources"),o=new Map,B=[];for(const u of F(U,"Resource")){const g=x(u,"UID"),w=x(u,"Name");if(g==null||w==null||w==="")continue;o.set(g,w);const i=x(u,"MaxUnits");B.push({id:w,name:w,capacity:i==null?1:Number(i)})}const W=C(I,"Assignments"),V=new Map;for(const u of F(W,"Assignment")){const g=x(u,"TaskUID"),w=x(u,"ResourceUID"),i=o.get(w);if(g==null||i==null)continue;const l=x(u,"Units");V.has(g)||V.set(g,[]),V.get(g).push({resource:i,units:l==null?1:Number(l)})}const E=C(I,"Tasks"),S=[],m=[],N=new Map,lt=[],wt=[];for(const u of F(E,"Task")){if(x(u,"IsNull")==="1")continue;const g=x(u,"UID");if(g==null||g==="0")continue;const w=g;N.set(g,w);const i=Number(x(u,"OutlineLevel"))||1;for(;lt.length&&lt[lt.length-1].level>=i;)lt.pop();const l=lt.length?lt[lt.length-1].uid:null;lt.push({uid:g,level:i});const n=x(u,"Summary")==="1",t=x(u,"Milestone")==="1",e={id:w,name:x(u,"Name")??w};if(l&&(e.parent=l),t&&(e.milestone=!0),!n&&!t){const G=K(x(u,"Duration"),d);G!=null&&(e.duration=G)}const s=it(x(u,"Start"));!n&&s!=null&&(e.start=s);const a=x(u,"PercentComplete");a!=null&&(e.percentComplete=Number(a));const v=c[Number(x(u,"ConstraintType"))];if(v){e.constraint=v;const G=it(x(u,"ConstraintDate"));G!=null&&(e.constraintDate=G)}const f=C(u,"Baseline");if(f){const G=it(x(f,"Start")),A=it(x(f,"Finish"));G!=null&&(e.baselineStart=G),A!=null&&(e.baselineEnd=A)}const T=V.get(g);T&&T.length&&(e.assignments=T),S.push(e);for(const G of F(u,"PredecessorLink"))wt.push({raw:G,uid:g})}for(const{raw:u,uid:g}of wt){const w=x(u,"PredecessorUID"),i=N.get(w),l=N.get(g);if(i==null||l==null)continue;const n=j[Number(x(u,"Type")??1)]??"FS",t=X(x(u,"LinkLag"),d),e={from:i,to:l,type:n};t&&(e.lag=t),m.push(e)}const ot=y(I),r={ok:!0,tasks:S,dependencies:m,resources:B};return k!=null&&(r.projectStart=k),ot&&(r.calendar=ot),r}function y(M){const H=C(M,"Calendars"),d=F(H,"Calendar"),I=x(M,"CalendarUID"),k=d.find(E=>x(E,"UID")===I)??d[0];if(!k)return null;const U=C(k,"WeekDays"),o=[];let B=!1;for(const E of F(U,"WeekDay")){const S=Number(x(E,"DayType"));S>=1&&S<=7&&(B=!0,x(E,"DayWorking")==="1"&&o.push(S-1))}const W=[],V=C(k,"Exceptions");for(const E of F(V,"Exception")){if(x(E,"DayWorking")==="1")continue;const S=C(E,"TimePeriod"),m=it(x(S,"FromDate")),N=it(x(S,"ToDate"))??m;if(m!=null)for(let lt=m;lt<=N;lt+=1)W.push(lt)}return!B&&!W.length?null:{workdays:B?o:[1,2,3,4,5],holidays:W}}function h(M,H={}){const d=H.hoursPerDay??8,I=Array.isArray(M.tasks)?M.tasks:[],k=Array.isArray(M.dependencies)?M.dependencies:[],U=Array.isArray(M.resources)?M.resources:M.resources&&typeof M.resources=="object"?Object.entries(M.resources).map(([r,u])=>({id:r,name:r,capacity:u})):[],o=M.schedule&&M.schedule.ok?M.schedule:null,B=new Map;I.forEach((r,u)=>{const g=String(r.id);B.set(g,/^\d+$/.test(g)?g:String(u+1))});const W=new Map;for(const r of I){const u=r.parent!=null?String(r.parent):null;u&&(W.has(u)||W.set(u,[]),W.get(u).push(String(r.id)))}const V=r=>W.has(r),E=r=>{let u=1,g=I.find(w=>String(w.id)===r);for(;g&&g.parent!=null;)u+=1,g=I.find(w=>String(w.id)===String(g.parent));return u},S=new Map;for(const r of k){const u=String(r.to);S.has(u)||S.set(u,[]),S.get(u).push(r)}const m=[];m.push('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'),m.push('<Project xmlns="http://schemas.microsoft.com/project">'),m.push(` <Name>${_(H.projectName||"Lattice Gantt export")}</Name>`);const N=M.projectStart!=null?Y(M.projectStart):o?o.projectStart:null;N!=null&&m.push(` <StartDate>${z(N,8)}</StartDate>`);const lt=Z(M.calendar);if(lt&&m.push(" <CalendarUID>1</CalendarUID>"),lt){m.push(" <Calendars>"),m.push(" <Calendar>"),m.push(" <UID>1</UID>"),m.push(" <Name>Standard</Name>"),m.push(" <IsBaseCalendar>1</IsBaseCalendar>"),m.push(" <WeekDays>");for(let r=0;r<=6;r+=1){const u=lt.workdays.includes(r);m.push(" <WeekDay>"),m.push(` <DayType>${r+1}</DayType>`),m.push(` <DayWorking>${u?1:0}</DayWorking>`),m.push(" </WeekDay>")}if(m.push(" </WeekDays>"),lt.holidays.length){m.push(" <Exceptions>");for(const r of lt.holidays)m.push(" <Exception>"),m.push(" <DayWorking>0</DayWorking>"),m.push(` <TimePeriod><FromDate>${z(r,0)}</FromDate><ToDate>${z(r,23)}</ToDate></TimePeriod>`),m.push(" </Exception>");m.push(" </Exceptions>")}m.push(" </Calendar>"),m.push(" </Calendars>")}m.push(" <Tasks>");for(const r of I){const u=String(r.id),g=B.get(u),w=V(u),i=!!r.milestone||!w&&Number(r.duration)===0,l=o?o.tasks.get(u):null;m.push(" <Task>"),m.push(` <UID>${_(g)}</UID>`),m.push(` <ID>${_(g)}</ID>`),m.push(` <Name>${_(r.name!=null?r.name:u)}</Name>`),m.push(` <OutlineLevel>${E(u)}</OutlineLevel>`),m.push(` <Summary>${w?1:0}</Summary>`),m.push(` <Milestone>${i?1:0}</Milestone>`);const n=l?l.duration:r.duration!=null?Number(r.duration):null;n!=null&&m.push(` <Duration>${L(n,d)}</Duration>`),m.push(" <DurationFormat>7</DurationFormat>");const t=l?l.es:r.start!=null?Y(r.start):null,e=l?l.ef:r.end!=null?Y(r.end):t!=null&&n!=null?t+n:null;t!=null&&m.push(` <Start>${z(t,8)}</Start>`),e!=null&&m.push(` <Finish>${z(e,17)}</Finish>`);const s=l?l.percentComplete:r.percentComplete;s!=null&&m.push(` <PercentComplete>${Math.round(Number(s))}</PercentComplete>`);const a=R(r.constraint??r.constraintType);if(a!=null){m.push(` <ConstraintType>${a}</ConstraintType>`);const T=rt(r.constraintDate??r.constraintAt??r.at);T!=null&&m.push(` <ConstraintDate>${z(T,8)}</ConstraintDate>`)}const v=rt(r.baselineStart??(r.baseline&&r.baseline.start)),f=rt(r.baselineEnd??(r.baseline&&r.baseline.end));(v!=null||f!=null)&&(m.push(" <Baseline>"),m.push(" <Number>0</Number>"),v!=null&&m.push(` <Start>${z(v,8)}</Start>`),f!=null&&m.push(` <Finish>${z(f,17)}</Finish>`),v!=null&&f!=null&&m.push(` <Duration>${L(f-v,d)}</Duration>`),m.push(" </Baseline>"));for(const T of S.get(u)||[]){const G=B.get(String(T.from));G!=null&&(m.push(" <PredecessorLink>"),m.push(` <PredecessorUID>${_(G)}</PredecessorUID>`),m.push(` <Type>${J[T.type?String(T.type).toUpperCase():"FS"]??1}</Type>`),T.lag&&(m.push(` <LinkLag>${Q(Number(T.lag),d)}</LinkLag>`),m.push(" <LagFormat>7</LagFormat>")),m.push(" </PredecessorLink>"))}m.push(" </Task>")}m.push(" </Tasks>");const wt=new Map;U.forEach((r,u)=>{const g=String(r.name??r.id??`Resource ${u+1}`);wt.set(g,{uid:String(u+1),capacity:r.capacity??r.maxUnits??1})});const ot=[];for(const r of I)for(const u of P(r))wt.has(u.resource)||wt.set(u.resource,{uid:String(wt.size+1),capacity:1}),ot.push({taskUid:B.get(String(r.id)),resUid:wt.get(u.resource).uid,units:u.units});m.push(" <Resources>");for(const[r,u]of wt)m.push(" <Resource>"),m.push(` <UID>${_(u.uid)}</UID>`),m.push(` <ID>${_(u.uid)}</ID>`),m.push(` <Name>${_(r)}</Name>`),m.push(` <MaxUnits>${Number(u.capacity)}</MaxUnits>`),m.push(" </Resource>");return m.push(" </Resources>"),m.push(" <Assignments>"),ot.forEach((r,u)=>{m.push(" <Assignment>"),m.push(` <UID>${u+1}</UID>`),m.push(` <TaskUID>${_(r.taskUid)}</TaskUID>`),m.push(` <ResourceUID>${_(r.resUid)}</ResourceUID>`),m.push(` <Units>${Number(r.units)}</Units>`),m.push(" </Assignment>")}),m.push(" </Assignments>"),m.push("</Project>"),m.join(`
7
7
  `)}function P(M){if(M&&Array.isArray(M.assignments))return M.assignments.map(I=>{const k=I&&(I.resource??I.name??I.id);if(k==null||k==="")return null;const U=Number(I.units??I.allocation??1);return{resource:String(k),units:Number.isFinite(U)?U:1}}).filter(Boolean);const H=M?M.assignee??M.assignees??M.owner:null;return(Array.isArray(H)?H:H==null||H===""?[]:[H]).map(I=>String(I)).filter(I=>I!=="").map(I=>({resource:I,units:1}))}function Z(M){if(M==null)return null;if(M==="weekends")return{workdays:[1,2,3,4,5],holidays:[]};const H=Array.isArray(M.workdays)&&M.workdays.length?M.workdays.map(Number).filter(I=>I>=0&&I<=6):[1,2,3,4,5],d=(Array.isArray(M.holidays)?M.holidays:[]).map(I=>Y(I)).filter(I=>I!=null);return{workdays:H,holidays:d}}function R(M){if(M==null||M==="")return null;const H=String(M).toLowerCase().replace(/\s+/g,"-"),I={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(M).toUpperCase())?String(M).toUpperCase():null);return I?$[I]:null}function rt(M){return M==null||M===""?null:Y(M)}}),Tt("packages/modules/gantt/workload.js",function(p,pt){"use strict";Object.defineProperty(p,"WORKLOAD_DEFAULTS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(p,"statedHours",{enumerable:!0,get:function(){return q}}),Object.defineProperty(p,"taskContour",{enumerable:!0,get:function(){return et}}),Object.defineProperty(p,"contourTotal",{enumerable:!0,get:function(){return C}}),Object.defineProperty(p,"serializeContour",{enumerable:!0,get:function(){return F}}),Object.defineProperty(p,"contourSpan",{enumerable:!0,get:function(){return x}}),Object.defineProperty(p,"spanDuration",{enumerable:!0,get:function(){return it}}),Object.defineProperty(p,"spreadHours",{enumerable:!0,get:function(){return z}}),Object.defineProperty(p,"setContourBucket",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"retimeContour",{enumerable:!0,get:function(){return L}}),Object.defineProperty(p,"recordWorkingDays",{enumerable:!0,get:function(){return X}}),Object.defineProperty(p,"workloadBuckets",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(p,"computeWorkload",{enumerable:!0,get:function(){return st}}),Object.defineProperty(p,"formatHours",{enumerable:!0,get:function(){return y}});const dt=pt("packages/modules/gantt/resources.js").parseAssignments,at=pt("packages/modules/gantt/schedule.js"),Y=at.EPS,tt=at.taskIdReader,j=pt("packages/modules/gantt/time.js"),J=j.fromDayNumber,c=j.toDayNumber,$=j.toISODate,b=Object.freeze({hoursPerDay:8,height:160,rowHeight:28,decimals:1,totals:!0});function _(h){if(h==null||h===""||typeof h=="boolean")return null;const P=typeof h=="number"?h:Number(h);return Number.isFinite(P)?P:null}function q(h){if(!h||Array.isArray(h.work))return null;const P=_(h.work);return P??_(h.hours)}function et(h){if(!h||!Array.isArray(h.work))return null;const P=[];for(const R of h.work){if(!R||typeof R!="object")continue;const rt=c(R.date),M=_(R.hours);rt==null||M==null||P.push({day:Math.round(rt),hours:M})}P.sort((R,rt)=>R.day-rt.day);const Z=[];for(const R of P){const rt=Z[Z.length-1];rt&&rt.day===R.day?rt.hours+=R.hours:Z.push({day:R.day,hours:R.hours})}return Z}function C(h){return(Array.isArray(h)?h:[]).reduce((P,Z)=>P+(_(Z.hours)??0),0)}function F(h){const P=[];for(const Z of Array.isArray(h)?h:[]){const R=_(Z.hours);if(R==null||!(Math.abs(R)>Y))continue;const rt=$(Z.day);rt!=null&&P.push({date:rt,hours:Math.round(R*1e6)/1e6})}return P}function x(h){const P=(Array.isArray(h)?h:[]).filter(Z=>Math.abs(_(Z.hours)??0)>Y);return P.length?{first:P[0].day,last:P[P.length-1].day}:null}function it(h,P,Z=null){if(!Number.isFinite(h)||!Number.isFinite(P)||P<h)return 0;if(typeof Z!="function")return Math.round(P-h)+1;let R=0;for(let rt=Math.round(h);rt<=Math.round(P);rt+=1)Z(rt)&&(R+=1);return R}function z(h,P){if(!Array.isArray(h)||!h.length)return[];const Z=P/h.length;return h.map(R=>({day:R,hours:Z}))}function K(h,P,Z,R){const rt=(Array.isArray(h)?h:[]).filter(H=>!(H.day>=P.start&&H.day<P.end)),M=Math.abs(R)>Y?z(Z,R):[];return[...rt,...M].sort((H,d)=>H.day-d.day)}function L(h,P,Z){const R=Array.isArray(P)?P:[],rt=Array.isArray(Z)?Z:[];if(!Array.isArray(h)||!R.length||!rt.length)return Array.isArray(h)?h:[];const M=new Map(h.map(k=>[k.day,_(k.hours)??0])),H=R.map(k=>M.get(k)??0),d=H.length,I=[];for(let k=0;k<rt.length;k+=1){const U=H[Math.min(d-1,Math.floor(k*d/rt.length))];Math.abs(U)>Y&&I.push({day:rt[k],hours:U})}return I}function X(h,P=null){const Z=[];if(!h||!Number.isFinite(h.es)||!Number.isFinite(h.ef))return Z;for(let R=Math.floor(h.es);R<Math.ceil(h.ef);R+=1)(typeof P!="function"||P(R))&&Z.push(R);return Z}function Q(h,P,Z){const R=Math.floor(P),rt=Math.ceil(Z),M=[];if(!(rt>R))return M;if(h==="day"){for(let I=R;I<rt;I+=1)M.push({start:I,end:I+1});return M}if(h==="month"||h==="quarter"){const I=J(R);if(!I)return M;let k=Date.UTC(I.getUTCFullYear(),I.getUTCMonth(),1)/864e5;for(;k<rt;){const U=J(k),o=Date.UTC(U.getUTCFullYear(),U.getUTCMonth()+1,1)/864e5;M.push({start:k,end:o}),k=o}return M}const H=J(R);let d=R-(H?H.getUTCDay():0);for(;d<rt;d+=7)M.push({start:d,end:d+7});return M}function st(h,P,Z={}){const R=Array.isArray(Z.buckets)?Z.buckets:[],rt={ok:!1,buckets:[],rows:[],totals:R.map(()=>null),grandTotal:0};if(!P||!P.ok)return rt;const M=_(Z.hoursPerDay)??b.hoursPerDay,H=typeof Z.isWorking=="function"?Z.isWorking:null,d=Z.capacities instanceof Map?Z.capacities:null,I=tt(Z.fields),k=new Map,U=(ot,r,u,g)=>{k.has(ot)||k.set(ot,{days:new Map,tasks:new Map});const w=k.get(ot);w.days.set(r,(w.days.get(r)||0)+u),w.tasks.has(g.id)||w.tasks.set(g.id,{...g,days:new Map});const i=w.tasks.get(g.id);i.days.set(r,(i.days.get(r)||0)+u)},o=new Map;for(const ot of Array.isArray(h)?h:[]){const r=ot?I(ot):null;r!=null&&o.set(String(r),ot)}const B=Array.isArray(h)&&P.order.length===h.length;for(let ot=0;ot<P.order.length;ot+=1){const r=P.order[ot],u=P.tasks.get(r);if(!u||u.isSummary)continue;const g=o.get(r)||(B?h[ot]:null);if(!g)continue;const w=X(u,H),i=et(g);if(!i&&!w.length)continue;const l=dt(g),n=l.length?l:[{resource:null,units:1}],t=n.reduce((s,a)=>s+(_(a.units)??0),0);if(!(t>0))continue;let e;if(i)e=i.filter(s=>Math.abs(s.hours)>Y);else{const s=q(g),a=s??w.length*M*t;if(!(Math.abs(a)>Y))continue;e=z(w,a)}if(e.length)for(const s of n){const a=_(s.units)??0,v=a/t;if(!(Math.abs(v)>0))continue;const f={id:r,name:u.name,units:a,unitsTotal:t,raw:g};for(const T of e)U(s.resource,T.day,T.hours*v,f)}}const W=ot=>{let r=0,u=R.length-1;for(;r<=u;){const g=r+u>>1;if(ot<R[g].start)u=g-1;else if(ot>=R[g].end)r=g+1;else return g}return-1},V=R.map(ot=>{let r=0;for(let u=Math.floor(ot.start);u<Math.ceil(ot.end);u+=1)(!H||H(u))&&(r+=1);return{start:ot.start,end:ot.end,workingDays:r}}),E=ot=>{const r=V.map(()=>0);for(const[u,g]of ot){const w=W(u);w>=0&&(r[w]+=g)}return r},S=[...k.keys()].filter(ot=>ot!=null).sort(),m=k.has(null)?[...S,null]:S,N=[],lt=V.map(()=>0);let wt=0;for(const ot of m){const r=k.get(ot),u=E(r.days),g=ot!=null&&d&&d.has(ot)?d.get(ot):null,w=u.map(t=>Math.abs(t)>Y?t:null),i=u.map((t,e)=>{if(g==null)return!1;const s=g*M*V[e].workingDays;return t>s+Y});let l=0;u.forEach((t,e)=>{l+=t,lt[e]+=t}),wt+=l;const n=[...r.tasks.values()].map(t=>{const e=E(t.days);return{id:t.id,name:t.name,units:t.units,unitsTotal:t.unitsTotal,raw:t.raw,cells:e.map(s=>Math.abs(s)>Y?s:null),total:e.reduce((s,a)=>s+a,0)}});N.push({resource:ot,capacity:g,cells:w,over:i,total:l,tasks:n})}return{ok:!0,buckets:V,rows:N,totals:lt.map(ot=>Math.abs(ot)>Y?ot:null),grandTotal:wt}}function y(h,P){if(h==null||!Number.isFinite(h))return"";const R=10**(Number.isFinite(P)?Math.max(0,Math.min(6,Math.round(P))):1),rt=Math.round(h*R)/R;return Object.is(rt,-0)||rt===0?"0":String(rt)}}),Tt("packages/modules/shared/autosize.js",function(p,pt){"use strict";Object.defineProperty(p,"contentWidth",{enumerable:!0,get:function(){return at}}),Object.defineProperty(p,"contentHeight",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"firstMeasured",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(p,"watchSize",{enumerable:!0,get:function(){return j}}),Object.defineProperty(p,"watchBox",{enumerable:!0,get:function(){return J}});const dt=pt("packages/core/src/internal/util.js").warnOnce;function at(c){if(!c||typeof c!="object")return null;const $=Number(c.clientWidth);if(Number.isFinite($)&&$>0)return $;if(typeof c.getBoundingClientRect=="function"){const b=c.getBoundingClientRect(),_=b&&Number(b.width);if(Number.isFinite(_)&&_>0)return _}return null}function Y(c){if(!c||typeof c!="object")return null;const $=Number(c.clientHeight);if(Number.isFinite($)&&$>0)return $;if(typeof c.getBoundingClientRect=="function"){const b=c.getBoundingClientRect(),_=b&&Number(b.height);if(Number.isFinite(_)&&_>0)return _}return null}function tt(c,$=at){for(const b of c||[]){const _=$(b);if(Number.isFinite(_)&&_>0)return _}return null}function j(c){const $=(c&&Array.isArray(c.targets)?c.targets:[]).filter(Boolean),b=c&&typeof c.read=="function"?c.read:()=>null,_=c&&typeof c.apply=="function"?c.apply:()=>{},q=Number.isFinite(c&&c.epsilon)?Number(c.epsilon):1;let et=null,C=!1;const F=()=>{if(C)return!1;const L=b();if(!Number.isFinite(L)||L<=0||et!=null&&Math.abs(L-et)<q)return!1;et=L,C=!0;try{_(L)}finally{C=!1}return!0};F();const x=$[0],it=c&&c.view||x&&x.ownerDocument&&x.ownerDocument.defaultView||globalThis,z=it&&it.ResizeObserver;let K=null;if(typeof z=="function"&&$.length){K=new z(()=>{F()});for(const L of $)L&&typeof K.observe=="function"&&K.observe(L)}else $.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:F,get applied(){return et},release(){if(K&&typeof K.disconnect=="function")try{K.disconnect()}catch{}K=null}}}function J(c){const $=(c&&Array.isArray(c.targets)?c.targets:[]).filter(Boolean),b=c&&typeof c.read=="function"?c.read:()=>({}),_=c&&typeof c.apply=="function"?c.apply:()=>{},q=Number.isFinite(c&&c.epsilon)?Number(c.epsilon):1;let et=null,C=!1;const F=X=>{if(et==null)return!0;for(const[Q,st]of Object.entries(X)){if(!Number.isFinite(st)||st<=0)continue;const y=et[Q];if(!Number.isFinite(y)||Math.abs(st-y)>=q)return!0}return!1},x=()=>{if(C)return!1;const X=b();if(!X||typeof X!="object"||!Object.values(X).some(st=>Number.isFinite(st)&&st>0)||!F(X))return!1;et={...et,...X},C=!0;try{_(X)}finally{C=!1}return!0};x();const it=$[0],z=c&&c.view||it&&it.ownerDocument&&it.ownerDocument.defaultView||globalThis,K=z&&z.ResizeObserver;let L=null;if(typeof K=="function"&&$.length){L=new K(()=>{x()});for(const X of $)X&&typeof L.observe=="function"&&L.observe(X)}else $.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:x,get applied(){return et},release(){if(L&&typeof L.disconnect=="function")try{L.disconnect()}catch{}L=null}}}}),Tt("packages/modules/shared/axislabels.js",function(p,pt){"use strict";Object.defineProperty(p,"CHAR_RATIO",{enumerable:!0,get:function(){return xt}}),Object.defineProperty(p,"BOLD_FACTOR",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(p,"MIN_GAP",{enumerable:!0,get:function(){return at}}),Object.defineProperty(p,"estimateLabelWidth",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"thinLabels",{enumerable:!0,get:function(){return tt}});const xt=.62,dt=1.05,at=6;function Y(j,J,c=!1){return String(j??"").length*J*xt*(c?dt:1)}function tt(j,J){const c=Number.isFinite(J.gap)?Number(J.gap):at,$=Number.isFinite(J.fontSize)?Number(J.fontSize):11,b=typeof J.measure=="function"?J.measure:F=>Y(F,$,!!J.bold),_=j.filter(F=>F&&Number.isFinite(F.at)).map(F=>({...F,width:b(String(F.text??""))})).sort((F,x)=>F.at-x.at);if(_.length<2)return{every:1,kept:_};const q=F=>{let x=null;for(let it=0;it<_.length;it+=F){const z=_[it];if(x&&z.at-x.at<x.width+c)return!1;x=z}return!0};let et=1;for(;et<_.length&&!q(et);)et++;const C=[];for(let F=0;F<_.length;F+=et)C.push(_[F]);return{every:et,kept:C}}}),Tt("packages/modules/charts/svg.js",function(p,pt){"use strict";Object.defineProperty(p,"SVG_NS",{enumerable:!0,get:function(){return xt}}),Object.defineProperty(p,"el",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(p,"svg",{enumerable:!0,get:function(){return at}}),Object.defineProperty(p,"attr",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"attrs",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(p,"setText",{enumerable:!0,get:function(){return j}}),Object.defineProperty(p,"clear",{enumerable:!0,get:function(){return J}}),Object.defineProperty(p,"append",{enumerable:!0,get:function(){return c}}),Object.defineProperty(p,"path",{enumerable:!0,get:function(){return $}}),Object.defineProperty(p,"ribbonPath",{enumerable:!0,get:function(){return b}}),Object.defineProperty(p,"round",{enumerable:!0,get:function(){return _}}),Object.defineProperty(p,"pathRings",{enumerable:!0,get:function(){return q}}),Object.defineProperty(p,"insideRings",{enumerable:!0,get:function(){return et}});const xt="http://www.w3.org/2000/svg";function dt(C,F,x){const it=C.createElement(F);return x&&it.setAttribute("class",x),it}function at(C,F,x){const it=C.createElementNS(xt,F);if(x)for(const z of Object.keys(x))it.setAttribute(z,String(x[z]));return it}function Y(C,F,x){C&&(x==null?C.removeAttribute(F):C.setAttribute(F,String(x)))}function tt(C,F){if(C)for(const x of Object.keys(F))Y(C,x,F[x])}function j(C,F){C&&(C.textContent=F==null?"":String(F))}function J(C){if(C)for(;C.firstChild;)C.removeChild(C.firstChild)}function c(C,F){for(const x of F)x&&C.appendChild(x);return C}function $(C){return C.join(" ")}function b(C){if(!C||C.length<2)return"";const F=["M",C[0].x,C[0].upper];for(let x=1;x<C.length;x++)F.push("L",C[x].x,C[x].upper);for(let x=C.length-1;x>=0;x--)F.push("L",C[x].x,C[x].lower);return F.push("Z"),$(F)}function _(C){return Math.round(C*100)/100}function q(C){const F=[];let x=[];const it=String(C||"").match(/[A-Za-z]|-?\d*\.?\d+(?:e[-+]?\d+)?/gi)||[];let z="",K=[];const L=()=>{if(!z||!K.length){K=[];return}if(z==="M"||z==="L")for(let X=0;X+1<K.length;X+=2)x.push([K[X],K[X+1]]);else z!=="Z"&&K.length>=2&&x.push([K[K.length-2],K[K.length-1]]);K=[]};for(const X of it){if(/[A-Za-z]/.test(X)){if(L(),X==="Z"||X==="z"){x.length>2&&F.push(x),x=[],z="";continue}X==="M"&&x.length>2&&(F.push(x),x=[]),z=X;continue}K.push(Number(X))}return L(),x.length>2&&F.push(x),F}function et(C,F,x){let it=!1;for(const z of C)for(let K=0,L=z.length-1;K<z.length;L=K++){const[X,Q]=z[K],[st,y]=z[L];Q>x!=y>x&&F<(st-X)*(x-Q)/(y-Q||1e-12)+X&&(it=!it)}return it}}),Tt("packages/modules/charts/scale.js",function(p,pt){"use strict";Object.defineProperty(p,"isNumber",{enumerable:!0,get:function(){return c}}),Object.defineProperty(p,"toNumber",{enumerable:!0,get:function(){return $}}),Object.defineProperty(p,"toTime",{enumerable:!0,get:function(){return b}}),Object.defineProperty(p,"extent",{enumerable:!0,get:function(){return _}}),Object.defineProperty(p,"niceStep",{enumerable:!0,get:function(){return q}}),Object.defineProperty(p,"niceDomain",{enumerable:!0,get:function(){return et}}),Object.defineProperty(p,"measureDomain",{enumerable:!0,get:function(){return C}}),Object.defineProperty(p,"linearTicks",{enumerable:!0,get:function(){return F}}),Object.defineProperty(p,"timeStepFor",{enumerable:!0,get:function(){return x}}),Object.defineProperty(p,"timeTicks",{enumerable:!0,get:function(){return z}}),Object.defineProperty(p,"linearScale",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"timeScale",{enumerable:!0,get:function(){return L}}),Object.defineProperty(p,"key",{enumerable:!0,get:function(){return X}}),Object.defineProperty(p,"bandScale",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(p,"sqrtScale",{enumerable:!0,get:function(){return st}});const xt=[1,2,2.5,5,10],dt=6e4,at=36e5,Y=864e5,tt=365.25*Y,j=[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,Y,2*Y,7*Y,14*Y,30*Y,90*Y,180*Y,...j.map(y=>y*tt)];function c(y){return typeof y=="number"&&Number.isFinite(y)}function $(y){if(y==null||y==="")return null;if(y instanceof Date){const P=y.getTime();return Number.isFinite(P)?P:null}if(typeof y=="boolean")return y?1:0;const h=Number(y);return Number.isFinite(h)?h:null}function b(y){if(y==null||y==="")return null;if(y instanceof Date){const P=y.getTime();return Number.isFinite(P)?P:null}if(typeof y=="number")return Number.isFinite(y)?y:null;const h=Date.parse(String(y));return Number.isFinite(h)?h:null}function _(y){let h=1/0,P=-1/0;for(let Z=0;Z<y.length;Z++){const R=y[Z];c(R)&&(R<h&&(h=R),R>P&&(P=R))}return h===1/0?null:{min:h,max:P}}function q(y){if(!(y>0))return 1;const h=10**Math.floor(Math.log10(y));for(const P of xt)if(y<=P*h)return P*h;return 10*h}function et(y,h=5){const P=q((y.max-y.min)/Math.max(1,h));return{min:Math.floor(y.min/P)*P,max:Math.ceil(y.max/P)*P,step:P}}function C(y,h={}){const P=_(y)||{min:0,max:1};let{min:Z,max:R}=P;if(h.zero&&(Z>0&&(Z=0),R<0&&(R=0)),Z===R){const rt=Math.abs(Z)>0?Math.abs(Z)/10:1;Z-=rt,R+=rt}if(h.nice!==!1){const rt=et({min:Z,max:R},h.ticks||5);Z=rt.min,R=rt.max}return c(h.min)&&(Z=h.min),c(h.max)&&(R=h.max),Z===R&&(R=Z+1),{min:Z,max:R}}function F(y,h=5){const P=q((y.max-y.min)/Math.max(1,h)),Z=Math.ceil(y.min/P),R=Math.floor(y.max/P),rt=[];for(let M=Z;M<=R;M++){const H=M*P;rt.push(Math.abs(H)<P/1e6?0:Number(H.toPrecision(12)))}return rt}function x(y,h=5){const P=Math.max(1,h),Z=y/P;let R=J[J.length-1];for(const H of J)if(H>=Z){R=H;break}if(R<tt)return R;let rt=R,M=Math.abs(y/R-P);for(const H of J){if(H<tt)continue;const d=Math.abs(y/H-P);d<M&&(M=d,rt=H)}return rt}function it(y,h){const P=new Date(y.min).getUTCFullYear();let Z=Math.ceil(P/h)*h;Date.UTC(Z,0,1)<y.min&&(Z+=h);const R=[];for(;Date.UTC(Z,0,1)<=y.max;Z+=h)R.push(Date.UTC(Z,0,1));return R}function z(y,h=5){const P=x(y.max-y.min,h);if(P>=tt)return it(y,Math.round(P/tt));const Z=[],R=Math.ceil(y.min/P)*P;for(let rt=R;rt<=y.max;rt+=P)Z.push(rt);return Z}function K(y,h){const P=y.max-y.min||1,[Z,R]=h;return{kind:"linear",domain:y,range:h,of(rt){return Z+(rt-y.min)/P*(R-Z)},invert(rt){return y.min+(rt-Z)/(R-Z||1)*P},ticks(rt=5){return F(y,rt)}}}function L(y,h){return{...K(y,h),kind:"time",ticks(Z=5){return z(y,Z)}}}function X(y){if(y==null)return" null";if(y instanceof Date)return` date:${y.getTime()}`;if(typeof y=="object"){const h=y,P=h.id??h.key??h.value;return P!==void 0&&typeof P!="object"?` obj:${String(P)}`:` obj:${String(y)}`}return String(y)}function Q(y,h,P=.2){const Z=Math.min(.9,Math.max(0,P)),[R,rt]=h,M=new Map;for(let I=0;I<y.length;I++){const k=X(y[I]);M.has(k)||M.set(k,I)}const H=y.length?(rt-R)/y.length:rt-R,d=Math.max(0,H*(1-Z));return{kind:"band",domain:y,range:h,bandwidth:d,step:H,of(I){const k=M.get(X(I));return k===void 0?NaN:R+k*H+(H-d)/2},centre(I){const k=this.of(I);return Number.isNaN(k)?NaN:k+d/2},ticks(){return y}}}function st(y,h){const[P,Z]=h,R=Math.max(Math.abs(y.max),Math.abs(y.min),0)||1;return{kind:"sqrt",domain:y,range:h,of(rt){const M=Math.sqrt(Math.abs(rt)/R);return P+M*(Z-P)}}}}),Tt("packages/modules/gantt/links.js",function(p,pt){"use strict";Object.defineProperty(p,"LINK_SIDES",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"linkSides",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(p,"routeLink",{enumerable:!0,get:function(){return j}}),Object.defineProperty(p,"arrowheadPath",{enumerable:!0,get:function(){return J}});const xt=pt("packages/modules/charts/svg.js"),dt=xt.path,at=xt.round,Y=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(c){return Y[String(c||"FS").toUpperCase()]||Y.FS}function j(c){const $=Number(c.sx),b=Number(c.sy),_=Number(c.ex),q=Number(c.ey),et=Number.isFinite(c.elbow)&&c.elbow>0?Number(c.elbow):8,C=Number.isFinite(c.rowGap)&&c.rowGap>0?Number(c.rowGap):et,F=tt(c.type),x=-F.arrive,it=Math.abs(q-b)<.5,z=(_-$)*x;if(it&&z>0)return{d:dt(["M",at($),at(b),"H",at(_)]),arrowDir:x,route:"straight"};if(z>=0)return{d:dt(["M",at($),at(b),"V",at(q),"H",at(_)]),arrowDir:x,route:"drop"};const K=it?b+C:(b+q)/2,L=$+F.depart*et,X=_+F.arrive*et;return{d:dt(["M",at($),at(b),"H",at(L),"V",at(K),"H",at(X),"V",at(q),"H",at(_)]),arrowDir:x,route:"detour"}}function J(c,$,b,_=4){return dt(["M",at(c),at($),"L",at(c-b*_),at($-_),"L",at(c-b*_),at($+_),"Z"])}}),Tt("packages/modules/gantt/messages.js",function(p,pt){"use strict";Object.defineProperty(p,"FALLBACK_EN",{enumerable:!0,get:function(){return at}}),Object.defineProperty(p,"createTranslator",{enumerable:!0,get:function(){return Y}});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 Y(tt,j){return function(c,$){const b=dt(j)?j():null,_=tt&&tt.grid,q=b&&dt(b.t)&&b||_&&_.messages&&dt(_.messages.t)&&_.messages||null;if(q){let C;try{C=q.t(c,$)}catch{C=null}if(typeof C=="string"&&C&&C!==c)return C}const et=at[c];return et?et.replace(/\{(\w+)\}/g,(C,F)=>$&&F in $?String($[F]):C):c}}}),Tt("packages/modules/gantt/gestures.js",function(p,pt){"use strict";Object.defineProperty(p,"describeTask",{enumerable:!0,get:function(){return at}}),Object.defineProperty(p,"GanttGestures",{enumerable:!0,get:function(){return Y}});const dt=pt("packages/modules/charts/svg.js").round;function at(tt,j){const J=tt.isSummary?"summary":tt.isMilestone?"milestone":"task",c=j.dateAxis===!1?`day ${dt(tt.es)} to ${dt(tt.ef)}`:`${j.iso(tt.es)} to ${j.iso(tt.ef)}`,$=[`${tt.name}, ${J}`,c];return tt.isMilestone||$.push(`${dt(tt.duration)} days`),tt.percentComplete!=null&&$.push(`${Math.round(tt.percentComplete)}% complete`),$.push(`slack ${dt(tt.totalFloat)} days`),tt.critical&&$.push("on the critical path"),$.join(", ")}class Y{#n;#r=null;#t=null;#e=null;constructor(j){this.#n=j}#o(){return this.#n.options()||{}}get dragging(){return this.#r!==null}#s(){const j=this.#n.plot();if(j&&typeof j.getScreenCTM=="function"){let c=null;try{c=j.getScreenCTM()}catch{c=null}if(c&&Number.isFinite(c.a)&&c.a>0)return{scale:c.a,origin:Number.isFinite(c.e)?c.e:0}}const J=j&&j.getBoundingClientRect?j.getBoundingClientRect():null;return{scale:1,origin:J&&J.left||0}}#u(j){const{scale:J,origin:c}=this.#s();return((j.clientX||0)-c)/J}#a(j){const{scale:J}=this.#s();return Math.round(j/J/(this.#n.pxPerDay()||1))}onPointerDown(j){const J=this.#n.controller.schedule;if(!J||!J.ok)return;const c=this.#n.rowOf(j.target);if(!c)return;const $=c.getAttribute("data-task"),b=J.tasks.get($);if(!b||b.isSummary)return;const _=this.#n.barOf(c);if(!_)return;const q=this.#u(j),et=Number.isFinite(this.#o().resizeZone)?Number(this.#o().resizeZone):6,C=!b.isMilestone&&q>=this.#y(_)-et?"resize":"move";this.#r={id:$,mode:C,startX:j.clientX||0,origStart:b.es,origDuration:b.duration,barEl:_},j.preventDefault&&j.preventDefault();const F=it=>this.#i(it),x=it=>this.#N(it);this.#t={move:F,up:x},this.#n.doc.addEventListener("pointermove",F),this.#n.doc.addEventListener("pointerup",x)}#y(j){const J=parseFloat(j.getAttribute("x")),c=parseFloat(j.getAttribute("width"));return Number.isFinite(J)&&Number.isFinite(c)?J+c:Number.POSITIVE_INFINITY}#i(j){if(!this.#r)return;const J=this.#n.pxPerDay()||1,c=this.#a((j.clientX||0)-this.#r.startX),$=this.#r.barEl;if(this.#r.mode==="move")$.getAttribute("d")?this.#x($,c*J):($.setAttribute("x",dt(parseFloat($.getAttribute("x"))+c*J-this.#c($))),this.#w($,c*J));else{const b=Math.max(1,parseFloat($.getAttribute("width"))+(c*J-this.#c($)));$.setAttribute("width",dt(b)),this.#w($,c*J)}}#c(j){return parseFloat(j.getAttribute("data-preview")||"0")}#w(j,J){j.setAttribute("data-preview",String(J))}#x(j,J){const c=this.#c(j),$=j.getAttribute("d").split(" ");for(let b=1;b<$.length;b+=1){const _=parseFloat($[b]);!Number.isNaN(_)&&b%3===1&&($[b]=String(dt(_+(J-c))))}j.setAttribute("d",$.join(" ")),this.#w(j,J)}#N(j){const J=this.#r;if(this.#g(),this.#r=null,!J)return;const c=this.#a((j.clientX||0)-J.startX);if(c===0){this.#n.redraw();return}J.mode==="move"?this.#n.controller.applyEdit({id:J.id,start:J.origStart+c},{writeBack:!0}):this.#n.controller.applyEdit({id:J.id,duration:Math.max(0,J.origDuration+c)},{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(j){const J=this.#n.controller,c=J.schedule;if(!c||!c.ok)return;const $=this.#n.rowOf(j.target),b=$?$.getAttribute("data-task"):null,_=b?c.tasks.get(b):null;if(!_)return;const q=this.#o(),et=Number.isFinite(q.moveStep)?Number(q.moveStep):1,C=j.key,F=this.#n.t;if(C==="ArrowRight"||C==="ArrowLeft"){if(_.isSummary)return;const x=C==="ArrowRight"?1:-1;if(this.#n.focusTask(b),j.shiftKey){if(_.isMilestone)return;const it=Math.max(0,_.duration+x*et);J.applyEdit({id:b,duration:it},{writeBack:!0}),this.#n.announce(F("gantt.a11y.resized",{name:_.name,days:it}))}else{const it=_.es+x*et,z=q.dateAxis===!1?F("gantt.a11y.day",{day:it}):this.#n.iso(it);J.applyEdit({id:b,start:it},{writeBack:!0}),this.#n.announce(F("gantt.a11y.moved",{name:_.name,date:z}))}j.preventDefault&&j.preventDefault()}else if(C==="l"||C==="L"){if(_.isSummary)return;if(!this.#e)this.#e=b,this.#n.announce(F("gantt.a11y.linkFrom",{name:_.name}));else if(this.#e!==b){const x=this.#e;this.#e=null,this.#n.focusTask(b),J.setDependencies([...J.dependencies,{from:x,to:b,type:"FS"}]),this.#n.announce(F("gantt.a11y.linked",{from:x,to:_.name}))}j.preventDefault&&j.preventDefault()}else if(C==="Delete"||C==="Backspace"){if(_.isSummary)return;J.deleteTask(b),this.#n.announce(F("gantt.a11y.deleted",{name:_.name})),j.preventDefault&&j.preventDefault()}else C==="Escape"&&this.#e&&(this.#e=null,this.#n.announce(F("gantt.a11y.linkCancelled")))}destroy(){this.#g(),this.#r=null,this.#e=null}}}),Tt("packages/modules/gantt/render.js",function(p,pt){"use strict";Object.defineProperty(p,"NS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(p,"GanttView",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(p,"mountGantt",{enumerable:!0,get:function(){return wt}});const dt=pt("packages/core/src/internal/util.js").warnOnce,at=pt("packages/modules/shared/autosize.js"),Y=at.contentWidth,tt=at.firstMeasured,j=at.watchSize,c=pt("packages/modules/shared/axislabels.js").thinLabels,$=pt("packages/modules/charts/svg.js"),b=$.svg,_=$.el,q=$.setText,et=$.path,C=$.round,x=pt("packages/modules/charts/scale.js").linearScale,it=pt("packages/modules/gantt/time.js"),z=it.toISODate,K=it.fromDayNumber,L=it.toDayNumber,X=it.resolveProjectEpoch,Q=pt("packages/modules/gantt/links.js"),st=Q.routeLink,y=Q.arrowheadPath,P=pt("packages/modules/gantt/schedule.js").EPS,Z=pt("packages/modules/gantt/messages.js"),R=Z.createTranslator,rt=pt("packages/modules/gantt/gestures.js"),M=rt.GanttGestures,H=rt.describeTask;Object.defineProperty(p,"FALLBACK_EN",{enumerable:!0,get:function(){return Z.FALLBACK_EN}});const d="lat-gantt",I="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
  .${d}{font:12px/1.4 system-ui,sans-serif;color:var(--lattice-foreground,#1f2933);overflow:auto}
9
9
  .${d}__plot{max-width:100%;height:auto;display:block}