@karoy/dsh-gitlab-workbench 0.0.0-stage → 0.2.2

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.
package/dist/client.js ADDED
@@ -0,0 +1,2288 @@
1
+ /* generated by build.mjs — edit src/client/** instead. */
2
+ window.__ModuleLoader__.load({
3
+ id: '@karoy/dsh-gitlab-workbench',
4
+ factory(require) {
5
+ const module = { exports: {} };
6
+ const exports = module.exports;
7
+ (function (module, exports, require) {
8
+ var __defProp = Object.defineProperty;
9
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
10
+ var __getOwnPropNames = Object.getOwnPropertyNames;
11
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
12
+ var __export = (target, all) => {
13
+ for (var name in all)
14
+ __defProp(target, name, { get: all[name], enumerable: true });
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from))
19
+ if (!__hasOwnProp.call(to, key) && key !== except)
20
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
+ }
22
+ return to;
23
+ };
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+
26
+ // src/client/index.ts
27
+ var index_exports = {};
28
+ __export(index_exports, {
29
+ default: () => plugin_default,
30
+ plugin: () => plugin_default
31
+ });
32
+ module.exports = __toCommonJS(index_exports);
33
+
34
+ // src/client/plugin.ts
35
+ var import_react12 = require("react");
36
+
37
+ // src/client/i18n.ts
38
+ var language = (typeof navigator !== "undefined" && navigator.language || "zh").toLowerCase().startsWith("zh") ? "zh" : "en";
39
+ function setLanguage(localeId) {
40
+ const id = String(localeId ?? "").toLowerCase();
41
+ if (id !== "") language = id.startsWith("zh") ? "zh" : "en";
42
+ }
43
+ function getLanguage() {
44
+ return language;
45
+ }
46
+ var EN = {
47
+ panel: "GitLab",
48
+ title: "GitLab",
49
+ subtitle: "workbench",
50
+ settings: "Instances and tokens",
51
+ refresh: "Refresh",
52
+ back: "Back",
53
+ backToWorkbench: "Back to workbench",
54
+ close: "Close",
55
+ retry: "Retry",
56
+ cancel: "Cancel",
57
+ save: "Save",
58
+ saving: "Saving\u2026",
59
+ add: "Add",
60
+ remove: "Remove",
61
+ openInGitLab: "Open in GitLab",
62
+ loading: "Loading\u2026",
63
+ search: "Search projects",
64
+ filter: "Filter projects",
65
+ memberOnly: "Only projects you belong to",
66
+ noInstances: "No GitLab instance yet",
67
+ noInstancesHint: "Add the URL of a self-managed GitLab and a personal access token. Each instance keeps its own token.",
68
+ addInstance: "Add instance",
69
+ newInstance: "New instance",
70
+ instanceLabel: "Name",
71
+ instanceLabelHint: "Shown in the instance picker; the host is used when empty.",
72
+ instanceUrl: "Instance URL",
73
+ instanceUrlHint: "The instance root; calls are made under /api/v4.",
74
+ token: "Personal access token",
75
+ tokenLink: "Create a token in GitLab",
76
+ tokenRequired: "A personal access token is required.",
77
+ instanceGone: "This instance no longer exists. Add it again with the values below.",
78
+ manualFlagsUnavailable: "Manual job flags are unavailable; actions fall back to the job status.",
79
+ setupHint: "Add a personal access token for {name}; it stays on this machine.",
80
+ openSettings: "Open settings",
81
+ clone: "Clone URL",
82
+ copy: "Copy",
83
+ copied: "Copied",
84
+ setupTitle: "Finish connecting this instance",
85
+ tokenHint: "read_api covers the read-only views; api is needed for pipeline retry and cancel. The token stays on this machine.",
86
+ tokenStored: "Token stored",
87
+ tokenMissing: "No token",
88
+ replaceToken: "Replace",
89
+ saveToken: "Save token",
90
+ verifyTls: "Verify the TLS certificate",
91
+ verifyTlsHint: "For a self-signed instance, prefer a corporate CA above over turning verification off.",
92
+ ca: "Corporate CA certificate (PEM, optional)",
93
+ caHint: "The internal root certificate; empty means the system trust chain only.",
94
+ advanced: "Advanced",
95
+ test: "Test connection",
96
+ testing: "Testing\u2026",
97
+ saveChanges: "Save changes",
98
+ removeInstance: "Remove instance",
99
+ removeConfirm: "Remove this instance and its stored token?",
100
+ connected: "Connected",
101
+ loggedInAs: "Signed in as {name}",
102
+ versionLabel: "GitLab {version}",
103
+ projects: "Projects",
104
+ project: "Project",
105
+ pipeline: "Pipelines",
106
+ mergeRequests: "Merge requests",
107
+ issues: "Issues",
108
+ files: "Files",
109
+ overview: "Overview",
110
+ noProjects: "No project found",
111
+ noProject: "Select a project",
112
+ noProjectHint: "Pick a project in the left column to see its overview, pipelines and merge requests.",
113
+ defaultBranch: "default",
114
+ private: "private",
115
+ protected: "protected",
116
+ openIssues: "Open issues",
117
+ openMergeRequests: "Open merge requests",
118
+ stars: "Stars",
119
+ forks: "Forks",
120
+ branches: "Branches",
121
+ tags: "Tags",
122
+ allRefs: "All refs",
123
+ noTags: "No tags",
124
+ recentCommits: "Recent commits",
125
+ recentPipelines: "Recent pipelines",
126
+ allPipelines: "All pipelines",
127
+ commitHistory: "Commit history",
128
+ branchCount: "{count} branches",
129
+ noBranches: "No branch",
130
+ noCommits: "No commit",
131
+ noPipelines: "No pipeline yet",
132
+ noPipelinesHint: "Pipelines appear once this project has run CI.",
133
+ noPipelinesBranch: "No pipelines for {ref}. Try all branches.",
134
+ noMergeRequests: "No merge request",
135
+ noIssues: "No issue",
136
+ allStatuses: "All",
137
+ statusFailed: "Failed",
138
+ statusRunning: "Running",
139
+ statusSuccess: "Success",
140
+ statusPending: "Pending",
141
+ statusSkipped: "Skipped",
142
+ statusCanceled: "Canceled",
143
+ statusOpened: "Open",
144
+ statusMerged: "Merged",
145
+ statusClosed: "Closed",
146
+ commit: "Commit",
147
+ branch: "Branch",
148
+ source: "Source",
149
+ created: "Created",
150
+ duration: "Duration",
151
+ jobs: "Jobs",
152
+ job: "Job",
153
+ log: "Log",
154
+ hideLog: "Hide",
155
+ retryPipeline: "Retry",
156
+ cancelPipeline: "Cancel",
157
+ retryJob: "Retry",
158
+ cancelJob: "Cancel",
159
+ playJob: "Run",
160
+ download: "Download",
161
+ stage: "stage",
162
+ description: "Description",
163
+ noDescription: "No description",
164
+ labels: "Labels",
165
+ author: "Author",
166
+ assignees: "Assignees",
167
+ changes: "Changes",
168
+ pipelineOfMR: "Pipeline",
169
+ noSelection: "No pipeline selected",
170
+ tree: "Files",
171
+ items: "{count} items",
172
+ loadMore: "Load more",
173
+ branchLabel: "Branch",
174
+ allBranches: "All branches",
175
+ searchBranch: "Search branch",
176
+ noBranch: "No matching branch",
177
+ emptyDir: "This directory is empty",
178
+ binaryFile: "This file is binary and is not displayed here.",
179
+ truncated: "Truncated; open the file in GitLab for the rest.",
180
+ traceTruncated: "Only the end of the log is shown.",
181
+ contentTooLarge: "The content is too large to display.",
182
+ clearSearch: "Clear",
183
+ errorGeneric: "Something went wrong",
184
+ errorNoToken: "This instance has no token yet.",
185
+ errorUnauthorized: "GitLab rejected the token. Replace it in the instance settings.",
186
+ errorForbidden: "The token is not allowed to read this.",
187
+ errorNotFound: "GitLab did not find this resource.",
188
+ errorRateLimited: "GitLab is rate limiting this instance. Try again shortly.",
189
+ errorTls: "The TLS certificate is not trusted. Add the corporate CA or disable verification in the instance settings.",
190
+ errorNetwork: "Cannot reach the instance. Check the URL and the network.",
191
+ aboutInstancesTitle: "Several instances",
192
+ aboutInstances: "Each instance keeps its own URL and token. Switching in the top bar changes the project list and pipelines. The browser never receives a token; every GitLab call is made by the local host."
193
+ };
194
+ var ZH = {
195
+ panel: "GitLab",
196
+ title: "GitLab",
197
+ subtitle: "\u5DE5\u4F5C\u53F0",
198
+ settings: "\u5B9E\u4F8B\u4E0E\u4EE4\u724C",
199
+ refresh: "\u5237\u65B0",
200
+ back: "\u8FD4\u56DE",
201
+ backToWorkbench: "\u8FD4\u56DE\u5DE5\u4F5C\u53F0",
202
+ close: "\u5173\u95ED",
203
+ retry: "\u91CD\u8BD5",
204
+ cancel: "\u53D6\u6D88",
205
+ save: "\u4FDD\u5B58",
206
+ saving: "\u4FDD\u5B58\u4E2D\u2026",
207
+ add: "\u6DFB\u52A0",
208
+ remove: "\u5220\u9664",
209
+ openInGitLab: "\u5728 GitLab \u6253\u5F00",
210
+ loading: "\u52A0\u8F7D\u4E2D\u2026",
211
+ search: "\u641C\u7D22\u9879\u76EE",
212
+ filter: "\u7B5B\u9009\u9879\u76EE",
213
+ memberOnly: "\u4EC5\u663E\u793A\u4F60\u53C2\u4E0E\u7684\u9879\u76EE",
214
+ noInstances: "\u8FD8\u6CA1\u6709 GitLab \u5B9E\u4F8B",
215
+ noInstancesHint: "\u6DFB\u52A0\u81EA\u6258\u7BA1 GitLab \u7684\u5730\u5740\u548C\u4E2A\u4EBA\u8BBF\u95EE\u4EE4\u724C\uFF1B\u6BCF\u4E2A\u5B9E\u4F8B\u4F7F\u7528\u5404\u81EA\u7684\u4EE4\u724C\u3002",
216
+ addInstance: "\u6DFB\u52A0\u5B9E\u4F8B",
217
+ newInstance: "\u65B0\u5B9E\u4F8B",
218
+ instanceLabel: "\u540D\u79F0",
219
+ instanceLabelHint: "\u663E\u793A\u5728\u5B9E\u4F8B\u9009\u62E9\u5668\u91CC\uFF0C\u7559\u7A7A\u5219\u7528\u4E3B\u673A\u540D\u3002",
220
+ instanceUrl: "\u5B9E\u4F8B\u5730\u5740",
221
+ instanceUrlHint: "\u586B\u5B9E\u4F8B\u6839\u5730\u5740\uFF0C\u8C03\u7528\u4F1A\u62FC\u4E0A /api/v4\u3002",
222
+ token: "\u4E2A\u4EBA\u8BBF\u95EE\u4EE4\u724C",
223
+ tokenLink: "\u53BB GitLab \u521B\u5EFA\u4EE4\u724C",
224
+ tokenRequired: "\u9700\u8981\u586B\u5199\u4E2A\u4EBA\u8BBF\u95EE\u4EE4\u724C\u3002",
225
+ instanceGone: "\u8FD9\u4E2A\u5B9E\u4F8B\u5DF2\u4E0D\u5B58\u5728\uFF0C\u8BF7\u7528\u4E0B\u9762\u7684\u4FE1\u606F\u91CD\u65B0\u6DFB\u52A0\u3002",
226
+ setupTitle: "\u8FD9\u4E2A\u5B9E\u4F8B\u8FD8\u6CA1\u6709\u8FDE\u63A5",
227
+ setupHint: "\u4E3A {name} \u6DFB\u52A0\u4E2A\u4EBA\u8BBF\u95EE\u4EE4\u724C\uFF0C\u4EE4\u724C\u53EA\u4FDD\u5B58\u5728\u672C\u673A\u3002",
228
+ openSettings: "\u6253\u5F00\u8BBE\u7F6E",
229
+ clone: "\u514B\u9686\u5730\u5740",
230
+ copy: "\u590D\u5236",
231
+ copied: "\u5DF2\u590D\u5236",
232
+ tokenHint: "\u53EA\u8BFB\u89C6\u56FE\u9700\u8981 read_api\uFF1B\u91CD\u8BD5\u6216\u53D6\u6D88\u6D41\u6C34\u7EBF\u9700\u8981 api\u3002\u4EE4\u724C\u53EA\u4FDD\u5B58\u5728\u672C\u673A\u3002",
233
+ tokenStored: "\u5DF2\u4FDD\u5B58\u4EE4\u724C",
234
+ tokenMissing: "\u672A\u8BBE\u7F6E\u4EE4\u724C",
235
+ replaceToken: "\u66F4\u6362",
236
+ saveToken: "\u4FDD\u5B58\u4EE4\u724C",
237
+ verifyTls: "\u6821\u9A8C TLS \u8BC1\u4E66",
238
+ verifyTlsHint: "\u81EA\u7B7E\u8BC1\u4E66\u5EFA\u8BAE\u586B\u5199\u4F01\u4E1A CA\uFF0C\u800C\u4E0D\u662F\u5173\u95ED\u6821\u9A8C\u3002",
239
+ ca: "\u4F01\u4E1A CA \u8BC1\u4E66\uFF08PEM\uFF0C\u53EF\u9009\uFF09",
240
+ caHint: "\u5185\u7F51 GitLab \u5E38\u7528\u4F01\u4E1A\u6839\u8BC1\u4E66\uFF1B\u7559\u7A7A\u5219\u53EA\u4FE1\u4EFB\u7CFB\u7EDF\u8BC1\u4E66\u94FE\u3002",
241
+ advanced: "\u9AD8\u7EA7",
242
+ test: "\u6D4B\u8BD5\u8FDE\u63A5",
243
+ testing: "\u6D4B\u8BD5\u4E2D\u2026",
244
+ saveChanges: "\u4FDD\u5B58\u66F4\u6539",
245
+ removeInstance: "\u5220\u9664\u5B9E\u4F8B",
246
+ removeConfirm: "\u5220\u9664\u8BE5\u5B9E\u4F8B\u53CA\u5176\u4FDD\u5B58\u7684\u4EE4\u724C\uFF1F",
247
+ connected: "\u5DF2\u8FDE\u63A5",
248
+ loggedInAs: "\u5DF2\u767B\u5F55\uFF1A{name}",
249
+ versionLabel: "GitLab {version}",
250
+ projects: "\u9879\u76EE",
251
+ project: "\u9879\u76EE",
252
+ pipeline: "\u6D41\u6C34\u7EBF",
253
+ mergeRequests: "\u5408\u5E76\u8BF7\u6C42",
254
+ issues: "\u8BAE\u9898",
255
+ files: "\u6587\u4EF6",
256
+ overview: "\u6982\u89C8",
257
+ noProjects: "\u6CA1\u6709\u627E\u5230\u9879\u76EE",
258
+ noProject: "\u9009\u62E9\u4E00\u4E2A\u9879\u76EE",
259
+ noProjectHint: "\u4ECE\u5DE6\u680F\u9009\u4E00\u4E2A\u9879\u76EE\uFF0C\u67E5\u770B\u5B83\u7684\u6982\u89C8\u3001\u6D41\u6C34\u7EBF\u548C\u5408\u5E76\u8BF7\u6C42\u3002",
260
+ defaultBranch: "\u9ED8\u8BA4\u5206\u652F",
261
+ private: "\u79C1\u6709",
262
+ protected: "\u53D7\u4FDD\u62A4",
263
+ openIssues: "\u5F00\u653E\u8BAE\u9898",
264
+ openMergeRequests: "\u5F00\u653E\u5408\u5E76\u8BF7\u6C42",
265
+ stars: "Star",
266
+ forks: "Fork",
267
+ branches: "\u5206\u652F",
268
+ tags: "Tags",
269
+ allRefs: "\u5168\u90E8",
270
+ noTags: "\u6CA1\u6709 Tags",
271
+ recentCommits: "\u6700\u8FD1\u63D0\u4EA4",
272
+ recentPipelines: "\u6700\u8FD1\u6D41\u6C34\u7EBF",
273
+ allPipelines: "\u5168\u90E8\u6D41\u6C34\u7EBF",
274
+ commitHistory: "\u63D0\u4EA4\u5386\u53F2",
275
+ branchCount: "\u5171 {count} \u4E2A\u5206\u652F",
276
+ noBranches: "\u6CA1\u6709\u5206\u652F",
277
+ noCommits: "\u6CA1\u6709\u63D0\u4EA4",
278
+ noPipelines: "\u8FD8\u6CA1\u6709\u6D41\u6C34\u7EBF",
279
+ noPipelinesHint: "\u9879\u76EE\u8FD0\u884C\u8FC7 CI \u540E\uFF0C\u6D41\u6C34\u7EBF\u4F1A\u51FA\u73B0\u5728\u8FD9\u91CC\u3002",
280
+ noPipelinesBranch: "\u5F53\u524D\u5206\u652F {ref} \u6CA1\u6709\u6D41\u6C34\u7EBF\uFF0C\u8BD5\u8BD5\u5168\u90E8\u5206\u652F\u3002",
281
+ noMergeRequests: "\u6CA1\u6709\u5408\u5E76\u8BF7\u6C42",
282
+ noIssues: "\u6CA1\u6709\u8BAE\u9898",
283
+ allStatuses: "\u5168\u90E8",
284
+ statusFailed: "\u5931\u8D25",
285
+ statusRunning: "\u8FD0\u884C\u4E2D",
286
+ statusSuccess: "\u6210\u529F",
287
+ statusPending: "\u7B49\u5F85\u4E2D",
288
+ statusSkipped: "\u8DF3\u8FC7",
289
+ statusCanceled: "\u5DF2\u53D6\u6D88",
290
+ statusOpened: "\u6253\u5F00",
291
+ statusMerged: "\u5DF2\u5408\u5E76",
292
+ statusClosed: "\u5DF2\u5173\u95ED",
293
+ commit: "\u63D0\u4EA4",
294
+ branch: "\u5206\u652F",
295
+ source: "\u6765\u6E90",
296
+ created: "\u521B\u5EFA",
297
+ duration: "\u8017\u65F6",
298
+ jobs: "\u4F5C\u4E1A",
299
+ job: "\u4F5C\u4E1A",
300
+ log: "\u65E5\u5FD7",
301
+ hideLog: "\u6536\u8D77",
302
+ retryPipeline: "\u91CD\u8BD5",
303
+ cancelPipeline: "\u53D6\u6D88",
304
+ retryJob: "\u91CD\u8BD5",
305
+ cancelJob: "\u53D6\u6D88",
306
+ playJob: "\u8FD0\u884C",
307
+ download: "\u4E0B\u8F7D",
308
+ stage: "\u9636\u6BB5",
309
+ description: "\u63CF\u8FF0",
310
+ noDescription: "\u6CA1\u6709\u63CF\u8FF0",
311
+ labels: "\u6807\u7B7E",
312
+ author: "\u4F5C\u8005",
313
+ assignees: "\u6307\u6D3E\u7ED9",
314
+ changes: "\u53D8\u66F4",
315
+ pipelineOfMR: "\u6D41\u6C34\u7EBF",
316
+ noSelection: "\u672A\u9009\u62E9\u6D41\u6C34\u7EBF",
317
+ tree: "\u6587\u4EF6",
318
+ items: "{count} \u9879",
319
+ loadMore: "\u52A0\u8F7D\u66F4\u591A",
320
+ branchLabel: "\u5206\u652F",
321
+ allBranches: "\u5168\u90E8\u5206\u652F",
322
+ searchBranch: "\u641C\u7D22\u5206\u652F",
323
+ noBranch: "\u6CA1\u6709\u5339\u914D\u7684\u5206\u652F",
324
+ emptyDir: "\u8FD9\u4E2A\u76EE\u5F55\u662F\u7A7A\u7684",
325
+ binaryFile: "\u8FD9\u662F\u4E8C\u8FDB\u5236\u6587\u4EF6\uFF0C\u4E0D\u5728\u9875\u9762\u91CC\u663E\u793A\u3002",
326
+ truncated: "\u5185\u5BB9\u5DF2\u622A\u65AD\uFF1B\u5B8C\u6574\u6587\u4EF6\u8BF7\u5728 GitLab \u6253\u5F00\u3002",
327
+ traceTruncated: "\u53EA\u663E\u793A\u65E5\u5FD7\u7684\u672B\u5C3E\u90E8\u5206\u3002",
328
+ contentTooLarge: "\u5185\u5BB9\u592A\u5927\uFF0C\u65E0\u6CD5\u663E\u793A\u3002",
329
+ clearSearch: "\u6E05\u9664",
330
+ errorGeneric: "\u51FA\u9519\u4E86",
331
+ errorNoToken: "\u8FD9\u4E2A\u5B9E\u4F8B\u8FD8\u6CA1\u6709\u8BBE\u7F6E\u4EE4\u724C\u3002",
332
+ errorUnauthorized: "GitLab \u62D2\u7EDD\u4E86\u4EE4\u724C\uFF0C\u8BF7\u5728\u5B9E\u4F8B\u8BBE\u7F6E\u91CC\u66F4\u6362\u3002",
333
+ errorForbidden: "\u4EE4\u724C\u6CA1\u6709\u6743\u9650\u8BFB\u53D6\u8FD9\u4E2A\u8D44\u6E90\u3002",
334
+ errorNotFound: "GitLab \u6CA1\u6709\u627E\u5230\u8FD9\u4E2A\u8D44\u6E90\u3002",
335
+ errorRateLimited: "\u8BF7\u6C42\u8FC7\u4E8E\u9891\u7E41\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5\u3002",
336
+ errorTls: "TLS \u8BC1\u4E66\u4E0D\u53D7\u4FE1\u4EFB\uFF1A\u8BF7\u6DFB\u52A0\u4F01\u4E1A CA\uFF0C\u6216\u5728\u5B9E\u4F8B\u8BBE\u7F6E\u91CC\u5173\u95ED\u8BC1\u4E66\u6821\u9A8C\u3002",
337
+ errorNetwork: "\u65E0\u6CD5\u8FDE\u63A5\u5B9E\u4F8B\uFF0C\u8BF7\u68C0\u67E5\u5730\u5740\u548C\u7F51\u7EDC\u3002",
338
+ aboutInstancesTitle: "\u5173\u4E8E\u591A\u4E2A\u5B9E\u4F8B",
339
+ aboutInstances: "\u6BCF\u4E2A\u5B9E\u4F8B\u5355\u72EC\u4FDD\u5B58\u5730\u5740\u4E0E\u4EE4\u724C\uFF0C\u9876\u680F\u5207\u6362\u540E\u9879\u76EE\u5217\u8868\u3001\u6D41\u6C34\u7EBF\u90FD\u4F1A\u8DDF\u7740\u6362\u3002\u6D4F\u89C8\u5668\u7AEF\u62FF\u4E0D\u5230\u4EE4\u724C\uFF0C\u6240\u6709 GitLab \u8BF7\u6C42\u90FD\u7531\u672C\u673A Host \u53D1\u51FA\u3002"
340
+ };
341
+ var DICTIONARIES = { zh: ZH, en: EN };
342
+ function t(key, params) {
343
+ const template = DICTIONARIES[language][key] ?? EN[key] ?? key;
344
+ if (!params) return template;
345
+ return template.replace(
346
+ /\{(\w+)\}/g,
347
+ (match, name) => params[name] === void 0 ? match : String(params[name])
348
+ );
349
+ }
350
+
351
+ // src/client/styles/app.css
352
+ var app_default = '.gw-app{--glw-text-2xs:12px;--glw-text-xs:12px;--glw-text-sm:12.5px;--glw-text-base:13px;--glw-text-md:14px;--glw-text-lg:16px;--glw-text-xl:21px;--glw-text-2xl:28px;--glw-space-1:4px;--glw-space-2:8px;--glw-space-3:12px;--glw-space-4:16px;--glw-space-5:20px;--glw-space-6:24px;--glw-space-8:32px;--glw-radius-sm:6px;--glw-radius-md:10px;--glw-radius-lg:14px;--glw-radius-full:999px;--glw-topbar:56px;--glw-rail:264px;--glw-line:1px solid var(--dsw-alias-border-l1);--glw-font:var(--dsw-font-family-sans, system-ui);position:relative;display:flex;flex-direction:column;width:100%;height:100%;min-height:0;background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary);font-family:"PingFang SC","HarmonyOS Sans SC","MiSans","Microsoft YaHei",system-ui,sans-serif;font-size:var(--glw-text-base);line-height:1.5;padding-top:var(--dsh-frame-top-clearance,0px);box-sizing:border-box}\n.gw-app *,.gw-app *::before,.gw-app *::after{box-sizing:border-box}\n.gw-app a{color:inherit;text-decoration:none}\n.gw-app button,.gw-app input,.gw-app select,.gw-app textarea{font:inherit;color:inherit}\n.gw-app :focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}\n.gw-i{display:inline-block;vertical-align:middle;flex:none}\n.gw-top{flex:none;display:flex;align-items:center;gap:var(--glw-space-3);height:var(--glw-topbar);padding:0 var(--glw-space-4);border-bottom:var(--glw-line);background:var(--dsw-alias-bg-base)}\n.gw-brand{display:flex;align-items:center;gap:var(--glw-space-2);min-width:0}\n.gw-logo{display:grid;place-items:center;width:26px;height:26px;border-radius:7px;background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-base);flex:none}\n.gw-word{font-size:var(--glw-text-md);font-weight:650;letter-spacing:-.01em;white-space:nowrap}\n.gw-word-sub{font-size:var(--glw-text-xs);color:var(--dsw-alias-label-secondary);margin-left:2px;white-space:nowrap}\n.gw-instance{position:relative;display:inline-flex;align-items:center;gap:7px;height:30px;padding:0 10px;margin-left:var(--glw-space-2);border:var(--glw-line);border-radius:var(--glw-radius-sm);background:var(--dsw-alias-bg-layer-1);font-size:var(--glw-text-sm);color:var(--dsw-alias-label-primary);white-space:nowrap}\n.gw-instance-select{appearance:none;border:0;background:transparent;outline:none;cursor:pointer;font-size:var(--glw-text-sm);color:inherit;max-width:180px;text-overflow:ellipsis}\n.gw-dot{width:6px;height:6px;border-radius:50%;background:var(--dsw-alias-state-idle-primary);flex:none;display:inline-block}\n.gw-dot.is-ok{background:var(--dsw-alias-state-success-primary)}\n.gw-dot.is-bad{background:var(--dsw-alias-state-error-primary)}\n.gw-search{display:flex;align-items:center;gap:7px;width:300px;height:30px;padding:0 10px;margin-left:var(--glw-space-2);border:var(--glw-line);border-radius:var(--glw-radius-sm);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary)}\n.gw-search:focus-within{border-color:var(--dsw-alias-brand-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--dsw-alias-brand-primary) 18%,transparent)}\n.gw-search input{flex:1;min-width:0;height:100%;border:0;outline:0;background:transparent;font-size:var(--glw-text-sm)}\n.gw-search input::placeholder{color:var(--dsw-alias-label-secondary)}\n.gw-top-spacer{flex:1}\n.gw-top-actions{display:flex;align-items:center;gap:var(--glw-space-1)}\n.gw-icon-btn{display:grid;place-items:center;width:30px;height:30px;padding:0;border:1px solid transparent;border-radius:var(--glw-radius-sm);background:transparent;color:var(--dsw-alias-label-secondary);cursor:pointer}\n.gw-icon-btn:hover{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}\n.gw-shell{flex:1;display:grid;grid-template-columns:var(--glw-rail) minmax(0,1fr);min-height:0}\n.gw-rail{display:flex;flex-direction:column;min-height:0;border-right:var(--glw-line);background:var(--dsw-alias-bg-base)}\n.gw-rail-head{display:flex;align-items:center;justify-content:space-between;padding:var(--glw-space-4) var(--glw-space-3) var(--glw-space-2);font-size:var(--glw-text-xs);font-weight:600;letter-spacing:.04em;color:var(--dsw-alias-label-secondary)}\n.gw-count{font-weight:500;color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-2);border-radius:var(--glw-radius-full);padding:1px 7px}\n.gw-rail-search{margin:0 var(--glw-space-3) var(--glw-space-2);display:flex;align-items:center;gap:6px;height:28px;padding:0 9px;border:var(--glw-line);border-radius:var(--glw-radius-sm);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary)}\n.gw-rail-search:focus-within{border-color:var(--dsw-alias-brand-primary)}\n.gw-rail-search input{flex:1;min-width:0;height:100%;border:0;outline:0;background:transparent;font-size:var(--glw-text-sm)}\n.gw-projects{flex:1;min-height:0;overflow:auto;padding:0 var(--glw-space-2) var(--glw-space-3)}\n.gw-project{position:relative;display:flex;align-items:center;gap:9px;padding:7px var(--glw-space-2) 7px 10px;border-radius:var(--glw-radius-sm);cursor:pointer;width:100%;border:0;background:transparent;text-align:left;color:inherit}\n.gw-project+.gw-project{margin-top:1px}\n.gw-project:hover{background:var(--dsw-alias-bg-layer-1)}\n.gw-project.is-active{background:var(--dsw-alias-bg-layer-2)}\n.gw-project.is-active::before{content:"";position:absolute;left:0;top:8px;bottom:8px;width:2px;border-radius:2px;background:var(--dsw-alias-brand-primary)}\n.gw-avatar{display:grid;place-items:center;width:28px;height:28px;border-radius:7px;background:hsl(var(--h) 38% 27%);color:#fff;font-size:var(--glw-text-2xs);font-weight:650;letter-spacing:.02em;flex:none}\n.gw-proj-text{display:flex;flex-direction:column;gap:1px;min-width:0;flex:1}\n.gw-proj-name{font-size:var(--glw-text-base);font-weight:550;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.gw-proj-ns{font-size:var(--glw-text-xs);color:var(--dsw-alias-label-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.gw-proj-meta{font-size:var(--glw-text-2xs);color:var(--dsw-alias-label-secondary);white-space:nowrap;flex:none}\n.gw-rail-foot{flex:none;padding:var(--glw-space-2) var(--glw-space-4);border-top:var(--glw-line);font-size:var(--glw-text-2xs);color:var(--dsw-alias-label-secondary)}\n.gw-rail-action{flex:none;display:flex;align-items:center;gap:6px;width:100%;padding:9px var(--glw-space-4);border:0;border-top:var(--glw-line);background:transparent;color:var(--dsw-alias-label-secondary);font-size:var(--glw-text-xs);cursor:pointer;text-align:left}\n.gw-rail-action:hover{background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary)}\n.gw-main{display:flex;flex-direction:column;min-width:0;min-height:0;background:var(--dsw-alias-bg-base)}\n.gw-head{flex:none;padding:var(--glw-space-4) var(--glw-space-6) 0}\n.gw-crumbs{display:flex;align-items:center;gap:6px;font-size:var(--glw-text-xs);color:var(--dsw-alias-label-secondary);margin-bottom:var(--glw-space-2)}\n.gw-crumbs button{border:0;background:transparent;padding:0;color:inherit;cursor:pointer;display:inline-flex;align-items:center;height:24px}\n.gw-crumbs button:hover{color:var(--dsw-alias-label-primary)}\n.gw-title-row{display:flex;align-items:center;gap:var(--glw-space-2);flex-wrap:wrap}\n.gw-h1{margin:0;font-size:var(--glw-text-xl);line-height:1.25;font-weight:650;letter-spacing:-.015em}\n.gw-desc{margin:var(--glw-space-2) 0 0;max-width:72ch;font-size:var(--glw-text-sm);line-height:1.6;color:var(--dsw-alias-label-secondary)}\n.gw-head-row{display:flex;align-items:flex-start;gap:var(--glw-space-4)}\n.gw-head-text{min-width:0;flex:1}\n.gw-head-actions{display:flex;align-items:center;gap:var(--glw-space-2);flex:none;padding-top:2px}\n.gw-chip{display:inline-flex;align-items:center;gap:4px;height:22px;padding:0 8px;border:var(--glw-line);border-radius:var(--glw-radius-full);font-size:var(--glw-text-2xs);color:var(--dsw-alias-label-secondary);white-space:nowrap}\n.gw-chip.mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:var(--glw-text-2xs)}\n.gw-chip.is-active{background:var(--dsw-alias-brand-primary);border-color:var(--dsw-alias-brand-primary);color:#fff}\n.gw-branch-row{width:100%;border:0;background:transparent;text-align:left;font:inherit;color:inherit;cursor:pointer}\n.gw-branch-row:hover{background:var(--dsw-alias-bg-layer-2)}\n.gw-branch-row.is-active{background:var(--dsw-alias-bg-layer-2)}\n.gw-branch-row.is-active .gw-branch{color:var(--dsw-alias-brand-primary)}\n.gw-branch{display:inline-flex;align-items:center;gap:4px;height:22px;padding:0 6px 0 8px;border:var(--glw-line);border-radius:var(--glw-radius-full);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary);cursor:pointer;max-width:210px}\n.gw-branch:hover{color:var(--dsw-alias-label-primary)}\n.gw-branch-select{appearance:none;border:0;background:transparent;color:inherit;font:inherit;font-size:var(--glw-text-2xs);cursor:pointer;max-width:150px;padding:0 2px;outline:none}\n.gw-branch-caret{flex:none;pointer-events:none;opacity:.7}\n.gw-branch-picker{position:relative;display:inline-flex;min-width:0}\n.gw-clone{position:relative;display:inline-flex}\n.gw-clone-pop{position:absolute;top:calc(100% + 6px);right:0;z-index:30;width:min(460px,80vw);padding:10px;border:var(--glw-line);border-radius:var(--glw-radius-md);background:var(--dsw-alias-bg-layer-1);box-shadow:0 10px 30px rgba(0,0,0,.18)}\n.gw-clone-row{display:flex;align-items:center;gap:6px}\n.gw-clone-row+.gw-clone-row{margin-top:8px}\n.gw-clone-label{flex:none;width:44px;font-size:var(--glw-text-2xs);color:var(--dsw-alias-label-secondary)}\n.gw-clone-url{flex:1;min-width:0;height:28px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:var(--glw-text-2xs)}\n.gw-branch-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:150px}\n.gw-popover{position:absolute;top:calc(100% + 6px);left:0;z-index:30;width:268px;padding:6px;border:var(--glw-line);border-radius:var(--glw-radius-md);background:var(--dsw-alias-bg-layer-1);box-shadow:0 10px 30px rgba(0,0,0,.18)}\n.gw-popover-search{width:100%;height:28px;margin-bottom:6px}\n.gw-popover-list{max-height:260px;overflow:auto}\n.gw-inline{display:inline-flex;align-items:center;gap:4px}\n.gw-popover-group-title{padding:6px 9px 3px;font-size:10px;letter-spacing:.05em;text-transform:uppercase;color:var(--dsw-alias-label-secondary)}\n.gw-popover-divider{height:1px;margin:4px 6px;background:var(--glw-line)}\n.gw-popover-item{display:flex;align-items:center;gap:8px;width:100%;padding:7px 9px;border:0;border-radius:var(--glw-radius-sm);background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:var(--glw-text-xs);cursor:pointer;text-align:left}\n.gw-popover-item:hover{background:var(--dsw-alias-bg-layer-2)}\n.gw-popover-item.is-active{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-brand-primary)}\n.gw-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;height:30px;padding:0 11px;border:var(--glw-line);border-radius:var(--glw-radius-sm);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font-size:var(--glw-text-sm);font-weight:500;cursor:pointer;white-space:nowrap}\n.gw-btn:hover{background:var(--dsw-alias-bg-layer-2)}\n.gw-btn.is-primary{background:var(--dsw-alias-brand-primary);border-color:var(--dsw-alias-brand-primary);color:#fff}\n.gw-btn.is-primary:hover{filter:brightness(1.06)}\n.gw-btn.is-ghost{border-color:transparent;background:transparent;color:var(--dsw-alias-label-secondary)}\n.gw-btn.is-ghost:hover{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}\n.gw-btn.is-danger{border-color:transparent;background:transparent;color:var(--dsw-alias-state-error-primary)}\n.gw-btn.is-danger:hover{background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 10%,transparent)}\n.gw-btn.is-sm{height:26px;padding:0 9px;font-size:var(--glw-text-xs)}\n.gw-btn:disabled{opacity:.5;cursor:default}\n.gw-tabs{flex:none;display:flex;align-items:stretch;gap:var(--glw-space-1);padding:0 var(--glw-space-6);margin-top:var(--glw-space-4);border-bottom:var(--glw-line)}\n.gw-tab{display:inline-flex;align-items:center;gap:6px;height:34px;padding:0 2px;margin-right:var(--glw-space-4);border:0;border-bottom:2px solid transparent;background:transparent;font-size:var(--glw-text-sm);color:var(--dsw-alias-label-secondary);cursor:pointer;white-space:nowrap}\n.gw-tab:hover{color:var(--dsw-alias-label-primary)}\n.gw-tab.is-active{color:var(--dsw-alias-label-primary);border-bottom-color:var(--dsw-alias-brand-primary);font-weight:550}\n.gw-tab-count{min-width:18px;height:18px;padding:0 5px;border-radius:var(--glw-radius-full);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);font-size:var(--glw-text-2xs);font-weight:500;display:inline-grid;place-items:center}\n.gw-content{flex:1;min-height:0;overflow:auto;padding:var(--glw-space-5) var(--glw-space-6) var(--glw-space-8)}\n.gw-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));border:var(--glw-line);border-radius:var(--glw-radius-md);background:var(--dsw-alias-bg-layer-1);overflow:hidden}\n.gw-stat{padding:var(--glw-space-3) var(--glw-space-4);border-right:var(--glw-line);min-width:0}\n.gw-stat:last-child{border-right:0}\n.gw-stat-num{font-size:var(--glw-text-2xl);font-weight:600;line-height:1.15;letter-spacing:-.02em;font-variant-numeric:tabular-nums}\n.gw-stat-label{margin-top:2px;font-size:var(--glw-text-xs);color:var(--dsw-alias-label-secondary)}\n.gw-block{margin-top:var(--glw-space-6)}\n.gw-block-head{display:flex;align-items:baseline;justify-content:space-between;gap:var(--glw-space-4);margin-bottom:var(--glw-space-2)}\n.gw-block-head h2{margin:0;font-size:var(--glw-text-sm);font-weight:600;color:var(--dsw-alias-label-primary)}\n.gw-block-link{display:inline-flex;align-items:center;gap:4px;height:24px;border:0;background:transparent;padding:0 2px;font-size:var(--glw-text-xs);color:var(--dsw-alias-label-secondary);cursor:pointer}\n.gw-block-link:hover{color:var(--dsw-alias-brand-primary)}\n.gw-columns{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.25fr);gap:var(--glw-space-6);margin-top:var(--glw-space-6)}\n.gw-columns .gw-block{margin-top:0}\n.gw-list{border:var(--glw-line);border-radius:var(--glw-radius-md);background:var(--dsw-alias-bg-layer-1);overflow:hidden}\n.gw-list-row{display:flex;align-items:center;gap:var(--glw-space-2);padding:8px var(--glw-space-3);min-width:0;font-size:var(--glw-text-sm)}\n.gw-list-row+.gw-list-row{border-top:var(--glw-line)}\n.gw-list-empty{padding:14px 16px}\n.gw-row-time{margin-left:auto;font-size:var(--glw-text-2xs);color:var(--dsw-alias-label-secondary);white-space:nowrap;flex:none}\n.gw-mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:var(--glw-text-xs);font-variant-ligatures:none}\n.gw-muted{color:var(--dsw-alias-label-secondary)}\n.gw-branch{display:inline-flex;align-items:center;gap:6px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.gw-badge{height:20px;padding:0 7px;border-radius:var(--glw-radius-full);font-size:var(--glw-text-2xs);display:inline-flex;align-items:center;color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-2);white-space:nowrap}\n.gw-badge.is-brand{color:var(--dsw-alias-brand-primary);background:color-mix(in srgb,var(--dsw-alias-brand-primary) 10%,transparent)}\n.gw-commit{display:flex;align-items:center;gap:8px;min-width:0;flex:1}\n.gw-commit-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.gw-commit-author{font-size:var(--glw-text-2xs);color:var(--dsw-alias-label-secondary);flex:none}\n.gw-status{display:inline-flex;align-items:center;gap:6px;font-size:var(--glw-text-xs);color:var(--dsw-alias-label-secondary);white-space:nowrap;flex:none}\n.gw-status .gw-dot{width:7px;height:7px}\n.gw-status.is-success{color:var(--dsw-alias-state-success-primary)}\n.gw-status.is-success .gw-dot{background:var(--dsw-alias-state-success-primary)}\n.gw-status.is-error{color:var(--dsw-alias-state-error-primary)}\n.gw-status.is-error .gw-dot{background:var(--dsw-alias-state-error-primary)}\n.gw-status.is-warn{color:var(--dsw-alias-state-warn-primary)}\n.gw-status.is-warn .gw-dot{background:var(--dsw-alias-state-warn-primary)}\n.gw-status.is-brand{color:var(--dsw-alias-brand-primary)}\n.gw-status.is-brand .gw-dot{background:var(--dsw-alias-brand-primary)}\n.gw-pipe-mini{border:var(--glw-line);border-radius:var(--glw-radius-md);background:var(--dsw-alias-bg-layer-1);overflow:hidden}\n.gw-pipe-mini .gw-list-row{gap:var(--glw-space-3)}\n.gw-pipe-id{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:var(--glw-text-xs);font-weight:600;color:var(--dsw-alias-label-primary);width:54px;flex:none}\n.gw-pipe-ref{display:inline-flex;align-items:center;gap:5px;min-width:0;color:var(--dsw-alias-label-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.gw-pipe-duration{font-size:var(--glw-text-2xs);color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;width:52px;text-align:right;flex:none}\n.gw-split{flex:1;min-height:0;display:grid;grid-template-columns:320px minmax(0,1fr);grid-template-rows:minmax(0,1fr)}\n.gw-list-pane{display:flex;flex-direction:column;min-height:0;border-right:var(--glw-line)}\n.gw-toolbar{display:flex;align-items:center;gap:var(--glw-space-2);padding:var(--glw-space-3) var(--glw-space-4);border-bottom:var(--glw-line);flex:none;flex-wrap:wrap;row-gap:6px}\n.gw-seg{display:inline-flex;padding:2px;border:var(--glw-line);border-radius:var(--glw-radius-sm);background:var(--dsw-alias-bg-layer-1);flex:none}\n.gw-seg button{white-space:nowrap}\n.gw-toolbar .gw-chip{flex:none;max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.gw-toolbar .gw-icon-btn{flex:none}\n.gw-seg button{height:26px;min-width:32px;padding:0 9px;border:0;border-radius:4px;background:transparent;color:var(--dsw-alias-label-secondary);font-size:var(--glw-text-xs);cursor:pointer}\n.gw-seg button.is-active{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}\n.gw-scroll-y{flex:1;min-height:0;overflow:auto}\n.gw-pipe-row{display:flex;flex-direction:column;gap:3px;padding:11px var(--glw-space-4);border:0;border-bottom:var(--glw-line);background:transparent;cursor:pointer;position:relative;width:100%;text-align:left;color:inherit}\n.gw-pipe-row:hover{background:var(--dsw-alias-bg-layer-1)}\n.gw-pipe-row.is-active{background:var(--dsw-alias-bg-layer-1)}\n.gw-pipe-row.is-active::before{content:"";position:absolute;left:0;top:0;bottom:0;width:2px;background:var(--dsw-alias-brand-primary)}\n.gw-pipe-row-top{display:flex;align-items:center;gap:var(--glw-space-2)}\n.gw-pipe-row-bottom{display:flex;align-items:center;gap:var(--glw-space-2);font-size:var(--glw-text-2xs);color:var(--dsw-alias-label-secondary)}\n.gw-pipe-row-bottom .gw-mono{font-size:var(--glw-text-2xs)}\n.gw-detail-pane{display:flex;flex-direction:column;min-height:0;overflow:auto;padding:var(--glw-space-4) var(--glw-space-6) var(--glw-space-8)}\n.gw-detail-pane>*{flex-shrink:0}\n.gw-detail-head{display:flex;align-items:flex-start;gap:var(--glw-space-3)}\n.gw-detail-title{display:flex;align-items:baseline;gap:var(--glw-space-2);flex-wrap:wrap}\n.gw-detail-title h2{margin:0;font-size:var(--glw-text-lg);font-weight:650;letter-spacing:-.01em;font-family:ui-monospace,SFMono-Regular,Menlo,monospace}\n.gw-detail-actions{margin-left:auto;display:flex;align-items:center;gap:var(--glw-space-1)}\n.gw-meta-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:var(--glw-space-3);margin-top:var(--glw-space-3);padding:8px var(--glw-space-4);border:var(--glw-line);border-radius:var(--glw-radius-md);background:var(--dsw-alias-bg-layer-1)}\n.gw-meta-grid dt{margin:0;font-size:var(--glw-text-2xs);color:var(--dsw-alias-label-secondary)}\n.gw-meta-grid dd{margin:2px 0 0;font-size:var(--glw-text-sm);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.gw-timeline{display:flex;align-items:flex-start;gap:0;margin-top:var(--glw-space-3);padding:0 var(--glw-space-1)}\n.gw-stage{display:flex;flex-direction:column;align-items:center;gap:6px;flex:none;width:96px;text-align:center}\n.gw-stage-dot{width:12px;height:12px;border-radius:50%;border:2px solid var(--dsw-alias-bg-base);box-shadow:0 0 0 1px var(--dsw-alias-border-l2);background:var(--dsw-alias-state-idle-primary)}\n.gw-stage.is-success .gw-stage-dot{background:var(--dsw-alias-state-success-primary);box-shadow:0 0 0 1px var(--dsw-alias-state-success-primary)}\n.gw-stage.is-error .gw-stage-dot{background:var(--dsw-alias-state-error-primary);box-shadow:0 0 0 1px var(--dsw-alias-state-error-primary)}\n.gw-stage.is-brand .gw-stage-dot{background:var(--dsw-alias-brand-primary);box-shadow:0 0 0 1px var(--dsw-alias-brand-primary)}\n.gw-stage-name{font-size:var(--glw-text-xs);font-weight:550;color:var(--dsw-alias-label-primary);white-space:nowrap}\n.gw-stage-meta{font-size:var(--glw-text-2xs);color:var(--dsw-alias-label-secondary)}\n.gw-stage-line{flex:1;height:1px;margin-top:6px;background:var(--dsw-alias-border-l2)}\n.gw-stage-line.is-done{background:var(--dsw-alias-state-success-primary)}\n.gw-jobs{margin-top:var(--glw-space-3);border:var(--glw-line);border-radius:var(--glw-radius-md);background:var(--dsw-alias-bg-layer-1);overflow:hidden}\n.gw-job{display:flex;align-items:center;gap:var(--glw-space-3);padding:7px var(--glw-space-4);min-width:0;flex-wrap:wrap;row-gap:4px}\n.gw-job+.gw-job{border-top:var(--glw-line)}\n.gw-job-name{font-size:var(--glw-text-sm);font-weight:550;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.gw-job-stage{font-size:var(--glw-text-2xs);color:var(--dsw-alias-label-secondary);flex:none;white-space:nowrap}\n.gw-job-dur{margin-left:auto;font-size:var(--glw-text-2xs);color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;flex:none}\n.gw-job-actions{display:flex;gap:2px;flex:none}\n.gw-log{margin-top:var(--glw-space-3);border:var(--glw-line);border-radius:var(--glw-radius-md);background:var(--dsw-alias-bg-layer-1);overflow:hidden;flex:1;min-height:0;display:flex;flex-direction:column}\n.gw-log-head{display:flex;align-items:center;gap:var(--glw-space-2);padding:7px var(--glw-space-3);border-bottom:var(--glw-line);font-size:var(--glw-text-xs);color:var(--dsw-alias-label-secondary);flex:none}\n.gw-log-head .gw-mono{color:var(--dsw-alias-label-primary)}\n.gw-log-fill{flex:1;min-height:0;display:flex;flex-direction:column}\n.gw-log-body{margin:0;padding:var(--glw-space-3) var(--glw-space-4);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:var(--glw-text-xs);line-height:1.65;white-space:pre-wrap;word-break:break-word;max-height:none;flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;color:var(--dsw-alias-label-primary)}\n.gw-log-note{padding:6px 12px;font-size:var(--glw-text-2xs);color:var(--dsw-alias-state-warn-primary);border-bottom:var(--glw-line);flex:none}\n.gw-settings{flex:1;min-height:0;display:grid;grid-template-columns:248px minmax(0,1fr)}\n.gw-set-rail{display:flex;flex-direction:column;min-height:0;border-right:var(--glw-line)}\n.gw-set-list{flex:1;min-height:0;overflow:auto;padding:var(--glw-space-2)}\n.gw-inst{display:flex;flex-direction:column;gap:2px;width:100%;padding:9px 10px;border:0;border-radius:var(--glw-radius-sm);background:transparent;text-align:left;cursor:pointer;position:relative;color:inherit}\n.gw-inst:hover{background:var(--dsw-alias-bg-layer-1)}\n.gw-inst.is-active{background:var(--dsw-alias-bg-layer-2)}\n.gw-inst.is-active::before{content:"";position:absolute;left:0;top:8px;bottom:8px;width:2px;border-radius:2px;background:var(--dsw-alias-brand-primary)}\n.gw-inst-name{font-size:var(--glw-text-sm);font-weight:550;display:flex;align-items:center;gap:6px}\n.gw-inst-url{font-size:var(--glw-text-2xs);color:var(--dsw-alias-label-secondary);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.gw-set-foot{padding:var(--glw-space-2);border-top:var(--glw-line)}\n.gw-set-foot .gw-btn{width:100%}\n.gw-set-main{min-width:0;overflow:auto;padding:var(--glw-space-5) var(--glw-space-6) var(--glw-space-8)}\n.gw-set-title{display:flex;align-items:baseline;gap:var(--glw-space-2);flex-wrap:wrap}\n.gw-set-title h2{margin:0;font-size:var(--glw-text-lg);font-weight:650;letter-spacing:-.01em}\n.gw-set-sub{margin:4px 0 0;font-size:var(--glw-text-xs);color:var(--dsw-alias-label-secondary)}\n.gw-form{margin-top:var(--glw-space-5);display:flex;flex-direction:column;gap:var(--glw-space-4);max-width:560px}\n.gw-field{display:flex;flex-direction:column;gap:6px}\n.gw-field-label-row{display:flex;align-items:center;justify-content:space-between;gap:8px}\n.gw-inline-link{display:inline-flex;align-items:center;gap:4px;color:var(--dsw-alias-brand-primary);font-size:var(--glw-text-xs);text-decoration:none;white-space:nowrap}\n.gw-inline-link:hover{text-decoration:underline}\n.gw-field label{font-size:var(--glw-text-xs);font-weight:550;color:var(--dsw-alias-label-primary)}\n.gw-field .hint{font-size:var(--glw-text-2xs);color:var(--dsw-alias-label-secondary)}\n.gw-input{width:100%;height:32px;padding:0 10px;border:var(--glw-line);border-radius:var(--glw-radius-sm);background:var(--dsw-alias-bg-layer-1);font-size:var(--glw-text-sm);outline:none}\n.gw-input:focus{border-color:var(--dsw-alias-brand-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--dsw-alias-brand-primary) 16%,transparent)}\n.gw-input[readonly]{color:var(--dsw-alias-label-secondary);font-family:ui-monospace,SFMono-Regular,Menlo,monospace}\n.gw-select{max-width:200px;cursor:pointer}\n.gw-inline{display:flex;align-items:center;gap:var(--glw-space-2)}\n.gw-inline .gw-input{flex:1}\n.gw-switch{display:flex;align-items:center;gap:var(--glw-space-3);padding:var(--glw-space-3) 0;border-top:var(--glw-line)}\n.gw-switch-text{flex:1;min-width:0}\n.gw-switch-title{font-size:var(--glw-text-sm)}\n.gw-switch-hint{font-size:var(--glw-text-2xs);color:var(--dsw-alias-label-secondary);margin-top:2px}\n.gw-toggle{position:relative;width:38px;height:24px;border-radius:999px;background:var(--dsw-alias-bg-layer-2);border:var(--glw-line);flex:none;cursor:pointer}\n.gw-toggle::after{content:"";position:absolute;top:3px;left:3px;width:16px;height:16px;border-radius:50%;background:var(--dsw-alias-label-secondary);transition:transform 160ms cubic-bezier(.2,.8,.2,1)}\n.gw-toggle.is-on{background:var(--dsw-alias-brand-primary);border-color:var(--dsw-alias-brand-primary)}\n.gw-toggle.is-on::after{background:#fff;transform:translateX(14px)}\n.gw-actions{display:flex;align-items:center;gap:var(--glw-space-2);padding-top:var(--glw-space-1)}\n.gw-actions .end{margin-left:auto}\n.gw-note{margin-top:var(--glw-space-4);padding:var(--glw-space-3) var(--glw-space-4);border:1px dashed var(--dsw-alias-border-l2);border-radius:var(--glw-radius-md);font-size:var(--glw-text-xs);line-height:1.6;color:var(--dsw-alias-label-secondary);max-width:560px}\n.gw-note b{color:var(--dsw-alias-label-primary);font-weight:550}\n.gw-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--glw-space-2);height:100%;min-height:240px;text-align:center;color:var(--dsw-alias-label-secondary)}\n.gw-empty-icon{display:grid;place-items:center;width:40px;height:40px;border:var(--glw-line);border-radius:var(--glw-radius-md);color:var(--dsw-alias-label-secondary)}\n.gw-empty h3{margin:6px 0 0;font-size:var(--glw-text-md);color:var(--dsw-alias-label-primary)}\n.gw-empty p{margin:0;max-width:40ch;font-size:var(--glw-text-sm);line-height:1.6}\n.gw-empty-action{margin-top:var(--glw-space-2)}\n.gw-loading{display:flex;align-items:center;gap:9px;padding:18px 4px;color:var(--dsw-alias-label-secondary);font-size:var(--glw-text-sm)}\n.gw-spinner{width:13px;height:13px;border-radius:50%;border:2px solid var(--dsw-alias-border-l2);border-top-color:var(--dsw-alias-brand-primary);animation:gw-spin .7s linear infinite}\n@keyframes gw-spin{to{transform:rotate(360deg)}}\n.gw-error{border:1px solid color-mix(in srgb,var(--dsw-alias-state-error-primary) 45%,transparent);background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 8%,transparent);border-radius:var(--glw-radius-md);padding:10px 12px;display:flex;flex-direction:column;gap:4px;font-size:var(--glw-text-sm);margin:0 0 12px}\n.gw-error-title{font-weight:600;color:var(--dsw-alias-state-error-primary)}\n.gw-error-text{color:var(--dsw-alias-label-primary)}\n.gw-error-detail{font-size:var(--glw-text-2xs);color:var(--dsw-alias-label-secondary);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;word-break:break-all}\n.gw-table{display:flex;flex-direction:column;border:var(--glw-line);border-radius:var(--glw-radius-md);overflow:hidden;background:var(--dsw-alias-bg-layer-1)}\n.gw-table-row{display:flex;align-items:center;gap:10px;width:100%;text-align:left;background:transparent;border:0;border-bottom:var(--glw-line);padding:9px 12px;cursor:pointer;color:inherit;font:inherit;min-width:0}\n.gw-table-row:last-child{border-bottom:0}\n.gw-table-row:hover{background:var(--dsw-alias-bg-layer-2)}\n.gw-item-id{width:56px;flex:none;color:var(--dsw-alias-label-secondary)}\n.gw-item-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--glw-text-sm)}\n.gw-labels{display:inline-flex;gap:4px;flex-wrap:wrap}\n.gw-label{font-size:var(--glw-text-2xs);border:var(--glw-line);border-radius:var(--glw-radius-full);padding:0 7px;color:var(--dsw-alias-label-secondary);white-space:nowrap}\n.gw-detail{display:flex;flex-direction:column;gap:var(--glw-space-3);padding:var(--glw-space-5) var(--glw-space-6) var(--glw-space-8);min-height:0;overflow:auto}\n.gw-detail-kicker{font-size:var(--glw-text-xs);color:var(--dsw-alias-label-secondary)}\n.gw-detail-body{display:flex;flex-direction:column;gap:var(--glw-space-3);max-width:92ch}\n.gw-detail-meta{display:flex;gap:14px;flex-wrap:wrap;font-size:var(--glw-text-xs);color:var(--dsw-alias-label-secondary)}\n.gw-subhead{margin:var(--glw-space-2) 0 0;font-size:var(--glw-text-xs);font-weight:600;color:var(--dsw-alias-label-secondary)}\n.gw-description{white-space:pre-wrap;word-break:break-word;font-family:inherit;font-size:var(--glw-text-sm);margin:0;color:var(--dsw-alias-label-primary);max-width:72ch}\n.gw-inline-pipeline{display:flex;align-items:center;gap:8px;font-size:var(--glw-text-xs);color:var(--dsw-alias-label-secondary)}\n.gw-breadcrumbs{display:flex;align-items:center;gap:2px;flex-wrap:wrap;min-height:28px;margin-bottom:var(--glw-space-2)}\n.gw-crumb-wrap{display:inline-flex;align-items:center;gap:2px;color:var(--dsw-alias-label-secondary)}\n.gw-crumb{border:0;background:transparent;color:inherit;font:inherit;font-size:var(--glw-text-xs);cursor:pointer;padding:2px 5px;border-radius:5px;max-width:280px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.gw-crumb:hover{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}\n.gw-filepath{font-size:var(--glw-text-xs);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.gw-tree{border:var(--glw-line);border-radius:var(--glw-radius-md);overflow:hidden;background:var(--dsw-alias-bg-layer-1)}\n.gw-tree-meta{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:2px 0 8px;font-size:var(--glw-text-2xs);color:var(--dsw-alias-label-secondary)}\n.gw-tree-more{display:flex;justify-content:center;padding:10px 0}\n.gw-tree-row{display:flex;align-items:center;gap:9px;width:100%;background:transparent;border:0;border-bottom:var(--glw-line);padding:9px 12px;cursor:pointer;color:inherit;font:inherit;text-align:left}\n.gw-tree-row:last-child{border-bottom:0}\n.gw-tree-row:hover{background:var(--dsw-alias-bg-layer-2)}\n.gw-tree-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--glw-text-sm)}\n.gw-file-content{margin:0;padding:14px 16px;border:var(--glw-line);border-radius:var(--glw-radius-md);background:var(--dsw-alias-bg-layer-1);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:var(--glw-text-xs);line-height:1.6;white-space:pre;overflow:auto;max-height:65vh}\n@media (max-width:1080px){.gw-app{--glw-rail:224px}.gw-search{width:220px}.gw-columns{grid-template-columns:1fr;gap:var(--glw-space-5)}.gw-split{grid-template-columns:280px minmax(0,1fr)}.gw-meta-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}\n@media (max-width:880px){.gw-search{display:none}.gw-shell{grid-template-columns:1fr;grid-template-rows:auto minmax(0,1fr)}.gw-rail{flex-direction:row;align-items:center;border-right:0;border-bottom:var(--glw-line);padding:6px var(--glw-space-2);gap:var(--glw-space-1);overflow:hidden}.gw-rail-head,.gw-rail-search,.gw-rail-foot{display:none}.gw-projects{display:flex;gap:var(--glw-space-1);overflow-x:auto;padding:0}.gw-project{padding:5px 8px;flex:none}.gw-project.is-active::before{display:none}.gw-proj-ns,.gw-proj-meta{display:none}.gw-proj-name{max-width:120px}.gw-split{grid-template-columns:1fr;grid-template-rows:minmax(140px,38%) minmax(0,1fr)}.gw-list-pane{border-right:0;border-bottom:var(--glw-line)}.gw-settings{grid-template-columns:1fr}.gw-settings>*{min-width:0}.gw-set-rail{border-right:0;border-bottom:var(--glw-line)}.gw-set-list{display:flex;gap:var(--glw-space-1);padding:var(--glw-space-2);overflow-x:auto}.gw-inst{flex:none;min-width:160px}.gw-stats{grid-template-columns:repeat(2,minmax(0,1fr))}.gw-stat{border-bottom:var(--glw-line)}.gw-stat:nth-child(2n){border-right:0}.gw-stat:nth-last-child(-n+2){border-bottom:0}.gw-head,.gw-tabs{padding-left:var(--glw-space-4);padding-right:var(--glw-space-4)}.gw-content,.gw-detail-pane,.gw-detail,.gw-set-main{padding-left:var(--glw-space-4);padding-right:var(--glw-space-4)}}\n@media (max-width:560px){.gw-word-sub{display:none}.gw-top-actions .gw-status{display:none}.gw-tabs{overflow-x:auto}.gw-pipe-mini .gw-mono,.gw-pipe-duration{display:none}.gw-job-stage,.gw-job-dur{display:none}.gw-job-name{flex:1}.gw-meta-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.gw-head-actions,.gw-detail-head{flex-wrap:wrap}.gw-head-row{flex-direction:column;align-items:stretch;gap:var(--glw-space-2)}.gw-head-actions{padding-top:0}.gw-form{max-width:none}.gw-stage{width:auto;min-width:64px;flex:1}.gw-stage-line{flex:0 0 24px}.gw-stage-meta{white-space:normal;line-height:1.35}.gw-note{max-width:none}}\n@media (prefers-reduced-motion:reduce){.gw-app *{transition:none!important}}\n';
353
+
354
+ // src/client/views/panel.ts
355
+ var import_react11 = require("react");
356
+
357
+ // src/client/api.ts
358
+ var API_ROOT = "/gitlab-workbench/api/";
359
+ async function api(action, options = {}) {
360
+ const url = new URL(API_ROOT + action, window.location.origin);
361
+ for (const [key, value] of Object.entries(options.query ?? {})) {
362
+ if (value === void 0 || value === null || value === "") continue;
363
+ url.searchParams.set(key, String(value));
364
+ }
365
+ let response;
366
+ try {
367
+ response = await fetch(url, {
368
+ method: options.method ?? "GET",
369
+ credentials: "same-origin",
370
+ headers: options.body === void 0 ? void 0 : { "Content-Type": "application/json" },
371
+ body: options.body === void 0 ? void 0 : JSON.stringify(options.body)
372
+ });
373
+ } catch (error) {
374
+ throw Object.assign(new Error(t("errorNetwork")), { code: "network_error", cause: error });
375
+ }
376
+ let payload;
377
+ try {
378
+ payload = await response.json();
379
+ } catch {
380
+ throw Object.assign(new Error(`HTTP ${response.status}`), { code: "bad_response", status: response.status });
381
+ }
382
+ if (!payload || payload.ok !== true) {
383
+ const reason = payload && payload.error ? payload.error : {};
384
+ throw Object.assign(new Error(reason.message || `HTTP ${response.status}`), {
385
+ code: reason.code,
386
+ status: reason.status ?? response.status,
387
+ detail: reason.detail
388
+ });
389
+ }
390
+ return payload.data;
391
+ }
392
+
393
+ // src/client/icons.ts
394
+ var import_react = require("react");
395
+ function icon(paths, options = {}) {
396
+ return (0, import_react.createElement)(
397
+ "svg",
398
+ {
399
+ className: "gw-i",
400
+ viewBox: "0 0 24 24",
401
+ width: options.size ?? 16,
402
+ height: options.size ?? 16,
403
+ fill: options.fill ? "currentColor" : "none",
404
+ stroke: options.fill ? "none" : "currentColor",
405
+ strokeWidth: 1.75,
406
+ strokeLinecap: "round",
407
+ strokeLinejoin: "round",
408
+ "aria-hidden": true,
409
+ focusable: false
410
+ },
411
+ paths.map((d, index) => (0, import_react.createElement)("path", { key: index, d }))
412
+ );
413
+ }
414
+ var I = {
415
+ logo: () => (0, import_react.createElement)(
416
+ "svg",
417
+ {
418
+ className: "gw-i",
419
+ viewBox: "0 0 24 24",
420
+ width: 16,
421
+ height: 16,
422
+ fill: "none",
423
+ strokeWidth: 2,
424
+ strokeLinecap: "round",
425
+ strokeLinejoin: "round",
426
+ "aria-hidden": true,
427
+ focusable: false
428
+ },
429
+ (0, import_react.createElement)("path", { d: "M6 4v10a4 4 0 0 0 4 4h3", stroke: "currentColor" }),
430
+ (0, import_react.createElement)("circle", { cx: 6, cy: 4, r: 1.7, fill: "currentColor" }),
431
+ (0, import_react.createElement)("circle", { cx: 18, cy: 7, r: 2.3, fill: "currentColor" }),
432
+ (0, import_react.createElement)("circle", { cx: 13, cy: 18, r: 2.3, fill: "currentColor" }),
433
+ (0, import_react.createElement)("path", { d: "M18 9.3v1.2a3.5 3.5 0 0 1-3.5 3.5H15", stroke: "currentColor" })
434
+ ),
435
+ search: (p) => icon(["M11 11m-7 0a7 7 0 1 0 14 0a7 7 0 1 0-14 0", "M20 20l-3.6-3.6"], p),
436
+ refresh: (p) => icon(["M20 11a8 8 0 1 0-2.3 6.3", "M20 4v7h-7"], p),
437
+ settings: (p) => (0, import_react.createElement)(
438
+ "svg",
439
+ {
440
+ className: "gw-i",
441
+ viewBox: "0 0 24 24",
442
+ width: p?.size ?? 16,
443
+ height: p?.size ?? 16,
444
+ fill: "none",
445
+ stroke: "currentColor",
446
+ strokeWidth: 1.6,
447
+ strokeLinecap: "round",
448
+ strokeLinejoin: "round",
449
+ "aria-hidden": true,
450
+ focusable: false
451
+ },
452
+ (0, import_react.createElement)("circle", { cx: 12, cy: 12, r: 3 }),
453
+ (0, import_react.createElement)("path", { d: "M19.4 15a1.7 1.7 0 0 0 .3 1.9l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.9-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.9.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.9 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.9l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.9.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.9-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.9V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1Z" })
454
+ ),
455
+ chevron: (p) => icon(["M9 6l6 6-6 6"], p),
456
+ down: (p) => icon(["M6 9l6 6 6-6"], p),
457
+ external: (p) => icon(["M14 4h6v6", "M20 4l-9 9", "M19 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h5"], p),
458
+ branch: (p) => icon(
459
+ ["M6 4v11", "M6 19m-2.2 0a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0-4.4 0", "M18 7m-2.2 0a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0-4.4 0", "M18 9.2v1.3a4.5 4.5 0 0 1-4.5 4.5H10"],
460
+ p
461
+ ),
462
+ tag: (p) => icon(["M3 3h9l9 9-9 9-9-9Z", "M7.5 7.5h.01"], p),
463
+ commit: (p) => icon(
464
+ ["M12 12m-3.4 0a3.4 3.4 0 1 0 6.8 0a3.4 3.4 0 1 0-6.8 0", "M3 12h5.6", "M15.4 12H21"],
465
+ p
466
+ ),
467
+ folder: (p) => icon(["M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z"], p),
468
+ file: (p) => icon(["M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8Z", "M14 3v5h5"], p),
469
+ lock: (p) => icon(["M5 10h14v10H5Z", "M8 10V7a4 4 0 0 1 8 0v3"], p),
470
+ terminal: (p) => icon(["M4 6l5 5-5 5", "M12 17h8"], p),
471
+ play: (p) => icon(["M8 5.5l10 6.5-10 6.5Z"], p),
472
+ stop: (p) => icon(["M7 7h10v10H7Z"], p),
473
+ x: (p) => icon(["M18 6L6 18", "M6 6l12 12"], p),
474
+ plus: (p) => icon(["M12 5v14", "M5 12h14"], p),
475
+ trash: (p) => icon(["M3 6h18", "M8 6V4h8v2", "M19 6l-1 14H6L5 6", "M10 11v6", "M14 11v6"], p),
476
+ copy: (p) => icon(["M9 9h10v10H9Z", "M5 15V5h10"], p),
477
+ check: (p) => icon(["M20 6L9 17l-5-5"], p),
478
+ info: (p) => icon(["M12 12m-8.5 0a8.5 8.5 0 1 0 17 0a8.5 8.5 0 1 0-17 0", "M12 11v5"], p)
479
+ };
480
+
481
+ // src/client/util.ts
482
+ var import_react2 = require("react");
483
+ function relTime(value) {
484
+ if (!value) return "\u2014";
485
+ const then = Date.parse(value);
486
+ if (!Number.isFinite(then)) return "\u2014";
487
+ const seconds = Math.round((Date.now() - then) / 1e3);
488
+ if (seconds < 60) return getLanguage() === "zh" ? "\u521A\u521A" : "just now";
489
+ const minutes = Math.round(seconds / 60);
490
+ if (minutes < 60) return getLanguage() === "zh" ? `${minutes} \u5206\u949F\u524D` : `${minutes}m ago`;
491
+ const hours = Math.round(minutes / 60);
492
+ if (hours < 48) return getLanguage() === "zh" ? `${hours} \u5C0F\u65F6\u524D` : `${hours}h ago`;
493
+ const days = Math.round(hours / 24);
494
+ if (days < 30) return getLanguage() === "zh" ? `${days} \u5929\u524D` : `${days}d ago`;
495
+ return new Date(then).toLocaleDateString();
496
+ }
497
+ function fmtDuration(seconds) {
498
+ if (typeof seconds !== "number" || !Number.isFinite(seconds) || seconds <= 0) return "\u2014";
499
+ if (seconds < 60) return `${Math.round(seconds)}s`;
500
+ const minutes = Math.floor(seconds / 60);
501
+ const rest = Math.round(seconds - minutes * 60);
502
+ if (minutes < 60) return `${minutes}m ${rest}s`;
503
+ const hours = Math.floor(minutes / 60);
504
+ return `${hours}h ${minutes - hours * 60}m`;
505
+ }
506
+ function pipelineDuration(pipeline) {
507
+ if (typeof pipeline?.duration === "number") return fmtDuration(pipeline.duration);
508
+ if (!pipeline?.created_at || !pipeline?.updated_at) return "\u2014";
509
+ if (!["success", "failed", "canceled", "skipped"].includes(pipeline.status)) return "\u2014";
510
+ return fmtDuration((Date.parse(pipeline.updated_at) - Date.parse(pipeline.created_at)) / 1e3);
511
+ }
512
+ var TONES = {
513
+ success: "success",
514
+ failed: "error",
515
+ canceled: "idle",
516
+ skipped: "idle",
517
+ manual: "warn",
518
+ running: "brand",
519
+ pending: "warn",
520
+ created: "warn",
521
+ preparing: "warn",
522
+ waiting_for_resource: "warn",
523
+ scheduled: "warn",
524
+ opened: "brand",
525
+ merged: "success",
526
+ closed: "idle"
527
+ };
528
+ var STATUS_TEXT = {
529
+ success: { zh: "\u6210\u529F", en: "Success" },
530
+ failed: { zh: "\u5931\u8D25", en: "Failed" },
531
+ running: { zh: "\u8FD0\u884C\u4E2D", en: "Running" },
532
+ pending: { zh: "\u7B49\u5F85\u4E2D", en: "Pending" },
533
+ canceled: { zh: "\u5DF2\u53D6\u6D88", en: "Canceled" },
534
+ skipped: { zh: "\u8DF3\u8FC7", en: "Skipped" },
535
+ manual: { zh: "\u624B\u52A8", en: "Manual" },
536
+ created: { zh: "\u5DF2\u521B\u5EFA", en: "Created" },
537
+ preparing: { zh: "\u51C6\u5907\u4E2D", en: "Preparing" },
538
+ waiting_for_resource: { zh: "\u7B49\u5F85\u8D44\u6E90", en: "Waiting" },
539
+ scheduled: { zh: "\u5DF2\u8BA1\u5212", en: "Scheduled" },
540
+ opened: { zh: "\u6253\u5F00", en: "Open" },
541
+ closed: { zh: "\u5DF2\u5173\u95ED", en: "Closed" },
542
+ merged: { zh: "\u5DF2\u5408\u5E76", en: "Merged" },
543
+ locked: { zh: "\u5DF2\u9501\u5B9A", en: "Locked" }
544
+ };
545
+ function statusText(status) {
546
+ const entry = STATUS_TEXT[status];
547
+ if (!entry) return status || "\u2014";
548
+ return getLanguage() === "zh" ? entry.zh : entry.en;
549
+ }
550
+ function statusTone(status) {
551
+ return TONES[status] ?? "idle";
552
+ }
553
+ function shortSha(sha) {
554
+ return typeof sha === "string" ? sha.slice(0, 8) : "\u2014";
555
+ }
556
+ function errorText(error) {
557
+ if (!error) return "";
558
+ if (getLanguage() === "zh") {
559
+ if (error.code === "no_token") return t("errorNoToken");
560
+ if (error.code === "unauthorized" || error.code === "invalid_token") return t("errorUnauthorized");
561
+ if (error.code === "forbidden") return t("errorForbidden");
562
+ if (error.code === "not_found") return t("errorNotFound");
563
+ if (error.code === "rate_limited") return t("errorRateLimited");
564
+ if (error.code === "tls_error") return t("errorTls");
565
+ if (["network_error", "connection_refused", "dns_error", "timeout"].includes(error.code)) return t("errorNetwork");
566
+ }
567
+ return error.message || t("errorGeneric");
568
+ }
569
+ var ACTIVE_PIPELINE_STATUSES = /* @__PURE__ */ new Set([
570
+ "created",
571
+ "waiting_for_resource",
572
+ "preparing",
573
+ "pending",
574
+ "running",
575
+ "scheduled"
576
+ ]);
577
+ function isActivePipelineStatus(status) {
578
+ return Boolean(status && ACTIVE_PIPELINE_STATUSES.has(status));
579
+ }
580
+ function usePolling(reload, active, intervalMs) {
581
+ (0, import_react2.useEffect)(() => {
582
+ if (!active) return void 0;
583
+ const timer = setInterval(() => {
584
+ if (typeof document !== "undefined" && document.visibilityState === "hidden") return;
585
+ reload();
586
+ }, intervalMs);
587
+ return () => clearInterval(timer);
588
+ }, [active, reload, intervalMs]);
589
+ }
590
+ function useAsync(load, deps) {
591
+ const [state, setState] = (0, import_react2.useState)({
592
+ data: null,
593
+ error: null,
594
+ loading: true
595
+ });
596
+ const [nonce, setNonce] = (0, import_react2.useState)(0);
597
+ const seq = (0, import_react2.useRef)(0);
598
+ (0, import_react2.useEffect)(() => {
599
+ const current = ++seq.current;
600
+ setState((previous) => ({ data: previous.data, error: null, loading: true }));
601
+ Promise.resolve().then(load).then((data) => {
602
+ if (seq.current === current) setState({ data, error: null, loading: false });
603
+ }).catch((error) => {
604
+ if (seq.current === current) setState({ data: null, error, loading: false });
605
+ });
606
+ return () => {
607
+ seq.current += 1;
608
+ };
609
+ }, [...deps, nonce]);
610
+ const reload = (0, import_react2.useCallback)(() => setNonce((value) => value + 1), []);
611
+ return { ...state, reload };
612
+ }
613
+ function readUiState() {
614
+ try {
615
+ const parsed = JSON.parse(window.localStorage.getItem("dsh-gitlab-workbench:ui") || "{}");
616
+ return {
617
+ instanceId: typeof parsed.instanceId === "string" ? parsed.instanceId : "",
618
+ project: typeof parsed.project === "string" ? parsed.project : ""
619
+ };
620
+ } catch {
621
+ return { instanceId: "", project: "" };
622
+ }
623
+ }
624
+ function writeUiState(state) {
625
+ try {
626
+ window.localStorage.setItem("dsh-gitlab-workbench:ui", JSON.stringify(state));
627
+ } catch {
628
+ }
629
+ }
630
+
631
+ // src/client/ui.ts
632
+ var import_react3 = require("react");
633
+ function Dot({ tone = "idle" }) {
634
+ return (0, import_react3.createElement)("span", { className: `gw-dot${tone === "idle" ? "" : ` is-${tone}`}` });
635
+ }
636
+ function BranchPicker({
637
+ value,
638
+ options,
639
+ onChange,
640
+ label
641
+ }) {
642
+ const [open, setOpen] = (0, import_react3.useState)(false);
643
+ const [query, setQuery] = (0, import_react3.useState)("");
644
+ const box = (0, import_react3.useRef)(null);
645
+ const search = (0, import_react3.useRef)(null);
646
+ (0, import_react3.useEffect)(() => {
647
+ if (!open) return void 0;
648
+ setQuery("");
649
+ const timer = setTimeout(() => search.current?.focus(), 0);
650
+ const onDocument = (event) => {
651
+ if (box.current && !box.current.contains(event.target)) setOpen(false);
652
+ };
653
+ document.addEventListener("mousedown", onDocument);
654
+ return () => {
655
+ clearTimeout(timer);
656
+ document.removeEventListener("mousedown", onDocument);
657
+ };
658
+ }, [open]);
659
+ const needle = query.trim().toLowerCase();
660
+ const current = options.find((option) => option.name === value);
661
+ const matches = query.trim() === "" ? options : options.filter((option) => option.kind !== "all" && option.name.toLowerCase().includes(needle));
662
+ const choose = (name) => {
663
+ onChange(name);
664
+ setOpen(false);
665
+ };
666
+ return (0, import_react3.createElement)(
667
+ "div",
668
+ { className: "gw-branch-picker", ref: box },
669
+ (0, import_react3.createElement)(
670
+ "button",
671
+ {
672
+ type: "button",
673
+ className: "gw-branch",
674
+ onClick: () => setOpen((current2) => !current2),
675
+ "aria-haspopup": "listbox",
676
+ "aria-expanded": open,
677
+ title: label
678
+ },
679
+ current?.kind === "tag" ? (0, import_react3.createElement)(I.tag, { size: 12 }) : (0, import_react3.createElement)(I.branch, { size: 12 }),
680
+ (0, import_react3.createElement)("span", { className: "gw-branch-name" }, current ? current.name || t("allRefs") : value || t("allRefs")),
681
+ (0, import_react3.createElement)(I.chevron, { size: 11, className: "gw-branch-caret" })
682
+ ),
683
+ open ? (0, import_react3.createElement)(
684
+ "div",
685
+ { className: "gw-popover", role: "listbox" },
686
+ (0, import_react3.createElement)("input", {
687
+ ref: search,
688
+ className: "gw-input gw-popover-search",
689
+ placeholder: t("searchBranch"),
690
+ value: query,
691
+ onChange: (event) => setQuery(event.target.value),
692
+ onKeyDown: (event) => {
693
+ if (event.key === "Escape") setOpen(false);
694
+ else if (event.key === "Enter" && matches[0]) choose(matches[0].name);
695
+ }
696
+ }),
697
+ (0, import_react3.createElement)(
698
+ "div",
699
+ { className: "gw-popover-list" },
700
+ [
701
+ { title: "", items: matches.filter((option) => option.kind === "all"), empty: "" },
702
+ { title: t("branches"), items: matches.filter((option) => option.kind === "branch"), empty: t("noBranch") },
703
+ { title: t("tags"), items: matches.filter((option) => option.kind === "tag"), empty: t("noTags") }
704
+ ].map((group) => {
705
+ if (group.items.length === 0 && (group.title === "" || query.trim() !== "")) return null;
706
+ return (0, import_react3.createElement)(
707
+ "div",
708
+ { key: group.title || "all", className: "gw-popover-group" },
709
+ group.title ? (0, import_react3.createElement)("div", { className: "gw-popover-group-title" }, group.title) : null,
710
+ group.items.length === 0 ? (0, import_react3.createElement)("div", { className: "gw-muted", style: { padding: "4px 9px 6px" } }, group.empty) : group.items.map(
711
+ (option) => (0, import_react3.createElement)(
712
+ "button",
713
+ {
714
+ key: option.name || "all",
715
+ type: "button",
716
+ role: "option",
717
+ "aria-selected": option.name === value,
718
+ className: `gw-popover-item${option.name === value ? " is-active" : ""}`,
719
+ onClick: () => choose(option.name)
720
+ },
721
+ option.kind === "tag" ? (0, import_react3.createElement)(I.tag, { size: 12 }) : (0, import_react3.createElement)(I.branch, { size: 12 }),
722
+ (0, import_react3.createElement)("span", { className: "gw-branch-name" }, option.name || t("allRefs"))
723
+ )
724
+ ),
725
+ group.title === "" && group.items.length > 0 ? (0, import_react3.createElement)("div", { className: "gw-popover-divider" }) : null
726
+ );
727
+ }),
728
+ matches.length === 0 ? (0, import_react3.createElement)("div", { className: "gw-muted", style: { padding: "8px 10px" } }, t("noBranch")) : null
729
+ )
730
+ ) : null
731
+ );
732
+ }
733
+ function Status({ status, label }) {
734
+ return (0, import_react3.createElement)(
735
+ "span",
736
+ { className: `gw-status is-${statusTone(status)}` },
737
+ (0, import_react3.createElement)("span", { className: "gw-dot" }),
738
+ label ?? statusText(status)
739
+ );
740
+ }
741
+ function Button({ children, onClick, kind = "", small, disabled, type = "button", title }) {
742
+ return (0, import_react3.createElement)(
743
+ "button",
744
+ {
745
+ type,
746
+ className: `gw-btn${kind ? ` is-${kind}` : ""}${small ? " is-sm" : ""}`,
747
+ onClick,
748
+ disabled: Boolean(disabled),
749
+ title: title ?? void 0
750
+ },
751
+ children
752
+ );
753
+ }
754
+ function IconButton({ label, onClick, children, disabled }) {
755
+ return (0, import_react3.createElement)(
756
+ "button",
757
+ { type: "button", className: "gw-icon-btn", onClick, disabled: Boolean(disabled), "aria-label": label, title: label },
758
+ children
759
+ );
760
+ }
761
+ function Spinner({ label }) {
762
+ return (0, import_react3.createElement)(
763
+ "div",
764
+ { className: "gw-loading", role: "status" },
765
+ (0, import_react3.createElement)("span", { className: "gw-spinner" }),
766
+ (0, import_react3.createElement)("span", null, label ?? t("loading"))
767
+ );
768
+ }
769
+ function Empty({ title, hint, action, icon: icon2 }) {
770
+ return (0, import_react3.createElement)(
771
+ "div",
772
+ { className: "gw-empty" },
773
+ (0, import_react3.createElement)("div", { className: "gw-empty-icon" }, icon2 ?? (0, import_react3.createElement)(I.branch, { size: 18 })),
774
+ (0, import_react3.createElement)("h3", null, title ?? t("noSelection")),
775
+ hint ? (0, import_react3.createElement)("p", null, hint) : null,
776
+ action ? (0, import_react3.createElement)("div", { className: "gw-empty-action" }, action) : null
777
+ );
778
+ }
779
+ function ErrorNote({ error, onRetry }) {
780
+ if (!error) return null;
781
+ return (0, import_react3.createElement)(
782
+ "div",
783
+ { className: "gw-error", role: "alert" },
784
+ (0, import_react3.createElement)("div", { className: "gw-error-title" }, t("errorGeneric")),
785
+ (0, import_react3.createElement)("div", { className: "gw-error-text" }, errorText(error)),
786
+ error.detail ? (0, import_react3.createElement)("div", { className: "gw-error-detail" }, error.detail) : null,
787
+ onRetry ? (0, import_react3.createElement)(Button, { kind: "ghost", small: true, onClick: onRetry }, t("retry")) : null
788
+ );
789
+ }
790
+ function MetaGrid({ items }) {
791
+ return (0, import_react3.createElement)(
792
+ "dl",
793
+ { className: "gw-meta-grid" },
794
+ items.map(([label, value]) => (0, import_react3.createElement)("div", { key: label }, (0, import_react3.createElement)("dt", null, label), (0, import_react3.createElement)("dd", null, value)))
795
+ );
796
+ }
797
+ function SectionHead({ title, link, onLink }) {
798
+ return (0, import_react3.createElement)(
799
+ "div",
800
+ { className: "gw-block-head" },
801
+ (0, import_react3.createElement)("h2", null, title),
802
+ link ? (0, import_react3.createElement)("button", { type: "button", className: "gw-block-link", onClick: onLink }, link) : null
803
+ );
804
+ }
805
+ function LabelList({ labels }) {
806
+ if (!Array.isArray(labels) || labels.length === 0) return null;
807
+ return (0, import_react3.createElement)(
808
+ "span",
809
+ { className: "gw-labels" },
810
+ labels.slice(0, 4).map((label) => (0, import_react3.createElement)("span", { key: label, className: "gw-label" }, label))
811
+ );
812
+ }
813
+ function InstancePicker({ instances, value, onChange }) {
814
+ const current = instances.find((item) => item.id === value);
815
+ return (0, import_react3.createElement)(
816
+ "span",
817
+ { className: "gw-instance" },
818
+ (0, import_react3.createElement)("span", { className: `gw-dot${current?.status?.ok === false ? " is-bad" : current?.hasToken ? " is-ok" : ""}` }),
819
+ (0, import_react3.createElement)(
820
+ "select",
821
+ {
822
+ className: "gw-instance-select",
823
+ value,
824
+ "aria-label": t("settings"),
825
+ onChange: (event) => onChange(event.target.value)
826
+ },
827
+ instances.map((instance) => (0, import_react3.createElement)("option", { key: instance.id, value: instance.id }, instance.label || instance.endpoint))
828
+ ),
829
+ (0, import_react3.createElement)(I.down, { size: 12 })
830
+ );
831
+ }
832
+
833
+ // src/client/views/project.ts
834
+ var import_react9 = require("react");
835
+
836
+ // src/client/views/files.ts
837
+ var import_react4 = require("react");
838
+ function FilesTab({
839
+ instanceId,
840
+ projectPath,
841
+ project,
842
+ refName
843
+ }) {
844
+ const [dir, setDir] = (0, import_react4.useState)("");
845
+ const [file, setFile] = (0, import_react4.useState)(null);
846
+ const [more, setMore] = (0, import_react4.useState)([]);
847
+ const [moreBusy, setMoreBusy] = (0, import_react4.useState)(false);
848
+ const ref = refName;
849
+ const tree = useAsync(
850
+ () => api("tree", { query: { id: instanceId, path: projectPath, dir, ref } }),
851
+ [instanceId, projectPath, dir, ref]
852
+ );
853
+ const fileData = useAsync(
854
+ () => file ? api("file", { query: { id: instanceId, path: projectPath, filePath: file, ref } }) : Promise.resolve(null),
855
+ [instanceId, projectPath, file, ref]
856
+ );
857
+ (0, import_react4.useEffect)(() => {
858
+ setMore([]);
859
+ }, [dir, ref, projectPath]);
860
+ const entries = [...tree.data?.items ?? [], ...more];
861
+ const nextPage = tree.data?.nextPage ?? null;
862
+ const loadMore = async () => {
863
+ if (!nextPage || moreBusy) return;
864
+ setMoreBusy(true);
865
+ try {
866
+ const page = await api("tree", { query: { id: instanceId, path: projectPath, dir, ref, page: nextPage } });
867
+ setMore((current) => [...current, ...page.items ?? []]);
868
+ } finally {
869
+ setMoreBusy(false);
870
+ }
871
+ };
872
+ if (file) {
873
+ const size = typeof fileData.data?.size === "number" ? fileData.data.size : null;
874
+ const humanSize = size === null ? "" : size < 1024 ? `${size} B` : size < 1024 * 1024 ? `${(size / 1024).toFixed(1)} KB` : `${(size / (1024 * 1024)).toFixed(1)} MB`;
875
+ return (0, import_react4.createElement)(
876
+ "div",
877
+ { className: "gw-content" },
878
+ (0, import_react4.createElement)(
879
+ "div",
880
+ { className: "gw-breadcrumbs" },
881
+ (0, import_react4.createElement)(IconButton, { label: t("back"), onClick: () => setFile(null) }, (0, import_react4.createElement)(I.chevron, { size: 14, style: { transform: "rotate(180deg)" } })),
882
+ (0, import_react4.createElement)("span", { className: "gw-mono gw-filepath" }, file),
883
+ (0, import_react4.createElement)("span", { className: "gw-top-spacer" }),
884
+ (0, import_react4.createElement)("span", { className: "gw-chip mono" }, ref || t("defaultBranch")),
885
+ humanSize ? (0, import_react4.createElement)("span", { className: "gw-chip" }, humanSize) : null,
886
+ project.web_url ? (0, import_react4.createElement)(
887
+ "a",
888
+ {
889
+ className: "gw-btn is-ghost is-sm",
890
+ href: `${project.web_url}/-/blob/${encodeURIComponent(ref)}/${file.split("/").map(encodeURIComponent).join("/")}`,
891
+ target: "_blank",
892
+ rel: "noreferrer noopener"
893
+ },
894
+ t("openInGitLab"),
895
+ (0, import_react4.createElement)(I.external, { size: 12 })
896
+ ) : null
897
+ ),
898
+ (0, import_react4.createElement)(ErrorNote, { error: fileData.error, onRetry: fileData.reload }),
899
+ fileData.loading ? (0, import_react4.createElement)(Spinner) : null,
900
+ fileData.data ? fileData.data.binary ? (0, import_react4.createElement)(Empty, { title: t("binaryFile"), icon: (0, import_react4.createElement)(I.file, { size: 18 }) }) : (0, import_react4.createElement)(
901
+ "div",
902
+ null,
903
+ fileData.data.truncated ? (0, import_react4.createElement)("div", { className: "gw-note" }, t("truncated")) : null,
904
+ (0, import_react4.createElement)("pre", { className: "gw-file-content" }, fileData.data.content)
905
+ ) : null
906
+ );
907
+ }
908
+ const parts = dir === "" ? [] : dir.split("/");
909
+ return (0, import_react4.createElement)(
910
+ "div",
911
+ { className: "gw-content" },
912
+ (0, import_react4.createElement)(
913
+ "div",
914
+ { className: "gw-breadcrumbs" },
915
+ (0, import_react4.createElement)("button", { type: "button", className: "gw-crumb", onClick: () => setDir("") }, project.name || projectPath),
916
+ parts.map(
917
+ (part, index) => (0, import_react4.createElement)(
918
+ "span",
919
+ { key: `${part}-${index}`, className: "gw-crumb-wrap" },
920
+ (0, import_react4.createElement)(I.chevron, { size: 12 }),
921
+ (0, import_react4.createElement)("button", { type: "button", className: "gw-crumb", onClick: () => setDir(parts.slice(0, index + 1).join("/")) }, part)
922
+ )
923
+ ),
924
+ (0, import_react4.createElement)("span", { className: "gw-top-spacer" }),
925
+ (0, import_react4.createElement)(IconButton, { label: t("refresh"), onClick: tree.reload }, (0, import_react4.createElement)(I.refresh, { size: 15 }))
926
+ ),
927
+ (0, import_react4.createElement)(
928
+ "div",
929
+ { className: "gw-tree-meta" },
930
+ (0, import_react4.createElement)("span", null, t("items", { count: entries.length })),
931
+ (0, import_react4.createElement)("span", { className: "gw-mono" }, ref)
932
+ ),
933
+ (0, import_react4.createElement)(ErrorNote, { error: tree.error, onRetry: tree.reload }),
934
+ tree.loading && !tree.data ? (0, import_react4.createElement)(Spinner) : null,
935
+ tree.data && entries.length === 0 ? (0, import_react4.createElement)("div", { className: "gw-muted" }, t("emptyDir")) : null,
936
+ entries.length > 0 ? (0, import_react4.createElement)(
937
+ "div",
938
+ { className: "gw-tree" },
939
+ [...entries].sort((a, b) => a.type === b.type ? a.name.localeCompare(b.name) : a.type === "tree" ? -1 : 1).map(
940
+ (entry) => (0, import_react4.createElement)(
941
+ "button",
942
+ {
943
+ key: entry.id ?? entry.path,
944
+ type: "button",
945
+ className: "gw-tree-row",
946
+ onClick: () => entry.type === "tree" ? setDir(entry.path) : setFile(entry.path)
947
+ },
948
+ entry.type === "tree" ? (0, import_react4.createElement)(I.folder, { size: 15 }) : (0, import_react4.createElement)(I.file, { size: 15 }),
949
+ (0, import_react4.createElement)("span", { className: "gw-tree-name" }, entry.name),
950
+ entry.type === "tree" ? (0, import_react4.createElement)(I.chevron, { size: 13 }) : null
951
+ )
952
+ )
953
+ ) : null,
954
+ nextPage ? (0, import_react4.createElement)(
955
+ "div",
956
+ { className: "gw-tree-more" },
957
+ (0, import_react4.createElement)(Button, { kind: "ghost", onClick: loadMore, disabled: moreBusy }, moreBusy ? t("loading") : t("loadMore"))
958
+ ) : null
959
+ );
960
+ }
961
+
962
+ // src/client/views/issues.ts
963
+ var import_react5 = require("react");
964
+ function IssueDetail({ instanceId, projectPath, iid, onBack }) {
965
+ const { data, error, loading, reload } = useAsync(
966
+ () => api("issue", { query: { id: instanceId, path: projectPath, iid } }),
967
+ [instanceId, projectPath, iid]
968
+ );
969
+ return (0, import_react5.createElement)(
970
+ "div",
971
+ { className: "gw-detail" },
972
+ (0, import_react5.createElement)(
973
+ "div",
974
+ { className: "gw-detail-head" },
975
+ (0, import_react5.createElement)(IconButton, { label: t("back"), onClick: onBack }, (0, import_react5.createElement)(I.chevron, { size: 14, style: { transform: "rotate(180deg)" } })),
976
+ (0, import_react5.createElement)("span", { className: "gw-detail-kicker gw-mono" }, `#${data?.iid ?? iid}`),
977
+ data ? (0, import_react5.createElement)(Status, { status: data.state }) : null,
978
+ (0, import_react5.createElement)("span", { className: "gw-top-spacer" }),
979
+ data?.web_url ? (0, import_react5.createElement)("a", { className: "gw-btn is-ghost is-sm", href: data.web_url, target: "_blank", rel: "noreferrer noopener" }, t("openInGitLab"), (0, import_react5.createElement)(I.external, { size: 12 })) : null
980
+ ),
981
+ (0, import_react5.createElement)(ErrorNote, { error, onRetry: reload }),
982
+ loading && !data ? (0, import_react5.createElement)(Spinner) : null,
983
+ data ? (0, import_react5.createElement)(
984
+ "div",
985
+ { className: "gw-detail-body" },
986
+ (0, import_react5.createElement)("h2", { className: "gw-detail-title" }, data.title),
987
+ (0, import_react5.createElement)(
988
+ "div",
989
+ { className: "gw-detail-meta" },
990
+ (0, import_react5.createElement)("span", null, `${t("author")}\uFF1A${data.author?.name || data.author?.username || "\u2014"}`),
991
+ (0, import_react5.createElement)("span", null, relTime(data.updated_at)),
992
+ Array.isArray(data.assignees) && data.assignees.length > 0 ? (0, import_react5.createElement)("span", null, `${t("assignees")}\uFF1A${data.assignees.map((user) => user.name || user.username).join(", ")}`) : null
993
+ ),
994
+ (0, import_react5.createElement)(LabelList, { labels: data.labels }),
995
+ (0, import_react5.createElement)("h3", { className: "gw-subhead" }, t("description")),
996
+ (0, import_react5.createElement)("pre", { className: "gw-description" }, data.description || t("noDescription"))
997
+ ) : null
998
+ );
999
+ }
1000
+ function IssuesTab({ instanceId, projectPath }) {
1001
+ const [state, setState] = (0, import_react5.useState)("opened");
1002
+ const [selected, setSelected] = (0, import_react5.useState)(null);
1003
+ const list = useAsync(
1004
+ () => api("issues", { query: { id: instanceId, path: projectPath, state } }),
1005
+ [instanceId, projectPath, state]
1006
+ );
1007
+ if (selected) {
1008
+ return (0, import_react5.createElement)(IssueDetail, { instanceId, projectPath, iid: selected, onBack: () => setSelected(null) });
1009
+ }
1010
+ return (0, import_react5.createElement)(
1011
+ "div",
1012
+ { className: "gw-content" },
1013
+ (0, import_react5.createElement)(
1014
+ "div",
1015
+ { className: "gw-toolbar" },
1016
+ (0, import_react5.createElement)(
1017
+ "select",
1018
+ { className: "gw-input gw-select", value: state, onChange: (event) => setState(event.target.value), "aria-label": t("issues") },
1019
+ (0, import_react5.createElement)("option", { value: "opened" }, t("statusOpened")),
1020
+ (0, import_react5.createElement)("option", { value: "closed" }, t("statusClosed")),
1021
+ (0, import_react5.createElement)("option", { value: "all" }, t("allStatuses"))
1022
+ ),
1023
+ (0, import_react5.createElement)("span", { className: "gw-top-spacer" }),
1024
+ (0, import_react5.createElement)(IconButton, { label: t("refresh"), onClick: list.reload }, (0, import_react5.createElement)(I.refresh, { size: 15 }))
1025
+ ),
1026
+ (0, import_react5.createElement)(ErrorNote, { error: list.error, onRetry: list.reload }),
1027
+ list.loading && !list.data ? (0, import_react5.createElement)(Spinner) : null,
1028
+ list.data && list.data.items.length === 0 ? (0, import_react5.createElement)(Empty, { title: t("noIssues") }) : null,
1029
+ list.data && list.data.items.length > 0 ? (0, import_react5.createElement)(
1030
+ "div",
1031
+ { className: "gw-table" },
1032
+ list.data.items.map(
1033
+ (issue) => (0, import_react5.createElement)(
1034
+ "button",
1035
+ { key: issue.id, type: "button", className: "gw-table-row", onClick: () => setSelected(issue.iid) },
1036
+ (0, import_react5.createElement)("span", { className: "gw-item-id gw-mono" }, `#${issue.iid}`),
1037
+ (0, import_react5.createElement)("span", { className: "gw-item-title" }, issue.title),
1038
+ (0, import_react5.createElement)(LabelList, { labels: issue.labels }),
1039
+ (0, import_react5.createElement)("span", { className: "gw-row-time" }, relTime(issue.updated_at)),
1040
+ (0, import_react5.createElement)(I.chevron, { size: 14 })
1041
+ )
1042
+ )
1043
+ ) : null
1044
+ );
1045
+ }
1046
+
1047
+ // src/client/views/mergeRequests.ts
1048
+ var import_react6 = require("react");
1049
+ function MergeRequestDetail({ instanceId, projectPath, iid, onBack }) {
1050
+ const { data, error, loading, reload } = useAsync(
1051
+ () => api("merge-request", { query: { id: instanceId, path: projectPath, iid } }),
1052
+ [instanceId, projectPath, iid]
1053
+ );
1054
+ const pipeline = data?.head_pipeline || data?.pipeline;
1055
+ return (0, import_react6.createElement)(
1056
+ "div",
1057
+ { className: "gw-detail" },
1058
+ (0, import_react6.createElement)(
1059
+ "div",
1060
+ { className: "gw-detail-head" },
1061
+ (0, import_react6.createElement)(IconButton, { label: t("back"), onClick: onBack }, (0, import_react6.createElement)(I.chevron, { size: 14, style: { transform: "rotate(180deg)" } })),
1062
+ (0, import_react6.createElement)("span", { className: "gw-detail-kicker gw-mono" }, `!${data?.iid ?? iid}`),
1063
+ data ? (0, import_react6.createElement)(Status, { status: data.state }) : null,
1064
+ (0, import_react6.createElement)("span", { className: "gw-top-spacer" }),
1065
+ data?.web_url ? (0, import_react6.createElement)("a", { className: "gw-btn is-ghost is-sm", href: data.web_url, target: "_blank", rel: "noreferrer noopener" }, t("openInGitLab"), (0, import_react6.createElement)(I.external, { size: 12 })) : null
1066
+ ),
1067
+ (0, import_react6.createElement)(ErrorNote, { error, onRetry: reload }),
1068
+ loading && !data ? (0, import_react6.createElement)(Spinner) : null,
1069
+ data ? (0, import_react6.createElement)(
1070
+ "div",
1071
+ { className: "gw-detail-body" },
1072
+ (0, import_react6.createElement)("h2", { className: "gw-detail-title" }, data.title),
1073
+ (0, import_react6.createElement)(
1074
+ "div",
1075
+ { className: "gw-detail-meta" },
1076
+ (0, import_react6.createElement)("span", null, `${t("author")}\uFF1A${data.author?.name || data.author?.username || "\u2014"}`),
1077
+ (0, import_react6.createElement)("span", { className: "gw-mono" }, `${data.source_branch} \u2192 ${data.target_branch}`),
1078
+ (0, import_react6.createElement)("span", null, relTime(data.updated_at)),
1079
+ data.changes_count ? (0, import_react6.createElement)("span", null, `${t("changes")} ${data.changes_count}`) : null
1080
+ ),
1081
+ (0, import_react6.createElement)(LabelList, { labels: data.labels }),
1082
+ pipeline ? (0, import_react6.createElement)("div", { className: "gw-inline-pipeline" }, (0, import_react6.createElement)("span", null, t("pipelineOfMR")), (0, import_react6.createElement)(Status, { status: pipeline.status }), (0, import_react6.createElement)("span", { className: "gw-muted gw-mono" }, `#${pipeline.id}`)) : null,
1083
+ (0, import_react6.createElement)("h3", { className: "gw-subhead" }, t("description")),
1084
+ (0, import_react6.createElement)("pre", { className: "gw-description" }, data.description || t("noDescription"))
1085
+ ) : null
1086
+ );
1087
+ }
1088
+ function MergeRequestsTab({ instanceId, projectPath }) {
1089
+ const [state, setState] = (0, import_react6.useState)("opened");
1090
+ const [selected, setSelected] = (0, import_react6.useState)(null);
1091
+ const list = useAsync(
1092
+ () => api("merge-requests", { query: { id: instanceId, path: projectPath, state } }),
1093
+ [instanceId, projectPath, state]
1094
+ );
1095
+ if (selected) {
1096
+ return (0, import_react6.createElement)(MergeRequestDetail, { instanceId, projectPath, iid: selected, onBack: () => setSelected(null) });
1097
+ }
1098
+ return (0, import_react6.createElement)(
1099
+ "div",
1100
+ { className: "gw-content" },
1101
+ (0, import_react6.createElement)(
1102
+ "div",
1103
+ { className: "gw-toolbar" },
1104
+ (0, import_react6.createElement)(
1105
+ "select",
1106
+ { className: "gw-input gw-select", value: state, onChange: (event) => setState(event.target.value), "aria-label": t("mergeRequests") },
1107
+ (0, import_react6.createElement)("option", { value: "opened" }, t("statusOpened")),
1108
+ (0, import_react6.createElement)("option", { value: "merged" }, t("statusMerged")),
1109
+ (0, import_react6.createElement)("option", { value: "closed" }, t("statusClosed")),
1110
+ (0, import_react6.createElement)("option", { value: "all" }, t("allStatuses"))
1111
+ ),
1112
+ (0, import_react6.createElement)("span", { className: "gw-top-spacer" }),
1113
+ (0, import_react6.createElement)(IconButton, { label: t("refresh"), onClick: list.reload }, (0, import_react6.createElement)(I.refresh, { size: 15 }))
1114
+ ),
1115
+ (0, import_react6.createElement)(ErrorNote, { error: list.error, onRetry: list.reload }),
1116
+ list.loading && !list.data ? (0, import_react6.createElement)(Spinner) : null,
1117
+ list.data && list.data.items.length === 0 ? (0, import_react6.createElement)(Empty, { title: t("noMergeRequests") }) : null,
1118
+ list.data && list.data.items.length > 0 ? (0, import_react6.createElement)(
1119
+ "div",
1120
+ { className: "gw-table" },
1121
+ list.data.items.map(
1122
+ (mr) => (0, import_react6.createElement)(
1123
+ "button",
1124
+ { key: mr.id, type: "button", className: "gw-table-row", onClick: () => setSelected(mr.iid) },
1125
+ (0, import_react6.createElement)("span", { className: "gw-item-id gw-mono" }, `!${mr.iid}`),
1126
+ (0, import_react6.createElement)("span", { className: "gw-item-title" }, mr.title),
1127
+ (0, import_react6.createElement)(LabelList, { labels: mr.labels }),
1128
+ mr.head_pipeline || mr.pipeline ? (0, import_react6.createElement)(Status, { status: (mr.head_pipeline || mr.pipeline).status }) : null,
1129
+ (0, import_react6.createElement)("span", { className: "gw-row-time" }, relTime(mr.updated_at)),
1130
+ (0, import_react6.createElement)(I.chevron, { size: 14 })
1131
+ )
1132
+ )
1133
+ ) : null
1134
+ );
1135
+ }
1136
+
1137
+ // src/client/views/overview.ts
1138
+ var import_react7 = require("react");
1139
+ function OverviewTab({ instanceId, projectPath, project, counts, refName, onOpenPipelines }) {
1140
+ const pipelines = useAsync(
1141
+ () => api("pipelines", { query: { id: instanceId, path: projectPath, ref: refName } }),
1142
+ [instanceId, projectPath, refName]
1143
+ );
1144
+ const commits = useAsync(
1145
+ () => api("commits", { query: { id: instanceId, path: projectPath, ref: refName || project.default_branch } }),
1146
+ [instanceId, projectPath, refName, project.default_branch]
1147
+ );
1148
+ usePolling(
1149
+ pipelines.reload,
1150
+ (pipelines.data?.items ?? []).some((pipeline) => isActivePipelineStatus(pipeline.status)),
1151
+ 8e3
1152
+ );
1153
+ const [more, setMore] = (0, import_react7.useState)([]);
1154
+ const [moreBusy, setMoreBusy] = (0, import_react7.useState)(false);
1155
+ (0, import_react7.useEffect)(() => {
1156
+ setMore([]);
1157
+ }, [instanceId, projectPath, refName]);
1158
+ const commitItems = [...commits.data?.items ?? [], ...more];
1159
+ const nextPage = commits.data?.nextPage ?? null;
1160
+ const loadMore = async () => {
1161
+ if (!nextPage || moreBusy) return;
1162
+ setMoreBusy(true);
1163
+ try {
1164
+ const page = await api("commits", {
1165
+ query: { id: instanceId, path: projectPath, ref: refName || project.default_branch, page: nextPage }
1166
+ });
1167
+ setMore((current) => [...current, ...page.items ?? []]);
1168
+ } finally {
1169
+ setMoreBusy(false);
1170
+ }
1171
+ };
1172
+ return (0, import_react7.createElement)(
1173
+ "div",
1174
+ { className: "gw-content" },
1175
+ (0, import_react7.createElement)(
1176
+ "section",
1177
+ { className: "gw-stats", "aria-label": t("projects") },
1178
+ (0, import_react7.createElement)("div", { className: "gw-stat" }, (0, import_react7.createElement)("div", { className: "gw-stat-num" }, String(project.open_issues_count ?? 0)), (0, import_react7.createElement)("div", { className: "gw-stat-label" }, t("openIssues"))),
1179
+ (0, import_react7.createElement)("div", { className: "gw-stat" }, (0, import_react7.createElement)("div", { className: "gw-stat-num" }, String(counts?.openMergeRequests ?? "\u2014")), (0, import_react7.createElement)("div", { className: "gw-stat-label" }, t("openMergeRequests"))),
1180
+ (0, import_react7.createElement)("div", { className: "gw-stat" }, (0, import_react7.createElement)("div", { className: "gw-stat-num" }, String(project.star_count ?? 0)), (0, import_react7.createElement)("div", { className: "gw-stat-label" }, t("stars"))),
1181
+ (0, import_react7.createElement)("div", { className: "gw-stat" }, (0, import_react7.createElement)("div", { className: "gw-stat-num" }, String(project.forks_count ?? 0)), (0, import_react7.createElement)("div", { className: "gw-stat-label" }, t("forks")))
1182
+ ),
1183
+ (0, import_react7.createElement)(
1184
+ "section",
1185
+ { className: "gw-block" },
1186
+ (0, import_react7.createElement)(SectionHead, { title: t("recentPipelines"), link: `${t("allPipelines")} \u2192`, onLink: onOpenPipelines }),
1187
+ (0, import_react7.createElement)(ErrorNote, { error: pipelines.error, onRetry: pipelines.reload }),
1188
+ pipelines.loading && !pipelines.data ? (0, import_react7.createElement)(Spinner) : null,
1189
+ (0, import_react7.createElement)(
1190
+ "div",
1191
+ { className: "gw-pipe-mini" },
1192
+ pipelines.data && pipelines.data.items.length === 0 ? (0, import_react7.createElement)(
1193
+ "div",
1194
+ { className: "gw-muted", style: { padding: "14px 16px" } },
1195
+ refName ? t("noPipelinesBranch", { ref: refName }) : t("noPipelines")
1196
+ ) : (pipelines.data?.items ?? []).slice(0, 3).map(
1197
+ (pipeline) => (0, import_react7.createElement)(
1198
+ "div",
1199
+ { key: pipeline.id, className: "gw-list-row" },
1200
+ (0, import_react7.createElement)(Status, { status: pipeline.status }),
1201
+ (0, import_react7.createElement)("span", { className: "gw-pipe-id" }, `#${pipeline.id}`),
1202
+ (0, import_react7.createElement)("span", { className: "gw-pipe-ref" }, (0, import_react7.createElement)(I.branch, { size: 12 }), pipeline.ref),
1203
+ (0, import_react7.createElement)("span", { className: "gw-mono gw-muted" }, shortSha(pipeline.sha)),
1204
+ (0, import_react7.createElement)("span", { className: "gw-pipe-duration" }, pipelineDuration(pipeline)),
1205
+ (0, import_react7.createElement)("span", { className: "gw-row-time" }, relTime(pipeline.created_at))
1206
+ )
1207
+ )
1208
+ )
1209
+ ),
1210
+ (0, import_react7.createElement)(
1211
+ "section",
1212
+ { className: "gw-block" },
1213
+ (0, import_react7.createElement)(SectionHead, {
1214
+ title: t("recentCommits"),
1215
+ link: (0, import_react7.createElement)("span", { className: "gw-inline" }, t("openInGitLab"), (0, import_react7.createElement)(I.external, { size: 12 })),
1216
+ onLink: () => window.open(`${project.web_url}/-/commits/${encodeURIComponent(refName || project.default_branch)}`, "_blank", "noopener")
1217
+ }),
1218
+ (0, import_react7.createElement)(ErrorNote, { error: commits.error, onRetry: commits.reload }),
1219
+ commits.loading && !commits.data ? (0, import_react7.createElement)(Spinner) : null,
1220
+ (0, import_react7.createElement)(
1221
+ "div",
1222
+ { className: "gw-list gw-commit-list" },
1223
+ commitItems.map(
1224
+ (commit) => (0, import_react7.createElement)(
1225
+ "div",
1226
+ { key: commit.id, className: "gw-list-row" },
1227
+ (0, import_react7.createElement)("span", { className: "gw-mono gw-muted" }, commit.short_id ?? shortSha(commit.id)),
1228
+ (0, import_react7.createElement)("span", { className: "gw-commit" }, (0, import_react7.createElement)("span", { className: "gw-commit-title" }, commit.title)),
1229
+ (0, import_react7.createElement)("span", { className: "gw-commit-author" }, commit.author_name || ""),
1230
+ (0, import_react7.createElement)("span", { className: "gw-row-time" }, commit.authored_date ? relTime(commit.authored_date) : "")
1231
+ )
1232
+ ),
1233
+ commitItems.length === 0 && commits.data ? (0, import_react7.createElement)("div", { className: "gw-muted gw-list-empty" }, t("noCommits")) : null
1234
+ ),
1235
+ nextPage ? (0, import_react7.createElement)(
1236
+ "div",
1237
+ { className: "gw-tree-more" },
1238
+ (0, import_react7.createElement)(Button, { kind: "ghost", onClick: loadMore, disabled: moreBusy }, moreBusy ? t("loading") : t("loadMore"))
1239
+ ) : null
1240
+ )
1241
+ );
1242
+ }
1243
+
1244
+ // src/client/views/pipelines.ts
1245
+ var import_react8 = require("react");
1246
+ function stagesOf(jobs) {
1247
+ const order = [];
1248
+ const map = /* @__PURE__ */ new Map();
1249
+ for (const job of jobs) {
1250
+ const stage = job.stage || "default";
1251
+ if (!map.has(stage)) {
1252
+ map.set(stage, []);
1253
+ order.push(stage);
1254
+ }
1255
+ map.get(stage).push(job);
1256
+ }
1257
+ return order.map((stage) => {
1258
+ const items = map.get(stage);
1259
+ const failed = items.filter((job) => job.status === "failed").length;
1260
+ const running = items.filter((job) => ["running", "pending", "preparing"].includes(job.status)).length;
1261
+ const success = items.filter((job) => job.status === "success").length;
1262
+ const skipped = items.filter((job) => ["skipped", "canceled", "manual"].includes(job.status)).length;
1263
+ let tone = "idle";
1264
+ let meta = `${skipped} ${statusText("skipped")}`;
1265
+ if (failed > 0) {
1266
+ tone = "error";
1267
+ meta = `${failed} ${statusText("failed")} / ${success} ${statusText("success")}`;
1268
+ } else if (running > 0) {
1269
+ tone = "brand";
1270
+ meta = `${running} ${statusText("running")}`;
1271
+ } else if (success > 0) {
1272
+ tone = "success";
1273
+ meta = `${success} ${statusText("success")}`;
1274
+ }
1275
+ return { stage, items, tone, meta };
1276
+ });
1277
+ }
1278
+ function JobLog({ instanceId, projectPath, job, onClose }) {
1279
+ const { data, error, loading, reload } = useAsync(
1280
+ () => api("job-trace", { query: { id: instanceId, path: projectPath, jobId: job.id } }),
1281
+ [instanceId, projectPath, job.id]
1282
+ );
1283
+ const download = () => {
1284
+ if (!data) return;
1285
+ const blob = new Blob([data.content ?? ""], { type: "text/plain;charset=utf-8" });
1286
+ const url = URL.createObjectURL(blob);
1287
+ const link = document.createElement("a");
1288
+ link.href = url;
1289
+ link.download = `job-${job.id}-${job.name}.log`;
1290
+ link.click();
1291
+ setTimeout(() => URL.revokeObjectURL(url), 1e3);
1292
+ };
1293
+ return (0, import_react8.createElement)(
1294
+ "section",
1295
+ { className: "gw-log" },
1296
+ (0, import_react8.createElement)(
1297
+ "div",
1298
+ { className: "gw-log-head" },
1299
+ (0, import_react8.createElement)(I.terminal, { size: 13 }),
1300
+ (0, import_react8.createElement)("span", { className: "gw-mono" }, `${job.name} \xB7 #${job.id}`),
1301
+ (0, import_react8.createElement)("span", { className: "gw-top-spacer" }),
1302
+ (0, import_react8.createElement)(Button, { kind: "ghost", small: true, onClick: download, disabled: !data }, t("download")),
1303
+ job.web_url && job.web_url !== "#" ? (0, import_react8.createElement)(
1304
+ "a",
1305
+ { className: "gw-btn is-ghost is-sm", href: job.web_url, target: "_blank", rel: "noreferrer noopener" },
1306
+ t("openInGitLab"),
1307
+ (0, import_react8.createElement)(I.external, { size: 12 })
1308
+ ) : null,
1309
+ (0, import_react8.createElement)(Button, { kind: "ghost", small: true, onClick: onClose }, t("hideLog"))
1310
+ ),
1311
+ (0, import_react8.createElement)(ErrorNote, { error, onRetry: reload }),
1312
+ loading ? (0, import_react8.createElement)(Spinner) : null,
1313
+ data ? (0, import_react8.createElement)(
1314
+ "div",
1315
+ { className: "gw-log-fill" },
1316
+ data.truncated ? (0, import_react8.createElement)("div", { className: "gw-log-note" }, t("traceTruncated")) : null,
1317
+ (0, import_react8.createElement)("pre", { className: "gw-log-body" }, data.content)
1318
+ ) : null
1319
+ );
1320
+ }
1321
+ function PipelineDetail({ instanceId, projectPath, pipelineId }) {
1322
+ const [traceJob, setTraceJob] = (0, import_react8.useState)(null);
1323
+ const [busy, setBusy] = (0, import_react8.useState)("");
1324
+ const [actionError, setActionError] = (0, import_react8.useState)(null);
1325
+ (0, import_react8.useEffect)(() => {
1326
+ setTraceJob(null);
1327
+ setActionError(null);
1328
+ }, [pipelineId]);
1329
+ const { data, error, loading, reload } = useAsync(
1330
+ () => api("pipeline", { query: { id: instanceId, path: projectPath, pipelineId } }),
1331
+ [instanceId, projectPath, pipelineId]
1332
+ );
1333
+ const pipeline = data?.pipeline;
1334
+ const jobs = data?.jobs ?? [];
1335
+ const stages = (0, import_react8.useMemo)(() => stagesOf(jobs), [jobs]);
1336
+ usePolling(reload, isActivePipelineStatus(pipeline?.status), 5e3);
1337
+ const act = async (kind, job) => {
1338
+ setBusy(kind + (job ? job.id : pipelineId));
1339
+ setActionError(null);
1340
+ try {
1341
+ if (kind === "retry-pipeline") await api("pipeline/retry", { method: "POST", query: { id: instanceId }, body: { path: projectPath, pipelineId } });
1342
+ if (kind === "cancel-pipeline") await api("pipeline/cancel", { method: "POST", query: { id: instanceId }, body: { path: projectPath, pipelineId } });
1343
+ if (kind === "retry-job") await api("job/retry", { method: "POST", query: { id: instanceId }, body: { path: projectPath, jobId: job.id } });
1344
+ if (kind === "cancel-job") await api("job/cancel", { method: "POST", query: { id: instanceId }, body: { path: projectPath, jobId: job.id } });
1345
+ if (kind === "play-job") await api("job/play", { method: "POST", query: { id: instanceId }, body: { path: projectPath, jobId: job.id } });
1346
+ reload();
1347
+ } catch (failure) {
1348
+ setActionError(failure);
1349
+ } finally {
1350
+ setBusy("");
1351
+ }
1352
+ };
1353
+ return (0, import_react8.createElement)(
1354
+ "div",
1355
+ { className: "gw-detail-pane" },
1356
+ (0, import_react8.createElement)(
1357
+ "div",
1358
+ { className: "gw-detail-head" },
1359
+ (0, import_react8.createElement)("div", { className: "gw-detail-title" }, (0, import_react8.createElement)("h2", null, `#${pipelineId}`), pipeline ? (0, import_react8.createElement)(Status, { status: pipeline.status }) : null),
1360
+ (0, import_react8.createElement)(
1361
+ "div",
1362
+ { className: "gw-detail-actions" },
1363
+ pipeline && ["failed", "success", "canceled"].includes(pipeline.status) ? (0, import_react8.createElement)(Button, { kind: "ghost", small: true, onClick: () => act("retry-pipeline"), disabled: Boolean(busy) }, (0, import_react8.createElement)(I.refresh, { size: 13 }), t("retryPipeline")) : null,
1364
+ pipeline && ["running", "pending"].includes(pipeline.status) ? (0, import_react8.createElement)(Button, { kind: "ghost", small: true, onClick: () => act("cancel-pipeline"), disabled: Boolean(busy) }, (0, import_react8.createElement)(I.stop, { size: 13 }), t("cancelPipeline")) : null,
1365
+ pipeline?.web_url ? (0, import_react8.createElement)("a", { className: "gw-btn is-ghost is-sm", href: pipeline.web_url, target: "_blank", rel: "noreferrer noopener" }, t("openInGitLab"), (0, import_react8.createElement)(I.external, { size: 12 })) : null
1366
+ )
1367
+ ),
1368
+ (0, import_react8.createElement)(ErrorNote, { error, onRetry: reload }),
1369
+ actionError ? (0, import_react8.createElement)(ErrorNote, { error: actionError }) : null,
1370
+ loading && !pipeline ? (0, import_react8.createElement)(Spinner) : null,
1371
+ pipeline ? (0, import_react8.createElement)(MetaGrid, {
1372
+ items: [
1373
+ [t("commit"), (0, import_react8.createElement)("span", { className: "gw-mono" }, shortSha(pipeline.sha))],
1374
+ [t("branch"), (0, import_react8.createElement)("span", { className: "gw-mono" }, pipeline.ref || "\u2014")],
1375
+ [t("source"), pipeline.source || "\u2014"],
1376
+ [t("created"), relTime(pipeline.created_at)],
1377
+ [t("duration"), pipelineDuration(pipeline)]
1378
+ ]
1379
+ }) : null,
1380
+ stages.length > 0 ? (0, import_react8.createElement)(
1381
+ "div",
1382
+ { className: "gw-timeline", "aria-label": t("stage") },
1383
+ stages.map((group, index) => [
1384
+ (0, import_react8.createElement)(
1385
+ "div",
1386
+ { key: group.stage, className: `gw-stage is-${group.tone}` },
1387
+ (0, import_react8.createElement)("span", { className: "gw-stage-dot" }),
1388
+ (0, import_react8.createElement)("span", { className: "gw-stage-name" }, group.stage),
1389
+ (0, import_react8.createElement)("span", { className: "gw-stage-meta" }, group.meta)
1390
+ ),
1391
+ index < stages.length - 1 ? (0, import_react8.createElement)("span", { key: `${group.stage}-line`, className: `gw-stage-line${group.tone === "success" ? " is-done" : ""}` }) : null
1392
+ ])
1393
+ ) : null,
1394
+ jobs.length > 0 ? (0, import_react8.createElement)(
1395
+ "div",
1396
+ { className: "gw-jobs" },
1397
+ jobs.map(
1398
+ (job) => (0, import_react8.createElement)(
1399
+ "div",
1400
+ { key: job.id, className: "gw-job" },
1401
+ (0, import_react8.createElement)(Status, { status: job.status }),
1402
+ (0, import_react8.createElement)("span", { className: "gw-job-name" }, job.name),
1403
+ (0, import_react8.createElement)("span", { className: "gw-job-stage" }, `${job.stage || "default"} \xB7 #${job.id}`),
1404
+ (0, import_react8.createElement)("span", { className: "gw-job-dur" }, fmtDuration(job.duration)),
1405
+ (0, import_react8.createElement)(
1406
+ "span",
1407
+ { className: "gw-job-actions" },
1408
+ (0, import_react8.createElement)(Button, { kind: "ghost", small: true, onClick: () => setTraceJob(traceJob?.id === job.id ? null : job) }, (0, import_react8.createElement)(I.terminal, { size: 12 }), t("log")),
1409
+ ["failed", "canceled", "success", "skipped"].includes(job.status) ? (0, import_react8.createElement)(Button, { kind: "ghost", small: true, onClick: () => act("retry-job", job), disabled: Boolean(busy) }, (0, import_react8.createElement)(I.refresh, { size: 12 }), t("retryJob")) : null,
1410
+ ["running", "pending"].includes(job.status) ? (0, import_react8.createElement)(Button, { kind: "ghost", small: true, onClick: () => act("cancel-job", job), disabled: Boolean(busy) }, (0, import_react8.createElement)(I.stop, { size: 12 }), t("cancelJob")) : null,
1411
+ job.status === "manual" ? (0, import_react8.createElement)(Button, { kind: "ghost", small: true, onClick: () => act("play-job", job), disabled: Boolean(busy) }, (0, import_react8.createElement)(I.play, { size: 12 }), t("playJob")) : null,
1412
+ job.web_url && job.web_url !== "#" ? (0, import_react8.createElement)(
1413
+ "a",
1414
+ { className: "gw-btn is-ghost is-sm", href: job.web_url, target: "_blank", rel: "noreferrer noopener", title: t("openInGitLab") },
1415
+ (0, import_react8.createElement)(I.external, { size: 12 })
1416
+ ) : null
1417
+ )
1418
+ )
1419
+ )
1420
+ ) : null,
1421
+ traceJob ? (0, import_react8.createElement)(JobLog, { instanceId, projectPath, job: traceJob, onClose: () => setTraceJob(null) }) : null
1422
+ );
1423
+ }
1424
+ function PipelinesTab({ instanceId, projectPath, refName }) {
1425
+ const [status, setStatus] = (0, import_react8.useState)("");
1426
+ const [selected, setSelected] = (0, import_react8.useState)(null);
1427
+ const [allRefs, setAllRefs] = (0, import_react8.useState)(false);
1428
+ (0, import_react8.useEffect)(() => {
1429
+ setAllRefs(false);
1430
+ }, [refName]);
1431
+ const list = useAsync(
1432
+ () => api("pipelines", { query: { id: instanceId, path: projectPath, status, ref: allRefs ? "" : refName } }),
1433
+ [instanceId, projectPath, status, refName, allRefs]
1434
+ );
1435
+ usePolling(
1436
+ list.reload,
1437
+ (list.data?.items ?? []).some((pipeline) => isActivePipelineStatus(pipeline.status)),
1438
+ 8e3
1439
+ );
1440
+ (0, import_react8.useEffect)(() => {
1441
+ const items = list.data?.items ?? [];
1442
+ if (items.length === 0) {
1443
+ if (selected !== null) setSelected(null);
1444
+ return;
1445
+ }
1446
+ if (!selected || !items.some((pipeline) => pipeline.id === selected)) setSelected(items[0].id);
1447
+ }, [list.data, selected]);
1448
+ const filters = [
1449
+ { id: "", label: t("allStatuses") },
1450
+ { id: "failed", label: t("statusFailed") },
1451
+ { id: "running", label: t("statusRunning") }
1452
+ ];
1453
+ return (0, import_react8.createElement)(
1454
+ "div",
1455
+ { className: "gw-split" },
1456
+ (0, import_react8.createElement)(
1457
+ "div",
1458
+ { className: "gw-list-pane" },
1459
+ (0, import_react8.createElement)(
1460
+ "div",
1461
+ { className: "gw-toolbar" },
1462
+ (0, import_react8.createElement)(
1463
+ "div",
1464
+ { className: "gw-seg", role: "tablist", "aria-label": t("pipeline") },
1465
+ filters.map(
1466
+ (filter) => (0, import_react8.createElement)(
1467
+ "button",
1468
+ {
1469
+ key: filter.id || "all",
1470
+ type: "button",
1471
+ role: "tab",
1472
+ "aria-selected": status === filter.id,
1473
+ className: status === filter.id ? "is-active" : "",
1474
+ onClick: () => setStatus(filter.id)
1475
+ },
1476
+ filter.label
1477
+ )
1478
+ )
1479
+ ),
1480
+ (0, import_react8.createElement)("span", { className: "gw-top-spacer" }),
1481
+ (0, import_react8.createElement)(
1482
+ "button",
1483
+ {
1484
+ type: "button",
1485
+ className: `gw-chip${allRefs ? " is-active" : ""}`,
1486
+ onClick: () => setAllRefs((current) => !current),
1487
+ title: allRefs ? t("allBranches") : refName || t("allBranches")
1488
+ },
1489
+ allRefs ? t("allBranches") : refName || t("allBranches")
1490
+ ),
1491
+ (0, import_react8.createElement)(IconButton, { label: t("refresh"), onClick: list.reload }, (0, import_react8.createElement)(I.refresh, { size: 15 }))
1492
+ ),
1493
+ (0, import_react8.createElement)(ErrorNote, { error: list.error, onRetry: list.reload }),
1494
+ (0, import_react8.createElement)(
1495
+ "div",
1496
+ { className: "gw-scroll-y" },
1497
+ list.loading && !list.data ? (0, import_react8.createElement)(Spinner) : null,
1498
+ list.data && list.data.items.length === 0 ? (0, import_react8.createElement)(Empty, {
1499
+ title: t("noPipelines"),
1500
+ hint: refName && !allRefs ? t("noPipelinesBranch", { ref: refName }) : t("noPipelinesHint"),
1501
+ action: refName && !allRefs ? (0, import_react8.createElement)(Button, { kind: "ghost", onClick: () => setAllRefs(true) }, t("allBranches")) : null
1502
+ }) : null,
1503
+ (list.data?.items ?? []).map(
1504
+ (pipeline) => (0, import_react8.createElement)(
1505
+ "button",
1506
+ {
1507
+ key: pipeline.id,
1508
+ type: "button",
1509
+ className: `gw-pipe-row${selected === pipeline.id ? " is-active" : ""}`,
1510
+ onClick: () => setSelected(pipeline.id)
1511
+ },
1512
+ (0, import_react8.createElement)(
1513
+ "span",
1514
+ { className: "gw-pipe-row-top" },
1515
+ (0, import_react8.createElement)(Status, { status: pipeline.status }),
1516
+ (0, import_react8.createElement)("span", { className: "gw-pipe-id" }, `#${pipeline.id}`),
1517
+ (0, import_react8.createElement)("span", { className: "gw-row-time" }, relTime(pipeline.created_at))
1518
+ ),
1519
+ (0, import_react8.createElement)(
1520
+ "span",
1521
+ { className: "gw-pipe-row-bottom" },
1522
+ (0, import_react8.createElement)(I.branch, { size: 11 }),
1523
+ (0, import_react8.createElement)("span", null, pipeline.ref),
1524
+ (0, import_react8.createElement)("span", { className: "gw-mono" }, shortSha(pipeline.sha)),
1525
+ (0, import_react8.createElement)("span", { className: "gw-pipe-duration" }, pipelineDuration(pipeline))
1526
+ )
1527
+ )
1528
+ )
1529
+ )
1530
+ ),
1531
+ selected ? (0, import_react8.createElement)(PipelineDetail, { key: selected, instanceId, projectPath, pipelineId: selected }) : (0, import_react8.createElement)("div", { className: "gw-detail-pane" }, (0, import_react8.createElement)(Empty, { title: t("noSelection") }))
1532
+ );
1533
+ }
1534
+
1535
+ // src/client/views/project.ts
1536
+ var ALL_REFS = "__all__";
1537
+ function ProjectView({ instanceId, projectPath, instanceLabel, onBack }) {
1538
+ const [tab, setTab] = (0, import_react9.useState)("overview");
1539
+ const [cloneOpen, setCloneOpen] = (0, import_react9.useState)(false);
1540
+ const [copied, setCopied] = (0, import_react9.useState)("");
1541
+ const cloneBox = (0, import_react9.useRef)(null);
1542
+ const storageKey = `dsh-gitlab-workbench:branch:${instanceId}:${projectPath}`;
1543
+ const [ref, setRef] = (0, import_react9.useState)(() => {
1544
+ try {
1545
+ const saved = window.localStorage.getItem(storageKey);
1546
+ return saved === ALL_REFS ? "" : saved || "";
1547
+ } catch {
1548
+ return "";
1549
+ }
1550
+ });
1551
+ const restored = (0, import_react9.useRef)(false);
1552
+ const detail = useAsync(
1553
+ () => api("project", { query: { id: instanceId, path: projectPath } }),
1554
+ [instanceId, projectPath]
1555
+ );
1556
+ const branches = useAsync(
1557
+ () => api("branches", { query: { id: instanceId, path: projectPath } }),
1558
+ [instanceId, projectPath]
1559
+ );
1560
+ const tags = useAsync(
1561
+ () => api("tags", { query: { id: instanceId, path: projectPath } }),
1562
+ [instanceId, projectPath]
1563
+ );
1564
+ const project = detail.data?.project;
1565
+ const namespace = projectPath.includes("/") ? projectPath.slice(0, projectPath.lastIndexOf("/")) : instanceLabel;
1566
+ (0, import_react9.useEffect)(() => {
1567
+ if (!project || restored.current) return;
1568
+ restored.current = true;
1569
+ let saved = null;
1570
+ try {
1571
+ saved = window.localStorage.getItem(storageKey);
1572
+ } catch {
1573
+ saved = null;
1574
+ }
1575
+ if (saved === null) setRef(project.default_branch || "");
1576
+ else setRef(saved === ALL_REFS ? "" : saved);
1577
+ }, [project, storageKey]);
1578
+ (0, import_react9.useEffect)(() => {
1579
+ const names = [
1580
+ ...(branches.data?.items ?? []).map((branch) => branch.name),
1581
+ ...(tags.data?.items ?? []).map((tag) => tag.name)
1582
+ ];
1583
+ if (names.length === 0) return;
1584
+ setRef((current) => current && !names.includes(current) ? project?.default_branch || "" : current);
1585
+ }, [branches.data, tags.data, project?.default_branch]);
1586
+ (0, import_react9.useEffect)(() => {
1587
+ if (!restored.current) return;
1588
+ try {
1589
+ window.localStorage.setItem(storageKey, ref === "" ? ALL_REFS : ref);
1590
+ } catch {
1591
+ }
1592
+ }, [storageKey, ref]);
1593
+ (0, import_react9.useEffect)(() => {
1594
+ if (!cloneOpen) return void 0;
1595
+ const onDocument = (event) => {
1596
+ if (cloneBox.current && !cloneBox.current.contains(event.target)) setCloneOpen(false);
1597
+ };
1598
+ document.addEventListener("mousedown", onDocument);
1599
+ return () => document.removeEventListener("mousedown", onDocument);
1600
+ }, [cloneOpen]);
1601
+ const copyCloneUrl = async (label, url) => {
1602
+ try {
1603
+ await navigator.clipboard.writeText(url);
1604
+ } catch {
1605
+ const area = document.createElement("textarea");
1606
+ area.value = url;
1607
+ document.body.appendChild(area);
1608
+ area.select();
1609
+ try {
1610
+ document.execCommand("copy");
1611
+ } catch {
1612
+ }
1613
+ area.remove();
1614
+ }
1615
+ setCopied(label);
1616
+ setTimeout(() => setCopied(""), 1500);
1617
+ };
1618
+ const refOptions = [
1619
+ { name: "", kind: "all" },
1620
+ ...(branches.data?.items ?? []).map((branch) => ({ name: branch.name, kind: "branch" })),
1621
+ ...(tags.data?.items ?? []).map((tag) => ({ name: tag.name, kind: "tag" }))
1622
+ ];
1623
+ if (ref && !refOptions.some((option) => option.name === ref)) refOptions.splice(1, 0, { name: ref, kind: "branch" });
1624
+ const tabs = [
1625
+ { id: "overview", label: t("overview") },
1626
+ { id: "pipelines", label: t("pipeline") },
1627
+ { id: "mrs", label: t("mergeRequests") },
1628
+ { id: "issues", label: t("issues") },
1629
+ { id: "files", label: t("files") }
1630
+ ];
1631
+ return (0, import_react9.createElement)(
1632
+ "main",
1633
+ { className: "gw-main" },
1634
+ (0, import_react9.createElement)(
1635
+ "div",
1636
+ { className: "gw-head" },
1637
+ (0, import_react9.createElement)(
1638
+ "div",
1639
+ { className: "gw-crumbs" },
1640
+ (0, import_react9.createElement)("button", { type: "button", className: "gw-crumb", onClick: onBack }, instanceLabel),
1641
+ (0, import_react9.createElement)("span", null, "/"),
1642
+ (0, import_react9.createElement)("span", null, namespace)
1643
+ ),
1644
+ (0, import_react9.createElement)(
1645
+ "div",
1646
+ { className: "gw-head-row" },
1647
+ (0, import_react9.createElement)(
1648
+ "div",
1649
+ { className: "gw-head-text" },
1650
+ (0, import_react9.createElement)(
1651
+ "div",
1652
+ { className: "gw-title-row" },
1653
+ (0, import_react9.createElement)("h1", { className: "gw-h1" }, project?.name || projectPath.split("/").pop()),
1654
+ project?.visibility === "private" ? (0, import_react9.createElement)("span", { className: "gw-chip" }, (0, import_react9.createElement)(I.lock, { size: 11 }), t("private")) : null,
1655
+ refOptions.length > 1 ? (0, import_react9.createElement)(BranchPicker, {
1656
+ value: ref,
1657
+ options: refOptions,
1658
+ onChange: (name) => setRef(name),
1659
+ label: t("branchLabel")
1660
+ }) : project?.default_branch ? (0, import_react9.createElement)("span", { className: "gw-chip mono" }, project.default_branch) : null
1661
+ ),
1662
+ project?.description ? (0, import_react9.createElement)("p", { className: "gw-desc" }, project.description) : null
1663
+ ),
1664
+ (0, import_react9.createElement)(
1665
+ "div",
1666
+ { className: "gw-head-actions" },
1667
+ project?.http_url_to_repo || project?.ssh_url_to_repo ? (0, import_react9.createElement)(
1668
+ "div",
1669
+ { className: "gw-clone", ref: cloneBox },
1670
+ (0, import_react9.createElement)(
1671
+ Button,
1672
+ { kind: "ghost", small: true, onClick: () => setCloneOpen((current) => !current), title: t("clone") },
1673
+ (0, import_react9.createElement)(I.copy, { size: 13 }),
1674
+ t("clone")
1675
+ ),
1676
+ cloneOpen ? (0, import_react9.createElement)(
1677
+ "div",
1678
+ { className: "gw-clone-pop" },
1679
+ [["HTTPS", project.http_url_to_repo], ["SSH", project.ssh_url_to_repo]].map(
1680
+ ([label, url]) => url ? (0, import_react9.createElement)(
1681
+ "div",
1682
+ { key: label, className: "gw-clone-row" },
1683
+ (0, import_react9.createElement)("span", { className: "gw-clone-label" }, label),
1684
+ (0, import_react9.createElement)("input", {
1685
+ className: "gw-input gw-clone-url",
1686
+ readOnly: true,
1687
+ value: url,
1688
+ onFocus: (event) => event.target.select(),
1689
+ "aria-label": `${label} ${t("clone")}`
1690
+ }),
1691
+ (0, import_react9.createElement)(Button, { kind: "ghost", small: true, onClick: () => copyCloneUrl(label, url) }, copied === label ? t("copied") : t("copy"))
1692
+ ) : null
1693
+ )
1694
+ ) : null
1695
+ ) : null,
1696
+ project?.web_url ? (0, import_react9.createElement)("a", { className: "gw-btn is-ghost", href: project.web_url, target: "_blank", rel: "noreferrer noopener" }, t("openInGitLab"), (0, import_react9.createElement)(I.external, { size: 13 })) : null,
1697
+ (0, import_react9.createElement)(IconButton, { label: t("refresh"), onClick: detail.reload }, (0, import_react9.createElement)(I.refresh, { size: 16 }))
1698
+ )
1699
+ )
1700
+ ),
1701
+ (0, import_react9.createElement)(
1702
+ "nav",
1703
+ { className: "gw-tabs", "aria-label": t("project") },
1704
+ tabs.map(
1705
+ (item) => (0, import_react9.createElement)(
1706
+ "button",
1707
+ { key: item.id, type: "button", className: `gw-tab${tab === item.id ? " is-active" : ""}`, onClick: () => setTab(item.id) },
1708
+ item.label
1709
+ )
1710
+ )
1711
+ ),
1712
+ (0, import_react9.createElement)(ErrorNote, { error: detail.error, onRetry: detail.reload }),
1713
+ detail.loading && !project ? (0, import_react9.createElement)(Spinner) : null,
1714
+ project ? tab === "overview" ? (0, import_react9.createElement)(OverviewTab, {
1715
+ instanceId,
1716
+ projectPath,
1717
+ project,
1718
+ refName: ref,
1719
+ counts: { openMergeRequests: detail.data?.openMergeRequests },
1720
+ onOpenPipelines: () => setTab("pipelines")
1721
+ }) : tab === "pipelines" ? (0, import_react9.createElement)(PipelinesTab, { instanceId, projectPath, refName: ref }) : tab === "mrs" ? (0, import_react9.createElement)(MergeRequestsTab, { instanceId, projectPath }) : tab === "issues" ? (0, import_react9.createElement)(IssuesTab, { instanceId, projectPath }) : (0, import_react9.createElement)(FilesTab, { key: `${projectPath}:${ref}`, instanceId, projectPath, project, refName: ref }) : null
1722
+ );
1723
+ }
1724
+
1725
+ // src/client/views/settings.ts
1726
+ var import_react10 = require("react");
1727
+ var EMPTY_FORM = { label: "", endpoint: "", token: "", verifyTls: true, caPem: "" };
1728
+ function tokenPageUrl(endpoint) {
1729
+ const text = endpoint.trim();
1730
+ if (text === "") return null;
1731
+ let url;
1732
+ try {
1733
+ url = new URL(text);
1734
+ } catch {
1735
+ return null;
1736
+ }
1737
+ if (url.protocol !== "https:" && url.protocol !== "http:") return null;
1738
+ const base = `${url.origin}${url.pathname}`.replace(/\/+$/, "").replace(/\/api\/v4$/i, "");
1739
+ return `${base}/-/user_settings/personal_access_tokens`;
1740
+ }
1741
+ function SettingsView({ instances, reload, onBack, initialInstanceId, startNew }) {
1742
+ const [selectedId, setSelectedId] = (0, import_react10.useState)(initialInstanceId || instances[0]?.id || "");
1743
+ const [previousId, setPreviousId] = (0, import_react10.useState)(initialInstanceId || instances[0]?.id || "");
1744
+ const [draft, setDraft] = (0, import_react10.useState)(Boolean(startNew) || instances.length === 0);
1745
+ const [form, setForm] = (0, import_react10.useState)(EMPTY_FORM);
1746
+ const [busy, setBusy] = (0, import_react10.useState)("");
1747
+ const [error, setError] = (0, import_react10.useState)(null);
1748
+ const [tokenOpen, setTokenOpen] = (0, import_react10.useState)(false);
1749
+ const selected = instances.find((instance) => instance.id === selectedId) ?? null;
1750
+ const recoverIfGone = (failure) => {
1751
+ if (failure?.code !== "unknown_instance") return false;
1752
+ setDraft(true);
1753
+ setSelectedId("");
1754
+ setError(Object.assign(new Error(t("instanceGone")), { code: "instance_gone" }));
1755
+ reload();
1756
+ return true;
1757
+ };
1758
+ (0, import_react10.useEffect)(() => {
1759
+ if (!selected && instances.length > 0 && !draft) setSelectedId(instances[0].id);
1760
+ }, [instances, selected, draft]);
1761
+ (0, import_react10.useEffect)(() => {
1762
+ if (instances.length === 0 && !draft) {
1763
+ setDraft(true);
1764
+ setForm(EMPTY_FORM);
1765
+ setSelectedId("");
1766
+ }
1767
+ }, [instances.length, draft]);
1768
+ (0, import_react10.useEffect)(() => {
1769
+ if (!selected) return;
1770
+ setForm({
1771
+ label: selected.label || "",
1772
+ endpoint: selected.endpoint,
1773
+ token: "",
1774
+ verifyTls: selected.verifyTls !== false,
1775
+ caPem: ""
1776
+ });
1777
+ setTokenOpen(!selected.hasToken);
1778
+ }, [selectedId, selected?.endpoint, selected?.label, selected?.verifyTls]);
1779
+ const startDraft = () => {
1780
+ setPreviousId(selectedId);
1781
+ setDraft(true);
1782
+ setForm(EMPTY_FORM);
1783
+ setTokenOpen(true);
1784
+ setSelectedId("");
1785
+ setError(null);
1786
+ };
1787
+ const cancelDraft = () => {
1788
+ setDraft(false);
1789
+ setError(null);
1790
+ const fallback = instances.some((instance) => instance.id === previousId) ? previousId : instances[0]?.id ?? "";
1791
+ if (fallback === "") {
1792
+ setSelectedId("");
1793
+ onBack();
1794
+ return;
1795
+ }
1796
+ setSelectedId(fallback);
1797
+ };
1798
+ const saveDraft = async () => {
1799
+ setError(null);
1800
+ if (form.token.trim() === "") {
1801
+ setError(Object.assign(new Error(t("tokenRequired")), { code: "token_required" }));
1802
+ return;
1803
+ }
1804
+ setBusy("save");
1805
+ let created = null;
1806
+ try {
1807
+ created = await api("instances/add", {
1808
+ method: "POST",
1809
+ body: { label: form.label, endpoint: form.endpoint, verifyTls: form.verifyTls, caPem: form.caPem }
1810
+ });
1811
+ await api("instances/token", { method: "POST", body: { id: created.id, token: form.token.trim() } });
1812
+ setDraft(false);
1813
+ setSelectedId(created.id);
1814
+ reload();
1815
+ onBack();
1816
+ } catch (failure) {
1817
+ if (created) {
1818
+ try {
1819
+ await api("instances/remove", { method: "POST", body: { id: created.id } });
1820
+ } catch {
1821
+ }
1822
+ reload();
1823
+ }
1824
+ setError(failure);
1825
+ } finally {
1826
+ setBusy("");
1827
+ }
1828
+ };
1829
+ const saveToken = async () => {
1830
+ if (!selected) return;
1831
+ setBusy("token");
1832
+ setError(null);
1833
+ try {
1834
+ await api("instances/token", { method: "POST", body: { id: selected.id, token: form.token.trim() } });
1835
+ setForm((current) => ({ ...current, token: "" }));
1836
+ setTokenOpen(false);
1837
+ reload();
1838
+ } catch (failure) {
1839
+ if (!recoverIfGone(failure)) setError(failure);
1840
+ } finally {
1841
+ setBusy("");
1842
+ }
1843
+ };
1844
+ const saveChanges = async () => {
1845
+ if (!selected) return;
1846
+ setBusy("save");
1847
+ setError(null);
1848
+ try {
1849
+ await api("instances/update", {
1850
+ method: "POST",
1851
+ body: { id: selected.id, label: form.label, endpoint: form.endpoint, verifyTls: form.verifyTls, caPem: form.caPem }
1852
+ });
1853
+ reload();
1854
+ } catch (failure) {
1855
+ if (!recoverIfGone(failure)) setError(failure);
1856
+ } finally {
1857
+ setBusy("");
1858
+ }
1859
+ };
1860
+ const testConnection = async () => {
1861
+ if (!selected) return;
1862
+ setBusy("test");
1863
+ setError(null);
1864
+ try {
1865
+ await api("instances/test", { method: "POST", body: { id: selected.id } });
1866
+ reload();
1867
+ } catch (failure) {
1868
+ if (!recoverIfGone(failure)) setError(failure);
1869
+ } finally {
1870
+ setBusy("");
1871
+ }
1872
+ };
1873
+ const removeInstance = async () => {
1874
+ if (!selected) return;
1875
+ if (!window.confirm(t("removeConfirm"))) return;
1876
+ setBusy("remove");
1877
+ setError(null);
1878
+ try {
1879
+ await api("instances/remove", { method: "POST", body: { id: selected.id } });
1880
+ setSelectedId("");
1881
+ reload();
1882
+ } catch (failure) {
1883
+ if (!recoverIfGone(failure)) setError(failure);
1884
+ } finally {
1885
+ setBusy("");
1886
+ }
1887
+ };
1888
+ const title = draft ? t("newInstance") : selected ? selected.label : t("addInstance");
1889
+ const tokenUrl = tokenPageUrl(form.endpoint);
1890
+ return (0, import_react10.createElement)(
1891
+ "div",
1892
+ { className: "gw-settings" },
1893
+ (0, import_react10.createElement)(
1894
+ "aside",
1895
+ { className: "gw-set-rail" },
1896
+ (0, import_react10.createElement)("div", { className: "gw-rail-head" }, (0, import_react10.createElement)("span", null, t("settings")), (0, import_react10.createElement)("span", { className: "gw-count" }, String(instances.length))),
1897
+ (0, import_react10.createElement)(
1898
+ "div",
1899
+ { className: "gw-set-list" },
1900
+ instances.map(
1901
+ (instance) => (0, import_react10.createElement)(
1902
+ "button",
1903
+ {
1904
+ key: instance.id,
1905
+ type: "button",
1906
+ className: `gw-inst${!draft && instance.id === selectedId ? " is-active" : ""}`,
1907
+ onClick: () => {
1908
+ setDraft(false);
1909
+ setSelectedId(instance.id);
1910
+ setError(null);
1911
+ }
1912
+ },
1913
+ (0, import_react10.createElement)("span", { className: "gw-inst-name" }, (0, import_react10.createElement)(Dot, { tone: instance.status?.ok === false ? "bad" : instance.hasToken ? "ok" : "idle" }), instance.label || instance.endpoint),
1914
+ (0, import_react10.createElement)("span", { className: "gw-inst-url" }, instance.endpoint)
1915
+ )
1916
+ )
1917
+ ),
1918
+ (0, import_react10.createElement)("div", { className: "gw-set-foot" }, (0, import_react10.createElement)(Button, { onClick: startDraft }, (0, import_react10.createElement)(I.plus, { size: 13 }), t("addInstance")))
1919
+ ),
1920
+ (0, import_react10.createElement)(
1921
+ "main",
1922
+ { className: "gw-set-main" },
1923
+ (0, import_react10.createElement)(
1924
+ "button",
1925
+ { type: "button", className: "gw-btn is-ghost", onClick: onBack, style: { marginBottom: 10 } },
1926
+ (0, import_react10.createElement)(I.chevron, { size: 13, style: { transform: "rotate(180deg)" } }),
1927
+ t("backToWorkbench")
1928
+ ),
1929
+ (0, import_react10.createElement)(
1930
+ "div",
1931
+ { className: "gw-set-title" },
1932
+ (0, import_react10.createElement)("h2", null, title),
1933
+ !draft && selected ? (0, import_react10.createElement)(Status, {
1934
+ status: selected.status?.ok ? "success" : "idle",
1935
+ label: selected.status?.ok ? t("connected") : selected.hasToken ? t("connected") : t("tokenMissing")
1936
+ }) : null,
1937
+ !draft && selected?.status?.version ? (0, import_react10.createElement)("span", { className: "gw-chip mono" }, t("versionLabel", { version: selected.status.version })) : null
1938
+ ),
1939
+ !draft && selected ? (0, import_react10.createElement)(
1940
+ "p",
1941
+ { className: "gw-set-sub" },
1942
+ selected.endpoint.replace(/^https?:\/\//, ""),
1943
+ selected.status?.user?.username ? ` \xB7 ${t("loggedInAs", { name: selected.status.user.username })}` : ""
1944
+ ) : null,
1945
+ (0, import_react10.createElement)(ErrorNote, { error }),
1946
+ (0, import_react10.createElement)(
1947
+ "form",
1948
+ { className: "gw-form", onSubmit: (event) => event.preventDefault() },
1949
+ (0, import_react10.createElement)(
1950
+ "div",
1951
+ { className: "gw-field" },
1952
+ (0, import_react10.createElement)("label", { htmlFor: "gw-name" }, t("instanceLabel")),
1953
+ (0, import_react10.createElement)("input", { id: "gw-name", className: "gw-input", value: form.label, onChange: (event) => setForm({ ...form, label: event.target.value }), placeholder: "corp" }),
1954
+ (0, import_react10.createElement)("span", { className: "hint" }, t("instanceLabelHint"))
1955
+ ),
1956
+ (0, import_react10.createElement)(
1957
+ "div",
1958
+ { className: "gw-field" },
1959
+ (0, import_react10.createElement)("label", { htmlFor: "gw-url" }, t("instanceUrl")),
1960
+ (0, import_react10.createElement)("input", { id: "gw-url", className: "gw-input", value: form.endpoint, onChange: (event) => setForm({ ...form, endpoint: event.target.value }), placeholder: "https://gitlab.example.com", inputMode: "url" }),
1961
+ (0, import_react10.createElement)("span", { className: "hint" }, t("instanceUrlHint"))
1962
+ ),
1963
+ (0, import_react10.createElement)(
1964
+ "div",
1965
+ { className: "gw-field" },
1966
+ (0, import_react10.createElement)(
1967
+ "div",
1968
+ { className: "gw-field-label-row" },
1969
+ (0, import_react10.createElement)("label", { htmlFor: "gw-token" }, t("token")),
1970
+ tokenUrl ? (0, import_react10.createElement)(
1971
+ "a",
1972
+ { className: "gw-inline-link", href: tokenUrl, target: "_blank", rel: "noreferrer noopener" },
1973
+ t("tokenLink"),
1974
+ (0, import_react10.createElement)(I.external, { size: 11 })
1975
+ ) : null
1976
+ ),
1977
+ tokenOpen || draft ? (0, import_react10.createElement)(
1978
+ "div",
1979
+ { className: "gw-inline" },
1980
+ (0, import_react10.createElement)("input", {
1981
+ id: "gw-token",
1982
+ className: "gw-input",
1983
+ type: "password",
1984
+ value: form.token,
1985
+ onChange: (event) => setForm({ ...form, token: event.target.value }),
1986
+ placeholder: "glpat-\u2026",
1987
+ autoComplete: "off",
1988
+ autoFocus: true
1989
+ }),
1990
+ (0, import_react10.createElement)(Button, { onClick: draft ? saveDraft : saveToken, disabled: Boolean(busy) || form.token.trim() === "" }, busy ? t("saving") : t("saveToken"))
1991
+ ) : (0, import_react10.createElement)(
1992
+ "div",
1993
+ { className: "gw-inline" },
1994
+ (0, import_react10.createElement)("input", { id: "gw-token", className: "gw-input", value: selected?.hasToken ? "glpat-\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" : "", readOnly: true, placeholder: t("tokenMissing") }),
1995
+ (0, import_react10.createElement)(Button, { onClick: () => setTokenOpen(true) }, t("replaceToken"))
1996
+ ),
1997
+ (0, import_react10.createElement)("span", { className: "hint" }, t("tokenHint"))
1998
+ ),
1999
+ (0, import_react10.createElement)(
2000
+ "div",
2001
+ { className: "gw-switch" },
2002
+ (0, import_react10.createElement)(
2003
+ "div",
2004
+ { className: "gw-switch-text" },
2005
+ (0, import_react10.createElement)("div", { className: "gw-switch-title" }, t("verifyTls")),
2006
+ (0, import_react10.createElement)("div", { className: "gw-switch-hint" }, t("verifyTlsHint"))
2007
+ ),
2008
+ (0, import_react10.createElement)("button", {
2009
+ type: "button",
2010
+ role: "switch",
2011
+ "aria-checked": form.verifyTls,
2012
+ "aria-label": t("verifyTls"),
2013
+ className: `gw-toggle${form.verifyTls ? " is-on" : ""}`,
2014
+ onClick: () => setForm({ ...form, verifyTls: !form.verifyTls })
2015
+ })
2016
+ ),
2017
+ (0, import_react10.createElement)(
2018
+ "div",
2019
+ { className: "gw-field" },
2020
+ (0, import_react10.createElement)("label", { htmlFor: "gw-ca" }, t("ca")),
2021
+ (0, import_react10.createElement)("input", { id: "gw-ca", className: "gw-input", value: form.caPem, onChange: (event) => setForm({ ...form, caPem: event.target.value }), placeholder: "-----BEGIN CERTIFICATE-----" }),
2022
+ (0, import_react10.createElement)("span", { className: "hint" }, t("caHint"))
2023
+ ),
2024
+ (0, import_react10.createElement)(
2025
+ "div",
2026
+ { className: "gw-actions" },
2027
+ draft ? [
2028
+ (0, import_react10.createElement)(Button, { key: "save", kind: "primary", onClick: saveDraft, disabled: Boolean(busy) || form.endpoint.trim() === "" }, busy ? t("saving") : t("addInstance")),
2029
+ (0, import_react10.createElement)(Button, { key: "cancel", kind: "ghost", onClick: cancelDraft, disabled: Boolean(busy) }, t("cancel"))
2030
+ ] : [
2031
+ (0, import_react10.createElement)(Button, { key: "test", onClick: testConnection, disabled: Boolean(busy) || !selected?.hasToken }, busy === "test" ? t("testing") : t("test")),
2032
+ (0, import_react10.createElement)(Button, { key: "save", kind: "primary", onClick: saveChanges, disabled: Boolean(busy) || !selected }, busy === "save" ? t("saving") : t("saveChanges")),
2033
+ (0, import_react10.createElement)("span", { key: "end", className: "end" }),
2034
+ (0, import_react10.createElement)(Button, { key: "remove", kind: "danger", onClick: removeInstance, disabled: Boolean(busy) }, (0, import_react10.createElement)(I.trash, { size: 13 }), t("removeInstance"))
2035
+ ]
2036
+ )
2037
+ ),
2038
+ (0, import_react10.createElement)("div", { className: "gw-note" }, (0, import_react10.createElement)("b", null, `${t("aboutInstancesTitle")}\uFF1A`), t("aboutInstances"))
2039
+ )
2040
+ );
2041
+ }
2042
+
2043
+ // src/client/views/panel.ts
2044
+ function PanelPage({ appCss }) {
2045
+ const [ui, setUi] = (0, import_react11.useState)(readUiState);
2046
+ const [view, setView] = (0, import_react11.useState)("main");
2047
+ const [refreshKey, setRefreshKey] = (0, import_react11.useState)(0);
2048
+ const [settingsTarget, setSettingsTarget] = (0, import_react11.useState)("");
2049
+ const [settingsDraft, setSettingsDraft] = (0, import_react11.useState)(false);
2050
+ const [query, setQuery] = (0, import_react11.useState)("");
2051
+ const instancesState = useAsync(() => api("instances"), [refreshKey]);
2052
+ const instances = instancesState.data?.items ?? [];
2053
+ const selected = instances.find((instance) => instance.id === ui.instanceId) ?? instances[0] ?? null;
2054
+ const instanceId = selected ? selected.id : "";
2055
+ const hasToken = Boolean(selected?.hasToken);
2056
+ (0, import_react11.useEffect)(() => {
2057
+ if (!instancesState.data) return;
2058
+ if (selected && ui.instanceId !== selected.id) {
2059
+ const next = { ...ui, instanceId: selected.id };
2060
+ setUi(next);
2061
+ writeUiState(next);
2062
+ }
2063
+ }, [instancesState.data, selected?.id]);
2064
+ const projects = useAsync(
2065
+ () => instanceId && hasToken ? api("projects", { query: { id: instanceId, search: query } }) : Promise.resolve({ items: [], total: 0, page: 1, nextPage: null }),
2066
+ [instanceId, query, refreshKey, hasToken]
2067
+ );
2068
+ const openSettings = (draft = false) => {
2069
+ setSettingsTarget("");
2070
+ setSettingsDraft(draft);
2071
+ setView("settings");
2072
+ instancesState.reload();
2073
+ };
2074
+ const selectInstance = (id) => {
2075
+ const next = { instanceId: id, project: "" };
2076
+ setUi(next);
2077
+ writeUiState(next);
2078
+ setQuery("");
2079
+ };
2080
+ const openProject = (path) => {
2081
+ const next = { ...ui, project: path };
2082
+ setUi(next);
2083
+ writeUiState(next);
2084
+ };
2085
+ const backToProjects = () => {
2086
+ const next = { ...ui, project: "" };
2087
+ setUi(next);
2088
+ writeUiState(next);
2089
+ };
2090
+ const refresh = () => {
2091
+ setRefreshKey((value) => value + 1);
2092
+ instancesState.reload();
2093
+ projects.reload();
2094
+ };
2095
+ const onSearch = (value) => {
2096
+ setQuery(value);
2097
+ if (value !== "" && ui.project) backToProjects();
2098
+ };
2099
+ return (0, import_react11.createElement)(
2100
+ "div",
2101
+ { className: "gw-app" },
2102
+ (0, import_react11.createElement)("style", { dangerouslySetInnerHTML: { __html: appCss } }),
2103
+ (0, import_react11.createElement)(
2104
+ "header",
2105
+ { className: "gw-top" },
2106
+ (0, import_react11.createElement)(
2107
+ "div",
2108
+ { className: "gw-brand" },
2109
+ (0, import_react11.createElement)("span", { className: "gw-logo" }, (0, import_react11.createElement)(I.logo)),
2110
+ (0, import_react11.createElement)("span", { className: "gw-word" }, t("title")),
2111
+ (0, import_react11.createElement)("span", { className: "gw-word-sub" }, t("subtitle"))
2112
+ ),
2113
+ instances.length > 0 && view === "main" ? (0, import_react11.createElement)(InstancePicker, { instances, value: instanceId, onChange: selectInstance }) : null,
2114
+ view === "main" ? (0, import_react11.createElement)(
2115
+ "label",
2116
+ { className: "gw-search" },
2117
+ (0, import_react11.createElement)(I.search, { size: 14 }),
2118
+ (0, import_react11.createElement)("input", {
2119
+ value: query,
2120
+ placeholder: t("search"),
2121
+ "aria-label": t("search"),
2122
+ onChange: (event) => onSearch(event.target.value)
2123
+ })
2124
+ ) : null,
2125
+ (0, import_react11.createElement)("span", { className: "gw-top-spacer" }),
2126
+ (0, import_react11.createElement)(
2127
+ "div",
2128
+ { className: "gw-top-actions" },
2129
+ view === "main" ? (0, import_react11.createElement)(IconButton, { label: t("refresh"), onClick: refresh }, (0, import_react11.createElement)(I.refresh, { size: 16 })) : null,
2130
+ (0, import_react11.createElement)(
2131
+ IconButton,
2132
+ {
2133
+ label: t("settings"),
2134
+ onClick: () => {
2135
+ if (view === "settings") setView("main");
2136
+ else openSettings(false);
2137
+ }
2138
+ },
2139
+ (0, import_react11.createElement)(I.settings, { size: 16 })
2140
+ )
2141
+ )
2142
+ ),
2143
+ view === "settings" ? (0, import_react11.createElement)(SettingsView, {
2144
+ instances,
2145
+ initialInstanceId: settingsTarget,
2146
+ startNew: settingsDraft,
2147
+ reload: () => instancesState.reload(),
2148
+ onBack: () => {
2149
+ setView("main");
2150
+ instancesState.reload();
2151
+ }
2152
+ }) : (0, import_react11.createElement)(
2153
+ "div",
2154
+ { className: "gw-shell" },
2155
+ (0, import_react11.createElement)(
2156
+ "aside",
2157
+ { className: "gw-rail" },
2158
+ (0, import_react11.createElement)(
2159
+ "div",
2160
+ { className: "gw-rail-head" },
2161
+ (0, import_react11.createElement)("span", null, t("projects")),
2162
+ (0, import_react11.createElement)("span", { className: "gw-count" }, String(projects.data?.total ?? projects.data?.items?.length ?? 0))
2163
+ ),
2164
+ (0, import_react11.createElement)(
2165
+ "div",
2166
+ { className: "gw-rail-search" },
2167
+ (0, import_react11.createElement)(I.search, { size: 13 }),
2168
+ (0, import_react11.createElement)("input", { value: query, placeholder: t("filter"), "aria-label": t("filter"), onChange: (event) => setQuery(event.target.value) })
2169
+ ),
2170
+ (0, import_react11.createElement)(
2171
+ "div",
2172
+ { className: "gw-projects" },
2173
+ (0, import_react11.createElement)(ErrorNote, { error: projects.error, onRetry: projects.reload }),
2174
+ projects.loading && !projects.data ? (0, import_react11.createElement)(Spinner) : null,
2175
+ (projects.data?.items ?? []).map(
2176
+ (project) => (0, import_react11.createElement)(
2177
+ "button",
2178
+ {
2179
+ key: project.id,
2180
+ type: "button",
2181
+ className: `gw-project${ui.project === project.path_with_namespace ? " is-active" : ""}`,
2182
+ onClick: () => openProject(project.path_with_namespace)
2183
+ },
2184
+ (0, import_react11.createElement)("span", { className: "gw-avatar", style: { "--h": project.id % 360 } }, (project.name || project.path || "?").slice(0, 2).toUpperCase()),
2185
+ (0, import_react11.createElement)(
2186
+ "span",
2187
+ { className: "gw-proj-text" },
2188
+ (0, import_react11.createElement)("span", { className: "gw-proj-name" }, project.name),
2189
+ (0, import_react11.createElement)("span", { className: "gw-proj-ns" }, project.namespace?.path || project.path_with_namespace?.split("/").slice(0, -1).join("/") || "")
2190
+ ),
2191
+ (0, import_react11.createElement)("span", { className: "gw-proj-meta" }, project.last_activity_at ? relTime(project.last_activity_at) : "")
2192
+ )
2193
+ ),
2194
+ projects.data && projects.data.items.length === 0 ? (0, import_react11.createElement)("div", { className: "gw-muted", style: { padding: "10px 12px", fontSize: 12 } }, t("noProjects")) : null
2195
+ ),
2196
+ (0, import_react11.createElement)("div", { className: "gw-rail-foot" }, t("memberOnly")),
2197
+ (0, import_react11.createElement)(
2198
+ "button",
2199
+ { type: "button", className: "gw-rail-action", onClick: () => openSettings(true) },
2200
+ (0, import_react11.createElement)(I.plus, { size: 12 }),
2201
+ t("addInstance")
2202
+ )
2203
+ ),
2204
+ ui.project && selected?.hasToken ? (0, import_react11.createElement)(ProjectView, {
2205
+ key: `${instanceId}:${ui.project}:${refreshKey}`,
2206
+ instanceId,
2207
+ projectPath: ui.project,
2208
+ instanceLabel: selected.label || selected.endpoint,
2209
+ onBack: backToProjects
2210
+ }) : (0, import_react11.createElement)(
2211
+ "main",
2212
+ { className: "gw-main" },
2213
+ (0, import_react11.createElement)(
2214
+ "div",
2215
+ { className: "gw-content" },
2216
+ (0, import_react11.createElement)(ErrorNote, { error: instancesState.error, onRetry: instancesState.reload }),
2217
+ !instancesState.data && instancesState.loading ? (0, import_react11.createElement)(Spinner) : null,
2218
+ instances.length === 0 ? (0, import_react11.createElement)(Empty, {
2219
+ title: t("noInstances"),
2220
+ hint: t("noInstancesHint"),
2221
+ action: (0, import_react11.createElement)(Button, { kind: "primary", onClick: () => openSettings(true) }, t("addInstance"))
2222
+ }) : selected && !selected.hasToken ? (0, import_react11.createElement)(Empty, {
2223
+ title: t("setupTitle"),
2224
+ hint: t("setupHint", { name: selected.label || selected.endpoint }),
2225
+ action: (0, import_react11.createElement)(
2226
+ Button,
2227
+ { kind: "primary", onClick: () => {
2228
+ setSettingsTarget(selected.id);
2229
+ setSettingsDraft(false);
2230
+ setView("settings");
2231
+ } },
2232
+ t("openSettings")
2233
+ )
2234
+ }) : (0, import_react11.createElement)(Empty, { title: t("noProject"), hint: t("noProjectHint") })
2235
+ )
2236
+ )
2237
+ )
2238
+ );
2239
+ }
2240
+
2241
+ // src/client/plugin.ts
2242
+ var PANEL_ID = "gitlab-workbench";
2243
+ function PanelIcon({ size = 18, active = false }) {
2244
+ return (0, import_react12.createElement)(
2245
+ "svg",
2246
+ {
2247
+ viewBox: "0 0 24 24",
2248
+ width: size,
2249
+ height: size,
2250
+ fill: "none",
2251
+ stroke: "currentColor",
2252
+ strokeWidth: 1.7,
2253
+ strokeLinecap: "round",
2254
+ strokeLinejoin: "round",
2255
+ "aria-hidden": true,
2256
+ focusable: false,
2257
+ style: { display: "block", opacity: active ? 1 : 0.86 }
2258
+ },
2259
+ (0, import_react12.createElement)("path", { d: "M6 4v10a4 4 0 0 0 4 4h3" }),
2260
+ (0, import_react12.createElement)("circle", { cx: 6, cy: 4, r: 1.6 }),
2261
+ (0, import_react12.createElement)("circle", { cx: 18, cy: 7, r: 2.2 }),
2262
+ (0, import_react12.createElement)("circle", { cx: 13, cy: 18, r: 2.2 }),
2263
+ (0, import_react12.createElement)("path", { d: "M18 9.2v1.3a3.5 3.5 0 0 1-3.5 3.5H15" })
2264
+ );
2265
+ }
2266
+ var plugin = {
2267
+ name: "gitlab-workbench",
2268
+ inject: ["slots"],
2269
+ apply(ctx) {
2270
+ try {
2271
+ const snapshot = ctx.locale?.getLocale?.() ?? ctx.locale?.getSnapshot?.();
2272
+ setLanguage(snapshot?.id ?? snapshot?.locale ?? snapshot?.localeId);
2273
+ } catch {
2274
+ }
2275
+ const Page = () => (0, import_react12.createElement)(PanelPage, { appCss: app_default });
2276
+ ctx.slots.inject("main", () => ctx.slots.register({ name: "main", key: PANEL_ID }, Page));
2277
+ ctx.slots.inject(
2278
+ "sidebar.panellist",
2279
+ () => ctx.slots.register({ name: "sidebar.panellist", id: PANEL_ID, order: 20, label: () => t("panel") }, PanelIcon)
2280
+ );
2281
+ }
2282
+ };
2283
+ var plugin_default = plugin;
2284
+
2285
+ })(module, exports, require);
2286
+ return module.exports && module.exports.default ? module.exports.default : module.exports;
2287
+ },
2288
+ });