@meirblachman/azure-pipelines-visualizer 0.2.2 → 0.2.3

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