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