@meirblachman/azure-pipelines-visualizer 0.2.2 → 0.2.4

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.
@@ -1,124 +1,699 @@
1
- import { jsx as s, jsxs as c, Fragment as et } from "react/jsx-runtime";
2
- import { useMemo as ze, Component as pt, createContext as ut, useContext as mt, memo as tt, useState as Z, useCallback as fe, useRef as te, useEffect as oe, createElement as ht } from "react";
3
- import { parseYaml as pe, extractTaskReferences as ft, resolveTaskDocUrl as gt, extractVariableValues as Pe, detectTemplateReferences as Se, extractParameterDefaults as De, buildAdoFileUrl as at, getEffectiveRepoAlias as re, extractDeclaredParameterNames as je, pathHasExpressions as ue, resolveExpressionPath as Ee, resolveTemplateRefPaths as nt, evaluateExpression as _t, resolveTemplateSource as st, parseTemplatePath as vt, resolveAllExpressions as yt, collapsePath as Nt, parseAdoUrl as Pt } from "@meirblachman/azure-pipelines-visualizer-core";
4
- import bt from "@monaco-editor/react";
5
- import { create as wt } from "zustand";
6
- import { Handle as He, Position as Ke, getBezierPath as Rt, BaseEdge as Et, EdgeLabelRenderer as xt, MarkerType as xe, useNodesState as kt, useEdgesState as At, ReactFlow as Tt, Background as $t, BackgroundVariant as Ct, Controls as St } from "@xyflow/react";
7
- import Ye from "@dagrejs/dagre";
8
- import Dt from "react-dom";
9
- const Te = wt((t) => ({
1
+ import { jsx as s, jsxs as l, Fragment as Xe } from "react/jsx-runtime";
2
+ import { memo as Qe, useMemo as ve, useEffect as ee, useCallback as ne, useState as L, useRef as Q, Component as wt, createContext as Pt, useContext as Et, createElement as Rt } from "react";
3
+ import { collapsePath as xt, parseAdoCommitUrl as kt, parseYaml as ue, extractTaskReferences as Tt, resolveTaskDocUrl as $t, extractVariableValues as Pe, detectTemplateReferences as je, extractParameterDefaults as ze, buildAdoFileUrl as it, getEffectiveRepoAlias as ie, extractDeclaredParameterNames as et, pathHasExpressions as me, resolveExpressionPath as $e, resolveTemplateRefPaths as lt, evaluateExpression as St, resolveTemplateSource as ct, parseTemplatePath as Ct, resolveAllExpressions as Dt, parseAdoUrl as At } from "@meirblachman/azure-pipelines-visualizer-core";
4
+ import Se from "@dagrejs/dagre";
5
+ import { Handle as Ce, Position as De, useNodesState as dt, useEdgesState as pt, ReactFlow as ut, Background as mt, Controls as ht, getBezierPath as It, BaseEdge as Lt, EdgeLabelRenderer as Bt, MarkerType as Ae, BackgroundVariant as Ft } from "@xyflow/react";
6
+ import Ut from "@monaco-editor/react";
7
+ import { create as Vt } from "zustand";
8
+ import Mt from "react-dom";
9
+ const Be = "7.1";
10
+ function Fe(e, t) {
11
+ return `https://dev.azure.com/${encodeURIComponent(e)}/${encodeURIComponent(t)}/_apis`;
12
+ }
13
+ function Ot(e) {
14
+ return e.startsWith("refs/heads/") ? { version: e.slice(11), versionType: "branch" } : e.startsWith("refs/tags/") ? { version: e.slice(10), versionType: "tag" } : /^[0-9a-f]{40}$/i.test(e) ? { version: e, versionType: "commit" } : { version: e, versionType: "branch" };
15
+ }
16
+ async function Ue(e) {
17
+ const t = await fetch(e, { credentials: "include" });
18
+ if (!t.ok) {
19
+ const a = await t.text();
20
+ throw new Error(`ADO API error (${t.status}): ${a}`);
21
+ }
22
+ return t;
23
+ }
24
+ async function ft(e, t, a, o, r) {
25
+ const n = o.startsWith("/") ? o : `/${o}`, d = xt(n);
26
+ let m = `${Fe(e, t)}/git/repositories/${encodeURIComponent(a)}/items?path=${encodeURIComponent(d)}&api-version=${Be}&includeContent=true&$format=text`;
27
+ if (r) {
28
+ const h = Ot(r);
29
+ m += `&versionDescriptor.version=${encodeURIComponent(h.version)}&versionDescriptor.versionType=${h.versionType}`;
30
+ }
31
+ return (await Ue(m)).text();
32
+ }
33
+ async function jt(e, t) {
34
+ const a = `${Fe(e, t)}/pipelines?api-version=${Be}`;
35
+ return (await (await Ue(a)).json()).value;
36
+ }
37
+ async function zt(e, t, a) {
38
+ var u, h, i, p, f;
39
+ const o = `${Fe(e, t)}/build/definitions/${a}?api-version=${Be}`, n = await (await Ue(o)).json(), d = {
40
+ id: n.id,
41
+ name: n.name,
42
+ path: ((u = n.process) == null ? void 0 : u.yamlFilename) ?? n.path,
43
+ repository: {
44
+ id: (h = n.repository) == null ? void 0 : h.id,
45
+ name: (i = n.repository) == null ? void 0 : i.name,
46
+ type: (p = n.repository) == null ? void 0 : p.type,
47
+ defaultBranch: (f = n.repository) == null ? void 0 : f.defaultBranch
48
+ }
49
+ }, m = await ft(
50
+ e,
51
+ t,
52
+ d.repository.id,
53
+ d.path,
54
+ d.repository.defaultBranch
55
+ );
56
+ return { definition: d, yaml: m };
57
+ }
58
+ async function Wt(e, t, a, o, r) {
59
+ return { content: await ft(e, t, a, o, r), path: o, repoId: a, repoName: a, branch: r || "" };
60
+ }
61
+ async function Ht() {
62
+ return { customTaskDocs: {} };
63
+ }
64
+ async function Gt(e) {
65
+ return { tasks: [], cached: !1 };
66
+ }
67
+ async function Kt(e, t, a, o) {
68
+ const r = new URLSearchParams({
69
+ "api-version": Be,
70
+ repositoryId: a,
71
+ repositoryType: "TfsGit",
72
+ sourceVersion: o,
73
+ queryOrder: "queueTimeAscending",
74
+ maxBuildsPerDefinition: "50"
75
+ }), n = `${Fe(e, t)}/build/builds?${r}`;
76
+ return (await (await Ue(n)).json()).value ?? [];
77
+ }
78
+ const gt = "/api";
79
+ var rt;
80
+ const he = typeof window < "u" && ((rt = window.location) == null ? void 0 : rt.protocol) === "chrome-extension:";
81
+ async function Ne(e) {
82
+ const t = await fetch(`${gt}${e}`);
83
+ if (!t.ok) {
84
+ const a = await t.text();
85
+ throw new Error(`API error (${t.status}): ${a}`);
86
+ }
87
+ return t.json();
88
+ }
89
+ function qa(e, t) {
90
+ return he ? jt(e, t) : Ne(`/${e}/${t}/pipelines`);
91
+ }
92
+ function qt(e, t, a) {
93
+ return he ? zt(e, t, a) : Ne(`/${e}/${t}/pipelines/${a}/yaml`);
94
+ }
95
+ function _t(e, t, a, o, r) {
96
+ if (he)
97
+ return Wt(e, t, a, o, r);
98
+ const n = new URLSearchParams({ repo: a, path: o });
99
+ return r && n.set("branch", r), Ne(`/${e}/${t}/file-by-repo-name?${n}`);
100
+ }
101
+ function Yt() {
102
+ return he ? Ht() : Ne("/config/task-docs");
103
+ }
104
+ function Jt(e) {
105
+ return he ? Gt() : Ne(`/${e}/schema/tasks`);
106
+ }
107
+ function Xt(e, t, a, o, r, n, d) {
108
+ const m = new AbortController();
109
+ if (he)
110
+ return Kt(e, t, a, o).then((p) => {
111
+ r(p), n();
112
+ }).catch(
113
+ (p) => d(p instanceof Error ? p.message : String(p))
114
+ ), m;
115
+ const u = new URLSearchParams({ repoName: a, commitSha: o }), h = `${gt}/${e}/${t}/commit-flow/stream?${u}`, i = new EventSource(h);
116
+ return m.signal.addEventListener("abort", () => i.close()), i.addEventListener("builds", (p) => {
117
+ try {
118
+ const f = JSON.parse(p.data);
119
+ r(f);
120
+ } catch {
121
+ }
122
+ }), i.addEventListener("done", () => {
123
+ i.close(), n();
124
+ }), i.addEventListener("error", (p) => {
125
+ i.close();
126
+ const f = p instanceof MessageEvent && p.data ? JSON.parse(p.data).error : "Connection lost";
127
+ d(f);
128
+ }), m;
129
+ }
130
+ function We(e) {
131
+ return e ? new Date(e).toLocaleString() : "—";
132
+ }
133
+ function Zt(e, t) {
134
+ if (!e || !t) return null;
135
+ const a = new Date(t).getTime() - new Date(e).getTime();
136
+ if (a < 0) return null;
137
+ const o = Math.floor(a / 1e3);
138
+ if (o < 60) return `${o}s`;
139
+ const r = Math.floor(o / 60), n = o % 60;
140
+ if (r < 60) return `${r}m ${n}s`;
141
+ const d = Math.floor(r / 60), m = r % 60;
142
+ return `${d}h ${m}m`;
143
+ }
144
+ function Qt(e, t) {
145
+ return e === "inProgress" ? { label: "In Progress", className: "badge--in-progress" } : e === "notStarted" ? { label: "Not Started", className: "badge--pending" } : t === "succeeded" ? { label: "Succeeded", className: "badge--succeeded" } : t === "partiallySucceeded" ? { label: "Partial Success", className: "badge--partial" } : t === "failed" ? { label: "Failed", className: "badge--failed" } : t === "canceled" ? { label: "Canceled", className: "badge--canceled" } : { label: e, className: "" };
146
+ }
147
+ function ea(e) {
148
+ var o, r;
149
+ const t = (r = (o = e._links) == null ? void 0 : o.web) == null ? void 0 : r.href;
150
+ if (!t) return null;
151
+ const a = t.match(/(https:\/\/dev\.azure\.com\/[^/]+\/[^/]+)/);
152
+ return a ? a[1] : null;
153
+ }
154
+ function Ee({
155
+ href: e,
156
+ children: t
157
+ }) {
158
+ return e ? /* @__PURE__ */ l(
159
+ "a",
160
+ {
161
+ href: e,
162
+ target: "_blank",
163
+ rel: "noopener noreferrer",
164
+ className: "build-popup__link",
165
+ children: [
166
+ t,
167
+ " ↗"
168
+ ]
169
+ }
170
+ ) : /* @__PURE__ */ s("span", { children: t });
171
+ }
172
+ function ta({
173
+ build: e,
174
+ onClose: t
175
+ }) {
176
+ var p, f;
177
+ const a = Qt(e.status, e.result), o = Zt(e.startTime, e.finishTime), r = ((f = (p = e._links) == null ? void 0 : p.web) == null ? void 0 : f.href) ?? null, n = ea(e), d = e.sourceBranch.replace("refs/heads/", ""), m = r, u = n ? `${n}/_build?definitionId=${e.definition.id}` : null, h = n ? `${n}/_git/?version=GC${e.sourceVersion}` : null, i = n ? `${n}/_git/?version=GB${d}` : null;
178
+ return /* @__PURE__ */ s(
179
+ "div",
180
+ {
181
+ className: "build-popup-overlay",
182
+ onClick: t,
183
+ onKeyDown: (c) => {
184
+ c.key === "Escape" && t();
185
+ },
186
+ role: "dialog",
187
+ "aria-modal": "true",
188
+ children: /* @__PURE__ */ l(
189
+ "div",
190
+ {
191
+ className: "build-popup",
192
+ onClick: (c) => c.stopPropagation(),
193
+ onKeyDown: (c) => c.stopPropagation(),
194
+ children: [
195
+ /* @__PURE__ */ l("div", { className: "build-popup__header", children: [
196
+ /* @__PURE__ */ s("h2", { children: /* @__PURE__ */ s(Ee, { href: u, children: e.definition.name }) }),
197
+ /* @__PURE__ */ s(
198
+ "button",
199
+ {
200
+ className: "build-popup__close",
201
+ onClick: t,
202
+ type: "button",
203
+ children: "✕"
204
+ }
205
+ )
206
+ ] }),
207
+ /* @__PURE__ */ l("div", { className: "build-popup__body", children: [
208
+ /* @__PURE__ */ l("div", { className: "build-popup__row", children: [
209
+ /* @__PURE__ */ s("span", { className: "build-popup__label", children: "Build Number" }),
210
+ /* @__PURE__ */ l(Ee, { href: m, children: [
211
+ "#",
212
+ e.buildNumber
213
+ ] })
214
+ ] }),
215
+ /* @__PURE__ */ l("div", { className: "build-popup__row", children: [
216
+ /* @__PURE__ */ s("span", { className: "build-popup__label", children: "Status" }),
217
+ /* @__PURE__ */ s("span", { className: `build-popup__badge ${a.className}`, children: a.label })
218
+ ] }),
219
+ /* @__PURE__ */ l("div", { className: "build-popup__row", children: [
220
+ /* @__PURE__ */ s("span", { className: "build-popup__label", children: "Project" }),
221
+ /* @__PURE__ */ s("span", { children: e.project.name })
222
+ ] }),
223
+ /* @__PURE__ */ l("div", { className: "build-popup__row", children: [
224
+ /* @__PURE__ */ s("span", { className: "build-popup__label", children: "Queued" }),
225
+ /* @__PURE__ */ s("span", { children: We(e.queueTime) })
226
+ ] }),
227
+ /* @__PURE__ */ l("div", { className: "build-popup__row", children: [
228
+ /* @__PURE__ */ s("span", { className: "build-popup__label", children: "Started" }),
229
+ /* @__PURE__ */ s("span", { children: We(e.startTime) })
230
+ ] }),
231
+ /* @__PURE__ */ l("div", { className: "build-popup__row", children: [
232
+ /* @__PURE__ */ s("span", { className: "build-popup__label", children: "Finished" }),
233
+ /* @__PURE__ */ s("span", { children: We(e.finishTime) })
234
+ ] }),
235
+ o && /* @__PURE__ */ l("div", { className: "build-popup__row", children: [
236
+ /* @__PURE__ */ s("span", { className: "build-popup__label", children: "Duration" }),
237
+ /* @__PURE__ */ s("span", { children: o })
238
+ ] }),
239
+ /* @__PURE__ */ l("div", { className: "build-popup__row", children: [
240
+ /* @__PURE__ */ s("span", { className: "build-popup__label", children: "Branch" }),
241
+ /* @__PURE__ */ s(Ee, { href: i, children: d })
242
+ ] }),
243
+ /* @__PURE__ */ l("div", { className: "build-popup__row", children: [
244
+ /* @__PURE__ */ s("span", { className: "build-popup__label", children: "Commit" }),
245
+ /* @__PURE__ */ s(Ee, { href: h, children: /* @__PURE__ */ s("span", { className: "build-popup__mono", children: e.sourceVersion.slice(0, 8) }) })
246
+ ] }),
247
+ e.requestedFor && /* @__PURE__ */ l("div", { className: "build-popup__row", children: [
248
+ /* @__PURE__ */ s("span", { className: "build-popup__label", children: "Requested For" }),
249
+ /* @__PURE__ */ s("span", { children: e.requestedFor.displayName })
250
+ ] }),
251
+ e.triggeredByBuild && /* @__PURE__ */ l("div", { className: "build-popup__row", children: [
252
+ /* @__PURE__ */ s("span", { className: "build-popup__label", children: "Triggered By" }),
253
+ /* @__PURE__ */ l("span", { children: [
254
+ e.triggeredByBuild.definition.name,
255
+ " #",
256
+ e.triggeredByBuild.buildNumber
257
+ ] })
258
+ ] }),
259
+ Object.keys(e.triggerInfo).length > 0 && /* @__PURE__ */ l("div", { className: "build-popup__row", children: [
260
+ /* @__PURE__ */ s("span", { className: "build-popup__label", children: "Trigger Info" }),
261
+ /* @__PURE__ */ s("span", { className: "build-popup__mono", children: Object.entries(e.triggerInfo).map(([c, N]) => `${c}: ${N}`).join(", ") })
262
+ ] }),
263
+ e.tags.length > 0 && /* @__PURE__ */ l("div", { className: "build-popup__row", children: [
264
+ /* @__PURE__ */ s("span", { className: "build-popup__label", children: "Tags" }),
265
+ /* @__PURE__ */ s("span", { className: "build-popup__tags", children: e.tags.map((c) => /* @__PURE__ */ s("span", { className: "build-popup__tag", children: c }, c)) })
266
+ ] }),
267
+ r && /* @__PURE__ */ s("div", { className: "build-popup__actions", children: /* @__PURE__ */ s(
268
+ "a",
269
+ {
270
+ href: r,
271
+ target: "_blank",
272
+ rel: "noopener noreferrer",
273
+ className: "build-popup__action-link",
274
+ children: "Open Build in Azure DevOps ↗"
275
+ }
276
+ ) })
277
+ ] })
278
+ ]
279
+ }
280
+ )
281
+ }
282
+ );
283
+ }
284
+ function aa(e) {
285
+ return e ? new Date(e).toLocaleString(void 0, {
286
+ month: "short",
287
+ day: "numeric",
288
+ hour: "2-digit",
289
+ minute: "2-digit",
290
+ second: "2-digit"
291
+ }) : "—";
292
+ }
293
+ function na(e, t) {
294
+ if (!e || !t) return null;
295
+ const a = new Date(t).getTime() - new Date(e).getTime();
296
+ if (a < 0) return null;
297
+ const o = Math.floor(a / 1e3);
298
+ if (o < 60) return `${o}s`;
299
+ const r = Math.floor(o / 60), n = o % 60;
300
+ if (r < 60) return `${r}m ${n}s`;
301
+ const d = Math.floor(r / 60), m = r % 60;
302
+ return `${d}h ${m}m`;
303
+ }
304
+ function sa(e, t) {
305
+ return e === "inProgress" ? "⏳" : e === "notStarted" ? "⏸️" : t === "succeeded" ? "✅" : t === "partiallySucceeded" ? "⚠️" : t === "failed" ? "❌" : t === "canceled" ? "🚫" : "❓";
306
+ }
307
+ function oa(e, t) {
308
+ return e === "inProgress" ? "build-node--in-progress" : t === "succeeded" ? "build-node--succeeded" : t === "partiallySucceeded" ? "build-node--partial" : t === "failed" ? "build-node--failed" : t === "canceled" ? "build-node--canceled" : "";
309
+ }
310
+ function ra({ data: e }) {
311
+ const t = e, a = na(t.startTime, t.finishTime);
312
+ return /* @__PURE__ */ l("div", { className: `build-node ${oa(t.status, t.result)}`, children: [
313
+ !t.isRoot && /* @__PURE__ */ s(Ce, { type: "target", position: De.Left }),
314
+ /* @__PURE__ */ l("div", { className: "build-node__header", children: [
315
+ /* @__PURE__ */ s("span", { className: "build-node__status", children: sa(t.status, t.result) }),
316
+ /* @__PURE__ */ s("span", { className: "build-node__name", title: t.pipelineName, children: t.pipelineName })
317
+ ] }),
318
+ !t.isRoot && t.projectName && /* @__PURE__ */ l(
319
+ "div",
320
+ {
321
+ className: "build-node__project",
322
+ title: `Project: ${t.projectName}`,
323
+ children: [
324
+ "📁 ",
325
+ t.projectName
326
+ ]
327
+ }
328
+ ),
329
+ /* @__PURE__ */ l("div", { className: "build-node__number", children: [
330
+ "#",
331
+ t.buildNumber
332
+ ] }),
333
+ /* @__PURE__ */ l("div", { className: "build-node__times", children: [
334
+ /* @__PURE__ */ l("span", { title: "Start time", children: [
335
+ "🕐 ",
336
+ aa(t.startTime)
337
+ ] }),
338
+ a && /* @__PURE__ */ l("span", { title: "Duration", children: [
339
+ "⏱️ ",
340
+ a
341
+ ] })
342
+ ] }),
343
+ /* @__PURE__ */ l("div", { className: "build-node__branch", title: t.sourceBranch, children: [
344
+ "🌿 ",
345
+ t.sourceBranch.replace("refs/heads/", "")
346
+ ] }),
347
+ /* @__PURE__ */ s(Ce, { type: "source", position: De.Right })
348
+ ] });
349
+ }
350
+ const ia = Qe(ra), He = 280, _e = 130, Ge = 20, la = { build: ia };
351
+ function ca(e, t) {
352
+ if (e.length === 0) return { nodes: e, edges: t };
353
+ const a = /* @__PURE__ */ new Set();
354
+ for (const d of t)
355
+ a.add(d.source), a.add(d.target);
356
+ const o = e.filter((d) => !a.has(d.id)), r = e.filter((d) => a.has(d.id));
357
+ let n = [];
358
+ if (r.length > 0) {
359
+ const d = new Se.graphlib.Graph();
360
+ d.setDefaultEdgeLabel(() => ({})), d.setGraph({ rankdir: "LR", ranksep: 80, nodesep: 30 });
361
+ for (const m of r)
362
+ d.setNode(m.id, { width: He, height: _e });
363
+ for (const m of t)
364
+ d.setEdge(m.source, m.target);
365
+ Se.layout(d), n = r.map((m) => {
366
+ const u = d.node(m.id);
367
+ return {
368
+ ...m,
369
+ position: { x: u.x - He / 2, y: u.y - _e / 2 }
370
+ };
371
+ });
372
+ }
373
+ if (o.length > 0) {
374
+ let d = 0;
375
+ for (const i of n) d = Math.max(d, i.position.y + _e);
376
+ const m = n.length > 0 ? d + 60 : 0, u = [...o].sort((i, p) => {
377
+ const f = i.data.startTime ?? "", c = p.data.startTime ?? "";
378
+ return f < c ? -1 : f > c ? 1 : 0;
379
+ }), h = u.map((i) => {
380
+ const p = i.data.startTime;
381
+ return p ? new Date(p).getTime() : null;
382
+ }).filter((i) => i !== null);
383
+ if (h.length > 0) {
384
+ const i = Math.min(...h), f = Math.max(...h) - i || 1, c = Math.max(u.length * (He + Ge), 1200);
385
+ let N = 0;
386
+ for (const E of u) {
387
+ const _ = E.data.startTime, w = ((_ ? new Date(_).getTime() : i) - i) / f * c;
388
+ E.position = {
389
+ x: w,
390
+ y: m + N * (_e + Ge)
391
+ }, N++;
392
+ }
393
+ } else
394
+ u.forEach((i, p) => {
395
+ i.position = { x: 0, y: m + p * (_e + Ge) };
396
+ });
397
+ n = [...n, ...u];
398
+ }
399
+ return { nodes: n, edges: t };
400
+ }
401
+ function da(e) {
402
+ const t = /* @__PURE__ */ new Map();
403
+ for (const n of e)
404
+ t.set(n.id, n);
405
+ const a = /* @__PURE__ */ new Set();
406
+ for (const n of e)
407
+ n.upstreamBuildId && t.has(n.upstreamBuildId) && a.add(n.id);
408
+ const o = e.map((n) => {
409
+ var d, m;
410
+ return {
411
+ id: String(n.id),
412
+ type: "build",
413
+ position: { x: 0, y: 0 },
414
+ data: {
415
+ buildId: n.id,
416
+ pipelineName: n.definition.name,
417
+ buildNumber: n.buildNumber,
418
+ status: n.status,
419
+ result: n.result,
420
+ startTime: n.startTime,
421
+ finishTime: n.finishTime,
422
+ sourceBranch: n.sourceBranch,
423
+ webUrl: ((m = (d = n._links) == null ? void 0 : d.web) == null ? void 0 : m.href) ?? null,
424
+ isRoot: !a.has(n.id),
425
+ projectName: n.project.name
426
+ }
427
+ };
428
+ }), r = [];
429
+ for (const n of e)
430
+ n.upstreamBuildId && t.has(n.upstreamBuildId) && r.push({
431
+ id: `e-${n.upstreamBuildId}-${n.id}`,
432
+ source: String(n.upstreamBuildId),
433
+ target: String(n.id),
434
+ animated: n.status === "inProgress",
435
+ style: { stroke: "#89b4fa", strokeWidth: 2 }
436
+ });
437
+ return ca(o, r);
438
+ }
439
+ function pa({
440
+ builds: e,
441
+ onNodeClick: t
442
+ }) {
443
+ const { nodes: a, edges: o } = ve(
444
+ () => da(e),
445
+ [e]
446
+ ), [r, n, d] = dt(a), [m, u, h] = pt(o);
447
+ ee(() => {
448
+ n(a), u(o);
449
+ }, [a, o, n, u]);
450
+ const i = ve(() => {
451
+ const f = /* @__PURE__ */ new Map();
452
+ for (const c of e) f.set(c.id, c);
453
+ return f;
454
+ }, [e]), p = ne(
455
+ (f, c) => {
456
+ const N = i.get(Number(c.id));
457
+ N && t(N);
458
+ },
459
+ [i, t]
460
+ );
461
+ return /* @__PURE__ */ s("div", { className: "commit-flow-diagram", children: /* @__PURE__ */ l(
462
+ ut,
463
+ {
464
+ nodes: r,
465
+ edges: m,
466
+ nodeTypes: la,
467
+ onNodesChange: d,
468
+ onEdgesChange: h,
469
+ onNodeClick: p,
470
+ fitView: !0,
471
+ minZoom: 0.2,
472
+ maxZoom: 2,
473
+ proOptions: { hideAttribution: !0 },
474
+ children: [
475
+ /* @__PURE__ */ s(mt, {}),
476
+ /* @__PURE__ */ s(ht, {})
477
+ ]
478
+ }
479
+ ) });
480
+ }
481
+ function ua({
482
+ onLoad: e,
483
+ loading: t
484
+ }) {
485
+ const [a, o] = L(""), [r, n] = L(null), d = () => {
486
+ const u = a.trim();
487
+ if (!u) return;
488
+ n(null);
489
+ const h = kt(u);
490
+ if (!h) {
491
+ n(
492
+ "Invalid URL. Expected: https://dev.azure.com/{org}/{project}/_git/{repo}/commit/{sha}"
493
+ );
494
+ return;
495
+ }
496
+ e({
497
+ org: h.org,
498
+ project: h.project,
499
+ repoName: h.repoName,
500
+ commitSha: h.commitSha
501
+ });
502
+ };
503
+ return /* @__PURE__ */ l("div", { className: "commit-flow-selector", children: [
504
+ /* @__PURE__ */ s(
505
+ "input",
506
+ {
507
+ type: "text",
508
+ placeholder: "https://dev.azure.com/{org}/{project}/_git/{repo}/commit/{sha}",
509
+ value: a,
510
+ onChange: (u) => o(u.target.value),
511
+ onKeyDown: (u) => {
512
+ u.key === "Enter" && (u.preventDefault(), d());
513
+ },
514
+ className: "commit-flow-selector__input commit-flow-selector__input--url"
515
+ }
516
+ ),
517
+ /* @__PURE__ */ s(
518
+ "button",
519
+ {
520
+ className: "commit-flow-selector__btn",
521
+ onClick: d,
522
+ disabled: !a.trim() || t,
523
+ type: "button",
524
+ children: t ? "⏳ Loading..." : "Load Builds"
525
+ }
526
+ ),
527
+ r && /* @__PURE__ */ s("div", { className: "commit-flow-selector__error", children: r })
528
+ ] });
529
+ }
530
+ function ma() {
531
+ const [e, t] = L([]), [a, o] = L(!1), [r, n] = L(null), [d, m] = L(null), [u, h] = L(null), i = Q(null), p = ne((c) => {
532
+ var N;
533
+ (N = i.current) == null || N.abort(), o(!0), n(null), t([]), m(null), h(c), i.current = Xt(
534
+ c.org,
535
+ c.project,
536
+ c.repoName,
537
+ c.commitSha,
538
+ (E) => {
539
+ t((_) => [..._, ...E]);
540
+ },
541
+ () => {
542
+ o(!1), t((E) => (E.length === 0 && n("No builds found for this commit."), E));
543
+ },
544
+ (E) => {
545
+ o(!1), n(E);
546
+ }
547
+ );
548
+ }, []), f = ne(() => {
549
+ u && p(u);
550
+ }, [u, p]);
551
+ return /* @__PURE__ */ l("div", { className: "commit-flow-page", children: [
552
+ /* @__PURE__ */ l("div", { className: "commit-flow-page__selector", children: [
553
+ /* @__PURE__ */ s(ua, { onLoad: p, loading: a }),
554
+ u && !a && /* @__PURE__ */ s(
555
+ "button",
556
+ {
557
+ className: "commit-flow-page__refresh",
558
+ onClick: f,
559
+ type: "button",
560
+ children: "🔄 Refresh"
561
+ }
562
+ )
563
+ ] }),
564
+ r && /* @__PURE__ */ s("div", { className: "commit-flow-page__error", children: r }),
565
+ e.length > 0 && /* @__PURE__ */ l("div", { className: "commit-flow-page__diagram", children: [
566
+ /* @__PURE__ */ l("div", { className: "commit-flow-page__summary", children: [
567
+ e.length,
568
+ " build",
569
+ e.length !== 1 ? "s" : "",
570
+ " found",
571
+ a && " (loading…)"
572
+ ] }),
573
+ /* @__PURE__ */ s(pa, { builds: e, onNodeClick: m })
574
+ ] }),
575
+ d && /* @__PURE__ */ s(
576
+ ta,
577
+ {
578
+ build: d,
579
+ onClose: () => m(null)
580
+ }
581
+ )
582
+ ] });
583
+ }
584
+ const Ve = Vt((e) => ({
10
585
  org: "",
11
586
  project: "",
12
- setConnection: (e, a) => t({ org: e, project: a }),
587
+ setConnection: (t, a) => e({ org: t, project: a }),
13
588
  selectedPipeline: null,
14
589
  selectedPipelineLoading: !1,
15
590
  selectedPipelineError: null,
16
- setSelectedPipeline: (e) => t({
17
- selectedPipeline: e,
591
+ setSelectedPipeline: (t) => e({
592
+ selectedPipeline: t,
18
593
  selectedPipelineError: null,
19
594
  expandedNodes: /* @__PURE__ */ new Set()
20
595
  }),
21
- setSelectedPipelineLoading: (e) => t({ selectedPipelineLoading: e }),
22
- setSelectedPipelineError: (e) => t({ selectedPipelineError: e }),
23
- expandedTemplates: new Map(It()),
24
- setExpandedTemplate: (e, a) => t((n) => {
25
- const l = new Map(n.expandedTemplates);
26
- return l.set(e, a), Ft(l), { expandedTemplates: l };
596
+ setSelectedPipelineLoading: (t) => e({ selectedPipelineLoading: t }),
597
+ setSelectedPipelineError: (t) => e({ selectedPipelineError: t }),
598
+ expandedTemplates: new Map(ha()),
599
+ setExpandedTemplate: (t, a) => e((o) => {
600
+ const r = new Map(o.expandedTemplates);
601
+ return r.set(t, a), fa(r), { expandedTemplates: r };
27
602
  }),
28
603
  expandedNodes: /* @__PURE__ */ new Set(),
29
- toggleNode: (e) => t((a) => {
30
- const n = new Set(a.expandedNodes);
31
- return n.has(e) ? n.delete(e) : n.add(e), { expandedNodes: n };
604
+ toggleNode: (t) => e((a) => {
605
+ const o = new Set(a.expandedNodes);
606
+ return o.has(t) ? o.delete(t) : o.add(t), { expandedNodes: o };
32
607
  }),
33
608
  selectedNodeDetail: null,
34
- setSelectedNodeDetail: (e) => t({ selectedNodeDetail: e }),
609
+ setSelectedNodeDetail: (t) => e({ selectedNodeDetail: t }),
35
610
  customTaskDocs: {},
36
- setCustomTaskDocs: (e) => t({ customTaskDocs: e }),
611
+ setCustomTaskDocs: (t) => e({ customTaskDocs: t }),
37
612
  taskSchema: /* @__PURE__ */ new Map(),
38
- setTaskSchema: (e) => t(() => {
613
+ setTaskSchema: (t) => e(() => {
39
614
  const a = /* @__PURE__ */ new Map();
40
- for (const n of e)
41
- a.set(`${n.name}@${n.version}`, n);
615
+ for (const o of t)
616
+ a.set(`${o.name}@${o.version}`, o);
42
617
  return { taskSchema: a };
43
618
  })
44
- })), ot = "apv-template-cache";
45
- function It() {
619
+ })), vt = "apv-template-cache";
620
+ function ha() {
46
621
  try {
47
- const t = localStorage.getItem(ot);
48
- if (t)
49
- return JSON.parse(t);
622
+ const e = localStorage.getItem(vt);
623
+ if (e)
624
+ return JSON.parse(e);
50
625
  } catch {
51
626
  }
52
627
  return [];
53
628
  }
54
- function Ft(t) {
629
+ function fa(e) {
55
630
  try {
56
- const a = Array.from(t.entries()).slice(-100);
57
- localStorage.setItem(ot, JSON.stringify(a));
631
+ const a = Array.from(e.entries()).slice(-100);
632
+ localStorage.setItem(vt, JSON.stringify(a));
58
633
  } catch {
59
634
  }
60
635
  }
61
- function Lt() {
636
+ function ga() {
62
637
  const {
63
- selectedNodeDetail: t,
64
- customTaskDocs: e,
638
+ selectedNodeDetail: e,
639
+ customTaskDocs: t,
65
640
  taskSchema: a,
66
- setSelectedNodeDetail: n
67
- } = Te(), l = ze(() => {
68
- if (!(t != null && t.yaml)) return [];
641
+ setSelectedNodeDetail: o
642
+ } = Ve(), r = ve(() => {
643
+ if (!(e != null && e.yaml)) return [];
69
644
  try {
70
- const o = pe(t.yaml);
71
- return ft(o ?? {});
645
+ const n = ue(e.yaml);
646
+ return Tt(n ?? {});
72
647
  } catch {
73
648
  return [];
74
649
  }
75
- }, [t == null ? void 0 : t.yaml]);
76
- return t ? /* @__PURE__ */ c("div", { className: "detail-panel", children: [
77
- /* @__PURE__ */ c("div", { className: "detail-panel__header", children: [
78
- /* @__PURE__ */ c("div", { className: "detail-panel__header-row", children: [
79
- /* @__PURE__ */ s("h3", { className: "detail-panel__title", children: t.label }),
650
+ }, [e == null ? void 0 : e.yaml]);
651
+ return e ? /* @__PURE__ */ l("div", { className: "detail-panel", children: [
652
+ /* @__PURE__ */ l("div", { className: "detail-panel__header", children: [
653
+ /* @__PURE__ */ l("div", { className: "detail-panel__header-row", children: [
654
+ /* @__PURE__ */ s("h3", { className: "detail-panel__title", children: e.label }),
80
655
  /* @__PURE__ */ s(
81
656
  "button",
82
657
  {
83
658
  className: "detail-panel__close",
84
- onClick: () => n(null),
659
+ onClick: () => o(null),
85
660
  "aria-label": "Close detail panel",
86
661
  title: "Close",
87
662
  children: "✕"
88
663
  }
89
664
  )
90
665
  ] }),
91
- /* @__PURE__ */ c("div", { className: "detail-panel__path", children: [
92
- t.filePath,
93
- t.repoAlias && /* @__PURE__ */ c("span", { className: "detail-panel__repo", children: [
666
+ /* @__PURE__ */ l("div", { className: "detail-panel__path", children: [
667
+ e.filePath,
668
+ e.repoAlias && /* @__PURE__ */ l("span", { className: "detail-panel__repo", children: [
94
669
  " ",
95
670
  "@",
96
- t.repoAlias
671
+ e.repoAlias
97
672
  ] })
98
673
  ] })
99
674
  ] }),
100
- l.length > 0 && /* @__PURE__ */ c("div", { className: "detail-panel__tasks", children: [
101
- /* @__PURE__ */ c("h4", { className: "detail-panel__section-title", children: [
675
+ r.length > 0 && /* @__PURE__ */ l("div", { className: "detail-panel__tasks", children: [
676
+ /* @__PURE__ */ l("h4", { className: "detail-panel__section-title", children: [
102
677
  "Tasks (",
103
- l.length,
678
+ r.length,
104
679
  ")"
105
680
  ] }),
106
- /* @__PURE__ */ s("ul", { className: "task-list", children: l.map((o) => /* @__PURE__ */ s(
107
- Ut,
681
+ /* @__PURE__ */ s("ul", { className: "task-list", children: r.map((n) => /* @__PURE__ */ s(
682
+ _a,
108
683
  {
109
- ref_: o,
110
- customDocs: e,
111
- schemaEntry: a.get(o.raw) ?? a.get(`${o.name}@${o.version}`)
684
+ ref_: n,
685
+ customDocs: t,
686
+ schemaEntry: a.get(n.raw) ?? a.get(`${n.name}@${n.version}`)
112
687
  },
113
- o.raw
688
+ n.raw
114
689
  )) })
115
690
  ] }),
116
691
  /* @__PURE__ */ s("div", { className: "detail-panel__editor", children: /* @__PURE__ */ s(
117
- bt,
692
+ Ut,
118
693
  {
119
694
  height: "100%",
120
695
  language: "yaml",
121
- value: t.yaml,
696
+ value: e.yaml,
122
697
  theme: "vs-dark",
123
698
  options: {
124
699
  readOnly: !0,
@@ -134,58 +709,58 @@ function Lt() {
134
709
  ) })
135
710
  ] }) : /* @__PURE__ */ s("div", { className: "detail-panel detail-panel--empty", children: /* @__PURE__ */ s("p", { children: "Click a node to view its contents" }) });
136
711
  }
137
- function Ut({
138
- ref_: t,
139
- customDocs: e,
712
+ function _a({
713
+ ref_: e,
714
+ customDocs: t,
140
715
  schemaEntry: a
141
716
  }) {
142
- const n = gt(t, e);
143
- return /* @__PURE__ */ c("li", { className: "task-item", children: [
717
+ const o = $t(e, t);
718
+ return /* @__PURE__ */ l("li", { className: "task-item", children: [
144
719
  /* @__PURE__ */ s("span", { className: "task-item__icon", children: "⚙️" }),
145
- /* @__PURE__ */ c("div", { className: "task-item__content", children: [
146
- n ? /* @__PURE__ */ c(
720
+ /* @__PURE__ */ l("div", { className: "task-item__content", children: [
721
+ o ? /* @__PURE__ */ l(
147
722
  "a",
148
723
  {
149
- href: n,
724
+ href: o,
150
725
  target: "_blank",
151
726
  rel: "noopener noreferrer",
152
727
  className: "task-item__link",
153
- title: (a == null ? void 0 : a.description) || `Open docs for ${t.name}`,
728
+ title: (a == null ? void 0 : a.description) || `Open docs for ${e.name}`,
154
729
  children: [
155
- t.name,
156
- /* @__PURE__ */ c("span", { className: "task-item__version", children: [
730
+ e.name,
731
+ /* @__PURE__ */ l("span", { className: "task-item__version", children: [
157
732
  "@",
158
- t.version
733
+ e.version
159
734
  ] }),
160
735
  /* @__PURE__ */ s("span", { className: "task-item__external", children: "↗" })
161
736
  ]
162
737
  }
163
- ) : /* @__PURE__ */ c("span", { className: "task-item__name", children: [
164
- t.name,
165
- /* @__PURE__ */ c("span", { className: "task-item__version", children: [
738
+ ) : /* @__PURE__ */ l("span", { className: "task-item__name", children: [
739
+ e.name,
740
+ /* @__PURE__ */ l("span", { className: "task-item__version", children: [
166
741
  "@",
167
- t.version
742
+ e.version
168
743
  ] })
169
744
  ] }),
170
745
  (a == null ? void 0 : a.description) && /* @__PURE__ */ s("div", { className: "task-item__description", children: a.description })
171
746
  ] })
172
747
  ] });
173
748
  }
174
- class Ie extends pt {
175
- constructor(e) {
176
- super(e), this.state = { hasError: !1, error: null };
749
+ class Re extends wt {
750
+ constructor(t) {
751
+ super(t), this.state = { hasError: !1, error: null };
177
752
  }
178
- static getDerivedStateFromError(e) {
179
- return { hasError: !0, error: e };
753
+ static getDerivedStateFromError(t) {
754
+ return { hasError: !0, error: t };
180
755
  }
181
- componentDidCatch(e, a) {
182
- console.error("ErrorBoundary caught:", e, a);
756
+ componentDidCatch(t, a) {
757
+ console.error("ErrorBoundary caught:", t, a);
183
758
  }
184
759
  render() {
185
- var e;
186
- return this.state.hasError ? this.props.fallback || /* @__PURE__ */ c("div", { className: "error", children: [
760
+ var t;
761
+ return this.state.hasError ? this.props.fallback || /* @__PURE__ */ l("div", { className: "error", children: [
187
762
  /* @__PURE__ */ s("h3", { children: "Something went wrong" }),
188
- /* @__PURE__ */ s("p", { children: (e = this.state.error) == null ? void 0 : e.message }),
763
+ /* @__PURE__ */ s("p", { children: (t = this.state.error) == null ? void 0 : t.message }),
189
764
  /* @__PURE__ */ s(
190
765
  "button",
191
766
  {
@@ -197,104 +772,104 @@ class Ie extends pt {
197
772
  ] }) : this.props.children;
198
773
  }
199
774
  }
200
- const rt = ut(null), Vt = rt.Provider;
201
- function zt() {
202
- const t = mt(rt);
203
- if (!t)
775
+ const Nt = Pt(null), va = Nt.Provider;
776
+ function Na() {
777
+ const e = Et(Nt);
778
+ if (!e)
204
779
  throw new Error(
205
780
  "useFileFetch must be used within a FileFetchProvider. Wrap your component tree with <FileFetchProvider value={...}>."
206
781
  );
207
- return t;
782
+ return e;
208
783
  }
209
- const Xe = 300, Ge = 100;
210
- function Fe(t, e, a = "TB") {
211
- const n = new Ye.graphlib.Graph();
212
- n.setDefaultEdgeLabel(() => ({})), n.setGraph({ rankdir: a, ranksep: 80, nodesep: 40 });
213
- for (const o of t)
214
- n.setNode(o.id, { width: Xe, height: Ge });
215
- for (const o of e)
216
- n.setEdge(o.source, o.target);
217
- return Ye.layout(n), { nodes: t.map((o) => {
218
- const m = n.node(o.id);
784
+ const tt = 300, at = 100;
785
+ function Ke(e, t, a = "TB") {
786
+ const o = new Se.graphlib.Graph();
787
+ o.setDefaultEdgeLabel(() => ({})), o.setGraph({ rankdir: a, ranksep: 80, nodesep: 40 });
788
+ for (const n of e)
789
+ o.setNode(n.id, { width: tt, height: at });
790
+ for (const n of t)
791
+ o.setEdge(n.source, n.target);
792
+ return Se.layout(o), { nodes: e.map((n) => {
793
+ const d = o.node(n.id);
219
794
  return {
220
- ...o,
795
+ ...n,
221
796
  position: {
222
- x: m.x - Xe / 2,
223
- y: m.y - Ge / 2
797
+ x: d.x - tt / 2,
798
+ y: d.y - at / 2
224
799
  }
225
800
  };
226
- }), edges: e };
801
+ }), edges: t };
227
802
  }
228
- function Ot({ data: t }) {
229
- var m;
230
- const e = t, [a, n] = Z(!1), l = e.status === "root" ? "file-node--root" : e.status === "expanded" ? "file-node--expanded" : e.status === "loading" ? "file-node--loading" : e.status === "error" ? "file-node--error" : "file-node--collapsed", o = e.repoAlias ? "file-node--cross-repo" : "";
231
- return /* @__PURE__ */ c("div", { className: `file-node ${l} ${o}`, children: [
232
- !e.isRoot && /* @__PURE__ */ s(He, { type: "target", position: Ke.Top }),
233
- /* @__PURE__ */ c("div", { className: "file-node__header", children: [
234
- /* @__PURE__ */ s("span", { className: "file-node__icon", children: e.isRoot ? "📄" : e.status === "expanded" ? "📋" : e.repoAlias ? "🔗" : "📁" }),
235
- /* @__PURE__ */ s("span", { className: "file-node__label", title: e.filePath, children: e.label }),
236
- /* @__PURE__ */ s("span", { className: "file-node__actions", children: e.adoUrl && /* @__PURE__ */ s(
803
+ function ba({ data: e }) {
804
+ var d;
805
+ const t = e, [a, o] = L(!1), r = t.status === "root" ? "file-node--root" : t.status === "expanded" ? "file-node--expanded" : t.status === "loading" ? "file-node--loading" : t.status === "error" ? "file-node--error" : "file-node--collapsed", n = t.repoAlias ? "file-node--cross-repo" : "";
806
+ return /* @__PURE__ */ l("div", { className: `file-node ${r} ${n}`, children: [
807
+ !t.isRoot && /* @__PURE__ */ s(Ce, { type: "target", position: De.Top }),
808
+ /* @__PURE__ */ l("div", { className: "file-node__header", children: [
809
+ /* @__PURE__ */ s("span", { className: "file-node__icon", children: t.isRoot ? "📄" : t.status === "expanded" ? "📋" : t.repoAlias ? "🔗" : "📁" }),
810
+ /* @__PURE__ */ s("span", { className: "file-node__label", title: t.filePath, children: t.label }),
811
+ /* @__PURE__ */ s("span", { className: "file-node__actions", children: t.adoUrl && /* @__PURE__ */ s(
237
812
  "a",
238
813
  {
239
- href: e.adoUrl,
814
+ href: t.adoUrl,
240
815
  target: "_blank",
241
816
  rel: "noopener noreferrer",
242
817
  className: "file-node__action-btn",
243
818
  title: "Open in Azure DevOps",
244
- onClick: (P) => P.stopPropagation(),
245
- children: /* @__PURE__ */ s(Mt, {})
819
+ onClick: (m) => m.stopPropagation(),
820
+ children: /* @__PURE__ */ s(ya, {})
246
821
  }
247
822
  ) })
248
823
  ] }),
249
- e.repoAlias && /* @__PURE__ */ c(
824
+ t.repoAlias && /* @__PURE__ */ l(
250
825
  "div",
251
826
  {
252
827
  className: "file-node__repo-row",
253
- onMouseEnter: () => n(!0),
254
- onMouseLeave: () => n(!1),
828
+ onMouseEnter: () => o(!0),
829
+ onMouseLeave: () => o(!1),
255
830
  children: [
256
- /* @__PURE__ */ c("span", { className: "file-node__repo", children: [
831
+ /* @__PURE__ */ l("span", { className: "file-node__repo", children: [
257
832
  "@",
258
- e.repoAlias
833
+ t.repoAlias
259
834
  ] }),
260
- e.repoInfo && a && /* @__PURE__ */ c("div", { className: "file-node__repo-tooltip", children: [
261
- /* @__PURE__ */ c("div", { className: "file-node__repo-tooltip-row", children: [
835
+ t.repoInfo && a && /* @__PURE__ */ l("div", { className: "file-node__repo-tooltip", children: [
836
+ /* @__PURE__ */ l("div", { className: "file-node__repo-tooltip-row", children: [
262
837
  /* @__PURE__ */ s("span", { className: "file-node__repo-tooltip-label", children: "Repo" }),
263
- /* @__PURE__ */ s("span", { children: e.repoInfo.fullName })
838
+ /* @__PURE__ */ s("span", { children: t.repoInfo.fullName })
264
839
  ] }),
265
- /* @__PURE__ */ c("div", { className: "file-node__repo-tooltip-row", children: [
840
+ /* @__PURE__ */ l("div", { className: "file-node__repo-tooltip-row", children: [
266
841
  /* @__PURE__ */ s("span", { className: "file-node__repo-tooltip-label", children: "Type" }),
267
- /* @__PURE__ */ s("span", { children: e.repoInfo.type })
842
+ /* @__PURE__ */ s("span", { children: t.repoInfo.type })
268
843
  ] }),
269
- e.repoInfo.ref && /* @__PURE__ */ c("div", { className: "file-node__repo-tooltip-row", children: [
844
+ t.repoInfo.ref && /* @__PURE__ */ l("div", { className: "file-node__repo-tooltip-row", children: [
270
845
  /* @__PURE__ */ s("span", { className: "file-node__repo-tooltip-label", children: "Ref" }),
271
- /* @__PURE__ */ s("span", { children: e.repoInfo.ref })
846
+ /* @__PURE__ */ s("span", { children: t.repoInfo.ref })
272
847
  ] }),
273
- e.repoInfo.project && /* @__PURE__ */ c("div", { className: "file-node__repo-tooltip-row", children: [
848
+ t.repoInfo.project && /* @__PURE__ */ l("div", { className: "file-node__repo-tooltip-row", children: [
274
849
  /* @__PURE__ */ s("span", { className: "file-node__repo-tooltip-label", children: "Project" }),
275
- /* @__PURE__ */ s("span", { children: e.repoInfo.project })
850
+ /* @__PURE__ */ s("span", { children: t.repoInfo.project })
276
851
  ] })
277
852
  ] })
278
853
  ]
279
854
  }
280
855
  ),
281
- /* @__PURE__ */ c("div", { className: "file-node__meta", children: [
282
- e.status === "loading" && /* @__PURE__ */ s("span", { className: "file-node__spinner", children: "⏳ Loading..." }),
283
- e.status === "error" && /* @__PURE__ */ c("span", { className: "file-node__error", title: e.errorMessage, children: [
856
+ /* @__PURE__ */ l("div", { className: "file-node__meta", children: [
857
+ t.status === "loading" && /* @__PURE__ */ s("span", { className: "file-node__spinner", children: "⏳ Loading..." }),
858
+ t.status === "error" && /* @__PURE__ */ l("span", { className: "file-node__error", title: t.errorMessage, children: [
284
859
  "❌ ",
285
- (m = e.errorMessage) == null ? void 0 : m.slice(0, 80)
860
+ (d = t.errorMessage) == null ? void 0 : d.slice(0, 80)
286
861
  ] }),
287
- e.status === "collapsed" && /* @__PURE__ */ s("span", { className: "file-node__hint", children: "Click to expand" }),
288
- e.status === "expanded" && e.templateCount === 0 && !e.isRoot && /* @__PURE__ */ s("span", { className: "file-node__leaf", children: "✓ no nested templates" }),
289
- (e.status === "root" || e.status === "expanded") && e.templateCount > 0 && /* @__PURE__ */ c("span", { className: "file-node__count", children: [
290
- e.templateCount,
862
+ t.status === "collapsed" && /* @__PURE__ */ s("span", { className: "file-node__hint", children: "Click to expand" }),
863
+ t.status === "expanded" && t.templateCount === 0 && !t.isRoot && /* @__PURE__ */ s("span", { className: "file-node__leaf", children: "✓ no nested templates" }),
864
+ (t.status === "root" || t.status === "expanded") && t.templateCount > 0 && /* @__PURE__ */ l("span", { className: "file-node__count", children: [
865
+ t.templateCount,
291
866
  " template ref(s)"
292
867
  ] })
293
868
  ] }),
294
- /* @__PURE__ */ s(He, { type: "source", position: Ke.Bottom })
869
+ /* @__PURE__ */ s(Ce, { type: "source", position: De.Bottom })
295
870
  ] });
296
871
  }
297
- function Mt() {
872
+ function ya() {
298
873
  return /* @__PURE__ */ s(
299
874
  "svg",
300
875
  {
@@ -313,132 +888,132 @@ function Mt() {
313
888
  }
314
889
  );
315
890
  }
316
- const Bt = tt(Ot);
317
- function Le({
318
- className: t,
319
- label: e,
891
+ const wa = Qe(ba);
892
+ function qe({
893
+ className: e,
894
+ label: t,
320
895
  children: a
321
896
  }) {
322
- const [n, l] = Z(!1);
323
- return /* @__PURE__ */ c(
897
+ const [o, r] = L(!1);
898
+ return /* @__PURE__ */ l(
324
899
  "span",
325
900
  {
326
- className: t,
327
- onMouseEnter: () => l(!0),
328
- onMouseLeave: () => l(!1),
901
+ className: e,
902
+ onMouseEnter: () => r(!0),
903
+ onMouseLeave: () => r(!1),
329
904
  children: [
330
- e,
331
- n && /* @__PURE__ */ s("div", { className: "template-edge__badge-tooltip", children: a })
905
+ t,
906
+ o && /* @__PURE__ */ s("div", { className: "template-edge__badge-tooltip", children: a })
332
907
  ]
333
908
  }
334
909
  );
335
910
  }
336
- function Wt({
337
- id: t,
338
- sourceX: e,
911
+ function Pa({
912
+ id: e,
913
+ sourceX: t,
339
914
  sourceY: a,
340
- targetX: n,
341
- targetY: l,
342
- sourcePosition: o,
343
- targetPosition: m,
344
- data: P,
345
- markerEnd: v,
346
- style: d
915
+ targetX: o,
916
+ targetY: r,
917
+ sourcePosition: n,
918
+ targetPosition: d,
919
+ data: m,
920
+ markerEnd: u,
921
+ style: h
347
922
  }) {
348
- var _;
349
- const r = P, [y, g] = Z(!1), [i, R, S] = Rt({
350
- sourceX: e,
923
+ var P;
924
+ const i = m, [p, f] = L(!1), [c, N, E] = It({
925
+ sourceX: t,
351
926
  sourceY: a,
352
- sourcePosition: o,
353
- targetX: n,
354
- targetY: l,
355
- targetPosition: m
356
- }), h = fe(() => g(!0), []), N = fe(() => g(!1), []), b = ((_ = r == null ? void 0 : r.parameterNames) == null ? void 0 : _.length) ?? 0;
357
- return /* @__PURE__ */ c(et, { children: [
358
- /* @__PURE__ */ s(Et, { id: t, path: i, markerEnd: v, style: d }),
359
- /* @__PURE__ */ s(xt, { children: /* @__PURE__ */ c(
927
+ sourcePosition: n,
928
+ targetX: o,
929
+ targetY: r,
930
+ targetPosition: d
931
+ }), _ = ne(() => f(!0), []), y = ne(() => f(!1), []), w = ((P = i == null ? void 0 : i.parameterNames) == null ? void 0 : P.length) ?? 0;
932
+ return /* @__PURE__ */ l(Xe, { children: [
933
+ /* @__PURE__ */ s(Lt, { id: e, path: c, markerEnd: u, style: h }),
934
+ /* @__PURE__ */ s(Bt, { children: /* @__PURE__ */ l(
360
935
  "div",
361
936
  {
362
937
  className: "template-edge__label-container",
363
938
  style: {
364
939
  position: "absolute",
365
- transform: `translate(-50%, -50%) translate(${R}px,${S}px)`,
940
+ transform: `translate(-50%, -50%) translate(${N}px,${E}px)`,
366
941
  pointerEvents: "all"
367
942
  },
368
943
  children: [
369
- /* @__PURE__ */ c("div", { className: "template-edge__top-row", children: [
370
- /* @__PURE__ */ s("span", { className: "template-edge__category", children: r == null ? void 0 : r.edgeLabel }),
371
- (r == null ? void 0 : r.conditional) && /* @__PURE__ */ c(
372
- Le,
944
+ /* @__PURE__ */ l("div", { className: "template-edge__top-row", children: [
945
+ /* @__PURE__ */ s("span", { className: "template-edge__category", children: i == null ? void 0 : i.edgeLabel }),
946
+ (i == null ? void 0 : i.conditional) && /* @__PURE__ */ l(
947
+ qe,
373
948
  {
374
- className: `template-edge__badge template-edge__badge--conditional${r.conditionResult === !1 ? " template-edge__badge--condition-false" : r.conditionResult === !0 ? " template-edge__badge--condition-true" : ""}`,
375
- label: r.conditionResult === !1 ? "⊘ false" : r.conditionResult === !0 ? "✓ conditional" : "conditional",
949
+ className: `template-edge__badge template-edge__badge--conditional${i.conditionResult === !1 ? " template-edge__badge--condition-false" : i.conditionResult === !0 ? " template-edge__badge--condition-true" : ""}`,
950
+ label: i.conditionResult === !1 ? "⊘ false" : i.conditionResult === !0 ? "✓ conditional" : "conditional",
376
951
  children: [
377
952
  /* @__PURE__ */ s("div", { className: "template-edge__badge-tooltip-title", children: "⚡ Conditional Reference" }),
378
- /* @__PURE__ */ s("p", { children: r.conditionResult === !0 ? "Condition evaluated to true — this template will be included." : r.conditionResult === !1 ? "Condition evaluated to false — this template will NOT be included in this pipeline run." : "This template is inside a conditional block. The condition could not be fully evaluated." }),
379
- r.conditionExpression && /* @__PURE__ */ c("div", { className: "template-edge__badge-tooltip-row", children: [
953
+ /* @__PURE__ */ s("p", { children: i.conditionResult === !0 ? "Condition evaluated to true — this template will be included." : i.conditionResult === !1 ? "Condition evaluated to false — this template will NOT be included in this pipeline run." : "This template is inside a conditional block. The condition could not be fully evaluated." }),
954
+ i.conditionExpression && /* @__PURE__ */ l("div", { className: "template-edge__badge-tooltip-row", children: [
380
955
  /* @__PURE__ */ s("span", { className: "template-edge__badge-tooltip-label", children: "Condition" }),
381
- /* @__PURE__ */ s("code", { children: r.conditionExpression })
956
+ /* @__PURE__ */ s("code", { children: i.conditionExpression })
382
957
  ] }),
383
- r.conditionResult != null && /* @__PURE__ */ c("div", { className: "template-edge__badge-tooltip-row", children: [
958
+ i.conditionResult != null && /* @__PURE__ */ l("div", { className: "template-edge__badge-tooltip-row", children: [
384
959
  /* @__PURE__ */ s("span", { className: "template-edge__badge-tooltip-label", children: "Result" }),
385
- /* @__PURE__ */ s("code", { children: String(r.conditionResult) })
960
+ /* @__PURE__ */ s("code", { children: String(i.conditionResult) })
386
961
  ] })
387
962
  ]
388
963
  }
389
964
  ),
390
- (r == null ? void 0 : r.dynamicPath) && r.expressionResolved && /* @__PURE__ */ c(
391
- Le,
965
+ (i == null ? void 0 : i.dynamicPath) && i.expressionResolved && /* @__PURE__ */ l(
966
+ qe,
392
967
  {
393
968
  className: "template-edge__badge template-edge__badge--resolved",
394
969
  label: "🔮 resolved",
395
970
  children: [
396
971
  /* @__PURE__ */ s("div", { className: "template-edge__badge-tooltip-title", children: "🔮 Expression Resolved" }),
397
972
  /* @__PURE__ */ s("p", { children: "The template path contained expressions that were successfully evaluated." }),
398
- /* @__PURE__ */ c("div", { className: "template-edge__badge-tooltip-row", children: [
973
+ /* @__PURE__ */ l("div", { className: "template-edge__badge-tooltip-row", children: [
399
974
  /* @__PURE__ */ s("span", { className: "template-edge__badge-tooltip-label", children: "Original" }),
400
- /* @__PURE__ */ s("code", { children: r.originalPath })
975
+ /* @__PURE__ */ s("code", { children: i.originalPath })
401
976
  ] }),
402
- r.resolvedPath && /* @__PURE__ */ c("div", { className: "template-edge__badge-tooltip-row", children: [
977
+ i.resolvedPath && /* @__PURE__ */ l("div", { className: "template-edge__badge-tooltip-row", children: [
403
978
  /* @__PURE__ */ s("span", { className: "template-edge__badge-tooltip-label", children: "Resolved" }),
404
- /* @__PURE__ */ s("code", { children: r.resolvedPath })
979
+ /* @__PURE__ */ s("code", { children: i.resolvedPath })
405
980
  ] })
406
981
  ]
407
982
  }
408
983
  ),
409
- (r == null ? void 0 : r.dynamicPath) && !r.expressionResolved && /* @__PURE__ */ c(
410
- Le,
984
+ (i == null ? void 0 : i.dynamicPath) && !i.expressionResolved && /* @__PURE__ */ l(
985
+ qe,
411
986
  {
412
987
  className: "template-edge__badge template-edge__badge--unresolved",
413
988
  label: "⚠️ dynamic",
414
989
  children: [
415
990
  /* @__PURE__ */ s("div", { className: "template-edge__badge-tooltip-title", children: "⚠️ Unresolved Expressions" }),
416
991
  /* @__PURE__ */ s("p", { children: "The template path contains expressions that could not be evaluated at analysis time." }),
417
- /* @__PURE__ */ c("div", { className: "template-edge__badge-tooltip-row", children: [
992
+ /* @__PURE__ */ l("div", { className: "template-edge__badge-tooltip-row", children: [
418
993
  /* @__PURE__ */ s("span", { className: "template-edge__badge-tooltip-label", children: "Original" }),
419
- /* @__PURE__ */ s("code", { children: r.originalPath })
994
+ /* @__PURE__ */ s("code", { children: i.originalPath })
420
995
  ] }),
421
- r.resolvedPath && r.resolvedPath !== r.originalPath && /* @__PURE__ */ c("div", { className: "template-edge__badge-tooltip-row", children: [
996
+ i.resolvedPath && i.resolvedPath !== i.originalPath && /* @__PURE__ */ l("div", { className: "template-edge__badge-tooltip-row", children: [
422
997
  /* @__PURE__ */ s("span", { className: "template-edge__badge-tooltip-label", children: "Partial" }),
423
- /* @__PURE__ */ s("code", { children: r.resolvedPath })
998
+ /* @__PURE__ */ s("code", { children: i.resolvedPath })
424
999
  ] }),
425
- r.unresolvedExpressions && r.unresolvedExpressions.length > 0 && /* @__PURE__ */ c("div", { className: "template-edge__badge-tooltip-row", children: [
1000
+ i.unresolvedExpressions && i.unresolvedExpressions.length > 0 && /* @__PURE__ */ l("div", { className: "template-edge__badge-tooltip-row", children: [
426
1001
  /* @__PURE__ */ s("span", { className: "template-edge__badge-tooltip-label", children: "Unresolved" }),
427
- /* @__PURE__ */ s("span", { children: r.unresolvedExpressions.join(", ") })
1002
+ /* @__PURE__ */ s("span", { children: i.unresolvedExpressions.join(", ") })
428
1003
  ] })
429
1004
  ]
430
1005
  }
431
1006
  )
432
1007
  ] }),
433
- b > 0 && /* @__PURE__ */ c(
1008
+ w > 0 && /* @__PURE__ */ l(
434
1009
  "span",
435
1010
  {
436
1011
  className: "template-edge__params-badge",
437
- onMouseEnter: h,
438
- onMouseLeave: N,
1012
+ onMouseEnter: _,
1013
+ onMouseLeave: y,
439
1014
  children: [
440
- jt(r),
441
- y && /* @__PURE__ */ s(Ht, { data: r })
1015
+ Ea(i),
1016
+ p && /* @__PURE__ */ s(Ra, { data: i })
442
1017
  ]
443
1018
  }
444
1019
  )
@@ -447,539 +1022,539 @@ function Wt({
447
1022
  ) })
448
1023
  ] });
449
1024
  }
450
- function jt(t) {
1025
+ function Ea(e) {
451
1026
  var a;
452
- const e = ((a = t.parameterNames) == null ? void 0 : a.length) ?? 0;
453
- return t.totalParameterCount != null ? `${e}/${t.totalParameterCount} params` : `${e} params`;
1027
+ const t = ((a = e.parameterNames) == null ? void 0 : a.length) ?? 0;
1028
+ return e.totalParameterCount != null ? `${t}/${e.totalParameterCount} params` : `${t} params`;
454
1029
  }
455
- function Ht({ data: t }) {
456
- var a, n;
457
- const e = (a = t.declaredParameterNames) == null ? void 0 : a.filter(
458
- (l) => {
459
- var o;
460
- return !((o = t.parameterNames) != null && o.includes(l));
1030
+ function Ra({ data: e }) {
1031
+ var a, o;
1032
+ const t = (a = e.declaredParameterNames) == null ? void 0 : a.filter(
1033
+ (r) => {
1034
+ var n;
1035
+ return !((n = e.parameterNames) != null && n.includes(r));
461
1036
  }
462
1037
  );
463
- return /* @__PURE__ */ c("div", { className: "template-edge__params-tooltip", children: [
464
- t.parameterNames && t.parameterNames.length > 0 && /* @__PURE__ */ c("div", { className: "template-edge__params-section", children: [
465
- /* @__PURE__ */ c("div", { className: "template-edge__params-heading", children: [
1038
+ return /* @__PURE__ */ l("div", { className: "template-edge__params-tooltip", children: [
1039
+ e.parameterNames && e.parameterNames.length > 0 && /* @__PURE__ */ l("div", { className: "template-edge__params-section", children: [
1040
+ /* @__PURE__ */ l("div", { className: "template-edge__params-heading", children: [
466
1041
  "✓ Passed (",
467
- t.parameterNames.length,
1042
+ e.parameterNames.length,
468
1043
  ")"
469
1044
  ] }),
470
- /* @__PURE__ */ s("ul", { className: "template-edge__params-list", children: t.parameterNames.map((l) => /* @__PURE__ */ s(
1045
+ /* @__PURE__ */ s("ul", { className: "template-edge__params-list", children: e.parameterNames.map((r) => /* @__PURE__ */ s(
471
1046
  "li",
472
1047
  {
473
1048
  className: "template-edge__params-item template-edge__params-item--passed",
474
- children: l
1049
+ children: r
475
1050
  },
476
- l
1051
+ r
477
1052
  )) })
478
1053
  ] }),
479
- e && e.length > 0 && /* @__PURE__ */ c("div", { className: "template-edge__params-section", children: [
480
- /* @__PURE__ */ c("div", { className: "template-edge__params-heading", children: [
1054
+ t && t.length > 0 && /* @__PURE__ */ l("div", { className: "template-edge__params-section", children: [
1055
+ /* @__PURE__ */ l("div", { className: "template-edge__params-heading", children: [
481
1056
  "○ Not passed (",
482
- e.length,
1057
+ t.length,
483
1058
  ")"
484
1059
  ] }),
485
- /* @__PURE__ */ s("ul", { className: "template-edge__params-list", children: e.map((l) => /* @__PURE__ */ s(
1060
+ /* @__PURE__ */ s("ul", { className: "template-edge__params-list", children: t.map((r) => /* @__PURE__ */ s(
486
1061
  "li",
487
1062
  {
488
1063
  className: "template-edge__params-item template-edge__params-item--missing",
489
- children: l
1064
+ children: r
490
1065
  },
491
- l
1066
+ r
492
1067
  )) })
493
1068
  ] }),
494
- t.totalParameterCount == null && !((n = t.declaredParameterNames) != null && n.length) && /* @__PURE__ */ s("div", { className: "template-edge__params-hint", children: "Expand node to see all declared params" })
1069
+ e.totalParameterCount == null && !((o = e.declaredParameterNames) != null && o.length) && /* @__PURE__ */ s("div", { className: "template-edge__params-hint", children: "Expand node to see all declared params" })
495
1070
  ] });
496
1071
  }
497
- const Kt = tt(Wt), Yt = { fileNode: Bt }, Xt = { templateEdge: Kt }, Gt = {
1072
+ const xa = Qe(Pa), ka = { fileNode: wa }, Ta = { templateEdge: xa }, $a = {
498
1073
  animated: !0,
499
1074
  style: { stroke: "var(--accent)", strokeWidth: 2 },
500
- markerEnd: { type: xe.ArrowClosed, color: "var(--accent)" }
1075
+ markerEnd: { type: Ae.ArrowClosed, color: "var(--accent)" }
501
1076
  };
502
- function qt() {
503
- var le, ve;
1077
+ function Sa() {
1078
+ var le, be;
504
1079
  const {
505
- org: t,
506
- project: e,
1080
+ org: e,
1081
+ project: t,
507
1082
  selectedPipeline: a,
508
- selectedPipelineLoading: n,
509
- selectedPipelineError: l,
510
- expandedTemplates: o,
511
- setExpandedTemplate: m,
512
- setSelectedNodeDetail: P
513
- } = Te(), v = zt(), [d, r, y] = kt([]), [g, i, R] = At([]), S = te(null), h = te(null), N = te(""), b = te([]);
514
- oe(() => {
515
- b.current = g;
516
- }, [g]);
517
- const [_, L] = Z(/* @__PURE__ */ new Set()), x = te(/* @__PURE__ */ new Set()), [k, ae] = Z(!1), $ = ((ve = (le = a == null ? void 0 : a.definition) == null ? void 0 : le.repository) == null ? void 0 : ve.name) ?? "", z = ze(() => {
1083
+ selectedPipelineLoading: o,
1084
+ selectedPipelineError: r,
1085
+ expandedTemplates: n,
1086
+ setExpandedTemplate: d,
1087
+ setSelectedNodeDetail: m
1088
+ } = Ve(), u = Na(), [h, i, p] = dt([]), [f, c, N] = pt([]), E = Q(null), _ = Q(null), y = Q(""), w = Q([]);
1089
+ ee(() => {
1090
+ w.current = f;
1091
+ }, [f]);
1092
+ const [P, F] = L(/* @__PURE__ */ new Set()), k = Q(/* @__PURE__ */ new Set()), [T, se] = L(!1), C = ((be = (le = a == null ? void 0 : a.definition) == null ? void 0 : le.repository) == null ? void 0 : be.name) ?? "", M = ve(() => {
518
1093
  if (!(a != null && a.yaml)) return [];
519
1094
  try {
520
- const f = pe(a.yaml), p = f == null ? void 0 : f.resources;
521
- return (p == null ? void 0 : p.repositories) ?? [];
1095
+ const b = ue(a.yaml), g = b == null ? void 0 : b.resources;
1096
+ return (g == null ? void 0 : g.repositories) ?? [];
522
1097
  } catch {
523
1098
  return [];
524
1099
  }
525
- }, [a == null ? void 0 : a.yaml]), H = ze(() => {
1100
+ }, [a == null ? void 0 : a.yaml]), G = ve(() => {
526
1101
  if (!(a != null && a.yaml)) return {};
527
1102
  try {
528
- const f = pe(a.yaml);
529
- return Pe(f ?? {});
1103
+ const b = ue(a.yaml);
1104
+ return Pe(b ?? {});
530
1105
  } catch {
531
1106
  return {};
532
1107
  }
533
1108
  }, [a == null ? void 0 : a.yaml]);
534
- oe(() => {
535
- var w, F, B, ie, ce, de, ne;
1109
+ ee(() => {
1110
+ var R, B, z, ce, de, pe, oe;
536
1111
  if (!(a != null && a.yaml)) {
537
- r([]), i([]);
1112
+ i([]), c([]);
538
1113
  return;
539
1114
  }
540
- const f = pe(a.yaml), p = ((w = a.definition) == null ? void 0 : w.path) ?? "", u = Se(f ?? {}, { sourcePath: p }), E = ((F = a.definition) == null ? void 0 : F.name) ?? p.split("/").pop() ?? "Pipeline", A = Ae(p), D = De(f ?? {}), C = ((ie = (B = a.definition) == null ? void 0 : B.repository) == null ? void 0 : ie.name) ?? "", W = (ne = (de = (ce = a.definition) == null ? void 0 : ce.repository) == null ? void 0 : de.defaultBranch) == null ? void 0 : ne.replace(
1115
+ const b = ue(a.yaml), g = ((R = a.definition) == null ? void 0 : R.path) ?? "", v = je(b ?? {}, { sourcePath: g }), x = ((B = a.definition) == null ? void 0 : B.name) ?? g.split("/").pop() ?? "Pipeline", $ = Le(g), A = ze(b ?? {}), D = ((ce = (z = a.definition) == null ? void 0 : z.repository) == null ? void 0 : ce.name) ?? "", W = (oe = (pe = (de = a.definition) == null ? void 0 : de.repository) == null ? void 0 : pe.defaultBranch) == null ? void 0 : oe.replace(
541
1116
  /^refs\/heads\//,
542
1117
  ""
543
- ), I = t && e && C ? at({
544
- org: t,
545
- project: e,
546
- repoName: C,
547
- filePath: p,
1118
+ ), I = e && t && D ? it({
1119
+ org: e,
1120
+ project: t,
1121
+ repoName: D,
1122
+ filePath: g,
548
1123
  branch: W
549
- }) : void 0, Q = {
1124
+ }) : void 0, te = {
550
1125
  id: "root",
551
1126
  type: "fileNode",
552
1127
  position: { x: 0, y: 0 },
553
1128
  data: {
554
- label: E,
555
- filePath: p,
556
- templateCount: u.length,
1129
+ label: x,
1130
+ filePath: g,
1131
+ templateCount: v.length,
557
1132
  status: "root",
558
1133
  isRoot: !0,
559
- baseDir: A,
1134
+ baseDir: $,
560
1135
  adoUrl: I
561
1136
  }
562
- }, { templateNodes: j, templateEdges: J } = Ue(
1137
+ }, { templateNodes: H, templateEdges: Z } = Ye(
563
1138
  "root",
564
- u,
565
- t,
1139
+ v,
566
1140
  e,
567
- $,
568
- z,
569
- D,
1141
+ t,
1142
+ C,
1143
+ M,
1144
+ A,
570
1145
  void 0,
571
1146
  // existingNodeIds
572
- H
573
- ), Y = [Q, ...j], ee = [...J], { nodes: O, edges: U } = Fe(
574
- Y,
575
- ee
1147
+ G
1148
+ ), q = [te, ...H], ae = [...Z], { nodes: O, edges: U } = Ke(
1149
+ q,
1150
+ ae
576
1151
  );
577
- r(O), i(U), x.current = /* @__PURE__ */ new Set();
578
- }, [a, r, i]);
579
- const me = te(!1);
580
- oe(() => {
581
- if (!k || !S.current || d.length === 0) return;
582
- const f = `${d.length}:${g.length}`;
583
- if (f !== N.current)
584
- return N.current = f, h.current != null && cancelAnimationFrame(h.current), h.current = requestAnimationFrame(() => {
585
- var p;
586
- (p = S.current) == null || p.fitView({
1152
+ i(O), c(U), k.current = /* @__PURE__ */ new Set();
1153
+ }, [a, i, c]);
1154
+ const fe = Q(!1);
1155
+ ee(() => {
1156
+ if (!T || !E.current || h.length === 0) return;
1157
+ const b = `${h.length}:${f.length}`;
1158
+ if (b !== y.current)
1159
+ return y.current = b, _.current != null && cancelAnimationFrame(_.current), _.current = requestAnimationFrame(() => {
1160
+ var g;
1161
+ (g = E.current) == null || g.fitView({
587
1162
  padding: 0.2,
588
1163
  duration: 300
589
- }), h.current = null;
1164
+ }), _.current = null;
590
1165
  }), () => {
591
- h.current != null && (cancelAnimationFrame(h.current), h.current = null);
1166
+ _.current != null && (cancelAnimationFrame(_.current), _.current = null);
592
1167
  };
593
- }, [k, d.length, g.length]), oe(() => {
594
- if (me.current) return;
595
- const f = d.filter((p) => {
596
- const u = p.data;
597
- if (u.status !== "collapsed" || x.current.has(p.id) || _.has(p.id)) return !1;
598
- const E = u._conditionResult;
599
- return !(E === !1 || E === "unknown" && !k);
1168
+ }, [T, h.length, f.length]), ee(() => {
1169
+ if (fe.current) return;
1170
+ const b = h.filter((g) => {
1171
+ const v = g.data;
1172
+ if (v.status !== "collapsed" || k.current.has(g.id) || P.has(g.id)) return !1;
1173
+ const x = v._conditionResult;
1174
+ return !(x === !1 || x === "unknown" && !T);
600
1175
  });
601
- if (f.length !== 0) {
602
- f.sort((p, u) => {
603
- const E = p.data.templateLocation === "variables" ? 0 : 1, A = u.data.templateLocation === "variables" ? 0 : 1;
604
- return E - A;
1176
+ if (b.length !== 0) {
1177
+ b.sort((g, v) => {
1178
+ const x = g.data.templateLocation === "variables" ? 0 : 1, $ = v.data.templateLocation === "variables" ? 0 : 1;
1179
+ return x - $;
605
1180
  });
606
- for (const p of f) {
607
- const u = p.data;
608
- u.dynamicPath && !u.expressionResolved || x.current.add(p.id);
1181
+ for (const g of b) {
1182
+ const v = g.data;
1183
+ v.dynamicPath && !v.expressionResolved || k.current.add(g.id);
609
1184
  }
610
- me.current = !0, (async () => {
611
- for (const p of f) {
612
- const u = p.data;
613
- if (!(u.dynamicPath && !u.expressionResolved))
1185
+ fe.current = !0, (async () => {
1186
+ for (const g of b) {
1187
+ const v = g.data;
1188
+ if (!(v.dynamicPath && !v.expressionResolved))
614
1189
  try {
615
- const { content: E, actualPath: A } = await Ve(
616
- t,
1190
+ const { content: x, actualPath: $ } = await Je(
617
1191
  e,
618
- $,
619
- u,
620
- z,
621
- o,
622
- m,
623
- v
624
- ), D = pe(E) ?? {}, C = u._ref, W = Se(D, {
625
- contextRepoAlias: re(C ?? {}),
626
- sourcePath: A
627
- }), I = je(D);
1192
+ t,
1193
+ C,
1194
+ v,
1195
+ M,
1196
+ n,
1197
+ d,
1198
+ u
1199
+ ), A = ue(x) ?? {}, D = v._ref, W = je(A, {
1200
+ contextRepoAlias: ie(D ?? {}),
1201
+ sourcePath: $
1202
+ }), I = et(A);
628
1203
  if (W.length === 0) {
629
- const j = u.templateLocation === "variables" ? Pe(D) : void 0, J = j && Object.keys(j).length > 0, Y = /* @__PURE__ */ new Set(), ee = /* @__PURE__ */ new Set(), O = /* @__PURE__ */ new Map();
630
- if (J)
631
- for (const U of d) {
632
- const w = U.data;
633
- if (w.dynamicPath && !w.expressionResolved) {
634
- const F = we(
1204
+ const H = v.templateLocation === "variables" ? Pe(A) : void 0, Z = H && Object.keys(H).length > 0, q = /* @__PURE__ */ new Set(), ae = /* @__PURE__ */ new Set(), O = /* @__PURE__ */ new Map();
1205
+ if (Z)
1206
+ for (const U of h) {
1207
+ const R = U.data;
1208
+ if (R.dynamicPath && !R.expressionResolved) {
1209
+ const B = ke(
635
1210
  U,
636
- j,
637
- t,
1211
+ H,
638
1212
  e,
639
- $,
640
- z
1213
+ t,
1214
+ C,
1215
+ M
641
1216
  );
642
- if (F !== U) {
643
- Y.add(U.id);
644
- const B = F.data;
645
- B.repoAlias && ee.add(U.id), O.set(U.id, B.filePath);
1217
+ if (B !== U) {
1218
+ q.add(U.id);
1219
+ const z = B.data;
1220
+ z.repoAlias && ae.add(U.id), O.set(U.id, z.filePath);
646
1221
  }
647
1222
  }
648
1223
  }
649
- r(
650
- (U) => U.map((w) => w.id === p.id ? {
651
- ...w,
1224
+ i(
1225
+ (U) => U.map((R) => R.id === g.id ? {
1226
+ ...R,
652
1227
  data: {
653
- ...w.data,
1228
+ ...R.data,
654
1229
  status: "expanded",
655
1230
  templateCount: 0,
656
1231
  totalParameterCount: I.length || void 0,
657
1232
  declaredParameterNames: I.length ? I : void 0
658
1233
  }
659
- } : J && Y.has(w.id) ? we(
660
- w,
661
- j,
662
- t,
1234
+ } : Z && q.has(R.id) ? ke(
1235
+ R,
1236
+ H,
663
1237
  e,
664
- $,
665
- z
666
- ) : w)
667
- ), Y.size > 0 && i(
668
- (U) => U.map((w) => {
669
- if (!Y.has(w.target)) return w;
670
- const F = w.data;
671
- if (!(F != null && F.dynamicPath)) return w;
672
- const B = ee.has(w.target);
1238
+ t,
1239
+ C,
1240
+ M
1241
+ ) : R)
1242
+ ), q.size > 0 && c(
1243
+ (U) => U.map((R) => {
1244
+ if (!q.has(R.target)) return R;
1245
+ const B = R.data;
1246
+ if (!(B != null && B.dynamicPath)) return R;
1247
+ const z = ae.has(R.target);
673
1248
  return {
674
- ...w,
1249
+ ...R,
675
1250
  data: {
676
- ...F,
1251
+ ...B,
677
1252
  expressionResolved: !0,
678
- isExternal: B || F.isExternal || void 0,
679
- resolvedPath: O.get(w.target) ?? F.resolvedPath,
1253
+ isExternal: z || B.isExternal || void 0,
1254
+ resolvedPath: O.get(R.target) ?? B.resolvedPath,
680
1255
  unresolvedExpressions: void 0
681
1256
  },
682
- style: B ? {
1257
+ style: z ? {
683
1258
  stroke: "var(--badge-resources)",
684
1259
  strokeWidth: 2,
685
1260
  strokeDasharray: "6 3"
686
- } : w.style,
687
- markerEnd: B ? {
688
- type: xe.ArrowClosed,
1261
+ } : R.style,
1262
+ markerEnd: z ? {
1263
+ type: Ae.ArrowClosed,
689
1264
  color: "var(--badge-resources)"
690
- } : w.markerEnd
1265
+ } : R.markerEnd
691
1266
  };
692
1267
  })
693
1268
  );
694
- } else if (k) {
695
- const Q = De(D), j = u._parentParamContext, J = u._accumulatedVariables, Y = C == null ? void 0 : C.parameters, ee = ke(
696
- Y,
697
- j,
698
- J
699
- ), O = { ...Q, ...ee }, U = Pe(D), w = {
700
- ...J ?? H,
1269
+ } else if (T) {
1270
+ const te = ze(A), H = v._parentParamContext, Z = v._accumulatedVariables, q = D == null ? void 0 : D.parameters, ae = Ie(
1271
+ q,
1272
+ H,
1273
+ Z
1274
+ ), O = { ...te, ...ae }, U = Pe(A), R = {
1275
+ ...Z ?? G,
701
1276
  ...U
702
- }, F = u._accumulatedResources, B = qe(D), ie = Je([
703
- ...F ?? z,
704
- ...B
1277
+ }, B = v._accumulatedResources, z = nt(A), ce = st([
1278
+ ...B ?? M,
1279
+ ...z
705
1280
  ]);
706
- await new Promise((M) => setTimeout(M, 0));
707
- const ce = new Set(d.map((M) => M.id)), { templateNodes: de, templateEdges: ne } = Ue(
708
- p.id,
1281
+ await new Promise((j) => setTimeout(j, 0));
1282
+ const de = new Set(h.map((j) => j.id)), { templateNodes: pe, templateEdges: oe } = Ye(
1283
+ g.id,
709
1284
  W,
710
- t,
711
1285
  e,
712
- $,
713
- ie,
714
- O,
1286
+ t,
1287
+ C,
715
1288
  ce,
716
- w
1289
+ O,
1290
+ de,
1291
+ R
717
1292
  );
718
- r((M) => {
719
- const se = new Set(M.map((T) => T.id)), ye = de.filter(
720
- (T) => !se.has(T.id)
721
- ), Ne = [...M.map(
722
- (T) => T.id === p.id ? {
723
- ...T,
1293
+ i((j) => {
1294
+ const re = new Set(j.map((S) => S.id)), ye = pe.filter(
1295
+ (S) => !re.has(S.id)
1296
+ ), we = [...j.map(
1297
+ (S) => S.id === g.id ? {
1298
+ ...S,
724
1299
  data: {
725
- ...T.data,
1300
+ ...S.data,
726
1301
  status: "expanded",
727
1302
  templateCount: W.length,
728
1303
  totalParameterCount: I.length || void 0,
729
1304
  declaredParameterNames: I.length ? I : void 0
730
1305
  }
731
- } : T
732
- ), ...ye], X = [...I.length ? be(
733
- b.current,
734
- p.id,
1306
+ } : S
1307
+ ), ...ye], Y = [...I.length ? xe(
1308
+ w.current,
1309
+ g.id,
735
1310
  I
736
- ) : b.current, ...ne];
737
- return Fe(Ne, X).nodes;
738
- }), i((M) => [...I.length ? be(
739
- M,
740
- p.id,
1311
+ ) : w.current, ...oe];
1312
+ return Ke(we, Y).nodes;
1313
+ }), c((j) => [...I.length ? xe(
1314
+ j,
1315
+ g.id,
741
1316
  I
742
- ) : M, ...ne]), await new Promise((M) => setTimeout(M, 50));
1317
+ ) : j, ...oe]), await new Promise((j) => setTimeout(j, 50));
743
1318
  }
744
1319
  } catch {
745
1320
  }
746
1321
  }
747
- me.current = !1, k && r((p) => [...p]);
1322
+ fe.current = !1, T && i((g) => [...g]);
748
1323
  })();
749
1324
  }
750
1325
  }, [
751
- d,
752
- t,
1326
+ h,
753
1327
  e,
754
- $,
755
- z,
756
- o,
757
- m,
758
- _,
759
- r,
1328
+ t,
1329
+ C,
1330
+ M,
1331
+ n,
1332
+ d,
1333
+ P,
760
1334
  i,
761
- k,
762
- v
1335
+ c,
1336
+ T,
1337
+ u
763
1338
  ]);
764
- const K = fe(
765
- async (f, p) => {
766
- const u = p.data;
767
- if (u.status === "root" && (a != null && a.yaml)) {
768
- P({
769
- nodeId: p.id,
770
- label: u.label,
771
- filePath: u.filePath,
1339
+ const K = ne(
1340
+ async (b, g) => {
1341
+ const v = g.data;
1342
+ if (v.status === "root" && (a != null && a.yaml)) {
1343
+ m({
1344
+ nodeId: g.id,
1345
+ label: v.label,
1346
+ filePath: v.filePath,
772
1347
  yaml: a.yaml
773
1348
  });
774
1349
  return;
775
1350
  }
776
- if (u.status === "expanded") {
777
- const E = u._ref, A = re(E ?? {}) || "", D = `${A}:${u.filePath}`, C = u._fallbackPath, W = C ? `${A}:${C}` : void 0, I = o.get(D) ?? (W ? o.get(W) : void 0);
1351
+ if (v.status === "expanded") {
1352
+ const x = v._ref, $ = ie(x ?? {}) || "", A = `${$}:${v.filePath}`, D = v._fallbackPath, W = D ? `${$}:${D}` : void 0, I = n.get(A) ?? (W ? n.get(W) : void 0);
778
1353
  if (I) {
779
- P({
780
- nodeId: p.id,
781
- label: u.label,
782
- filePath: u.filePath,
1354
+ m({
1355
+ nodeId: g.id,
1356
+ label: v.label,
1357
+ filePath: v.filePath,
783
1358
  yaml: I,
784
- repoAlias: u.repoAlias
1359
+ repoAlias: v.repoAlias
785
1360
  });
786
1361
  return;
787
1362
  }
788
1363
  try {
789
- const { content: Q } = await Ve(
790
- t,
1364
+ const { content: te } = await Je(
791
1365
  e,
792
- $,
793
- u,
794
- z,
795
- o,
796
- m,
797
- v
1366
+ t,
1367
+ C,
1368
+ v,
1369
+ M,
1370
+ n,
1371
+ d,
1372
+ u
798
1373
  );
799
- P({
800
- nodeId: p.id,
801
- label: u.label,
802
- filePath: u.filePath,
803
- yaml: Q,
804
- repoAlias: u.repoAlias
1374
+ m({
1375
+ nodeId: g.id,
1376
+ label: v.label,
1377
+ filePath: v.filePath,
1378
+ yaml: te,
1379
+ repoAlias: v.repoAlias
805
1380
  });
806
1381
  } catch {
807
1382
  }
808
1383
  return;
809
1384
  }
810
- if (u.status === "collapsed" && !_.has(p.id)) {
811
- L((E) => new Set(E).add(p.id)), r(
812
- (E) => E.map(
813
- (A) => A.id === p.id ? { ...A, data: { ...A.data, status: "loading" } } : A
1385
+ if (v.status === "collapsed" && !P.has(g.id)) {
1386
+ F((x) => new Set(x).add(g.id)), i(
1387
+ (x) => x.map(
1388
+ ($) => $.id === g.id ? { ...$, data: { ...$.data, status: "loading" } } : $
814
1389
  )
815
1390
  );
816
1391
  try {
817
- const { content: E, actualPath: A } = await Ve(
818
- t,
1392
+ const { content: x, actualPath: $ } = await Je(
819
1393
  e,
820
- $,
821
- u,
822
- z,
823
- o,
824
- m,
825
- v
826
- ), D = pe(E) ?? {}, C = u._ref, W = Se(D, {
827
- contextRepoAlias: re(C ?? {}),
828
- sourcePath: A
829
- }), I = De(D), Q = u._parentParamContext, j = u._accumulatedVariables, J = C == null ? void 0 : C.parameters, Y = ke(
830
- J,
831
- Q,
832
- j
833
- ), ee = { ...I, ...Y }, O = je(D), U = Ae(A), w = Pe(D), F = {
834
- ...j ?? H,
835
- ...w
836
- }, B = u._accumulatedResources, ie = qe(D), ce = Je([
837
- ...B ?? z,
838
- ...ie
839
- ]), de = new Set(d.map((V) => V.id)), { templateNodes: ne, templateEdges: M } = Ue(
840
- p.id,
841
- W,
842
1394
  t,
1395
+ C,
1396
+ v,
1397
+ M,
1398
+ n,
1399
+ d,
1400
+ u
1401
+ ), A = ue(x) ?? {}, D = v._ref, W = je(A, {
1402
+ contextRepoAlias: ie(D ?? {}),
1403
+ sourcePath: $
1404
+ }), I = ze(A), te = v._parentParamContext, H = v._accumulatedVariables, Z = D == null ? void 0 : D.parameters, q = Ie(
1405
+ Z,
1406
+ te,
1407
+ H
1408
+ ), ae = { ...I, ...q }, O = et(A), U = Le($), R = Pe(A), B = {
1409
+ ...H ?? G,
1410
+ ...R
1411
+ }, z = v._accumulatedResources, ce = nt(A), de = st([
1412
+ ...z ?? M,
1413
+ ...ce
1414
+ ]), pe = new Set(h.map((V) => V.id)), { templateNodes: oe, templateEdges: j } = Ye(
1415
+ g.id,
1416
+ W,
843
1417
  e,
844
- $,
845
- ce,
846
- ee,
1418
+ t,
1419
+ C,
847
1420
  de,
848
- F
849
- ), se = /* @__PURE__ */ new Set(), ye = /* @__PURE__ */ new Set(), Ce = /* @__PURE__ */ new Map(), Ne = u.templateLocation === "variables" && Object.keys(w).length > 0;
850
- if (Ne)
851
- for (const V of d) {
852
- const X = V.data;
853
- if (X.dynamicPath && !X.expressionResolved) {
854
- const T = we(
1421
+ ae,
1422
+ pe,
1423
+ B
1424
+ ), re = /* @__PURE__ */ new Set(), ye = /* @__PURE__ */ new Set(), Oe = /* @__PURE__ */ new Map(), we = v.templateLocation === "variables" && Object.keys(R).length > 0;
1425
+ if (we)
1426
+ for (const V of h) {
1427
+ const Y = V.data;
1428
+ if (Y.dynamicPath && !Y.expressionResolved) {
1429
+ const S = ke(
855
1430
  V,
856
- w,
857
- t,
1431
+ R,
858
1432
  e,
859
- $,
860
- z
1433
+ t,
1434
+ C,
1435
+ M
861
1436
  );
862
- if (T !== V) {
863
- se.add(V.id);
864
- const G = T.data;
865
- G.repoAlias && ye.add(V.id), Ce.set(V.id, G.filePath);
1437
+ if (S !== V) {
1438
+ re.add(V.id);
1439
+ const J = S.data;
1440
+ J.repoAlias && ye.add(V.id), Oe.set(V.id, J.filePath);
866
1441
  }
867
1442
  }
868
1443
  }
869
- r((V) => {
870
- const X = new Set(V.map((q) => q.id)), T = ne.filter((q) => !X.has(q.id)), he = [...V.map((q) => q.id === p.id ? {
871
- ...q,
1444
+ i((V) => {
1445
+ const Y = new Set(V.map((X) => X.id)), S = oe.filter((X) => !Y.has(X.id)), ge = [...V.map((X) => X.id === g.id ? {
1446
+ ...X,
872
1447
  data: {
873
- ...q.data,
1448
+ ...X.data,
874
1449
  status: "expanded",
875
1450
  templateCount: W.length,
876
1451
  totalParameterCount: O.length || void 0,
877
1452
  declaredParameterNames: O.length ? O : void 0
878
1453
  }
879
- } : Ne && se.has(q.id) ? we(
880
- q,
881
- w,
882
- t,
1454
+ } : we && re.has(X.id) ? ke(
1455
+ X,
1456
+ R,
883
1457
  e,
884
- $,
885
- z
886
- ) : q), ...T], dt = [...O.length ? be(
887
- b.current,
888
- p.id,
1458
+ t,
1459
+ C,
1460
+ M
1461
+ ) : X), ...S], yt = [...O.length ? xe(
1462
+ w.current,
1463
+ g.id,
889
1464
  O
890
- ) : b.current, ...M];
891
- return Fe(he, dt).nodes;
892
- }), i((V) => {
893
- let X = O.length ? be(
1465
+ ) : w.current, ...j];
1466
+ return Ke(ge, yt).nodes;
1467
+ }), c((V) => {
1468
+ let Y = O.length ? xe(
894
1469
  V,
895
- p.id,
1470
+ g.id,
896
1471
  O
897
1472
  ) : V;
898
- return se.size > 0 && (X = X.map((T) => {
899
- if (!se.has(T.target)) return T;
900
- const G = T.data;
901
- if (!(G != null && G.dynamicPath)) return T;
902
- const he = ye.has(T.target);
1473
+ return re.size > 0 && (Y = Y.map((S) => {
1474
+ if (!re.has(S.target)) return S;
1475
+ const J = S.data;
1476
+ if (!(J != null && J.dynamicPath)) return S;
1477
+ const ge = ye.has(S.target);
903
1478
  return {
904
- ...T,
1479
+ ...S,
905
1480
  data: {
906
- ...G,
1481
+ ...J,
907
1482
  expressionResolved: !0,
908
- isExternal: he || G.isExternal || void 0,
909
- resolvedPath: Ce.get(T.target) ?? G.resolvedPath,
1483
+ isExternal: ge || J.isExternal || void 0,
1484
+ resolvedPath: Oe.get(S.target) ?? J.resolvedPath,
910
1485
  unresolvedExpressions: void 0
911
1486
  },
912
- style: he ? {
1487
+ style: ge ? {
913
1488
  stroke: "var(--badge-resources)",
914
1489
  strokeWidth: 2,
915
1490
  strokeDasharray: "6 3"
916
- } : T.style,
917
- markerEnd: he ? {
918
- type: xe.ArrowClosed,
1491
+ } : S.style,
1492
+ markerEnd: ge ? {
1493
+ type: Ae.ArrowClosed,
919
1494
  color: "var(--badge-resources)"
920
- } : T.markerEnd
1495
+ } : S.markerEnd
921
1496
  };
922
- })), [...X, ...M];
923
- }), P({
924
- nodeId: p.id,
925
- label: u.label,
926
- filePath: u.filePath,
927
- yaml: E,
928
- repoAlias: u.repoAlias
1497
+ })), [...Y, ...j];
1498
+ }), m({
1499
+ nodeId: g.id,
1500
+ label: v.label,
1501
+ filePath: v.filePath,
1502
+ yaml: x,
1503
+ repoAlias: v.repoAlias
929
1504
  });
930
- } catch (E) {
931
- const A = E instanceof Error ? E.message : String(E);
932
- r(
933
- (D) => D.map(
934
- (C) => C.id === p.id ? {
935
- ...C,
936
- data: { ...C.data, status: "error", errorMessage: A }
937
- } : C
1505
+ } catch (x) {
1506
+ const $ = x instanceof Error ? x.message : String(x);
1507
+ i(
1508
+ (A) => A.map(
1509
+ (D) => D.id === g.id ? {
1510
+ ...D,
1511
+ data: { ...D.data, status: "error", errorMessage: $ }
1512
+ } : D
938
1513
  )
939
1514
  );
940
1515
  } finally {
941
- L((E) => {
942
- const A = new Set(E);
943
- return A.delete(p.id), A;
1516
+ F((x) => {
1517
+ const $ = new Set(x);
1518
+ return $.delete(g.id), $;
944
1519
  });
945
1520
  }
946
1521
  }
947
1522
  },
948
1523
  [
949
- t,
950
1524
  e,
951
- $,
1525
+ t,
1526
+ C,
952
1527
  a,
953
- z,
954
- o,
1528
+ M,
1529
+ n,
1530
+ d,
955
1531
  m,
956
1532
  P,
957
- _,
958
- r,
959
1533
  i,
960
- v
1534
+ c,
1535
+ u
961
1536
  ]
962
- ), $e = fe(() => {
963
- ae((f) => (f || (x.current = /* @__PURE__ */ new Set(), N.current = ""), !f));
1537
+ ), Me = ne(() => {
1538
+ se((b) => (b || (k.current = /* @__PURE__ */ new Set(), y.current = ""), !b));
964
1539
  }, []);
965
- return n ? /* @__PURE__ */ s("div", { className: "pipeline-tree__empty", children: /* @__PURE__ */ c("div", { className: "loading-indicator", children: [
1540
+ return o ? /* @__PURE__ */ s("div", { className: "pipeline-tree__empty", children: /* @__PURE__ */ l("div", { className: "loading-indicator", children: [
966
1541
  /* @__PURE__ */ s("span", { className: "loading-indicator__spinner", children: "⏳" }),
967
1542
  /* @__PURE__ */ s("span", { children: "Loading pipeline..." })
968
- ] }) }) : l ? /* @__PURE__ */ s("div", { className: "error", children: l }) : a ? /* @__PURE__ */ c("div", { style: { width: "100%", height: "100%", position: "relative" }, children: [
969
- /* @__PURE__ */ c(
970
- Tt,
1543
+ ] }) }) : r ? /* @__PURE__ */ s("div", { className: "error", children: r }) : a ? /* @__PURE__ */ l("div", { style: { width: "100%", height: "100%", position: "relative" }, children: [
1544
+ /* @__PURE__ */ l(
1545
+ ut,
971
1546
  {
972
- nodes: d,
973
- edges: g,
974
- onInit: (f) => {
975
- S.current = f;
1547
+ nodes: h,
1548
+ edges: f,
1549
+ onInit: (b) => {
1550
+ E.current = b;
976
1551
  },
977
- onNodesChange: y,
978
- onEdgesChange: R,
1552
+ onNodesChange: p,
1553
+ onEdgesChange: N,
979
1554
  onNodeClick: K,
980
- nodeTypes: Yt,
981
- edgeTypes: Xt,
982
- defaultEdgeOptions: Gt,
1555
+ nodeTypes: ka,
1556
+ edgeTypes: Ta,
1557
+ defaultEdgeOptions: $a,
983
1558
  fitView: !0,
984
1559
  fitViewOptions: { padding: 0.2 },
985
1560
  minZoom: 0.1,
@@ -987,521 +1562,434 @@ function qt() {
987
1562
  proOptions: { hideAttribution: !0 },
988
1563
  children: [
989
1564
  /* @__PURE__ */ s(
990
- $t,
1565
+ mt,
991
1566
  {
992
- variant: Ct.Dots,
1567
+ variant: Ft.Dots,
993
1568
  color: "var(--border)",
994
1569
  gap: 20
995
1570
  }
996
1571
  ),
997
- /* @__PURE__ */ s(St, {})
1572
+ /* @__PURE__ */ s(ht, {})
998
1573
  ]
999
1574
  }
1000
1575
  ),
1001
- /* @__PURE__ */ c("label", { className: "auto-expand-toggle", children: [
1576
+ /* @__PURE__ */ l("label", { className: "auto-expand-toggle", children: [
1002
1577
  /* @__PURE__ */ s(
1003
1578
  "input",
1004
1579
  {
1005
1580
  type: "checkbox",
1006
- checked: k,
1007
- onChange: $e
1581
+ checked: T,
1582
+ onChange: Me
1008
1583
  }
1009
1584
  ),
1010
1585
  /* @__PURE__ */ s("span", { children: "Auto-expand all" })
1011
1586
  ] })
1012
1587
  ] }) : /* @__PURE__ */ s("div", { className: "pipeline-tree__empty", children: "Select a pipeline to visualize" });
1013
1588
  }
1014
- function be(t, e, a) {
1015
- return t.map((n) => {
1016
- if (n.target !== e) return n;
1017
- const l = n.data ?? {};
1589
+ function xe(e, t, a) {
1590
+ return e.map((o) => {
1591
+ if (o.target !== t) return o;
1592
+ const r = o.data ?? {};
1018
1593
  return {
1019
- ...n,
1594
+ ...o,
1020
1595
  data: {
1021
- ...l,
1596
+ ...r,
1022
1597
  totalParameterCount: a.length,
1023
1598
  declaredParameterNames: a
1024
1599
  }
1025
1600
  };
1026
1601
  });
1027
1602
  }
1028
- function ke(t, e, a) {
1029
- if (!t || !e && !a)
1030
- return t;
1031
- const n = {};
1032
- for (const [l, o] of Object.entries(t))
1033
- if (typeof o == "string" && ue(o)) {
1034
- const { result: m, isFullyResolved: P } = yt(o, {
1035
- parameters: e,
1603
+ function Ie(e, t, a) {
1604
+ if (!e || !t && !a)
1605
+ return e;
1606
+ const o = {};
1607
+ for (const [r, n] of Object.entries(e))
1608
+ if (typeof n == "string" && me(n)) {
1609
+ const { result: d, isFullyResolved: m } = Dt(n, {
1610
+ parameters: t,
1036
1611
  variables: a
1037
1612
  });
1038
- n[l] = P ? Jt(m) : o;
1039
- } else o && typeof o == "object" && !Array.isArray(o) ? n[l] = ke(
1040
- o,
1041
- e,
1613
+ o[r] = m ? Ca(d) : n;
1614
+ } else n && typeof n == "object" && !Array.isArray(n) ? o[r] = Ie(
1615
+ n,
1616
+ t,
1042
1617
  a
1043
- ) ?? o : n[l] = o;
1044
- return n;
1618
+ ) ?? n : o[r] = n;
1619
+ return o;
1045
1620
  }
1046
- function Jt(t) {
1047
- if (t === "True" || t === "true") return !0;
1048
- if (t === "False" || t === "false") return !1;
1049
- if (t === "null") return null;
1050
- if (t.startsWith("{") && t.endsWith("}") || t.startsWith("[") && t.endsWith("]"))
1621
+ function Ca(e) {
1622
+ if (e === "True" || e === "true") return !0;
1623
+ if (e === "False" || e === "false") return !1;
1624
+ if (e === "null") return null;
1625
+ if (e.startsWith("{") && e.endsWith("}") || e.startsWith("[") && e.endsWith("]"))
1051
1626
  try {
1052
- return JSON.parse(t);
1627
+ return JSON.parse(e);
1053
1628
  } catch {
1054
1629
  }
1055
- return t;
1630
+ return e;
1056
1631
  }
1057
- function qe(t) {
1058
- const e = t.resources;
1059
- if (!e) return [];
1060
- const a = e.repositories;
1632
+ function nt(e) {
1633
+ const t = e.resources;
1634
+ if (!t) return [];
1635
+ const a = t.repositories;
1061
1636
  return Array.isArray(a) ? a.filter(
1062
- (n) => n != null && typeof n == "object" && "repository" in n && "name" in n && typeof n.repository == "string" && typeof n.name == "string"
1637
+ (o) => o != null && typeof o == "object" && "repository" in o && "name" in o && typeof o.repository == "string" && typeof o.name == "string"
1063
1638
  ) : [];
1064
1639
  }
1065
- function Je(t) {
1066
- const e = /* @__PURE__ */ new Map();
1067
- for (const a of t)
1068
- e.set(a.repository, a);
1069
- return Array.from(e.values());
1640
+ function st(e) {
1641
+ const t = /* @__PURE__ */ new Map();
1642
+ for (const a of e)
1643
+ t.set(a.repository, a);
1644
+ return Array.from(t.values());
1070
1645
  }
1071
- function Zt(t, e) {
1072
- return `tpl::${t || "self"}::${e}`;
1646
+ function Da(e, t) {
1647
+ return `tpl::${e || "self"}::${t}`;
1073
1648
  }
1074
- function Ue(t, e, a, n, l, o, m, P, v) {
1075
- const d = /* @__PURE__ */ new Set(), r = [], y = [];
1076
- for (let g = 0; g < e.length; g++) {
1077
- const i = e[g];
1078
- let R = i.normalizedPath, S = !1, h = !0, N, b;
1079
- if (ue(i.normalizedPath)) {
1080
- S = !0, N = i.normalizedPath;
1081
- const f = Ee(
1082
- i.normalizedPath,
1083
- m,
1649
+ function Ye(e, t, a, o, r, n, d, m, u) {
1650
+ const h = /* @__PURE__ */ new Set(), i = [], p = [];
1651
+ for (let f = 0; f < t.length; f++) {
1652
+ const c = t[f];
1653
+ let N = c.normalizedPath, E = !1, _ = !0, y, w;
1654
+ if (me(c.normalizedPath)) {
1655
+ E = !0, y = c.normalizedPath;
1656
+ const b = $e(
1657
+ c.normalizedPath,
1658
+ d,
1084
1659
  void 0,
1085
- v
1660
+ u
1086
1661
  );
1087
- R = f.resolvedPath, h = f.isFullyResolved, b = f.unresolved.length ? f.unresolved : void 0;
1662
+ N = b.resolvedPath, _ = b.isFullyResolved, w = b.unresolved.length ? b.unresolved : void 0;
1088
1663
  }
1089
- let _ = re(i), L = !1, x = !0;
1090
- if (_ && ue(_)) {
1091
- L = !0;
1092
- const f = Ee(
1093
- _,
1094
- m,
1664
+ let P = ie(c), F = !1, k = !0;
1665
+ if (P && me(P)) {
1666
+ F = !0;
1667
+ const b = $e(
1668
+ P,
1669
+ d,
1095
1670
  void 0,
1096
- v
1671
+ u
1097
1672
  );
1098
- f.isFullyResolved ? _ = f.resolvedPath : (x = !1, b = [
1099
- ...b ?? [],
1100
- ...f.unresolved
1673
+ b.isFullyResolved ? P = b.resolvedPath : (k = !1, w = [
1674
+ ...w ?? [],
1675
+ ...b.unresolved
1101
1676
  ]);
1102
1677
  }
1103
- const k = S || L, ae = h && x, { primary: $, fallback: z } = nt({
1104
- ...i,
1105
- normalizedPath: R,
1106
- repoAlias: i.repoAlias,
1107
- sourcePath: i.sourcePath
1108
- }), H = Zt(_, $);
1109
- if (d.has(H)) continue;
1110
- d.add(H);
1111
- const me = P == null ? void 0 : P.has(H);
1678
+ const T = E || F, se = _ && k, { primary: C, fallback: M } = lt({
1679
+ ...c,
1680
+ normalizedPath: N,
1681
+ repoAlias: c.repoAlias,
1682
+ sourcePath: c.sourcePath
1683
+ }), G = Da(P, C);
1684
+ if (h.has(G)) continue;
1685
+ h.add(G);
1686
+ const fe = m == null ? void 0 : m.has(G);
1112
1687
  let K;
1113
- if (i.conditional && i.conditionExpression)
1688
+ if (c.conditional && c.conditionExpression)
1114
1689
  try {
1115
- const f = _t(i.conditionExpression, {
1116
- parameters: m,
1117
- variables: v
1690
+ const b = St(c.conditionExpression, {
1691
+ parameters: d,
1692
+ variables: u
1118
1693
  });
1119
- typeof f == "boolean" ? K = f : f === void 0 || f === i.conditionExpression ? K = "unknown" : K = !!f;
1694
+ typeof b == "boolean" ? K = b : b === void 0 || b === c.conditionExpression ? K = "unknown" : K = !!b;
1120
1695
  } catch {
1121
1696
  K = "unknown";
1122
1697
  }
1123
- else i.conditional && (K = "unknown");
1698
+ else c.conditional && (K = "unknown");
1124
1699
  if (K === !1) continue;
1125
- if (!me) {
1126
- const f = R.length > 40 ? `...${R.slice(-37)}` : R, { repoInfo: p, adoUrl: u } = lt(
1127
- i,
1128
- _,
1129
- $,
1700
+ if (!fe) {
1701
+ const b = N.length > 40 ? `...${N.slice(-37)}` : N, { repoInfo: g, adoUrl: v } = bt(
1702
+ c,
1703
+ P,
1704
+ C,
1130
1705
  a,
1131
- n,
1132
- l,
1133
- o
1134
- ), E = ke(
1135
- i.parameters,
1136
- m,
1137
- v
1138
- ), A = _ !== re(i) || E !== i.parameters ? {
1139
- ...i,
1140
- repoAlias: _ || i.repoAlias,
1141
- contextRepoAlias: _ || i.contextRepoAlias,
1142
- parameters: E
1143
- } : i;
1144
- r.push({
1145
- id: H,
1706
+ o,
1707
+ r,
1708
+ n
1709
+ ), x = Ie(
1710
+ c.parameters,
1711
+ d,
1712
+ u
1713
+ ), $ = P !== ie(c) || x !== c.parameters ? {
1714
+ ...c,
1715
+ repoAlias: P || c.repoAlias,
1716
+ contextRepoAlias: P || c.contextRepoAlias,
1717
+ parameters: x
1718
+ } : c;
1719
+ i.push({
1720
+ id: G,
1146
1721
  type: "fileNode",
1147
1722
  position: { x: 0, y: 0 },
1148
1723
  data: {
1149
- label: f,
1150
- filePath: $,
1151
- repoAlias: _,
1724
+ label: b,
1725
+ filePath: C,
1726
+ repoAlias: P,
1152
1727
  templateCount: 0,
1153
1728
  status: "collapsed",
1154
1729
  isRoot: !1,
1155
- baseDir: Ae($),
1156
- adoUrl: u,
1157
- repoInfo: p,
1158
- templateLocation: i.location,
1730
+ baseDir: Le(C),
1731
+ adoUrl: v,
1732
+ repoInfo: g,
1733
+ templateLocation: c.location,
1159
1734
  // Dynamic path info for auto-expand to skip unresolved expression paths
1160
- dynamicPath: k || void 0,
1161
- expressionResolved: k ? ae : void 0,
1735
+ dynamicPath: T || void 0,
1736
+ expressionResolved: T ? se : void 0,
1162
1737
  // Stash the resolved ref for expansion (with resolved repo alias + params)
1163
- _ref: A,
1738
+ _ref: $,
1164
1739
  // Stash fallback path for fetch retry (repo-root-relative)
1165
- _fallbackPath: z,
1740
+ _fallbackPath: M,
1166
1741
  // Stash the parent's parameter context so it can flow down during expansion
1167
- _parentParamContext: m,
1742
+ _parentParamContext: d,
1168
1743
  // Stash accumulated resources (root + all ancestor template resources)
1169
- _accumulatedResources: o,
1744
+ _accumulatedResources: n,
1170
1745
  // Stash accumulated variables for expression resolution in descendants
1171
- _accumulatedVariables: v,
1746
+ _accumulatedVariables: u,
1172
1747
  // Condition evaluation result for conditional refs
1173
1748
  // true = expand, false = skip, 'unknown' = expand when autoExpandAll
1174
1749
  _conditionResult: K
1175
1750
  }
1176
1751
  });
1177
1752
  }
1178
- const $e = i.location === "extends" ? "extends" : i.location === "extends-parameters" ? "extends param" : i.location, le = !!_, ve = i.parameters ? Object.keys(i.parameters) : void 0;
1179
- y.push({
1180
- id: `${t}->${H}`,
1181
- source: t,
1182
- target: H,
1753
+ const Me = c.location === "extends" ? "extends" : c.location === "extends-parameters" ? "extends param" : c.location, le = !!P, be = c.parameters ? Object.keys(c.parameters) : void 0;
1754
+ p.push({
1755
+ id: `${e}->${G}`,
1756
+ source: e,
1757
+ target: G,
1183
1758
  type: "templateEdge",
1184
1759
  data: {
1185
- edgeLabel: $e,
1186
- parameterNames: ve,
1760
+ edgeLabel: Me,
1761
+ parameterNames: be,
1187
1762
  isExternal: le || void 0,
1188
- conditional: i.conditional || void 0,
1189
- conditionExpression: i.conditionExpression,
1763
+ conditional: c.conditional || void 0,
1764
+ conditionExpression: c.conditionExpression,
1190
1765
  conditionResult: K,
1191
- dynamicPath: k || void 0,
1192
- expressionResolved: k ? ae : void 0,
1193
- originalPath: N || (L ? i.rawPath : void 0),
1194
- resolvedPath: k ? $ : void 0,
1195
- unresolvedExpressions: b
1766
+ dynamicPath: T || void 0,
1767
+ expressionResolved: T ? se : void 0,
1768
+ originalPath: y || (F ? c.rawPath : void 0),
1769
+ resolvedPath: T ? C : void 0,
1770
+ unresolvedExpressions: w
1196
1771
  },
1197
1772
  style: le ? {
1198
1773
  stroke: "var(--badge-resources)",
1199
1774
  strokeWidth: 2,
1200
1775
  strokeDasharray: "6 3"
1201
1776
  } : void 0,
1202
- markerEnd: le ? { type: xe.ArrowClosed, color: "var(--badge-resources)" } : void 0
1777
+ markerEnd: le ? { type: Ae.ArrowClosed, color: "var(--badge-resources)" } : void 0
1203
1778
  });
1204
1779
  }
1205
- return { templateNodes: r, templateEdges: y };
1780
+ return { templateNodes: i, templateEdges: p };
1206
1781
  }
1207
- async function Ve(t, e, a, n, l, o, m, P) {
1208
- const v = n._ref;
1209
- if (!v) throw new Error("No template reference on this node");
1210
- const d = n.filePath, r = n._fallbackPath, y = re(v), g = `${y || ""}:${d}`, i = o.get(g);
1211
- if (i) return { content: i, actualPath: d };
1212
- if (r) {
1213
- const x = `${y || ""}:${r}`, k = o.get(x);
1214
- if (k)
1215
- return { content: k, actualPath: r };
1782
+ async function Je(e, t, a, o, r, n, d, m) {
1783
+ const u = o._ref;
1784
+ if (!u) throw new Error("No template reference on this node");
1785
+ const h = o.filePath, i = o._fallbackPath, p = ie(u), f = `${p || ""}:${h}`, c = n.get(f);
1786
+ if (c) return { content: c, actualPath: h };
1787
+ if (i) {
1788
+ const k = `${p || ""}:${i}`, T = n.get(k);
1789
+ if (T)
1790
+ return { content: T, actualPath: i };
1216
1791
  }
1217
- const S = n._accumulatedResources ?? l;
1218
- let h = e, N = a, b;
1219
- if (y && S.length) {
1220
- const x = st(y, S);
1221
- x ? (h = x.project || e, N = x.repoName, b = x.ref) : N = y;
1222
- } else y && (N = y);
1223
- let _, L = d;
1792
+ const E = o._accumulatedResources ?? r;
1793
+ let _ = t, y = a, w;
1794
+ if (p && E.length) {
1795
+ const k = ct(p, E);
1796
+ k ? (_ = k.project || t, y = k.repoName, w = k.ref) : y = p;
1797
+ } else p && (y = p);
1798
+ let P, F = h;
1224
1799
  try {
1225
- _ = await P(
1226
- t,
1800
+ P = await m(
1801
+ e,
1802
+ _,
1803
+ y,
1227
1804
  h,
1228
- N,
1229
- d,
1230
- b
1805
+ w
1231
1806
  );
1232
- } catch (x) {
1233
- if (r)
1234
- _ = await P(
1235
- t,
1236
- h,
1237
- N,
1238
- r,
1239
- b
1240
- ), L = r;
1807
+ } catch (k) {
1808
+ if (i)
1809
+ P = await m(
1810
+ e,
1811
+ _,
1812
+ y,
1813
+ i,
1814
+ w
1815
+ ), F = i;
1241
1816
  else
1242
- throw x;
1817
+ throw k;
1243
1818
  }
1244
- return m(`${y || ""}:${L}`, _.content), { content: _.content, actualPath: L };
1819
+ return d(`${p || ""}:${F}`, P.content), { content: P.content, actualPath: F };
1245
1820
  }
1246
- function Ae(t) {
1247
- const e = t.replace(/\\/g, "/"), a = e.lastIndexOf("/");
1248
- return a > 0 ? e.slice(0, a) : "";
1821
+ function Le(e) {
1822
+ const t = e.replace(/\\/g, "/"), a = t.lastIndexOf("/");
1823
+ return a > 0 ? t.slice(0, a) : "";
1249
1824
  }
1250
- function lt(t, e, a, n, l, o, m) {
1251
- let P = l, v = o, d, r;
1252
- if (e && m.length) {
1253
- const g = st(e, m), i = m.find(
1254
- (R) => R.repository === e
1825
+ function bt(e, t, a, o, r, n, d) {
1826
+ let m = r, u = n, h, i;
1827
+ if (t && d.length) {
1828
+ const f = ct(t, d), c = d.find(
1829
+ (N) => N.repository === t
1255
1830
  );
1256
- g ? (P = g.project || l, v = g.repoName, d = g.ref) : v = e, i && (r = {
1257
- alias: e,
1258
- fullName: i.name,
1259
- type: i.type,
1260
- ref: i.ref,
1261
- project: g == null ? void 0 : g.project
1831
+ f ? (m = f.project || r, u = f.repoName, h = f.ref) : u = t, c && (i = {
1832
+ alias: t,
1833
+ fullName: c.name,
1834
+ type: c.type,
1835
+ ref: c.ref,
1836
+ project: f == null ? void 0 : f.project
1262
1837
  });
1263
- } else e && (v = e);
1264
- const y = n && P && v ? at({
1265
- org: n,
1266
- project: P,
1267
- repoName: v,
1838
+ } else t && (u = t);
1839
+ const p = o && m && u ? it({
1840
+ org: o,
1841
+ project: m,
1842
+ repoName: u,
1268
1843
  filePath: a,
1269
- ref: d
1844
+ ref: h
1270
1845
  }) : void 0;
1271
- return { repoInfo: r, adoUrl: y };
1846
+ return { repoInfo: i, adoUrl: p };
1272
1847
  }
1273
- function we(t, e, a, n, l, o) {
1274
- const m = t.data, v = { ...m._accumulatedVariables ?? {}, ...e }, d = m._ref;
1275
- if (!d) return t;
1276
- const r = m._parentParamContext;
1277
- let y = d.normalizedPath, g = !1, i = !0, R = re(d);
1278
- if (ue(d.normalizedPath)) {
1279
- g = !0;
1280
- const x = Ee(
1281
- d.normalizedPath,
1282
- r,
1848
+ function ke(e, t, a, o, r, n) {
1849
+ const d = e.data, u = { ...d._accumulatedVariables ?? {}, ...t }, h = d._ref;
1850
+ if (!h) return e;
1851
+ const i = d._parentParamContext;
1852
+ let p = h.normalizedPath, f = !1, c = !0, N = ie(h);
1853
+ if (me(h.normalizedPath)) {
1854
+ f = !0;
1855
+ const k = $e(
1856
+ h.normalizedPath,
1857
+ i,
1283
1858
  void 0,
1284
- v
1859
+ u
1285
1860
  );
1286
- if (y = x.resolvedPath, i = x.isFullyResolved, i && !ue(y)) {
1287
- const k = vt(y);
1288
- y = k.normalizedPath, k.repoAlias && (R = k.repoAlias);
1861
+ if (p = k.resolvedPath, c = k.isFullyResolved, c && !me(p)) {
1862
+ const T = Ct(p);
1863
+ p = T.normalizedPath, T.repoAlias && (N = T.repoAlias);
1289
1864
  }
1290
1865
  }
1291
- if (R && ue(R)) {
1292
- g = !0;
1293
- const x = Ee(
1294
- R,
1295
- r,
1866
+ if (N && me(N)) {
1867
+ f = !0;
1868
+ const k = $e(
1869
+ N,
1870
+ i,
1296
1871
  void 0,
1297
- v
1872
+ u
1298
1873
  );
1299
- x.isFullyResolved ? R = x.resolvedPath : i = !1;
1874
+ k.isFullyResolved ? N = k.resolvedPath : c = !1;
1300
1875
  }
1301
- const S = {
1302
- ...d,
1303
- normalizedPath: y,
1304
- repoAlias: R || d.repoAlias,
1305
- contextRepoAlias: R || d.contextRepoAlias
1306
- }, { primary: h, fallback: N } = nt({
1307
- ...S,
1308
- normalizedPath: y,
1309
- repoAlias: S.repoAlias,
1310
- sourcePath: d.sourcePath
1311
- }), b = y.length > 40 ? `...${y.slice(-37)}` : y, { repoInfo: _, adoUrl: L } = a && n && l && o ? lt(
1312
- S,
1313
- R,
1314
- h,
1876
+ const E = {
1877
+ ...h,
1878
+ normalizedPath: p,
1879
+ repoAlias: N || h.repoAlias,
1880
+ contextRepoAlias: N || h.contextRepoAlias
1881
+ }, { primary: _, fallback: y } = lt({
1882
+ ...E,
1883
+ normalizedPath: p,
1884
+ repoAlias: E.repoAlias,
1885
+ sourcePath: h.sourcePath
1886
+ }), w = p.length > 40 ? `...${p.slice(-37)}` : p, { repoInfo: P, adoUrl: F } = a && o && r && n ? bt(
1887
+ E,
1888
+ N,
1889
+ _,
1315
1890
  a,
1316
- n,
1317
- l,
1318
- o
1891
+ o,
1892
+ r,
1893
+ n
1319
1894
  ) : { repoInfo: void 0, adoUrl: void 0 };
1320
1895
  return {
1321
- ...t,
1896
+ ...e,
1322
1897
  data: {
1323
- ...t.data,
1324
- label: b,
1325
- filePath: h,
1326
- repoAlias: R,
1327
- baseDir: Ae(h),
1328
- dynamicPath: g || void 0,
1329
- expressionResolved: g ? i : void 0,
1330
- adoUrl: L || t.data.adoUrl,
1331
- repoInfo: _ || t.data.repoInfo,
1332
- _ref: S,
1333
- _accumulatedVariables: v,
1334
- _fallbackPath: N
1898
+ ...e.data,
1899
+ label: w,
1900
+ filePath: _,
1901
+ repoAlias: N,
1902
+ baseDir: Le(_),
1903
+ dynamicPath: f || void 0,
1904
+ expressionResolved: f ? c : void 0,
1905
+ adoUrl: F || e.data.adoUrl,
1906
+ repoInfo: P || e.data.repoInfo,
1907
+ _ref: E,
1908
+ _accumulatedVariables: u,
1909
+ _fallbackPath: y
1335
1910
  }
1336
1911
  };
1337
1912
  }
1338
- const Me = "7.1";
1339
- function Be(t, e) {
1340
- return `https://dev.azure.com/${encodeURIComponent(t)}/${encodeURIComponent(e)}/_apis`;
1341
- }
1342
- function Qt(t) {
1343
- return t.startsWith("refs/heads/") ? { version: t.slice(11), versionType: "branch" } : t.startsWith("refs/tags/") ? { version: t.slice(10), versionType: "tag" } : /^[0-9a-f]{40}$/i.test(t) ? { version: t, versionType: "commit" } : { version: t, versionType: "branch" };
1344
- }
1345
- async function We(t) {
1346
- const e = await fetch(t, { credentials: "include" });
1347
- if (!e.ok) {
1348
- const a = await e.text();
1349
- throw new Error(`ADO API error (${e.status}): ${a}`);
1350
- }
1351
- return e;
1352
- }
1353
- async function it(t, e, a, n, l) {
1354
- const o = n.startsWith("/") ? n : `/${n}`, m = Nt(o);
1355
- let P = `${Be(t, e)}/git/repositories/${encodeURIComponent(a)}/items?path=${encodeURIComponent(m)}&api-version=${Me}&includeContent=true&$format=text`;
1356
- if (l) {
1357
- const d = Qt(l);
1358
- P += `&versionDescriptor.version=${encodeURIComponent(d.version)}&versionDescriptor.versionType=${d.versionType}`;
1359
- }
1360
- return (await We(P)).text();
1361
- }
1362
- async function ea(t, e) {
1363
- const a = `${Be(t, e)}/pipelines?api-version=${Me}`;
1364
- return (await (await We(a)).json()).value;
1365
- }
1366
- async function ta(t, e, a) {
1367
- var v, d, r, y, g;
1368
- const n = `${Be(t, e)}/build/definitions/${a}?api-version=${Me}`, o = await (await We(n)).json(), m = {
1369
- id: o.id,
1370
- name: o.name,
1371
- path: ((v = o.process) == null ? void 0 : v.yamlFilename) ?? o.path,
1372
- repository: {
1373
- id: (d = o.repository) == null ? void 0 : d.id,
1374
- name: (r = o.repository) == null ? void 0 : r.name,
1375
- type: (y = o.repository) == null ? void 0 : y.type,
1376
- defaultBranch: (g = o.repository) == null ? void 0 : g.defaultBranch
1377
- }
1378
- }, P = await it(
1379
- t,
1380
- e,
1381
- m.repository.id,
1382
- m.path,
1383
- m.repository.defaultBranch
1384
- );
1385
- return { definition: m, yaml: P };
1386
- }
1387
- async function aa(t, e, a, n, l) {
1388
- return { content: await it(t, e, a, n, l), path: n, repoId: a, repoName: a, branch: l || "" };
1389
- }
1390
- async function na() {
1391
- return { customTaskDocs: {} };
1392
- }
1393
- async function sa(t) {
1394
- return { tasks: [], cached: !1 };
1395
- }
1396
- const oa = "/api";
1397
- var Qe;
1398
- const ge = typeof window < "u" && ((Qe = window.location) == null ? void 0 : Qe.protocol) === "chrome-extension:";
1399
- async function _e(t) {
1400
- const e = await fetch(`${oa}${t}`);
1401
- if (!e.ok) {
1402
- const a = await e.text();
1403
- throw new Error(`API error (${e.status}): ${a}`);
1404
- }
1405
- return e.json();
1406
- }
1407
- function wa(t, e) {
1408
- return ge ? ea(t, e) : _e(`/${t}/${e}/pipelines`);
1409
- }
1410
- function ra(t, e, a) {
1411
- return ge ? ta(t, e, a) : _e(`/${t}/${e}/pipelines/${a}/yaml`);
1412
- }
1413
- function ct(t, e, a, n, l) {
1414
- if (ge)
1415
- return aa(t, e, a, n, l);
1416
- const o = new URLSearchParams({ repo: a, path: n });
1417
- return l && o.set("branch", l), _e(`/${t}/${e}/file-by-repo-name?${o}`);
1418
- }
1419
- function la() {
1420
- return ge ? na() : _e("/config/task-docs");
1421
- }
1422
- function ia(t) {
1423
- return ge ? sa() : _e(`/${t}/schema/tasks`);
1424
- }
1425
- function ca(t) {
1913
+ function Aa(e) {
1426
1914
  const {
1427
- setConnection: e,
1915
+ setConnection: t,
1428
1916
  setSelectedPipeline: a,
1429
- setSelectedPipelineLoading: n,
1430
- setSelectedPipelineError: l
1431
- } = Te(), [o, m] = Z(""), [P, v] = Z(null), [d, r] = Z(!1), y = te(!1);
1432
- oe(() => {
1433
- if (y.current) return;
1434
- y.current = !0;
1435
- const h = new URLSearchParams(window.location.search), N = t.fileUrl || h.get("url"), b = t.org || h.get("org"), _ = t.project || h.get("project"), L = t.repo || h.get("repo"), x = t.path || h.get("path"), k = t.branch || h.get("branch") || void 0, ae = t.pipelineId ?? (h.get("pipelineId") ? Number(h.get("pipelineId")) : null);
1436
- if (N)
1437
- m(N), g(N);
1438
- else if (b && _ && L && x) {
1439
- const $ = `https://dev.azure.com/${b}/${_}/_git/${L}?path=${x}${k ? `&version=GB${k}` : ""}`;
1440
- m($), g($);
1441
- } else b && _ && ae != null && i(b, _, ae);
1917
+ setSelectedPipelineLoading: o,
1918
+ setSelectedPipelineError: r
1919
+ } = Ve(), [n, d] = L(""), [m, u] = L(null), [h, i] = L(!1), p = Q(!1);
1920
+ ee(() => {
1921
+ if (p.current) return;
1922
+ p.current = !0;
1923
+ const _ = new URLSearchParams(window.location.search), y = e.fileUrl || _.get("url"), w = e.org || _.get("org"), P = e.project || _.get("project"), F = e.repo || _.get("repo"), k = e.path || _.get("path"), T = e.branch || _.get("branch") || void 0, se = e.pipelineId ?? (_.get("pipelineId") ? Number(_.get("pipelineId")) : null);
1924
+ if (y)
1925
+ d(y), f(y);
1926
+ else if (w && P && F && k) {
1927
+ const C = `https://dev.azure.com/${w}/${P}/_git/${F}?path=${k}${T ? `&version=GB${T}` : ""}`;
1928
+ d(C), f(C);
1929
+ } else w && P && se != null && c(w, P, se);
1442
1930
  }, []);
1443
- const g = async (h) => {
1444
- const N = Pt(h);
1445
- if (!N) {
1446
- v("Invalid Azure DevOps URL");
1931
+ const f = async (_) => {
1932
+ const y = At(_);
1933
+ if (!y) {
1934
+ u("Invalid Azure DevOps URL");
1447
1935
  return;
1448
1936
  }
1449
- e(N.org, N.project), n(!0), l(null), r(!0);
1937
+ t(y.org, y.project), o(!0), r(null), i(!0);
1450
1938
  try {
1451
- const b = await ct(
1452
- N.org,
1453
- N.project,
1454
- N.repoName,
1455
- N.filePath,
1456
- N.branch
1939
+ const w = await _t(
1940
+ y.org,
1941
+ y.project,
1942
+ y.repoName,
1943
+ y.filePath,
1944
+ y.branch
1457
1945
  );
1458
1946
  a({
1459
1947
  definition: {
1460
1948
  id: 0,
1461
- name: N.filePath.split("/").pop() || N.filePath,
1462
- path: N.filePath,
1949
+ name: y.filePath.split("/").pop() || y.filePath,
1950
+ path: y.filePath,
1463
1951
  repository: {
1464
- id: b.repoId,
1465
- name: b.repoName,
1952
+ id: w.repoId,
1953
+ name: w.repoName,
1466
1954
  type: "git",
1467
- defaultBranch: b.branch || ""
1955
+ defaultBranch: w.branch || ""
1468
1956
  }
1469
1957
  },
1470
- yaml: b.content
1958
+ yaml: w.content
1471
1959
  });
1472
- } catch (b) {
1473
- l(
1474
- b instanceof Error ? b.message : String(b)
1960
+ } catch (w) {
1961
+ r(
1962
+ w instanceof Error ? w.message : String(w)
1475
1963
  );
1476
1964
  } finally {
1477
- n(!1), r(!1);
1965
+ o(!1), i(!1);
1478
1966
  }
1479
- }, i = async (h, N, b) => {
1480
- e(h, N), n(!0), l(null);
1967
+ }, c = async (_, y, w) => {
1968
+ t(_, y), o(!0), r(null);
1481
1969
  try {
1482
- const _ = await ra(h, N, b);
1483
- a(_);
1484
- } catch (_) {
1485
- l(
1486
- _ instanceof Error ? _.message : String(_)
1970
+ const P = await qt(_, y, w);
1971
+ a(P);
1972
+ } catch (P) {
1973
+ r(
1974
+ P instanceof Error ? P.message : String(P)
1487
1975
  );
1488
1976
  } finally {
1489
- n(!1);
1977
+ o(!1);
1490
1978
  }
1491
- }, R = async () => {
1492
- o.trim() && (v(null), await g(o.trim()));
1979
+ }, N = async () => {
1980
+ n.trim() && (u(null), await f(n.trim()));
1493
1981
  };
1494
- return /* @__PURE__ */ c("div", { className: "pipeline-url-bar", children: [
1982
+ return /* @__PURE__ */ l("div", { className: "pipeline-url-bar", children: [
1495
1983
  /* @__PURE__ */ s(
1496
1984
  "input",
1497
1985
  {
1498
1986
  type: "text",
1499
1987
  className: "pipeline-url-bar__input",
1500
1988
  placeholder: "https://dev.azure.com/{org}/{project}/_git/{repo}?path=/{pipeline}.yml",
1501
- value: o,
1502
- onChange: (h) => m(h.target.value),
1503
- onKeyDown: (h) => {
1504
- h.key === "Enter" && (h.preventDefault(), R());
1989
+ value: n,
1990
+ onChange: (_) => d(_.target.value),
1991
+ onKeyDown: (_) => {
1992
+ _.key === "Enter" && (_.preventDefault(), N());
1505
1993
  }
1506
1994
  }
1507
1995
  ),
@@ -1509,104 +1997,136 @@ function ca(t) {
1509
1997
  "button",
1510
1998
  {
1511
1999
  className: "pipeline-url-bar__btn",
1512
- onClick: R,
1513
- disabled: !o.trim() || d,
1514
- children: d ? "⏳ Loading..." : "Load"
2000
+ onClick: N,
2001
+ disabled: !n.trim() || h,
2002
+ children: h ? "⏳ Loading..." : "Load"
1515
2003
  }
1516
2004
  ),
1517
- P && /* @__PURE__ */ s("div", { className: "pipeline-url-bar__error", children: P })
2005
+ m && /* @__PURE__ */ s("div", { className: "pipeline-url-bar__error", children: m })
1518
2006
  ] });
1519
2007
  }
1520
- const da = 280, pa = 900, ua = 420;
1521
- function ma(t) {
1522
- const { setCustomTaskDocs: e, setTaskSchema: a, selectedNodeDetail: n, org: l } = Te(), [o, m] = Z(ua), P = te(!1);
1523
- oe(() => {
1524
- la().then((d) => e(d.customTaskDocs)).catch(() => {
2008
+ function Ia() {
2009
+ const e = () => window.location.hash.startsWith("#/commit-flow") ? "commit-flow" : "pipeline", [t, a] = L(e);
2010
+ return ee(() => {
2011
+ const r = () => a(e());
2012
+ return window.addEventListener("hashchange", r), () => window.removeEventListener("hashchange", r);
2013
+ }, []), [t, (r) => {
2014
+ window.location.hash = r === "pipeline" ? "#/" : `#/${r}`;
2015
+ }];
2016
+ }
2017
+ const La = 280, Ba = 900, Fa = 420;
2018
+ function Ua(e) {
2019
+ const { setCustomTaskDocs: t, setTaskSchema: a, selectedNodeDetail: o, org: r } = Ve(), [n, d] = L(Fa), m = Q(!1), [u, h] = Ia();
2020
+ ee(() => {
2021
+ Yt().then((p) => t(p.customTaskDocs)).catch(() => {
1525
2022
  });
1526
- }, [e]), oe(() => {
1527
- l && ia(l).then((d) => a(d.tasks)).catch(() => {
2023
+ }, [t]), ee(() => {
2024
+ r && Jt(r).then((p) => a(p.tasks)).catch(() => {
1528
2025
  });
1529
- }, [l, a]);
1530
- const v = fe(
1531
- (d) => {
1532
- d.preventDefault(), P.current = !0;
1533
- const r = d.clientX, y = o;
2026
+ }, [r, a]);
2027
+ const i = ne(
2028
+ (p) => {
2029
+ p.preventDefault(), m.current = !0;
2030
+ const f = p.clientX, c = n;
1534
2031
  document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
1535
- const g = (R) => {
1536
- const S = r - R.clientX, h = Math.min(
1537
- pa,
1538
- Math.max(da, y + S)
2032
+ const N = (_) => {
2033
+ const y = f - _.clientX, w = Math.min(
2034
+ Ba,
2035
+ Math.max(La, c + y)
1539
2036
  );
1540
- m(h);
1541
- }, i = () => {
1542
- P.current = !1, document.body.style.cursor = "", document.body.style.userSelect = "", window.removeEventListener("mousemove", g), window.removeEventListener("mouseup", i);
2037
+ d(w);
2038
+ }, E = () => {
2039
+ m.current = !1, document.body.style.cursor = "", document.body.style.userSelect = "", window.removeEventListener("mousemove", N), window.removeEventListener("mouseup", E);
1543
2040
  };
1544
- window.addEventListener("mousemove", g), window.addEventListener("mouseup", i);
2041
+ window.addEventListener("mousemove", N), window.addEventListener("mouseup", E);
1545
2042
  },
1546
- [o]
2043
+ [n]
1547
2044
  );
1548
- return /* @__PURE__ */ s(Vt, { value: ct, children: /* @__PURE__ */ c("div", { className: "app", children: [
1549
- /* @__PURE__ */ c("header", { className: "app__header", children: [
2045
+ return /* @__PURE__ */ s(va, { value: _t, children: /* @__PURE__ */ l("div", { className: "app", children: [
2046
+ /* @__PURE__ */ l("header", { className: "app__header", children: [
1550
2047
  /* @__PURE__ */ s("h1", { children: "🔧 Azure Pipelines Visualizer" }),
1551
- /* @__PURE__ */ s(Ie, { children: /* @__PURE__ */ s(ca, { ...t }) })
1552
- ] }),
1553
- /* @__PURE__ */ c("main", { className: "app__main", children: [
1554
- /* @__PURE__ */ s("section", { className: "app__content", children: /* @__PURE__ */ s(Ie, { children: /* @__PURE__ */ s(qt, {}) }) }),
1555
- n && /* @__PURE__ */ c(et, { children: [
2048
+ /* @__PURE__ */ l("nav", { className: "app__nav", children: [
1556
2049
  /* @__PURE__ */ s(
1557
- "div",
2050
+ "button",
1558
2051
  {
1559
- className: "app__detail-resize-handle",
1560
- onMouseDown: v,
1561
- title: "Drag to resize"
2052
+ className: `app__nav-btn ${u === "pipeline" ? "app__nav-btn--active" : ""}`,
2053
+ onClick: () => h("pipeline"),
2054
+ type: "button",
2055
+ children: "Pipeline Templates"
1562
2056
  }
1563
2057
  ),
1564
- /* @__PURE__ */ s("aside", { className: "app__detail", style: { width: o }, children: /* @__PURE__ */ s(Ie, { children: /* @__PURE__ */ s(Lt, {}) }) })
1565
- ] })
2058
+ /* @__PURE__ */ s(
2059
+ "button",
2060
+ {
2061
+ className: `app__nav-btn ${u === "commit-flow" ? "app__nav-btn--active" : ""}`,
2062
+ onClick: () => h("commit-flow"),
2063
+ type: "button",
2064
+ children: "Commit Flow"
2065
+ }
2066
+ )
2067
+ ] }),
2068
+ u === "pipeline" && /* @__PURE__ */ s(Re, { children: /* @__PURE__ */ s(Aa, { ...e }) })
2069
+ ] }),
2070
+ /* @__PURE__ */ l("main", { className: "app__main", children: [
2071
+ u === "pipeline" && /* @__PURE__ */ l(Xe, { children: [
2072
+ /* @__PURE__ */ s("section", { className: "app__content", children: /* @__PURE__ */ s(Re, { children: /* @__PURE__ */ s(Sa, {}) }) }),
2073
+ o && /* @__PURE__ */ l(Xe, { children: [
2074
+ /* @__PURE__ */ s(
2075
+ "div",
2076
+ {
2077
+ className: "app__detail-resize-handle",
2078
+ onMouseDown: i,
2079
+ title: "Drag to resize"
2080
+ }
2081
+ ),
2082
+ /* @__PURE__ */ s("aside", { className: "app__detail", style: { width: n }, children: /* @__PURE__ */ s(Re, { children: /* @__PURE__ */ s(ga, {}) }) })
2083
+ ] })
2084
+ ] }),
2085
+ u === "commit-flow" && /* @__PURE__ */ s("section", { className: "app__content", children: /* @__PURE__ */ s(Re, { children: /* @__PURE__ */ s(ma, {}) }) })
1566
2086
  ] })
1567
2087
  ] }) });
1568
2088
  }
1569
- var Oe, Re = Dt;
2089
+ var Ze, Te = Mt;
1570
2090
  if (process.env.NODE_ENV === "production")
1571
- Oe = Re.createRoot, Re.hydrateRoot;
2091
+ Ze = Te.createRoot, Te.hydrateRoot;
1572
2092
  else {
1573
- var Ze = Re.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
1574
- Oe = function(t, e) {
1575
- Ze.usingClientEntryPoint = !0;
2093
+ var ot = Te.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
2094
+ Ze = function(e, t) {
2095
+ ot.usingClientEntryPoint = !0;
1576
2096
  try {
1577
- return Re.createRoot(t, e);
2097
+ return Te.createRoot(e, t);
1578
2098
  } finally {
1579
- Ze.usingClientEntryPoint = !1;
2099
+ ot.usingClientEntryPoint = !1;
1580
2100
  }
1581
2101
  };
1582
2102
  }
1583
- function Ra(t, e = {}) {
1584
- let a = { ...e };
1585
- const n = Oe(t);
1586
- function l(o) {
1587
- n.render(ht(ma, o));
2103
+ function Ya(e, t = {}) {
2104
+ let a = { ...t };
2105
+ const o = Ze(e);
2106
+ function r(n) {
2107
+ o.render(Rt(Ua, n));
1588
2108
  }
1589
- return l(a), {
1590
- unmount: () => n.unmount(),
1591
- update: (o) => {
1592
- a = { ...a, ...o }, l(a);
2109
+ return r(a), {
2110
+ unmount: () => o.unmount(),
2111
+ update: (n) => {
2112
+ a = { ...a, ...n }, r(a);
1593
2113
  }
1594
2114
  };
1595
2115
  }
1596
2116
  export {
1597
- ma as App,
1598
- Lt as DetailPanel,
1599
- Ie as ErrorBoundary,
1600
- Bt as FileNode,
1601
- qt as PipelineDiagram,
1602
- ca as PipelineSelector,
1603
- Kt as TemplateEdge,
1604
- ct as fetchFileByRepoName,
1605
- ra as fetchPipelineYaml,
1606
- wa as fetchPipelines,
1607
- la as fetchTaskDocsConfig,
1608
- ia as fetchTaskSchema,
1609
- Fe as getLayoutedElements,
1610
- Ra as mount,
1611
- Te as usePipelineStore
2117
+ Ua as App,
2118
+ ga as DetailPanel,
2119
+ Re as ErrorBoundary,
2120
+ wa as FileNode,
2121
+ Sa as PipelineDiagram,
2122
+ Aa as PipelineSelector,
2123
+ xa as TemplateEdge,
2124
+ _t as fetchFileByRepoName,
2125
+ qt as fetchPipelineYaml,
2126
+ qa as fetchPipelines,
2127
+ Yt as fetchTaskDocsConfig,
2128
+ Jt as fetchTaskSchema,
2129
+ Ke as getLayoutedElements,
2130
+ Ya as mount,
2131
+ Ve as usePipelineStore
1612
2132
  };