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,1921 @@
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
+ };
815
+ case "MR_DONE": return {
816
+ ...state,
817
+ mrStatus: "done",
818
+ mrUrl: action.mrUrl
819
+ };
820
+ case "MR_ERROR": return {
821
+ ...state,
822
+ mrStatus: "error",
823
+ mrError: action.error
824
+ };
825
+ }
826
+ };
827
+ const cleanVersion = (v) => (v ?? "").split("-")[0];
828
+ const selKeyDown = (e, open, len, idx, onSelect, onClose) => {
829
+ if (!open || len === 0) return void 0;
830
+ switch (e.key) {
831
+ case "ArrowDown":
832
+ e.preventDefault();
833
+ return Math.min(idx + 1, len - 1);
834
+ case "ArrowUp":
835
+ e.preventDefault();
836
+ return Math.max(idx - 1, -1);
837
+ case "Enter":
838
+ e.preventDefault();
839
+ if (idx >= 0) onSelect(idx);
840
+ return;
841
+ case "Escape":
842
+ onClose();
843
+ return;
844
+ }
845
+ };
846
+ const pipelineStepClass = (done, active) => done ? "pipeline-step done" : active ? "pipeline-step active" : "pipeline-step";
847
+ const pipelineLineClass = (done) => done ? "pipeline-line done" : "pipeline-line";
848
+ const HistoryList = ({ s, d }) => {
849
+ const handleQuickExecute = async (id) => {
850
+ d({
851
+ type: "QUICK_EXEC_START",
852
+ id
853
+ });
854
+ try {
855
+ const data = await (await fetch(`/release/api/history/${id}/execute`, {
856
+ method: "POST",
857
+ headers: { "Content-Type": "application/json" },
858
+ body: JSON.stringify({ createMr: s.createMrChecked[id] ?? false })
859
+ })).json();
860
+ if (data.error) d({
861
+ type: "QUICK_EXEC_FAIL",
862
+ id,
863
+ error: data.error
864
+ });
865
+ else {
866
+ d({
867
+ type: "QUICK_EXEC_SUCCESS",
868
+ id,
869
+ result: data
870
+ });
871
+ d({
872
+ type: "SET_HISTORY",
873
+ history: await (await fetch("/release/api/history")).json()
874
+ });
875
+ }
876
+ } catch (e) {
877
+ d({
878
+ type: "QUICK_EXEC_FAIL",
879
+ id,
880
+ error: e instanceof Error ? e.message : String(e)
881
+ });
882
+ }
883
+ };
884
+ const handleClearHistory = async () => {
885
+ await fetch("/release/api/history", { method: "DELETE" });
886
+ d({ type: "CLEAR_HISTORY_DONE" });
887
+ };
888
+ return /* @__PURE__ */ jsxDEV("div", {
889
+ class: "history-section",
890
+ children: [
891
+ /* @__PURE__ */ jsxDEV("div", {
892
+ class: "history-title",
893
+ children: t("web.historyTitle")
894
+ }),
895
+ s.history.length > 0 ? /* @__PURE__ */ jsxDEV("div", {
896
+ class: "history-list",
897
+ children: s.history.map((entry) => /* @__PURE__ */ jsxDEV("div", {
898
+ class: "history-item",
899
+ children: [
900
+ /* @__PURE__ */ jsxDEV("div", {
901
+ class: "history-item-row",
902
+ children: [/* @__PURE__ */ jsxDEV("div", {
903
+ class: "history-info",
904
+ children: [/* @__PURE__ */ jsxDEV("span", {
905
+ class: "history-project",
906
+ children: entry.projectName
907
+ }), /* @__PURE__ */ jsxDEV("span", {
908
+ class: "history-detail",
909
+ children: [
910
+ entry.branch,
911
+ " / ",
912
+ entry.jiraProjectKey
913
+ ]
914
+ })]
915
+ }), /* @__PURE__ */ jsxDEV("div", {
916
+ class: "history-actions",
917
+ children: [/* @__PURE__ */ jsxDEV("label", {
918
+ style: "display:flex;align-items:center;gap:4px;font-size:12px;color:var(--text-3);cursor:pointer",
919
+ children: [/* @__PURE__ */ jsxDEV("input", {
920
+ type: "checkbox",
921
+ checked: s.createMrChecked[entry.id] ?? false,
922
+ onChange: () => d({
923
+ type: "TOGGLE_CREATE_MR",
924
+ id: entry.id
925
+ })
926
+ }), t("web.createMrCheckbox")]
927
+ }), /* @__PURE__ */ jsxDEV("button", {
928
+ class: `history-quick-btn${s.quickExecuting === entry.id ? " executing" : ""}`,
929
+ type: "button",
930
+ disabled: s.quickExecuting !== null,
931
+ onClick: () => handleQuickExecute(entry.id),
932
+ children: s.quickExecuting === entry.id ? t("web.executing") : t("web.quickExecute")
933
+ })]
934
+ })]
935
+ }),
936
+ s.quickResults[entry.id] && /* @__PURE__ */ jsxDEV("div", {
937
+ class: "history-result",
938
+ children: [
939
+ /* @__PURE__ */ jsxDEV("a", {
940
+ class: "history-result-key",
941
+ href: s.quickResults[entry.id].issueUrl,
942
+ target: "_blank",
943
+ rel: "noreferrer",
944
+ children: s.quickResults[entry.id].issueKey
945
+ }),
946
+ /* @__PURE__ */ jsxDEV("span", {
947
+ style: "font-size:12px;color:var(--text-3);margin-left:8px",
948
+ children: ["v", s.quickResults[entry.id].version]
949
+ }),
950
+ s.quickResults[entry.id].versionCreated && /* @__PURE__ */ jsxDEV("span", {
951
+ style: "font-size:10px;color:var(--neon);margin-left:4px",
952
+ children: t("web.createdBadge")
953
+ }),
954
+ s.quickResults[entry.id].mrUrl && /* @__PURE__ */ jsxDEV("span", {
955
+ style: "font-size:12px;margin-left:12px",
956
+ children: /* @__PURE__ */ jsxDEV("a", {
957
+ href: s.quickResults[entry.id].mrUrl,
958
+ target: "_blank",
959
+ rel: "noreferrer",
960
+ style: "color:var(--cyan);text-decoration:none;border-bottom:1px dashed var(--cyan)",
961
+ children: "MR"
962
+ })
963
+ })
964
+ ]
965
+ }),
966
+ s.quickErrors[entry.id] && /* @__PURE__ */ jsxDEV("div", {
967
+ class: "history-result-error",
968
+ children: s.quickErrors[entry.id]
969
+ })
970
+ ]
971
+ }))
972
+ }) : /* @__PURE__ */ jsxDEV("div", {
973
+ class: "empty-hint",
974
+ children: t("web.noHistory")
975
+ }),
976
+ /* @__PURE__ */ jsxDEV("div", {
977
+ class: "history-footer",
978
+ children: [/* @__PURE__ */ jsxDEV("button", {
979
+ class: "history-new-btn",
980
+ type: "button",
981
+ onClick: () => d({ type: "SHOW_NEW_MODAL" }),
982
+ children: t("web.createNew")
983
+ }), s.history.length > 0 && (s.clearConfirm ? /* @__PURE__ */ jsxDEV("div", {
984
+ style: "display:flex;align-items:center;gap:8px",
985
+ children: [
986
+ /* @__PURE__ */ jsxDEV("span", {
987
+ style: "font-size:12px;color:var(--text-3)",
988
+ children: t("web.clearConfirm")
989
+ }),
990
+ /* @__PURE__ */ jsxDEV("button", {
991
+ class: "history-clear-btn",
992
+ type: "button",
993
+ style: "border-color:var(--error);color:var(--error)",
994
+ onClick: handleClearHistory,
995
+ children: t("web.clearHistory")
996
+ }),
997
+ /* @__PURE__ */ jsxDEV("button", {
998
+ class: "history-clear-btn",
999
+ type: "button",
1000
+ onClick: () => d({ type: "CLEAR_CONFIRM_TOGGLE" }),
1001
+ children: t("web.cancel")
1002
+ })
1003
+ ]
1004
+ }) : /* @__PURE__ */ jsxDEV("button", {
1005
+ class: "history-clear-btn",
1006
+ type: "button",
1007
+ onClick: () => d({ type: "CLEAR_CONFIRM_TOGGLE" }),
1008
+ children: t("web.clearHistory")
1009
+ }))]
1010
+ })
1011
+ ]
1012
+ });
1013
+ };
1014
+ const ReleaseFlow = ({ s, d }) => {
1015
+ const projectSearchRef = useRef(null);
1016
+ const branchSearchRef = useRef(null);
1017
+ const jiraSearchRef = useRef(null);
1018
+ const mrBranchSearchRef = useRef(null);
1019
+ useEffect(() => {
1020
+ fetch("/release/api/config").then((r) => r.json()).then((data) => {
1021
+ if (data.jiraHost) d({
1022
+ type: "SET_JIRA_HOST",
1023
+ host: data.jiraHost
1024
+ });
1025
+ }).catch(() => {});
1026
+ }, []);
1027
+ useEffect(() => {
1028
+ fetch("/release/api/projects").then((r) => r.json()).then((data) => {
1029
+ if (data.error) d({
1030
+ type: "PROJECTS_ERROR",
1031
+ error: data.error
1032
+ });
1033
+ else d({
1034
+ type: "PROJECTS_LOADED",
1035
+ projects: data
1036
+ });
1037
+ }).catch((e) => d({
1038
+ type: "PROJECTS_ERROR",
1039
+ error: e.message
1040
+ }));
1041
+ }, []);
1042
+ useEffect(() => {
1043
+ if (!s.projectOpen && !s.branchOpen && !s.jiraProjectOpen && !s.mrBranchOpen) return;
1044
+ const handler = (e) => {
1045
+ const target = e.target;
1046
+ if (!target.closest(".sel") && !target.closest(".mr-branch-sel")) {
1047
+ d({
1048
+ type: "SET_PROJECT_OPEN",
1049
+ open: false
1050
+ });
1051
+ d({
1052
+ type: "SET_BRANCH_OPEN",
1053
+ open: false
1054
+ });
1055
+ d({
1056
+ type: "SET_MR_BRANCH_OPEN",
1057
+ open: false
1058
+ });
1059
+ d({
1060
+ type: "SET_JIRA_PROJECT_OPEN",
1061
+ open: false
1062
+ });
1063
+ }
1064
+ };
1065
+ document.addEventListener("click", handler);
1066
+ return () => document.removeEventListener("click", handler);
1067
+ }, [
1068
+ s.projectOpen,
1069
+ s.branchOpen,
1070
+ s.jiraProjectOpen
1071
+ ]);
1072
+ useEffect(() => {
1073
+ if (s.projectOpen) setTimeout(() => projectSearchRef.current?.focus(), 50);
1074
+ if (s.branchOpen) setTimeout(() => branchSearchRef.current?.focus(), 50);
1075
+ if (s.jiraProjectOpen) setTimeout(() => jiraSearchRef.current?.focus(), 50);
1076
+ if (s.mrBranchOpen) setTimeout(() => mrBranchSearchRef.current?.focus(), 50);
1077
+ }, [
1078
+ s.projectOpen,
1079
+ s.branchOpen,
1080
+ s.jiraProjectOpen,
1081
+ s.mrBranchOpen
1082
+ ]);
1083
+ useEffect(() => {
1084
+ if (s.mrStatus !== "creating" || !s.mrSourceBranch || !s.selected) return;
1085
+ const jiraUrl2 = s.jiraResult && s.jiraHost ? `${s.jiraHost}/browse/${s.jiraResult.key}` : "";
1086
+ fetch("/release/api/create-mr", {
1087
+ method: "POST",
1088
+ headers: { "Content-Type": "application/json" },
1089
+ body: JSON.stringify({
1090
+ projectId: s.selected.id,
1091
+ targetBranch: s.selectedBranch,
1092
+ sourceBranch: s.mrSourceBranch,
1093
+ jiraUrl: jiraUrl2
1094
+ })
1095
+ }).then((r) => r.json()).then((data) => {
1096
+ if (data.mrUrl) d({
1097
+ type: "MR_DONE",
1098
+ mrUrl: data.mrUrl
1099
+ });
1100
+ else d({
1101
+ type: "MR_ERROR",
1102
+ error: data.error ?? "Failed"
1103
+ });
1104
+ }).catch((e) => d({
1105
+ type: "MR_ERROR",
1106
+ error: e instanceof Error ? e.message : "Failed"
1107
+ }));
1108
+ }, [s.mrStatus, s.mrSourceBranch]);
1109
+ useEffect(() => {
1110
+ if (!s.pomInfo?.version || s.jiraProjects.length > 0 || s.jiraProjectsLoading) return;
1111
+ d({ type: "JIRA_PROJECTS_LOADING" });
1112
+ fetch("/release/api/jira/projects").then((r) => r.json()).then((data) => {
1113
+ if (Array.isArray(data)) d({
1114
+ type: "JIRA_PROJECTS_LOADED",
1115
+ projects: data
1116
+ });
1117
+ else d({
1118
+ type: "JIRA_PROJECTS_ERROR",
1119
+ error: data.error ?? "Failed"
1120
+ });
1121
+ }).catch(() => d({
1122
+ type: "JIRA_PROJECTS_ERROR",
1123
+ error: "Failed"
1124
+ }));
1125
+ }, [s.pomInfo?.version]);
1126
+ const fetchPom = (projectId, ref) => {
1127
+ d({ type: "POM_LOADING" });
1128
+ fetch(`/release/api/projects/${projectId}/pom-version?ref=${encodeURIComponent(ref)}`).then((r) => r.json()).then((data) => {
1129
+ if (data.error) d({
1130
+ type: "POM_ERROR",
1131
+ error: data.error
1132
+ });
1133
+ else d({
1134
+ type: "POM_LOADED",
1135
+ info: data
1136
+ });
1137
+ }).catch(() => d({
1138
+ type: "POM_ERROR",
1139
+ error: "Failed to fetch version"
1140
+ }));
1141
+ };
1142
+ const handleSelectProject = (project) => {
1143
+ d({
1144
+ type: "SELECT_PROJECT",
1145
+ project
1146
+ });
1147
+ d({ type: "BRANCHES_LOADING" });
1148
+ fetch(`/release/api/projects/${project.id}/branches`).then((r) => r.json()).then((data) => {
1149
+ d({
1150
+ type: "BRANCHES_LOADED",
1151
+ branches: "error" in data ? [] : data
1152
+ });
1153
+ }).catch(() => d({
1154
+ type: "BRANCHES_LOADED",
1155
+ branches: []
1156
+ }));
1157
+ };
1158
+ const handleSelectBranch = (name) => {
1159
+ d({
1160
+ type: "SELECT_BRANCH",
1161
+ branch: name
1162
+ });
1163
+ if (s.selected) fetchPom(s.selected.id, name);
1164
+ };
1165
+ const handleCreateIssue = async () => {
1166
+ if (!s.selected || !s.pomInfo?.version || !s.selectedJiraProject) return;
1167
+ const artifactId = s.pomInfo.artifactId ?? s.selected.name;
1168
+ const projectVersion = cleanVersion(s.pomInfo.version);
1169
+ const versionName = `${artifactId}-${projectVersion}`;
1170
+ const summary = `${artifactId}-${projectVersion} ${t("web.releaseSuffix") ?? t("release.releaseSuffix")}`;
1171
+ d({ type: "JIRA_CHECKING" });
1172
+ try {
1173
+ const searchData = await (await fetch("/release/api/jira/search", {
1174
+ method: "POST",
1175
+ headers: { "Content-Type": "application/json" },
1176
+ body: JSON.stringify({
1177
+ jql: `summary ~ "${summary}" AND project = ${s.selectedJiraProject.key}`,
1178
+ maxResults: 1
1179
+ })
1180
+ })).json();
1181
+ if (searchData.error) {
1182
+ d({
1183
+ type: "JIRA_ERROR",
1184
+ error: searchData.error
1185
+ });
1186
+ return;
1187
+ }
1188
+ if (searchData.total > 0 && searchData.issues?.[0]) {
1189
+ d({
1190
+ type: "JIRA_DONE",
1191
+ result: {
1192
+ key: searchData.issues[0].key,
1193
+ exists: true,
1194
+ versionName
1195
+ }
1196
+ });
1197
+ await fetch("/release/api/history", {
1198
+ method: "POST",
1199
+ headers: { "Content-Type": "application/json" },
1200
+ body: JSON.stringify({
1201
+ id: Date.now().toString(36),
1202
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
1203
+ projectId: s.selected.id,
1204
+ projectName: s.selected.name,
1205
+ projectPath: s.selected.pathWithNamespace ?? "",
1206
+ branch: s.selectedBranch,
1207
+ jiraProjectKey: s.selectedJiraProject.key
1208
+ })
1209
+ });
1210
+ return;
1211
+ }
1212
+ d({ type: "JIRA_CREATING" });
1213
+ const verData = await (await fetch("/release/api/jira/ensure-version", {
1214
+ method: "POST",
1215
+ headers: { "Content-Type": "application/json" },
1216
+ body: JSON.stringify({
1217
+ projectKey: s.selectedJiraProject.key,
1218
+ versionName
1219
+ })
1220
+ })).json();
1221
+ if (verData.error) {
1222
+ d({
1223
+ type: "JIRA_ERROR",
1224
+ error: verData.error
1225
+ });
1226
+ return;
1227
+ }
1228
+ const issueData = await (await fetch("/release/api/jira/create-issue", {
1229
+ method: "POST",
1230
+ headers: { "Content-Type": "application/json" },
1231
+ body: JSON.stringify({
1232
+ projectKey: s.selectedJiraProject.key,
1233
+ summary,
1234
+ issuetypeId: "10000",
1235
+ customfield_15800: "无",
1236
+ customfield_13410: [{ id: verData.id }],
1237
+ customfield_13341: [{ name: "licheng.li" }]
1238
+ })
1239
+ })).json();
1240
+ if (issueData.error) {
1241
+ d({
1242
+ type: "JIRA_ERROR",
1243
+ error: issueData.error
1244
+ });
1245
+ return;
1246
+ }
1247
+ d({
1248
+ type: "JIRA_DONE",
1249
+ result: {
1250
+ key: issueData.key,
1251
+ exists: false,
1252
+ versionName: verData.name
1253
+ }
1254
+ });
1255
+ await fetch("/release/api/history", {
1256
+ method: "POST",
1257
+ headers: { "Content-Type": "application/json" },
1258
+ body: JSON.stringify({
1259
+ id: Date.now().toString(36),
1260
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
1261
+ projectId: s.selected.id,
1262
+ projectName: s.selected.name,
1263
+ projectPath: s.selected.pathWithNamespace ?? "",
1264
+ branch: s.selectedBranch,
1265
+ jiraProjectKey: s.selectedJiraProject.key
1266
+ })
1267
+ });
1268
+ } catch (e) {
1269
+ d({
1270
+ type: "JIRA_ERROR",
1271
+ error: e instanceof Error ? e.message : String(e)
1272
+ });
1273
+ }
1274
+ };
1275
+ const fp = filterByRelevance(s.projects.map((p) => ({
1276
+ ...p,
1277
+ name: p.name,
1278
+ path: p.pathWithNamespace ?? ""
1279
+ })), s.projectSearch);
1280
+ const fb = filterByRelevance(s.branches.map((b) => ({
1281
+ ...b,
1282
+ name: b.name
1283
+ })), s.branchSearch);
1284
+ const fj = filterByRelevance(s.jiraProjects.map((p) => ({
1285
+ ...p,
1286
+ name: `${p.key} ${p.name ?? ""}`
1287
+ })), s.jiraProjectSearch);
1288
+ const jiraUrl = s.jiraResult && s.jiraHost ? `${s.jiraHost}/browse/${s.jiraResult.key}` : "";
1289
+ const step1Done = !!s.selected;
1290
+ const step1Active = !s.projectsLoading && !step1Done;
1291
+ const step2Done = !!s.selectedBranch;
1292
+ const step2Active = !!s.selected && !step2Done;
1293
+ const step3Done = !!s.pomInfo?.version;
1294
+ const step3Active = !!s.selectedBranch && !step3Done;
1295
+ const step4Done = !!s.selectedJiraProject;
1296
+ const step4Active = !!s.pomInfo?.version && !step4Done;
1297
+ const step5Done = !!s.jiraResult;
1298
+ const step5Active = !!s.selectedJiraProject && !step5Done;
1299
+ if (s.projectsLoading) return /* @__PURE__ */ jsxDEV("div", {
1300
+ class: "loading-row",
1301
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), t("web.loadingProjects")]
1302
+ });
1303
+ if (s.projectsError) return /* @__PURE__ */ jsxDEV("div", {
1304
+ class: "state-error",
1305
+ children: s.projectsError
1306
+ });
1307
+ return /* @__PURE__ */ jsxDEV("div", { children: [
1308
+ /* @__PURE__ */ jsxDEV("div", {
1309
+ class: "pipeline",
1310
+ children: [
1311
+ /* @__PURE__ */ jsxDEV("div", {
1312
+ class: pipelineStepClass(step1Done, step1Active),
1313
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "pipeline-node" }), t("web.projectLabel")]
1314
+ }),
1315
+ /* @__PURE__ */ jsxDEV("div", { class: pipelineLineClass(step1Done) }),
1316
+ /* @__PURE__ */ jsxDEV("div", {
1317
+ class: pipelineStepClass(step2Done, step2Active),
1318
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "pipeline-node" }), t("web.branchLabel")]
1319
+ }),
1320
+ /* @__PURE__ */ jsxDEV("div", { class: pipelineLineClass(step2Done) }),
1321
+ /* @__PURE__ */ jsxDEV("div", {
1322
+ class: pipelineStepClass(step3Done, step3Active),
1323
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "pipeline-node" }), t("web.versionTag")]
1324
+ }),
1325
+ /* @__PURE__ */ jsxDEV("div", { class: pipelineLineClass(step3Done) }),
1326
+ /* @__PURE__ */ jsxDEV("div", {
1327
+ class: pipelineStepClass(step4Done, step4Active),
1328
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "pipeline-node" }), t("web.jiraProjectLabel")]
1329
+ }),
1330
+ /* @__PURE__ */ jsxDEV("div", { class: pipelineLineClass(step4Done) }),
1331
+ /* @__PURE__ */ jsxDEV("div", {
1332
+ class: pipelineStepClass(step5Done, step5Active),
1333
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "pipeline-node" }), t("web.createBtn")]
1334
+ })
1335
+ ]
1336
+ }),
1337
+ /* @__PURE__ */ jsxDEV("div", {
1338
+ class: "sel",
1339
+ "data-sel": "project",
1340
+ style: `z-index:${s.projectOpen ? 100 : 1}`,
1341
+ children: [/* @__PURE__ */ jsxDEV("button", {
1342
+ class: `sel-trigger${s.projectOpen ? " open" : ""}`,
1343
+ type: "button",
1344
+ role: "combobox",
1345
+ "aria-expanded": s.projectOpen,
1346
+ "aria-haspopup": "listbox",
1347
+ onClick: () => {
1348
+ d({
1349
+ type: "SET_BRANCH_OPEN",
1350
+ open: false
1351
+ });
1352
+ d({
1353
+ type: "SET_JIRA_PROJECT_OPEN",
1354
+ open: false
1355
+ });
1356
+ d({
1357
+ type: "SET_MR_BRANCH_OPEN",
1358
+ open: false
1359
+ });
1360
+ d({
1361
+ type: "SET_PROJECT_OPEN",
1362
+ open: !s.projectOpen
1363
+ });
1364
+ },
1365
+ children: [
1366
+ /* @__PURE__ */ jsxDEV("span", {
1367
+ class: "sel-trigger-label",
1368
+ children: t("web.projectLabel")
1369
+ }),
1370
+ /* @__PURE__ */ jsxDEV("span", {
1371
+ class: `sel-trigger-value${s.selected ? "" : " empty"}`,
1372
+ children: s.selected ? s.selected.name : t("web.selectProject")
1373
+ }),
1374
+ /* @__PURE__ */ jsxDEV("span", {
1375
+ class: "sel-trigger-arrow",
1376
+ children: "▼"
1377
+ })
1378
+ ]
1379
+ }), s.projectOpen && /* @__PURE__ */ jsxDEV("div", {
1380
+ class: "sel-dropdown",
1381
+ role: "listbox",
1382
+ "aria-label": t("web.selectProject"),
1383
+ children: [/* @__PURE__ */ jsxDEV("div", {
1384
+ class: "sel-search",
1385
+ children: /* @__PURE__ */ jsxDEV("input", {
1386
+ ref: projectSearchRef,
1387
+ class: "sel-search-input",
1388
+ type: "text",
1389
+ placeholder: t("web.searchProjects"),
1390
+ value: s.projectSearch,
1391
+ onChange: (e) => d({
1392
+ type: "SET_PROJECT_SEARCH",
1393
+ search: e.target.value
1394
+ }),
1395
+ onKeyDown: (e) => {
1396
+ const n = selKeyDown(e, s.projectOpen, fp.length, s.projectIndex, (i) => {
1397
+ const p = fp[i];
1398
+ if (p) handleSelectProject(p);
1399
+ }, () => d({
1400
+ type: "SET_PROJECT_OPEN",
1401
+ open: false
1402
+ }));
1403
+ if (n !== void 0) d({
1404
+ type: "SET_PROJECT_INDEX",
1405
+ index: n
1406
+ });
1407
+ }
1408
+ })
1409
+ }), fp.length > 0 ? fp.map((p, i) => /* @__PURE__ */ jsxDEV("div", {
1410
+ class: `sel-item${s.selected?.id === p.id ? " active" : ""}${i === s.projectIndex ? " highlighted" : ""}`,
1411
+ onMouseEnter: () => d({
1412
+ type: "SET_PROJECT_INDEX",
1413
+ index: i
1414
+ }),
1415
+ onClick: () => handleSelectProject(p),
1416
+ children: [/* @__PURE__ */ jsxDEV("div", {
1417
+ class: "sel-item-name",
1418
+ children: p.name
1419
+ }), /* @__PURE__ */ jsxDEV("div", {
1420
+ class: "sel-item-sub",
1421
+ children: p.pathWithNamespace
1422
+ })]
1423
+ })) : /* @__PURE__ */ jsxDEV("div", {
1424
+ class: "sel-empty",
1425
+ children: t("web.noProjects")
1426
+ })]
1427
+ })]
1428
+ }),
1429
+ s.selected && (s.branchesLoading ? /* @__PURE__ */ jsxDEV("div", {
1430
+ class: "loading-row",
1431
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), t("web.loadingBranches")]
1432
+ }) : s.branches.length > 0 && /* @__PURE__ */ jsxDEV("div", {
1433
+ class: "sel",
1434
+ "data-sel": "branch",
1435
+ style: `z-index:${s.branchOpen ? 100 : 1}`,
1436
+ children: [/* @__PURE__ */ jsxDEV("button", {
1437
+ class: `sel-trigger${s.branchOpen ? " open" : ""}`,
1438
+ type: "button",
1439
+ role: "combobox",
1440
+ "aria-expanded": s.branchOpen,
1441
+ "aria-haspopup": "listbox",
1442
+ onClick: () => {
1443
+ d({
1444
+ type: "SET_PROJECT_OPEN",
1445
+ open: false
1446
+ });
1447
+ d({
1448
+ type: "SET_JIRA_PROJECT_OPEN",
1449
+ open: false
1450
+ });
1451
+ d({
1452
+ type: "SET_MR_BRANCH_OPEN",
1453
+ open: false
1454
+ });
1455
+ d({
1456
+ type: "SET_BRANCH_OPEN",
1457
+ open: !s.branchOpen
1458
+ });
1459
+ },
1460
+ children: [
1461
+ /* @__PURE__ */ jsxDEV("span", {
1462
+ class: "sel-trigger-label",
1463
+ children: t("web.branchLabel")
1464
+ }),
1465
+ /* @__PURE__ */ jsxDEV("span", {
1466
+ class: `sel-trigger-value${s.selectedBranch ? "" : " empty"}`,
1467
+ children: s.selectedBranch || t("web.selectBranch")
1468
+ }),
1469
+ /* @__PURE__ */ jsxDEV("span", {
1470
+ class: "sel-trigger-arrow",
1471
+ children: "▼"
1472
+ })
1473
+ ]
1474
+ }), s.branchOpen && /* @__PURE__ */ jsxDEV("div", {
1475
+ class: "sel-dropdown",
1476
+ role: "listbox",
1477
+ "aria-label": t("web.selectBranch"),
1478
+ children: [/* @__PURE__ */ jsxDEV("div", {
1479
+ class: "sel-search",
1480
+ children: /* @__PURE__ */ jsxDEV("input", {
1481
+ ref: branchSearchRef,
1482
+ class: "sel-search-input",
1483
+ type: "text",
1484
+ placeholder: t("web.filterBranches"),
1485
+ value: s.branchSearch,
1486
+ onChange: (e) => d({
1487
+ type: "SET_BRANCH_SEARCH",
1488
+ search: e.target.value
1489
+ }),
1490
+ onKeyDown: (e) => {
1491
+ const n = selKeyDown(e, s.branchOpen, fb.length, s.branchIndex, (i) => {
1492
+ const b = fb[i];
1493
+ if (b) handleSelectBranch(b.name);
1494
+ }, () => d({
1495
+ type: "SET_BRANCH_OPEN",
1496
+ open: false
1497
+ }));
1498
+ if (n !== void 0) d({
1499
+ type: "SET_BRANCH_INDEX",
1500
+ index: n
1501
+ });
1502
+ }
1503
+ })
1504
+ }), fb.length > 0 ? fb.map((b, i) => /* @__PURE__ */ jsxDEV("div", {
1505
+ class: `sel-item${b.name === s.selectedBranch ? " active" : ""}${i === s.branchIndex ? " highlighted" : ""}`,
1506
+ onMouseEnter: () => d({
1507
+ type: "SET_BRANCH_INDEX",
1508
+ index: i
1509
+ }),
1510
+ onClick: () => handleSelectBranch(b.name),
1511
+ children: [/* @__PURE__ */ jsxDEV("span", {
1512
+ class: "sel-item-name",
1513
+ children: b.name
1514
+ }), b.default && /* @__PURE__ */ jsxDEV("span", {
1515
+ style: "font-size:10px;color:var(--neon);margin-left:6px",
1516
+ children: t("web.defaultBranch")
1517
+ })]
1518
+ })) : /* @__PURE__ */ jsxDEV("div", {
1519
+ class: "sel-empty",
1520
+ children: t("web.noBranches")
1521
+ })]
1522
+ })]
1523
+ })),
1524
+ s.selected && s.selectedBranch && !s.branchesLoading && (s.pomLoading ? /* @__PURE__ */ jsxDEV("div", {
1525
+ class: "loading-row",
1526
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), t("web.loadingVersion")]
1527
+ }) : s.pomError ? /* @__PURE__ */ jsxDEV("div", {
1528
+ class: "version-error",
1529
+ role: "alert",
1530
+ children: s.pomError.includes("404") ? t("web.noPom") : s.pomError
1531
+ }) : s.pomInfo && /* @__PURE__ */ jsxDEV("div", {
1532
+ class: "version-display",
1533
+ children: [/* @__PURE__ */ jsxDEV("span", {
1534
+ class: "version-tag",
1535
+ children: t("web.versionTag")
1536
+ }), /* @__PURE__ */ jsxDEV("span", {
1537
+ class: "version-number",
1538
+ children: cleanVersion(s.pomInfo.version)
1539
+ })]
1540
+ })),
1541
+ s.selected && s.pomInfo?.version && !s.pomLoading && /* @__PURE__ */ jsxDEV("div", {
1542
+ class: "jira-section",
1543
+ children: [
1544
+ s.jiraProjectsLoading ? /* @__PURE__ */ jsxDEV("div", {
1545
+ class: "loading-row",
1546
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), t("web.loadingJiraProjects")]
1547
+ }) : /* @__PURE__ */ jsxDEV("div", {
1548
+ class: "sel",
1549
+ "data-sel": "jira",
1550
+ style: `z-index:${s.jiraProjectOpen ? 100 : 1}`,
1551
+ children: [/* @__PURE__ */ jsxDEV("button", {
1552
+ class: `sel-trigger${s.jiraProjectOpen ? " open" : ""}`,
1553
+ type: "button",
1554
+ role: "combobox",
1555
+ "aria-expanded": s.jiraProjectOpen,
1556
+ "aria-haspopup": "listbox",
1557
+ onClick: () => {
1558
+ d({
1559
+ type: "SET_PROJECT_OPEN",
1560
+ open: false
1561
+ });
1562
+ d({
1563
+ type: "SET_BRANCH_OPEN",
1564
+ open: false
1565
+ });
1566
+ d({
1567
+ type: "SET_JIRA_PROJECT_OPEN",
1568
+ open: !s.jiraProjectOpen
1569
+ });
1570
+ },
1571
+ children: [
1572
+ /* @__PURE__ */ jsxDEV("span", {
1573
+ class: "sel-trigger-label",
1574
+ children: t("web.jiraProjectLabel")
1575
+ }),
1576
+ /* @__PURE__ */ jsxDEV("span", {
1577
+ class: `sel-trigger-value${s.selectedJiraProject ? "" : " empty"}`,
1578
+ children: s.selectedJiraProject ? `${s.selectedJiraProject.key} - ${s.selectedJiraProject.name ?? ""}` : t("web.selectJiraProject")
1579
+ }),
1580
+ /* @__PURE__ */ jsxDEV("span", {
1581
+ class: "sel-trigger-arrow",
1582
+ children: "▼"
1583
+ })
1584
+ ]
1585
+ }), s.jiraProjectOpen && /* @__PURE__ */ jsxDEV("div", {
1586
+ class: "sel-dropdown",
1587
+ role: "listbox",
1588
+ "aria-label": t("web.selectJiraProject"),
1589
+ children: [/* @__PURE__ */ jsxDEV("div", {
1590
+ class: "sel-search",
1591
+ children: /* @__PURE__ */ jsxDEV("input", {
1592
+ ref: jiraSearchRef,
1593
+ class: "sel-search-input",
1594
+ type: "text",
1595
+ placeholder: t("web.searchJiraProject"),
1596
+ value: s.jiraProjectSearch,
1597
+ onChange: (e) => d({
1598
+ type: "SET_JIRA_PROJECT_SEARCH",
1599
+ search: e.target.value
1600
+ }),
1601
+ onKeyDown: (e) => {
1602
+ const n = selKeyDown(e, s.jiraProjectOpen, fj.length, s.jiraProjectIndex, (i) => {
1603
+ const p = fj[i];
1604
+ if (p) d({
1605
+ type: "SELECT_JIRA_PROJECT",
1606
+ project: p
1607
+ });
1608
+ }, () => d({
1609
+ type: "SET_JIRA_PROJECT_OPEN",
1610
+ open: false
1611
+ }));
1612
+ if (n !== void 0) d({
1613
+ type: "SET_JIRA_PROJECT_INDEX",
1614
+ index: n
1615
+ });
1616
+ }
1617
+ })
1618
+ }), fj.length > 0 ? fj.map((p, i) => /* @__PURE__ */ jsxDEV("div", {
1619
+ class: `sel-item${s.selectedJiraProject?.key === p.key ? " active" : ""}${i === s.jiraProjectIndex ? " highlighted" : ""}`,
1620
+ onMouseEnter: () => d({
1621
+ type: "SET_JIRA_PROJECT_INDEX",
1622
+ index: i
1623
+ }),
1624
+ onClick: () => d({
1625
+ type: "SELECT_JIRA_PROJECT",
1626
+ project: p
1627
+ }),
1628
+ children: [/* @__PURE__ */ jsxDEV("span", {
1629
+ class: "sel-item-name",
1630
+ children: p.key
1631
+ }), p.name && /* @__PURE__ */ jsxDEV("div", {
1632
+ class: "sel-item-sub",
1633
+ children: p.name
1634
+ })]
1635
+ })) : /* @__PURE__ */ jsxDEV("div", {
1636
+ class: "sel-empty",
1637
+ children: t("web.noJiraProjects")
1638
+ })]
1639
+ })]
1640
+ }),
1641
+ /* @__PURE__ */ jsxDEV("button", {
1642
+ class: "jira-btn",
1643
+ type: "button",
1644
+ disabled: !s.selectedJiraProject || s.jiraStatus === "checking" || s.jiraStatus === "creating",
1645
+ onClick: handleCreateIssue,
1646
+ children: s.jiraStatus === "checking" ? t("web.checkingBtn") : s.jiraStatus === "creating" ? t("web.creatingBtn") : t("web.createBtn")
1647
+ }),
1648
+ (s.jiraStatus === "checking" || s.jiraStatus === "creating") && /* @__PURE__ */ jsxDEV("div", {
1649
+ class: "loading-row",
1650
+ style: "margin-top:12px",
1651
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), s.jiraStatus === "checking" ? t("web.checkingIssues") : t("web.creatingIssue")]
1652
+ }),
1653
+ s.jiraResult && /* @__PURE__ */ jsxDEV("div", {
1654
+ class: "jira-result",
1655
+ children: [
1656
+ /* @__PURE__ */ jsxDEV("div", {
1657
+ class: "jira-result-label",
1658
+ children: s.jiraResult.exists ? t("web.versionExistsResult", { version: s.jiraResult.versionName }) : t("web.versionCreatedResult", { version: s.jiraResult.versionName })
1659
+ }),
1660
+ /* @__PURE__ */ jsxDEV("a", {
1661
+ class: "jira-result-key",
1662
+ href: jiraUrl,
1663
+ target: "_blank",
1664
+ rel: "noreferrer",
1665
+ children: s.jiraResult.key
1666
+ }),
1667
+ /* @__PURE__ */ jsxDEV("span", {
1668
+ class: `jira-result-badge ${s.jiraResult.exists ? "exists" : "created"}`,
1669
+ children: s.jiraResult.exists ? t("web.existsBadge") : t("web.createdBadge")
1670
+ })
1671
+ ]
1672
+ }),
1673
+ s.jiraError && /* @__PURE__ */ jsxDEV("div", {
1674
+ class: "jira-error",
1675
+ role: "alert",
1676
+ children: s.jiraError
1677
+ }),
1678
+ s.jiraResult && (s.mrStatus === "idle" || s.mrStatus === "loading") && /* @__PURE__ */ jsxDEV("button", {
1679
+ class: "jira-btn",
1680
+ type: "button",
1681
+ disabled: s.mrStatus === "loading",
1682
+ style: "background:var(--cyan);margin-top:12px",
1683
+ onClick: async () => {
1684
+ if (s.mrStatus === "loading") return;
1685
+ d({ type: "MR_LOADING" });
1686
+ try {
1687
+ const data = await (await fetch(`/release/api/projects/${s.selected.id}/branches`)).json();
1688
+ const branches = (Array.isArray(data) ? data : []).filter((b) => b.name !== s.selectedBranch);
1689
+ if (branches.length === 0) {
1690
+ d({
1691
+ type: "MR_ERROR",
1692
+ error: t("release.noSourceBranches")
1693
+ });
1694
+ return;
1695
+ }
1696
+ d({
1697
+ type: "MR_SELECTING",
1698
+ branches
1699
+ });
1700
+ } catch (e) {
1701
+ d({
1702
+ type: "MR_ERROR",
1703
+ error: e instanceof Error ? e.message : "Failed"
1704
+ });
1705
+ }
1706
+ },
1707
+ children: s.mrStatus === "loading" ? /* @__PURE__ */ jsxDEV(Fragment, { children: [/* @__PURE__ */ jsxDEV("span", {
1708
+ class: "spinner",
1709
+ style: "width:12px;height:12px;border-width:1px;margin-right:6px;vertical-align:middle"
1710
+ }), t("web.loadingMr")] }) : t("web.createMrBtn")
1711
+ }),
1712
+ s.mrStatus === "selecting" && (() => {
1713
+ const mrb = s.mrBranches.filter((b) => b.name.toLowerCase().includes(s.mrBranchSearch.toLowerCase()));
1714
+ return /* @__PURE__ */ jsxDEV("div", {
1715
+ class: "mr-branch-sel",
1716
+ style: "margin-top:12px",
1717
+ children: [/* @__PURE__ */ jsxDEV("div", {
1718
+ style: "font-size:13px;color:var(--text-2);margin-bottom:4px",
1719
+ children: t("release.selectMrBranch")
1720
+ }), /* @__PURE__ */ jsxDEV("div", {
1721
+ class: "sel",
1722
+ style: "position:relative;z-index:100",
1723
+ children: [/* @__PURE__ */ jsxDEV("button", {
1724
+ type: "button",
1725
+ class: "sel-trigger",
1726
+ onClick: () => d({
1727
+ type: "SET_MR_BRANCH_OPEN",
1728
+ open: !s.mrBranchOpen
1729
+ }),
1730
+ children: [
1731
+ /* @__PURE__ */ jsxDEV("span", {
1732
+ class: "sel-trigger-label",
1733
+ children: t("web.branchLabel")
1734
+ }),
1735
+ /* @__PURE__ */ jsxDEV("span", {
1736
+ class: `sel-trigger-value${s.mrSourceBranch ? "" : " empty"}`,
1737
+ children: s.mrSourceBranch || t("web.selectBranch")
1738
+ }),
1739
+ /* @__PURE__ */ jsxDEV("span", {
1740
+ class: "sel-trigger-arrow",
1741
+ children: "▼"
1742
+ })
1743
+ ]
1744
+ }), s.mrBranchOpen && /* @__PURE__ */ jsxDEV("div", {
1745
+ class: "sel-dropdown",
1746
+ role: "listbox",
1747
+ "aria-label": t("release.selectMrBranch"),
1748
+ children: [/* @__PURE__ */ jsxDEV("div", {
1749
+ class: "sel-search",
1750
+ children: /* @__PURE__ */ jsxDEV("input", {
1751
+ ref: mrBranchSearchRef,
1752
+ class: "sel-search-input",
1753
+ type: "text",
1754
+ placeholder: t("web.filterBranches"),
1755
+ value: s.mrBranchSearch,
1756
+ onChange: (e) => d({
1757
+ type: "SET_MR_BRANCH_SEARCH",
1758
+ search: e.target.value
1759
+ }),
1760
+ onKeyDown: (e) => {
1761
+ const n = selKeyDown(e, s.mrBranchOpen, mrb.length, s.mrBranchIndex, (i) => {
1762
+ if (mrb[i]) d({
1763
+ type: "MR_SOURCE_SELECTED",
1764
+ branch: mrb[i].name
1765
+ });
1766
+ }, () => d({
1767
+ type: "SET_MR_BRANCH_OPEN",
1768
+ open: false
1769
+ }));
1770
+ if (n !== void 0) d({
1771
+ type: "SET_MR_BRANCH_INDEX",
1772
+ index: n
1773
+ });
1774
+ }
1775
+ })
1776
+ }), mrb.length > 0 ? mrb.map((b, i) => /* @__PURE__ */ jsxDEV("div", {
1777
+ class: `sel-item${b.name === s.mrSourceBranch ? " active" : ""}${i === s.mrBranchIndex ? " highlighted" : ""}`,
1778
+ onMouseEnter: () => d({
1779
+ type: "SET_MR_BRANCH_INDEX",
1780
+ index: i
1781
+ }),
1782
+ onClick: () => d({
1783
+ type: "MR_SOURCE_SELECTED",
1784
+ branch: b.name
1785
+ }),
1786
+ children: [/* @__PURE__ */ jsxDEV("span", {
1787
+ class: "sel-item-name",
1788
+ children: b.name
1789
+ }), b.default && /* @__PURE__ */ jsxDEV("span", {
1790
+ style: "font-size:10px;color:var(--neon);margin-left:6px",
1791
+ children: t("web.defaultBranch")
1792
+ })]
1793
+ })) : /* @__PURE__ */ jsxDEV("div", {
1794
+ class: "sel-empty",
1795
+ children: t("web.noBranches")
1796
+ })]
1797
+ })]
1798
+ })]
1799
+ });
1800
+ })(),
1801
+ s.mrStatus === "selecting" && s.mrSourceBranch && /* @__PURE__ */ jsxDEV("div", {
1802
+ style: "margin-top:8px;display:flex;align-items:center;gap:8px",
1803
+ children: [/* @__PURE__ */ jsxDEV("span", {
1804
+ style: "font-size:12px;color:var(--text-2)",
1805
+ children: t("release.mrFromTo", {
1806
+ source: s.mrSourceBranch,
1807
+ target: s.selectedBranch
1808
+ })
1809
+ }), /* @__PURE__ */ jsxDEV("button", {
1810
+ class: "jira-btn",
1811
+ type: "button",
1812
+ style: "background:var(--cyan);font-size:13px;padding:4px 12px",
1813
+ onClick: () => d({ type: "MR_CREATING" }),
1814
+ children: t("release.confirmCreateMr")
1815
+ })]
1816
+ }),
1817
+ s.mrStatus === "creating" && /* @__PURE__ */ jsxDEV("div", {
1818
+ class: "loading-row",
1819
+ style: "margin-top:12px",
1820
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), t("release.creatingMrBtn")]
1821
+ }),
1822
+ s.mrStatus === "done" && s.mrUrl && /* @__PURE__ */ jsxDEV("div", {
1823
+ class: "jira-result",
1824
+ style: "margin-top:12px",
1825
+ children: [/* @__PURE__ */ jsxDEV("div", {
1826
+ class: "jira-result-label",
1827
+ children: "MR"
1828
+ }), /* @__PURE__ */ jsxDEV("a", {
1829
+ class: "jira-result-key",
1830
+ href: s.mrUrl,
1831
+ target: "_blank",
1832
+ rel: "noreferrer",
1833
+ children: t("release.mrCreated")
1834
+ })]
1835
+ }),
1836
+ s.mrStatus === "error" && s.mrError && /* @__PURE__ */ jsxDEV("div", {
1837
+ class: "jira-error",
1838
+ role: "alert",
1839
+ style: "margin-top:12px",
1840
+ children: s.mrError
1841
+ })
1842
+ ]
1843
+ }),
1844
+ !s.selected && /* @__PURE__ */ jsxDEV("div", {
1845
+ class: "empty-hint",
1846
+ children: t("web.emptyHint")
1847
+ })
1848
+ ] });
1849
+ };
1850
+ const ReleaseClient = () => {
1851
+ const [s, d] = useReducer(reducer, initial);
1852
+ useEffect(() => {
1853
+ fetch("/release/api/history").then((r) => r.json()).then((data) => d({
1854
+ type: "SET_HISTORY",
1855
+ history: Array.isArray(data) ? data : []
1856
+ })).catch(() => d({
1857
+ type: "SET_HISTORY",
1858
+ history: []
1859
+ }));
1860
+ }, []);
1861
+ return /* @__PURE__ */ jsxDEV("div", { children: [
1862
+ /* @__PURE__ */ jsxDEV("style", { children: releaseStyle }),
1863
+ /* @__PURE__ */ jsxDEV("div", {
1864
+ class: "page-header",
1865
+ children: [/* @__PURE__ */ jsxDEV("h2", { children: t("web.releaseTitle") }), /* @__PURE__ */ jsxDEV("p", { children: t("web.releaseDesc") })]
1866
+ }),
1867
+ s.historyLoading ? /* @__PURE__ */ jsxDEV("div", {
1868
+ class: "loading-row",
1869
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), t("web.loading")]
1870
+ }) : s.showNewModal ? /* @__PURE__ */ jsxDEV("div", {
1871
+ class: "modal-overlay",
1872
+ onClick: (e) => {
1873
+ if (e.target.classList.contains("modal-overlay")) fetch("/release/api/history").then((r) => r.json()).then((data) => {
1874
+ d({
1875
+ type: "SET_HISTORY",
1876
+ history: Array.isArray(data) ? data : []
1877
+ });
1878
+ d({ type: "HIDE_NEW_MODAL" });
1879
+ }).catch(() => d({ type: "HIDE_NEW_MODAL" }));
1880
+ },
1881
+ children: /* @__PURE__ */ jsxDEV("div", {
1882
+ class: "modal-content",
1883
+ children: [/* @__PURE__ */ jsxDEV("div", {
1884
+ class: "modal-header",
1885
+ children: [/* @__PURE__ */ jsxDEV("span", {
1886
+ class: "modal-title",
1887
+ children: t("web.newModalTitle")
1888
+ }), /* @__PURE__ */ jsxDEV("button", {
1889
+ class: "modal-close",
1890
+ type: "button",
1891
+ onClick: () => {
1892
+ fetch("/release/api/history").then((r) => r.json()).then((data) => {
1893
+ d({
1894
+ type: "SET_HISTORY",
1895
+ history: Array.isArray(data) ? data : []
1896
+ });
1897
+ d({ type: "HIDE_NEW_MODAL" });
1898
+ }).catch(() => d({ type: "HIDE_NEW_MODAL" }));
1899
+ },
1900
+ children: "✕"
1901
+ })]
1902
+ }), /* @__PURE__ */ jsxDEV(ReleaseFlow, {
1903
+ s,
1904
+ d
1905
+ })]
1906
+ })
1907
+ }) : s.history.length > 0 ? /* @__PURE__ */ jsxDEV(HistoryList, {
1908
+ s,
1909
+ d
1910
+ }) : /* @__PURE__ */ jsxDEV(ReleaseFlow, {
1911
+ s,
1912
+ d
1913
+ })
1914
+ ] });
1915
+ };
1916
+ const mount = async (el) => {
1917
+ await initPromise;
1918
+ render(/* @__PURE__ */ jsxDEV(ReleaseClient, {}), el);
1919
+ };
1920
+ //#endregion
1921
+ export { mount };