flowpilot 0.0.2 → 0.0.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.
@@ -0,0 +1,1922 @@
1
+ import { a as useRef, c as Fragment, i as useReducer, n as instance, r as useEffect, s as render, t as jsxDEV } from "./jsx-dev-runtime-DOO7Tqjo.js";
2
+ import { t as filterByRelevance } from "./search-cPm8k8mK.js";
3
+ //#region src/commands/release/client.tsx
4
+ const initPromise = typeof window !== "undefined" && window.__I18N_LOCALE__ && window.__I18N_RESOURCES__ ? instance.init({
5
+ lng: window.__I18N_LOCALE__,
6
+ fallbackLng: "zh-CN",
7
+ resources: window.__I18N_RESOURCES__,
8
+ interpolation: { escapeValue: false }
9
+ }) : Promise.resolve();
10
+ const t = instance.t;
11
+ const releaseStyle = `
12
+ .page-header {
13
+ margin-bottom: 28px;
14
+ animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
15
+ }
16
+ .page-header h2 {
17
+ font-size: 22px;
18
+ font-weight: 600;
19
+ letter-spacing: -0.02em;
20
+ margin-bottom: 6px;
21
+ }
22
+ .page-header p {
23
+ font-size: 13px;
24
+ color: var(--text-2);
25
+ font-weight: 300;
26
+ line-height: 1.5;
27
+ }
28
+
29
+ /* ── Pipeline ── */
30
+ .pipeline {
31
+ display: flex;
32
+ align-items: center;
33
+ gap: 0;
34
+ margin-bottom: 28px;
35
+ animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) 0.08s both;
36
+ }
37
+ .pipeline-step {
38
+ display: flex;
39
+ align-items: center;
40
+ gap: 6px;
41
+ font-size: 11px;
42
+ font-family: var(--mono);
43
+ color: var(--text-3);
44
+ font-weight: 400;
45
+ white-space: nowrap;
46
+ }
47
+ .pipeline-step.active {
48
+ color: var(--neon);
49
+ font-weight: 500;
50
+ }
51
+ .pipeline-step.done {
52
+ color: var(--cyan);
53
+ }
54
+ .pipeline-node {
55
+ width: 8px; height: 8px;
56
+ border-radius: 50%;
57
+ background: var(--text-3);
58
+ transition: background 0.3s, box-shadow 0.3s;
59
+ }
60
+ .pipeline-step.active .pipeline-node {
61
+ background: var(--neon);
62
+ box-shadow: 0 0 8px var(--neon-glow);
63
+ animation: neon-pulse 2s ease infinite;
64
+ }
65
+ .pipeline-step.done .pipeline-node {
66
+ background: var(--cyan);
67
+ box-shadow: 0 0 4px var(--cyan-glow);
68
+ }
69
+ .pipeline-line {
70
+ width: 32px;
71
+ height: 1px;
72
+ background: var(--border);
73
+ margin: 0 4px;
74
+ transition: background 0.3s;
75
+ }
76
+ .pipeline-line.done { background: var(--cyan); }
77
+
78
+ /* ── Generic select ── */
79
+ .sel {
80
+ position: relative;
81
+ margin-bottom: 16px;
82
+ animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) 0.12s both;
83
+ z-index: 1;
84
+ }
85
+ .sel-trigger {
86
+ width: 100%;
87
+ display: flex;
88
+ align-items: center;
89
+ gap: 8px;
90
+ padding: 12px 14px;
91
+ font-size: 13px;
92
+ font-family: var(--sans);
93
+ color: var(--text-1, #E2E8F0);
94
+ background: var(--bg-input, #0A0E14);
95
+ border: 1px solid var(--border);
96
+ border-radius: 8px;
97
+ cursor: pointer;
98
+ outline: none;
99
+ transition: border-color 0.2s, box-shadow 0.2s;
100
+ text-align: left;
101
+ }
102
+ .sel-trigger:hover { border-color: var(--border-active); }
103
+ .sel-trigger:focus,
104
+ .sel-trigger.open {
105
+ border-color: var(--neon);
106
+ box-shadow: 0 0 0 2px var(--neon-soft), 0 0 8px var(--neon-glow);
107
+ }
108
+ .sel-trigger-label {
109
+ font-size: 11px;
110
+ color: var(--text-3, #64748B);
111
+ flex-shrink: 0;
112
+ }
113
+ .sel-trigger-value {
114
+ flex: 1;
115
+ font-family: var(--mono);
116
+ font-size: 13px;
117
+ font-weight: 500;
118
+ color: var(--text-1, #E2E8F0);
119
+ }
120
+ .sel-trigger-value.empty {
121
+ color: var(--text-3);
122
+ font-weight: 300;
123
+ }
124
+ .sel-trigger-arrow {
125
+ color: var(--text-3, #64748B);
126
+ font-size: 10px;
127
+ transition: transform 0.2s;
128
+ }
129
+ .sel-trigger.open .sel-trigger-arrow {
130
+ transform: rotate(180deg);
131
+ }
132
+ .sel-dropdown {
133
+ position: absolute;
134
+ top: calc(100% + 6px);
135
+ left: 0; right: 0;
136
+ max-height: 280px;
137
+ overflow-y: auto;
138
+ background: var(--bg-card, #111820);
139
+ border: 1px solid rgba(0,255,136,0.08);
140
+ border-radius: 8px;
141
+ box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 12px rgba(0,255,136,0.03);
142
+ z-index: 1000;
143
+ animation: dropdown-in 0.12s ease both;
144
+ }
145
+ .sel-dropdown::-webkit-scrollbar { width: 6px; }
146
+ .sel-dropdown::-webkit-scrollbar-track { background: transparent; }
147
+ .sel-dropdown::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
148
+ .sel-search {
149
+ padding: 8px;
150
+ border-bottom: 1px solid var(--border);
151
+ position: sticky;
152
+ top: 0;
153
+ background: var(--bg-card, #111820);
154
+ z-index: 1;
155
+ }
156
+ .sel-search-input {
157
+ width: 100%;
158
+ padding: 6px 10px;
159
+ font-size: 12px;
160
+ font-family: var(--mono);
161
+ color: var(--text-1, #E2E8F0);
162
+ background: var(--bg-void, #0A0A0F);
163
+ border: 1px solid var(--border);
164
+ border-radius: 4px;
165
+ outline: none;
166
+ transition: border-color 0.15s;
167
+ }
168
+ .sel-search-input::placeholder { color: var(--text-3); }
169
+ .sel-search-input:focus { border-color: var(--neon); }
170
+ .sel-item {
171
+ padding: 10px 14px;
172
+ font-size: 13px;
173
+ cursor: pointer;
174
+ transition: background 0.1s;
175
+ border-left: 3px solid transparent;
176
+ color: var(--text-1, #E2E8F0);
177
+ }
178
+ .sel-item:first-child { border-radius: 7px 7px 0 0; }
179
+ .sel-item:last-child { border-radius: 0 0 7px 7px; }
180
+ .sel-item:hover,
181
+ .sel-item.highlighted { background: var(--bg-hover, rgba(0,255,136,0.04)); }
182
+ .sel-item.active {
183
+ background: var(--neon-soft, rgba(0,255,136,0.08));
184
+ border-left-color: var(--neon);
185
+ font-weight: 500;
186
+ }
187
+ .sel-item-name { font-weight: 500; color: var(--text-1, #E2E8F0); }
188
+ .sel-item-sub { font-size: 11px; color: var(--text-3, #64748B); font-family: var(--mono); margin-top: 2px; }
189
+ .sel-empty { padding: 12px; text-align: center; color: var(--text-3, #64748B); font-size: 12px; }
190
+
191
+ /* ── Spinner ── */
192
+ .spinner {
193
+ display: inline-block;
194
+ width: 14px; height: 14px;
195
+ border: 2px solid var(--border);
196
+ border-top-color: var(--neon);
197
+ border-radius: 50%;
198
+ animation: spin 0.6s linear infinite;
199
+ }
200
+ @keyframes spin { to { transform: rotate(360deg); } }
201
+ .loading-row {
202
+ display: flex;
203
+ align-items: center;
204
+ gap: 8px;
205
+ padding: 10px 14px;
206
+ color: var(--text-3);
207
+ font-size: 13px;
208
+ margin-bottom: 16px;
209
+ animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
210
+ }
211
+
212
+ /* ── Version display ── */
213
+ .version-display {
214
+ display: flex;
215
+ align-items: center;
216
+ gap: 12px;
217
+ padding: 14px 20px;
218
+ background: var(--bg-card);
219
+ border: 1px solid rgba(0,212,255,0.08);
220
+ border-radius: 8px;
221
+ animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
222
+ }
223
+ .version-tag { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; font-family: var(--mono); }
224
+ .version-number { font-size: 20px; font-weight: 600; font-family: var(--mono); color: var(--cyan); letter-spacing: -0.01em; }
225
+ .version-error { color: var(--error); font-size: 13px; animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) both; }
226
+
227
+ .empty-hint { text-align: center; padding: 32px 0; color: var(--text-3); font-size: 13px; animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both; }
228
+ .state-error { color: var(--error); font-size: 13px; animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) both; }
229
+
230
+ /* ── Jira ── */
231
+ .jira-section { margin-top: 20px; animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) both; }
232
+ .jira-btn {
233
+ width: 100%;
234
+ min-height: 44px;
235
+ padding: 10px 20px;
236
+ font-size: 13px;
237
+ font-family: var(--sans);
238
+ font-weight: 500;
239
+ color: var(--bg-void);
240
+ background: var(--neon);
241
+ border: none;
242
+ border-radius: 8px;
243
+ cursor: pointer;
244
+ transition: background 0.15s, box-shadow 0.2s;
245
+ margin-top: 16px;
246
+ position: relative;
247
+ z-index: 1;
248
+ }
249
+ .jira-btn:hover { background: var(--neon-hover); box-shadow: 0 0 12px var(--neon-glow), 0 2px 12px rgba(0,255,136,0.2); }
250
+ .jira-btn:disabled { opacity: 0.5; cursor: not-allowed; }
251
+
252
+ /* ── Custom Checkbox ── */
253
+ input[type="checkbox"] {
254
+ appearance: none;
255
+ width: 16px;
256
+ height: 16px;
257
+ border: 1px solid var(--border, rgba(0,255,136,0.2));
258
+ border-radius: 3px;
259
+ background: var(--bg-input, #0A0E14);
260
+ cursor: pointer;
261
+ position: relative;
262
+ transition: border-color 0.15s, background 0.15s;
263
+ }
264
+ input[type="checkbox"]:checked {
265
+ background: var(--neon, #00ff88);
266
+ border-color: var(--neon, #00ff88);
267
+ }
268
+ input[type="checkbox"]:checked::after {
269
+ content: "✓";
270
+ position: absolute;
271
+ top: -1px;
272
+ left: 2px;
273
+ font-size: 12px;
274
+ font-weight: 700;
275
+ color: var(--bg-void, #0A0A0F);
276
+ }
277
+ input[type="checkbox"]:focus-visible {
278
+ outline: 2px solid var(--neon-soft, rgba(0,255,136,0.2));
279
+ outline-offset: 2px;
280
+ }
281
+ .jira-result {
282
+ margin-top: 12px;
283
+ padding: 12px 16px;
284
+ background: var(--bg-card);
285
+ border: 1px solid var(--border);
286
+ border-radius: 8px;
287
+ animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
288
+ position: relative;
289
+ z-index: 1;
290
+ }
291
+ .jira-result-key {
292
+ font-family: var(--mono);
293
+ font-size: 14px;
294
+ font-weight: 600;
295
+ color: var(--neon);
296
+ text-decoration: none;
297
+ border-bottom: 1px dashed rgba(0,255,136,0.3);
298
+ transition: border-color 0.2s;
299
+ }
300
+ .jira-result-key:hover { border-bottom-color: var(--neon); }
301
+ .jira-result-label { font-size: 11px; color: var(--text-3); margin-bottom: 4px; }
302
+ .jira-result-badge { display: inline-block; font-size: 10px; padding: 2px 8px; border-radius: 4px; margin-left: 8px; font-weight: 500; }
303
+ .jira-result-badge.created { background: var(--neon-soft); color: var(--neon); }
304
+ .jira-result-badge.exists { background: var(--cyan-soft); color: var(--cyan); }
305
+ .jira-error { margin-top: 12px; color: var(--error); font-size: 13px; animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) both; }
306
+
307
+ /* ── History ── */
308
+ .history-section {
309
+ margin-bottom: 24px;
310
+ animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) 0.06s both;
311
+ }
312
+ .history-title {
313
+ font-size: 16px;
314
+ font-weight: 600;
315
+ margin-bottom: 12px;
316
+ color: var(--text-1);
317
+ }
318
+ .history-list {
319
+ display: flex;
320
+ flex-direction: column;
321
+ gap: 8px;
322
+ }
323
+ .history-item {
324
+ display: flex;
325
+ flex-direction: column;
326
+ padding: 12px 16px;
327
+ background: var(--bg-card);
328
+ border: 1px solid var(--border);
329
+ border-radius: 8px;
330
+ transition: border-color 0.15s, box-shadow 0.15s;
331
+ animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
332
+ }
333
+ .history-item-row {
334
+ display: flex;
335
+ align-items: center;
336
+ justify-content: space-between;
337
+ }
338
+ .history-item:hover {
339
+ border-color: var(--border-active);
340
+ box-shadow: 0 2px 8px rgba(0,0,0,0.3);
341
+ }
342
+ .history-info {
343
+ display: flex;
344
+ align-items: center;
345
+ gap: 12px;
346
+ flex: 1;
347
+ }
348
+ .history-project { font-weight: 500; color: var(--text-1); font-size: 14px; }
349
+ .history-detail { font-size: 12px; color: var(--text-3); font-family: var(--mono); }
350
+ .history-actions { display: flex; align-items: center; gap: 8px; }
351
+ .history-quick-btn {
352
+ padding: 6px 14px;
353
+ font-size: 12px;
354
+ font-family: var(--sans);
355
+ font-weight: 500;
356
+ color: var(--bg-void);
357
+ background: var(--neon);
358
+ border: none;
359
+ border-radius: 6px;
360
+ cursor: pointer;
361
+ transition: background 0.15s;
362
+ }
363
+ .history-quick-btn:hover { background: var(--neon-hover); }
364
+ .history-quick-btn:disabled { opacity: 0.5; cursor: not-allowed; }
365
+ .history-quick-btn.executing {
366
+ background: var(--border);
367
+ color: var(--text-3);
368
+ }
369
+ .history-footer {
370
+ display: flex;
371
+ align-items: center;
372
+ justify-content: space-between;
373
+ margin-top: 16px;
374
+ padding-top: 16px;
375
+ border-top: 1px solid var(--border);
376
+ }
377
+ .history-new-btn {
378
+ padding: 8px 16px;
379
+ font-size: 13px;
380
+ font-family: var(--sans);
381
+ font-weight: 500;
382
+ color: var(--bg-void);
383
+ background: var(--neon);
384
+ border: none;
385
+ border-radius: 8px;
386
+ cursor: pointer;
387
+ transition: background 0.15s, box-shadow 0.2s;
388
+ }
389
+ .history-new-btn:hover { background: var(--neon-hover); box-shadow: 0 0 12px var(--neon-glow); }
390
+ .history-clear-btn {
391
+ padding: 8px 16px;
392
+ font-size: 13px;
393
+ font-family: var(--sans);
394
+ font-weight: 400;
395
+ color: var(--text-3);
396
+ background: transparent;
397
+ border: 1px solid var(--border);
398
+ border-radius: 8px;
399
+ cursor: pointer;
400
+ transition: border-color 0.15s, color 0.15s;
401
+ }
402
+ .history-clear-btn:hover { border-color: var(--error); color: var(--error); }
403
+ .history-result {
404
+ margin-top: 12px;
405
+ padding: 10px 14px;
406
+ background: var(--bg-void);
407
+ border: 1px solid rgba(0,255,136,0.08);
408
+ border-radius: 8px;
409
+ animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
410
+ }
411
+ .history-result-key {
412
+ font-family: var(--mono);
413
+ font-size: 14px;
414
+ font-weight: 600;
415
+ color: var(--neon);
416
+ text-decoration: none;
417
+ }
418
+ .history-result-error {
419
+ color: var(--error);
420
+ font-size: 13px;
421
+ }
422
+
423
+ /* ── Modal ── */
424
+ .modal-overlay {
425
+ position: fixed;
426
+ top: 0; left: 0; right: 0; bottom: 0;
427
+ background: rgba(0,0,0,0.7);
428
+ display: flex;
429
+ align-items: center;
430
+ justify-content: center;
431
+ z-index: 2000;
432
+ animation: fade-in 0.2s ease both;
433
+ }
434
+ .modal-content {
435
+ width: 90%;
436
+ max-width: 560px;
437
+ background: var(--bg-void);
438
+ border: 1px solid var(--border);
439
+ border-radius: 12px;
440
+ padding: 24px;
441
+ animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
442
+ }
443
+ .modal-header {
444
+ display: flex;
445
+ align-items: center;
446
+ justify-content: space-between;
447
+ margin-bottom: 20px;
448
+ }
449
+ .modal-title { font-size: 18px; font-weight: 600; color: var(--text-1); }
450
+ .modal-close {
451
+ width: 32px; height: 32px;
452
+ display: flex;
453
+ align-items: center;
454
+ justify-content: center;
455
+ font-size: 16px;
456
+ color: var(--text-3);
457
+ background: transparent;
458
+ border: 1px solid var(--border);
459
+ border-radius: 6px;
460
+ cursor: pointer;
461
+ transition: border-color 0.15s, color 0.15s;
462
+ }
463
+ .modal-close:hover { border-color: var(--text-2); color: var(--text-2); }
464
+ `;
465
+ const initial = {
466
+ jiraHost: "",
467
+ projects: [],
468
+ projectsLoading: true,
469
+ projectsError: "",
470
+ projectOpen: false,
471
+ projectSearch: "",
472
+ projectIndex: -1,
473
+ selected: null,
474
+ branches: [],
475
+ branchesLoading: false,
476
+ branchOpen: false,
477
+ branchSearch: "",
478
+ branchIndex: -1,
479
+ selectedBranch: "",
480
+ pomInfo: null,
481
+ pomLoading: false,
482
+ pomError: "",
483
+ jiraProjects: [],
484
+ jiraProjectsLoading: false,
485
+ jiraProjectOpen: false,
486
+ jiraProjectSearch: "",
487
+ jiraProjectIndex: -1,
488
+ selectedJiraProject: null,
489
+ jiraStatus: "idle",
490
+ jiraResult: null,
491
+ jiraError: "",
492
+ mrStatus: "idle",
493
+ mrUrl: "",
494
+ mrError: "",
495
+ mrBranches: [],
496
+ mrSourceBranch: "",
497
+ mrBranchOpen: false,
498
+ mrBranchSearch: "",
499
+ mrBranchIndex: -1,
500
+ history: [],
501
+ historyLoading: true,
502
+ quickExecuting: null,
503
+ quickResults: {},
504
+ quickErrors: {},
505
+ showNewModal: false,
506
+ clearConfirm: false,
507
+ createMrChecked: {}
508
+ };
509
+ const reducer = (state, action) => {
510
+ switch (action.type) {
511
+ case "SET_JIRA_HOST": return {
512
+ ...state,
513
+ jiraHost: action.host
514
+ };
515
+ case "PROJECTS_LOADED": return {
516
+ ...state,
517
+ projects: action.projects,
518
+ projectsLoading: false
519
+ };
520
+ case "PROJECTS_ERROR": return {
521
+ ...state,
522
+ projectsError: action.error,
523
+ projectsLoading: false
524
+ };
525
+ case "SET_PROJECT_OPEN": return {
526
+ ...state,
527
+ projectOpen: action.open,
528
+ ...action.open ? {} : {
529
+ projectSearch: "",
530
+ projectIndex: -1
531
+ }
532
+ };
533
+ case "SET_PROJECT_SEARCH": return {
534
+ ...state,
535
+ projectSearch: action.search,
536
+ projectIndex: -1
537
+ };
538
+ case "SET_PROJECT_INDEX": return {
539
+ ...state,
540
+ projectIndex: action.index
541
+ };
542
+ case "SELECT_PROJECT": return {
543
+ ...state,
544
+ selected: action.project,
545
+ projectOpen: false,
546
+ projectSearch: "",
547
+ projectIndex: -1,
548
+ branches: [],
549
+ branchesLoading: false,
550
+ selectedBranch: "",
551
+ branchOpen: false,
552
+ branchSearch: "",
553
+ branchIndex: -1,
554
+ pomInfo: null,
555
+ pomError: "",
556
+ selectedJiraProject: null,
557
+ jiraStatus: "idle",
558
+ jiraResult: null,
559
+ jiraError: "",
560
+ mrStatus: "idle",
561
+ mrUrl: "",
562
+ mrError: "",
563
+ mrBranches: [],
564
+ mrSourceBranch: "",
565
+ mrBranchOpen: false,
566
+ mrBranchSearch: "",
567
+ mrBranchIndex: -1
568
+ };
569
+ case "CLEAR_PROJECT": return {
570
+ ...state,
571
+ selected: null,
572
+ branches: [],
573
+ selectedBranch: "",
574
+ branchOpen: false,
575
+ branchSearch: "",
576
+ branchIndex: -1,
577
+ pomInfo: null,
578
+ pomError: "",
579
+ pomLoading: false,
580
+ selectedJiraProject: null,
581
+ jiraStatus: "idle",
582
+ jiraResult: null,
583
+ jiraError: "",
584
+ mrStatus: "idle",
585
+ mrUrl: "",
586
+ mrError: "",
587
+ mrBranches: [],
588
+ mrSourceBranch: "",
589
+ mrBranchOpen: false,
590
+ mrBranchSearch: "",
591
+ mrBranchIndex: -1
592
+ };
593
+ case "BRANCHES_LOADING": return {
594
+ ...state,
595
+ branchesLoading: true,
596
+ branches: [],
597
+ selectedBranch: ""
598
+ };
599
+ case "BRANCHES_LOADED": return {
600
+ ...state,
601
+ branches: action.branches,
602
+ branchesLoading: false
603
+ };
604
+ case "SET_BRANCH_OPEN": return {
605
+ ...state,
606
+ branchOpen: action.open,
607
+ ...action.open ? {} : {
608
+ branchSearch: "",
609
+ branchIndex: -1
610
+ }
611
+ };
612
+ case "SET_BRANCH_SEARCH": return {
613
+ ...state,
614
+ branchSearch: action.search,
615
+ branchIndex: -1
616
+ };
617
+ case "SET_BRANCH_INDEX": return {
618
+ ...state,
619
+ branchIndex: action.index
620
+ };
621
+ case "SELECT_BRANCH": return {
622
+ ...state,
623
+ selectedBranch: action.branch,
624
+ branchOpen: false,
625
+ branchSearch: "",
626
+ branchIndex: -1
627
+ };
628
+ case "POM_LOADING": return {
629
+ ...state,
630
+ pomLoading: true,
631
+ pomError: "",
632
+ pomInfo: null
633
+ };
634
+ case "POM_LOADED": return {
635
+ ...state,
636
+ pomLoading: false,
637
+ pomInfo: action.info
638
+ };
639
+ case "POM_ERROR": return {
640
+ ...state,
641
+ pomLoading: false,
642
+ pomError: action.error
643
+ };
644
+ case "JIRA_PROJECTS_LOADING": return {
645
+ ...state,
646
+ jiraProjectsLoading: true
647
+ };
648
+ case "JIRA_PROJECTS_LOADED": return {
649
+ ...state,
650
+ jiraProjects: action.projects,
651
+ jiraProjectsLoading: false
652
+ };
653
+ case "JIRA_PROJECTS_ERROR": return {
654
+ ...state,
655
+ jiraProjectsLoading: false
656
+ };
657
+ case "SET_JIRA_PROJECT_OPEN": return {
658
+ ...state,
659
+ jiraProjectOpen: action.open,
660
+ ...action.open ? {} : {
661
+ jiraProjectSearch: "",
662
+ jiraProjectIndex: -1
663
+ }
664
+ };
665
+ case "SET_JIRA_PROJECT_SEARCH": return {
666
+ ...state,
667
+ jiraProjectSearch: action.search,
668
+ jiraProjectIndex: -1
669
+ };
670
+ case "SET_JIRA_PROJECT_INDEX": return {
671
+ ...state,
672
+ jiraProjectIndex: action.index
673
+ };
674
+ case "SELECT_JIRA_PROJECT": return {
675
+ ...state,
676
+ selectedJiraProject: action.project,
677
+ jiraProjectOpen: false,
678
+ jiraProjectSearch: "",
679
+ jiraProjectIndex: -1,
680
+ jiraStatus: "idle",
681
+ jiraResult: null,
682
+ jiraError: ""
683
+ };
684
+ case "CLEAR_JIRA_PROJECT": return {
685
+ ...state,
686
+ selectedJiraProject: null,
687
+ jiraProjectOpen: false,
688
+ jiraProjectSearch: "",
689
+ jiraProjectIndex: -1,
690
+ jiraStatus: "idle",
691
+ jiraResult: null,
692
+ jiraError: ""
693
+ };
694
+ case "JIRA_CHECKING": return {
695
+ ...state,
696
+ jiraStatus: "checking",
697
+ jiraResult: null,
698
+ jiraError: ""
699
+ };
700
+ case "JIRA_CREATING": return {
701
+ ...state,
702
+ jiraStatus: "creating"
703
+ };
704
+ case "JIRA_DONE": return {
705
+ ...state,
706
+ jiraStatus: "done",
707
+ jiraResult: action.result
708
+ };
709
+ case "JIRA_ERROR": return {
710
+ ...state,
711
+ jiraStatus: "error",
712
+ jiraError: action.error
713
+ };
714
+ case "JIRA_RESET": return {
715
+ ...state,
716
+ jiraStatus: "idle",
717
+ jiraResult: null,
718
+ jiraError: ""
719
+ };
720
+ case "SET_HISTORY": return {
721
+ ...state,
722
+ history: action.history,
723
+ historyLoading: false
724
+ };
725
+ case "QUICK_EXEC_START": return {
726
+ ...state,
727
+ quickExecuting: action.id
728
+ };
729
+ case "QUICK_EXEC_SUCCESS": return {
730
+ ...state,
731
+ quickExecuting: null,
732
+ quickResults: {
733
+ ...state.quickResults,
734
+ [action.id]: action.result
735
+ }
736
+ };
737
+ case "QUICK_EXEC_FAIL": return {
738
+ ...state,
739
+ quickExecuting: null,
740
+ quickErrors: {
741
+ ...state.quickErrors,
742
+ [action.id]: action.error
743
+ }
744
+ };
745
+ case "SHOW_NEW_MODAL": return {
746
+ ...state,
747
+ showNewModal: true
748
+ };
749
+ case "HIDE_NEW_MODAL": return {
750
+ ...state,
751
+ showNewModal: false
752
+ };
753
+ case "CLEAR_CONFIRM_TOGGLE": return {
754
+ ...state,
755
+ clearConfirm: !state.clearConfirm
756
+ };
757
+ case "CLEAR_HISTORY_DONE": return {
758
+ ...state,
759
+ history: [],
760
+ clearConfirm: false,
761
+ quickResults: {},
762
+ quickErrors: {}
763
+ };
764
+ case "TOGGLE_CREATE_MR": return {
765
+ ...state,
766
+ createMrChecked: {
767
+ ...state.createMrChecked,
768
+ [action.id]: !state.createMrChecked[action.id]
769
+ }
770
+ };
771
+ case "MR_SELECTING": return {
772
+ ...state,
773
+ mrStatus: "selecting",
774
+ mrBranches: action.branches,
775
+ mrSourceBranch: "",
776
+ mrError: ""
777
+ };
778
+ case "MR_SOURCE_SELECTED": return {
779
+ ...state,
780
+ mrSourceBranch: action.branch,
781
+ mrBranchOpen: false,
782
+ mrBranchSearch: "",
783
+ mrBranchIndex: -1
784
+ };
785
+ case "SET_MR_BRANCH_OPEN": return {
786
+ ...state,
787
+ mrBranchOpen: action.open,
788
+ ...action.open ? {} : {
789
+ mrBranchSearch: "",
790
+ mrBranchIndex: -1
791
+ }
792
+ };
793
+ case "SET_MR_BRANCH_SEARCH": return {
794
+ ...state,
795
+ mrBranchSearch: action.search,
796
+ mrBranchIndex: -1
797
+ };
798
+ case "SET_MR_BRANCH_INDEX": return {
799
+ ...state,
800
+ mrBranchIndex: action.index
801
+ };
802
+ case "MR_LOADING": return {
803
+ ...state,
804
+ mrStatus: "loading",
805
+ mrBranches: [],
806
+ mrSourceBranch: "",
807
+ mrError: ""
808
+ };
809
+ case "MR_CREATING": return {
810
+ ...state,
811
+ mrStatus: "creating",
812
+ mrUrl: "",
813
+ mrError: "",
814
+ mrSourceBranch: ""
815
+ };
816
+ case "MR_DONE": return {
817
+ ...state,
818
+ mrStatus: "done",
819
+ mrUrl: action.mrUrl
820
+ };
821
+ case "MR_ERROR": return {
822
+ ...state,
823
+ mrStatus: "error",
824
+ mrError: action.error
825
+ };
826
+ }
827
+ };
828
+ const cleanVersion = (v) => (v ?? "").split("-")[0];
829
+ const selKeyDown = (e, open, len, idx, onSelect, onClose) => {
830
+ if (!open || len === 0) return void 0;
831
+ switch (e.key) {
832
+ case "ArrowDown":
833
+ e.preventDefault();
834
+ return Math.min(idx + 1, len - 1);
835
+ case "ArrowUp":
836
+ e.preventDefault();
837
+ return Math.max(idx - 1, -1);
838
+ case "Enter":
839
+ e.preventDefault();
840
+ if (idx >= 0) onSelect(idx);
841
+ return;
842
+ case "Escape":
843
+ onClose();
844
+ return;
845
+ }
846
+ };
847
+ const pipelineStepClass = (done, active) => done ? "pipeline-step done" : active ? "pipeline-step active" : "pipeline-step";
848
+ const pipelineLineClass = (done) => done ? "pipeline-line done" : "pipeline-line";
849
+ const HistoryList = ({ s, d }) => {
850
+ const handleQuickExecute = async (id) => {
851
+ d({
852
+ type: "QUICK_EXEC_START",
853
+ id
854
+ });
855
+ try {
856
+ const data = await (await fetch(`/release/api/history/${id}/execute`, {
857
+ method: "POST",
858
+ headers: { "Content-Type": "application/json" },
859
+ body: JSON.stringify({ createMr: s.createMrChecked[id] ?? false })
860
+ })).json();
861
+ if (data.error) d({
862
+ type: "QUICK_EXEC_FAIL",
863
+ id,
864
+ error: data.error
865
+ });
866
+ else {
867
+ d({
868
+ type: "QUICK_EXEC_SUCCESS",
869
+ id,
870
+ result: data
871
+ });
872
+ d({
873
+ type: "SET_HISTORY",
874
+ history: await (await fetch("/release/api/history")).json()
875
+ });
876
+ }
877
+ } catch (e) {
878
+ d({
879
+ type: "QUICK_EXEC_FAIL",
880
+ id,
881
+ error: e instanceof Error ? e.message : String(e)
882
+ });
883
+ }
884
+ };
885
+ const handleClearHistory = async () => {
886
+ await fetch("/release/api/history", { method: "DELETE" });
887
+ d({ type: "CLEAR_HISTORY_DONE" });
888
+ };
889
+ return /* @__PURE__ */ jsxDEV("div", {
890
+ class: "history-section",
891
+ children: [
892
+ /* @__PURE__ */ jsxDEV("div", {
893
+ class: "history-title",
894
+ children: t("web.historyTitle")
895
+ }),
896
+ s.history.length > 0 ? /* @__PURE__ */ jsxDEV("div", {
897
+ class: "history-list",
898
+ children: s.history.map((entry) => /* @__PURE__ */ jsxDEV("div", {
899
+ class: "history-item",
900
+ children: [
901
+ /* @__PURE__ */ jsxDEV("div", {
902
+ class: "history-item-row",
903
+ children: [/* @__PURE__ */ jsxDEV("div", {
904
+ class: "history-info",
905
+ children: [/* @__PURE__ */ jsxDEV("span", {
906
+ class: "history-project",
907
+ children: entry.projectName
908
+ }), /* @__PURE__ */ jsxDEV("span", {
909
+ class: "history-detail",
910
+ children: [
911
+ entry.branch,
912
+ " / ",
913
+ entry.jiraProjectKey
914
+ ]
915
+ })]
916
+ }), /* @__PURE__ */ jsxDEV("div", {
917
+ class: "history-actions",
918
+ children: [/* @__PURE__ */ jsxDEV("label", {
919
+ style: "display:flex;align-items:center;gap:4px;font-size:12px;color:var(--text-3);cursor:pointer",
920
+ children: [/* @__PURE__ */ jsxDEV("input", {
921
+ type: "checkbox",
922
+ checked: s.createMrChecked[entry.id] ?? false,
923
+ onChange: () => d({
924
+ type: "TOGGLE_CREATE_MR",
925
+ id: entry.id
926
+ })
927
+ }), t("web.createMrCheckbox")]
928
+ }), /* @__PURE__ */ jsxDEV("button", {
929
+ class: `history-quick-btn${s.quickExecuting === entry.id ? " executing" : ""}`,
930
+ type: "button",
931
+ disabled: s.quickExecuting !== null,
932
+ onClick: () => handleQuickExecute(entry.id),
933
+ children: s.quickExecuting === entry.id ? t("web.executing") : t("web.quickExecute")
934
+ })]
935
+ })]
936
+ }),
937
+ s.quickResults[entry.id] && /* @__PURE__ */ jsxDEV("div", {
938
+ class: "history-result",
939
+ children: [
940
+ /* @__PURE__ */ jsxDEV("a", {
941
+ class: "history-result-key",
942
+ href: s.quickResults[entry.id].issueUrl,
943
+ target: "_blank",
944
+ rel: "noreferrer",
945
+ children: s.quickResults[entry.id].issueKey
946
+ }),
947
+ /* @__PURE__ */ jsxDEV("span", {
948
+ style: "font-size:12px;color:var(--text-3);margin-left:8px",
949
+ children: ["v", s.quickResults[entry.id].version]
950
+ }),
951
+ s.quickResults[entry.id].versionCreated && /* @__PURE__ */ jsxDEV("span", {
952
+ style: "font-size:10px;color:var(--neon);margin-left:4px",
953
+ children: t("web.createdBadge")
954
+ }),
955
+ s.quickResults[entry.id].mrUrl && /* @__PURE__ */ jsxDEV("span", {
956
+ style: "font-size:12px;margin-left:12px",
957
+ children: /* @__PURE__ */ jsxDEV("a", {
958
+ href: s.quickResults[entry.id].mrUrl,
959
+ target: "_blank",
960
+ rel: "noreferrer",
961
+ style: "color:var(--cyan);text-decoration:none;border-bottom:1px dashed var(--cyan)",
962
+ children: "MR"
963
+ })
964
+ })
965
+ ]
966
+ }),
967
+ s.quickErrors[entry.id] && /* @__PURE__ */ jsxDEV("div", {
968
+ class: "history-result-error",
969
+ children: s.quickErrors[entry.id]
970
+ })
971
+ ]
972
+ }))
973
+ }) : /* @__PURE__ */ jsxDEV("div", {
974
+ class: "empty-hint",
975
+ children: t("web.noHistory")
976
+ }),
977
+ /* @__PURE__ */ jsxDEV("div", {
978
+ class: "history-footer",
979
+ children: [/* @__PURE__ */ jsxDEV("button", {
980
+ class: "history-new-btn",
981
+ type: "button",
982
+ onClick: () => d({ type: "SHOW_NEW_MODAL" }),
983
+ children: t("web.createNew")
984
+ }), s.history.length > 0 && (s.clearConfirm ? /* @__PURE__ */ jsxDEV("div", {
985
+ style: "display:flex;align-items:center;gap:8px",
986
+ children: [
987
+ /* @__PURE__ */ jsxDEV("span", {
988
+ style: "font-size:12px;color:var(--text-3)",
989
+ children: t("web.clearConfirm")
990
+ }),
991
+ /* @__PURE__ */ jsxDEV("button", {
992
+ class: "history-clear-btn",
993
+ type: "button",
994
+ style: "border-color:var(--error);color:var(--error)",
995
+ onClick: handleClearHistory,
996
+ children: t("web.clearHistory")
997
+ }),
998
+ /* @__PURE__ */ jsxDEV("button", {
999
+ class: "history-clear-btn",
1000
+ type: "button",
1001
+ onClick: () => d({ type: "CLEAR_CONFIRM_TOGGLE" }),
1002
+ children: t("web.cancel")
1003
+ })
1004
+ ]
1005
+ }) : /* @__PURE__ */ jsxDEV("button", {
1006
+ class: "history-clear-btn",
1007
+ type: "button",
1008
+ onClick: () => d({ type: "CLEAR_CONFIRM_TOGGLE" }),
1009
+ children: t("web.clearHistory")
1010
+ }))]
1011
+ })
1012
+ ]
1013
+ });
1014
+ };
1015
+ const ReleaseFlow = ({ s, d }) => {
1016
+ const projectSearchRef = useRef(null);
1017
+ const branchSearchRef = useRef(null);
1018
+ const jiraSearchRef = useRef(null);
1019
+ const mrBranchSearchRef = useRef(null);
1020
+ useEffect(() => {
1021
+ fetch("/release/api/config").then((r) => r.json()).then((data) => {
1022
+ if (data.jiraHost) d({
1023
+ type: "SET_JIRA_HOST",
1024
+ host: data.jiraHost
1025
+ });
1026
+ }).catch(() => {});
1027
+ }, []);
1028
+ useEffect(() => {
1029
+ fetch("/release/api/projects").then((r) => r.json()).then((data) => {
1030
+ if (data.error) d({
1031
+ type: "PROJECTS_ERROR",
1032
+ error: data.error
1033
+ });
1034
+ else d({
1035
+ type: "PROJECTS_LOADED",
1036
+ projects: data
1037
+ });
1038
+ }).catch((e) => d({
1039
+ type: "PROJECTS_ERROR",
1040
+ error: e.message
1041
+ }));
1042
+ }, []);
1043
+ useEffect(() => {
1044
+ if (!s.projectOpen && !s.branchOpen && !s.jiraProjectOpen && !s.mrBranchOpen) return;
1045
+ const handler = (e) => {
1046
+ const target = e.target;
1047
+ if (!target.closest(".sel") && !target.closest(".mr-branch-sel")) {
1048
+ d({
1049
+ type: "SET_PROJECT_OPEN",
1050
+ open: false
1051
+ });
1052
+ d({
1053
+ type: "SET_BRANCH_OPEN",
1054
+ open: false
1055
+ });
1056
+ d({
1057
+ type: "SET_MR_BRANCH_OPEN",
1058
+ open: false
1059
+ });
1060
+ d({
1061
+ type: "SET_JIRA_PROJECT_OPEN",
1062
+ open: false
1063
+ });
1064
+ }
1065
+ };
1066
+ document.addEventListener("click", handler);
1067
+ return () => document.removeEventListener("click", handler);
1068
+ }, [
1069
+ s.projectOpen,
1070
+ s.branchOpen,
1071
+ s.jiraProjectOpen
1072
+ ]);
1073
+ useEffect(() => {
1074
+ if (s.projectOpen) setTimeout(() => projectSearchRef.current?.focus(), 50);
1075
+ if (s.branchOpen) setTimeout(() => branchSearchRef.current?.focus(), 50);
1076
+ if (s.jiraProjectOpen) setTimeout(() => jiraSearchRef.current?.focus(), 50);
1077
+ if (s.mrBranchOpen) setTimeout(() => mrBranchSearchRef.current?.focus(), 50);
1078
+ }, [
1079
+ s.projectOpen,
1080
+ s.branchOpen,
1081
+ s.jiraProjectOpen,
1082
+ s.mrBranchOpen
1083
+ ]);
1084
+ useEffect(() => {
1085
+ if (s.mrStatus !== "creating" || !s.mrSourceBranch || !s.selected) return;
1086
+ const jiraUrl2 = s.jiraResult && s.jiraHost ? `${s.jiraHost}/browse/${s.jiraResult.key}` : "";
1087
+ fetch("/release/api/create-mr", {
1088
+ method: "POST",
1089
+ headers: { "Content-Type": "application/json" },
1090
+ body: JSON.stringify({
1091
+ projectId: s.selected.id,
1092
+ targetBranch: s.selectedBranch,
1093
+ sourceBranch: s.mrSourceBranch,
1094
+ jiraUrl: jiraUrl2
1095
+ })
1096
+ }).then((r) => r.json()).then((data) => {
1097
+ if (data.mrUrl) d({
1098
+ type: "MR_DONE",
1099
+ mrUrl: data.mrUrl
1100
+ });
1101
+ else d({
1102
+ type: "MR_ERROR",
1103
+ error: data.error ?? "Failed"
1104
+ });
1105
+ }).catch((e) => d({
1106
+ type: "MR_ERROR",
1107
+ error: e instanceof Error ? e.message : "Failed"
1108
+ }));
1109
+ }, [s.mrStatus, s.mrSourceBranch]);
1110
+ useEffect(() => {
1111
+ if (!s.pomInfo?.version || s.jiraProjects.length > 0 || s.jiraProjectsLoading) return;
1112
+ d({ type: "JIRA_PROJECTS_LOADING" });
1113
+ fetch("/release/api/jira/projects").then((r) => r.json()).then((data) => {
1114
+ if (Array.isArray(data)) d({
1115
+ type: "JIRA_PROJECTS_LOADED",
1116
+ projects: data
1117
+ });
1118
+ else d({
1119
+ type: "JIRA_PROJECTS_ERROR",
1120
+ error: data.error ?? "Failed"
1121
+ });
1122
+ }).catch(() => d({
1123
+ type: "JIRA_PROJECTS_ERROR",
1124
+ error: "Failed"
1125
+ }));
1126
+ }, [s.pomInfo?.version]);
1127
+ const fetchPom = (projectId, ref) => {
1128
+ d({ type: "POM_LOADING" });
1129
+ fetch(`/release/api/projects/${projectId}/pom-version?ref=${encodeURIComponent(ref)}`).then((r) => r.json()).then((data) => {
1130
+ if (data.error) d({
1131
+ type: "POM_ERROR",
1132
+ error: data.error
1133
+ });
1134
+ else d({
1135
+ type: "POM_LOADED",
1136
+ info: data
1137
+ });
1138
+ }).catch(() => d({
1139
+ type: "POM_ERROR",
1140
+ error: "Failed to fetch version"
1141
+ }));
1142
+ };
1143
+ const handleSelectProject = (project) => {
1144
+ d({
1145
+ type: "SELECT_PROJECT",
1146
+ project
1147
+ });
1148
+ d({ type: "BRANCHES_LOADING" });
1149
+ fetch(`/release/api/projects/${project.id}/branches`).then((r) => r.json()).then((data) => {
1150
+ d({
1151
+ type: "BRANCHES_LOADED",
1152
+ branches: "error" in data ? [] : data
1153
+ });
1154
+ }).catch(() => d({
1155
+ type: "BRANCHES_LOADED",
1156
+ branches: []
1157
+ }));
1158
+ };
1159
+ const handleSelectBranch = (name) => {
1160
+ d({
1161
+ type: "SELECT_BRANCH",
1162
+ branch: name
1163
+ });
1164
+ if (s.selected) fetchPom(s.selected.id, name);
1165
+ };
1166
+ const handleCreateIssue = async () => {
1167
+ if (!s.selected || !s.pomInfo?.version || !s.selectedJiraProject) return;
1168
+ const artifactId = s.pomInfo.artifactId ?? s.selected.name;
1169
+ const projectVersion = cleanVersion(s.pomInfo.version);
1170
+ const versionName = `${artifactId}-${projectVersion}`;
1171
+ const summary = `${artifactId}-${projectVersion} ${t("web.releaseSuffix") ?? t("release.releaseSuffix")}`;
1172
+ d({ type: "JIRA_CHECKING" });
1173
+ try {
1174
+ const searchData = await (await fetch("/release/api/jira/search", {
1175
+ method: "POST",
1176
+ headers: { "Content-Type": "application/json" },
1177
+ body: JSON.stringify({
1178
+ jql: `summary ~ "${summary}" AND project = ${s.selectedJiraProject.key}`,
1179
+ maxResults: 1
1180
+ })
1181
+ })).json();
1182
+ if (searchData.error) {
1183
+ d({
1184
+ type: "JIRA_ERROR",
1185
+ error: searchData.error
1186
+ });
1187
+ return;
1188
+ }
1189
+ if (searchData.total > 0 && searchData.issues?.[0]) {
1190
+ d({
1191
+ type: "JIRA_DONE",
1192
+ result: {
1193
+ key: searchData.issues[0].key,
1194
+ exists: true,
1195
+ versionName
1196
+ }
1197
+ });
1198
+ await fetch("/release/api/history", {
1199
+ method: "POST",
1200
+ headers: { "Content-Type": "application/json" },
1201
+ body: JSON.stringify({
1202
+ id: Date.now().toString(36),
1203
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
1204
+ projectId: s.selected.id,
1205
+ projectName: s.selected.name,
1206
+ projectPath: s.selected.pathWithNamespace ?? "",
1207
+ branch: s.selectedBranch,
1208
+ jiraProjectKey: s.selectedJiraProject.key
1209
+ })
1210
+ });
1211
+ return;
1212
+ }
1213
+ d({ type: "JIRA_CREATING" });
1214
+ const verData = await (await fetch("/release/api/jira/ensure-version", {
1215
+ method: "POST",
1216
+ headers: { "Content-Type": "application/json" },
1217
+ body: JSON.stringify({
1218
+ projectKey: s.selectedJiraProject.key,
1219
+ versionName
1220
+ })
1221
+ })).json();
1222
+ if (verData.error) {
1223
+ d({
1224
+ type: "JIRA_ERROR",
1225
+ error: verData.error
1226
+ });
1227
+ return;
1228
+ }
1229
+ const issueData = await (await fetch("/release/api/jira/create-issue", {
1230
+ method: "POST",
1231
+ headers: { "Content-Type": "application/json" },
1232
+ body: JSON.stringify({
1233
+ projectKey: s.selectedJiraProject.key,
1234
+ summary,
1235
+ issuetypeId: "10000",
1236
+ customfield_15800: "无",
1237
+ customfield_13410: [{ id: verData.id }],
1238
+ customfield_13341: [{ name: "licheng.li" }]
1239
+ })
1240
+ })).json();
1241
+ if (issueData.error) {
1242
+ d({
1243
+ type: "JIRA_ERROR",
1244
+ error: issueData.error
1245
+ });
1246
+ return;
1247
+ }
1248
+ d({
1249
+ type: "JIRA_DONE",
1250
+ result: {
1251
+ key: issueData.key,
1252
+ exists: false,
1253
+ versionName: verData.name
1254
+ }
1255
+ });
1256
+ await fetch("/release/api/history", {
1257
+ method: "POST",
1258
+ headers: { "Content-Type": "application/json" },
1259
+ body: JSON.stringify({
1260
+ id: Date.now().toString(36),
1261
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
1262
+ projectId: s.selected.id,
1263
+ projectName: s.selected.name,
1264
+ projectPath: s.selected.pathWithNamespace ?? "",
1265
+ branch: s.selectedBranch,
1266
+ jiraProjectKey: s.selectedJiraProject.key
1267
+ })
1268
+ });
1269
+ } catch (e) {
1270
+ d({
1271
+ type: "JIRA_ERROR",
1272
+ error: e instanceof Error ? e.message : String(e)
1273
+ });
1274
+ }
1275
+ };
1276
+ const fp = filterByRelevance(s.projects.map((p) => ({
1277
+ ...p,
1278
+ name: p.name,
1279
+ path: p.pathWithNamespace ?? ""
1280
+ })), s.projectSearch);
1281
+ const fb = filterByRelevance(s.branches.map((b) => ({
1282
+ ...b,
1283
+ name: b.name
1284
+ })), s.branchSearch);
1285
+ const fj = filterByRelevance(s.jiraProjects.map((p) => ({
1286
+ ...p,
1287
+ name: `${p.key} ${p.name ?? ""}`
1288
+ })), s.jiraProjectSearch);
1289
+ const jiraUrl = s.jiraResult && s.jiraHost ? `${s.jiraHost}/browse/${s.jiraResult.key}` : "";
1290
+ const step1Done = !!s.selected;
1291
+ const step1Active = !s.projectsLoading && !step1Done;
1292
+ const step2Done = !!s.selectedBranch;
1293
+ const step2Active = !!s.selected && !step2Done;
1294
+ const step3Done = !!s.pomInfo?.version;
1295
+ const step3Active = !!s.selectedBranch && !step3Done;
1296
+ const step4Done = !!s.selectedJiraProject;
1297
+ const step4Active = !!s.pomInfo?.version && !step4Done;
1298
+ const step5Done = !!s.jiraResult;
1299
+ const step5Active = !!s.selectedJiraProject && !step5Done;
1300
+ if (s.projectsLoading) return /* @__PURE__ */ jsxDEV("div", {
1301
+ class: "loading-row",
1302
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), t("web.loadingProjects")]
1303
+ });
1304
+ if (s.projectsError) return /* @__PURE__ */ jsxDEV("div", {
1305
+ class: "state-error",
1306
+ children: s.projectsError
1307
+ });
1308
+ return /* @__PURE__ */ jsxDEV("div", { children: [
1309
+ /* @__PURE__ */ jsxDEV("div", {
1310
+ class: "pipeline",
1311
+ children: [
1312
+ /* @__PURE__ */ jsxDEV("div", {
1313
+ class: pipelineStepClass(step1Done, step1Active),
1314
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "pipeline-node" }), t("web.projectLabel")]
1315
+ }),
1316
+ /* @__PURE__ */ jsxDEV("div", { class: pipelineLineClass(step1Done) }),
1317
+ /* @__PURE__ */ jsxDEV("div", {
1318
+ class: pipelineStepClass(step2Done, step2Active),
1319
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "pipeline-node" }), t("web.branchLabel")]
1320
+ }),
1321
+ /* @__PURE__ */ jsxDEV("div", { class: pipelineLineClass(step2Done) }),
1322
+ /* @__PURE__ */ jsxDEV("div", {
1323
+ class: pipelineStepClass(step3Done, step3Active),
1324
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "pipeline-node" }), t("web.versionTag")]
1325
+ }),
1326
+ /* @__PURE__ */ jsxDEV("div", { class: pipelineLineClass(step3Done) }),
1327
+ /* @__PURE__ */ jsxDEV("div", {
1328
+ class: pipelineStepClass(step4Done, step4Active),
1329
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "pipeline-node" }), t("web.jiraProjectLabel")]
1330
+ }),
1331
+ /* @__PURE__ */ jsxDEV("div", { class: pipelineLineClass(step4Done) }),
1332
+ /* @__PURE__ */ jsxDEV("div", {
1333
+ class: pipelineStepClass(step5Done, step5Active),
1334
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "pipeline-node" }), t("web.createBtn")]
1335
+ })
1336
+ ]
1337
+ }),
1338
+ /* @__PURE__ */ jsxDEV("div", {
1339
+ class: "sel",
1340
+ "data-sel": "project",
1341
+ style: `z-index:${s.projectOpen ? 100 : 1}`,
1342
+ children: [/* @__PURE__ */ jsxDEV("button", {
1343
+ class: `sel-trigger${s.projectOpen ? " open" : ""}`,
1344
+ type: "button",
1345
+ role: "combobox",
1346
+ "aria-expanded": s.projectOpen,
1347
+ "aria-haspopup": "listbox",
1348
+ onClick: () => {
1349
+ d({
1350
+ type: "SET_BRANCH_OPEN",
1351
+ open: false
1352
+ });
1353
+ d({
1354
+ type: "SET_JIRA_PROJECT_OPEN",
1355
+ open: false
1356
+ });
1357
+ d({
1358
+ type: "SET_MR_BRANCH_OPEN",
1359
+ open: false
1360
+ });
1361
+ d({
1362
+ type: "SET_PROJECT_OPEN",
1363
+ open: !s.projectOpen
1364
+ });
1365
+ },
1366
+ children: [
1367
+ /* @__PURE__ */ jsxDEV("span", {
1368
+ class: "sel-trigger-label",
1369
+ children: t("web.projectLabel")
1370
+ }),
1371
+ /* @__PURE__ */ jsxDEV("span", {
1372
+ class: `sel-trigger-value${s.selected ? "" : " empty"}`,
1373
+ children: s.selected ? s.selected.name : t("web.selectProject")
1374
+ }),
1375
+ /* @__PURE__ */ jsxDEV("span", {
1376
+ class: "sel-trigger-arrow",
1377
+ children: "▼"
1378
+ })
1379
+ ]
1380
+ }), s.projectOpen && /* @__PURE__ */ jsxDEV("div", {
1381
+ class: "sel-dropdown",
1382
+ role: "listbox",
1383
+ "aria-label": t("web.selectProject"),
1384
+ children: [/* @__PURE__ */ jsxDEV("div", {
1385
+ class: "sel-search",
1386
+ children: /* @__PURE__ */ jsxDEV("input", {
1387
+ ref: projectSearchRef,
1388
+ class: "sel-search-input",
1389
+ type: "text",
1390
+ placeholder: t("web.searchProjects"),
1391
+ value: s.projectSearch,
1392
+ onChange: (e) => d({
1393
+ type: "SET_PROJECT_SEARCH",
1394
+ search: e.target.value
1395
+ }),
1396
+ onKeyDown: (e) => {
1397
+ const n = selKeyDown(e, s.projectOpen, fp.length, s.projectIndex, (i) => {
1398
+ const p = fp[i];
1399
+ if (p) handleSelectProject(p);
1400
+ }, () => d({
1401
+ type: "SET_PROJECT_OPEN",
1402
+ open: false
1403
+ }));
1404
+ if (n !== void 0) d({
1405
+ type: "SET_PROJECT_INDEX",
1406
+ index: n
1407
+ });
1408
+ }
1409
+ })
1410
+ }), fp.length > 0 ? fp.map((p, i) => /* @__PURE__ */ jsxDEV("div", {
1411
+ class: `sel-item${s.selected?.id === p.id ? " active" : ""}${i === s.projectIndex ? " highlighted" : ""}`,
1412
+ onMouseEnter: () => d({
1413
+ type: "SET_PROJECT_INDEX",
1414
+ index: i
1415
+ }),
1416
+ onClick: () => handleSelectProject(p),
1417
+ children: [/* @__PURE__ */ jsxDEV("div", {
1418
+ class: "sel-item-name",
1419
+ children: p.name
1420
+ }), /* @__PURE__ */ jsxDEV("div", {
1421
+ class: "sel-item-sub",
1422
+ children: p.pathWithNamespace
1423
+ })]
1424
+ })) : /* @__PURE__ */ jsxDEV("div", {
1425
+ class: "sel-empty",
1426
+ children: t("web.noProjects")
1427
+ })]
1428
+ })]
1429
+ }),
1430
+ s.selected && (s.branchesLoading ? /* @__PURE__ */ jsxDEV("div", {
1431
+ class: "loading-row",
1432
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), t("web.loadingBranches")]
1433
+ }) : s.branches.length > 0 && /* @__PURE__ */ jsxDEV("div", {
1434
+ class: "sel",
1435
+ "data-sel": "branch",
1436
+ style: `z-index:${s.branchOpen ? 100 : 1}`,
1437
+ children: [/* @__PURE__ */ jsxDEV("button", {
1438
+ class: `sel-trigger${s.branchOpen ? " open" : ""}`,
1439
+ type: "button",
1440
+ role: "combobox",
1441
+ "aria-expanded": s.branchOpen,
1442
+ "aria-haspopup": "listbox",
1443
+ onClick: () => {
1444
+ d({
1445
+ type: "SET_PROJECT_OPEN",
1446
+ open: false
1447
+ });
1448
+ d({
1449
+ type: "SET_JIRA_PROJECT_OPEN",
1450
+ open: false
1451
+ });
1452
+ d({
1453
+ type: "SET_MR_BRANCH_OPEN",
1454
+ open: false
1455
+ });
1456
+ d({
1457
+ type: "SET_BRANCH_OPEN",
1458
+ open: !s.branchOpen
1459
+ });
1460
+ },
1461
+ children: [
1462
+ /* @__PURE__ */ jsxDEV("span", {
1463
+ class: "sel-trigger-label",
1464
+ children: t("web.branchLabel")
1465
+ }),
1466
+ /* @__PURE__ */ jsxDEV("span", {
1467
+ class: `sel-trigger-value${s.selectedBranch ? "" : " empty"}`,
1468
+ children: s.selectedBranch || t("web.selectBranch")
1469
+ }),
1470
+ /* @__PURE__ */ jsxDEV("span", {
1471
+ class: "sel-trigger-arrow",
1472
+ children: "▼"
1473
+ })
1474
+ ]
1475
+ }), s.branchOpen && /* @__PURE__ */ jsxDEV("div", {
1476
+ class: "sel-dropdown",
1477
+ role: "listbox",
1478
+ "aria-label": t("web.selectBranch"),
1479
+ children: [/* @__PURE__ */ jsxDEV("div", {
1480
+ class: "sel-search",
1481
+ children: /* @__PURE__ */ jsxDEV("input", {
1482
+ ref: branchSearchRef,
1483
+ class: "sel-search-input",
1484
+ type: "text",
1485
+ placeholder: t("web.filterBranches"),
1486
+ value: s.branchSearch,
1487
+ onChange: (e) => d({
1488
+ type: "SET_BRANCH_SEARCH",
1489
+ search: e.target.value
1490
+ }),
1491
+ onKeyDown: (e) => {
1492
+ const n = selKeyDown(e, s.branchOpen, fb.length, s.branchIndex, (i) => {
1493
+ const b = fb[i];
1494
+ if (b) handleSelectBranch(b.name);
1495
+ }, () => d({
1496
+ type: "SET_BRANCH_OPEN",
1497
+ open: false
1498
+ }));
1499
+ if (n !== void 0) d({
1500
+ type: "SET_BRANCH_INDEX",
1501
+ index: n
1502
+ });
1503
+ }
1504
+ })
1505
+ }), fb.length > 0 ? fb.map((b, i) => /* @__PURE__ */ jsxDEV("div", {
1506
+ class: `sel-item${b.name === s.selectedBranch ? " active" : ""}${i === s.branchIndex ? " highlighted" : ""}`,
1507
+ onMouseEnter: () => d({
1508
+ type: "SET_BRANCH_INDEX",
1509
+ index: i
1510
+ }),
1511
+ onClick: () => handleSelectBranch(b.name),
1512
+ children: [/* @__PURE__ */ jsxDEV("span", {
1513
+ class: "sel-item-name",
1514
+ children: b.name
1515
+ }), b.default && /* @__PURE__ */ jsxDEV("span", {
1516
+ style: "font-size:10px;color:var(--neon);margin-left:6px",
1517
+ children: t("web.defaultBranch")
1518
+ })]
1519
+ })) : /* @__PURE__ */ jsxDEV("div", {
1520
+ class: "sel-empty",
1521
+ children: t("web.noBranches")
1522
+ })]
1523
+ })]
1524
+ })),
1525
+ s.selected && s.selectedBranch && !s.branchesLoading && (s.pomLoading ? /* @__PURE__ */ jsxDEV("div", {
1526
+ class: "loading-row",
1527
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), t("web.loadingVersion")]
1528
+ }) : s.pomError ? /* @__PURE__ */ jsxDEV("div", {
1529
+ class: "version-error",
1530
+ role: "alert",
1531
+ children: s.pomError.includes("404") ? t("web.noPom") : s.pomError
1532
+ }) : s.pomInfo && /* @__PURE__ */ jsxDEV("div", {
1533
+ class: "version-display",
1534
+ children: [/* @__PURE__ */ jsxDEV("span", {
1535
+ class: "version-tag",
1536
+ children: t("web.versionTag")
1537
+ }), /* @__PURE__ */ jsxDEV("span", {
1538
+ class: "version-number",
1539
+ children: cleanVersion(s.pomInfo.version)
1540
+ })]
1541
+ })),
1542
+ s.selected && s.pomInfo?.version && !s.pomLoading && /* @__PURE__ */ jsxDEV("div", {
1543
+ class: "jira-section",
1544
+ children: [
1545
+ s.jiraProjectsLoading ? /* @__PURE__ */ jsxDEV("div", {
1546
+ class: "loading-row",
1547
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), t("web.loadingJiraProjects")]
1548
+ }) : /* @__PURE__ */ jsxDEV("div", {
1549
+ class: "sel",
1550
+ "data-sel": "jira",
1551
+ style: `z-index:${s.jiraProjectOpen ? 100 : 1}`,
1552
+ children: [/* @__PURE__ */ jsxDEV("button", {
1553
+ class: `sel-trigger${s.jiraProjectOpen ? " open" : ""}`,
1554
+ type: "button",
1555
+ role: "combobox",
1556
+ "aria-expanded": s.jiraProjectOpen,
1557
+ "aria-haspopup": "listbox",
1558
+ onClick: () => {
1559
+ d({
1560
+ type: "SET_PROJECT_OPEN",
1561
+ open: false
1562
+ });
1563
+ d({
1564
+ type: "SET_BRANCH_OPEN",
1565
+ open: false
1566
+ });
1567
+ d({
1568
+ type: "SET_JIRA_PROJECT_OPEN",
1569
+ open: !s.jiraProjectOpen
1570
+ });
1571
+ },
1572
+ children: [
1573
+ /* @__PURE__ */ jsxDEV("span", {
1574
+ class: "sel-trigger-label",
1575
+ children: t("web.jiraProjectLabel")
1576
+ }),
1577
+ /* @__PURE__ */ jsxDEV("span", {
1578
+ class: `sel-trigger-value${s.selectedJiraProject ? "" : " empty"}`,
1579
+ children: s.selectedJiraProject ? `${s.selectedJiraProject.key} - ${s.selectedJiraProject.name ?? ""}` : t("web.selectJiraProject")
1580
+ }),
1581
+ /* @__PURE__ */ jsxDEV("span", {
1582
+ class: "sel-trigger-arrow",
1583
+ children: "▼"
1584
+ })
1585
+ ]
1586
+ }), s.jiraProjectOpen && /* @__PURE__ */ jsxDEV("div", {
1587
+ class: "sel-dropdown",
1588
+ role: "listbox",
1589
+ "aria-label": t("web.selectJiraProject"),
1590
+ children: [/* @__PURE__ */ jsxDEV("div", {
1591
+ class: "sel-search",
1592
+ children: /* @__PURE__ */ jsxDEV("input", {
1593
+ ref: jiraSearchRef,
1594
+ class: "sel-search-input",
1595
+ type: "text",
1596
+ placeholder: t("web.searchJiraProject"),
1597
+ value: s.jiraProjectSearch,
1598
+ onChange: (e) => d({
1599
+ type: "SET_JIRA_PROJECT_SEARCH",
1600
+ search: e.target.value
1601
+ }),
1602
+ onKeyDown: (e) => {
1603
+ const n = selKeyDown(e, s.jiraProjectOpen, fj.length, s.jiraProjectIndex, (i) => {
1604
+ const p = fj[i];
1605
+ if (p) d({
1606
+ type: "SELECT_JIRA_PROJECT",
1607
+ project: p
1608
+ });
1609
+ }, () => d({
1610
+ type: "SET_JIRA_PROJECT_OPEN",
1611
+ open: false
1612
+ }));
1613
+ if (n !== void 0) d({
1614
+ type: "SET_JIRA_PROJECT_INDEX",
1615
+ index: n
1616
+ });
1617
+ }
1618
+ })
1619
+ }), fj.length > 0 ? fj.map((p, i) => /* @__PURE__ */ jsxDEV("div", {
1620
+ class: `sel-item${s.selectedJiraProject?.key === p.key ? " active" : ""}${i === s.jiraProjectIndex ? " highlighted" : ""}`,
1621
+ onMouseEnter: () => d({
1622
+ type: "SET_JIRA_PROJECT_INDEX",
1623
+ index: i
1624
+ }),
1625
+ onClick: () => d({
1626
+ type: "SELECT_JIRA_PROJECT",
1627
+ project: p
1628
+ }),
1629
+ children: [/* @__PURE__ */ jsxDEV("span", {
1630
+ class: "sel-item-name",
1631
+ children: p.key
1632
+ }), p.name && /* @__PURE__ */ jsxDEV("div", {
1633
+ class: "sel-item-sub",
1634
+ children: p.name
1635
+ })]
1636
+ })) : /* @__PURE__ */ jsxDEV("div", {
1637
+ class: "sel-empty",
1638
+ children: t("web.noJiraProjects")
1639
+ })]
1640
+ })]
1641
+ }),
1642
+ /* @__PURE__ */ jsxDEV("button", {
1643
+ class: "jira-btn",
1644
+ type: "button",
1645
+ disabled: !s.selectedJiraProject || s.jiraStatus === "checking" || s.jiraStatus === "creating",
1646
+ onClick: handleCreateIssue,
1647
+ children: s.jiraStatus === "checking" ? t("web.checkingBtn") : s.jiraStatus === "creating" ? t("web.creatingBtn") : t("web.createBtn")
1648
+ }),
1649
+ (s.jiraStatus === "checking" || s.jiraStatus === "creating") && /* @__PURE__ */ jsxDEV("div", {
1650
+ class: "loading-row",
1651
+ style: "margin-top:12px",
1652
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), s.jiraStatus === "checking" ? t("web.checkingIssues") : t("web.creatingIssue")]
1653
+ }),
1654
+ s.jiraResult && /* @__PURE__ */ jsxDEV("div", {
1655
+ class: "jira-result",
1656
+ children: [
1657
+ /* @__PURE__ */ jsxDEV("div", {
1658
+ class: "jira-result-label",
1659
+ children: s.jiraResult.exists ? t("web.versionExistsResult", { version: s.jiraResult.versionName }) : t("web.versionCreatedResult", { version: s.jiraResult.versionName })
1660
+ }),
1661
+ /* @__PURE__ */ jsxDEV("a", {
1662
+ class: "jira-result-key",
1663
+ href: jiraUrl,
1664
+ target: "_blank",
1665
+ rel: "noreferrer",
1666
+ children: s.jiraResult.key
1667
+ }),
1668
+ /* @__PURE__ */ jsxDEV("span", {
1669
+ class: `jira-result-badge ${s.jiraResult.exists ? "exists" : "created"}`,
1670
+ children: s.jiraResult.exists ? t("web.existsBadge") : t("web.createdBadge")
1671
+ })
1672
+ ]
1673
+ }),
1674
+ s.jiraError && /* @__PURE__ */ jsxDEV("div", {
1675
+ class: "jira-error",
1676
+ role: "alert",
1677
+ children: s.jiraError
1678
+ }),
1679
+ s.jiraResult && (s.mrStatus === "idle" || s.mrStatus === "loading") && /* @__PURE__ */ jsxDEV("button", {
1680
+ class: "jira-btn",
1681
+ type: "button",
1682
+ disabled: s.mrStatus === "loading",
1683
+ style: "background:var(--cyan);margin-top:12px",
1684
+ onClick: async () => {
1685
+ if (s.mrStatus === "loading") return;
1686
+ d({ type: "MR_LOADING" });
1687
+ try {
1688
+ const data = await (await fetch(`/release/api/projects/${s.selected.id}/branches`)).json();
1689
+ const branches = (Array.isArray(data) ? data : []).filter((b) => b.name !== s.selectedBranch);
1690
+ if (branches.length === 0) {
1691
+ d({
1692
+ type: "MR_ERROR",
1693
+ error: t("release.noSourceBranches")
1694
+ });
1695
+ return;
1696
+ }
1697
+ d({
1698
+ type: "MR_SELECTING",
1699
+ branches
1700
+ });
1701
+ } catch (e) {
1702
+ d({
1703
+ type: "MR_ERROR",
1704
+ error: e instanceof Error ? e.message : "Failed"
1705
+ });
1706
+ }
1707
+ },
1708
+ children: s.mrStatus === "loading" ? /* @__PURE__ */ jsxDEV(Fragment, { children: [/* @__PURE__ */ jsxDEV("span", {
1709
+ class: "spinner",
1710
+ style: "width:12px;height:12px;border-width:1px;margin-right:6px;vertical-align:middle"
1711
+ }), t("web.loadingMr")] }) : t("web.createMrBtn")
1712
+ }),
1713
+ s.mrStatus === "selecting" && (() => {
1714
+ const mrb = s.mrBranches.filter((b) => b.name.toLowerCase().includes(s.mrBranchSearch.toLowerCase()));
1715
+ return /* @__PURE__ */ jsxDEV("div", {
1716
+ class: "mr-branch-sel",
1717
+ style: "margin-top:12px",
1718
+ children: [/* @__PURE__ */ jsxDEV("div", {
1719
+ style: "font-size:13px;color:var(--text-2);margin-bottom:4px",
1720
+ children: t("release.selectMrBranch")
1721
+ }), /* @__PURE__ */ jsxDEV("div", {
1722
+ class: "sel",
1723
+ style: "position:relative;z-index:100",
1724
+ children: [/* @__PURE__ */ jsxDEV("button", {
1725
+ type: "button",
1726
+ class: "sel-trigger",
1727
+ onClick: () => d({
1728
+ type: "SET_MR_BRANCH_OPEN",
1729
+ open: !s.mrBranchOpen
1730
+ }),
1731
+ children: [
1732
+ /* @__PURE__ */ jsxDEV("span", {
1733
+ class: "sel-trigger-label",
1734
+ children: t("web.branchLabel")
1735
+ }),
1736
+ /* @__PURE__ */ jsxDEV("span", {
1737
+ class: `sel-trigger-value${s.mrSourceBranch ? "" : " empty"}`,
1738
+ children: s.mrSourceBranch || t("web.selectBranch")
1739
+ }),
1740
+ /* @__PURE__ */ jsxDEV("span", {
1741
+ class: "sel-trigger-arrow",
1742
+ children: "▼"
1743
+ })
1744
+ ]
1745
+ }), s.mrBranchOpen && /* @__PURE__ */ jsxDEV("div", {
1746
+ class: "sel-dropdown",
1747
+ role: "listbox",
1748
+ "aria-label": t("release.selectMrBranch"),
1749
+ children: [/* @__PURE__ */ jsxDEV("div", {
1750
+ class: "sel-search",
1751
+ children: /* @__PURE__ */ jsxDEV("input", {
1752
+ ref: mrBranchSearchRef,
1753
+ class: "sel-search-input",
1754
+ type: "text",
1755
+ placeholder: t("web.filterBranches"),
1756
+ value: s.mrBranchSearch,
1757
+ onChange: (e) => d({
1758
+ type: "SET_MR_BRANCH_SEARCH",
1759
+ search: e.target.value
1760
+ }),
1761
+ onKeyDown: (e) => {
1762
+ const n = selKeyDown(e, s.mrBranchOpen, mrb.length, s.mrBranchIndex, (i) => {
1763
+ if (mrb[i]) d({
1764
+ type: "MR_SOURCE_SELECTED",
1765
+ branch: mrb[i].name
1766
+ });
1767
+ }, () => d({
1768
+ type: "SET_MR_BRANCH_OPEN",
1769
+ open: false
1770
+ }));
1771
+ if (n !== void 0) d({
1772
+ type: "SET_MR_BRANCH_INDEX",
1773
+ index: n
1774
+ });
1775
+ }
1776
+ })
1777
+ }), mrb.length > 0 ? mrb.map((b, i) => /* @__PURE__ */ jsxDEV("div", {
1778
+ class: `sel-item${b.name === s.mrSourceBranch ? " active" : ""}${i === s.mrBranchIndex ? " highlighted" : ""}`,
1779
+ onMouseEnter: () => d({
1780
+ type: "SET_MR_BRANCH_INDEX",
1781
+ index: i
1782
+ }),
1783
+ onClick: () => d({
1784
+ type: "MR_SOURCE_SELECTED",
1785
+ branch: b.name
1786
+ }),
1787
+ children: [/* @__PURE__ */ jsxDEV("span", {
1788
+ class: "sel-item-name",
1789
+ children: b.name
1790
+ }), b.default && /* @__PURE__ */ jsxDEV("span", {
1791
+ style: "font-size:10px;color:var(--neon);margin-left:6px",
1792
+ children: t("web.defaultBranch")
1793
+ })]
1794
+ })) : /* @__PURE__ */ jsxDEV("div", {
1795
+ class: "sel-empty",
1796
+ children: t("web.noBranches")
1797
+ })]
1798
+ })]
1799
+ })]
1800
+ });
1801
+ })(),
1802
+ s.mrStatus === "selecting" && s.mrSourceBranch && /* @__PURE__ */ jsxDEV("div", {
1803
+ style: "margin-top:8px;display:flex;align-items:center;gap:8px",
1804
+ children: [/* @__PURE__ */ jsxDEV("span", {
1805
+ style: "font-size:12px;color:var(--text-2)",
1806
+ children: t("release.mrFromTo", {
1807
+ source: s.mrSourceBranch,
1808
+ target: s.selectedBranch
1809
+ })
1810
+ }), /* @__PURE__ */ jsxDEV("button", {
1811
+ class: "jira-btn",
1812
+ type: "button",
1813
+ style: "background:var(--cyan);font-size:13px;padding:4px 12px",
1814
+ onClick: () => d({ type: "MR_CREATING" }),
1815
+ children: t("release.confirmCreateMr")
1816
+ })]
1817
+ }),
1818
+ s.mrStatus === "creating" && /* @__PURE__ */ jsxDEV("div", {
1819
+ class: "loading-row",
1820
+ style: "margin-top:12px",
1821
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), t("release.creatingMrBtn")]
1822
+ }),
1823
+ s.mrStatus === "done" && s.mrUrl && /* @__PURE__ */ jsxDEV("div", {
1824
+ class: "jira-result",
1825
+ style: "margin-top:12px",
1826
+ children: [/* @__PURE__ */ jsxDEV("div", {
1827
+ class: "jira-result-label",
1828
+ children: "MR"
1829
+ }), /* @__PURE__ */ jsxDEV("a", {
1830
+ class: "jira-result-key",
1831
+ href: s.mrUrl,
1832
+ target: "_blank",
1833
+ rel: "noreferrer",
1834
+ children: t("release.mrCreated")
1835
+ })]
1836
+ }),
1837
+ s.mrStatus === "error" && s.mrError && /* @__PURE__ */ jsxDEV("div", {
1838
+ class: "jira-error",
1839
+ role: "alert",
1840
+ style: "margin-top:12px",
1841
+ children: s.mrError
1842
+ })
1843
+ ]
1844
+ }),
1845
+ !s.selected && /* @__PURE__ */ jsxDEV("div", {
1846
+ class: "empty-hint",
1847
+ children: t("web.emptyHint")
1848
+ })
1849
+ ] });
1850
+ };
1851
+ const ReleaseClient = () => {
1852
+ const [s, d] = useReducer(reducer, initial);
1853
+ useEffect(() => {
1854
+ fetch("/release/api/history").then((r) => r.json()).then((data) => d({
1855
+ type: "SET_HISTORY",
1856
+ history: Array.isArray(data) ? data : []
1857
+ })).catch(() => d({
1858
+ type: "SET_HISTORY",
1859
+ history: []
1860
+ }));
1861
+ }, []);
1862
+ return /* @__PURE__ */ jsxDEV("div", { children: [
1863
+ /* @__PURE__ */ jsxDEV("style", { children: releaseStyle }),
1864
+ /* @__PURE__ */ jsxDEV("div", {
1865
+ class: "page-header",
1866
+ children: [/* @__PURE__ */ jsxDEV("h2", { children: t("web.releaseTitle") }), /* @__PURE__ */ jsxDEV("p", { children: t("web.releaseDesc") })]
1867
+ }),
1868
+ s.historyLoading ? /* @__PURE__ */ jsxDEV("div", {
1869
+ class: "loading-row",
1870
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), t("web.loading")]
1871
+ }) : s.showNewModal ? /* @__PURE__ */ jsxDEV("div", {
1872
+ class: "modal-overlay",
1873
+ onClick: (e) => {
1874
+ if (e.target.classList.contains("modal-overlay")) fetch("/release/api/history").then((r) => r.json()).then((data) => {
1875
+ d({
1876
+ type: "SET_HISTORY",
1877
+ history: Array.isArray(data) ? data : []
1878
+ });
1879
+ d({ type: "HIDE_NEW_MODAL" });
1880
+ }).catch(() => d({ type: "HIDE_NEW_MODAL" }));
1881
+ },
1882
+ children: /* @__PURE__ */ jsxDEV("div", {
1883
+ class: "modal-content",
1884
+ children: [/* @__PURE__ */ jsxDEV("div", {
1885
+ class: "modal-header",
1886
+ children: [/* @__PURE__ */ jsxDEV("span", {
1887
+ class: "modal-title",
1888
+ children: t("web.newModalTitle")
1889
+ }), /* @__PURE__ */ jsxDEV("button", {
1890
+ class: "modal-close",
1891
+ type: "button",
1892
+ onClick: () => {
1893
+ fetch("/release/api/history").then((r) => r.json()).then((data) => {
1894
+ d({
1895
+ type: "SET_HISTORY",
1896
+ history: Array.isArray(data) ? data : []
1897
+ });
1898
+ d({ type: "HIDE_NEW_MODAL" });
1899
+ }).catch(() => d({ type: "HIDE_NEW_MODAL" }));
1900
+ },
1901
+ children: "✕"
1902
+ })]
1903
+ }), /* @__PURE__ */ jsxDEV(ReleaseFlow, {
1904
+ s,
1905
+ d
1906
+ })]
1907
+ })
1908
+ }) : s.history.length > 0 ? /* @__PURE__ */ jsxDEV(HistoryList, {
1909
+ s,
1910
+ d
1911
+ }) : /* @__PURE__ */ jsxDEV(ReleaseFlow, {
1912
+ s,
1913
+ d
1914
+ })
1915
+ ] });
1916
+ };
1917
+ const mount = async (el) => {
1918
+ await initPromise;
1919
+ render(/* @__PURE__ */ jsxDEV(ReleaseClient, {}), el);
1920
+ };
1921
+ //#endregion
1922
+ export { mount };