@toclocoinc/lattice-grid 1.89.0 → 1.89.1

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 (310) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +1 -1
  3. package/angular/package.json +1 -1
  4. package/docs/API.html +5 -5
  5. package/docs/THEMING.md +27 -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/calendar.html +1 -1
  10. package/docs/api/charts.html +1 -1
  11. package/docs/api/dashboard.html +1 -1
  12. package/docs/api/data-router.html +1 -1
  13. package/docs/api/deckgl.html +1 -1
  14. package/docs/api/designer.html +2 -2
  15. package/docs/api/gantt.html +1 -1
  16. package/docs/api/geometry.html +1 -1
  17. package/docs/api/grid.html +2 -2
  18. package/docs/api/index.html +1 -1
  19. package/docs/api/kanban.html +1 -1
  20. package/docs/api/kpi.html +1 -1
  21. package/docs/api/layout.html +1 -1
  22. package/docs/api/leaflet.html +1 -1
  23. package/docs/api/list.html +1 -1
  24. package/docs/api/mapview.html +1 -1
  25. package/docs/api/mock-socket.html +1 -1
  26. package/docs/api/presets.html +1 -1
  27. package/docs/api/tabs.html +1 -1
  28. package/docs/api/types.html +1 -1
  29. package/docs/api-detail.html +4 -4
  30. package/docs/warnings.json +1 -1
  31. package/lattice-grid.d.ts +1 -1
  32. package/lattice-grid.esm.min.js +3 -3
  33. package/lattice-grid.min.cjs +3 -3
  34. package/lattice-grid.min.css +1 -1
  35. package/lattice-grid.min.js +3 -3
  36. package/modules/ai.d.ts +1 -1
  37. package/modules/ai.esm.min.js +2 -2
  38. package/modules/ai.min.cjs +2 -2
  39. package/modules/ai.min.js +2 -2
  40. package/modules/alarms.d.ts +1 -1
  41. package/modules/alarms.esm.min.js +2 -2
  42. package/modules/alarms.min.cjs +2 -2
  43. package/modules/alarms.min.js +2 -2
  44. package/modules/angular.d.ts +1 -1
  45. package/modules/angular.esm.min.js +2 -2
  46. package/modules/angular.min.cjs +2 -2
  47. package/modules/angular.min.js +2 -2
  48. package/modules/calendar.d.ts +1 -1
  49. package/modules/calendar.esm.min.js +2 -2
  50. package/modules/calendar.min.cjs +2 -2
  51. package/modules/calendar.min.js +2 -2
  52. package/modules/chart-alluvial.d.ts +1 -1
  53. package/modules/chart-alluvial.esm.min.js +1 -1
  54. package/modules/chart-alluvial.min.cjs +1 -1
  55. package/modules/chart-alluvial.min.js +1 -1
  56. package/modules/chart-arc.d.ts +1 -1
  57. package/modules/chart-arc.esm.min.js +1 -1
  58. package/modules/chart-arc.min.cjs +1 -1
  59. package/modules/chart-arc.min.js +1 -1
  60. package/modules/chart-barrace.d.ts +1 -1
  61. package/modules/chart-barrace.esm.min.js +1 -1
  62. package/modules/chart-barrace.min.cjs +1 -1
  63. package/modules/chart-barrace.min.js +1 -1
  64. package/modules/chart-bubblemap.d.ts +1 -1
  65. package/modules/chart-bubblemap.esm.min.js +1 -1
  66. package/modules/chart-bubblemap.min.cjs +1 -1
  67. package/modules/chart-bubblemap.min.js +1 -1
  68. package/modules/chart-bump.d.ts +1 -1
  69. package/modules/chart-bump.esm.min.js +1 -1
  70. package/modules/chart-bump.min.cjs +1 -1
  71. package/modules/chart-bump.min.js +1 -1
  72. package/modules/chart-calendar.d.ts +1 -1
  73. package/modules/chart-calendar.esm.min.js +1 -1
  74. package/modules/chart-calendar.min.cjs +1 -1
  75. package/modules/chart-calendar.min.js +1 -1
  76. package/modules/chart-choropleth.d.ts +1 -1
  77. package/modules/chart-choropleth.esm.min.js +1 -1
  78. package/modules/chart-choropleth.min.cjs +1 -1
  79. package/modules/chart-choropleth.min.js +1 -1
  80. package/modules/chart-decomposition.d.ts +1 -1
  81. package/modules/chart-decomposition.esm.min.js +1 -1
  82. package/modules/chart-decomposition.min.cjs +1 -1
  83. package/modules/chart-decomposition.min.js +1 -1
  84. package/modules/chart-diverging.d.ts +1 -1
  85. package/modules/chart-diverging.esm.min.js +1 -1
  86. package/modules/chart-diverging.min.cjs +1 -1
  87. package/modules/chart-diverging.min.js +1 -1
  88. package/modules/chart-dumbbell.d.ts +1 -1
  89. package/modules/chart-dumbbell.esm.min.js +1 -1
  90. package/modules/chart-dumbbell.min.cjs +1 -1
  91. package/modules/chart-dumbbell.min.js +1 -1
  92. package/modules/chart-fan.d.ts +1 -1
  93. package/modules/chart-fan.esm.min.js +1 -1
  94. package/modules/chart-fan.min.cjs +1 -1
  95. package/modules/chart-fan.min.js +1 -1
  96. package/modules/chart-forcetree.d.ts +1 -1
  97. package/modules/chart-forcetree.esm.min.js +1 -1
  98. package/modules/chart-forcetree.min.cjs +1 -1
  99. package/modules/chart-forcetree.min.js +1 -1
  100. package/modules/chart-hexbin.d.ts +1 -1
  101. package/modules/chart-hexbin.esm.min.js +1 -1
  102. package/modules/chart-hexbin.min.cjs +1 -1
  103. package/modules/chart-hexbin.min.js +1 -1
  104. package/modules/chart-hexmap.d.ts +1 -1
  105. package/modules/chart-hexmap.esm.min.js +1 -1
  106. package/modules/chart-hexmap.min.cjs +1 -1
  107. package/modules/chart-hexmap.min.js +1 -1
  108. package/modules/chart-icicle.d.ts +1 -1
  109. package/modules/chart-icicle.esm.min.js +1 -1
  110. package/modules/chart-icicle.min.cjs +1 -1
  111. package/modules/chart-icicle.min.js +1 -1
  112. package/modules/chart-markermap.d.ts +1 -1
  113. package/modules/chart-markermap.esm.min.js +1 -1
  114. package/modules/chart-markermap.min.cjs +1 -1
  115. package/modules/chart-markermap.min.js +1 -1
  116. package/modules/chart-motion.d.ts +1 -1
  117. package/modules/chart-motion.esm.min.js +1 -1
  118. package/modules/chart-motion.min.cjs +1 -1
  119. package/modules/chart-motion.min.js +1 -1
  120. package/modules/chart-pack.d.ts +1 -1
  121. package/modules/chart-pack.esm.min.js +1 -1
  122. package/modules/chart-pack.min.cjs +1 -1
  123. package/modules/chart-pack.min.js +1 -1
  124. package/modules/chart-parallel.d.ts +1 -1
  125. package/modules/chart-parallel.esm.min.js +1 -1
  126. package/modules/chart-parallel.min.cjs +1 -1
  127. package/modules/chart-parallel.min.js +1 -1
  128. package/modules/chart-pictorial.d.ts +1 -1
  129. package/modules/chart-pictorial.esm.min.js +1 -1
  130. package/modules/chart-pictorial.min.cjs +1 -1
  131. package/modules/chart-pictorial.min.js +1 -1
  132. package/modules/chart-polararea.d.ts +1 -1
  133. package/modules/chart-polararea.esm.min.js +1 -1
  134. package/modules/chart-polararea.min.cjs +1 -1
  135. package/modules/chart-polararea.min.js +1 -1
  136. package/modules/chart-polarscatter.d.ts +1 -1
  137. package/modules/chart-polarscatter.esm.min.js +1 -1
  138. package/modules/chart-polarscatter.min.cjs +1 -1
  139. package/modules/chart-polarscatter.min.js +1 -1
  140. package/modules/chart-pyramid.d.ts +1 -1
  141. package/modules/chart-pyramid.esm.min.js +1 -1
  142. package/modules/chart-pyramid.min.cjs +1 -1
  143. package/modules/chart-pyramid.min.js +1 -1
  144. package/modules/chart-radialbar.d.ts +1 -1
  145. package/modules/chart-radialbar.esm.min.js +1 -1
  146. package/modules/chart-radialbar.min.cjs +1 -1
  147. package/modules/chart-radialbar.min.js +1 -1
  148. package/modules/chart-ridgeline.d.ts +1 -1
  149. package/modules/chart-ridgeline.esm.min.js +1 -1
  150. package/modules/chart-ridgeline.min.cjs +1 -1
  151. package/modules/chart-ridgeline.min.js +1 -1
  152. package/modules/chart-roc.d.ts +1 -1
  153. package/modules/chart-roc.esm.min.js +1 -1
  154. package/modules/chart-roc.min.cjs +1 -1
  155. package/modules/chart-roc.min.js +1 -1
  156. package/modules/chart-serpentine.d.ts +1 -1
  157. package/modules/chart-serpentine.esm.min.js +1 -1
  158. package/modules/chart-serpentine.min.cjs +1 -1
  159. package/modules/chart-serpentine.min.js +1 -1
  160. package/modules/chart-slope.d.ts +1 -1
  161. package/modules/chart-slope.esm.min.js +1 -1
  162. package/modules/chart-slope.min.cjs +1 -1
  163. package/modules/chart-slope.min.js +1 -1
  164. package/modules/chart-spiral.d.ts +1 -1
  165. package/modules/chart-spiral.esm.min.js +1 -1
  166. package/modules/chart-spiral.min.cjs +1 -1
  167. package/modules/chart-spiral.min.js +1 -1
  168. package/modules/chart-splom.d.ts +1 -1
  169. package/modules/chart-splom.esm.min.js +1 -1
  170. package/modules/chart-splom.min.cjs +1 -1
  171. package/modules/chart-splom.min.js +1 -1
  172. package/modules/chart-tree.d.ts +1 -1
  173. package/modules/chart-tree.esm.min.js +1 -1
  174. package/modules/chart-tree.min.cjs +1 -1
  175. package/modules/chart-tree.min.js +1 -1
  176. package/modules/chart-venn.d.ts +1 -1
  177. package/modules/chart-venn.esm.min.js +1 -1
  178. package/modules/chart-venn.min.cjs +1 -1
  179. package/modules/chart-venn.min.js +1 -1
  180. package/modules/chart-voronoi.d.ts +1 -1
  181. package/modules/chart-voronoi.esm.min.js +1 -1
  182. package/modules/chart-voronoi.min.cjs +1 -1
  183. package/modules/chart-voronoi.min.js +1 -1
  184. package/modules/chart-waffle.d.ts +1 -1
  185. package/modules/chart-waffle.esm.min.js +1 -1
  186. package/modules/chart-waffle.min.cjs +1 -1
  187. package/modules/chart-waffle.min.js +1 -1
  188. package/modules/chart-wordcloud.d.ts +1 -1
  189. package/modules/chart-wordcloud.esm.min.js +1 -1
  190. package/modules/chart-wordcloud.min.cjs +1 -1
  191. package/modules/chart-wordcloud.min.js +1 -1
  192. package/modules/charts.d.ts +1 -1
  193. package/modules/charts.esm.min.js +2 -2
  194. package/modules/charts.min.cjs +2 -2
  195. package/modules/charts.min.js +2 -2
  196. package/modules/dashboard.d.ts +1 -1
  197. package/modules/dashboard.esm.min.js +2 -2
  198. package/modules/dashboard.min.cjs +2 -2
  199. package/modules/dashboard.min.js +2 -2
  200. package/modules/data-router.d.ts +1 -1
  201. package/modules/data-router.esm.min.js +2 -2
  202. package/modules/data-router.min.cjs +2 -2
  203. package/modules/data-router.min.js +2 -2
  204. package/modules/deckgl.d.ts +1 -1
  205. package/modules/deckgl.esm.min.js +2 -2
  206. package/modules/deckgl.min.cjs +2 -2
  207. package/modules/deckgl.min.js +2 -2
  208. package/modules/designer.d.ts +1 -1
  209. package/modules/designer.esm.min.js +187 -73
  210. package/modules/designer.esm.min.js.map +2 -2
  211. package/modules/designer.min.cjs +187 -73
  212. package/modules/designer.min.js +187 -73
  213. package/modules/designer.min.js.map +2 -2
  214. package/modules/devtools.d.ts +1 -1
  215. package/modules/devtools.esm.min.js +1 -1
  216. package/modules/devtools.min.cjs +1 -1
  217. package/modules/devtools.min.js +1 -1
  218. package/modules/dhtmlx-compat.d.ts +1 -1
  219. package/modules/dhtmlx-compat.esm.min.js +2 -2
  220. package/modules/dhtmlx-compat.min.cjs +2 -2
  221. package/modules/dhtmlx-compat.min.js +2 -2
  222. package/modules/gantt.d.ts +1 -1
  223. package/modules/gantt.esm.min.js +2 -2
  224. package/modules/gantt.min.cjs +2 -2
  225. package/modules/gantt.min.js +2 -2
  226. package/modules/geo-europe-nuts.d.ts +1 -1
  227. package/modules/geo-europe-nuts.esm.min.js +1 -1
  228. package/modules/geo-europe-nuts.min.cjs +1 -1
  229. package/modules/geo-europe-nuts.min.js +1 -1
  230. package/modules/geo-uk.d.ts +1 -1
  231. package/modules/geo-uk.esm.min.js +1 -1
  232. package/modules/geo-uk.min.cjs +1 -1
  233. package/modules/geo-uk.min.js +1 -1
  234. package/modules/geo-us-states.d.ts +1 -1
  235. package/modules/geo-us-states.esm.min.js +1 -1
  236. package/modules/geo-us-states.min.cjs +1 -1
  237. package/modules/geo-us-states.min.js +1 -1
  238. package/modules/geo-world-110m.d.ts +1 -1
  239. package/modules/geo-world-110m.esm.min.js +1 -1
  240. package/modules/geo-world-110m.min.cjs +1 -1
  241. package/modules/geo-world-110m.min.js +1 -1
  242. package/modules/geo-world-50m.d.ts +1 -1
  243. package/modules/geo-world-50m.esm.min.js +1 -1
  244. package/modules/geo-world-50m.min.cjs +1 -1
  245. package/modules/geo-world-50m.min.js +1 -1
  246. package/modules/geometry.d.ts +1 -1
  247. package/modules/geometry.esm.min.js +2 -2
  248. package/modules/geometry.min.cjs +2 -2
  249. package/modules/geometry.min.js +2 -2
  250. package/modules/htmx.d.ts +1 -1
  251. package/modules/htmx.esm.min.js +3 -3
  252. package/modules/htmx.min.cjs +3 -3
  253. package/modules/htmx.min.js +3 -3
  254. package/modules/kanban.d.ts +1 -1
  255. package/modules/kanban.esm.min.js +2 -2
  256. package/modules/kanban.min.cjs +2 -2
  257. package/modules/kanban.min.js +2 -2
  258. package/modules/kpi.d.ts +1 -1
  259. package/modules/kpi.esm.min.js +2 -2
  260. package/modules/kpi.min.cjs +2 -2
  261. package/modules/kpi.min.js +2 -2
  262. package/modules/layout.d.ts +1 -1
  263. package/modules/layout.esm.min.js +2 -2
  264. package/modules/layout.min.cjs +2 -2
  265. package/modules/layout.min.js +2 -2
  266. package/modules/leaflet.d.ts +1 -1
  267. package/modules/leaflet.esm.min.js +2 -2
  268. package/modules/leaflet.min.cjs +2 -2
  269. package/modules/leaflet.min.js +2 -2
  270. package/modules/list.d.ts +1 -1
  271. package/modules/list.esm.min.js +2 -2
  272. package/modules/list.min.cjs +2 -2
  273. package/modules/list.min.js +2 -2
  274. package/modules/mapview.d.ts +1 -1
  275. package/modules/mapview.esm.min.js +2 -2
  276. package/modules/mapview.min.cjs +2 -2
  277. package/modules/mapview.min.js +2 -2
  278. package/modules/mock-socket.d.ts +1 -1
  279. package/modules/mock-socket.esm.min.js +1 -1
  280. package/modules/mock-socket.min.cjs +1 -1
  281. package/modules/mock-socket.min.js +1 -1
  282. package/modules/presets/antd5.css +9 -0
  283. package/modules/presets/bootstrap5.css +9 -0
  284. package/modules/presets/fluent2.css +9 -0
  285. package/modules/presets/material3.css +9 -0
  286. package/modules/presets.d.ts +1 -1
  287. package/modules/presets.esm.min.js +2 -2
  288. package/modules/presets.min.cjs +2 -2
  289. package/modules/presets.min.js +2 -2
  290. package/modules/react.d.ts +1 -1
  291. package/modules/react.esm.min.js +2 -2
  292. package/modules/react.min.cjs +2 -2
  293. package/modules/react.min.js +2 -2
  294. package/modules/svelte.d.ts +1 -1
  295. package/modules/svelte.esm.min.js +2 -2
  296. package/modules/svelte.min.cjs +2 -2
  297. package/modules/svelte.min.js +2 -2
  298. package/modules/tabs.d.ts +1 -1
  299. package/modules/tabs.esm.min.js +2 -2
  300. package/modules/tabs.min.cjs +2 -2
  301. package/modules/tabs.min.js +2 -2
  302. package/modules/vue.d.ts +1 -1
  303. package/modules/vue.esm.min.js +2 -2
  304. package/modules/vue.min.cjs +2 -2
  305. package/modules/vue.min.js +2 -2
  306. package/modules/webcomponent.d.ts +1 -1
  307. package/modules/webcomponent.esm.min.js +3 -3
  308. package/modules/webcomponent.min.cjs +3 -3
  309. package/modules/webcomponent.min.js +3 -3
  310. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
1
  /*!
2
- * Lattice Grid 1.89.0, gantt module
2
+ * Lattice Grid 1.89.1, gantt module
3
3
  * Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
4
4
  * https://latticegrid.dev
5
5
  */
6
- var Nn=Object.create(null),jn=Object.create(null);function oe(f,ut){Nn[f]=ut}function Ln(f){var ut=jn[f];if(ut)return ut;var Pt=Object.create(null);jn[f]=Pt;var tt=Nn[f];if(!tt)throw new Error("[lattice] missing module: "+f);return tt(Pt,Ln),Pt}oe("packages/core/src/internal/util.js",function(f,ut){"use strict";Object.defineProperty(f,"VERSION",{enumerable:!0,get:function(){return at}}),Object.defineProperty(f,"reportedWarnings",{enumerable:!0,get:function(){return $}}),Object.defineProperty(f,"warnOnce",{enumerable:!0,get:function(){return _}}),Object.defineProperty(f,"infoOnce",{enumerable:!0,get:function(){return S}}),Object.defineProperty(f,"resetWarnings",{enumerable:!0,get:function(){return b}}),Object.defineProperty(f,"fail",{enumerable:!0,get:function(){return y}}),Object.defineProperty(f,"invariant",{enumerable:!0,get:function(){return g}}),Object.defineProperty(f,"DEV",{enumerable:!0,get:function(){return s}}),Object.defineProperty(f,"isObject",{enumerable:!0,get:function(){return e}}),Object.defineProperty(f,"isFunction",{enumerable:!0,get:function(){return i}}),Object.defineProperty(f,"isNil",{enumerable:!0,get:function(){return o}}),Object.defineProperty(f,"isBlank",{enumerable:!0,get:function(){return l}}),Object.defineProperty(f,"isCtor",{enumerable:!0,get:function(){return L}}),Object.defineProperty(f,"pathGetter",{enumerable:!0,get:function(){return W}}),Object.defineProperty(f,"pathSetter",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(f,"getPath",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(f,"setPath",{enumerable:!0,get:function(){return _t}}),Object.defineProperty(f,"humanise",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(f,"escapeHtml",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(f,"titleCase",{enumerable:!0,get:function(){return Gt}}),Object.defineProperty(f,"expand",{enumerable:!0,get:function(){return X}}),Object.defineProperty(f,"toArray",{enumerable:!0,get:function(){return et}}),Object.defineProperty(f,"merge",{enumerable:!0,get:function(){return w}}),Object.defineProperty(f,"mergeRow",{enumerable:!0,get:function(){return J}}),Object.defineProperty(f,"Lru",{enumerable:!0,get:function(){return O}}),Object.defineProperty(f,"collator",{enumerable:!0,get:function(){return v}}),Object.defineProperty(f,"defaultCompare",{enumerable:!0,get:function(){return F}}),Object.defineProperty(f,"now",{enumerable:!0,get:function(){return R}}),Object.defineProperty(f,"nextFrame",{enumerable:!0,get:function(){return G}}),Object.defineProperty(f,"cancelFrame",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(f,"frameBatched",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(f,"settleDebounce",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(f,"whenIdle",{enumerable:!0,get:function(){return vt}}),Object.defineProperty(f,"uid",{enumerable:!0,get:function(){return Qt}});const Pt="1.89.0";async function tt(){return Pt}const at="1.89.0",dt=new Set,nt=2e3;function q(p){if(dt.add(p),dt.size>nt){const A=dt.values().next().value;A!==void 0&&dt.delete(A)}}const T=[],d=500;function h(p,A,j){T.push({key:p,level:A,message:j.map(ot=>typeof ot=="string"?ot:D(ot)).join(" "),at:Date.now()}),T.length>d&&T.shift()}function D(p){if(p instanceof Error)return p.message;try{return JSON.stringify(p)}catch{return String(p)}}function $(){return T.map(p=>({...p}))}function k(p){if(p.length===0||typeof p[0]!="string")return p;const A=p[0].replace(/^\[lattice\]\s*/,"");return A===p[0]?p:[A,...p.slice(1)]}function _(p,...A){if(dt.has(p))return;q(p);const j=k(A);h(p,"warn",j),console.warn("[lattice]",...j)}function S(p,...A){if(dt.has(p))return;q(p);const j=k(A);h(p,"info",j),console.info("[lattice]",...j)}function b(){dt.clear(),T.length=0}function y(p,A){const j=new Error(`[lattice] ${p}`);throw A!==void 0&&(j.cause=A),j}function g(p,A){p||y(A)}const s=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function e(p){return p!==null&&typeof p=="object"&&!Array.isArray(p)}function i(p){return typeof p=="function"}function o(p){return p==null}function l(p){return p==null||p===""}function L(p){return typeof p!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(p))?!0:!!(p.prototype&&Object.getOwnPropertyNames(p.prototype).length>1)}const Y=new Map;function W(p){let A=Y.get(p);if(A)return A;if(!p.includes("."))A=j=>j?.[p];else{const j=p.split("."),ot=j.length;A=st=>{let ht=st;for(let E=0;E<ot;E++){if(ht==null)return;ht=ht[j[E]]}return ht}}return Y.set(p,A),A}const z=new Map;function kt(p){let A=z.get(p);if(A)return A;if(!p.includes("."))A=(j,ot)=>{j!=null&&(j[p]=ot)};else{const j=p.split("."),ot=j.length-1;A=(st,ht)=>{let E=st;for(let At=0;At<ot;At++){if(E==null)return;const ft=j[At];E[ft]==null&&(E[ft]={}),E=E[ft]}E!=null&&(E[j[ot]]=ht)}}return z.set(p,A),A}function bt(p,A){return W(A)(p)}function _t(p,A,j){kt(A)(p,j)}function lt(p){return p?(p.includes(".")?p.slice(p.lastIndexOf(".")+1):p).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(/^./,j=>j.toUpperCase()):""}const Et={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Rt(p){const A=p==null?"":String(p);return/[&<>"']/.test(A)?A.replace(/[&<>"']/g,j=>Et[j]):A}function Gt(p){return String(p).replace(/\w\S*/g,A=>A[0].toUpperCase()+A.slice(1).toLowerCase())}function X(p,A,j){if(p!==void 0)return p===!0?{enabled:!0,...j}:p===!1?{enabled:!1}:e(p)?p:{[A]:p,enabled:!0}}function et(p){return p==null?[]:Array.isArray(p)?p:[p]}const mt=Object.freeze(new Set(["__proto__","constructor","prototype"]));function w(p,A){if(!e(p))return e(A)?{...A}:A;if(!e(A))return A===void 0?p:A;const j={...p};for(const ot of Object.keys(A)){if(mt.has(ot))continue;const st=A[ot];st!==void 0&&(j[ot]=e(st)&&e(j[ot])?w(j[ot],st):st)}return j}function J(p,A){if(!e(p)||!e(A)||p===A)return A;const j=Object.create(Object.getPrototypeOf(p));return Object.assign(j,p,A),j}class O{#e;#r=new Map;#t;constructor(A=256,j=null){this.#e=A,this.#t=j}get size(){return this.#r.size}get max(){return this.#e}set max(A){this.#e=A,this.#n()}has(A){return this.#r.has(A)}get(A){const j=this.#r;if(!j.has(A))return;const ot=j.get(A);return j.delete(A),j.set(A,ot),ot}peek(A){return this.#r.get(A)}set(A,j){const ot=this.#r;return ot.has(A)&&ot.delete(A),ot.set(A,j),this.#n(),j}delete(A){const j=this.#r.get(A);return this.#r.delete(A)&&this.#t&&this.#t(j,A),j}clear(){if(this.#t)for(const[A,j]of this.#r)this.#t(j,A);this.#r.clear()}keys(){return this.#r.keys()}values(){return this.#r.values()}#n(){const A=this.#r;for(;A.size>this.#e;){const j=A.keys().next().value,ot=A.get(j);A.delete(j),this.#t&&this.#t(ot,j)}}}const K=new Map;function v(p,A){const j=`${p||""}|${A?JSON.stringify(A):""}`;let ot=K.get(j);return ot||(ot=new Intl.Collator(p||void 0,{numeric:!0,sensitivity:"variant",...A}),K.set(j,ot)),ot}function F(p,A){if(p===A)return 0;if(p==null)return 1;if(A==null)return-1;if(typeof p=="number"&&typeof A=="number")return Number.isNaN(p)?Number.isNaN(A)?0:1:Number.isNaN(A)||p<A?-1:p>A?1:0;const j=String(p),ot=String(A);return j<ot?-1:j>ot?1:0}function R(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const it=typeof requestAnimationFrame=="function";function G(p){return it?requestAnimationFrame(p):setTimeout(()=>p(R()),16)}function rt(p){p!=null&&(it?cancelAnimationFrame(p):clearTimeout(p))}function wt(p){let A=null,j=null;const ot=()=>{A=null;const ht=j;j=null,p(...ht||[])},st=(...ht)=>{j=ht,A===null&&(A=G(ot))};return st.cancel=()=>{rt(A),A=null,j=null},st.flush=()=>{A!==null&&(rt(A),ot())},st}function ct(p,A){let j=null,ot=null;const st=()=>{if(j=null,ot===null)return;const At=ot;ot=null,p(...At),ht()},ht=()=>{j=setTimeout(st,A),typeof j?.unref=="function"&&j.unref()},E=(...At)=>{j===null?(p(...At),ht()):(ot=At,clearTimeout(j),ht())};return E.flush=()=>{if(j!==null&&clearTimeout(j),j=null,ot===null)return;const At=ot;ot=null,p(...At)},E.cancel=()=>{j!==null&&clearTimeout(j),j=null,ot=null},E.pending=()=>j!==null||ot!==null,E}function vt(p,A=50){return typeof requestIdleCallback=="function"?requestIdleCallback(p,{timeout:A}):setTimeout(()=>p({timeRemaining:()=>0,didTimeout:!0}),1)}let B=0;function Qt(p="l"){return`${p}${(++B).toString(36)}`}}),oe("packages/modules/shared/emitter.js",function(f,ut){"use strict";Object.defineProperty(f,"WILDCARD",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(f,"Emitter",{enumerable:!0,get:function(){return T}}),Object.defineProperty(f,"gate",{enumerable:!0,get:function(){return d}});const Pt=ut("packages/core/src/internal/util.js"),tt=Pt.isFunction,at=Pt.warnOnce,dt="*",nt=new Set(["api","user","init","ai"]);function q(h,D){return h&&h.name?h.name:`#${D}`}class T{#e=new Map;#r;constructor(D="module"){this.#r=String(D)}on(D,$){if(!tt($))return()=>{};let k=this.#e.get(D);return k||(k=new Set,this.#e.set(D,k)),k.add($),()=>this.off(D,$)}off(D,$){const k=this.#e.get(D);k&&k.delete($)}count(D){const $=this.#e.get(D);return $?$.size:0}emit(D,$){const k=this.#e.get(D),_=this.#e.get(dt);if((!k||k.size===0)&&(!_||_.size===0))return;const S={...$||null,type:D};k&&k.size&&this.#t([...k],S,D),_&&_.size&&this.#t([..._],S,dt)}#t(D,$,k){for(let _=0;_<D.length;_++)try{D[_]($)}catch(S){at(`${this.#r}.emit.throw:${k}:${q(D[_],_)}`,`${this.#r}: a '${k}' handler threw; other handlers were unaffected.`,S)}}emitBefore(D,$,k){const _=k??($&&$.origin),S=nt.has(_)?_:"user";let b=!1,y=null;const g=L=>{b=!0,L!=null&&y===null&&(y=String(L))},s={...$||null,type:D,origin:S,get defaultPrevented(){return b},get reason(){return y},preventDefault(L){g(L)}},e=this.#e.get(D);if(!e||e.size===0)return!0;const i=[...e],o=()=>(b&&y===null&&(y="prevented"),b&&$&&typeof $=="object"&&($.reason=y),!b),l=[];for(let L=0;L<i.length;L++){const Y=i[L];try{const W=Y(s);W&&tt(W.then)?l.push(W):W===!1&&g("prevented")}catch(W){g("error"),at(`${this.#r}.beforeThrow:${D}:${q(Y,L)}`,`${this.#r}: a '${D}' before-handler threw; the action was cancelled.`,W)}}return l.length===0?o():Promise.allSettled(l).then(L=>{for(const Y of L)Y.status==="rejected"?(g("error"),at(`${this.#r}.beforeReject:${D}`,`${this.#r}: a '${D}' before-handler rejected; the action was cancelled.`,Y.reason)):Y.value===!1&&g("prevented");return o()})}clear(){this.#e.clear()}}function d(h,D,$,k,_){const S=h.emitBefore(D,k,k.origin),b=()=>(h.emit($,{...k,reason:k.reason||"prevented"}),!1);return S===!1?b():S&&tt(S.then)?S.then(y=>y?_():b()):_()}}),oe("packages/core/src/model/history.js",function(f,ut){"use strict";Object.defineProperty(f,"DEFAULT_HISTORY_DEPTH",{enumerable:!0,get:function(){return q}}),Object.defineProperty(f,"DEFAULT_COALESCE_MS",{enumerable:!0,get:function(){return T}}),Object.defineProperty(f,"HISTORY_TYPES",{enumerable:!0,get:function(){return d}}),Object.defineProperty(f,"COALESCING_TYPES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(f,"HISTORY_LABELS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(f,"diffSlices",{enumerable:!0,get:function(){return b}}),Object.defineProperty(f,"HistoryModel",{enumerable:!0,get:function(){return y}});const Pt=ut("packages/core/src/internal/util.js"),tt=Pt.warnOnce,at=Pt.isFunction,dt=Pt.isObject,nt=Pt.now,q=10,T=400,d=["sort","filter","group","pivot","column:move","column:resize","column:visible","column:pin","column:decorate","page","edit","transaction"],h=new Set(["column:resize","column:move"]),D={sort:"sort",filter:"filter",group:"grouping",pivot:"pivot",formatting:"conditional formatting","column:move":"column move","column:resize":"column resize","column:visible":"column visibility","column:pin":"column pin","column:decorate":"column decoration",page:"page change",edit:"edit",transaction:"change"};function $(g){if(g===null||typeof g!="object")return g;try{return structuredClone(g)}catch{try{return JSON.parse(JSON.stringify(g))}catch{return g}}}function k(g,s){if(g===s)return!0;if(g===null||s===null||typeof g!="object"||typeof s!="object")return g!==g&&s!==s;if(g instanceof Date||s instanceof Date)return g instanceof Date&&s instanceof Date&&g.getTime()===s.getTime();if(Array.isArray(g)||Array.isArray(s))return!Array.isArray(g)||!Array.isArray(s)||g.length!==s.length?!1:g.every((o,l)=>k(o,s[l]));const e=Object.keys(g),i=Object.keys(s);return e.length!==i.length?!1:e.every(o=>Object.prototype.hasOwnProperty.call(s,o)&&k(g[o],s[o]))}function _(g,s){const e=new Map;for(const L of s)dt(L)&&typeof L.id=="string"&&e.set(L.id,L);const i=new Set,o=[],l=[];for(const L of g){if(!dt(L)||typeof L.id!="string")continue;i.add(L.id);const Y=e.get(L.id);if(!Y){o.push({...L});continue}const W=new Set([...Object.keys(L),...Object.keys(Y)]);W.delete("id");const z={id:L.id},kt={id:L.id};let bt=!1;for(const _t of W)k(L[_t],Y[_t])||(bt=!0,_t in L&&(z[_t]=L[_t]),_t in Y&&(kt[_t]=Y[_t]));bt&&(o.push(z),l.push(kt))}for(const L of s)!dt(L)||typeof L.id!="string"||i.has(L.id)||l.push({...L});return o.length===0&&l.length===0?null:{before:o,after:l}}function S(g){if(typeof g=="string")return"";if(Array.isArray(g))return[]}function b(g,s){const e=dt(g)?g:null,i=dt(s)?s:null;if(!e&&!i)return null;if(!e||!i)return{before:e?{...e}:null,after:i?{...i}:null};const o={},l={};let L=!1;const Y=new Set([...Object.keys(e),...Object.keys(i)]);Y.delete("version");for(const W of Y){if(W==="columns"&&Array.isArray(e.columns)&&Array.isArray(i.columns)){const bt=_(e.columns,i.columns);if(!bt)continue;o.columns=bt.before,l.columns=bt.after,L=!0;continue}if(k(e[W],i[W]))continue;L=!0;const z=W in e,kt=W in i;z?o[W]=e[W]:S(i[W])!==void 0&&(o[W]=S(i[W])),kt?l[W]=i[W]:S(e[W])!==void 0&&(l[W]=S(e[W]))}return L?(o.columns&&Array.isArray(e.columnOrder)&&(o.columnOrder=e.columnOrder),l.columns&&Array.isArray(i.columnOrder)&&(l.columnOrder=i.columnOrder),e.version!==void 0&&(o.version=e.version),i.version!==void 0&&(l.version=i.version),{before:o,after:l}):null}class y{#e=[];#r=[];#t=q;#n=T;#i=null;#l=null;#a=null;#c=nt;#f=!1;#o=0;#d=0;constructor(s={}){s.apply&&(this.#i=s.apply),s.capture&&(this.#l=s.capture),s.edit&&(this.#a=s.edit),at(s.now)&&(this.#c=s.now),this.configure(s)}configure(s={}){typeof s.depth=="number"&&s.depth>=0&&(this.#t=Math.floor(s.depth),this.#h()),typeof s.coalesceMs=="number"&&s.coalesceMs>=0&&(this.#n=s.coalesceMs)}get depth(){return this.#t}set depth(s){this.configure({depth:s})}get coalesceMs(){return this.#n}set coalesceMs(s){this.configure({coalesceMs:s})}get size(){return this.#e.length}get redoSize(){return this.#r.length}get replaying(){return this.#f}canUndo(){return this.#e.length>0}canRedo(){return this.#r.length>0}push(s){if(this.#f||this.#o>0||this.#t===0||!dt(s)||typeof s.type!="string"||!s.type)return null;const e=s.type,i=e==="edit";let o=null,l=null;if(!i){const W=b($(s.before??null),$(s.after??null));if(!W)return null;o=W.before,l=W.after}const L={seq:++this.#d,type:e,label:typeof s.label=="string"&&s.label?s.label:D[e]||e,target:s.target==null?null:String(s.target),before:o,after:l,at:typeof s.at=="number"?s.at:this.#c(),delegated:i,mergeable:i?!1:s.coalesce===void 0?h.has(e):!!s.coalesce};this.#r.length=0;const Y=this.#s(L);return Y!==void 0?Y:(this.#e.push(L),this.#h(),L)}recordEdit(s,e={}){return this.push({type:"edit",label:s,target:e.target,at:e.at})}transaction(s,e,i={}){if(!at(e))return null;if(this.#f||this.#o>0){this.#o++;try{e()}finally{this.#o--}return null}const o=i.type||"transaction",l=i.type?o:void 0,L=this.#p(l,i.target);this.#o++;try{e()}finally{this.#o--}const Y=this.#p(l,i.target);return this.push({type:o,label:s,target:i.target,before:L,after:Y,coalesce:i.coalesce===void 0?!1:i.coalesce})}#s(s){if(!s.mergeable)return;const e=this.#e[this.#e.length-1];if(!e||!e.mergeable||e.delegated||e.type!==s.type||e.target!==s.target||s.at-e.at>this.#n)return;const i=b(e.before,s.after);return i?(e.before=i.before,e.after=i.after,e.at=s.at,e.label=s.label,e):(this.#e.pop(),null)}get busy(){return this.#f||this.#o>0}capture(s,e){return this.#p(s,e)}#p(s,e){if(!this.#l)return null;try{return $(this.#l(s,e??null))}catch(i){return tt("history.capture.throw","history capture threw; the action was not recorded.",i),null}}#h(){for(;this.#e.length>this.#t;)this.#e.shift();for(;this.#r.length>this.#t;)this.#r.shift()}undo(){return this.#g("undo")}redo(){return this.#g("redo")}#g(s){if(this.#f)return null;const e=s==="undo"?this.#e:this.#r,i=s==="undo"?this.#r:this.#e;this.#f=!0;try{for(;e.length;){const o=e[e.length-1],l=this.#C(o,s);if(o.delegated){if(!this.#S(s)){e.pop();continue}}else l.patch&&this.#v(l.patch,l);return e.pop(),i.push(o),this.#h(),l}return null}finally{this.#f=!1}}#S(s){const e=this.#a;if(!e||!at(e[s]))return!1;try{return e[s]({origin:"history"})!=null}catch(i){return tt("history.edit.throw",`edit ${s} threw; the entry was dropped.`,i),!1}}#v(s,e){if(this.#i)try{this.#i(s,e)}catch(i){tt("history.apply.throw",`applying the ${e.direction} of '${e.label}' threw.`,i)}}#C(s,e){return{direction:e,seq:s.seq,type:s.type,label:s.label,target:s.target,at:s.at,delegated:s.delegated,patch:s.delegated?null:$(e==="undo"?s.before:s.after)}}peek(s="undo"){const e=s==="redo"?this.#r:this.#e,i=e[e.length-1];return i?{seq:i.seq,type:i.type,label:i.label,target:i.target,at:i.at,delegated:i.delegated}:null}list(){const s=(e,i)=>({seq:e.seq,type:e.type,label:e.label,target:e.target,at:e.at,delegated:e.delegated,undone:i});return[...this.#r.map(e=>s(e,!0)),...[...this.#e].reverse().map(e=>s(e,!1))]}clear(){this.#e.length=0,this.#r.length=0}destroy(){this.clear(),this.#a=null}}}),oe("packages/modules/gantt/time.js",function(f,ut){"use strict";Object.defineProperty(f,"toDayNumber",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(f,"fromDayNumber",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(f,"toISODate",{enumerable:!0,get:function(){return q}}),Object.defineProperty(f,"resolveProjectEpoch",{enumerable:!0,get:function(){return T}});const tt=ut("packages/core/src/internal/util.js").warnOnce,at=864e5;function dt(d){if(d==null||d==="")return null;if(typeof d=="number")return Number.isFinite(d)?d:null;if(d instanceof Date)return Number.isFinite(d.getTime())?Math.floor(Date.UTC(d.getFullYear(),d.getMonth(),d.getDate())/at):null;const h=Date.parse(d);return Number.isFinite(h)?Math.floor(h/at):null}function nt(d){return Number.isFinite(d)?new Date(Math.round(d)*at):null}function q(d){const h=nt(d);return h?h.toISOString().slice(0,10):null}function T(d){if(d==null||d==="")return 0;const h=dt(d);return Number.isFinite(h)?h:(tt(`gantt.projectEpoch:${String(d)}`,`[lattice] gantt: projectEpoch ${JSON.stringify(d)} is not a date or a day number; the plan is rendered against the Unix epoch (day 0 = 1970-01-01).`),0)}}),oe("packages/modules/gantt/calendar.js",function(f,ut){"use strict";Object.defineProperty(f,"createCalendar",{enumerable:!0,get:function(){return dt}});const tt=ut("packages/modules/gantt/time.js").toDayNumber,at=Object.freeze([1,2,3,4,5]);function dt(nt,q=0){if(nt==null)return null;let T,d;nt==="weekends"?(T=at,d=new Set):(T=Array.isArray(nt.workdays)&&nt.workdays.length?nt.workdays.map(Number).filter(s=>s>=0&&s<=6):at,d=new Set((Array.isArray(nt.holidays)?nt.holidays:[]).map(s=>tt(s)).filter(s=>s!=null)));const h=new Set(T);if(h.size===7&&d.size===0||h.size===0)return null;const D=s=>{let e=(s%7+4)%7;return e<0&&(e+=7),e},$=s=>{if(!Number.isFinite(s))return!1;const e=Math.round(s);return h.has(D(e))&&!d.has(e)},k=s=>{let e=s;for(;!$(e);)e+=1;return e},_=k(Math.round(Number.isFinite(q)?q:0)),S=h.size,b=(s,e)=>{if(e<s)return 0;const i=e-s+1,o=Math.floor(i/7);let l=o*S;const L=D(s);for(let Y=o*7;Y<i;Y+=1)h.has((L+Y)%7)&&(l+=1);for(const Y of d)Y>=s&&Y<=e&&h.has(D(Y))&&(l-=1);return l};return{isWorking:$,nextWorking:k,dayOf:s=>{const e=Math.round(s);if(e===0)return _;if(e>0){const W=Math.floor(e/S);let z=_+W*7,kt=e-W*S;for(;kt>0;)z+=1,h.has(D(z))&&(kt-=1);let bt=0;for(const _t of d)_t>_&&_t<=z&&h.has(D(_t))&&(bt+=1);for(;bt>0;)z+=1,$(z)&&(bt-=1);for(;!$(z);)z+=1;return z}const i=-e,o=Math.floor(i/S);let l=_-o*7,L=i-o*S;for(;L>0;)l-=1,h.has(D(l))&&(L-=1);let Y=0;for(const W of d)W>=l&&W<_&&h.has(D(W))&&(Y+=1);for(;Y>0;)l-=1,$(l)&&(Y-=1);for(;!$(l);)l-=1;return l},indexOf:s=>{const e=k(Math.round(s));return e>=_?b(_,e)-1:-(b(e,_)-1)},anchor:_}}}),oe("packages/modules/gantt/assignments.js",function(f,ut){"use strict";Object.defineProperty(f,"parseAssignments",{enumerable:!0,get:function(){return tt}});function Pt(at){if(at==null||at==="")return null;const dt=typeof at=="number"?at:Number(at);return Number.isFinite(dt)?dt:null}function tt(at){if(at&&Array.isArray(at.assignments))return at.assignments.map(q=>{const T=q&&(q.resource??q.name??q.id);if(T==null||T==="")return null;const d=Pt(q.units)??Pt(q.allocation)??1;return{resource:String(T),units:d}}).filter(Boolean);const dt=at?at.assignee??at.assignees??at.owner:null;return(Array.isArray(dt)?dt:dt==null||dt===""?[]:[dt]).map(q=>String(q)).filter(q=>q!=="").map(q=>({resource:q,units:1}))}}),oe("packages/modules/gantt/unscheduled.js",function(f,ut){"use strict";Object.defineProperty(f,"UNSCHEDULED_DEFAULT_DURATION",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(f,"isUnscheduled",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(f,"findUnscheduled",{enumerable:!0,get:function(){return at}}),Object.defineProperty(f,"activeEdges",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(f,"unscheduledRecord",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(f,"completeUnscheduledPatch",{enumerable:!0,get:function(){return q}}),Object.defineProperty(f,"unscheduledMarker",{enumerable:!0,get:function(){return T}});const Pt=1;function tt(d){return!!(d&&d.unscheduled===!0)}function at(d,h,D){const $=new Set;for(const k of d)!D.isSummary(k)&&h.get(k).duration==null&&$.add(k);if(!$.size)return $;for(const k of d)D.isSummary(k)&&D.descendantLeaves(k).every(_=>$.has(_))&&$.add(k);return $}function dt(d,h){return h.size?d.filter(D=>!h.has(D.from)&&!h.has(D.to)):d}function nt(d,h){return{id:d.id,name:d.name,duration:null,es:null,ef:null,ls:null,lf:null,totalFloat:null,critical:!1,percentComplete:h?null:d.percentComplete,parent:d.parent,isSummary:h,isMilestone:!1,locked:h?!1:!!d.locked,unscheduled:!0,children:[]}}function q(d,h){if(!tt(h)||h.isSummary||d.duration!==void 0)return d;const D=d.start!=null&&d.start!=="",$=d.end!=null&&d.end!=="";if(!D&&!$)return d;const k={...d,duration:Pt};if(!D){const _=Number(d.end);Number.isFinite(_)&&(k.start=_-Pt)}return k}function T(d,h,D){const $=d.createElement("span");return $.setAttribute("class",`${h}__unscheduled`),$.textContent=D("gantt.unscheduled"),$}}),oe("packages/modules/gantt/schedule.js",function(f,ut){"use strict";Object.defineProperty(f,"LINK_TYPES",{enumerable:!0,get:function(){return _}}),Object.defineProperty(f,"CONSTRAINT_TYPES",{enumerable:!0,get:function(){return S}}),Object.defineProperty(f,"resolveConstraintCode",{enumerable:!0,get:function(){return y}}),Object.defineProperty(f,"SCHEDULING_MODES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(f,"resolveSchedulingMode",{enumerable:!0,get:function(){return e}}),Object.defineProperty(f,"effortRate",{enumerable:!0,get:function(){return o}}),Object.defineProperty(f,"recomputeEffort",{enumerable:!0,get:function(){return l}}),Object.defineProperty(f,"reconcileEffort",{enumerable:!0,get:function(){return L}}),Object.defineProperty(f,"EPS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(f,"SCHEDULE_ERROR",{enumerable:!0,get:function(){return W}}),Object.defineProperty(f,"TASK_FIELDS",{enumerable:!0,get:function(){return _t}}),Object.defineProperty(f,"taskIdReader",{enumerable:!0,get:function(){return Et}}),Object.defineProperty(f,"taskFieldWriters",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(f,"isTaskLocked",{enumerable:!0,get:function(){return X}}),Object.defineProperty(f,"normalizeTasks",{enumerable:!0,get:function(){return et}}),Object.defineProperty(f,"buildTree",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(f,"normalizeLinkSpec",{enumerable:!0,get:function(){return J}}),Object.defineProperty(f,"normalizeDependencies",{enumerable:!0,get:function(){return O}}),Object.defineProperty(f,"expandDependencies",{enumerable:!0,get:function(){return K}}),Object.defineProperty(f,"topoOrder",{enumerable:!0,get:function(){return F}}),Object.defineProperty(f,"wouldCreateCycle",{enumerable:!0,get:function(){return G}}),Object.defineProperty(f,"computeSchedule",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(f,"findViolations",{enumerable:!0,get:function(){return Qt}});const tt=ut("packages/core/src/internal/util.js").warnOnce,dt=ut("packages/modules/gantt/calendar.js").createCalendar,q=ut("packages/modules/gantt/assignments.js").parseAssignments,d=ut("packages/modules/gantt/time.js").toDayNumber,h=ut("packages/modules/gantt/unscheduled.js"),D=h.activeEdges,$=h.findUnscheduled,k=h.unscheduledRecord,_=["FS","SS","FF","SF"],S=["ASAP","MSO","MFO","ALAP","SNET","SNLT","FNET","FNLT"],b=Object.freeze({asap:"ASAP","as-soon-as-possible":"ASAP",assoonaspossible:"ASAP",mso:"MSO","must-start-on":"MSO",muststarton:"MSO","start-on":"MSO",mfo:"MFO","must-finish-on":"MFO",mustfinishon:"MFO","finish-on":"MFO",alap:"ALAP","as-late-as-possible":"ALAP",aslateaspossible:"ALAP",late:"ALAP",snet:"SNET","start-no-earlier-than":"SNET",startnoearlierthan:"SNET",snlt:"SNLT","start-no-later-than":"SNLT",startnolaterthan:"SNLT",fnet:"FNET","finish-no-earlier-than":"FNET",finishnoearlierthan:"FNET",fnlt:"FNLT","finish-no-later-than":"FNLT",finishnolaterthan:"FNLT"});function y(p){if(p==null||p===""||typeof p=="object"&&!Array.isArray(p)&&!(p instanceof Date)&&(p=p.type??p.constraint??p.code??null,p==null||p===""))return null;const A=String(p).toLowerCase().replace(/\s+/g,"-");return b[A]??(S.includes(String(p).toUpperCase())?String(p).toUpperCase():null)}const g=["fixedDuration","fixedEffort","fixedUnits"],s=Object.freeze({fixedduration:"fixedDuration","fixed-duration":"fixedDuration",duration:"fixedDuration",fixedeffort:"fixedEffort","fixed-effort":"fixedEffort",effort:"fixedEffort",work:"fixedEffort",fixedwork:"fixedEffort",fixedunits:"fixedUnits","fixed-units":"fixedUnits",units:"fixedUnits"});function e(p){if(p==null||p==="")return null;const A=String(p).toLowerCase().replace(/\s+/g,"-");if(s[A])return s[A];const j=A.replace(/-/g,"");return s[j]??null}const i=8;function o(p,A){const j=A.hoursPerDay,ot=A.resourceHours instanceof Map?A.resourceHours:new Map;if(!p||p.length===0)return{rate:j,units:1};let st=0,ht=0;for(const E of p){const At=ot.has(E.resource)?ot.get(E.resource):j;st+=E.units*At,ht+=E.units}return{rate:st,units:ht}}function l(p,A){const j=p.schedulingMode||A.defaultMode||"fixedDuration",ot=p.effortDriven!=null?!!p.effortDriven:!!A.defaultEffortDriven,{rate:st,units:ht}=o(p.assignments,A),E=p.duration,At=p.statedEffort;let ft=E,Ht=At??(E!=null?E*st:null);return j==="fixedEffort"?At!=null&&st>0?ft=At/st:Ht=E!=null?E*st:null:j==="fixedUnits"?E!=null?(ft=E,Ht=E*st):At!=null&&st>0&&(ft=At/st,Ht=At):ft=E,{duration:ft,effort:Ht,units:ht,schedulingMode:j,effortDriven:ot}}function L(p,A){const j=e(p.mode)||p.mode||"fixedDuration",ot=!!p.effortDriven,st=p.hoursPerDay>0?p.hoursPerDay:i;let ht=p.duration,E=p.units;const At=ht*E*st,ft=A.field,Ht=A.units!=null?A.units:1;if(ft==="duration")ht=A.value,j==="fixedEffort"&&(E=ht>0?At/(ht*st):E);else if(ft==="effort"){const Lt=A.value;j==="fixedDuration"?E=ht>0?Lt/(ht*st):E:ht=E>0?Lt/(E*st):ht}else if(ft==="units")E=A.value,j!=="fixedDuration"&&(ht=E>0?At/(E*st):ht);else if(ft==="addResource"||ft==="removeResource"){const Lt=ft==="addResource"?Ht:-Ht;j==="fixedDuration"?ot||(E=E+Lt):(E=E+Lt,ht=E>0?At/(E*st):ht)}return{duration:ht,units:E,effort:ht*E*st}}const Y=1e-9,W={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 z(p){if(p==null||p==="")return null;const A=typeof p=="number"?p:Number(p);return Number.isFinite(A)?A:null}function kt(p){if(!p)return null;const A=z(p.effort)??(Array.isArray(p.work)?null:z(p.work))??z(p.hours);if(A!=null)return A;if(Array.isArray(p.work)){let j=0,ot=!1;for(const st of p.work){const ht=z(st&&st.hours);ht!=null&&(j+=ht,ot=!0)}return ot?j:null}return null}function bt(p){return p==null||p===""?null:d(p)}const _t=Object.freeze(["id","name","start","end","duration","milestone","percentComplete","parent","baselineStart","baselineEnd","constraint","constraintDate","deadline"]);function lt(p){const A=p&&typeof p=="object"?p:{},j={};for(const ot of _t){const st=A[ot];if(typeof st=="function")j[ot]=st;else if(typeof st=="string"&&st!==""){const ht=st;j[ot]=E=>E[ht]}else j[ot]=ht=>ht[ot]}return j}function Et(p){return lt(p).id}function Rt(p){const A=p&&typeof p=="object"?p:{},j={};for(const ot of _t){const st=A[ot];typeof st=="string"&&st!==""?j[ot]=st:typeof st=="function"?j[ot]=null:j[ot]=ot}return j}function Gt(p,A){const j=A.constraint(p);let ot=j??(p&&p.constraintType),st=null;if(ot&&typeof ot=="object"&&!Array.isArray(ot)&&!(ot instanceof Date)&&(st=ot.date??ot.at??ot.constraintDate??null,ot=ot.type??ot.constraint??ot.code??null),ot==null||ot==="")return null;const ht=y(ot);if(!ht)return null;const E=bt(st??A.constraintDate(p)??p.constraintAt??p.at);return{type:ht,at:E}}function X(p,A){if(!p)return!1;if(p.locked===!0||typeof p.constraintMode=="string"&&p.constraintMode.toLowerCase()==="hard")return!0;if(typeof A=="function")try{return!!A(p)}catch{return!1}return!1}function et(p,A,j){const ot=new Map,st=[],ht=lt(A);if(!Array.isArray(p))return{ok:!1,error:{code:W.BAD_DURATION,message:"tasks must be an array"},order:st,byId:ot};for(const E of p){const At=E?ht.id(E):null,ft=At!=null?String(At):null;if(ft==null)return{ok:!1,error:{code:W.UNKNOWN_TASK,message:"every task needs an id"},order:st,byId:ot};if(ot.has(ft))return{ok:!1,error:{code:W.DUPLICATE_ID,message:`duplicate task id "${ft}"`,id:ft},order:st,byId:ot};const Ht=bt(ht.start(E)),Lt=bt(ht.end(E)),ee=ht.milestone(E)===!0;let Mt=ee?0:z(ht.duration(E));if(Mt==null&&Ht!=null&&Lt!=null&&(Mt=Lt-Ht),Mt!=null&&Mt<0)return{ok:!1,error:{code:W.BAD_DURATION,message:`task "${ft}" has negative duration ${Mt}`,id:ft},order:st,byId:ot};const N=ht.name(E),x=ht.parent(E),P=E.colour??E.color;ot.set(ft,{id:ft,name:N!=null?String(N):ft,colour:typeof P=="string"&&P.trim()!==""?P.trim():null,duration:Mt,milestoneFlag:ee,earliestStart:Ht,placedStart:Ht,placedEnd:Lt,percentComplete:z(ht.percentComplete(E)),parent:x!=null?String(x):null,constraint:Gt(E,ht),locked:X(E,j),baselineStart:bt(ht.baselineStart(E)??(E.baseline&&E.baseline.start)),baselineEnd:bt(ht.baselineEnd(E)??(E.baseline&&E.baseline.end)),deadline:bt(ht.deadline(E)),schedulingMode:e(E.schedulingMode??E.taskType),effortDriven:E.effortDriven==null?null:!!E.effortDriven,statedEffort:kt(E),assignments:q(E)}),st.push(ft)}return{ok:!0,order:st,byId:ot}}function mt(p,A){const j=new Map(p.map(At=>[At,[]]));for(const At of p){const ft=A.get(At).parent;if(ft!=null){if(!A.has(ft))return{ok:!1,error:{code:W.UNKNOWN_PARENT,message:`task "${At}" names unknown parent "${ft}"`,id:At}};j.get(ft).push(At)}}for(const At of p){const ft=new Set;let Ht=A.get(At).parent;for(;Ht!=null;){if(Ht===At||ft.has(Ht))return{ok:!1,error:{code:W.PARENT_CYCLE,message:`parent cycle at "${At}"`,id:At}};ft.add(Ht),Ht=A.get(Ht)?.parent??null}}const ot=At=>j.get(At).length>0,st=new Map,ht=At=>{if(st.has(At))return st.get(At);const ft=j.get(At),Ht=ft.length===0?[At]:ft.flatMap(Lt=>ht(Lt));return st.set(At,Ht),Ht};return{ok:!0,children:j,isSummary:ot,descendantLeaves:ht,ancestors:At=>{const ft=new Set;let Ht=A.get(At).parent;for(;Ht!=null;)ft.add(Ht),Ht=A.get(Ht).parent;return ft}}}const w=/^\s*(FS|SS|FF|SF)\s*(?:([+-])\s*(\d+(?:\.\d+)?))?\s*$/i;function J(p){const A={...p||null};if(typeof A.type!="string")return A;const j=w.exec(A.type);if(!j||!j[2])return A;const ot=(j[2]==="-"?-1:1)*Number(j[3]);A.type=j[1].toUpperCase();const st=z(p.lag);return st!=null&&st!==ot?(tt(`gantt-link-shorthand-${String(p.type)}-${st}`,`[lattice] gantt: dependency type ${JSON.stringify(p.type)} carries a lag of ${ot} but lag: ${st} was also given; the explicit lag wins. Give one or the other.`),A):(A.lag=ot,A)}function O(p,A,j={}){const ot=[];if(p==null)return{ok:!0,edges:ot};if(!Array.isArray(p))return{ok:!1,error:{code:W.UNKNOWN_TASK,message:"dependencies must be an array"},edges:ot};const st=typeof j.ancestors=="function"?j.ancestors:null;for(const ht of p){const E=J(ht),At=E&&E.from!=null?String(E.from):null,ft=E&&E.to!=null?String(E.to):null,Ht=E&&E.type!=null?String(E.type).toUpperCase():"FS",Lt=z(E.lag)??0;if(At==null||ft==null)return{ok:!1,error:{code:W.UNKNOWN_TASK,message:"a dependency needs both `from` and `to`"},edges:ot};if(!A.has(At))return{ok:!1,error:{code:W.UNKNOWN_TASK,message:`dependency references unknown task "${At}"`,id:At},edges:ot};if(!A.has(ft))return{ok:!1,error:{code:W.UNKNOWN_TASK,message:`dependency references unknown task "${ft}"`,id:ft},edges:ot};if(At===ft)return{ok:!1,error:{code:W.SELF_DEPENDENCY,message:`task "${At}" depends on itself`,id:At},edges:ot};if(!_.includes(Ht))return{ok:!1,error:{code:W.BAD_LINK_TYPE,message:`unknown link type "${Ht}" (expected one of ${_.join("/")})`},edges:ot};if(st&&(st(At).has(ft)||st(ft).has(At)))return{ok:!1,error:{code:W.DEP_ACROSS_HIERARCHY,message:`dependency between "${At}" and "${ft}" crosses their own parent/child hierarchy`,from:At,to:ft},edges:ot};ot.push({from:At,to:ft,type:Ht,lag:Lt})}return{ok:!0,edges:ot}}function K(p,A){const j=new Set,ot=[];for(const st of p){(A.isSummary(st.from)||A.isSummary(st.to))&&st.type!=="FS"&&tt(`gantt-summary-link-${st.type}-${st.from}-${st.to}`,`[lattice] gantt: ${st.type} link with a summary endpoint (${st.from} -> ${st.to}) is expanded to descendant leaves — a conservative v1 reading; only FS is exact for summary endpoints.`);for(const E of A.descendantLeaves(st.from))for(const At of A.descendantLeaves(st.to)){if(E===At)continue;const ft=[E,At,st.type,st.lag].join("");j.has(ft)||(j.add(ft),ot.push({from:E,to:At,type:st.type,lag:st.lag}))}}return ot}function v(p,A,j){return p.map(ot=>{const st=A.get(ot.from),ht=A.get(ot.to);if(!st||!ht||st.earliestStart==null||st.duration==null||ht.earliestStart==null||ht.duration==null)return ot;const E=j(st.earliestStart),At=E+st.duration,ft=j(ht.earliestStart),Ht=ft+ht.duration;let Lt;switch(ot.type){case"FS":Lt=ft-At;break;case"SS":Lt=ft-E;break;case"FF":Lt=Ht-At;break;case"SF":Lt=Ht-E;break;default:return ot}return{...ot,lag:Lt}})}function F(p,A){const j=new Map(p.map(E=>[E,0])),ot=new Map(p.map(E=>[E,[]]));for(const E of A)R(j,E.to),ot.get(E.from).push(E.to);const st=p.filter(E=>j.get(E)===0),ht=[];for(;st.length;){const E=st.shift();ht.push(E);for(const At of ot.get(E)){const ft=j.get(At)-1;j.set(At,ft),ft===0&&st.push(At)}}return ht.length===p.length?{ok:!0,sorted:ht}:{ok:!1,cycle:it(p,ot,new Set(ht))}}function R(p,A){p.set(A,p.get(A)+1)}function it(p,A,j){const ot=p.find(At=>!j.has(At)),st=[],ht=new Map;let E=ot;for(;E!=null&&!ht.has(E);)ht.set(E,st.length),st.push(E),E=A.get(E).find(At=>!j.has(At));return E==null?st:st.slice(ht.get(E)).concat(E)}function G(p,A,j){const ot=String(A),st=String(j);if(ot===st)return!0;const ht=new Map;for(const ft of p){const Ht=String(ft.from);ht.has(Ht)||ht.set(Ht,[]),ht.get(Ht).push(String(ft.to))}const E=new Set,At=[st];for(;At.length;){const ft=At.pop();if(ft===ot)return!0;if(!E.has(ft)){E.add(ft);for(const Ht of ht.get(ft)||[])At.push(Ht)}}return!1}function rt(p,A,j,ot,st,ht=new Map,E=new Map,At=!1){const ft=F(p,j);if(!ft.ok)return tt(`gantt-cycle-${ft.cycle.join(">")}`,`[lattice] gantt: dependency cycle detected (${ft.cycle.join(" -> ")}); schedule refused.`),{ok:!1,error:{code:W.CYCLE,message:`dependency cycle: ${ft.cycle.join(" -> ")}`,cycle:ft.cycle}};const Ht=ft.sorted,Lt=new Map(p.map(pt=>[pt,[]])),ee=new Map(p.map(pt=>[pt,[]]));for(const pt of j)Lt.get(pt.to).push(pt),ee.get(pt.from).push(pt);const Mt=new Map;for(const pt of p){const Ot=A.get(pt);Mt.set(pt,{id:pt,name:Ot.name,duration:Ot.duration,es:0,ef:0,ls:0,lf:0,totalFloat:0,critical:!1,percentComplete:Ot.percentComplete,parent:Ot.parent,isSummary:!1,isMilestone:Ot.duration===0,children:[],colour:Ot.colour??null,locked:!!Ot.locked})}const N=[];for(const pt of Ht){const Ot=A.get(pt),xt=Mt.get(pt);let It=Math.max(ot,Ot.earliestStart??ot);for(const te of Lt.get(pt)){const ne=Mt.get(te.from);let Yt;switch(te.type){case"FS":Yt=ne.ef+te.lag;break;case"SS":Yt=ne.es+te.lag;break;case"FF":Yt=ne.ef+te.lag-xt.duration;break;case"SF":Yt=ne.es+te.lag-xt.duration;break;default:Yt=-1/0}Yt>It&&(It=Yt)}const Ut=ht.get(pt);if(Ut&&Ut.at!=null)switch(Ut.type){case"MSO":Ut.at<It-Y?N.push({id:pt,type:Ut.type,date:Ut.at,scheduled:It,at:Ut.at,earliestFeasible:It}):It=Ut.at,xt.pinned=!0;break;case"MFO":{const te=Ut.at-xt.duration;te<It-Y?N.push({id:pt,type:Ut.type,date:Ut.at,scheduled:It+xt.duration,at:Ut.at,earliestFeasible:It}):It=te,xt.pinned=!0;break}case"SNET":Ut.at>It+Y&&(It=Ut.at);break;case"SNLT":It>Ut.at+Y&&N.push({id:pt,type:Ut.type,date:Ut.at,scheduled:It,at:Ut.at,earliestFeasible:It});break;case"FNET":{const te=Ut.at-xt.duration;te>It+Y&&(It=te);break}case"FNLT":{const te=It+xt.duration;te>Ut.at+Y&&N.push({id:pt,type:Ut.type,date:Ut.at,scheduled:te,at:Ut.at,earliestFeasible:It});break}default:break}if(Ot.locked){const te=Ut&&Ut.at!=null?Ut.type==="MFO"?Ut.at-xt.duration:Ut.type==="MSO"?Ut.at:null:null,ne=Ot.earliestStart!=null?Ot.earliestStart:te??It;if(It-Y>ne)for(const Yt of Lt.get(pt)){const Nt=Mt.get(Yt.from);let qt;switch(Yt.type){case"FS":qt=Nt.ef+Yt.lag;break;case"SS":qt=Nt.es+Yt.lag;break;case"FF":qt=Nt.ef+Yt.lag-xt.duration;break;case"SF":qt=Nt.es+Yt.lag-xt.duration;break;default:qt=-1/0}qt>ne+Y&&N.push({id:pt,from:Yt.from,to:pt,type:"LOCKED",date:ne,scheduled:qt,at:ne,earliestFeasible:ne})}It=ne,xt.pinned=!0}xt.es=It,xt.ef=It+xt.duration}const x=p.length?Math.max(...p.map(pt=>Mt.get(pt).ef)):ot,P=Number.isFinite(st)?st:x;for(let pt=Ht.length-1;pt>=0;pt-=1){const Ot=Ht[pt],xt=Mt.get(Ot);let It=P;const Ut=E.get(Ot);Ut!=null&&Ut<It&&(It=Ut);for(const te of ee.get(Ot)){const ne=Mt.get(te.to);let Yt;switch(te.type){case"FS":Yt=ne.ls-te.lag;break;case"SS":Yt=ne.ls-te.lag+xt.duration;break;case"FF":Yt=ne.lf-te.lag;break;case"SF":Yt=ne.lf-te.lag+xt.duration;break;default:Yt=1/0}Yt<It&&(It=Yt)}xt.pinned&&(It=xt.ef),xt.lf=It,xt.ls=It-xt.duration,xt.totalFloat=xt.ls-xt.es,xt.critical=xt.totalFloat<=Y,Ut!=null&&(xt.deadline=Ut,xt.late=xt.ef>Ut+Y)}for(const pt of p){const Ot=ht.get(pt);if(!Ot||Ot.type!=="ALAP")continue;const xt=Mt.get(pt);xt.es=xt.ls,xt.ef=xt.lf,xt.totalFloat=0,xt.critical=!0}const Q=p.filter(pt=>Mt.get(pt).critical),yt=At?[]:B(p,j,Mt);return{ok:!0,tasks:Mt,critical:Q,criticalPaths:yt,projectFinish:x,conflicts:N}}function wt(p,A=[],j={}){const ot=bt(j.projectStart)??0,st=bt(j.deadline),ht=dt(j.calendar,ot),E=$t=>$t==null?null:ht?ht.indexOf($t):$t,At=$t=>ht?ht.dayOf($t):$t,ft=et(p,j.fields,j.lockWhen);if(!ft.ok)return{ok:!1,error:ft.error};const{order:Ht,byId:Lt}=ft,ee=mt(Ht,Lt);if(!ee.ok)return{ok:!1,error:ee.error};const Mt=O(A,Lt,ee);if(!Mt.ok)return{ok:!1,error:Mt.error};const N=j.honourDates?v(Mt.edges,Lt,E):Mt.edges,x={defaultMode:e(j.schedulingMode)||"fixedDuration",defaultEffortDriven:!!j.effortDriven,hoursPerDay:z(j.hoursPerDay)??i,resourceHours:j.resourceHours instanceof Map?j.resourceHours:new Map},P=new Map;for(const $t of Ht){if(ee.isSummary($t))continue;const Jt=Lt.get($t);if(!(Jt.schedulingMode!=null||Jt.effortDriven!=null||Jt.statedEffort!=null||j.schedulingMode!=null||j.effortDriven!=null))continue;const $e=l(Jt,x);$e.duration!=null&&(Jt.duration=$e.duration),P.set($t,{schedulingMode:$e.schedulingMode,effortDriven:$e.effortDriven,effort:$e.effort,units:$e.units})}const Q=$(Ht,Lt,ee),yt=Ht.filter($t=>!ee.isSummary($t)&&!Q.has($t)),pt=new Map(yt.map($t=>{const Jt=Lt.get($t);return[$t,{...Jt,earliestStart:E(Jt.earliestStart)}]})),Ot=new Map;for(const $t of yt){const Jt=Lt.get($t).constraint;Jt&&Ot.set($t,{type:Jt.type,at:E(Jt.at)})}const xt=ht?ht.indexOf(ot):ot,It=st==null?void 0:E(st),Ut=new Map;for(const $t of yt){const Jt=pt.get($t).deadline;if(Jt==null)continue;const he=ht?ht.indexOf(Jt):Jt;Number.isFinite(he)&&Ut.set($t,he)}const te=D(K(N,ee),Q),ne=rt(yt,pt,te,xt,It,Ot,Ut,!!j.skipCriticalPaths);if(!ne.ok)return{ok:!1,error:ne.error};const Yt=ne.tasks;for(const $t of yt){const Jt=Yt.get($t);Jt.es=At(Jt.es),Jt.ef=At(Jt.ef),Jt.ls=At(Jt.ls),Jt.lf=At(Jt.lf),Jt.deadline!=null&&(Jt.deadline=At(Jt.deadline)),ct(Jt,Lt.get($t).baselineStart,Lt.get($t).baselineEnd);const he=P.get($t);he&&(Jt.schedulingMode=he.schedulingMode,Jt.effortDriven=he.effortDriven,Jt.effort=he.effort,Jt.units=he.units)}for(const $t of Ht)Q.has($t)&&Yt.set($t,k(Lt.get($t),ee.isSummary($t)));for(let $t=Ht.length-1;$t>=0;$t-=1){const Jt=Ht[$t];!ee.isSummary(Jt)||Q.has(Jt)||Yt.set(Jt,vt(Jt,Lt.get(Jt),ee,Yt))}for(const $t of Ht)ee.isSummary($t)&&(Yt.get($t).children=ee.children.get($t).slice());const Nt=ht?ht.anchor:ot,qt=At(ne.projectFinish);return{ok:!0,tasks:Yt,order:Ht,critical:ne.critical,criticalPaths:ne.criticalPaths,projectStart:Nt,projectFinish:qt,projectDuration:qt-Nt,conflicts:(ne.conflicts||[]).map($t=>({id:$t.id,type:$t.type,date:At($t.date),scheduled:At($t.scheduled),at:At($t.at),earliestFeasible:At($t.earliestFeasible),...$t.from!==void 0?{from:$t.from,to:$t.to}:null})),calendar:!!ht,unscheduled:Ht.filter($t=>Q.has($t)),...j.honourDates?{dependencies:N}:{}}}function ct(p,A,j){A==null&&j==null||(p.baselineStart=A??null,p.baselineEnd=j??null,p.startVariance=A==null?null:p.es-A,p.finishVariance=j==null?null:p.ef-j,p.durationVariance=A==null||j==null?null:p.ef-p.es-(j-A))}function vt(p,A,j,ot){const st=j.children.get(p).map(P=>ot.get(P)).filter(P=>!P.unscheduled),ht=Math.min(...st.map(P=>P.es)),E=Math.max(...st.map(P=>P.ef)),At=Math.min(...st.map(P=>P.ls)),ft=Math.max(...st.map(P=>P.lf)),Ht=j.descendantLeaves(p).map(P=>ot.get(P)).filter(P=>!P.unscheduled),Lt=Ht.reduce((P,Q)=>P+Q.duration,0),ee=Lt>Y?Ht.reduce((P,Q)=>P+Q.duration*(Q.percentComplete??0),0)/Lt:null,Mt={id:p,name:A.name,duration:E-ht,es:ht,ef:E,ls:At,lf:ft,totalFloat:At-ht,critical:st.some(P=>P.critical),percentComplete:ee,parent:A.parent,isSummary:!0,isMilestone:!1,locked:!1,children:[],colour:A.colour??null},N=Ht.map(P=>P.baselineStart).filter(P=>P!=null),x=Ht.map(P=>P.baselineEnd).filter(P=>P!=null);return(N.length||x.length)&&ct(Mt,N.length?Math.min(...N):null,x.length?Math.max(...x):null),Mt}function B(p,A,j){const ot=new Map(p.map(ft=>[ft,[]])),st=new Set;for(const ft of A){const Ht=j.get(ft.from),Lt=j.get(ft.to);if(!Ht.critical||!Lt.critical)continue;let ee;switch(ft.type){case"FS":ee=Ht.ef+ft.lag;break;case"SS":ee=Ht.es+ft.lag;break;case"FF":ee=Ht.ef+ft.lag-Lt.duration;break;case"SF":ee=Ht.es+ft.lag-Lt.duration;break;default:ee=-1/0}Math.abs(ee-Lt.es)<=Y&&(ot.get(ft.from).push(ft.to),st.add(ft.to))}const ht=p.filter(ft=>j.get(ft).critical&&!st.has(ft)),E=[],At=(ft,Ht)=>{const Lt=ot.get(ft);if(!Lt.length){E.push(Ht);return}for(const ee of Lt)At(ee,Ht.concat(ee))};for(const ft of ht)At(ft,[ft]);return E}function Qt(p,A,j){if(!A||!A.ok)return[];const ot=[],st=lt(j);for(const ht of p){const E=ht?st.id(ht):null,At=E!=null?String(E):null;if(At==null||!A.tasks.has(At))continue;const ft=A.tasks.get(At);if(ft.isSummary)continue;const Ht=z(st.start(ht));Ht==null||ft.unscheduled||Ht<ft.es-Y&&ot.push({id:At,placedStart:Ht,earliestStart:ft.es,by:ft.es-Ht})}return ot}}),oe("packages/modules/gantt/resources.js",function(f,ut){"use strict";Object.defineProperty(f,"normalizeCapacities",{enumerable:!0,get:function(){return s}}),Object.defineProperty(f,"resourceDisplayNames",{enumerable:!0,get:function(){return e}}),Object.defineProperty(f,"resourceSpecsByKey",{enumerable:!0,get:function(){return i}}),Object.defineProperty(f,"resourceAvatars",{enumerable:!0,get:function(){return o}}),Object.defineProperty(f,"normalizeResources",{enumerable:!0,get:function(){return W}}),Object.defineProperty(f,"resourceDailyHours",{enumerable:!0,get:function(){return z}}),Object.defineProperty(f,"sweepLoad",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(f,"computeResourceLoad",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(f,"normalizeResourceRates",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(f,"rateOn",{enumerable:!0,get:function(){return Et}}),Object.defineProperty(f,"levelResources",{enumerable:!0,get:function(){return et}});const tt=ut("packages/core/src/internal/util.js").warnOnce,at=ut("packages/modules/gantt/schedule.js"),dt=at.computeSchedule,nt=at.EPS,q=at.taskIdReader,T=at.resolveConstraintCode,d=ut("packages/modules/gantt/assignments.js"),h=d.parseAssignments,$=ut("packages/modules/gantt/calendar.js").createCalendar,k=ut("packages/modules/gantt/time.js"),_=k.fromDayNumber,S=k.toDayNumber;Object.defineProperty(f,"parseAssignments",{enumerable:!0,get:function(){return d.parseAssignments}});const b=Object.freeze([1,2,3,4,5]),y=8;function g(w){if(w==null||w==="")return null;const J=typeof w=="number"?w:Number(w);return Number.isFinite(J)?J:null}function s(w,J){const O=new Map;if(Array.isArray(w))for(const K of w){const v=K&&(K.id??K.name??K.resource);if(v==null||v==="")continue;const F=g(K.capacity??K.maxUnits??K.max??K.units);O.set(String(v),F??J)}else if(w&&typeof w=="object")for(const[K,v]of Object.entries(w)){const F=g(v);O.set(String(K),F??J)}return O}function e(w){const J=new Map;if(Array.isArray(w))for(const O of w){if(!O)continue;const K=O.id??O.name??O.resource;if(K==null||K==="")continue;const v=O.name??O.id??O.resource;J.set(String(K),String(v))}else if(w&&typeof w=="object")for(const[O,K]of Object.entries(w))J.set(O,K&&typeof K=="object"&&K.name!=null?String(K.name):O);return J}function i(w){const J=new Map;if(Array.isArray(w))for(const O of w){if(!O||typeof O!="object")continue;const K=O.id??O.name??O.resource;K!=null&&K!==""&&J.set(String(K),{...O})}else if(w&&typeof w=="object")for(const[O,K]of Object.entries(w))J.set(O,K&&typeof K=="object"?{...K}:{capacity:K});return J}function o(w){const J=new Map,O=K=>typeof K=="string"?K.trim():"";if(Array.isArray(w))for(const K of w){if(!K)continue;const v=K.id??K.name??K.resource;if(v==null||v==="")continue;const F=O(K.avatar);F&&J.set(String(v),F)}else if(w&&typeof w=="object")for(const[K,v]of Object.entries(w)){const F=v&&typeof v=="object"?O(v.avatar):"";F&&J.set(K,F)}return J}function l(w){const J=new Set;for(const O of Array.isArray(w)?w:[]){if(O&&typeof O=="object"&&!(O instanceof Date)&&("from"in O||"to"in O)){const v=S(O.from),F=S(O.to??O.from);if(v==null)continue;const R=F??v;for(let it=Math.min(v,R);it<=Math.max(v,R);it+=1)J.add(it);continue}const K=S(O);K!=null&&J.add(K)}return J}function L(w){return w==null?{workdays:[0,1,2,3,4,5,6],holidays:new Set}:w==="weekends"?{workdays:[...b],holidays:new Set}:{workdays:Array.isArray(w.workdays)&&w.workdays.length?w.workdays.map(Number).filter(O=>O>=0&&O<=6):[...b],holidays:l(w.holidays)}}function Y(w,J,O,K){const v=new Set(Array.isArray(w.workingDays)&&w.workingDays.length?w.workingDays.map(Number).filter(p=>p>=0&&p<=6):K.workdays),F=l(w.holidays);for(const p of K.holidays)F.add(p);const R=w.hoursPerDay,it=p=>{if(R!=null&&typeof R=="object"){const j=g(R[p]);return j??O}const A=g(R);return A??O},G=p=>{const A=_(p);return A?v.has(A.getUTCDay())&&!F.has(p):!1},rt=p=>G(p)?J??it(_(p).getUTCDay()):0,wt=p=>O>0?rt(p)/O:0;let ct=0;for(const p of v){const A=J??it(p);A>ct&&(ct=A)}const vt=O>0?ct/O:0;let B=0;for(const p of K.workdays)v.has(p)&&(B+=J??it(p));const Qt=K.workdays.length?B/K.workdays.length:O;return{hasCalendar:!0,capacityUnits:vt,hoursPerWorkingDay:Qt,worksOn:G,capacityHoursOn:rt,capacityUnitsOn:wt}}function W(w,J,O={}){const K=g(O.hoursPerDay)??y,v=L(O.calendar),F=new Map,R=(it,G)=>{const rt=g(G.capacity??G.maxUnits??G.max??G.units);G.calendar&&typeof G.calendar=="object"?F.set(it,Y(G.calendar,rt,K,v)):F.set(it,{hasCalendar:!1,capacityUnits:rt??J,hoursPerWorkingDay:K})};if(Array.isArray(w))for(const it of w){const G=it&&(it.id??it.name??it.resource);G==null||G===""||R(String(G),it)}else if(w&&typeof w=="object")for(const[it,G]of Object.entries(w))R(String(it),typeof G=="object"&&G?G:{capacity:G});return F}function z(w,J,O={}){const K=g(O.hoursPerDay)??y,v=W(w,J,O),F=new Map;for(const[R,it]of v)F.set(R,it.hoursPerWorkingDay!=null?it.hoursPerWorkingDay:K);return F}function kt(w){if(!w.length)return[];const J=new Set;for(const v of w)J.add(v.s),J.add(v.e);const O=[...J].sort((v,F)=>v-F),K=[];for(let v=0;v<O.length-1;v+=1){const F=O[v],R=O[v+1];if(R<=F)continue;let it=0;const G=[];for(const rt of w)rt.s<=F&&rt.e>=R&&(it+=rt.units,G.push(rt.taskId));G.length&&K.push({s:F,e:R,load:it,taskIds:G})}return K}function bt(w,J,O={}){const K={ok:!1,resources:[],overAllocations:[],byResource:new Map};if(!J||!J.ok)return K;const v=g(O.defaultCapacity)??1,F=s(O.resources,v),R=W(O.resources,v,{calendar:O.calendar,hoursPerDay:O.hoursPerDay}),it=O.calendar!=null?$(O.calendar,J.projectStart):null,G=j=>F.has(j)?F.get(j):v,rt=j=>it?it.indexOf(j):j,wt=j=>it?it.dayOf(j):j,ct=q(O.fields),vt=new Map;for(const j of w){if(!j)continue;const ot=ct(j);if(ot==null)continue;const st=String(ot);vt.has(st)||vt.set(st,j)}const B=new Map;for(const j of J.order){const ot=J.tasks.get(j);if(!ot||ot.isSummary||ot.unscheduled)continue;const st=vt.get(j);if(!st)continue;const ht=h(st);if(!ht.length)continue;const E=rt(ot.es),At=rt(ot.ef);if(!(At<=E))for(const ft of ht)B.has(ft.resource)||B.set(ft.resource,[]),B.get(ft.resource).push({s:E,e:At,units:ft.units,taskId:j})}const Qt=new Map,p=[],A=[];for(const[j,ot]of B){const st=R.get(j),ht=kt(ot);let E=0,At,ft;if(st&&st.hasCalendar){ft=st.capacityUnits,At=[];for(const Lt of ht){Lt.load>E&&(E=Lt.load);let ee=Lt.s,Mt=st.capacityUnitsOn(wt(Lt.s));const N=x=>{const P={start:wt(ee),end:wt(x),load:Lt.load,taskIds:Lt.taskIds};At.push(P),Lt.load>Mt+nt&&A.push({resource:j,capacity:Mt,start:P.start,end:P.end,load:Lt.load,taskIds:Lt.taskIds.slice()})};for(let x=Lt.s+1;x<Lt.e;x+=1){const P=st.capacityUnitsOn(wt(x));P!==Mt&&(N(x),ee=x,Mt=P)}N(Lt.e)}}else ft=G(j),At=ht.map(Lt=>{Lt.load>E&&(E=Lt.load);const ee={start:wt(Lt.s),end:wt(Lt.e),load:Lt.load,taskIds:Lt.taskIds};return Lt.load>ft+nt&&A.push({resource:j,capacity:ft,start:ee.start,end:ee.end,load:Lt.load,taskIds:Lt.taskIds.slice()}),ee});const Ht={resource:j,capacity:ft,peak:E,segments:At};Qt.set(j,Ht),p.push(Ht)}return p.sort((j,ot)=>j.resource<ot.resource?-1:j.resource>ot.resource?1:0),A.sort((j,ot)=>j.start-ot.start||(j.resource<ot.resource?-1:1)),{ok:!0,resources:p,overAllocations:A,byResource:Qt}}function _t(w){const J=[];for(const O of Array.isArray(w)?w:[]){const K=S(O&&O.from),v=g(O&&O.rate);K==null||v==null||J.push({from:Math.round(K),rate:v})}return J.sort((O,K)=>O.from-K.from),J}function lt(w){const J=new Map,O=(K,v)=>{if(!v||typeof v!="object")return;const F=v.type==="material"||v.type==="cost"?v.type:"work",R=g(v.rate),it=_t(v.rates),G=g(v.cost);R==null&&!it.length&&G==null||J.set(K,{type:F,rate:R,rates:it,cost:G})};if(Array.isArray(w))for(const K of w){const v=K&&(K.id??K.name??K.resource);v==null||v===""||O(String(v),K)}else if(w&&typeof w=="object")for(const[K,v]of Object.entries(w))v&&typeof v=="object"&&O(K,v);return J}function Et(w,J){if(!w)return null;let O=w.rate;for(const K of w.rates)if(K.from<=J)O=K.rate;else break;return O??null}function Rt(w){if(!w)return!1;const J=w.constraint??w.constraintType;if(J==null||J==="")return!1;const O=String(J).toLowerCase().replace(/\s+/g,"-");return O==="mso"||O==="must-start-on"||O==="muststarton"||O==="start-on"||O==="mfo"||O==="must-finish-on"||O==="mustfinishon"||O==="finish-on"}function Gt(w){if(!w)return null;const J=w.constraint??w.constraintType,O=T(J);if(O!=="SNLT"&&O!=="FNLT")return null;let K=w.constraintDate??w.constraintAt??w.at;if(J&&typeof J=="object"&&K==null&&(K=J.date),K==null||K==="")return null;const v=S(K);return Number.isFinite(v)?{type:O,date:v}:null}function X(w,J){return w?g(w[J])??0:0}function et(w,J,O={}){const K={projectStart:O.projectStart,deadline:O.deadline,calendar:O.calendar,fields:O.fields,skipCriticalPaths:!0},v=O.priorityField||"priority",F=O.maxIterations!=null?O.maxIterations:Math.max(100,w.length*w.length*2),R=q(O.fields),it=w.map(ft=>({...ft})),G=it.map(ft=>String(R(ft))),rt=new Map(it.map(ft=>[String(R(ft)),ft])),wt=new Map(G.map((ft,Ht)=>[ft,Ht])),ct=ft=>wt.has(ft)?wt.get(ft):-1;let vt=dt(it,J,K);if(!vt.ok)return{ok:!1,error:vt.error};const B=new Map;for(const ft of vt.order){const Ht=vt.tasks.get(ft);Ht&&!Ht.isSummary&&!Ht.unscheduled&&B.set(ft,Ht.es)}const Qt=g(O.defaultCapacity)??1,p=W(O.resources,Qt,{calendar:O.calendar,hoursPerDay:O.hoursPerDay}),A=O.calendar!=null?$(O.calendar,vt.projectStart):null,j=(ft,Ht)=>{const Lt=h(Ht).map(Mt=>p.get(Mt.resource)).filter(Mt=>Mt&&Mt.hasCalendar);let ee=Math.round(ft);for(let Mt=0;Mt<3660;Mt+=1){if((!A||A.isWorking(ee))&&Lt.every(N=>N.worksOn(ee)))return ee;ee+=1}return Math.round(ft)};let ot=0;const st=Math.max(32,w.length*2);let ht=1/0,E=0;for(;ot<F;ot+=1){const ft=bt(it,vt,O);ft.overAllocations.length<ht?(ht=ft.overAllocations.length,E=0):E+=1;const Ht=ft.overAllocations.filter(P=>new Set(P.taskIds).size>=2);if(!Ht.length)return{ok:!0,resolved:ft.overAllocations.length===0,tasks:it,schedule:vt,moves:mt(B,vt),remaining:ft.overAllocations,iterations:ot};if(E>=st)return tt("gantt-level-unresolved",`[lattice] gantt: resource leveling could not clear ${ft.overAllocations.length} over-allocation(s) after ${ot} iterations; the plan cannot be fully levelled, returning the partial result.`),{ok:!0,resolved:!1,tasks:it,schedule:vt,moves:mt(B,vt),remaining:ft.overAllocations,iterations:ot};const ee=Ht.slice().sort((P,Q)=>P.start-Q.start||Q.load-P.load)[0].taskIds.map(P=>vt.tasks.get(P)).filter(Boolean),Mt=ee.filter(P=>!Rt(rt.get(P.id)));if(!Mt.length)return{ok:!0,resolved:!1,tasks:it,schedule:vt,moves:mt(B,vt),remaining:ft.overAllocations,iterations:ot};Mt.sort((P,Q)=>{if(Q.totalFloat!==P.totalFloat)return Q.totalFloat-P.totalFloat;const yt=X(rt.get(P.id),v),pt=X(rt.get(Q.id),v);return yt!==pt?yt-pt:Q.es!==P.es?Q.es-P.es:ct(Q.id)-ct(P.id)});let N=null,x=null;for(const P of Mt){const Q=ee.filter(xt=>xt.id!==P.id).map(xt=>xt.ef).filter(xt=>xt>P.es+nt),yt=Q.length?Math.min(...Q):P.es+1,pt=j(yt,rt.get(P.id)),Ot=Gt(rt.get(P.id));if(!(Ot&&(Ot.type==="SNLT"?pt:pt+(P.ef-P.es))>Ot.date+nt)){N=P,x=pt;break}}if(!N)return{ok:!0,resolved:!1,tasks:it,schedule:vt,moves:mt(B,vt),remaining:ft.overAllocations,iterations:ot};if(rt.get(N.id).start=x,vt=dt(it,J,K),!vt.ok)return{ok:!1,error:vt.error}}const At=bt(it,vt,O);return At.overAllocations.length&&tt("gantt-level-unresolved",`[lattice] gantt: resource leveling hit its ${F}-iteration cap with ${At.overAllocations.length} over-allocation(s) unresolved; returning the partial result.`),{ok:!0,resolved:At.overAllocations.length===0,tasks:it,schedule:vt,moves:mt(B,vt),remaining:At.overAllocations,iterations:ot}}function mt(w,J){const O=[];for(const K of J.order){const v=J.tasks.get(K);if(!v||v.isSummary||v.unscheduled)continue;const F=w.get(K);F!=null&&v.es>F+nt&&O.push({id:K,from:F,to:v.es,delay:v.es-F})}return O}}),oe("packages/modules/gantt/workload.js",function(f,ut){"use strict";Object.defineProperty(f,"WORKLOAD_DEFAULTS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(f,"HISTOGRAM_DEFAULTS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(f,"normalizeThresholds",{enumerable:!0,get:function(){return y}}),Object.defineProperty(f,"thresholdFor",{enumerable:!0,get:function(){return g}}),Object.defineProperty(f,"normalizeExternalLoad",{enumerable:!0,get:function(){return e}}),Object.defineProperty(f,"statedHours",{enumerable:!0,get:function(){return o}}),Object.defineProperty(f,"taskContour",{enumerable:!0,get:function(){return l}}),Object.defineProperty(f,"contourTotal",{enumerable:!0,get:function(){return L}}),Object.defineProperty(f,"serializeContour",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(f,"contourSpan",{enumerable:!0,get:function(){return W}}),Object.defineProperty(f,"spanDuration",{enumerable:!0,get:function(){return z}}),Object.defineProperty(f,"spreadHours",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(f,"setContourBucket",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(f,"retimeContour",{enumerable:!0,get:function(){return _t}}),Object.defineProperty(f,"recordWorkingDays",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(f,"workloadBuckets",{enumerable:!0,get:function(){return Et}}),Object.defineProperty(f,"taskAssignmentEffort",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(f,"computeWorkload",{enumerable:!0,get:function(){return Gt}}),Object.defineProperty(f,"formatHours",{enumerable:!0,get:function(){return X}}),Object.defineProperty(f,"formatPercent",{enumerable:!0,get:function(){return et}}),Object.defineProperty(f,"formatCost",{enumerable:!0,get:function(){return mt}});const Pt=ut("packages/modules/gantt/resources.js"),tt=Pt.parseAssignments,at=Pt.rateOn,dt=ut("packages/modules/gantt/schedule.js"),nt=dt.EPS,q=dt.taskIdReader,T=ut("packages/modules/gantt/time.js"),d=T.fromDayNumber,h=T.toDayNumber,D=T.toISODate,k=ut("packages/core/src/internal/util.js").warnOnce,_=Object.freeze({hoursPerDay:8,height:160,rowHeight:28,decimals:1,totals:!0,unit:"hours",thresholds:null,showUnassigned:!0,labelWidth:null}),S=Object.freeze({resources:null,unit:"hours",stacked:!1,height:160,rowHeight:48,labelWidth:null});function b(w){if(w==null||w===""||typeof w=="boolean")return null;const J=typeof w=="number"?w:Number(w);return Number.isFinite(J)?J:null}function y(w){if(!Array.isArray(w))return null;const J=[];for(const O of w){if(!O||typeof O!="object")continue;const K=b(O.at);if(K==null||K<0)continue;const v=typeof O.className=="string"&&O.className?O.className:null,F=typeof O.colour=="string"&&O.colour?O.colour:typeof O.color=="string"&&O.color?O.color:null;!v&&!F||J.push({at:K,className:v,colour:F})}return J.length?(J.sort((O,K)=>O.at-K.at),J):null}function g(w,J){if(!w||J==null||!Number.isFinite(J))return null;let O=null;for(const K of w)if(J>=K.at)O=K;else break;return O}function s(w,J){if(w==null||w==="")return null;if(typeof w=="number")return Number.isFinite(w)?w:null;const O=h(w);return Number.isFinite(O)?O-J:null}function e(w,J=0){if(!Array.isArray(w))return[];const O=[];for(let K=0;K<w.length;K+=1){const v=w[K],F=v&&typeof v=="object"&&v.resource!=null&&v.resource!==""?String(v.resource):null,R=v&&typeof v=="object"?s(v.start,J):null,it=v&&typeof v=="object"?s(v.end,J):null;if(F==null||R==null||it==null){k(`gantt.workloadExternal.${K}`,`[lattice] gantt: workload.external entry ${K} has no resource or no drawable start/end; it is skipped.`);continue}const G=typeof v.label=="string"&&v.label!==""?v.label:null,rt=typeof v.group=="string"&&v.group!==""?v.group:null;O.push({index:K,resource:F,start:R,end:it,units:b(v.units),hours:b(v.hours),label:G,group:rt})}return O}function i(w){const J=h(w.start);if(!Number.isFinite(J))return null;const O=h(w.end);if(Number.isFinite(O))return{es:J,ef:O};const K=b(w.duration);return{es:J,ef:J+(K??0)}}function o(w){if(!w||Array.isArray(w.work))return null;const J=b(w.work);return J??b(w.hours)}function l(w){if(!w||!Array.isArray(w.work))return null;const J=[];for(const K of w.work){if(!K||typeof K!="object")continue;const v=h(K.date),F=b(K.hours);v==null||F==null||J.push({day:Math.round(v),hours:F})}J.sort((K,v)=>K.day-v.day);const O=[];for(const K of J){const v=O[O.length-1];v&&v.day===K.day?v.hours+=K.hours:O.push({day:K.day,hours:K.hours})}return O}function L(w){return(Array.isArray(w)?w:[]).reduce((J,O)=>J+(b(O.hours)??0),0)}function Y(w){const J=[];for(const O of Array.isArray(w)?w:[]){const K=b(O.hours);if(K==null||!(Math.abs(K)>nt))continue;const v=D(O.day);v!=null&&J.push({date:v,hours:Math.round(K*1e6)/1e6})}return J}function W(w){const J=(Array.isArray(w)?w:[]).filter(O=>Math.abs(b(O.hours)??0)>nt);return J.length?{first:J[0].day,last:J[J.length-1].day}:null}function z(w,J,O=null){if(!Number.isFinite(w)||!Number.isFinite(J)||J<w)return 0;if(typeof O!="function")return Math.round(J-w)+1;let K=0;for(let v=Math.round(w);v<=Math.round(J);v+=1)O(v)&&(K+=1);return K}function kt(w,J){if(!Array.isArray(w)||!w.length)return[];const O=J/w.length;return w.map(K=>({day:K,hours:O}))}function bt(w,J,O,K){const v=(Array.isArray(w)?w:[]).filter(R=>!(R.day>=J.start&&R.day<J.end)),F=Math.abs(K)>nt?kt(O,K):[];return[...v,...F].sort((R,it)=>R.day-it.day)}function _t(w,J,O){const K=Array.isArray(J)?J:[],v=Array.isArray(O)?O:[];if(!Array.isArray(w)||!K.length||!v.length)return Array.isArray(w)?w:[];const F=new Map(w.map(rt=>[rt.day,b(rt.hours)??0])),R=K.map(rt=>F.get(rt)??0),it=R.length,G=[];for(let rt=0;rt<v.length;rt+=1){const wt=R[Math.min(it-1,Math.floor(rt*it/v.length))];Math.abs(wt)>nt&&G.push({day:v[rt],hours:wt})}return G}function lt(w,J=null){const O=[];if(!w||!Number.isFinite(w.es)||!Number.isFinite(w.ef))return O;for(let K=Math.floor(w.es);K<Math.ceil(w.ef);K+=1)(typeof J!="function"||J(K))&&O.push(K);return O}function Et(w,J,O){const K=Math.floor(J),v=Math.ceil(O),F=[];if(!(v>K))return F;if(w==="day"){for(let G=K;G<v;G+=1)F.push({start:G,end:G+1});return F}if(w==="month"||w==="quarter"){const G=d(K);if(!G)return F;let rt=Date.UTC(G.getUTCFullYear(),G.getUTCMonth(),1)/864e5;for(;rt<v;){const wt=d(rt),ct=Date.UTC(wt.getUTCFullYear(),wt.getUTCMonth()+1,1)/864e5;F.push({start:rt,end:ct}),rt=ct}return F}const R=d(K);let it=K-(R?R.getUTCDay():0);for(;it<v;it+=7)F.push({start:it,end:it+7});return F}function Rt(w,J,O={}){const K=b(O.hoursPerDay)??_.hoursPerDay,v=typeof O.isWorking=="function"?O.isWorking:null,F=lt(J,v),R=l(w);if(!R&&!F.length)return[];const it=tt(w),G=it.length?it:[{resource:null,units:1}],rt=G.reduce((ct,vt)=>ct+(b(vt.units)??0),0);if(!(rt>0))return[];let wt;if(R)wt=R.filter(ct=>Math.abs(ct.hours)>nt);else{const ct=o(w),vt=ct??F.length*K*rt;if(!(Math.abs(vt)>nt))return[];wt=kt(F,vt)}return wt.length?G.map(ct=>{const vt=b(ct.units)??0,B=vt/rt;return{resource:ct.resource,units:vt,unitsTotal:rt,perDay:B>0?wt.map(Qt=>({day:Qt.day,hours:Qt.hours*B})):[]}}):[]}function Gt(w,J,O={}){const K=Array.isArray(O.buckets)?O.buckets:[],v={ok:!1,buckets:[],rows:[],totals:K.map(()=>null),totalsAvailable:K.map(()=>null),totalsCost:K.map(()=>null),grandTotal:0,grandAvailableTotal:null,grandCostTotal:null};if(!J||!J.ok)return v;const F=b(O.hoursPerDay)??_.hoursPerDay,R=typeof O.isWorking=="function"?O.isWorking:null,it=O.capacities instanceof Map?O.capacities:null,G=O.resourceModels instanceof Map?O.resourceModels:null,rt=O.resourceRates instanceof Map?O.resourceRates:null,wt=q(O.fields),ct=new Map,vt=(Mt,N,x,P)=>{ct.has(Mt)||ct.set(Mt,{days:new Map,costs:new Map,tasks:new Map});const Q=ct.get(Mt);if(Q.days.set(N,(Q.days.get(N)||0)+x),rt&&Mt!=null){const pt=at(rt.get(Mt),N);pt!=null&&Q.costs.set(N,(Q.costs.get(N)||0)+x*pt)}Q.tasks.has(P.id)||Q.tasks.set(P.id,{...P,days:new Map});const yt=Q.tasks.get(P.id);yt.days.set(N,(yt.days.get(N)||0)+x)},B=new Map;for(const Mt of Array.isArray(w)?w:[]){const N=Mt?wt(Mt):null;N!=null&&B.set(String(N),Mt)}const Qt=Array.isArray(w)&&J.order.length===w.length;for(let Mt=0;Mt<J.order.length;Mt+=1){const N=J.order[Mt],x=J.tasks.get(N);if(!x||x.isSummary||x.unscheduled)continue;const P=B.get(N)||(Qt?w[Mt]:null);if(!P||P.loadOnly===!0)continue;const Q=Rt(P,x,{hoursPerDay:F,isWorking:R});for(const yt of Q){if(!yt.perDay.length)continue;const pt={id:N,name:x.name,units:yt.units,unitsTotal:yt.unitsTotal,raw:P,loadOnly:!1,external:!1,group:null};for(const Ot of yt.perDay)vt(yt.resource,Ot.day,Ot.hours,pt)}}for(const Mt of Array.isArray(w)?w:[]){if(!Mt||Mt.loadOnly!==!0)continue;const N=i(Mt);if(!N)continue;const x=wt(Mt),P=x!=null?String(x):`loadOnly:${w.indexOf(Mt)}`,Q=Mt.name!=null?String(Mt.name):P,yt=Rt(Mt,N,{hoursPerDay:F,isWorking:R});for(const pt of yt){if(!pt.perDay.length)continue;const Ot={id:P,name:Q,units:pt.units,unitsTotal:pt.unitsTotal,raw:Mt,loadOnly:!0,external:!1,group:null};for(const xt of pt.perDay)vt(pt.resource,xt.day,xt.hours,Ot)}}for(const Mt of Array.isArray(O.external)?O.external:[]){if(!Mt||Mt.resource==null)continue;const N=b(Mt.start),x=b(Mt.end);if(N==null||x==null)continue;const P=lt({es:N,ef:x},R),Q=Mt.hours!=null?b(Mt.hours):P.length*F*(b(Mt.units)??1);if(Q==null||!(Math.abs(Q)>nt)||!P.length)continue;const pt={id:`external:${Mt.index??w.length}`,name:Mt.label,units:null,unitsTotal:null,raw:null,loadOnly:!0,external:!0,group:Mt.group??null};for(const Ot of kt(P,Q))vt(String(Mt.resource),Ot.day,Ot.hours,pt)}const p=Mt=>{let N=0,x=K.length-1;for(;N<=x;){const P=N+x>>1;if(Mt<K[P].start)x=P-1;else if(Mt>=K[P].end)N=P+1;else return P}return-1},A=K.map(Mt=>{let N=0;for(let x=Math.floor(Mt.start);x<Math.ceil(Mt.end);x+=1)(!R||R(x))&&(N+=1);return{start:Mt.start,end:Mt.end,workingDays:N}}),j=Mt=>{const N=A.map(()=>0);for(const[x,P]of Mt){const Q=p(x);Q>=0&&(N[Q]+=P)}return N},ot=[...ct.keys()].filter(Mt=>Mt!=null).sort(),st=ct.has(null)?[...ot,null]:ot,ht=[],E=A.map(()=>0),At=A.map(()=>null),ft=rt?A.map(()=>0):A.map(()=>null);let Ht=0,Lt=rt?0:null;for(const Mt of st){const N=ct.get(Mt),x=j(N.days),P=rt?j(N.costs):null,Q=Mt!=null&&it&&it.has(Mt)?it.get(Mt):null,yt=Mt!=null&&G?G.get(Mt):null,pt=x.map(Yt=>Math.abs(Yt)>nt?Yt:null),Ot=x.map((Yt,Nt)=>{if(yt&&yt.hasCalendar){let qt=0;for(let $t=Math.floor(A[Nt].start);$t<Math.ceil(A[Nt].end);$t+=1)(!R||R($t))&&(qt+=yt.capacityHoursOn($t));return qt}return Q==null?null:Q*F*A[Nt].workingDays}),xt=x.map((Yt,Nt)=>Ot[Nt]!=null&&Yt>Ot[Nt]+nt);let It=0,Ut=null,te=rt?0:null;x.forEach((Yt,Nt)=>{It+=Yt,E[Nt]+=Yt,Ot[Nt]!=null&&(Ut=(Ut??0)+Ot[Nt],At[Nt]=(At[Nt]??0)+Ot[Nt]),P&&(te+=P[Nt],ft[Nt]+=P[Nt])}),Ht+=It,rt&&(Lt+=te);const ne=[...N.tasks.values()].map(Yt=>{const Nt=j(Yt.days);return{id:Yt.id,name:Yt.name,units:Yt.units,unitsTotal:Yt.unitsTotal,raw:Yt.raw,cells:Nt.map(qt=>Math.abs(qt)>nt?qt:null),total:Nt.reduce((qt,$t)=>qt+$t,0),loadOnly:!!Yt.loadOnly,external:!!Yt.external,group:Yt.group??null}});ht.push({resource:Mt,capacity:Q,available:Ot,availableTotal:Ut,cells:pt,over:xt,total:It,costCells:P?P.map(Yt=>Math.abs(Yt)>nt?Yt:null):null,costTotal:te,tasks:ne})}let ee=null;for(const Mt of At)Mt!=null&&(ee=(ee??0)+Mt);return{ok:!0,buckets:A,rows:ht,totals:E.map(Mt=>Math.abs(Mt)>nt?Mt:null),totalsAvailable:At,totalsCost:ft,grandTotal:Ht,grandAvailableTotal:ee,grandCostTotal:Lt}}function X(w,J){if(w==null||!Number.isFinite(w))return"";const K=10**(Number.isFinite(J)?Math.max(0,Math.min(6,Math.round(J))):1),v=Math.round(w*K)/K;return Object.is(v,-0)||v===0?"0":String(v)}function et(w,J,O){if(J==null||!(J>nt))return"–";const K=Number.isFinite(w)?w:0;return X(K/J*100,O)}function mt(w,J=2){return X(w,J)}}),oe("packages/modules/gantt/cost.js",function(f,ut){"use strict";Object.defineProperty(f,"computeCost",{enumerable:!0,get:function(){return $}});const Pt=ut("packages/modules/gantt/resources.js"),tt=Pt.parseAssignments,at=Pt.normalizeResourceRates,dt=Pt.rateOn,q=ut("packages/modules/gantt/workload.js").taskAssignmentEffort,d=ut("packages/modules/gantt/schedule.js").taskIdReader;function h(k){if(k==null||k==="")return null;const _=typeof k=="number"?k:Number(k);return Number.isFinite(_)?_:null}function D(k,_,S,b){const y=h(k?k[b.costField]:null)??0;let g=0,s=!1;const e=tt(k),o=e.some(l=>{const L=S.get(l.resource);return!L||L.type==="work"})?q(k,_,{hoursPerDay:b.hoursPerDay,isWorking:b.isWorking}):null;for(let l=0;l<e.length;l+=1){const L=e[l],Y=S.get(L.resource);if(Y)if(Y.type==="cost")Y.cost!=null&&(g+=Y.cost,s=!0);else if(Y.type==="material"){const W=dt(Y,Math.round(_.es));W!=null&&(g+=(h(L.units)??0)*W,s=!0)}else{const W=o?o[l]:null;if(!W)continue;for(const z of W.perDay){const kt=dt(Y,z.day);kt!=null&&(g+=z.hours*kt,s=!0)}}}return{cost:y+g,rateCost:g,fixedCost:y,hasRate:s}}function $(k,_,S={}){if(!_||!_.ok||!_.tasks||!_.order)return{ok:!1,error:{code:"NO_SCHEDULE",message:"cost needs a successful schedule"}};const b=S.costField||"cost",y=h(S.hoursPerDay)??8,g=typeof S.isWorking=="function"?S.isWorking:null,s=S.resourceRates instanceof Map?S.resourceRates:at(S.resources),e=d(S.fields),i=new Map;for(const z of Array.isArray(k)?k:[]){const kt=e(z);kt!=null&&i.set(String(kt),z)}const o=()=>({cost:0,rateCost:0,fixedCost:0,hasRate:!1}),l=new Map;for(const z of _.order)l.set(z,o());const L=o();for(const z of _.order){const kt=_.tasks.get(z);if(!kt||kt.isSummary||kt.unscheduled)continue;const bt=D(i.get(z),kt,s,{hoursPerDay:y,isWorking:g,costField:b});let _t=z;for(;_t!=null&&l.has(_t);){const lt=l.get(_t);lt.cost+=bt.cost,lt.rateCost+=bt.rateCost,lt.fixedCost+=bt.fixedCost,bt.hasRate&&(lt.hasRate=!0),_t=_.tasks.get(_t).parent}L.cost+=bt.cost,L.rateCost+=bt.rateCost,L.fixedCost+=bt.fixedCost,bt.hasRate&&(L.hasRate=!0)}const Y=new Map,W=[];for(const z of _.order){const kt=_.tasks.get(z),bt=l.get(z),_t={id:kt.id,name:kt.name,isSummary:!!kt.isSummary,isMilestone:!!kt.isMilestone,cost:bt.cost,rateCost:bt.rateCost,fixedCost:bt.fixedCost,hasRate:bt.hasRate};Y.set(z,_t),W.push(_t)}return{ok:!0,byTask:Y,rows:W,project:{...L}}}}),oe("packages/modules/gantt/earned-value.js",function(f,ut){"use strict";Object.defineProperty(f,"computeEarnedValue",{enumerable:!0,get:function(){return D}});const tt=ut("packages/modules/gantt/time.js").toDayNumber,dt=ut("packages/modules/gantt/schedule.js").taskIdReader,nt=1e-9;function q($){if($==null||$==="")return null;const k=typeof $=="number"?$:Number($);return Number.isFinite(k)?k:null}function T($,k,_){return _-k<=nt?$>=_?1:0:$<=k?0:$>=_?1:($-k)/(_-k)}function d($,k,_,S,b,y){const g=k?q(k[S]):null,s=g??(y&&y.hasRate?y.cost:$.duration),e=k?q(k[b]):null,i=$.percentComplete==null?0:Math.max(0,Math.min(100,$.percentComplete))/100,o=$.baselineStart!=null||$.baselineEnd!=null,l=$.baselineStart!=null?$.baselineStart:$.es,L=$.baselineEnd!=null?$.baselineEnd:$.ef,Y=s*T(_,l,L),W=s*i;return{bac:s,pv:Y,ev:W,ac:e,hasBaseline:o}}function h($){const k=$.ac;return{bac:$.bac,pv:$.pv,ev:$.ev,ac:k,sv:$.ev-$.pv,cv:k==null?null:$.ev-k,spi:Math.abs($.pv)<nt?null:$.ev/$.pv,cpi:k==null||Math.abs(k)<nt?null:$.ev/k}}function D($,k,_={}){if(!k||!k.ok||!k.tasks||!k.order)return{ok:!1,error:{code:"NO_SCHEDULE",message:"earned value needs a successful schedule"}};const S=_.costField||"cost",b=_.actualCostField||"actualCost",y=_.statusDate==null?k.projectFinish:tt(_.statusDate)??k.projectFinish,g=_.rateCosts instanceof Map?_.rateCosts:null,s=dt(_.fields),e=new Map;for(const z of Array.isArray($)?$:[]){const kt=s(z);kt!=null&&e.set(String(kt),z)}const i=()=>({bac:0,pv:0,ev:0,ac:0,acAny:!1,hasBaseline:!1}),o=new Map;for(const z of k.order)o.set(z,i());const l=i();for(const z of k.order){const kt=k.tasks.get(z);if(!kt||kt.isSummary||kt.unscheduled)continue;const bt=d(kt,e.get(z),y,S,b,g?g.get(z):null);let _t=z;for(;_t!=null&&o.has(_t);){const lt=o.get(_t);lt.bac+=bt.bac,lt.pv+=bt.pv,lt.ev+=bt.ev,bt.ac!=null&&(lt.ac+=bt.ac,lt.acAny=!0),bt.hasBaseline&&(lt.hasBaseline=!0),_t=k.tasks.get(_t).parent}l.bac+=bt.bac,l.pv+=bt.pv,l.ev+=bt.ev,bt.ac!=null&&(l.ac+=bt.ac,l.acAny=!0),bt.hasBaseline&&(l.hasBaseline=!0)}const L=z=>h({bac:z.bac,pv:z.pv,ev:z.ev,ac:z.acAny?z.ac:null}),Y=new Map,W=[];for(const z of k.order){const kt=k.tasks.get(z),bt=o.get(z),_t={id:kt.id,name:kt.name,isSummary:!!kt.isSummary,isMilestone:!!kt.isMilestone,percentComplete:kt.percentComplete??null,hasBaseline:bt.hasBaseline,hasActualCost:bt.acAny,...L(bt)};Y.set(z,_t),W.push(_t)}return{ok:!0,statusDate:y,byTask:Y,rows:W,project:{hasActualCost:l.acAny,hasBaseline:l.hasBaseline,...L(l)}}}}),oe("packages/modules/gantt/mspdi.js",function(f,ut){"use strict";Object.defineProperty(f,"parseXml",{enumerable:!0,get:function(){return L}}),Object.defineProperty(f,"importMSPDI",{enumerable:!0,get:function(){return Gt}}),Object.defineProperty(f,"exportMSPDI",{enumerable:!0,get:function(){return w}});const tt=ut("packages/core/src/internal/util.js").warnOnce,at=ut("packages/modules/gantt/time.js"),dt=at.toDayNumber,nt=at.toISODate,q=ut("packages/modules/gantt/schedule.js"),T=q.taskIdReader,d=q.resolveConstraintCode,h=q.resolveSchedulingMode,D=Object.freeze({0:"FF",1:"FS",2:"SF",3:"SS"}),$=Object.freeze({FF:0,FS:1,SF:2,SS:3}),k=Object.freeze({0:"ASAP",1:"as-late-as-possible",2:"must-start-on",3:"must-finish-on",4:"SNET",5:"SNLT",6:"FNET",7:"FNLT"}),_=Object.freeze({ASAP:0,ALAP:1,MSO:2,MFO:3,SNET:4,SNLT:5,FNET:6,FNLT:7}),S=Object.freeze({0:"fixedUnits",1:"fixedDuration",2:"fixedEffort"}),b=Object.freeze({fixedUnits:0,fixedDuration:1,fixedEffort:2}),y=Object.freeze({0:"material",1:"work",2:"cost"}),g=Object.freeze({material:0,work:1,cost:2});function s(G){if(G==null)return null;const rt=/^(-?[0-9.]+)/.exec(String(G).trim());if(!rt)return null;const wt=Number(rt[1]);return Number.isFinite(wt)?wt:null}function e(G){if(G==null||G==="")return null;const rt=typeof G=="number"?G:Number(G);return Number.isFinite(rt)?rt:null}function i(G){return String(G).replace(/&(#x?[0-9a-fA-F]+|lt|gt|amp|quot|apos);/g,(rt,wt)=>{if(wt[0]==="#"){const ct=wt[1]==="x"||wt[1]==="X"?parseInt(wt.slice(2),16):parseInt(wt.slice(1),10);return Number.isFinite(ct)?String.fromCodePoint(ct):rt}return{lt:"<",gt:">",amp:"&",quot:'"',apos:"'"}[wt]??rt})}function o(G){return String(G??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function l(G){const rt=G.indexOf(":");return rt<0?G:G.slice(rt+1)}function L(G){const rt=String(G);let wt=0;const ct=[];let vt=null;for(;wt<rt.length;){const B=rt.indexOf("<",wt);if(B<0)break;if(B>wt&&ct.length){const E=rt.slice(wt,B);E.trim()&&(ct[ct.length-1].text+=i(E))}if(rt.startsWith("<?",B)){const E=rt.indexOf("?>",B);wt=E<0?rt.length:E+2;continue}if(rt.startsWith("<!--",B)){const E=rt.indexOf("-->",B);wt=E<0?rt.length:E+3;continue}if(rt.startsWith("<![CDATA[",B)){const E=rt.indexOf("]]>",B);ct.length&&(ct[ct.length-1].text+=rt.slice(B+9,E<0?rt.length:E)),wt=E<0?rt.length:E+3;continue}if(rt.startsWith("<!",B)){const E=rt.indexOf(">",B);wt=E<0?rt.length:E+1;continue}const Qt=rt.indexOf(">",B);if(Qt<0)break;let p=rt.slice(B+1,Qt).trim();if(p[0]==="/"){ct.pop(),wt=Qt+1;continue}const A=p.endsWith("/");A&&(p=p.slice(0,-1).trim());const j=p.search(/\s/),ot=l(j<0?p:p.slice(0,j)),st={};if(j>=0)for(const E of p.slice(j).matchAll(/([\w:.-]+)\s*=\s*"([^"]*)"|([\w:.-]+)\s*=\s*'([^']*)'/g))st[l(E[1]??E[3])]=i(E[2]??E[4]??"");const ht={name:ot,attrs:st,children:[],text:""};ct.length?ct[ct.length-1].children.push(ht):vt||(vt=ht),A||ct.push(ht),wt=Qt+1}return vt}function Y(G,rt){return G?G.children.find(wt=>wt.name===rt):void 0}function W(G,rt){return G?G.children.filter(wt=>wt.name===rt):[]}function z(G,rt){const wt=Y(G,rt);return wt?wt.text.trim():void 0}function kt(G){if(!G)return null;const rt=String(G).match(/^\d{4}-\d{2}-\d{2}/);return dt(rt?rt[0]:G)}function bt(G,rt){return`${nt(G)}T${String(rt).padStart(2,"0")}:00:00`}function _t(G,rt){if(!G)return null;const wt=String(G).match(/PT?(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?/);return wt?((Number(wt[1])||0)+(Number(wt[2])||0)/60+(Number(wt[3])||0)/3600)/rt:null}function lt(G,rt){return`PT${Math.round((G||0)*rt*1e3)/1e3}H0M0S`}function Et(G,rt){return(Number(G)||0)/(600*rt)}function Rt(G,rt){return Math.round((G||0)*10*60*rt)}function Gt(G,rt={}){const wt=rt.hoursPerDay??8,ct=L(G);if(!ct||ct.name!=="Project")return tt("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 vt=kt(z(ct,"StartDate")),B=Y(ct,"Resources"),Qt=Y(ct,"Calendars"),p=W(Qt,"Calendar"),A=new Map,j=[];for(const N of W(B,"Resource")){const x=z(N,"UID"),P=z(N,"Name");if(x==null||P==null||P==="")continue;A.set(x,P);const Q=z(N,"MaxUnits"),yt=z(N,"CalendarUID"),pt=yt!=null?mt(p,yt,wt):null,Ot={id:P,name:P,capacity:Q==null?1:Number(Q)};pt&&(Ot.calendar=pt.calendar,Q==null||Math.abs(Number(Q)-1)<1e-9?delete Ot.capacity:Ot.capacity=Number(Q)*pt.fullDayHours);const xt=y[Number(z(N,"Type"))];xt&&xt!=="work"&&(Ot.type=xt);const It=s(z(N,"StandardRate"));It!=null&&(Ot.rate=It);const Ut=z(N,"Cost"),te=Ut==null?null:Number(Ut);te!=null&&Number.isFinite(te)&&(Ot.cost=te),j.push(Ot)}const ot=Y(ct,"Assignments"),st=new Map;for(const N of W(ot,"Assignment")){const x=z(N,"TaskUID"),P=z(N,"ResourceUID"),Q=A.get(P);if(x==null||Q==null)continue;const yt=z(N,"Units");st.has(x)||st.set(x,[]),st.get(x).push({resource:Q,units:yt==null?1:Number(yt)})}const ht=Y(ct,"Tasks"),E=[],At=[],ft=new Map,Ht=[],Lt=[];for(const N of W(ht,"Task")){if(z(N,"IsNull")==="1")continue;const x=z(N,"UID");if(x==null||x==="0")continue;const P=x;ft.set(x,P);const Q=Number(z(N,"OutlineLevel"))||1;for(;Ht.length&&Ht[Ht.length-1].level>=Q;)Ht.pop();const yt=Ht.length?Ht[Ht.length-1].uid:null;Ht.push({uid:x,level:Q});const pt=z(N,"Summary")==="1",Ot=z(N,"Milestone")==="1",xt={id:P,name:z(N,"Name")??P};if(yt&&(xt.parent=yt),Ot&&(xt.milestone=!0),!pt&&!Ot){const qt=_t(z(N,"Duration"),wt);qt!=null&&(xt.duration=qt)}const It=kt(z(N,"Start"));!pt&&It!=null&&(xt.start=It);const Ut=z(N,"PercentComplete");if(Ut!=null&&(xt.percentComplete=Number(Ut)),!pt){const qt=z(N,"Type");qt!=null&&S[Number(qt)]&&(xt.schedulingMode=S[Number(qt)]);const $t=z(N,"EffortDriven");$t!=null&&(xt.effortDriven=$t==="1");const Jt=_t(z(N,"Work"),wt);Jt!=null&&(xt.effort=Jt*wt)}const te=k[Number(z(N,"ConstraintType"))];if(te){xt.constraint=te;const qt=kt(z(N,"ConstraintDate"));qt!=null&&(xt.constraintDate=qt)}const ne=kt(z(N,"Deadline"));ne!=null&&(xt.deadline=ne);const Yt=Y(N,"Baseline");if(Yt){const qt=kt(z(Yt,"Start")),$t=kt(z(Yt,"Finish"));qt!=null&&(xt.baselineStart=qt),$t!=null&&(xt.baselineEnd=$t)}const Nt=st.get(x);Nt&&Nt.length&&(xt.assignments=Nt),E.push(xt);for(const qt of W(N,"PredecessorLink"))Lt.push({raw:qt,uid:x})}for(const{raw:N,uid:x}of Lt){const P=z(N,"PredecessorUID"),Q=ft.get(P),yt=ft.get(x);if(Q==null||yt==null)continue;const pt=D[Number(z(N,"Type")??1)]??"FS",Ot=Et(z(N,"LinkLag"),wt),xt={from:Q,to:yt,type:pt};Ot&&(xt.lag=Ot),At.push(xt)}const ee=X(ct),Mt={ok:!0,tasks:E,dependencies:At,resources:j};return vt!=null&&(Mt.projectStart=vt),ee&&(Mt.calendar=ee),Mt}function X(G){const rt=Y(G,"Calendars"),wt=W(rt,"Calendar"),ct=z(G,"CalendarUID"),vt=(ct!=null?wt.find(ot=>z(ot,"UID")===ct):null)??wt.find(ot=>z(ot,"IsBaseCalendar")!=="0");if(!vt)return null;const B=Y(vt,"WeekDays"),Qt=[];let p=!1;for(const ot of W(B,"WeekDay")){const st=Number(z(ot,"DayType"));st>=1&&st<=7&&(p=!0,z(ot,"DayWorking")==="1"&&Qt.push(st-1))}const A=[],j=Y(vt,"Exceptions");for(const ot of W(j,"Exception")){if(z(ot,"DayWorking")==="1")continue;const st=Y(ot,"TimePeriod"),ht=kt(z(st,"FromDate")),E=kt(z(st,"ToDate"))??ht;if(ht!=null)for(let At=ht;At<=E;At+=1)A.push(At)}return!p&&!A.length?null:{workdays:p?Qt:[1,2,3,4,5],holidays:A}}function et(G){if(G==null)return null;const rt=/^(\d{1,2}):(\d{2})(?::(\d{2}))?$/.exec(String(G).trim());return rt?Number(rt[1])+Number(rt[2])/60+Number(rt[3]??0)/3600:null}function mt(G,rt,wt){const ct=G.find(st=>z(st,"UID")===rt);if(!ct)return null;const vt=[],B={};for(const st of W(Y(ct,"WeekDays"),"WeekDay")){const ht=Number(z(st,"DayType"));if(!(ht>=1&&ht<=7)||z(st,"DayWorking")!=="1")continue;const E=ht-1;vt.push(E);let At=0;for(const ft of W(Y(st,"WorkingTimes"),"WorkingTime")){const Ht=et(z(ft,"FromTime")),Lt=et(z(ft,"ToTime"));Ht!=null&&Lt!=null&&Lt>Ht&&(At+=Lt-Ht)}B[E]=At>0?At:wt}const Qt=[];for(const st of W(Y(ct,"Exceptions"),"Exception")){if(z(st,"DayWorking")==="1")continue;const ht=Y(st,"TimePeriod"),E=kt(z(ht,"FromDate")),At=kt(z(ht,"ToDate"))??E;if(E!=null)for(let ft=E;ft<=At;ft+=1)Qt.push(ft)}if(!vt.length&&!Qt.length)return null;const p=vt.map(st=>B[st]),A=p.length&&p.every(st=>Math.abs(st-p[0])<1e-9),j={workingDays:vt.slice().sort((st,ht)=>st-ht),hoursPerDay:A?p[0]:B};Qt.length&&(j.holidays=Qt);const ot=p.reduce((st,ht)=>Math.max(st,ht),0)||wt;return{calendar:j,fullDayHours:ot}}function w(G,rt={}){const wt=rt.hoursPerDay??8,ct=Array.isArray(G.tasks)?G.tasks:[],vt=Array.isArray(G.dependencies)?G.dependencies:[],B=Array.isArray(G.resources)?G.resources:G.resources&&typeof G.resources=="object"?Object.entries(G.resources).map(([x,P])=>({id:x,name:x,capacity:P})):[],Qt=G.schedule&&G.schedule.ok?G.schedule:null,p=T(G.fields),A=new Map;ct.forEach((x,P)=>{const Q=String(p(x));A.set(Q,/^\d+$/.test(Q)?Q:String(P+1))});const j=new Map;for(const x of ct){const P=x.parent!=null?String(x.parent):null;P&&(j.has(P)||j.set(P,[]),j.get(P).push(String(p(x))))}const ot=x=>j.has(x),st=x=>{let P=1,Q=ct.find(yt=>String(p(yt))===x);for(;Q&&Q.parent!=null;)P+=1,Q=ct.find(yt=>String(p(yt))===String(Q.parent));return P},ht=new Map;for(const x of vt){const P=String(x.to);ht.has(P)||ht.set(P,[]),ht.get(P).push(x)}const E=[];E.push('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'),E.push('<Project xmlns="http://schemas.microsoft.com/project">'),E.push(` <Name>${o(rt.projectName||"Lattice Gantt export")}</Name>`);const At=G.projectStart!=null?dt(G.projectStart):Qt?Qt.projectStart:null;At!=null&&E.push(` <StartDate>${bt(At,8)}</StartDate>`);const ft=O(G.calendar);ft&&E.push(" <CalendarUID>1</CalendarUID>");const Ht=wt;let Lt=ft?2:1;const ee=new Map;for(const x of B){const P=x&&(x.name??x.id??x.resource);P==null||P===""||!x.calendar||typeof x.calendar!="object"||(ee.set(String(P),{uid:Lt,spec:K(x.calendar,Ht)}),Lt+=1)}if(ft||ee.size){if(E.push(" <Calendars>"),ft){E.push(" <Calendar>"),E.push(" <UID>1</UID>"),E.push(" <Name>Standard</Name>"),E.push(" <IsBaseCalendar>1</IsBaseCalendar>"),E.push(" <WeekDays>");for(let x=0;x<=6;x+=1){const P=ft.workdays.includes(x);E.push(" <WeekDay>"),E.push(` <DayType>${x+1}</DayType>`),E.push(` <DayWorking>${P?1:0}</DayWorking>`),E.push(" </WeekDay>")}if(E.push(" </WeekDays>"),ft.holidays.length){E.push(" <Exceptions>");for(const x of ft.holidays)E.push(" <Exception>"),E.push(" <DayWorking>0</DayWorking>"),E.push(` <TimePeriod><FromDate>${bt(x,0)}</FromDate><ToDate>${bt(x,23)}</ToDate></TimePeriod>`),E.push(" </Exception>");E.push(" </Exceptions>")}E.push(" </Calendar>")}for(const[x,P]of ee)for(const Q of F(P.uid,x,P.spec))E.push(Q);E.push(" </Calendars>")}E.push(" <Tasks>");for(const x of ct){const P=String(p(x)),Q=A.get(P),yt=ot(P),pt=!!x.milestone||!yt&&Number(x.duration)===0,Ot=Qt?Qt.tasks.get(P):null;E.push(" <Task>"),E.push(` <UID>${o(Q)}</UID>`),E.push(` <ID>${o(Q)}</ID>`),E.push(` <Name>${o(x.name!=null?x.name:P)}</Name>`),E.push(` <OutlineLevel>${st(P)}</OutlineLevel>`),E.push(` <Summary>${yt?1:0}</Summary>`),E.push(` <Milestone>${pt?1:0}</Milestone>`);const xt=Ot?Ot.duration:x.duration!=null?Number(x.duration):null;xt!=null&&E.push(` <Duration>${lt(xt,wt)}</Duration>`),E.push(" <DurationFormat>7</DurationFormat>");const It=Ot?Ot.es:x.start!=null?dt(x.start):null,Ut=Ot?Ot.ef:x.end!=null?dt(x.end):It!=null&&xt!=null?It+xt:null;It!=null&&E.push(` <Start>${bt(It,8)}</Start>`),Ut!=null&&E.push(` <Finish>${bt(Ut,17)}</Finish>`);const te=Ot?Ot.percentComplete:x.percentComplete;if(te!=null&&E.push(` <PercentComplete>${Math.round(Number(te))}</PercentComplete>`),!yt&&!pt){const $t=Ot&&Ot.schedulingMode||h(x.schedulingMode??x.taskType),Jt=Ot&&Ot.effortDriven!=null?Ot.effortDriven:x.effortDriven!=null?!!x.effortDriven:null,he=Ot&&Ot.effort!=null?Ot.effort:Number.isFinite(Number(x.effort))?Number(x.effort):typeof x.work=="number"?x.work:Number.isFinite(Number(x.hours))?Number(x.hours):null;($t!=null||Jt!=null||he!=null)&&($t!=null&&E.push(` <Type>${b[$t]}</Type>`),E.push(` <EffortDriven>${Jt?1:0}</EffortDriven>`),he!=null&&E.push(` <Work>${lt(he/wt,wt)}</Work>`))}const ne=R(x.constraint??x.constraintType);if(ne!=null){E.push(` <ConstraintType>${ne}</ConstraintType>`);const $t=it(x.constraintDate??x.constraintAt??x.at??(x.constraint&&typeof x.constraint=="object"?x.constraint.date:null));$t!=null&&E.push(` <ConstraintDate>${bt($t,8)}</ConstraintDate>`)}const Yt=it(x.deadline);Yt!=null&&E.push(` <Deadline>${bt(Yt,17)}</Deadline>`);const Nt=it(x.baselineStart??(x.baseline&&x.baseline.start)),qt=it(x.baselineEnd??(x.baseline&&x.baseline.end));(Nt!=null||qt!=null)&&(E.push(" <Baseline>"),E.push(" <Number>0</Number>"),Nt!=null&&E.push(` <Start>${bt(Nt,8)}</Start>`),qt!=null&&E.push(` <Finish>${bt(qt,17)}</Finish>`),Nt!=null&&qt!=null&&E.push(` <Duration>${lt(qt-Nt,wt)}</Duration>`),E.push(" </Baseline>"));for(const $t of ht.get(P)||[]){const Jt=A.get(String($t.from));Jt!=null&&(E.push(" <PredecessorLink>"),E.push(` <PredecessorUID>${o(Jt)}</PredecessorUID>`),E.push(` <Type>${$[$t.type?String($t.type).toUpperCase():"FS"]??1}</Type>`),$t.lag&&(E.push(` <LinkLag>${Rt(Number($t.lag),wt)}</LinkLag>`),E.push(" <LagFormat>7</LagFormat>")),E.push(" </PredecessorLink>"))}E.push(" </Task>")}E.push(" </Tasks>");const Mt=new Map;B.forEach((x,P)=>{const Q=String(x.name??x.id??`Resource ${P+1}`),yt=ee.get(Q),pt=x.capacity??x.maxUnits??1,Ot=yt?x.capacity!=null?Number(x.capacity)/yt.spec.fullDayHours:1:Number(pt),xt=e(x.rate),It=e(x.cost),Ut=x.type==="material"||x.type==="cost"?x.type:null;Mt.set(Q,{uid:String(P+1),maxUnits:Ot,calUid:yt?yt.uid:null,rate:xt,cost:It,type:Ut})});const N=[];for(const x of ct)for(const P of J(x))Mt.has(P.resource)||Mt.set(P.resource,{uid:String(Mt.size+1),maxUnits:1,calUid:null}),N.push({taskUid:A.get(String(p(x))),resUid:Mt.get(P.resource).uid,units:P.units});E.push(" <Resources>");for(const[x,P]of Mt)E.push(" <Resource>"),E.push(` <UID>${o(P.uid)}</UID>`),E.push(` <ID>${o(P.uid)}</ID>`),E.push(` <Name>${o(x)}</Name>`),E.push(` <MaxUnits>${Number(P.maxUnits)}</MaxUnits>`),P.calUid!=null&&E.push(` <CalendarUID>${P.calUid}</CalendarUID>`),P.type!=null&&E.push(` <Type>${g[P.type]}</Type>`),P.rate!=null&&E.push(` <StandardRate>${P.rate}/h</StandardRate>`),P.cost!=null&&E.push(` <Cost>${P.cost}</Cost>`),E.push(" </Resource>");return E.push(" </Resources>"),E.push(" <Assignments>"),N.forEach((x,P)=>{E.push(" <Assignment>"),E.push(` <UID>${P+1}</UID>`),E.push(` <TaskUID>${o(x.taskUid)}</TaskUID>`),E.push(` <ResourceUID>${o(x.resUid)}</ResourceUID>`),E.push(` <Units>${Number(x.units)}</Units>`),E.push(" </Assignment>")}),E.push(" </Assignments>"),E.push("</Project>"),E.join(`
6
+ var Nn=Object.create(null),jn=Object.create(null);function oe(f,ut){Nn[f]=ut}function Ln(f){var ut=jn[f];if(ut)return ut;var Pt=Object.create(null);jn[f]=Pt;var tt=Nn[f];if(!tt)throw new Error("[lattice] missing module: "+f);return tt(Pt,Ln),Pt}oe("packages/core/src/internal/util.js",function(f,ut){"use strict";Object.defineProperty(f,"VERSION",{enumerable:!0,get:function(){return at}}),Object.defineProperty(f,"reportedWarnings",{enumerable:!0,get:function(){return $}}),Object.defineProperty(f,"warnOnce",{enumerable:!0,get:function(){return _}}),Object.defineProperty(f,"infoOnce",{enumerable:!0,get:function(){return S}}),Object.defineProperty(f,"resetWarnings",{enumerable:!0,get:function(){return b}}),Object.defineProperty(f,"fail",{enumerable:!0,get:function(){return y}}),Object.defineProperty(f,"invariant",{enumerable:!0,get:function(){return g}}),Object.defineProperty(f,"DEV",{enumerable:!0,get:function(){return s}}),Object.defineProperty(f,"isObject",{enumerable:!0,get:function(){return e}}),Object.defineProperty(f,"isFunction",{enumerable:!0,get:function(){return i}}),Object.defineProperty(f,"isNil",{enumerable:!0,get:function(){return o}}),Object.defineProperty(f,"isBlank",{enumerable:!0,get:function(){return l}}),Object.defineProperty(f,"isCtor",{enumerable:!0,get:function(){return L}}),Object.defineProperty(f,"pathGetter",{enumerable:!0,get:function(){return W}}),Object.defineProperty(f,"pathSetter",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(f,"getPath",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(f,"setPath",{enumerable:!0,get:function(){return _t}}),Object.defineProperty(f,"humanise",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(f,"escapeHtml",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(f,"titleCase",{enumerable:!0,get:function(){return Gt}}),Object.defineProperty(f,"expand",{enumerable:!0,get:function(){return X}}),Object.defineProperty(f,"toArray",{enumerable:!0,get:function(){return et}}),Object.defineProperty(f,"merge",{enumerable:!0,get:function(){return w}}),Object.defineProperty(f,"mergeRow",{enumerable:!0,get:function(){return J}}),Object.defineProperty(f,"Lru",{enumerable:!0,get:function(){return O}}),Object.defineProperty(f,"collator",{enumerable:!0,get:function(){return v}}),Object.defineProperty(f,"defaultCompare",{enumerable:!0,get:function(){return F}}),Object.defineProperty(f,"now",{enumerable:!0,get:function(){return R}}),Object.defineProperty(f,"nextFrame",{enumerable:!0,get:function(){return G}}),Object.defineProperty(f,"cancelFrame",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(f,"frameBatched",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(f,"settleDebounce",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(f,"whenIdle",{enumerable:!0,get:function(){return vt}}),Object.defineProperty(f,"uid",{enumerable:!0,get:function(){return Qt}});const Pt="1.89.1";async function tt(){return Pt}const at="1.89.1",dt=new Set,nt=2e3;function q(p){if(dt.add(p),dt.size>nt){const A=dt.values().next().value;A!==void 0&&dt.delete(A)}}const T=[],d=500;function h(p,A,j){T.push({key:p,level:A,message:j.map(ot=>typeof ot=="string"?ot:D(ot)).join(" "),at:Date.now()}),T.length>d&&T.shift()}function D(p){if(p instanceof Error)return p.message;try{return JSON.stringify(p)}catch{return String(p)}}function $(){return T.map(p=>({...p}))}function k(p){if(p.length===0||typeof p[0]!="string")return p;const A=p[0].replace(/^\[lattice\]\s*/,"");return A===p[0]?p:[A,...p.slice(1)]}function _(p,...A){if(dt.has(p))return;q(p);const j=k(A);h(p,"warn",j),console.warn("[lattice]",...j)}function S(p,...A){if(dt.has(p))return;q(p);const j=k(A);h(p,"info",j),console.info("[lattice]",...j)}function b(){dt.clear(),T.length=0}function y(p,A){const j=new Error(`[lattice] ${p}`);throw A!==void 0&&(j.cause=A),j}function g(p,A){p||y(A)}const s=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function e(p){return p!==null&&typeof p=="object"&&!Array.isArray(p)}function i(p){return typeof p=="function"}function o(p){return p==null}function l(p){return p==null||p===""}function L(p){return typeof p!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(p))?!0:!!(p.prototype&&Object.getOwnPropertyNames(p.prototype).length>1)}const Y=new Map;function W(p){let A=Y.get(p);if(A)return A;if(!p.includes("."))A=j=>j?.[p];else{const j=p.split("."),ot=j.length;A=st=>{let ht=st;for(let E=0;E<ot;E++){if(ht==null)return;ht=ht[j[E]]}return ht}}return Y.set(p,A),A}const z=new Map;function kt(p){let A=z.get(p);if(A)return A;if(!p.includes("."))A=(j,ot)=>{j!=null&&(j[p]=ot)};else{const j=p.split("."),ot=j.length-1;A=(st,ht)=>{let E=st;for(let At=0;At<ot;At++){if(E==null)return;const ft=j[At];E[ft]==null&&(E[ft]={}),E=E[ft]}E!=null&&(E[j[ot]]=ht)}}return z.set(p,A),A}function bt(p,A){return W(A)(p)}function _t(p,A,j){kt(A)(p,j)}function lt(p){return p?(p.includes(".")?p.slice(p.lastIndexOf(".")+1):p).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(/^./,j=>j.toUpperCase()):""}const Et={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Rt(p){const A=p==null?"":String(p);return/[&<>"']/.test(A)?A.replace(/[&<>"']/g,j=>Et[j]):A}function Gt(p){return String(p).replace(/\w\S*/g,A=>A[0].toUpperCase()+A.slice(1).toLowerCase())}function X(p,A,j){if(p!==void 0)return p===!0?{enabled:!0,...j}:p===!1?{enabled:!1}:e(p)?p:{[A]:p,enabled:!0}}function et(p){return p==null?[]:Array.isArray(p)?p:[p]}const mt=Object.freeze(new Set(["__proto__","constructor","prototype"]));function w(p,A){if(!e(p))return e(A)?{...A}:A;if(!e(A))return A===void 0?p:A;const j={...p};for(const ot of Object.keys(A)){if(mt.has(ot))continue;const st=A[ot];st!==void 0&&(j[ot]=e(st)&&e(j[ot])?w(j[ot],st):st)}return j}function J(p,A){if(!e(p)||!e(A)||p===A)return A;const j=Object.create(Object.getPrototypeOf(p));return Object.assign(j,p,A),j}class O{#e;#r=new Map;#t;constructor(A=256,j=null){this.#e=A,this.#t=j}get size(){return this.#r.size}get max(){return this.#e}set max(A){this.#e=A,this.#n()}has(A){return this.#r.has(A)}get(A){const j=this.#r;if(!j.has(A))return;const ot=j.get(A);return j.delete(A),j.set(A,ot),ot}peek(A){return this.#r.get(A)}set(A,j){const ot=this.#r;return ot.has(A)&&ot.delete(A),ot.set(A,j),this.#n(),j}delete(A){const j=this.#r.get(A);return this.#r.delete(A)&&this.#t&&this.#t(j,A),j}clear(){if(this.#t)for(const[A,j]of this.#r)this.#t(j,A);this.#r.clear()}keys(){return this.#r.keys()}values(){return this.#r.values()}#n(){const A=this.#r;for(;A.size>this.#e;){const j=A.keys().next().value,ot=A.get(j);A.delete(j),this.#t&&this.#t(ot,j)}}}const K=new Map;function v(p,A){const j=`${p||""}|${A?JSON.stringify(A):""}`;let ot=K.get(j);return ot||(ot=new Intl.Collator(p||void 0,{numeric:!0,sensitivity:"variant",...A}),K.set(j,ot)),ot}function F(p,A){if(p===A)return 0;if(p==null)return 1;if(A==null)return-1;if(typeof p=="number"&&typeof A=="number")return Number.isNaN(p)?Number.isNaN(A)?0:1:Number.isNaN(A)||p<A?-1:p>A?1:0;const j=String(p),ot=String(A);return j<ot?-1:j>ot?1:0}function R(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const it=typeof requestAnimationFrame=="function";function G(p){return it?requestAnimationFrame(p):setTimeout(()=>p(R()),16)}function rt(p){p!=null&&(it?cancelAnimationFrame(p):clearTimeout(p))}function wt(p){let A=null,j=null;const ot=()=>{A=null;const ht=j;j=null,p(...ht||[])},st=(...ht)=>{j=ht,A===null&&(A=G(ot))};return st.cancel=()=>{rt(A),A=null,j=null},st.flush=()=>{A!==null&&(rt(A),ot())},st}function ct(p,A){let j=null,ot=null;const st=()=>{if(j=null,ot===null)return;const At=ot;ot=null,p(...At),ht()},ht=()=>{j=setTimeout(st,A),typeof j?.unref=="function"&&j.unref()},E=(...At)=>{j===null?(p(...At),ht()):(ot=At,clearTimeout(j),ht())};return E.flush=()=>{if(j!==null&&clearTimeout(j),j=null,ot===null)return;const At=ot;ot=null,p(...At)},E.cancel=()=>{j!==null&&clearTimeout(j),j=null,ot=null},E.pending=()=>j!==null||ot!==null,E}function vt(p,A=50){return typeof requestIdleCallback=="function"?requestIdleCallback(p,{timeout:A}):setTimeout(()=>p({timeRemaining:()=>0,didTimeout:!0}),1)}let B=0;function Qt(p="l"){return`${p}${(++B).toString(36)}`}}),oe("packages/modules/shared/emitter.js",function(f,ut){"use strict";Object.defineProperty(f,"WILDCARD",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(f,"Emitter",{enumerable:!0,get:function(){return T}}),Object.defineProperty(f,"gate",{enumerable:!0,get:function(){return d}});const Pt=ut("packages/core/src/internal/util.js"),tt=Pt.isFunction,at=Pt.warnOnce,dt="*",nt=new Set(["api","user","init","ai"]);function q(h,D){return h&&h.name?h.name:`#${D}`}class T{#e=new Map;#r;constructor(D="module"){this.#r=String(D)}on(D,$){if(!tt($))return()=>{};let k=this.#e.get(D);return k||(k=new Set,this.#e.set(D,k)),k.add($),()=>this.off(D,$)}off(D,$){const k=this.#e.get(D);k&&k.delete($)}count(D){const $=this.#e.get(D);return $?$.size:0}emit(D,$){const k=this.#e.get(D),_=this.#e.get(dt);if((!k||k.size===0)&&(!_||_.size===0))return;const S={...$||null,type:D};k&&k.size&&this.#t([...k],S,D),_&&_.size&&this.#t([..._],S,dt)}#t(D,$,k){for(let _=0;_<D.length;_++)try{D[_]($)}catch(S){at(`${this.#r}.emit.throw:${k}:${q(D[_],_)}`,`${this.#r}: a '${k}' handler threw; other handlers were unaffected.`,S)}}emitBefore(D,$,k){const _=k??($&&$.origin),S=nt.has(_)?_:"user";let b=!1,y=null;const g=L=>{b=!0,L!=null&&y===null&&(y=String(L))},s={...$||null,type:D,origin:S,get defaultPrevented(){return b},get reason(){return y},preventDefault(L){g(L)}},e=this.#e.get(D);if(!e||e.size===0)return!0;const i=[...e],o=()=>(b&&y===null&&(y="prevented"),b&&$&&typeof $=="object"&&($.reason=y),!b),l=[];for(let L=0;L<i.length;L++){const Y=i[L];try{const W=Y(s);W&&tt(W.then)?l.push(W):W===!1&&g("prevented")}catch(W){g("error"),at(`${this.#r}.beforeThrow:${D}:${q(Y,L)}`,`${this.#r}: a '${D}' before-handler threw; the action was cancelled.`,W)}}return l.length===0?o():Promise.allSettled(l).then(L=>{for(const Y of L)Y.status==="rejected"?(g("error"),at(`${this.#r}.beforeReject:${D}`,`${this.#r}: a '${D}' before-handler rejected; the action was cancelled.`,Y.reason)):Y.value===!1&&g("prevented");return o()})}clear(){this.#e.clear()}}function d(h,D,$,k,_){const S=h.emitBefore(D,k,k.origin),b=()=>(h.emit($,{...k,reason:k.reason||"prevented"}),!1);return S===!1?b():S&&tt(S.then)?S.then(y=>y?_():b()):_()}}),oe("packages/core/src/model/history.js",function(f,ut){"use strict";Object.defineProperty(f,"DEFAULT_HISTORY_DEPTH",{enumerable:!0,get:function(){return q}}),Object.defineProperty(f,"DEFAULT_COALESCE_MS",{enumerable:!0,get:function(){return T}}),Object.defineProperty(f,"HISTORY_TYPES",{enumerable:!0,get:function(){return d}}),Object.defineProperty(f,"COALESCING_TYPES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(f,"HISTORY_LABELS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(f,"diffSlices",{enumerable:!0,get:function(){return b}}),Object.defineProperty(f,"HistoryModel",{enumerable:!0,get:function(){return y}});const Pt=ut("packages/core/src/internal/util.js"),tt=Pt.warnOnce,at=Pt.isFunction,dt=Pt.isObject,nt=Pt.now,q=10,T=400,d=["sort","filter","group","pivot","column:move","column:resize","column:visible","column:pin","column:decorate","page","edit","transaction"],h=new Set(["column:resize","column:move"]),D={sort:"sort",filter:"filter",group:"grouping",pivot:"pivot",formatting:"conditional formatting","column:move":"column move","column:resize":"column resize","column:visible":"column visibility","column:pin":"column pin","column:decorate":"column decoration",page:"page change",edit:"edit",transaction:"change"};function $(g){if(g===null||typeof g!="object")return g;try{return structuredClone(g)}catch{try{return JSON.parse(JSON.stringify(g))}catch{return g}}}function k(g,s){if(g===s)return!0;if(g===null||s===null||typeof g!="object"||typeof s!="object")return g!==g&&s!==s;if(g instanceof Date||s instanceof Date)return g instanceof Date&&s instanceof Date&&g.getTime()===s.getTime();if(Array.isArray(g)||Array.isArray(s))return!Array.isArray(g)||!Array.isArray(s)||g.length!==s.length?!1:g.every((o,l)=>k(o,s[l]));const e=Object.keys(g),i=Object.keys(s);return e.length!==i.length?!1:e.every(o=>Object.prototype.hasOwnProperty.call(s,o)&&k(g[o],s[o]))}function _(g,s){const e=new Map;for(const L of s)dt(L)&&typeof L.id=="string"&&e.set(L.id,L);const i=new Set,o=[],l=[];for(const L of g){if(!dt(L)||typeof L.id!="string")continue;i.add(L.id);const Y=e.get(L.id);if(!Y){o.push({...L});continue}const W=new Set([...Object.keys(L),...Object.keys(Y)]);W.delete("id");const z={id:L.id},kt={id:L.id};let bt=!1;for(const _t of W)k(L[_t],Y[_t])||(bt=!0,_t in L&&(z[_t]=L[_t]),_t in Y&&(kt[_t]=Y[_t]));bt&&(o.push(z),l.push(kt))}for(const L of s)!dt(L)||typeof L.id!="string"||i.has(L.id)||l.push({...L});return o.length===0&&l.length===0?null:{before:o,after:l}}function S(g){if(typeof g=="string")return"";if(Array.isArray(g))return[]}function b(g,s){const e=dt(g)?g:null,i=dt(s)?s:null;if(!e&&!i)return null;if(!e||!i)return{before:e?{...e}:null,after:i?{...i}:null};const o={},l={};let L=!1;const Y=new Set([...Object.keys(e),...Object.keys(i)]);Y.delete("version");for(const W of Y){if(W==="columns"&&Array.isArray(e.columns)&&Array.isArray(i.columns)){const bt=_(e.columns,i.columns);if(!bt)continue;o.columns=bt.before,l.columns=bt.after,L=!0;continue}if(k(e[W],i[W]))continue;L=!0;const z=W in e,kt=W in i;z?o[W]=e[W]:S(i[W])!==void 0&&(o[W]=S(i[W])),kt?l[W]=i[W]:S(e[W])!==void 0&&(l[W]=S(e[W]))}return L?(o.columns&&Array.isArray(e.columnOrder)&&(o.columnOrder=e.columnOrder),l.columns&&Array.isArray(i.columnOrder)&&(l.columnOrder=i.columnOrder),e.version!==void 0&&(o.version=e.version),i.version!==void 0&&(l.version=i.version),{before:o,after:l}):null}class y{#e=[];#r=[];#t=q;#n=T;#i=null;#l=null;#a=null;#c=nt;#f=!1;#o=0;#d=0;constructor(s={}){s.apply&&(this.#i=s.apply),s.capture&&(this.#l=s.capture),s.edit&&(this.#a=s.edit),at(s.now)&&(this.#c=s.now),this.configure(s)}configure(s={}){typeof s.depth=="number"&&s.depth>=0&&(this.#t=Math.floor(s.depth),this.#h()),typeof s.coalesceMs=="number"&&s.coalesceMs>=0&&(this.#n=s.coalesceMs)}get depth(){return this.#t}set depth(s){this.configure({depth:s})}get coalesceMs(){return this.#n}set coalesceMs(s){this.configure({coalesceMs:s})}get size(){return this.#e.length}get redoSize(){return this.#r.length}get replaying(){return this.#f}canUndo(){return this.#e.length>0}canRedo(){return this.#r.length>0}push(s){if(this.#f||this.#o>0||this.#t===0||!dt(s)||typeof s.type!="string"||!s.type)return null;const e=s.type,i=e==="edit";let o=null,l=null;if(!i){const W=b($(s.before??null),$(s.after??null));if(!W)return null;o=W.before,l=W.after}const L={seq:++this.#d,type:e,label:typeof s.label=="string"&&s.label?s.label:D[e]||e,target:s.target==null?null:String(s.target),before:o,after:l,at:typeof s.at=="number"?s.at:this.#c(),delegated:i,mergeable:i?!1:s.coalesce===void 0?h.has(e):!!s.coalesce};this.#r.length=0;const Y=this.#s(L);return Y!==void 0?Y:(this.#e.push(L),this.#h(),L)}recordEdit(s,e={}){return this.push({type:"edit",label:s,target:e.target,at:e.at})}transaction(s,e,i={}){if(!at(e))return null;if(this.#f||this.#o>0){this.#o++;try{e()}finally{this.#o--}return null}const o=i.type||"transaction",l=i.type?o:void 0,L=this.#p(l,i.target);this.#o++;try{e()}finally{this.#o--}const Y=this.#p(l,i.target);return this.push({type:o,label:s,target:i.target,before:L,after:Y,coalesce:i.coalesce===void 0?!1:i.coalesce})}#s(s){if(!s.mergeable)return;const e=this.#e[this.#e.length-1];if(!e||!e.mergeable||e.delegated||e.type!==s.type||e.target!==s.target||s.at-e.at>this.#n)return;const i=b(e.before,s.after);return i?(e.before=i.before,e.after=i.after,e.at=s.at,e.label=s.label,e):(this.#e.pop(),null)}get busy(){return this.#f||this.#o>0}capture(s,e){return this.#p(s,e)}#p(s,e){if(!this.#l)return null;try{return $(this.#l(s,e??null))}catch(i){return tt("history.capture.throw","history capture threw; the action was not recorded.",i),null}}#h(){for(;this.#e.length>this.#t;)this.#e.shift();for(;this.#r.length>this.#t;)this.#r.shift()}undo(){return this.#g("undo")}redo(){return this.#g("redo")}#g(s){if(this.#f)return null;const e=s==="undo"?this.#e:this.#r,i=s==="undo"?this.#r:this.#e;this.#f=!0;try{for(;e.length;){const o=e[e.length-1],l=this.#C(o,s);if(o.delegated){if(!this.#S(s)){e.pop();continue}}else l.patch&&this.#v(l.patch,l);return e.pop(),i.push(o),this.#h(),l}return null}finally{this.#f=!1}}#S(s){const e=this.#a;if(!e||!at(e[s]))return!1;try{return e[s]({origin:"history"})!=null}catch(i){return tt("history.edit.throw",`edit ${s} threw; the entry was dropped.`,i),!1}}#v(s,e){if(this.#i)try{this.#i(s,e)}catch(i){tt("history.apply.throw",`applying the ${e.direction} of '${e.label}' threw.`,i)}}#C(s,e){return{direction:e,seq:s.seq,type:s.type,label:s.label,target:s.target,at:s.at,delegated:s.delegated,patch:s.delegated?null:$(e==="undo"?s.before:s.after)}}peek(s="undo"){const e=s==="redo"?this.#r:this.#e,i=e[e.length-1];return i?{seq:i.seq,type:i.type,label:i.label,target:i.target,at:i.at,delegated:i.delegated}:null}list(){const s=(e,i)=>({seq:e.seq,type:e.type,label:e.label,target:e.target,at:e.at,delegated:e.delegated,undone:i});return[...this.#r.map(e=>s(e,!0)),...[...this.#e].reverse().map(e=>s(e,!1))]}clear(){this.#e.length=0,this.#r.length=0}destroy(){this.clear(),this.#a=null}}}),oe("packages/modules/gantt/time.js",function(f,ut){"use strict";Object.defineProperty(f,"toDayNumber",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(f,"fromDayNumber",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(f,"toISODate",{enumerable:!0,get:function(){return q}}),Object.defineProperty(f,"resolveProjectEpoch",{enumerable:!0,get:function(){return T}});const tt=ut("packages/core/src/internal/util.js").warnOnce,at=864e5;function dt(d){if(d==null||d==="")return null;if(typeof d=="number")return Number.isFinite(d)?d:null;if(d instanceof Date)return Number.isFinite(d.getTime())?Math.floor(Date.UTC(d.getFullYear(),d.getMonth(),d.getDate())/at):null;const h=Date.parse(d);return Number.isFinite(h)?Math.floor(h/at):null}function nt(d){return Number.isFinite(d)?new Date(Math.round(d)*at):null}function q(d){const h=nt(d);return h?h.toISOString().slice(0,10):null}function T(d){if(d==null||d==="")return 0;const h=dt(d);return Number.isFinite(h)?h:(tt(`gantt.projectEpoch:${String(d)}`,`[lattice] gantt: projectEpoch ${JSON.stringify(d)} is not a date or a day number; the plan is rendered against the Unix epoch (day 0 = 1970-01-01).`),0)}}),oe("packages/modules/gantt/calendar.js",function(f,ut){"use strict";Object.defineProperty(f,"createCalendar",{enumerable:!0,get:function(){return dt}});const tt=ut("packages/modules/gantt/time.js").toDayNumber,at=Object.freeze([1,2,3,4,5]);function dt(nt,q=0){if(nt==null)return null;let T,d;nt==="weekends"?(T=at,d=new Set):(T=Array.isArray(nt.workdays)&&nt.workdays.length?nt.workdays.map(Number).filter(s=>s>=0&&s<=6):at,d=new Set((Array.isArray(nt.holidays)?nt.holidays:[]).map(s=>tt(s)).filter(s=>s!=null)));const h=new Set(T);if(h.size===7&&d.size===0||h.size===0)return null;const D=s=>{let e=(s%7+4)%7;return e<0&&(e+=7),e},$=s=>{if(!Number.isFinite(s))return!1;const e=Math.round(s);return h.has(D(e))&&!d.has(e)},k=s=>{let e=s;for(;!$(e);)e+=1;return e},_=k(Math.round(Number.isFinite(q)?q:0)),S=h.size,b=(s,e)=>{if(e<s)return 0;const i=e-s+1,o=Math.floor(i/7);let l=o*S;const L=D(s);for(let Y=o*7;Y<i;Y+=1)h.has((L+Y)%7)&&(l+=1);for(const Y of d)Y>=s&&Y<=e&&h.has(D(Y))&&(l-=1);return l};return{isWorking:$,nextWorking:k,dayOf:s=>{const e=Math.round(s);if(e===0)return _;if(e>0){const W=Math.floor(e/S);let z=_+W*7,kt=e-W*S;for(;kt>0;)z+=1,h.has(D(z))&&(kt-=1);let bt=0;for(const _t of d)_t>_&&_t<=z&&h.has(D(_t))&&(bt+=1);for(;bt>0;)z+=1,$(z)&&(bt-=1);for(;!$(z);)z+=1;return z}const i=-e,o=Math.floor(i/S);let l=_-o*7,L=i-o*S;for(;L>0;)l-=1,h.has(D(l))&&(L-=1);let Y=0;for(const W of d)W>=l&&W<_&&h.has(D(W))&&(Y+=1);for(;Y>0;)l-=1,$(l)&&(Y-=1);for(;!$(l);)l-=1;return l},indexOf:s=>{const e=k(Math.round(s));return e>=_?b(_,e)-1:-(b(e,_)-1)},anchor:_}}}),oe("packages/modules/gantt/assignments.js",function(f,ut){"use strict";Object.defineProperty(f,"parseAssignments",{enumerable:!0,get:function(){return tt}});function Pt(at){if(at==null||at==="")return null;const dt=typeof at=="number"?at:Number(at);return Number.isFinite(dt)?dt:null}function tt(at){if(at&&Array.isArray(at.assignments))return at.assignments.map(q=>{const T=q&&(q.resource??q.name??q.id);if(T==null||T==="")return null;const d=Pt(q.units)??Pt(q.allocation)??1;return{resource:String(T),units:d}}).filter(Boolean);const dt=at?at.assignee??at.assignees??at.owner:null;return(Array.isArray(dt)?dt:dt==null||dt===""?[]:[dt]).map(q=>String(q)).filter(q=>q!=="").map(q=>({resource:q,units:1}))}}),oe("packages/modules/gantt/unscheduled.js",function(f,ut){"use strict";Object.defineProperty(f,"UNSCHEDULED_DEFAULT_DURATION",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(f,"isUnscheduled",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(f,"findUnscheduled",{enumerable:!0,get:function(){return at}}),Object.defineProperty(f,"activeEdges",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(f,"unscheduledRecord",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(f,"completeUnscheduledPatch",{enumerable:!0,get:function(){return q}}),Object.defineProperty(f,"unscheduledMarker",{enumerable:!0,get:function(){return T}});const Pt=1;function tt(d){return!!(d&&d.unscheduled===!0)}function at(d,h,D){const $=new Set;for(const k of d)!D.isSummary(k)&&h.get(k).duration==null&&$.add(k);if(!$.size)return $;for(const k of d)D.isSummary(k)&&D.descendantLeaves(k).every(_=>$.has(_))&&$.add(k);return $}function dt(d,h){return h.size?d.filter(D=>!h.has(D.from)&&!h.has(D.to)):d}function nt(d,h){return{id:d.id,name:d.name,duration:null,es:null,ef:null,ls:null,lf:null,totalFloat:null,critical:!1,percentComplete:h?null:d.percentComplete,parent:d.parent,isSummary:h,isMilestone:!1,locked:h?!1:!!d.locked,unscheduled:!0,children:[]}}function q(d,h){if(!tt(h)||h.isSummary||d.duration!==void 0)return d;const D=d.start!=null&&d.start!=="",$=d.end!=null&&d.end!=="";if(!D&&!$)return d;const k={...d,duration:Pt};if(!D){const _=Number(d.end);Number.isFinite(_)&&(k.start=_-Pt)}return k}function T(d,h,D){const $=d.createElement("span");return $.setAttribute("class",`${h}__unscheduled`),$.textContent=D("gantt.unscheduled"),$}}),oe("packages/modules/gantt/schedule.js",function(f,ut){"use strict";Object.defineProperty(f,"LINK_TYPES",{enumerable:!0,get:function(){return _}}),Object.defineProperty(f,"CONSTRAINT_TYPES",{enumerable:!0,get:function(){return S}}),Object.defineProperty(f,"resolveConstraintCode",{enumerable:!0,get:function(){return y}}),Object.defineProperty(f,"SCHEDULING_MODES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(f,"resolveSchedulingMode",{enumerable:!0,get:function(){return e}}),Object.defineProperty(f,"effortRate",{enumerable:!0,get:function(){return o}}),Object.defineProperty(f,"recomputeEffort",{enumerable:!0,get:function(){return l}}),Object.defineProperty(f,"reconcileEffort",{enumerable:!0,get:function(){return L}}),Object.defineProperty(f,"EPS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(f,"SCHEDULE_ERROR",{enumerable:!0,get:function(){return W}}),Object.defineProperty(f,"TASK_FIELDS",{enumerable:!0,get:function(){return _t}}),Object.defineProperty(f,"taskIdReader",{enumerable:!0,get:function(){return Et}}),Object.defineProperty(f,"taskFieldWriters",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(f,"isTaskLocked",{enumerable:!0,get:function(){return X}}),Object.defineProperty(f,"normalizeTasks",{enumerable:!0,get:function(){return et}}),Object.defineProperty(f,"buildTree",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(f,"normalizeLinkSpec",{enumerable:!0,get:function(){return J}}),Object.defineProperty(f,"normalizeDependencies",{enumerable:!0,get:function(){return O}}),Object.defineProperty(f,"expandDependencies",{enumerable:!0,get:function(){return K}}),Object.defineProperty(f,"topoOrder",{enumerable:!0,get:function(){return F}}),Object.defineProperty(f,"wouldCreateCycle",{enumerable:!0,get:function(){return G}}),Object.defineProperty(f,"computeSchedule",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(f,"findViolations",{enumerable:!0,get:function(){return Qt}});const tt=ut("packages/core/src/internal/util.js").warnOnce,dt=ut("packages/modules/gantt/calendar.js").createCalendar,q=ut("packages/modules/gantt/assignments.js").parseAssignments,d=ut("packages/modules/gantt/time.js").toDayNumber,h=ut("packages/modules/gantt/unscheduled.js"),D=h.activeEdges,$=h.findUnscheduled,k=h.unscheduledRecord,_=["FS","SS","FF","SF"],S=["ASAP","MSO","MFO","ALAP","SNET","SNLT","FNET","FNLT"],b=Object.freeze({asap:"ASAP","as-soon-as-possible":"ASAP",assoonaspossible:"ASAP",mso:"MSO","must-start-on":"MSO",muststarton:"MSO","start-on":"MSO",mfo:"MFO","must-finish-on":"MFO",mustfinishon:"MFO","finish-on":"MFO",alap:"ALAP","as-late-as-possible":"ALAP",aslateaspossible:"ALAP",late:"ALAP",snet:"SNET","start-no-earlier-than":"SNET",startnoearlierthan:"SNET",snlt:"SNLT","start-no-later-than":"SNLT",startnolaterthan:"SNLT",fnet:"FNET","finish-no-earlier-than":"FNET",finishnoearlierthan:"FNET",fnlt:"FNLT","finish-no-later-than":"FNLT",finishnolaterthan:"FNLT"});function y(p){if(p==null||p===""||typeof p=="object"&&!Array.isArray(p)&&!(p instanceof Date)&&(p=p.type??p.constraint??p.code??null,p==null||p===""))return null;const A=String(p).toLowerCase().replace(/\s+/g,"-");return b[A]??(S.includes(String(p).toUpperCase())?String(p).toUpperCase():null)}const g=["fixedDuration","fixedEffort","fixedUnits"],s=Object.freeze({fixedduration:"fixedDuration","fixed-duration":"fixedDuration",duration:"fixedDuration",fixedeffort:"fixedEffort","fixed-effort":"fixedEffort",effort:"fixedEffort",work:"fixedEffort",fixedwork:"fixedEffort",fixedunits:"fixedUnits","fixed-units":"fixedUnits",units:"fixedUnits"});function e(p){if(p==null||p==="")return null;const A=String(p).toLowerCase().replace(/\s+/g,"-");if(s[A])return s[A];const j=A.replace(/-/g,"");return s[j]??null}const i=8;function o(p,A){const j=A.hoursPerDay,ot=A.resourceHours instanceof Map?A.resourceHours:new Map;if(!p||p.length===0)return{rate:j,units:1};let st=0,ht=0;for(const E of p){const At=ot.has(E.resource)?ot.get(E.resource):j;st+=E.units*At,ht+=E.units}return{rate:st,units:ht}}function l(p,A){const j=p.schedulingMode||A.defaultMode||"fixedDuration",ot=p.effortDriven!=null?!!p.effortDriven:!!A.defaultEffortDriven,{rate:st,units:ht}=o(p.assignments,A),E=p.duration,At=p.statedEffort;let ft=E,Ht=At??(E!=null?E*st:null);return j==="fixedEffort"?At!=null&&st>0?ft=At/st:Ht=E!=null?E*st:null:j==="fixedUnits"?E!=null?(ft=E,Ht=E*st):At!=null&&st>0&&(ft=At/st,Ht=At):ft=E,{duration:ft,effort:Ht,units:ht,schedulingMode:j,effortDriven:ot}}function L(p,A){const j=e(p.mode)||p.mode||"fixedDuration",ot=!!p.effortDriven,st=p.hoursPerDay>0?p.hoursPerDay:i;let ht=p.duration,E=p.units;const At=ht*E*st,ft=A.field,Ht=A.units!=null?A.units:1;if(ft==="duration")ht=A.value,j==="fixedEffort"&&(E=ht>0?At/(ht*st):E);else if(ft==="effort"){const Lt=A.value;j==="fixedDuration"?E=ht>0?Lt/(ht*st):E:ht=E>0?Lt/(E*st):ht}else if(ft==="units")E=A.value,j!=="fixedDuration"&&(ht=E>0?At/(E*st):ht);else if(ft==="addResource"||ft==="removeResource"){const Lt=ft==="addResource"?Ht:-Ht;j==="fixedDuration"?ot||(E=E+Lt):(E=E+Lt,ht=E>0?At/(E*st):ht)}return{duration:ht,units:E,effort:ht*E*st}}const Y=1e-9,W={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 z(p){if(p==null||p==="")return null;const A=typeof p=="number"?p:Number(p);return Number.isFinite(A)?A:null}function kt(p){if(!p)return null;const A=z(p.effort)??(Array.isArray(p.work)?null:z(p.work))??z(p.hours);if(A!=null)return A;if(Array.isArray(p.work)){let j=0,ot=!1;for(const st of p.work){const ht=z(st&&st.hours);ht!=null&&(j+=ht,ot=!0)}return ot?j:null}return null}function bt(p){return p==null||p===""?null:d(p)}const _t=Object.freeze(["id","name","start","end","duration","milestone","percentComplete","parent","baselineStart","baselineEnd","constraint","constraintDate","deadline"]);function lt(p){const A=p&&typeof p=="object"?p:{},j={};for(const ot of _t){const st=A[ot];if(typeof st=="function")j[ot]=st;else if(typeof st=="string"&&st!==""){const ht=st;j[ot]=E=>E[ht]}else j[ot]=ht=>ht[ot]}return j}function Et(p){return lt(p).id}function Rt(p){const A=p&&typeof p=="object"?p:{},j={};for(const ot of _t){const st=A[ot];typeof st=="string"&&st!==""?j[ot]=st:typeof st=="function"?j[ot]=null:j[ot]=ot}return j}function Gt(p,A){const j=A.constraint(p);let ot=j??(p&&p.constraintType),st=null;if(ot&&typeof ot=="object"&&!Array.isArray(ot)&&!(ot instanceof Date)&&(st=ot.date??ot.at??ot.constraintDate??null,ot=ot.type??ot.constraint??ot.code??null),ot==null||ot==="")return null;const ht=y(ot);if(!ht)return null;const E=bt(st??A.constraintDate(p)??p.constraintAt??p.at);return{type:ht,at:E}}function X(p,A){if(!p)return!1;if(p.locked===!0||typeof p.constraintMode=="string"&&p.constraintMode.toLowerCase()==="hard")return!0;if(typeof A=="function")try{return!!A(p)}catch{return!1}return!1}function et(p,A,j){const ot=new Map,st=[],ht=lt(A);if(!Array.isArray(p))return{ok:!1,error:{code:W.BAD_DURATION,message:"tasks must be an array"},order:st,byId:ot};for(const E of p){const At=E?ht.id(E):null,ft=At!=null?String(At):null;if(ft==null)return{ok:!1,error:{code:W.UNKNOWN_TASK,message:"every task needs an id"},order:st,byId:ot};if(ot.has(ft))return{ok:!1,error:{code:W.DUPLICATE_ID,message:`duplicate task id "${ft}"`,id:ft},order:st,byId:ot};const Ht=bt(ht.start(E)),Lt=bt(ht.end(E)),ee=ht.milestone(E)===!0;let Mt=ee?0:z(ht.duration(E));if(Mt==null&&Ht!=null&&Lt!=null&&(Mt=Lt-Ht),Mt!=null&&Mt<0)return{ok:!1,error:{code:W.BAD_DURATION,message:`task "${ft}" has negative duration ${Mt}`,id:ft},order:st,byId:ot};const N=ht.name(E),x=ht.parent(E),P=E.colour??E.color;ot.set(ft,{id:ft,name:N!=null?String(N):ft,colour:typeof P=="string"&&P.trim()!==""?P.trim():null,duration:Mt,milestoneFlag:ee,earliestStart:Ht,placedStart:Ht,placedEnd:Lt,percentComplete:z(ht.percentComplete(E)),parent:x!=null?String(x):null,constraint:Gt(E,ht),locked:X(E,j),baselineStart:bt(ht.baselineStart(E)??(E.baseline&&E.baseline.start)),baselineEnd:bt(ht.baselineEnd(E)??(E.baseline&&E.baseline.end)),deadline:bt(ht.deadline(E)),schedulingMode:e(E.schedulingMode??E.taskType),effortDriven:E.effortDriven==null?null:!!E.effortDriven,statedEffort:kt(E),assignments:q(E)}),st.push(ft)}return{ok:!0,order:st,byId:ot}}function mt(p,A){const j=new Map(p.map(At=>[At,[]]));for(const At of p){const ft=A.get(At).parent;if(ft!=null){if(!A.has(ft))return{ok:!1,error:{code:W.UNKNOWN_PARENT,message:`task "${At}" names unknown parent "${ft}"`,id:At}};j.get(ft).push(At)}}for(const At of p){const ft=new Set;let Ht=A.get(At).parent;for(;Ht!=null;){if(Ht===At||ft.has(Ht))return{ok:!1,error:{code:W.PARENT_CYCLE,message:`parent cycle at "${At}"`,id:At}};ft.add(Ht),Ht=A.get(Ht)?.parent??null}}const ot=At=>j.get(At).length>0,st=new Map,ht=At=>{if(st.has(At))return st.get(At);const ft=j.get(At),Ht=ft.length===0?[At]:ft.flatMap(Lt=>ht(Lt));return st.set(At,Ht),Ht};return{ok:!0,children:j,isSummary:ot,descendantLeaves:ht,ancestors:At=>{const ft=new Set;let Ht=A.get(At).parent;for(;Ht!=null;)ft.add(Ht),Ht=A.get(Ht).parent;return ft}}}const w=/^\s*(FS|SS|FF|SF)\s*(?:([+-])\s*(\d+(?:\.\d+)?))?\s*$/i;function J(p){const A={...p||null};if(typeof A.type!="string")return A;const j=w.exec(A.type);if(!j||!j[2])return A;const ot=(j[2]==="-"?-1:1)*Number(j[3]);A.type=j[1].toUpperCase();const st=z(p.lag);return st!=null&&st!==ot?(tt(`gantt-link-shorthand-${String(p.type)}-${st}`,`[lattice] gantt: dependency type ${JSON.stringify(p.type)} carries a lag of ${ot} but lag: ${st} was also given; the explicit lag wins. Give one or the other.`),A):(A.lag=ot,A)}function O(p,A,j={}){const ot=[];if(p==null)return{ok:!0,edges:ot};if(!Array.isArray(p))return{ok:!1,error:{code:W.UNKNOWN_TASK,message:"dependencies must be an array"},edges:ot};const st=typeof j.ancestors=="function"?j.ancestors:null;for(const ht of p){const E=J(ht),At=E&&E.from!=null?String(E.from):null,ft=E&&E.to!=null?String(E.to):null,Ht=E&&E.type!=null?String(E.type).toUpperCase():"FS",Lt=z(E.lag)??0;if(At==null||ft==null)return{ok:!1,error:{code:W.UNKNOWN_TASK,message:"a dependency needs both `from` and `to`"},edges:ot};if(!A.has(At))return{ok:!1,error:{code:W.UNKNOWN_TASK,message:`dependency references unknown task "${At}"`,id:At},edges:ot};if(!A.has(ft))return{ok:!1,error:{code:W.UNKNOWN_TASK,message:`dependency references unknown task "${ft}"`,id:ft},edges:ot};if(At===ft)return{ok:!1,error:{code:W.SELF_DEPENDENCY,message:`task "${At}" depends on itself`,id:At},edges:ot};if(!_.includes(Ht))return{ok:!1,error:{code:W.BAD_LINK_TYPE,message:`unknown link type "${Ht}" (expected one of ${_.join("/")})`},edges:ot};if(st&&(st(At).has(ft)||st(ft).has(At)))return{ok:!1,error:{code:W.DEP_ACROSS_HIERARCHY,message:`dependency between "${At}" and "${ft}" crosses their own parent/child hierarchy`,from:At,to:ft},edges:ot};ot.push({from:At,to:ft,type:Ht,lag:Lt})}return{ok:!0,edges:ot}}function K(p,A){const j=new Set,ot=[];for(const st of p){(A.isSummary(st.from)||A.isSummary(st.to))&&st.type!=="FS"&&tt(`gantt-summary-link-${st.type}-${st.from}-${st.to}`,`[lattice] gantt: ${st.type} link with a summary endpoint (${st.from} -> ${st.to}) is expanded to descendant leaves — a conservative v1 reading; only FS is exact for summary endpoints.`);for(const E of A.descendantLeaves(st.from))for(const At of A.descendantLeaves(st.to)){if(E===At)continue;const ft=[E,At,st.type,st.lag].join("");j.has(ft)||(j.add(ft),ot.push({from:E,to:At,type:st.type,lag:st.lag}))}}return ot}function v(p,A,j){return p.map(ot=>{const st=A.get(ot.from),ht=A.get(ot.to);if(!st||!ht||st.earliestStart==null||st.duration==null||ht.earliestStart==null||ht.duration==null)return ot;const E=j(st.earliestStart),At=E+st.duration,ft=j(ht.earliestStart),Ht=ft+ht.duration;let Lt;switch(ot.type){case"FS":Lt=ft-At;break;case"SS":Lt=ft-E;break;case"FF":Lt=Ht-At;break;case"SF":Lt=Ht-E;break;default:return ot}return{...ot,lag:Lt}})}function F(p,A){const j=new Map(p.map(E=>[E,0])),ot=new Map(p.map(E=>[E,[]]));for(const E of A)R(j,E.to),ot.get(E.from).push(E.to);const st=p.filter(E=>j.get(E)===0),ht=[];for(;st.length;){const E=st.shift();ht.push(E);for(const At of ot.get(E)){const ft=j.get(At)-1;j.set(At,ft),ft===0&&st.push(At)}}return ht.length===p.length?{ok:!0,sorted:ht}:{ok:!1,cycle:it(p,ot,new Set(ht))}}function R(p,A){p.set(A,p.get(A)+1)}function it(p,A,j){const ot=p.find(At=>!j.has(At)),st=[],ht=new Map;let E=ot;for(;E!=null&&!ht.has(E);)ht.set(E,st.length),st.push(E),E=A.get(E).find(At=>!j.has(At));return E==null?st:st.slice(ht.get(E)).concat(E)}function G(p,A,j){const ot=String(A),st=String(j);if(ot===st)return!0;const ht=new Map;for(const ft of p){const Ht=String(ft.from);ht.has(Ht)||ht.set(Ht,[]),ht.get(Ht).push(String(ft.to))}const E=new Set,At=[st];for(;At.length;){const ft=At.pop();if(ft===ot)return!0;if(!E.has(ft)){E.add(ft);for(const Ht of ht.get(ft)||[])At.push(Ht)}}return!1}function rt(p,A,j,ot,st,ht=new Map,E=new Map,At=!1){const ft=F(p,j);if(!ft.ok)return tt(`gantt-cycle-${ft.cycle.join(">")}`,`[lattice] gantt: dependency cycle detected (${ft.cycle.join(" -> ")}); schedule refused.`),{ok:!1,error:{code:W.CYCLE,message:`dependency cycle: ${ft.cycle.join(" -> ")}`,cycle:ft.cycle}};const Ht=ft.sorted,Lt=new Map(p.map(pt=>[pt,[]])),ee=new Map(p.map(pt=>[pt,[]]));for(const pt of j)Lt.get(pt.to).push(pt),ee.get(pt.from).push(pt);const Mt=new Map;for(const pt of p){const Ot=A.get(pt);Mt.set(pt,{id:pt,name:Ot.name,duration:Ot.duration,es:0,ef:0,ls:0,lf:0,totalFloat:0,critical:!1,percentComplete:Ot.percentComplete,parent:Ot.parent,isSummary:!1,isMilestone:Ot.duration===0,children:[],colour:Ot.colour??null,locked:!!Ot.locked})}const N=[];for(const pt of Ht){const Ot=A.get(pt),xt=Mt.get(pt);let It=Math.max(ot,Ot.earliestStart??ot);for(const te of Lt.get(pt)){const ne=Mt.get(te.from);let Yt;switch(te.type){case"FS":Yt=ne.ef+te.lag;break;case"SS":Yt=ne.es+te.lag;break;case"FF":Yt=ne.ef+te.lag-xt.duration;break;case"SF":Yt=ne.es+te.lag-xt.duration;break;default:Yt=-1/0}Yt>It&&(It=Yt)}const Ut=ht.get(pt);if(Ut&&Ut.at!=null)switch(Ut.type){case"MSO":Ut.at<It-Y?N.push({id:pt,type:Ut.type,date:Ut.at,scheduled:It,at:Ut.at,earliestFeasible:It}):It=Ut.at,xt.pinned=!0;break;case"MFO":{const te=Ut.at-xt.duration;te<It-Y?N.push({id:pt,type:Ut.type,date:Ut.at,scheduled:It+xt.duration,at:Ut.at,earliestFeasible:It}):It=te,xt.pinned=!0;break}case"SNET":Ut.at>It+Y&&(It=Ut.at);break;case"SNLT":It>Ut.at+Y&&N.push({id:pt,type:Ut.type,date:Ut.at,scheduled:It,at:Ut.at,earliestFeasible:It});break;case"FNET":{const te=Ut.at-xt.duration;te>It+Y&&(It=te);break}case"FNLT":{const te=It+xt.duration;te>Ut.at+Y&&N.push({id:pt,type:Ut.type,date:Ut.at,scheduled:te,at:Ut.at,earliestFeasible:It});break}default:break}if(Ot.locked){const te=Ut&&Ut.at!=null?Ut.type==="MFO"?Ut.at-xt.duration:Ut.type==="MSO"?Ut.at:null:null,ne=Ot.earliestStart!=null?Ot.earliestStart:te??It;if(It-Y>ne)for(const Yt of Lt.get(pt)){const Nt=Mt.get(Yt.from);let qt;switch(Yt.type){case"FS":qt=Nt.ef+Yt.lag;break;case"SS":qt=Nt.es+Yt.lag;break;case"FF":qt=Nt.ef+Yt.lag-xt.duration;break;case"SF":qt=Nt.es+Yt.lag-xt.duration;break;default:qt=-1/0}qt>ne+Y&&N.push({id:pt,from:Yt.from,to:pt,type:"LOCKED",date:ne,scheduled:qt,at:ne,earliestFeasible:ne})}It=ne,xt.pinned=!0}xt.es=It,xt.ef=It+xt.duration}const x=p.length?Math.max(...p.map(pt=>Mt.get(pt).ef)):ot,P=Number.isFinite(st)?st:x;for(let pt=Ht.length-1;pt>=0;pt-=1){const Ot=Ht[pt],xt=Mt.get(Ot);let It=P;const Ut=E.get(Ot);Ut!=null&&Ut<It&&(It=Ut);for(const te of ee.get(Ot)){const ne=Mt.get(te.to);let Yt;switch(te.type){case"FS":Yt=ne.ls-te.lag;break;case"SS":Yt=ne.ls-te.lag+xt.duration;break;case"FF":Yt=ne.lf-te.lag;break;case"SF":Yt=ne.lf-te.lag+xt.duration;break;default:Yt=1/0}Yt<It&&(It=Yt)}xt.pinned&&(It=xt.ef),xt.lf=It,xt.ls=It-xt.duration,xt.totalFloat=xt.ls-xt.es,xt.critical=xt.totalFloat<=Y,Ut!=null&&(xt.deadline=Ut,xt.late=xt.ef>Ut+Y)}for(const pt of p){const Ot=ht.get(pt);if(!Ot||Ot.type!=="ALAP")continue;const xt=Mt.get(pt);xt.es=xt.ls,xt.ef=xt.lf,xt.totalFloat=0,xt.critical=!0}const Q=p.filter(pt=>Mt.get(pt).critical),yt=At?[]:B(p,j,Mt);return{ok:!0,tasks:Mt,critical:Q,criticalPaths:yt,projectFinish:x,conflicts:N}}function wt(p,A=[],j={}){const ot=bt(j.projectStart)??0,st=bt(j.deadline),ht=dt(j.calendar,ot),E=$t=>$t==null?null:ht?ht.indexOf($t):$t,At=$t=>ht?ht.dayOf($t):$t,ft=et(p,j.fields,j.lockWhen);if(!ft.ok)return{ok:!1,error:ft.error};const{order:Ht,byId:Lt}=ft,ee=mt(Ht,Lt);if(!ee.ok)return{ok:!1,error:ee.error};const Mt=O(A,Lt,ee);if(!Mt.ok)return{ok:!1,error:Mt.error};const N=j.honourDates?v(Mt.edges,Lt,E):Mt.edges,x={defaultMode:e(j.schedulingMode)||"fixedDuration",defaultEffortDriven:!!j.effortDriven,hoursPerDay:z(j.hoursPerDay)??i,resourceHours:j.resourceHours instanceof Map?j.resourceHours:new Map},P=new Map;for(const $t of Ht){if(ee.isSummary($t))continue;const Jt=Lt.get($t);if(!(Jt.schedulingMode!=null||Jt.effortDriven!=null||Jt.statedEffort!=null||j.schedulingMode!=null||j.effortDriven!=null))continue;const $e=l(Jt,x);$e.duration!=null&&(Jt.duration=$e.duration),P.set($t,{schedulingMode:$e.schedulingMode,effortDriven:$e.effortDriven,effort:$e.effort,units:$e.units})}const Q=$(Ht,Lt,ee),yt=Ht.filter($t=>!ee.isSummary($t)&&!Q.has($t)),pt=new Map(yt.map($t=>{const Jt=Lt.get($t);return[$t,{...Jt,earliestStart:E(Jt.earliestStart)}]})),Ot=new Map;for(const $t of yt){const Jt=Lt.get($t).constraint;Jt&&Ot.set($t,{type:Jt.type,at:E(Jt.at)})}const xt=ht?ht.indexOf(ot):ot,It=st==null?void 0:E(st),Ut=new Map;for(const $t of yt){const Jt=pt.get($t).deadline;if(Jt==null)continue;const he=ht?ht.indexOf(Jt):Jt;Number.isFinite(he)&&Ut.set($t,he)}const te=D(K(N,ee),Q),ne=rt(yt,pt,te,xt,It,Ot,Ut,!!j.skipCriticalPaths);if(!ne.ok)return{ok:!1,error:ne.error};const Yt=ne.tasks;for(const $t of yt){const Jt=Yt.get($t);Jt.es=At(Jt.es),Jt.ef=At(Jt.ef),Jt.ls=At(Jt.ls),Jt.lf=At(Jt.lf),Jt.deadline!=null&&(Jt.deadline=At(Jt.deadline)),ct(Jt,Lt.get($t).baselineStart,Lt.get($t).baselineEnd);const he=P.get($t);he&&(Jt.schedulingMode=he.schedulingMode,Jt.effortDriven=he.effortDriven,Jt.effort=he.effort,Jt.units=he.units)}for(const $t of Ht)Q.has($t)&&Yt.set($t,k(Lt.get($t),ee.isSummary($t)));for(let $t=Ht.length-1;$t>=0;$t-=1){const Jt=Ht[$t];!ee.isSummary(Jt)||Q.has(Jt)||Yt.set(Jt,vt(Jt,Lt.get(Jt),ee,Yt))}for(const $t of Ht)ee.isSummary($t)&&(Yt.get($t).children=ee.children.get($t).slice());const Nt=ht?ht.anchor:ot,qt=At(ne.projectFinish);return{ok:!0,tasks:Yt,order:Ht,critical:ne.critical,criticalPaths:ne.criticalPaths,projectStart:Nt,projectFinish:qt,projectDuration:qt-Nt,conflicts:(ne.conflicts||[]).map($t=>({id:$t.id,type:$t.type,date:At($t.date),scheduled:At($t.scheduled),at:At($t.at),earliestFeasible:At($t.earliestFeasible),...$t.from!==void 0?{from:$t.from,to:$t.to}:null})),calendar:!!ht,unscheduled:Ht.filter($t=>Q.has($t)),...j.honourDates?{dependencies:N}:{}}}function ct(p,A,j){A==null&&j==null||(p.baselineStart=A??null,p.baselineEnd=j??null,p.startVariance=A==null?null:p.es-A,p.finishVariance=j==null?null:p.ef-j,p.durationVariance=A==null||j==null?null:p.ef-p.es-(j-A))}function vt(p,A,j,ot){const st=j.children.get(p).map(P=>ot.get(P)).filter(P=>!P.unscheduled),ht=Math.min(...st.map(P=>P.es)),E=Math.max(...st.map(P=>P.ef)),At=Math.min(...st.map(P=>P.ls)),ft=Math.max(...st.map(P=>P.lf)),Ht=j.descendantLeaves(p).map(P=>ot.get(P)).filter(P=>!P.unscheduled),Lt=Ht.reduce((P,Q)=>P+Q.duration,0),ee=Lt>Y?Ht.reduce((P,Q)=>P+Q.duration*(Q.percentComplete??0),0)/Lt:null,Mt={id:p,name:A.name,duration:E-ht,es:ht,ef:E,ls:At,lf:ft,totalFloat:At-ht,critical:st.some(P=>P.critical),percentComplete:ee,parent:A.parent,isSummary:!0,isMilestone:!1,locked:!1,children:[],colour:A.colour??null},N=Ht.map(P=>P.baselineStart).filter(P=>P!=null),x=Ht.map(P=>P.baselineEnd).filter(P=>P!=null);return(N.length||x.length)&&ct(Mt,N.length?Math.min(...N):null,x.length?Math.max(...x):null),Mt}function B(p,A,j){const ot=new Map(p.map(ft=>[ft,[]])),st=new Set;for(const ft of A){const Ht=j.get(ft.from),Lt=j.get(ft.to);if(!Ht.critical||!Lt.critical)continue;let ee;switch(ft.type){case"FS":ee=Ht.ef+ft.lag;break;case"SS":ee=Ht.es+ft.lag;break;case"FF":ee=Ht.ef+ft.lag-Lt.duration;break;case"SF":ee=Ht.es+ft.lag-Lt.duration;break;default:ee=-1/0}Math.abs(ee-Lt.es)<=Y&&(ot.get(ft.from).push(ft.to),st.add(ft.to))}const ht=p.filter(ft=>j.get(ft).critical&&!st.has(ft)),E=[],At=(ft,Ht)=>{const Lt=ot.get(ft);if(!Lt.length){E.push(Ht);return}for(const ee of Lt)At(ee,Ht.concat(ee))};for(const ft of ht)At(ft,[ft]);return E}function Qt(p,A,j){if(!A||!A.ok)return[];const ot=[],st=lt(j);for(const ht of p){const E=ht?st.id(ht):null,At=E!=null?String(E):null;if(At==null||!A.tasks.has(At))continue;const ft=A.tasks.get(At);if(ft.isSummary)continue;const Ht=z(st.start(ht));Ht==null||ft.unscheduled||Ht<ft.es-Y&&ot.push({id:At,placedStart:Ht,earliestStart:ft.es,by:ft.es-Ht})}return ot}}),oe("packages/modules/gantt/resources.js",function(f,ut){"use strict";Object.defineProperty(f,"normalizeCapacities",{enumerable:!0,get:function(){return s}}),Object.defineProperty(f,"resourceDisplayNames",{enumerable:!0,get:function(){return e}}),Object.defineProperty(f,"resourceSpecsByKey",{enumerable:!0,get:function(){return i}}),Object.defineProperty(f,"resourceAvatars",{enumerable:!0,get:function(){return o}}),Object.defineProperty(f,"normalizeResources",{enumerable:!0,get:function(){return W}}),Object.defineProperty(f,"resourceDailyHours",{enumerable:!0,get:function(){return z}}),Object.defineProperty(f,"sweepLoad",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(f,"computeResourceLoad",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(f,"normalizeResourceRates",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(f,"rateOn",{enumerable:!0,get:function(){return Et}}),Object.defineProperty(f,"levelResources",{enumerable:!0,get:function(){return et}});const tt=ut("packages/core/src/internal/util.js").warnOnce,at=ut("packages/modules/gantt/schedule.js"),dt=at.computeSchedule,nt=at.EPS,q=at.taskIdReader,T=at.resolveConstraintCode,d=ut("packages/modules/gantt/assignments.js"),h=d.parseAssignments,$=ut("packages/modules/gantt/calendar.js").createCalendar,k=ut("packages/modules/gantt/time.js"),_=k.fromDayNumber,S=k.toDayNumber;Object.defineProperty(f,"parseAssignments",{enumerable:!0,get:function(){return d.parseAssignments}});const b=Object.freeze([1,2,3,4,5]),y=8;function g(w){if(w==null||w==="")return null;const J=typeof w=="number"?w:Number(w);return Number.isFinite(J)?J:null}function s(w,J){const O=new Map;if(Array.isArray(w))for(const K of w){const v=K&&(K.id??K.name??K.resource);if(v==null||v==="")continue;const F=g(K.capacity??K.maxUnits??K.max??K.units);O.set(String(v),F??J)}else if(w&&typeof w=="object")for(const[K,v]of Object.entries(w)){const F=g(v);O.set(String(K),F??J)}return O}function e(w){const J=new Map;if(Array.isArray(w))for(const O of w){if(!O)continue;const K=O.id??O.name??O.resource;if(K==null||K==="")continue;const v=O.name??O.id??O.resource;J.set(String(K),String(v))}else if(w&&typeof w=="object")for(const[O,K]of Object.entries(w))J.set(O,K&&typeof K=="object"&&K.name!=null?String(K.name):O);return J}function i(w){const J=new Map;if(Array.isArray(w))for(const O of w){if(!O||typeof O!="object")continue;const K=O.id??O.name??O.resource;K!=null&&K!==""&&J.set(String(K),{...O})}else if(w&&typeof w=="object")for(const[O,K]of Object.entries(w))J.set(O,K&&typeof K=="object"?{...K}:{capacity:K});return J}function o(w){const J=new Map,O=K=>typeof K=="string"?K.trim():"";if(Array.isArray(w))for(const K of w){if(!K)continue;const v=K.id??K.name??K.resource;if(v==null||v==="")continue;const F=O(K.avatar);F&&J.set(String(v),F)}else if(w&&typeof w=="object")for(const[K,v]of Object.entries(w)){const F=v&&typeof v=="object"?O(v.avatar):"";F&&J.set(K,F)}return J}function l(w){const J=new Set;for(const O of Array.isArray(w)?w:[]){if(O&&typeof O=="object"&&!(O instanceof Date)&&("from"in O||"to"in O)){const v=S(O.from),F=S(O.to??O.from);if(v==null)continue;const R=F??v;for(let it=Math.min(v,R);it<=Math.max(v,R);it+=1)J.add(it);continue}const K=S(O);K!=null&&J.add(K)}return J}function L(w){return w==null?{workdays:[0,1,2,3,4,5,6],holidays:new Set}:w==="weekends"?{workdays:[...b],holidays:new Set}:{workdays:Array.isArray(w.workdays)&&w.workdays.length?w.workdays.map(Number).filter(O=>O>=0&&O<=6):[...b],holidays:l(w.holidays)}}function Y(w,J,O,K){const v=new Set(Array.isArray(w.workingDays)&&w.workingDays.length?w.workingDays.map(Number).filter(p=>p>=0&&p<=6):K.workdays),F=l(w.holidays);for(const p of K.holidays)F.add(p);const R=w.hoursPerDay,it=p=>{if(R!=null&&typeof R=="object"){const j=g(R[p]);return j??O}const A=g(R);return A??O},G=p=>{const A=_(p);return A?v.has(A.getUTCDay())&&!F.has(p):!1},rt=p=>G(p)?J??it(_(p).getUTCDay()):0,wt=p=>O>0?rt(p)/O:0;let ct=0;for(const p of v){const A=J??it(p);A>ct&&(ct=A)}const vt=O>0?ct/O:0;let B=0;for(const p of K.workdays)v.has(p)&&(B+=J??it(p));const Qt=K.workdays.length?B/K.workdays.length:O;return{hasCalendar:!0,capacityUnits:vt,hoursPerWorkingDay:Qt,worksOn:G,capacityHoursOn:rt,capacityUnitsOn:wt}}function W(w,J,O={}){const K=g(O.hoursPerDay)??y,v=L(O.calendar),F=new Map,R=(it,G)=>{const rt=g(G.capacity??G.maxUnits??G.max??G.units);G.calendar&&typeof G.calendar=="object"?F.set(it,Y(G.calendar,rt,K,v)):F.set(it,{hasCalendar:!1,capacityUnits:rt??J,hoursPerWorkingDay:K})};if(Array.isArray(w))for(const it of w){const G=it&&(it.id??it.name??it.resource);G==null||G===""||R(String(G),it)}else if(w&&typeof w=="object")for(const[it,G]of Object.entries(w))R(String(it),typeof G=="object"&&G?G:{capacity:G});return F}function z(w,J,O={}){const K=g(O.hoursPerDay)??y,v=W(w,J,O),F=new Map;for(const[R,it]of v)F.set(R,it.hoursPerWorkingDay!=null?it.hoursPerWorkingDay:K);return F}function kt(w){if(!w.length)return[];const J=new Set;for(const v of w)J.add(v.s),J.add(v.e);const O=[...J].sort((v,F)=>v-F),K=[];for(let v=0;v<O.length-1;v+=1){const F=O[v],R=O[v+1];if(R<=F)continue;let it=0;const G=[];for(const rt of w)rt.s<=F&&rt.e>=R&&(it+=rt.units,G.push(rt.taskId));G.length&&K.push({s:F,e:R,load:it,taskIds:G})}return K}function bt(w,J,O={}){const K={ok:!1,resources:[],overAllocations:[],byResource:new Map};if(!J||!J.ok)return K;const v=g(O.defaultCapacity)??1,F=s(O.resources,v),R=W(O.resources,v,{calendar:O.calendar,hoursPerDay:O.hoursPerDay}),it=O.calendar!=null?$(O.calendar,J.projectStart):null,G=j=>F.has(j)?F.get(j):v,rt=j=>it?it.indexOf(j):j,wt=j=>it?it.dayOf(j):j,ct=q(O.fields),vt=new Map;for(const j of w){if(!j)continue;const ot=ct(j);if(ot==null)continue;const st=String(ot);vt.has(st)||vt.set(st,j)}const B=new Map;for(const j of J.order){const ot=J.tasks.get(j);if(!ot||ot.isSummary||ot.unscheduled)continue;const st=vt.get(j);if(!st)continue;const ht=h(st);if(!ht.length)continue;const E=rt(ot.es),At=rt(ot.ef);if(!(At<=E))for(const ft of ht)B.has(ft.resource)||B.set(ft.resource,[]),B.get(ft.resource).push({s:E,e:At,units:ft.units,taskId:j})}const Qt=new Map,p=[],A=[];for(const[j,ot]of B){const st=R.get(j),ht=kt(ot);let E=0,At,ft;if(st&&st.hasCalendar){ft=st.capacityUnits,At=[];for(const Lt of ht){Lt.load>E&&(E=Lt.load);let ee=Lt.s,Mt=st.capacityUnitsOn(wt(Lt.s));const N=x=>{const P={start:wt(ee),end:wt(x),load:Lt.load,taskIds:Lt.taskIds};At.push(P),Lt.load>Mt+nt&&A.push({resource:j,capacity:Mt,start:P.start,end:P.end,load:Lt.load,taskIds:Lt.taskIds.slice()})};for(let x=Lt.s+1;x<Lt.e;x+=1){const P=st.capacityUnitsOn(wt(x));P!==Mt&&(N(x),ee=x,Mt=P)}N(Lt.e)}}else ft=G(j),At=ht.map(Lt=>{Lt.load>E&&(E=Lt.load);const ee={start:wt(Lt.s),end:wt(Lt.e),load:Lt.load,taskIds:Lt.taskIds};return Lt.load>ft+nt&&A.push({resource:j,capacity:ft,start:ee.start,end:ee.end,load:Lt.load,taskIds:Lt.taskIds.slice()}),ee});const Ht={resource:j,capacity:ft,peak:E,segments:At};Qt.set(j,Ht),p.push(Ht)}return p.sort((j,ot)=>j.resource<ot.resource?-1:j.resource>ot.resource?1:0),A.sort((j,ot)=>j.start-ot.start||(j.resource<ot.resource?-1:1)),{ok:!0,resources:p,overAllocations:A,byResource:Qt}}function _t(w){const J=[];for(const O of Array.isArray(w)?w:[]){const K=S(O&&O.from),v=g(O&&O.rate);K==null||v==null||J.push({from:Math.round(K),rate:v})}return J.sort((O,K)=>O.from-K.from),J}function lt(w){const J=new Map,O=(K,v)=>{if(!v||typeof v!="object")return;const F=v.type==="material"||v.type==="cost"?v.type:"work",R=g(v.rate),it=_t(v.rates),G=g(v.cost);R==null&&!it.length&&G==null||J.set(K,{type:F,rate:R,rates:it,cost:G})};if(Array.isArray(w))for(const K of w){const v=K&&(K.id??K.name??K.resource);v==null||v===""||O(String(v),K)}else if(w&&typeof w=="object")for(const[K,v]of Object.entries(w))v&&typeof v=="object"&&O(K,v);return J}function Et(w,J){if(!w)return null;let O=w.rate;for(const K of w.rates)if(K.from<=J)O=K.rate;else break;return O??null}function Rt(w){if(!w)return!1;const J=w.constraint??w.constraintType;if(J==null||J==="")return!1;const O=String(J).toLowerCase().replace(/\s+/g,"-");return O==="mso"||O==="must-start-on"||O==="muststarton"||O==="start-on"||O==="mfo"||O==="must-finish-on"||O==="mustfinishon"||O==="finish-on"}function Gt(w){if(!w)return null;const J=w.constraint??w.constraintType,O=T(J);if(O!=="SNLT"&&O!=="FNLT")return null;let K=w.constraintDate??w.constraintAt??w.at;if(J&&typeof J=="object"&&K==null&&(K=J.date),K==null||K==="")return null;const v=S(K);return Number.isFinite(v)?{type:O,date:v}:null}function X(w,J){return w?g(w[J])??0:0}function et(w,J,O={}){const K={projectStart:O.projectStart,deadline:O.deadline,calendar:O.calendar,fields:O.fields,skipCriticalPaths:!0},v=O.priorityField||"priority",F=O.maxIterations!=null?O.maxIterations:Math.max(100,w.length*w.length*2),R=q(O.fields),it=w.map(ft=>({...ft})),G=it.map(ft=>String(R(ft))),rt=new Map(it.map(ft=>[String(R(ft)),ft])),wt=new Map(G.map((ft,Ht)=>[ft,Ht])),ct=ft=>wt.has(ft)?wt.get(ft):-1;let vt=dt(it,J,K);if(!vt.ok)return{ok:!1,error:vt.error};const B=new Map;for(const ft of vt.order){const Ht=vt.tasks.get(ft);Ht&&!Ht.isSummary&&!Ht.unscheduled&&B.set(ft,Ht.es)}const Qt=g(O.defaultCapacity)??1,p=W(O.resources,Qt,{calendar:O.calendar,hoursPerDay:O.hoursPerDay}),A=O.calendar!=null?$(O.calendar,vt.projectStart):null,j=(ft,Ht)=>{const Lt=h(Ht).map(Mt=>p.get(Mt.resource)).filter(Mt=>Mt&&Mt.hasCalendar);let ee=Math.round(ft);for(let Mt=0;Mt<3660;Mt+=1){if((!A||A.isWorking(ee))&&Lt.every(N=>N.worksOn(ee)))return ee;ee+=1}return Math.round(ft)};let ot=0;const st=Math.max(32,w.length*2);let ht=1/0,E=0;for(;ot<F;ot+=1){const ft=bt(it,vt,O);ft.overAllocations.length<ht?(ht=ft.overAllocations.length,E=0):E+=1;const Ht=ft.overAllocations.filter(P=>new Set(P.taskIds).size>=2);if(!Ht.length)return{ok:!0,resolved:ft.overAllocations.length===0,tasks:it,schedule:vt,moves:mt(B,vt),remaining:ft.overAllocations,iterations:ot};if(E>=st)return tt("gantt-level-unresolved",`[lattice] gantt: resource leveling could not clear ${ft.overAllocations.length} over-allocation(s) after ${ot} iterations; the plan cannot be fully levelled, returning the partial result.`),{ok:!0,resolved:!1,tasks:it,schedule:vt,moves:mt(B,vt),remaining:ft.overAllocations,iterations:ot};const ee=Ht.slice().sort((P,Q)=>P.start-Q.start||Q.load-P.load)[0].taskIds.map(P=>vt.tasks.get(P)).filter(Boolean),Mt=ee.filter(P=>!Rt(rt.get(P.id)));if(!Mt.length)return{ok:!0,resolved:!1,tasks:it,schedule:vt,moves:mt(B,vt),remaining:ft.overAllocations,iterations:ot};Mt.sort((P,Q)=>{if(Q.totalFloat!==P.totalFloat)return Q.totalFloat-P.totalFloat;const yt=X(rt.get(P.id),v),pt=X(rt.get(Q.id),v);return yt!==pt?yt-pt:Q.es!==P.es?Q.es-P.es:ct(Q.id)-ct(P.id)});let N=null,x=null;for(const P of Mt){const Q=ee.filter(xt=>xt.id!==P.id).map(xt=>xt.ef).filter(xt=>xt>P.es+nt),yt=Q.length?Math.min(...Q):P.es+1,pt=j(yt,rt.get(P.id)),Ot=Gt(rt.get(P.id));if(!(Ot&&(Ot.type==="SNLT"?pt:pt+(P.ef-P.es))>Ot.date+nt)){N=P,x=pt;break}}if(!N)return{ok:!0,resolved:!1,tasks:it,schedule:vt,moves:mt(B,vt),remaining:ft.overAllocations,iterations:ot};if(rt.get(N.id).start=x,vt=dt(it,J,K),!vt.ok)return{ok:!1,error:vt.error}}const At=bt(it,vt,O);return At.overAllocations.length&&tt("gantt-level-unresolved",`[lattice] gantt: resource leveling hit its ${F}-iteration cap with ${At.overAllocations.length} over-allocation(s) unresolved; returning the partial result.`),{ok:!0,resolved:At.overAllocations.length===0,tasks:it,schedule:vt,moves:mt(B,vt),remaining:At.overAllocations,iterations:ot}}function mt(w,J){const O=[];for(const K of J.order){const v=J.tasks.get(K);if(!v||v.isSummary||v.unscheduled)continue;const F=w.get(K);F!=null&&v.es>F+nt&&O.push({id:K,from:F,to:v.es,delay:v.es-F})}return O}}),oe("packages/modules/gantt/workload.js",function(f,ut){"use strict";Object.defineProperty(f,"WORKLOAD_DEFAULTS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(f,"HISTOGRAM_DEFAULTS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(f,"normalizeThresholds",{enumerable:!0,get:function(){return y}}),Object.defineProperty(f,"thresholdFor",{enumerable:!0,get:function(){return g}}),Object.defineProperty(f,"normalizeExternalLoad",{enumerable:!0,get:function(){return e}}),Object.defineProperty(f,"statedHours",{enumerable:!0,get:function(){return o}}),Object.defineProperty(f,"taskContour",{enumerable:!0,get:function(){return l}}),Object.defineProperty(f,"contourTotal",{enumerable:!0,get:function(){return L}}),Object.defineProperty(f,"serializeContour",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(f,"contourSpan",{enumerable:!0,get:function(){return W}}),Object.defineProperty(f,"spanDuration",{enumerable:!0,get:function(){return z}}),Object.defineProperty(f,"spreadHours",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(f,"setContourBucket",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(f,"retimeContour",{enumerable:!0,get:function(){return _t}}),Object.defineProperty(f,"recordWorkingDays",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(f,"workloadBuckets",{enumerable:!0,get:function(){return Et}}),Object.defineProperty(f,"taskAssignmentEffort",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(f,"computeWorkload",{enumerable:!0,get:function(){return Gt}}),Object.defineProperty(f,"formatHours",{enumerable:!0,get:function(){return X}}),Object.defineProperty(f,"formatPercent",{enumerable:!0,get:function(){return et}}),Object.defineProperty(f,"formatCost",{enumerable:!0,get:function(){return mt}});const Pt=ut("packages/modules/gantt/resources.js"),tt=Pt.parseAssignments,at=Pt.rateOn,dt=ut("packages/modules/gantt/schedule.js"),nt=dt.EPS,q=dt.taskIdReader,T=ut("packages/modules/gantt/time.js"),d=T.fromDayNumber,h=T.toDayNumber,D=T.toISODate,k=ut("packages/core/src/internal/util.js").warnOnce,_=Object.freeze({hoursPerDay:8,height:160,rowHeight:28,decimals:1,totals:!0,unit:"hours",thresholds:null,showUnassigned:!0,labelWidth:null}),S=Object.freeze({resources:null,unit:"hours",stacked:!1,height:160,rowHeight:48,labelWidth:null});function b(w){if(w==null||w===""||typeof w=="boolean")return null;const J=typeof w=="number"?w:Number(w);return Number.isFinite(J)?J:null}function y(w){if(!Array.isArray(w))return null;const J=[];for(const O of w){if(!O||typeof O!="object")continue;const K=b(O.at);if(K==null||K<0)continue;const v=typeof O.className=="string"&&O.className?O.className:null,F=typeof O.colour=="string"&&O.colour?O.colour:typeof O.color=="string"&&O.color?O.color:null;!v&&!F||J.push({at:K,className:v,colour:F})}return J.length?(J.sort((O,K)=>O.at-K.at),J):null}function g(w,J){if(!w||J==null||!Number.isFinite(J))return null;let O=null;for(const K of w)if(J>=K.at)O=K;else break;return O}function s(w,J){if(w==null||w==="")return null;if(typeof w=="number")return Number.isFinite(w)?w:null;const O=h(w);return Number.isFinite(O)?O-J:null}function e(w,J=0){if(!Array.isArray(w))return[];const O=[];for(let K=0;K<w.length;K+=1){const v=w[K],F=v&&typeof v=="object"&&v.resource!=null&&v.resource!==""?String(v.resource):null,R=v&&typeof v=="object"?s(v.start,J):null,it=v&&typeof v=="object"?s(v.end,J):null;if(F==null||R==null||it==null){k(`gantt.workloadExternal.${K}`,`[lattice] gantt: workload.external entry ${K} has no resource or no drawable start/end; it is skipped.`);continue}const G=typeof v.label=="string"&&v.label!==""?v.label:null,rt=typeof v.group=="string"&&v.group!==""?v.group:null;O.push({index:K,resource:F,start:R,end:it,units:b(v.units),hours:b(v.hours),label:G,group:rt})}return O}function i(w){const J=h(w.start);if(!Number.isFinite(J))return null;const O=h(w.end);if(Number.isFinite(O))return{es:J,ef:O};const K=b(w.duration);return{es:J,ef:J+(K??0)}}function o(w){if(!w||Array.isArray(w.work))return null;const J=b(w.work);return J??b(w.hours)}function l(w){if(!w||!Array.isArray(w.work))return null;const J=[];for(const K of w.work){if(!K||typeof K!="object")continue;const v=h(K.date),F=b(K.hours);v==null||F==null||J.push({day:Math.round(v),hours:F})}J.sort((K,v)=>K.day-v.day);const O=[];for(const K of J){const v=O[O.length-1];v&&v.day===K.day?v.hours+=K.hours:O.push({day:K.day,hours:K.hours})}return O}function L(w){return(Array.isArray(w)?w:[]).reduce((J,O)=>J+(b(O.hours)??0),0)}function Y(w){const J=[];for(const O of Array.isArray(w)?w:[]){const K=b(O.hours);if(K==null||!(Math.abs(K)>nt))continue;const v=D(O.day);v!=null&&J.push({date:v,hours:Math.round(K*1e6)/1e6})}return J}function W(w){const J=(Array.isArray(w)?w:[]).filter(O=>Math.abs(b(O.hours)??0)>nt);return J.length?{first:J[0].day,last:J[J.length-1].day}:null}function z(w,J,O=null){if(!Number.isFinite(w)||!Number.isFinite(J)||J<w)return 0;if(typeof O!="function")return Math.round(J-w)+1;let K=0;for(let v=Math.round(w);v<=Math.round(J);v+=1)O(v)&&(K+=1);return K}function kt(w,J){if(!Array.isArray(w)||!w.length)return[];const O=J/w.length;return w.map(K=>({day:K,hours:O}))}function bt(w,J,O,K){const v=(Array.isArray(w)?w:[]).filter(R=>!(R.day>=J.start&&R.day<J.end)),F=Math.abs(K)>nt?kt(O,K):[];return[...v,...F].sort((R,it)=>R.day-it.day)}function _t(w,J,O){const K=Array.isArray(J)?J:[],v=Array.isArray(O)?O:[];if(!Array.isArray(w)||!K.length||!v.length)return Array.isArray(w)?w:[];const F=new Map(w.map(rt=>[rt.day,b(rt.hours)??0])),R=K.map(rt=>F.get(rt)??0),it=R.length,G=[];for(let rt=0;rt<v.length;rt+=1){const wt=R[Math.min(it-1,Math.floor(rt*it/v.length))];Math.abs(wt)>nt&&G.push({day:v[rt],hours:wt})}return G}function lt(w,J=null){const O=[];if(!w||!Number.isFinite(w.es)||!Number.isFinite(w.ef))return O;for(let K=Math.floor(w.es);K<Math.ceil(w.ef);K+=1)(typeof J!="function"||J(K))&&O.push(K);return O}function Et(w,J,O){const K=Math.floor(J),v=Math.ceil(O),F=[];if(!(v>K))return F;if(w==="day"){for(let G=K;G<v;G+=1)F.push({start:G,end:G+1});return F}if(w==="month"||w==="quarter"){const G=d(K);if(!G)return F;let rt=Date.UTC(G.getUTCFullYear(),G.getUTCMonth(),1)/864e5;for(;rt<v;){const wt=d(rt),ct=Date.UTC(wt.getUTCFullYear(),wt.getUTCMonth()+1,1)/864e5;F.push({start:rt,end:ct}),rt=ct}return F}const R=d(K);let it=K-(R?R.getUTCDay():0);for(;it<v;it+=7)F.push({start:it,end:it+7});return F}function Rt(w,J,O={}){const K=b(O.hoursPerDay)??_.hoursPerDay,v=typeof O.isWorking=="function"?O.isWorking:null,F=lt(J,v),R=l(w);if(!R&&!F.length)return[];const it=tt(w),G=it.length?it:[{resource:null,units:1}],rt=G.reduce((ct,vt)=>ct+(b(vt.units)??0),0);if(!(rt>0))return[];let wt;if(R)wt=R.filter(ct=>Math.abs(ct.hours)>nt);else{const ct=o(w),vt=ct??F.length*K*rt;if(!(Math.abs(vt)>nt))return[];wt=kt(F,vt)}return wt.length?G.map(ct=>{const vt=b(ct.units)??0,B=vt/rt;return{resource:ct.resource,units:vt,unitsTotal:rt,perDay:B>0?wt.map(Qt=>({day:Qt.day,hours:Qt.hours*B})):[]}}):[]}function Gt(w,J,O={}){const K=Array.isArray(O.buckets)?O.buckets:[],v={ok:!1,buckets:[],rows:[],totals:K.map(()=>null),totalsAvailable:K.map(()=>null),totalsCost:K.map(()=>null),grandTotal:0,grandAvailableTotal:null,grandCostTotal:null};if(!J||!J.ok)return v;const F=b(O.hoursPerDay)??_.hoursPerDay,R=typeof O.isWorking=="function"?O.isWorking:null,it=O.capacities instanceof Map?O.capacities:null,G=O.resourceModels instanceof Map?O.resourceModels:null,rt=O.resourceRates instanceof Map?O.resourceRates:null,wt=q(O.fields),ct=new Map,vt=(Mt,N,x,P)=>{ct.has(Mt)||ct.set(Mt,{days:new Map,costs:new Map,tasks:new Map});const Q=ct.get(Mt);if(Q.days.set(N,(Q.days.get(N)||0)+x),rt&&Mt!=null){const pt=at(rt.get(Mt),N);pt!=null&&Q.costs.set(N,(Q.costs.get(N)||0)+x*pt)}Q.tasks.has(P.id)||Q.tasks.set(P.id,{...P,days:new Map});const yt=Q.tasks.get(P.id);yt.days.set(N,(yt.days.get(N)||0)+x)},B=new Map;for(const Mt of Array.isArray(w)?w:[]){const N=Mt?wt(Mt):null;N!=null&&B.set(String(N),Mt)}const Qt=Array.isArray(w)&&J.order.length===w.length;for(let Mt=0;Mt<J.order.length;Mt+=1){const N=J.order[Mt],x=J.tasks.get(N);if(!x||x.isSummary||x.unscheduled)continue;const P=B.get(N)||(Qt?w[Mt]:null);if(!P||P.loadOnly===!0)continue;const Q=Rt(P,x,{hoursPerDay:F,isWorking:R});for(const yt of Q){if(!yt.perDay.length)continue;const pt={id:N,name:x.name,units:yt.units,unitsTotal:yt.unitsTotal,raw:P,loadOnly:!1,external:!1,group:null};for(const Ot of yt.perDay)vt(yt.resource,Ot.day,Ot.hours,pt)}}for(const Mt of Array.isArray(w)?w:[]){if(!Mt||Mt.loadOnly!==!0)continue;const N=i(Mt);if(!N)continue;const x=wt(Mt),P=x!=null?String(x):`loadOnly:${w.indexOf(Mt)}`,Q=Mt.name!=null?String(Mt.name):P,yt=Rt(Mt,N,{hoursPerDay:F,isWorking:R});for(const pt of yt){if(!pt.perDay.length)continue;const Ot={id:P,name:Q,units:pt.units,unitsTotal:pt.unitsTotal,raw:Mt,loadOnly:!0,external:!1,group:null};for(const xt of pt.perDay)vt(pt.resource,xt.day,xt.hours,Ot)}}for(const Mt of Array.isArray(O.external)?O.external:[]){if(!Mt||Mt.resource==null)continue;const N=b(Mt.start),x=b(Mt.end);if(N==null||x==null)continue;const P=lt({es:N,ef:x},R),Q=Mt.hours!=null?b(Mt.hours):P.length*F*(b(Mt.units)??1);if(Q==null||!(Math.abs(Q)>nt)||!P.length)continue;const pt={id:`external:${Mt.index??w.length}`,name:Mt.label,units:null,unitsTotal:null,raw:null,loadOnly:!0,external:!0,group:Mt.group??null};for(const Ot of kt(P,Q))vt(String(Mt.resource),Ot.day,Ot.hours,pt)}const p=Mt=>{let N=0,x=K.length-1;for(;N<=x;){const P=N+x>>1;if(Mt<K[P].start)x=P-1;else if(Mt>=K[P].end)N=P+1;else return P}return-1},A=K.map(Mt=>{let N=0;for(let x=Math.floor(Mt.start);x<Math.ceil(Mt.end);x+=1)(!R||R(x))&&(N+=1);return{start:Mt.start,end:Mt.end,workingDays:N}}),j=Mt=>{const N=A.map(()=>0);for(const[x,P]of Mt){const Q=p(x);Q>=0&&(N[Q]+=P)}return N},ot=[...ct.keys()].filter(Mt=>Mt!=null).sort(),st=ct.has(null)?[...ot,null]:ot,ht=[],E=A.map(()=>0),At=A.map(()=>null),ft=rt?A.map(()=>0):A.map(()=>null);let Ht=0,Lt=rt?0:null;for(const Mt of st){const N=ct.get(Mt),x=j(N.days),P=rt?j(N.costs):null,Q=Mt!=null&&it&&it.has(Mt)?it.get(Mt):null,yt=Mt!=null&&G?G.get(Mt):null,pt=x.map(Yt=>Math.abs(Yt)>nt?Yt:null),Ot=x.map((Yt,Nt)=>{if(yt&&yt.hasCalendar){let qt=0;for(let $t=Math.floor(A[Nt].start);$t<Math.ceil(A[Nt].end);$t+=1)(!R||R($t))&&(qt+=yt.capacityHoursOn($t));return qt}return Q==null?null:Q*F*A[Nt].workingDays}),xt=x.map((Yt,Nt)=>Ot[Nt]!=null&&Yt>Ot[Nt]+nt);let It=0,Ut=null,te=rt?0:null;x.forEach((Yt,Nt)=>{It+=Yt,E[Nt]+=Yt,Ot[Nt]!=null&&(Ut=(Ut??0)+Ot[Nt],At[Nt]=(At[Nt]??0)+Ot[Nt]),P&&(te+=P[Nt],ft[Nt]+=P[Nt])}),Ht+=It,rt&&(Lt+=te);const ne=[...N.tasks.values()].map(Yt=>{const Nt=j(Yt.days);return{id:Yt.id,name:Yt.name,units:Yt.units,unitsTotal:Yt.unitsTotal,raw:Yt.raw,cells:Nt.map(qt=>Math.abs(qt)>nt?qt:null),total:Nt.reduce((qt,$t)=>qt+$t,0),loadOnly:!!Yt.loadOnly,external:!!Yt.external,group:Yt.group??null}});ht.push({resource:Mt,capacity:Q,available:Ot,availableTotal:Ut,cells:pt,over:xt,total:It,costCells:P?P.map(Yt=>Math.abs(Yt)>nt?Yt:null):null,costTotal:te,tasks:ne})}let ee=null;for(const Mt of At)Mt!=null&&(ee=(ee??0)+Mt);return{ok:!0,buckets:A,rows:ht,totals:E.map(Mt=>Math.abs(Mt)>nt?Mt:null),totalsAvailable:At,totalsCost:ft,grandTotal:Ht,grandAvailableTotal:ee,grandCostTotal:Lt}}function X(w,J){if(w==null||!Number.isFinite(w))return"";const K=10**(Number.isFinite(J)?Math.max(0,Math.min(6,Math.round(J))):1),v=Math.round(w*K)/K;return Object.is(v,-0)||v===0?"0":String(v)}function et(w,J,O){if(J==null||!(J>nt))return"–";const K=Number.isFinite(w)?w:0;return X(K/J*100,O)}function mt(w,J=2){return X(w,J)}}),oe("packages/modules/gantt/cost.js",function(f,ut){"use strict";Object.defineProperty(f,"computeCost",{enumerable:!0,get:function(){return $}});const Pt=ut("packages/modules/gantt/resources.js"),tt=Pt.parseAssignments,at=Pt.normalizeResourceRates,dt=Pt.rateOn,q=ut("packages/modules/gantt/workload.js").taskAssignmentEffort,d=ut("packages/modules/gantt/schedule.js").taskIdReader;function h(k){if(k==null||k==="")return null;const _=typeof k=="number"?k:Number(k);return Number.isFinite(_)?_:null}function D(k,_,S,b){const y=h(k?k[b.costField]:null)??0;let g=0,s=!1;const e=tt(k),o=e.some(l=>{const L=S.get(l.resource);return!L||L.type==="work"})?q(k,_,{hoursPerDay:b.hoursPerDay,isWorking:b.isWorking}):null;for(let l=0;l<e.length;l+=1){const L=e[l],Y=S.get(L.resource);if(Y)if(Y.type==="cost")Y.cost!=null&&(g+=Y.cost,s=!0);else if(Y.type==="material"){const W=dt(Y,Math.round(_.es));W!=null&&(g+=(h(L.units)??0)*W,s=!0)}else{const W=o?o[l]:null;if(!W)continue;for(const z of W.perDay){const kt=dt(Y,z.day);kt!=null&&(g+=z.hours*kt,s=!0)}}}return{cost:y+g,rateCost:g,fixedCost:y,hasRate:s}}function $(k,_,S={}){if(!_||!_.ok||!_.tasks||!_.order)return{ok:!1,error:{code:"NO_SCHEDULE",message:"cost needs a successful schedule"}};const b=S.costField||"cost",y=h(S.hoursPerDay)??8,g=typeof S.isWorking=="function"?S.isWorking:null,s=S.resourceRates instanceof Map?S.resourceRates:at(S.resources),e=d(S.fields),i=new Map;for(const z of Array.isArray(k)?k:[]){const kt=e(z);kt!=null&&i.set(String(kt),z)}const o=()=>({cost:0,rateCost:0,fixedCost:0,hasRate:!1}),l=new Map;for(const z of _.order)l.set(z,o());const L=o();for(const z of _.order){const kt=_.tasks.get(z);if(!kt||kt.isSummary||kt.unscheduled)continue;const bt=D(i.get(z),kt,s,{hoursPerDay:y,isWorking:g,costField:b});let _t=z;for(;_t!=null&&l.has(_t);){const lt=l.get(_t);lt.cost+=bt.cost,lt.rateCost+=bt.rateCost,lt.fixedCost+=bt.fixedCost,bt.hasRate&&(lt.hasRate=!0),_t=_.tasks.get(_t).parent}L.cost+=bt.cost,L.rateCost+=bt.rateCost,L.fixedCost+=bt.fixedCost,bt.hasRate&&(L.hasRate=!0)}const Y=new Map,W=[];for(const z of _.order){const kt=_.tasks.get(z),bt=l.get(z),_t={id:kt.id,name:kt.name,isSummary:!!kt.isSummary,isMilestone:!!kt.isMilestone,cost:bt.cost,rateCost:bt.rateCost,fixedCost:bt.fixedCost,hasRate:bt.hasRate};Y.set(z,_t),W.push(_t)}return{ok:!0,byTask:Y,rows:W,project:{...L}}}}),oe("packages/modules/gantt/earned-value.js",function(f,ut){"use strict";Object.defineProperty(f,"computeEarnedValue",{enumerable:!0,get:function(){return D}});const tt=ut("packages/modules/gantt/time.js").toDayNumber,dt=ut("packages/modules/gantt/schedule.js").taskIdReader,nt=1e-9;function q($){if($==null||$==="")return null;const k=typeof $=="number"?$:Number($);return Number.isFinite(k)?k:null}function T($,k,_){return _-k<=nt?$>=_?1:0:$<=k?0:$>=_?1:($-k)/(_-k)}function d($,k,_,S,b,y){const g=k?q(k[S]):null,s=g??(y&&y.hasRate?y.cost:$.duration),e=k?q(k[b]):null,i=$.percentComplete==null?0:Math.max(0,Math.min(100,$.percentComplete))/100,o=$.baselineStart!=null||$.baselineEnd!=null,l=$.baselineStart!=null?$.baselineStart:$.es,L=$.baselineEnd!=null?$.baselineEnd:$.ef,Y=s*T(_,l,L),W=s*i;return{bac:s,pv:Y,ev:W,ac:e,hasBaseline:o}}function h($){const k=$.ac;return{bac:$.bac,pv:$.pv,ev:$.ev,ac:k,sv:$.ev-$.pv,cv:k==null?null:$.ev-k,spi:Math.abs($.pv)<nt?null:$.ev/$.pv,cpi:k==null||Math.abs(k)<nt?null:$.ev/k}}function D($,k,_={}){if(!k||!k.ok||!k.tasks||!k.order)return{ok:!1,error:{code:"NO_SCHEDULE",message:"earned value needs a successful schedule"}};const S=_.costField||"cost",b=_.actualCostField||"actualCost",y=_.statusDate==null?k.projectFinish:tt(_.statusDate)??k.projectFinish,g=_.rateCosts instanceof Map?_.rateCosts:null,s=dt(_.fields),e=new Map;for(const z of Array.isArray($)?$:[]){const kt=s(z);kt!=null&&e.set(String(kt),z)}const i=()=>({bac:0,pv:0,ev:0,ac:0,acAny:!1,hasBaseline:!1}),o=new Map;for(const z of k.order)o.set(z,i());const l=i();for(const z of k.order){const kt=k.tasks.get(z);if(!kt||kt.isSummary||kt.unscheduled)continue;const bt=d(kt,e.get(z),y,S,b,g?g.get(z):null);let _t=z;for(;_t!=null&&o.has(_t);){const lt=o.get(_t);lt.bac+=bt.bac,lt.pv+=bt.pv,lt.ev+=bt.ev,bt.ac!=null&&(lt.ac+=bt.ac,lt.acAny=!0),bt.hasBaseline&&(lt.hasBaseline=!0),_t=k.tasks.get(_t).parent}l.bac+=bt.bac,l.pv+=bt.pv,l.ev+=bt.ev,bt.ac!=null&&(l.ac+=bt.ac,l.acAny=!0),bt.hasBaseline&&(l.hasBaseline=!0)}const L=z=>h({bac:z.bac,pv:z.pv,ev:z.ev,ac:z.acAny?z.ac:null}),Y=new Map,W=[];for(const z of k.order){const kt=k.tasks.get(z),bt=o.get(z),_t={id:kt.id,name:kt.name,isSummary:!!kt.isSummary,isMilestone:!!kt.isMilestone,percentComplete:kt.percentComplete??null,hasBaseline:bt.hasBaseline,hasActualCost:bt.acAny,...L(bt)};Y.set(z,_t),W.push(_t)}return{ok:!0,statusDate:y,byTask:Y,rows:W,project:{hasActualCost:l.acAny,hasBaseline:l.hasBaseline,...L(l)}}}}),oe("packages/modules/gantt/mspdi.js",function(f,ut){"use strict";Object.defineProperty(f,"parseXml",{enumerable:!0,get:function(){return L}}),Object.defineProperty(f,"importMSPDI",{enumerable:!0,get:function(){return Gt}}),Object.defineProperty(f,"exportMSPDI",{enumerable:!0,get:function(){return w}});const tt=ut("packages/core/src/internal/util.js").warnOnce,at=ut("packages/modules/gantt/time.js"),dt=at.toDayNumber,nt=at.toISODate,q=ut("packages/modules/gantt/schedule.js"),T=q.taskIdReader,d=q.resolveConstraintCode,h=q.resolveSchedulingMode,D=Object.freeze({0:"FF",1:"FS",2:"SF",3:"SS"}),$=Object.freeze({FF:0,FS:1,SF:2,SS:3}),k=Object.freeze({0:"ASAP",1:"as-late-as-possible",2:"must-start-on",3:"must-finish-on",4:"SNET",5:"SNLT",6:"FNET",7:"FNLT"}),_=Object.freeze({ASAP:0,ALAP:1,MSO:2,MFO:3,SNET:4,SNLT:5,FNET:6,FNLT:7}),S=Object.freeze({0:"fixedUnits",1:"fixedDuration",2:"fixedEffort"}),b=Object.freeze({fixedUnits:0,fixedDuration:1,fixedEffort:2}),y=Object.freeze({0:"material",1:"work",2:"cost"}),g=Object.freeze({material:0,work:1,cost:2});function s(G){if(G==null)return null;const rt=/^(-?[0-9.]+)/.exec(String(G).trim());if(!rt)return null;const wt=Number(rt[1]);return Number.isFinite(wt)?wt:null}function e(G){if(G==null||G==="")return null;const rt=typeof G=="number"?G:Number(G);return Number.isFinite(rt)?rt:null}function i(G){return String(G).replace(/&(#x?[0-9a-fA-F]+|lt|gt|amp|quot|apos);/g,(rt,wt)=>{if(wt[0]==="#"){const ct=wt[1]==="x"||wt[1]==="X"?parseInt(wt.slice(2),16):parseInt(wt.slice(1),10);return Number.isFinite(ct)?String.fromCodePoint(ct):rt}return{lt:"<",gt:">",amp:"&",quot:'"',apos:"'"}[wt]??rt})}function o(G){return String(G??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function l(G){const rt=G.indexOf(":");return rt<0?G:G.slice(rt+1)}function L(G){const rt=String(G);let wt=0;const ct=[];let vt=null;for(;wt<rt.length;){const B=rt.indexOf("<",wt);if(B<0)break;if(B>wt&&ct.length){const E=rt.slice(wt,B);E.trim()&&(ct[ct.length-1].text+=i(E))}if(rt.startsWith("<?",B)){const E=rt.indexOf("?>",B);wt=E<0?rt.length:E+2;continue}if(rt.startsWith("<!--",B)){const E=rt.indexOf("-->",B);wt=E<0?rt.length:E+3;continue}if(rt.startsWith("<![CDATA[",B)){const E=rt.indexOf("]]>",B);ct.length&&(ct[ct.length-1].text+=rt.slice(B+9,E<0?rt.length:E)),wt=E<0?rt.length:E+3;continue}if(rt.startsWith("<!",B)){const E=rt.indexOf(">",B);wt=E<0?rt.length:E+1;continue}const Qt=rt.indexOf(">",B);if(Qt<0)break;let p=rt.slice(B+1,Qt).trim();if(p[0]==="/"){ct.pop(),wt=Qt+1;continue}const A=p.endsWith("/");A&&(p=p.slice(0,-1).trim());const j=p.search(/\s/),ot=l(j<0?p:p.slice(0,j)),st={};if(j>=0)for(const E of p.slice(j).matchAll(/([\w:.-]+)\s*=\s*"([^"]*)"|([\w:.-]+)\s*=\s*'([^']*)'/g))st[l(E[1]??E[3])]=i(E[2]??E[4]??"");const ht={name:ot,attrs:st,children:[],text:""};ct.length?ct[ct.length-1].children.push(ht):vt||(vt=ht),A||ct.push(ht),wt=Qt+1}return vt}function Y(G,rt){return G?G.children.find(wt=>wt.name===rt):void 0}function W(G,rt){return G?G.children.filter(wt=>wt.name===rt):[]}function z(G,rt){const wt=Y(G,rt);return wt?wt.text.trim():void 0}function kt(G){if(!G)return null;const rt=String(G).match(/^\d{4}-\d{2}-\d{2}/);return dt(rt?rt[0]:G)}function bt(G,rt){return`${nt(G)}T${String(rt).padStart(2,"0")}:00:00`}function _t(G,rt){if(!G)return null;const wt=String(G).match(/PT?(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?/);return wt?((Number(wt[1])||0)+(Number(wt[2])||0)/60+(Number(wt[3])||0)/3600)/rt:null}function lt(G,rt){return`PT${Math.round((G||0)*rt*1e3)/1e3}H0M0S`}function Et(G,rt){return(Number(G)||0)/(600*rt)}function Rt(G,rt){return Math.round((G||0)*10*60*rt)}function Gt(G,rt={}){const wt=rt.hoursPerDay??8,ct=L(G);if(!ct||ct.name!=="Project")return tt("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 vt=kt(z(ct,"StartDate")),B=Y(ct,"Resources"),Qt=Y(ct,"Calendars"),p=W(Qt,"Calendar"),A=new Map,j=[];for(const N of W(B,"Resource")){const x=z(N,"UID"),P=z(N,"Name");if(x==null||P==null||P==="")continue;A.set(x,P);const Q=z(N,"MaxUnits"),yt=z(N,"CalendarUID"),pt=yt!=null?mt(p,yt,wt):null,Ot={id:P,name:P,capacity:Q==null?1:Number(Q)};pt&&(Ot.calendar=pt.calendar,Q==null||Math.abs(Number(Q)-1)<1e-9?delete Ot.capacity:Ot.capacity=Number(Q)*pt.fullDayHours);const xt=y[Number(z(N,"Type"))];xt&&xt!=="work"&&(Ot.type=xt);const It=s(z(N,"StandardRate"));It!=null&&(Ot.rate=It);const Ut=z(N,"Cost"),te=Ut==null?null:Number(Ut);te!=null&&Number.isFinite(te)&&(Ot.cost=te),j.push(Ot)}const ot=Y(ct,"Assignments"),st=new Map;for(const N of W(ot,"Assignment")){const x=z(N,"TaskUID"),P=z(N,"ResourceUID"),Q=A.get(P);if(x==null||Q==null)continue;const yt=z(N,"Units");st.has(x)||st.set(x,[]),st.get(x).push({resource:Q,units:yt==null?1:Number(yt)})}const ht=Y(ct,"Tasks"),E=[],At=[],ft=new Map,Ht=[],Lt=[];for(const N of W(ht,"Task")){if(z(N,"IsNull")==="1")continue;const x=z(N,"UID");if(x==null||x==="0")continue;const P=x;ft.set(x,P);const Q=Number(z(N,"OutlineLevel"))||1;for(;Ht.length&&Ht[Ht.length-1].level>=Q;)Ht.pop();const yt=Ht.length?Ht[Ht.length-1].uid:null;Ht.push({uid:x,level:Q});const pt=z(N,"Summary")==="1",Ot=z(N,"Milestone")==="1",xt={id:P,name:z(N,"Name")??P};if(yt&&(xt.parent=yt),Ot&&(xt.milestone=!0),!pt&&!Ot){const qt=_t(z(N,"Duration"),wt);qt!=null&&(xt.duration=qt)}const It=kt(z(N,"Start"));!pt&&It!=null&&(xt.start=It);const Ut=z(N,"PercentComplete");if(Ut!=null&&(xt.percentComplete=Number(Ut)),!pt){const qt=z(N,"Type");qt!=null&&S[Number(qt)]&&(xt.schedulingMode=S[Number(qt)]);const $t=z(N,"EffortDriven");$t!=null&&(xt.effortDriven=$t==="1");const Jt=_t(z(N,"Work"),wt);Jt!=null&&(xt.effort=Jt*wt)}const te=k[Number(z(N,"ConstraintType"))];if(te){xt.constraint=te;const qt=kt(z(N,"ConstraintDate"));qt!=null&&(xt.constraintDate=qt)}const ne=kt(z(N,"Deadline"));ne!=null&&(xt.deadline=ne);const Yt=Y(N,"Baseline");if(Yt){const qt=kt(z(Yt,"Start")),$t=kt(z(Yt,"Finish"));qt!=null&&(xt.baselineStart=qt),$t!=null&&(xt.baselineEnd=$t)}const Nt=st.get(x);Nt&&Nt.length&&(xt.assignments=Nt),E.push(xt);for(const qt of W(N,"PredecessorLink"))Lt.push({raw:qt,uid:x})}for(const{raw:N,uid:x}of Lt){const P=z(N,"PredecessorUID"),Q=ft.get(P),yt=ft.get(x);if(Q==null||yt==null)continue;const pt=D[Number(z(N,"Type")??1)]??"FS",Ot=Et(z(N,"LinkLag"),wt),xt={from:Q,to:yt,type:pt};Ot&&(xt.lag=Ot),At.push(xt)}const ee=X(ct),Mt={ok:!0,tasks:E,dependencies:At,resources:j};return vt!=null&&(Mt.projectStart=vt),ee&&(Mt.calendar=ee),Mt}function X(G){const rt=Y(G,"Calendars"),wt=W(rt,"Calendar"),ct=z(G,"CalendarUID"),vt=(ct!=null?wt.find(ot=>z(ot,"UID")===ct):null)??wt.find(ot=>z(ot,"IsBaseCalendar")!=="0");if(!vt)return null;const B=Y(vt,"WeekDays"),Qt=[];let p=!1;for(const ot of W(B,"WeekDay")){const st=Number(z(ot,"DayType"));st>=1&&st<=7&&(p=!0,z(ot,"DayWorking")==="1"&&Qt.push(st-1))}const A=[],j=Y(vt,"Exceptions");for(const ot of W(j,"Exception")){if(z(ot,"DayWorking")==="1")continue;const st=Y(ot,"TimePeriod"),ht=kt(z(st,"FromDate")),E=kt(z(st,"ToDate"))??ht;if(ht!=null)for(let At=ht;At<=E;At+=1)A.push(At)}return!p&&!A.length?null:{workdays:p?Qt:[1,2,3,4,5],holidays:A}}function et(G){if(G==null)return null;const rt=/^(\d{1,2}):(\d{2})(?::(\d{2}))?$/.exec(String(G).trim());return rt?Number(rt[1])+Number(rt[2])/60+Number(rt[3]??0)/3600:null}function mt(G,rt,wt){const ct=G.find(st=>z(st,"UID")===rt);if(!ct)return null;const vt=[],B={};for(const st of W(Y(ct,"WeekDays"),"WeekDay")){const ht=Number(z(st,"DayType"));if(!(ht>=1&&ht<=7)||z(st,"DayWorking")!=="1")continue;const E=ht-1;vt.push(E);let At=0;for(const ft of W(Y(st,"WorkingTimes"),"WorkingTime")){const Ht=et(z(ft,"FromTime")),Lt=et(z(ft,"ToTime"));Ht!=null&&Lt!=null&&Lt>Ht&&(At+=Lt-Ht)}B[E]=At>0?At:wt}const Qt=[];for(const st of W(Y(ct,"Exceptions"),"Exception")){if(z(st,"DayWorking")==="1")continue;const ht=Y(st,"TimePeriod"),E=kt(z(ht,"FromDate")),At=kt(z(ht,"ToDate"))??E;if(E!=null)for(let ft=E;ft<=At;ft+=1)Qt.push(ft)}if(!vt.length&&!Qt.length)return null;const p=vt.map(st=>B[st]),A=p.length&&p.every(st=>Math.abs(st-p[0])<1e-9),j={workingDays:vt.slice().sort((st,ht)=>st-ht),hoursPerDay:A?p[0]:B};Qt.length&&(j.holidays=Qt);const ot=p.reduce((st,ht)=>Math.max(st,ht),0)||wt;return{calendar:j,fullDayHours:ot}}function w(G,rt={}){const wt=rt.hoursPerDay??8,ct=Array.isArray(G.tasks)?G.tasks:[],vt=Array.isArray(G.dependencies)?G.dependencies:[],B=Array.isArray(G.resources)?G.resources:G.resources&&typeof G.resources=="object"?Object.entries(G.resources).map(([x,P])=>({id:x,name:x,capacity:P})):[],Qt=G.schedule&&G.schedule.ok?G.schedule:null,p=T(G.fields),A=new Map;ct.forEach((x,P)=>{const Q=String(p(x));A.set(Q,/^\d+$/.test(Q)?Q:String(P+1))});const j=new Map;for(const x of ct){const P=x.parent!=null?String(x.parent):null;P&&(j.has(P)||j.set(P,[]),j.get(P).push(String(p(x))))}const ot=x=>j.has(x),st=x=>{let P=1,Q=ct.find(yt=>String(p(yt))===x);for(;Q&&Q.parent!=null;)P+=1,Q=ct.find(yt=>String(p(yt))===String(Q.parent));return P},ht=new Map;for(const x of vt){const P=String(x.to);ht.has(P)||ht.set(P,[]),ht.get(P).push(x)}const E=[];E.push('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'),E.push('<Project xmlns="http://schemas.microsoft.com/project">'),E.push(` <Name>${o(rt.projectName||"Lattice Gantt export")}</Name>`);const At=G.projectStart!=null?dt(G.projectStart):Qt?Qt.projectStart:null;At!=null&&E.push(` <StartDate>${bt(At,8)}</StartDate>`);const ft=O(G.calendar);ft&&E.push(" <CalendarUID>1</CalendarUID>");const Ht=wt;let Lt=ft?2:1;const ee=new Map;for(const x of B){const P=x&&(x.name??x.id??x.resource);P==null||P===""||!x.calendar||typeof x.calendar!="object"||(ee.set(String(P),{uid:Lt,spec:K(x.calendar,Ht)}),Lt+=1)}if(ft||ee.size){if(E.push(" <Calendars>"),ft){E.push(" <Calendar>"),E.push(" <UID>1</UID>"),E.push(" <Name>Standard</Name>"),E.push(" <IsBaseCalendar>1</IsBaseCalendar>"),E.push(" <WeekDays>");for(let x=0;x<=6;x+=1){const P=ft.workdays.includes(x);E.push(" <WeekDay>"),E.push(` <DayType>${x+1}</DayType>`),E.push(` <DayWorking>${P?1:0}</DayWorking>`),E.push(" </WeekDay>")}if(E.push(" </WeekDays>"),ft.holidays.length){E.push(" <Exceptions>");for(const x of ft.holidays)E.push(" <Exception>"),E.push(" <DayWorking>0</DayWorking>"),E.push(` <TimePeriod><FromDate>${bt(x,0)}</FromDate><ToDate>${bt(x,23)}</ToDate></TimePeriod>`),E.push(" </Exception>");E.push(" </Exceptions>")}E.push(" </Calendar>")}for(const[x,P]of ee)for(const Q of F(P.uid,x,P.spec))E.push(Q);E.push(" </Calendars>")}E.push(" <Tasks>");for(const x of ct){const P=String(p(x)),Q=A.get(P),yt=ot(P),pt=!!x.milestone||!yt&&Number(x.duration)===0,Ot=Qt?Qt.tasks.get(P):null;E.push(" <Task>"),E.push(` <UID>${o(Q)}</UID>`),E.push(` <ID>${o(Q)}</ID>`),E.push(` <Name>${o(x.name!=null?x.name:P)}</Name>`),E.push(` <OutlineLevel>${st(P)}</OutlineLevel>`),E.push(` <Summary>${yt?1:0}</Summary>`),E.push(` <Milestone>${pt?1:0}</Milestone>`);const xt=Ot?Ot.duration:x.duration!=null?Number(x.duration):null;xt!=null&&E.push(` <Duration>${lt(xt,wt)}</Duration>`),E.push(" <DurationFormat>7</DurationFormat>");const It=Ot?Ot.es:x.start!=null?dt(x.start):null,Ut=Ot?Ot.ef:x.end!=null?dt(x.end):It!=null&&xt!=null?It+xt:null;It!=null&&E.push(` <Start>${bt(It,8)}</Start>`),Ut!=null&&E.push(` <Finish>${bt(Ut,17)}</Finish>`);const te=Ot?Ot.percentComplete:x.percentComplete;if(te!=null&&E.push(` <PercentComplete>${Math.round(Number(te))}</PercentComplete>`),!yt&&!pt){const $t=Ot&&Ot.schedulingMode||h(x.schedulingMode??x.taskType),Jt=Ot&&Ot.effortDriven!=null?Ot.effortDriven:x.effortDriven!=null?!!x.effortDriven:null,he=Ot&&Ot.effort!=null?Ot.effort:Number.isFinite(Number(x.effort))?Number(x.effort):typeof x.work=="number"?x.work:Number.isFinite(Number(x.hours))?Number(x.hours):null;($t!=null||Jt!=null||he!=null)&&($t!=null&&E.push(` <Type>${b[$t]}</Type>`),E.push(` <EffortDriven>${Jt?1:0}</EffortDriven>`),he!=null&&E.push(` <Work>${lt(he/wt,wt)}</Work>`))}const ne=R(x.constraint??x.constraintType);if(ne!=null){E.push(` <ConstraintType>${ne}</ConstraintType>`);const $t=it(x.constraintDate??x.constraintAt??x.at??(x.constraint&&typeof x.constraint=="object"?x.constraint.date:null));$t!=null&&E.push(` <ConstraintDate>${bt($t,8)}</ConstraintDate>`)}const Yt=it(x.deadline);Yt!=null&&E.push(` <Deadline>${bt(Yt,17)}</Deadline>`);const Nt=it(x.baselineStart??(x.baseline&&x.baseline.start)),qt=it(x.baselineEnd??(x.baseline&&x.baseline.end));(Nt!=null||qt!=null)&&(E.push(" <Baseline>"),E.push(" <Number>0</Number>"),Nt!=null&&E.push(` <Start>${bt(Nt,8)}</Start>`),qt!=null&&E.push(` <Finish>${bt(qt,17)}</Finish>`),Nt!=null&&qt!=null&&E.push(` <Duration>${lt(qt-Nt,wt)}</Duration>`),E.push(" </Baseline>"));for(const $t of ht.get(P)||[]){const Jt=A.get(String($t.from));Jt!=null&&(E.push(" <PredecessorLink>"),E.push(` <PredecessorUID>${o(Jt)}</PredecessorUID>`),E.push(` <Type>${$[$t.type?String($t.type).toUpperCase():"FS"]??1}</Type>`),$t.lag&&(E.push(` <LinkLag>${Rt(Number($t.lag),wt)}</LinkLag>`),E.push(" <LagFormat>7</LagFormat>")),E.push(" </PredecessorLink>"))}E.push(" </Task>")}E.push(" </Tasks>");const Mt=new Map;B.forEach((x,P)=>{const Q=String(x.name??x.id??`Resource ${P+1}`),yt=ee.get(Q),pt=x.capacity??x.maxUnits??1,Ot=yt?x.capacity!=null?Number(x.capacity)/yt.spec.fullDayHours:1:Number(pt),xt=e(x.rate),It=e(x.cost),Ut=x.type==="material"||x.type==="cost"?x.type:null;Mt.set(Q,{uid:String(P+1),maxUnits:Ot,calUid:yt?yt.uid:null,rate:xt,cost:It,type:Ut})});const N=[];for(const x of ct)for(const P of J(x))Mt.has(P.resource)||Mt.set(P.resource,{uid:String(Mt.size+1),maxUnits:1,calUid:null}),N.push({taskUid:A.get(String(p(x))),resUid:Mt.get(P.resource).uid,units:P.units});E.push(" <Resources>");for(const[x,P]of Mt)E.push(" <Resource>"),E.push(` <UID>${o(P.uid)}</UID>`),E.push(` <ID>${o(P.uid)}</ID>`),E.push(` <Name>${o(x)}</Name>`),E.push(` <MaxUnits>${Number(P.maxUnits)}</MaxUnits>`),P.calUid!=null&&E.push(` <CalendarUID>${P.calUid}</CalendarUID>`),P.type!=null&&E.push(` <Type>${g[P.type]}</Type>`),P.rate!=null&&E.push(` <StandardRate>${P.rate}/h</StandardRate>`),P.cost!=null&&E.push(` <Cost>${P.cost}</Cost>`),E.push(" </Resource>");return E.push(" </Resources>"),E.push(" <Assignments>"),N.forEach((x,P)=>{E.push(" <Assignment>"),E.push(` <UID>${P+1}</UID>`),E.push(` <TaskUID>${o(x.taskUid)}</TaskUID>`),E.push(` <ResourceUID>${o(x.resUid)}</ResourceUID>`),E.push(` <Units>${Number(x.units)}</Units>`),E.push(" </Assignment>")}),E.push(" </Assignments>"),E.push("</Project>"),E.join(`
7
7
  `)}function J(G){if(G&&Array.isArray(G.assignments))return G.assignments.map(ct=>{const vt=ct&&(ct.resource??ct.name??ct.id);if(vt==null||vt==="")return null;const B=Number(ct.units??ct.allocation??1);return{resource:String(vt),units:Number.isFinite(B)?B:1}}).filter(Boolean);const rt=G?G.assignee??G.assignees??G.owner:null;return(Array.isArray(rt)?rt:rt==null||rt===""?[]:[rt]).map(ct=>String(ct)).filter(ct=>ct!=="").map(ct=>({resource:ct,units:1}))}function O(G){if(G==null)return null;if(G==="weekends")return{workdays:[1,2,3,4,5],holidays:[]};const rt=Array.isArray(G.workdays)&&G.workdays.length?G.workdays.map(Number).filter(ct=>ct>=0&&ct<=6):[1,2,3,4,5],wt=(Array.isArray(G.holidays)?G.holidays:[]).map(ct=>dt(ct)).filter(ct=>ct!=null);return{workdays:rt,holidays:wt}}function K(G,rt){const wt=Array.isArray(G.workingDays)&&G.workingDays.length?[...new Set(G.workingDays.map(Number).filter(p=>p>=0&&p<=6))].sort((p,A)=>p-A):[1,2,3,4,5],ct=G.hoursPerDay,vt={};for(const p of wt){const A=ct!=null&&typeof ct=="object"?Number(ct[p]):Number(ct);vt[p]=Number.isFinite(A)&&A>0?A:rt}const B=[];for(const p of Array.isArray(G.holidays)?G.holidays:[]){if(p&&typeof p=="object"&&!(p instanceof Date)&&("from"in p||"to"in p)){const j=dt(p.from),ot=dt(p.to??p.from);if(j==null)continue;const st=ot??j;for(let ht=Math.min(j,st);ht<=Math.max(j,st);ht+=1)B.push(ht);continue}const A=dt(p);A!=null&&B.push(A)}const Qt=wt.reduce((p,A)=>Math.max(p,vt[A]),0)||rt;return{workingDays:wt,holidays:B,hoursByWeekday:vt,fullDayHours:Qt}}function v(G){const rt=Math.round(G*60),wt=Math.floor(rt/60),ct=rt%60;return`${String(wt).padStart(2,"0")}:${String(ct).padStart(2,"0")}:00`}function F(G,rt,wt){const ct=[],vt=new Set(wt.workingDays);ct.push(" <Calendar>"),ct.push(` <UID>${G}</UID>`),ct.push(` <Name>${o(rt)}</Name>`),ct.push(" <IsBaseCalendar>0</IsBaseCalendar>"),ct.push(" <WeekDays>");for(let B=0;B<=6;B+=1){const Qt=vt.has(B);if(ct.push(" <WeekDay>"),ct.push(` <DayType>${B+1}</DayType>`),ct.push(` <DayWorking>${Qt?1:0}</DayWorking>`),Qt){const p=wt.hoursByWeekday[B];ct.push(" <WorkingTimes>"),ct.push(" <WorkingTime>"),ct.push(` <FromTime>${v(8)}</FromTime>`),ct.push(` <ToTime>${v(8+p)}</ToTime>`),ct.push(" </WorkingTime>"),ct.push(" </WorkingTimes>")}ct.push(" </WeekDay>")}if(ct.push(" </WeekDays>"),wt.holidays.length){ct.push(" <Exceptions>");for(const B of wt.holidays)ct.push(" <Exception>"),ct.push(" <DayWorking>0</DayWorking>"),ct.push(` <TimePeriod><FromDate>${bt(B,0)}</FromDate><ToDate>${bt(B,23)}</ToDate></TimePeriod>`),ct.push(" </Exception>");ct.push(" </Exceptions>")}return ct.push(" </Calendar>"),ct}function R(G){if(G==null||G==="")return null;const rt=d(G);return rt?_[rt]:null}function it(G){return G==null||G===""?null:dt(G)}}),oe("packages/modules/shared/autosize.js",function(f,ut){"use strict";Object.defineProperty(f,"contentWidth",{enumerable:!0,get:function(){return at}}),Object.defineProperty(f,"contentHeight",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(f,"firstMeasured",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(f,"watchSize",{enumerable:!0,get:function(){return q}}),Object.defineProperty(f,"watchBox",{enumerable:!0,get:function(){return T}});const tt=ut("packages/core/src/internal/util.js").warnOnce;function at(d){if(!d||typeof d!="object")return null;const h=Number(d.clientWidth);if(Number.isFinite(h)&&h>0)return h;if(typeof d.getBoundingClientRect=="function"){const D=d.getBoundingClientRect(),$=D&&Number(D.width);if(Number.isFinite($)&&$>0)return $}return null}function dt(d){if(!d||typeof d!="object")return null;const h=Number(d.clientHeight);if(Number.isFinite(h)&&h>0)return h;if(typeof d.getBoundingClientRect=="function"){const D=d.getBoundingClientRect(),$=D&&Number(D.height);if(Number.isFinite($)&&$>0)return $}return null}function nt(d,h=at){for(const D of d||[]){const $=h(D);if(Number.isFinite($)&&$>0)return $}return null}function q(d){const h=(d&&Array.isArray(d.targets)?d.targets:[]).filter(Boolean),D=d&&typeof d.read=="function"?d.read:()=>null,$=d&&typeof d.apply=="function"?d.apply:()=>{},k=Number.isFinite(d&&d.epsilon)?Number(d.epsilon):1;let _=null,S=!1;const b=()=>{if(S)return!1;const i=D();if(!Number.isFinite(i)||i<=0||_!=null&&Math.abs(i-_)<k)return!1;_=i,S=!0;try{$(i)}finally{S=!1}return!0};b();const y=h[0],g=d&&d.view||y&&y.ownerDocument&&y.ownerDocument.defaultView||globalThis,s=g&&g.ResizeObserver;let e=null;if(typeof s=="function"&&h.length){e=new s(()=>{b()});for(const i of h)i&&typeof e.observe=="function"&&e.observe(i)}else h.length&&tt("shared.autosize.no-resize-observer","ResizeObserver is unavailable; this view was sized once at mount and will not follow its container.");return{refresh:b,get applied(){return _},release(){if(e&&typeof e.disconnect=="function")try{e.disconnect()}catch{}e=null}}}function T(d){const h=(d&&Array.isArray(d.targets)?d.targets:[]).filter(Boolean),D=d&&typeof d.read=="function"?d.read:()=>({}),$=d&&typeof d.apply=="function"?d.apply:()=>{},k=Number.isFinite(d&&d.epsilon)?Number(d.epsilon):1;let _=null,S=!1;const b=o=>{if(_==null)return!0;for(const[l,L]of Object.entries(o)){if(!Number.isFinite(L)||L<=0)continue;const Y=_[l];if(!Number.isFinite(Y)||Math.abs(L-Y)>=k)return!0}return!1},y=()=>{if(S)return!1;const o=D();if(!o||typeof o!="object"||!Object.values(o).some(L=>Number.isFinite(L)&&L>0)||!b(o))return!1;_={..._,...o},S=!0;try{$(o)}finally{S=!1}return!0};y();const g=h[0],s=d&&d.view||g&&g.ownerDocument&&g.ownerDocument.defaultView||globalThis,e=s&&s.ResizeObserver;let i=null;if(typeof e=="function"&&h.length){i=new e(()=>{y()});for(const o of h)o&&typeof i.observe=="function"&&i.observe(o)}else h.length&&tt("shared.autosize.no-resize-observer","ResizeObserver is unavailable; this view was sized once at mount and will not follow its container.");return{refresh:y,get applied(){return _},release(){if(i&&typeof i.disconnect=="function")try{i.disconnect()}catch{}i=null}}}}),oe("packages/modules/shared/axislabels.js",function(f,ut){"use strict";Object.defineProperty(f,"CHAR_RATIO",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(f,"BOLD_FACTOR",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(f,"MIN_GAP",{enumerable:!0,get:function(){return at}}),Object.defineProperty(f,"estimateLabelWidth",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(f,"thinLabels",{enumerable:!0,get:function(){return nt}});const Pt=.62,tt=1.05,at=6;function dt(q,T,d=!1){return String(q??"").length*T*Pt*(d?tt:1)}function nt(q,T){const d=Number.isFinite(T.gap)?Number(T.gap):at,h=Number.isFinite(T.fontSize)?Number(T.fontSize):11,D=typeof T.measure=="function"?T.measure:b=>dt(b,h,!!T.bold),$=q.filter(b=>b&&Number.isFinite(b.at)).map(b=>({...b,width:D(String(b.text??""))})).sort((b,y)=>b.at-y.at);if($.length<2)return{every:1,kept:$};const k=b=>{let y=null;for(let g=0;g<$.length;g+=b){const s=$[g];if(y&&s.at-y.at<y.width+d)return!1;y=s}return!0};let _=1;for(;_<$.length&&!k(_);)_++;const S=[];for(let b=0;b<$.length;b+=_)S.push($[b]);return{every:_,kept:S}}}),oe("packages/modules/charts/svg.js",function(f,ut){"use strict";Object.defineProperty(f,"SVG_NS",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(f,"el",{enumerable:!0,get:function(){return at}}),Object.defineProperty(f,"svg",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(f,"attr",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(f,"attrs",{enumerable:!0,get:function(){return q}}),Object.defineProperty(f,"setText",{enumerable:!0,get:function(){return T}}),Object.defineProperty(f,"clear",{enumerable:!0,get:function(){return d}}),Object.defineProperty(f,"append",{enumerable:!0,get:function(){return h}}),Object.defineProperty(f,"path",{enumerable:!0,get:function(){return D}}),Object.defineProperty(f,"ribbonPath",{enumerable:!0,get:function(){return $}}),Object.defineProperty(f,"round",{enumerable:!0,get:function(){return k}}),Object.defineProperty(f,"pathRings",{enumerable:!0,get:function(){return _}}),Object.defineProperty(f,"insideRings",{enumerable:!0,get:function(){return S}});const Pt="http://www.w3.org/2000/svg";function tt(b){const y=b.indexOf(")");return y<0?b:b.slice(y+1).trim()||"#0072b2"}function at(b,y,g){const s=b.createElement(y);return g&&s.setAttribute("class",g),s}function dt(b,y,g){const s=b.createElementNS(Pt,y);if(g)for(const e of Object.keys(g))s.setAttribute(e,String(g[e]));return s}function nt(b,y,g){if(!b)return;if(g==null){b.removeAttribute(y);return}let s=String(g);s.startsWith("url(#")&&(y==="stroke"||y==="fill"&&b.localName==="text")&&(s=tt(s)),b.setAttribute(y,s)}function q(b,y){if(b)for(const g of Object.keys(y))nt(b,g,y[g])}function T(b,y){b&&(b.textContent=y==null?"":String(y))}function d(b){if(b)for(;b.firstChild;)b.removeChild(b.firstChild)}function h(b,y){for(const g of y)g&&b.appendChild(g);return b}function D(b){return b.join(" ")}function $(b){if(!b||b.length<2)return"";const y=["M",b[0].x,b[0].upper];for(let g=1;g<b.length;g++)y.push("L",b[g].x,b[g].upper);for(let g=b.length-1;g>=0;g--)y.push("L",b[g].x,b[g].lower);return y.push("Z"),D(y)}function k(b){return Math.round(b*100)/100}function _(b){const y=[];let g=[];const s=String(b||"").match(/[A-Za-z]|-?\d*\.?\d+(?:e[-+]?\d+)?/gi)||[];let e="",i=[];const o=()=>{if(!e||!i.length){i=[];return}if(e==="M"||e==="L")for(let l=0;l+1<i.length;l+=2)g.push([i[l],i[l+1]]);else e!=="Z"&&i.length>=2&&g.push([i[i.length-2],i[i.length-1]]);i=[]};for(const l of s){if(/[A-Za-z]/.test(l)){if(o(),l==="Z"||l==="z"){g.length>2&&y.push(g),g=[],e="";continue}l==="M"&&g.length>2&&(y.push(g),g=[]),e=l;continue}i.push(Number(l))}return o(),g.length>2&&y.push(g),y}function S(b,y,g){let s=!1;for(const e of b)for(let i=0,o=e.length-1;i<e.length;o=i++){const[l,L]=e[i],[Y,W]=e[o];L>g!=W>g&&y<(Y-l)*(g-L)/(W-L||1e-12)+l&&(s=!s)}return s}}),oe("packages/modules/charts/scale.js",function(f,ut){"use strict";Object.defineProperty(f,"isNumber",{enumerable:!0,get:function(){return d}}),Object.defineProperty(f,"toNumber",{enumerable:!0,get:function(){return h}}),Object.defineProperty(f,"toTime",{enumerable:!0,get:function(){return D}}),Object.defineProperty(f,"extent",{enumerable:!0,get:function(){return $}}),Object.defineProperty(f,"niceStep",{enumerable:!0,get:function(){return k}}),Object.defineProperty(f,"niceDomain",{enumerable:!0,get:function(){return _}}),Object.defineProperty(f,"measureDomain",{enumerable:!0,get:function(){return S}}),Object.defineProperty(f,"linearTicks",{enumerable:!0,get:function(){return b}}),Object.defineProperty(f,"timeStepFor",{enumerable:!0,get:function(){return y}}),Object.defineProperty(f,"MONTH_STEPS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(f,"timeTicks",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(f,"linearScale",{enumerable:!0,get:function(){return W}}),Object.defineProperty(f,"timeScale",{enumerable:!0,get:function(){return z}}),Object.defineProperty(f,"key",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(f,"bandScale",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(f,"sqrtScale",{enumerable:!0,get:function(){return _t}});const Pt=[1,2,2.5,5,10],tt=6e4,at=36e5,dt=864e5,nt=365.25*dt,q=[1,2,5,10,20,25,50,100],T=[1,5,10,25,50,100,250,500,1e3,5e3,15e3,3e4,tt,5*tt,15*tt,30*tt,at,3*at,6*at,12*at,dt,2*dt,7*dt,14*dt,30*dt,90*dt,180*dt,...q.map(lt=>lt*nt)];function d(lt){return typeof lt=="number"&&Number.isFinite(lt)}function h(lt){if(lt==null||lt==="")return null;if(lt instanceof Date){const Rt=lt.getTime();return Number.isFinite(Rt)?Rt:null}if(typeof lt=="boolean")return lt?1:0;const Et=Number(lt);return Number.isFinite(Et)?Et:null}function D(lt){if(lt==null||lt==="")return null;if(lt instanceof Date){const Rt=lt.getTime();return Number.isFinite(Rt)?Rt:null}if(typeof lt=="number")return Number.isFinite(lt)?lt:null;const Et=Date.parse(String(lt));return Number.isFinite(Et)?Et:null}function $(lt){let Et=1/0,Rt=-1/0;for(let Gt=0;Gt<lt.length;Gt++){const X=lt[Gt];d(X)&&(X<Et&&(Et=X),X>Rt&&(Rt=X))}return Et===1/0?null:{min:Et,max:Rt}}function k(lt){if(!(lt>0))return 1;const Et=10**Math.floor(Math.log10(lt));for(const Rt of Pt)if(lt<=Rt*Et)return Rt*Et;return 10*Et}function _(lt,Et=5){const Rt=k((lt.max-lt.min)/Math.max(1,Et));return{min:Math.floor(lt.min/Rt)*Rt,max:Math.ceil(lt.max/Rt)*Rt,step:Rt}}function S(lt,Et={}){const Rt=$(lt)||{min:0,max:1};let{min:Gt,max:X}=Rt;if(Et.zero&&(Gt>0&&(Gt=0),X<0&&(X=0)),Gt===X){const et=Math.abs(Gt)>0?Math.abs(Gt)/10:1;Gt-=et,X+=et}if(Et.nice!==!1){const et=_({min:Gt,max:X},Et.ticks||5);Gt=et.min,X=et.max}return d(Et.min)&&(Gt=Et.min),d(Et.max)&&(X=Et.max),Gt===X&&(X=Gt+1),{min:Gt,max:X}}function b(lt,Et=5){const Rt=k((lt.max-lt.min)/Math.max(1,Et)),Gt=Math.ceil(lt.min/Rt),X=Math.floor(lt.max/Rt),et=[];for(let mt=Gt;mt<=X;mt++){const w=mt*Rt;et.push(Math.abs(w)<Rt/1e6?0:Number(w.toPrecision(12)))}return et}function y(lt,Et=5){const Rt=Math.max(1,Et),Gt=lt/Rt;let X=T[T.length-1];for(const w of T)if(w>=Gt){X=w;break}if(X<nt)return X;let et=X,mt=Math.abs(lt/X-Rt);for(const w of T){if(w<nt)continue;const J=Math.abs(lt/w-Rt);J<mt&&(mt=J,et=w)}return et}const g=new Map;function s(lt){let Et=g.get(lt);return Et||(Et=new Intl.DateTimeFormat("en-US",{timeZone:lt,year:"numeric",month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),g.set(lt,Et)),Et}function e(lt,Et){const Rt={year:0,month:0,day:1,hour:0,minute:0,second:0};for(const Gt of s(Et).formatToParts(new Date(lt)))switch(Gt.type){case"year":Rt.year=Number(Gt.value);break;case"month":Rt.month=Number(Gt.value)-1;break;case"day":Rt.day=Number(Gt.value);break;case"hour":Rt.hour=Number(Gt.value)%24;break;case"minute":Rt.minute=Number(Gt.value);break;case"second":Rt.second=Number(Gt.value);break;default:break}return Rt}function i(lt,Et,Rt){const Gt=Date.UTC(lt,Et,1);let X=Gt;for(let et=0;et<2;et++){const mt=e(X,Rt),w=Date.UTC(mt.year,mt.month,mt.day,mt.hour,mt.minute,mt.second),J=Gt-w;if(J===0)break;X+=J}return X}function o(lt,Et,Rt){const Gt=Rt?e(lt.min,Rt).year:new Date(lt.min).getUTCFullYear();let X=Math.ceil(Gt/Et)*Et;const et=w=>Rt?i(w,0,Rt):Date.UTC(w,0,1);et(X)<lt.min&&(X+=Et);const mt=[];for(;et(X)<=lt.max;X+=Et)mt.push(et(X));return mt}const l=new Map([[30*dt,1],[90*dt,3],[180*dt,6]]);function L(lt,Et,Rt){const Gt=Rt?e(lt.min,Rt):{year:new Date(lt.min).getUTCFullYear(),month:new Date(lt.min).getUTCMonth()};let X=Gt.year*12+Gt.month;const et=w=>{const J=Math.floor(w/12),O=w-J*12;return Rt?i(J,O,Rt):Date.UTC(J,O,1)};et(X)<lt.min&&(X+=1),X=Math.ceil(X/Et)*Et;const mt=[];for(;;X+=Et){const w=et(X);if(w>lt.max)break;mt.push(w)}return mt}function Y(lt,Et=5,Rt){const Gt=y(lt.max-lt.min,Et);if(Gt>=nt)return o(lt,Math.round(Gt/nt),Rt);const X=l.get(Gt);if(X)return L(lt,X,Rt);const et=[],mt=Math.ceil(lt.min/Gt)*Gt;for(let w=mt;w<=lt.max;w+=Gt)et.push(w);return et}function W(lt,Et){const Rt=lt.max-lt.min||1,[Gt,X]=Et;return{kind:"linear",domain:lt,range:Et,of(et){return Gt+(et-lt.min)/Rt*(X-Gt)},invert(et){return lt.min+(et-Gt)/(X-Gt||1)*Rt},ticks(et=5){return b(lt,et)}}}function z(lt,Et){return{...W(lt,Et),kind:"time",ticks(Gt=5,X){return Y(lt,Gt,X)}}}function kt(lt){if(lt==null)return" null";if(lt instanceof Date)return` date:${lt.getTime()}`;if(typeof lt=="object"){const Et=lt,Rt=Et.id??Et.key??Et.value;return Rt!==void 0&&typeof Rt!="object"?` obj:${String(Rt)}`:` obj:${String(lt)}`}return String(lt)}function bt(lt,Et,Rt=.2){const Gt=Math.min(.9,Math.max(0,Rt)),[X,et]=Et,mt=new Map;for(let O=0;O<lt.length;O++){const K=kt(lt[O]);mt.has(K)||mt.set(K,O)}const w=lt.length?(et-X)/lt.length:et-X,J=Math.max(0,w*(1-Gt));return{kind:"band",domain:lt,range:Et,bandwidth:J,step:w,of(O){const K=mt.get(kt(O));return K===void 0?NaN:X+K*w+(w-J)/2},centre(O){const K=this.of(O);return Number.isNaN(K)?NaN:K+J/2},ticks(){return lt}}}function _t(lt,Et){const[Rt,Gt]=Et,X=Math.max(Math.abs(lt.max),Math.abs(lt.min),0)||1;return{kind:"sqrt",domain:lt,range:Et,of(et){const mt=Math.sqrt(Math.abs(et)/X);return Rt+mt*(Gt-Rt)}}}}),oe("packages/modules/gantt/links.js",function(f,ut){"use strict";Object.defineProperty(f,"LINK_SIDES",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(f,"linkSides",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(f,"linkTypeForSides",{enumerable:!0,get:function(){return q}}),Object.defineProperty(f,"routeLink",{enumerable:!0,get:function(){return T}}),Object.defineProperty(f,"arrowheadPath",{enumerable:!0,get:function(){return d}});const Pt=ut("packages/modules/charts/svg.js"),tt=Pt.path,at=Pt.round,dt=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 nt(h){return dt[String(h||"FS").toUpperCase()]||dt.FS}function q(h,D){for(const[$,k]of Object.entries(dt))if(k.depart===h&&k.arrive===D)return $;return"FS"}function T(h){const D=Number(h.sx),$=Number(h.sy),k=Number(h.ex),_=Number(h.ey),S=Number.isFinite(h.elbow)&&h.elbow>0?Number(h.elbow):8,b=Number.isFinite(h.rowGap)&&h.rowGap>0?Number(h.rowGap):S,y=nt(h.type),g=-y.arrive,s=Math.abs(_-$)<.5,e=(k-D)*g;if(s&&e>0)return{d:tt(["M",at(D),at($),"H",at(k)]),arrowDir:g,route:"straight"};if(e>=0)return{d:tt(["M",at(D),at($),"V",at(_),"H",at(k)]),arrowDir:g,route:"drop"};const i=s?$+b:($+_)/2,o=D+y.depart*S,l=k+y.arrive*S;return{d:tt(["M",at(D),at($),"H",at(o),"V",at(i),"H",at(l),"V",at(_),"H",at(k)]),arrowDir:g,route:"detour"}}function d(h,D,$,k=4){return tt(["M",at(h),at(D),"L",at(h-$*k),at(D-k),"L",at(h-$*k),at(D+k),"Z"])}}),oe("packages/modules/gantt/colour.js",function(f,ut){"use strict";Object.defineProperty(f,"resolveTaskColour",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(f,"darkenColour",{enumerable:!0,get:function(){return at}}),Object.defineProperty(f,"contrastColour",{enumerable:!0,get:function(){return dt}});function Pt(nt,q){if(typeof q=="function"){const T=q(nt);if(T)return String(T)}return nt&&nt.colour?String(nt.colour):null}function tt(nt){const q=String(nt).trim();let T;return(T=/^#([0-9a-f]{3})$/i.exec(q))?[T[1][0]+T[1][0],T[1][1]+T[1][1],T[1][2]+T[1][2]].map(d=>parseInt(d,16)):(T=/^#([0-9a-f]{6})$/i.exec(q))?[T[1].slice(0,2),T[1].slice(2,4),T[1].slice(4,6)].map(d=>parseInt(d,16)):(T=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i.exec(q))?[Number(T[1]),Number(T[2]),Number(T[3])]:null}function at(nt){const q=tt(nt);if(!q)return nt;const T=.7;return`#${q.map(h=>Math.max(0,Math.min(255,Math.round(h*T)))).map(h=>h.toString(16).padStart(2,"0")).join("")}`}function dt(nt){const q=tt(nt);if(!q)return null;const T=q.map(h=>{const D=h/255;return D<=.03928?D/12.92:Math.pow((D+.055)/1.055,2.4)});return .2126*T[0]+.7152*T[1]+.0722*T[2]>.179?"#1a1a1a":"#ffffff"}}),oe("packages/modules/gantt/messages.js",function(f,ut){"use strict";Object.defineProperty(f,"FALLBACK_EN",{enumerable:!0,get:function(){return at}}),Object.defineProperty(f,"createTranslator",{enumerable:!0,get:function(){return dt}});const tt=ut("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.row.moveHandle":"Drag to reorder or re-parent {name}","gantt.a11y.rowMoved":"{name} moved.","gantt.a11y.rowReparented":"{name} moved under {parent}.","gantt.a11y.rowPromoted":"{name} moved to the top level.","gantt.a11y.rowMoveCancelled":"Move cancelled.","gantt.a11y.linkCycle":"Linking {from} to {to} would create a cycle; link not created.","gantt.a11y.linkCreated":"{from} linked to {to}, {type}.","gantt.a11y.linkDeleted":"Link from {from} to {to} deleted.","gantt.a11y.linkLabel":"Link, {from} to {to}, {type}","gantt.linkEditor.title":"Edit link from {from} to {to}","gantt.linkEditor.type":"Link type","gantt.linkEditor.lag":"Lag, in days","gantt.linkEditor.apply":"Apply","gantt.linkEditor.delete":"Delete link","gantt.linkEditor.cancel":"Cancel","gantt.a11y.undone":"Undone.","gantt.a11y.redone":"Redone.","gantt.a11y.nothingToUndo":"Nothing to undo.","gantt.a11y.nothingToRedo":"Nothing to redo.","gantt.workload.title":"Resource workload","gantt.workload.resource":"Resource","gantt.workload.total":"Total","gantt.workload.unassigned":"Unassigned","gantt.workload.cell":"{hours} h from {date}","gantt.workload.over":"{hours} h from {date}, over a capacity of {capacity} h","gantt.workload.expand":"Show {name}’s tasks","gantt.workload.collapse":"Hide {name}’s tasks","gantt.workload.unitToggle":"Hours / % / Cost","gantt.workload.unitHours":"Showing hours","gantt.workload.unitPercent":"Showing percent of capacity","gantt.workload.unitCost":"Showing cost","gantt.workload.cellPercent":"{percent}% from {date}","gantt.workload.overPercent":"{percent}% from {date}, over capacity","gantt.workload.cellNoCapacity":"No available hours from {date}","gantt.workload.cellCost":"{cost} from {date}","gantt.workload.otherProjectLabel":"{name} (other project)","gantt.workload.external":"External booking","gantt.row.expand":"Expand {name}","gantt.row.collapse":"Collapse {name}","gantt.resource.over":"{name} — over-allocated","gantt.a11y.hoursSet":"{name}: {hours} h from {date}","gantt.a11y.hoursCleared":"{name}: no hours from {date}","gantt.a11y.hoursRefused":"{date} is not a working day; {name} was not changed.","gantt.tip.range":"{from} to {to}","gantt.tip.duration":"{days}d","gantt.tip.slack":"slack {days}d","gantt.tip.row":"{label}: {value}","gantt.tip.start":"Start","gantt.tip.end":"End","gantt.tip.date":"Date","gantt.tip.durationLabel":"Duration","gantt.tip.durationValue":"{days} days","gantt.tip.complete":"Complete","gantt.tip.effortLabel":"Effort","gantt.tip.effortValue":"{hours} h","gantt.tip.assigned":"Assigned","gantt.tip.cost":"Cost","gantt.tip.slackLabel":"Slack","gantt.tip.slackValue":"{days} days","gantt.tip.deadline":"Deadline","gantt.col.deadline":"Deadline","gantt.histogram.title":"Resource histogram","gantt.histogram.tableTitle":"Resource histogram data","gantt.histogram.resource":"Resource","gantt.histogram.period":"Period","gantt.histogram.hours":"Hours","gantt.histogram.percent":"Percent of capacity","gantt.histogram.cost":"Cost","gantt.histogram.capacity":"Capacity","gantt.histogram.overAllocated":"Over-allocated","gantt.histogram.yes":"Yes","gantt.histogram.no":"No","gantt.histogram.tip":"{name}, {from} to {to}: {value}{capacity}{tasks}","gantt.histogram.tipHours":"{hours} h","gantt.histogram.tipPercent":"{percent}% of capacity","gantt.histogram.tipCost":"{cost}","gantt.histogram.tipCapacity":", capacity {hours} h","gantt.histogram.tipTasks":" ({tasks})","gantt.histogram.tipOver":", over capacity","gantt.histogram.tipNoCapacity":"no available hours","gantt.scurve.spi":"SPI {index}","gantt.scurve.cpi":"CPI {index}","gantt.picker.title":"Assign resources to {name}","gantt.picker.open":"Edit assignments for {name}","gantt.picker.search":"Search resources","gantt.picker.list":"Resources","gantt.picker.selected":"Assigned resources","gantt.picker.load":"{load}% booked of {capacity}% over these dates","gantt.picker.none":"No matching resources","gantt.picker.units":"{name}, units in percent","gantt.picker.remove":"Remove {name}","gantt.picker.apply":"Apply","gantt.picker.cancel":"Cancel","gantt.picker.warn":"{name} would be over-allocated: {load}% booked of {capacity}%","gantt.picker.ok":"No resource would be over-allocated","gantt.picker.assign":"Assign","gantt.col.effort":"Effort","gantt.col.units":"Units","gantt.unscheduled":"Unscheduled","gantt.col.unscheduled":"Unscheduled","gantt.col.slack":"Slack","gantt.row.ancestor":"Shown because a task inside it matches the filter","gantt.progress.handle":"Drag to set the progress of {name}","gantt.a11y.progress":"{name} {percent}% complete","gantt.col.name":"Task name","gantt.col.start":"Start","gantt.col.end":"Finish","gantt.col.duration":"Duration","gantt.col.assignee":"Assignee","gantt.col.progress":"%","gantt.zoom.label":"Zoom","gantt.zoom.day":"Day","gantt.zoom.week":"Week","gantt.zoom.month":"Month","gantt.zoom.quarter":"Quarter","gantt.zoom.fit":"Fit to plan","gantt.print.page":"Page {page} of {pages}","gantt.print.printed":"Printed {date}","gantt.issues.title":"Scheduling conflicts","gantt.issues.empty":"No scheduling conflicts","gantt.issues.count":"{count} scheduling conflicts","gantt.issues.toggle":"Toggle the conflicts panel","gantt.issues.cycle":"Circular dependency: {tasks}","gantt.issues.constraint":"{task} cannot meet its {constraint} constraint of {date}","gantt.issues.lock":"{task} is locked but a dependency would move it","gantt.issues.deadline":"{task} finishes after its deadline of {date}","gantt.issues.fixRemoveLink":"Remove link","gantt.issues.fixAsap":"Set as soon as possible","gantt.issues.fixUnlock":"Unlock task","gantt.issues.fixClearDeadline":"Clear deadline"});function dt(nt,q){return function(d,h){const D=tt(q)?q():null,$=nt&&nt.grid,k=D&&tt(D.t)&&D||$&&$.messages&&tt($.messages.t)&&$.messages||null;if(k){let S;try{S=k.t(d,h)}catch{S=null}if(typeof S=="string"&&S&&S!==d)return S}const _=at[d];return _?_.replace(/\{(\w+)\}/g,(S,b)=>h&&b in h?String(h[b]):S):d}}}),oe("packages/modules/gantt/events-pointer.js",function(f,ut){"use strict";Object.defineProperty(f,"GESTURE_EVENTS",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(f,"DRAG_THRESHOLD",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(f,"DEFAULT_PROGRESS_STEP",{enumerable:!0,get:function(){return q}}),Object.defineProperty(f,"HANDLE_TARGET",{enumerable:!0,get:function(){return T}}),Object.defineProperty(f,"emitGesture",{enumerable:!0,get:function(){return d}}),Object.defineProperty(f,"gateGesture",{enumerable:!0,get:function(){return h}}),Object.defineProperty(f,"taskContext",{enumerable:!0,get:function(){return D}}),Object.defineProperty(f,"pointerOf",{enumerable:!0,get:function(){return $}}),Object.defineProperty(f,"snapProgress",{enumerable:!0,get:function(){return k}}),Object.defineProperty(f,"FrameThrottle",{enumerable:!0,get:function(){return _}}),Object.defineProperty(f,"partOfElement",{enumerable:!0,get:function(){return S}}),Object.defineProperty(f,"partOfTask",{enumerable:!0,get:function(){return b}}),Object.defineProperty(f,"TaskPointerEvents",{enumerable:!0,get:function(){return y}}),Object.defineProperty(f,"drawProgressHandle",{enumerable:!0,get:function(){return g}}),Object.defineProperty(f,"previewProgress",{enumerable:!0,get:function(){return s}}),Object.defineProperty(f,"progressHandleCss",{enumerable:!0,get:function(){return e}});const Pt=ut("packages/modules/charts/svg.js"),tt=Pt.svg,at=Pt.round,dt=Object.freeze(["beforeTaskDrag","taskDragStart","taskDrag","taskDrag:cancelled","beforeTaskResizeStart","taskResizeStart","taskPartialResize","taskResizeEnd","taskResize:cancelled","beforePercentBarDrag","percentBarDragStart","percentBarDrag","percentBarDrop","percentBarDrag:cancelled","taskClick","taskDblClick","taskMouseOver","taskMouseOut"]),nt=3,q=5,T=16;function d(i,o,l){i&&typeof i.emitGesture=="function"&&i.emitGesture(o,l)}function h(i,o,l,L){return!i||typeof i.gateGesture!="function"?!0:i.gateGesture(o,l,L)}function D(i,o){const l=i&&i.schedule,L=l&&l.ok?l.tasks.get(o):null,Y=i&&typeof i.taskById=="function"?i.taskById(o):null;return{id:o,rawTask:Y,task:L?{...L}:null}}function $(i){return!i||!Number.isFinite(i.clientX)?null:{x:i.clientX,y:Number.isFinite(i.clientY)?i.clientY:0}}function k(i,o){const l=Number.isFinite(o)&&o>0?Number(o):q,L=Math.round((Number(i)||0)/l)*l;return Math.max(0,Math.min(100,Math.round(L*1e3)/1e3))}class _{#e;#r;#t=null;#n=null;constructor(o,l){this.#e=l;const L=o&&o.defaultView;this.#r=L&&typeof L.requestAnimationFrame=="function"?L:null}push(o){if(!this.#r){this.#e(o);return}this.#n={value:o},this.#t==null&&(this.#t=this.#r.requestAnimationFrame(()=>{this.#t=null;const l=this.#n;this.#n=null,l&&this.#e(l.value)}))}flush(){const o=this.#n;this.cancel(),o&&this.#e(o.value)}cancel(){this.#t!=null&&this.#r&&this.#r.cancelAnimationFrame(this.#t),this.#t=null,this.#n=null}}function S(i,o){const l=i&&i.classList;return l?l.contains(`${o}__progresshandle-hit`)||l.contains(`${o}__progresshandle-thumb`)||l.contains(`${o}__progress`)?"progress":l.contains(`${o}__bar`)?"bar":l.contains(`${o}__barlabel`)||l.contains(`${o}__label`)?"label":l.contains(`${o}__baseline`)?"baseline":l.contains(`${o}__milestone`)?"milestone":l.contains(`${o}__summary-bar`)||l.contains(`${o}__summary`)?"summary":null:null}function b(i){return i&&i.isSummary?"summary":i&&i.isMilestone?"milestone":"bar"}class y{#e;#r=[];#t=null;#n=null;constructor(o){this.#e=o}attach(o){if(!o||!o.addEventListener)return;const bt=[["click",_t=>this.#c(_t)],["dblclick",_t=>this.#f(_t)],["pointerover",_t=>this.#o(_t)],["pointerout",_t=>this.#d(_t)],["focusin",_t=>this.#h(_t)],["focusout",_t=>this.#g(_t)]];if(this.#e.keyboard){const _t=lt=>this.#S(lt);bt.push(["keydown",_t])}for(const[_t,lt]of bt)o.addEventListener(_t,lt),this.#r.push([o,_t,lt])}#i(o){const l=S(o,this.#e.ns);if(!l)return null;const L=this.#e.rowOf(o),Y=L?L.getAttribute("data-task"):null;return Y==null?null:{id:String(Y),part:l}}#l(o,l){return{...D(this.#e.controller,o),view:this.#e.view(),...l}}#a(o,l){let L=Number.isFinite(o&&o.clientX)?this.#e.dayAt(o):null;if(!Number.isFinite(L)){const Y=this.#e.controller.schedule,W=Y&&Y.ok?Y.tasks.get(l):null;L=W?W.es:null}return Number.isFinite(L)?this.#e.date(Math.floor(L)):null}#c(o){if(this.#e.consumeDragRelease())return;const l=this.#i(o.target);l&&d(this.#e.controller,"taskClick",this.#l(l.id,{part:l.part,date:this.#a(o,l.id),event:o}))}#f(o){const l=this.#i(o.target);if(!l)return;!h(this.#e.controller,"taskDblClick",null,this.#l(l.id,{part:l.part,date:this.#a(o,l.id),event:o}))&&o.preventDefault&&o.preventDefault()}#o(o){if(this.#e.dragging())return;const l=this.#i(o.target);!l||this.#t&&this.#t.id===l.id||(this.#t&&this.#s(o),this.#t=l,d(this.#e.controller,"taskMouseOver",this.#l(l.id,{part:l.part,event:o})))}#d(o){if(!this.#t)return;const l=o.relatedTarget?this.#i(o.relatedTarget):null;l&&l.id===this.#t.id||this.#s(o)}#s(o){const l=this.#t;this.#t=null,d(this.#e.controller,"taskMouseOut",this.#l(l.id,{part:l.part,event:o}))}#p(o){const l=this.#e.rowOf(o.target);if(!l||l!==o.target)return null;const L=String(l.getAttribute("data-task")),Y=this.#e.controller.schedule;return{id:L,part:b(Y&&Y.ok?Y.tasks.get(L):null)}}#h(o){const l=this.#p(o);!l||l.id===this.#n||(this.#n=l.id,d(this.#e.controller,"taskMouseOver",this.#l(l.id,{part:l.part,event:o})))}#g(o){const l=this.#p(o);!l||l.id!==this.#n||(this.#n=null,d(this.#e.controller,"taskMouseOut",this.#l(l.id,{part:l.part,event:o})))}#S(o){if(o.key!=="Enter"&&o.key!==" "||o.ctrlKey||o.metaKey||o.altKey)return;const l=this.#p(o);l&&(o.preventDefault&&o.preventDefault(),d(this.#e.controller,"taskClick",this.#l(l.id,{part:l.part,date:this.#a(null,l.id),event:o})))}destroy(){for(const[o,l,L]of this.#r)o.removeEventListener(l,L);this.#r=[],this.#t=null,this.#n=null}}function g(i,o){const l=Math.max(0,Math.min(100,Number(o.percent)||0)),L=o.x0+o.w*(l/100),Y=o.barY+o.barH,W=Y-T/2,z=T,kt=tt(i,"g",{class:`${o.ns}__progresshandle`,"data-task":o.id,"data-percent":String(l),"aria-hidden":"true"}),bt=tt(i,"rect",{class:`${o.ns}__progresshandle-hit`,x:at(L-T/2),y:at(W),width:T,height:at(z),fill:"transparent"}),_t=tt(i,"title",{});return _t.textContent=o.title,bt.appendChild(_t),kt.appendChild(bt),kt.appendChild(tt(i,"path",{class:`${o.ns}__progresshandle-thumb`,d:`M ${at(L)} ${at(Y-3)} L ${at(L+5)} ${at(Y+5)} L ${at(L-5)} ${at(Y+5)} Z`})),kt}function s(i,o,l,L){const Y=o&&o.querySelector(`.${l}__bar`);if(!Y)return;const W=parseFloat(Y.getAttribute("x")),z=parseFloat(Y.getAttribute("width"));if(!Number.isFinite(W)||!Number.isFinite(z))return;let kt=o.querySelector(`.${l}__progress`);kt||(kt=tt(i,"rect",{class:`${l}__progress`,x:W,y:Y.getAttribute("y"),height:Y.getAttribute("height"),rx:3,width:0}),Y.parentNode.insertBefore(kt,Y.nextSibling)),kt.setAttribute("width",String(at(z*(L/100))));const bt=o.querySelector(`.${l}__progresshandle`);if(!bt)return;const _t=parseFloat(bt.getAttribute("data-percent"))||0,lt=at(z*((L-_t)/100));bt.setAttribute("transform",`translate(${lt} 0)`),bt.setAttribute("data-preview-percent",String(L))}function e(i,o="barrow"){return`.${i}__progresshandle{opacity:0;transition:opacity .1s;cursor:ew-resize}
8
8
  .${i}__${o}:hover .${i}__progresshandle,.${i}__${o}:focus .${i}__progresshandle,.${i}__progresshandle--active{opacity:1}
9
9
  .${i}__progresshandle-thumb{fill:var(--lattice-background,#fff);stroke:var(--lattice-foreground,#3d4650);stroke-width:1.5}