dsh-plugin-github-issues 0.0.0-stage → 0.4.7

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.
Files changed (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +147 -2
  3. package/cordis.patch.yml +20 -0
  4. package/docs/README.zh.md +134 -0
  5. package/icon.svg +9 -0
  6. package/lib/client.js +3243 -0
  7. package/lib/controller.js +289 -0
  8. package/lib/controller.js.map +1 -0
  9. package/lib/github/auth.js +249 -0
  10. package/lib/github/auth.js.map +1 -0
  11. package/lib/github/client.js +767 -0
  12. package/lib/github/client.js.map +1 -0
  13. package/lib/github/queries.js +479 -0
  14. package/lib/github/queries.js.map +1 -0
  15. package/lib/github/state.js +186 -0
  16. package/lib/github/state.js.map +1 -0
  17. package/lib/github/types.js +29 -0
  18. package/lib/github/types.js.map +1 -0
  19. package/lib/github/vm.js +362 -0
  20. package/lib/github/vm.js.map +1 -0
  21. package/lib/index.js +65 -0
  22. package/lib/index.js.map +1 -0
  23. package/lib/prompt.js +87 -0
  24. package/lib/prompt.js.map +1 -0
  25. package/lib/remote-methods.js +32 -0
  26. package/lib/remote-methods.js.map +1 -0
  27. package/lib/types/controller.d.ts +105 -0
  28. package/lib/types/controller.d.ts.map +1 -0
  29. package/lib/types/github/auth.d.ts +52 -0
  30. package/lib/types/github/auth.d.ts.map +1 -0
  31. package/lib/types/github/client.d.ts +40 -0
  32. package/lib/types/github/client.d.ts.map +1 -0
  33. package/lib/types/github/queries.d.ts +172 -0
  34. package/lib/types/github/queries.d.ts.map +1 -0
  35. package/lib/types/github/state.d.ts +51 -0
  36. package/lib/types/github/state.d.ts.map +1 -0
  37. package/lib/types/github/types.d.ts +79 -0
  38. package/lib/types/github/types.d.ts.map +1 -0
  39. package/lib/types/github/vm.d.ts +260 -0
  40. package/lib/types/github/vm.d.ts.map +1 -0
  41. package/lib/types/index.d.ts +46 -0
  42. package/lib/types/index.d.ts.map +1 -0
  43. package/lib/types/prompt.d.ts +30 -0
  44. package/lib/types/prompt.d.ts.map +1 -0
  45. package/lib/types/remote-methods.d.ts +32 -0
  46. package/lib/types/remote-methods.d.ts.map +1 -0
  47. package/lib/types/vm.d.ts +264 -0
  48. package/lib/types/vm.d.ts.map +1 -0
  49. package/lib/types/workspace.d.ts +43 -0
  50. package/lib/types/workspace.d.ts.map +1 -0
  51. package/lib/vm.js +42 -0
  52. package/lib/vm.js.map +1 -0
  53. package/lib/workspace.js +57 -0
  54. package/lib/workspace.js.map +1 -0
  55. package/locale/en.json +6 -0
  56. package/locale/zh.json +6 -0
  57. package/package.json +97 -4
package/lib/client.js ADDED
@@ -0,0 +1,3243 @@
1
+ window.__ModuleLoader__.load({
2
+ id: "dsh-plugin-github-issues",
3
+ factory: function (require) {
4
+ var module = { exports: {} };
5
+ var exports = module.exports;
6
+ (function (module, exports, require) {
7
+ "use strict";
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.tsx
27
+ var index_exports = {};
28
+ __export(index_exports, {
29
+ apply: () => apply,
30
+ inject: () => inject
31
+ });
32
+ module.exports = __toCommonJS(index_exports);
33
+
34
+ // src/client/containers.tsx
35
+ var import_react5 = require("react");
36
+
37
+ // src/vm.ts
38
+ var DEFAULT_PROMPT_TEMPLATE = [
39
+ "\u5904\u7406 GitHub Issue\uFF1A{{repo}}#{{number}} {{title}}",
40
+ "\u94FE\u63A5\uFF1A{{url}}",
41
+ "\u72B6\u6001\uFF1A{{state}} \uFF5C \u91CC\u7A0B\u7891\uFF1A{{milestone}} \uFF5C \u4F18\u5148\u7EA7\uFF1A{{priority}} \uFF5C \u6307\u6D3E\uFF1A{{assignees}}",
42
+ "\u6807\u7B7E\uFF1A{{labels}}",
43
+ "\u5173\u8054 PR\uFF1A{{prs}}",
44
+ "\u8981\u6C42\uFF1A\u5148\u8BFB Issue \u6B63\u6587\u4E0E\u5173\u8054 PR\uFF0C\u786E\u8BA4\u9A8C\u6536\u6807\u51C6\u540E\u518D\u52A8\u624B\uFF1B\u7528 subagent_codex \u6267\u884C\u5177\u4F53\u6539\u52A8\uFF0C\u5B8C\u6210\u540E\u8DD1\u76F8\u5173\u6D4B\u8BD5\u5E76\u56DE\u62A5\u3002"
45
+ ].join("\n");
46
+ var DEFAULT_PREFS = {
47
+ org: void 0,
48
+ projectId: void 0,
49
+ repo: void 0,
50
+ assignee: "@me",
51
+ state: "open",
52
+ handoffMode: "draft",
53
+ promptTemplate: DEFAULT_PROMPT_TEMPLATE,
54
+ pinned: void 0
55
+ };
56
+
57
+ // src/prompt.ts
58
+ function fill(template, token, value) {
59
+ return template.split(`{{${token}}}`).join(value);
60
+ }
61
+ function stateText(issue) {
62
+ if (issue.state === "OPEN") return "Open";
63
+ return issue.stateReason === "COMPLETED" ? "Closed (completed)" : `Closed (${issue.stateReason ?? "no reason"})`;
64
+ }
65
+ function prsText(issue) {
66
+ if (issue.linkedPRs.length === 0) return "\u65E0";
67
+ return issue.linkedPRs.map((pr) => {
68
+ const state = pr.merged ? "merged" : pr.state.toLowerCase();
69
+ return `#${String(pr.number)} (${state}${pr.checks === null ? "" : `, checks ${pr.checks.toLowerCase()}`})`;
70
+ }).join("\u3001");
71
+ }
72
+ function milestoneText(issue) {
73
+ if (issue.milestone === void 0) return "\u65E0";
74
+ const due = issue.milestone.dueOn === null ? "" : `, due ${issue.milestone.dueOn}`;
75
+ const progress = issue.milestone.progress === null ? "" : `, ${String(issue.milestone.progress)}%`;
76
+ return `${issue.milestone.title}${due}${progress}`;
77
+ }
78
+ function priorityText(issue) {
79
+ if (issue.priority === void 0) return "\u65E0";
80
+ const source = issue.priority.source === "project" ? "project field" : issue.priority.source === "issue-field" ? "issue field" : "label";
81
+ return `${issue.priority.name} (${source})`;
82
+ }
83
+ function renderPrompt(issue, template) {
84
+ const source = template === "" ? DEFAULT_PROMPT_TEMPLATE : template;
85
+ let text = source;
86
+ text = fill(text, "repo", issue.repo);
87
+ text = fill(text, "number", String(issue.number));
88
+ text = fill(text, "title", issue.title);
89
+ text = fill(text, "url", issue.url);
90
+ text = fill(text, "state", stateText(issue));
91
+ text = fill(text, "milestone", milestoneText(issue));
92
+ text = fill(text, "priority", priorityText(issue));
93
+ text = fill(text, "assignees", issue.assignees.length === 0 ? "\u672A\u6307\u6D3E" : issue.assignees.map((a) => a.login).join(", "));
94
+ text = fill(text, "labels", issue.labels.length === 0 ? "\u65E0" : issue.labels.map((l) => l.name).join(", "));
95
+ text = fill(text, "prs", prsText(issue));
96
+ if (text.length > 8e3) return `${text.slice(0, 7990)}
97
+ \u2026\uFF08\u5DF2\u622A\u65AD\uFF09`;
98
+ return text;
99
+ }
100
+ var EMPTY_DRAFT_HOLD = "\u200B\n";
101
+ function composeHandoffPrompt(prompt, memo) {
102
+ const extra = memo.replace(/\u200b/g, "").replace(/^\n+/, "").trim();
103
+ return extra === "" ? prompt : `${prompt}
104
+
105
+ ${extra}`;
106
+ }
107
+
108
+ // src/client/views/Dock.tsx
109
+ var import_react = require("react");
110
+
111
+ // src/client/views/format.ts
112
+ var MINUTES_PER_HOUR = 60;
113
+ var HEX_COLOR = /^[0-9a-f]{3}$|^[0-9a-f]{6}$/i;
114
+ function normalizeHex(hex) {
115
+ const cleaned = hex.trim().replace(/^#/, "");
116
+ if (!HEX_COLOR.test(cleaned)) return void 0;
117
+ if (cleaned.length === 3) {
118
+ return cleaned.split("").map((digit) => `${digit}${digit}`).join("").toLowerCase();
119
+ }
120
+ return cleaned.toLowerCase();
121
+ }
122
+ function linearize(channel) {
123
+ const value = channel / 255;
124
+ return value <= 0.03928 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
125
+ }
126
+ function labelTextColor(hex) {
127
+ const normalized = normalizeHex(hex);
128
+ if (normalized === void 0) return "#ffffff";
129
+ const red = Number.parseInt(normalized.slice(0, 2), 16);
130
+ const green = Number.parseInt(normalized.slice(2, 4), 16);
131
+ const blue = Number.parseInt(normalized.slice(4, 6), 16);
132
+ const luminance = 0.2126 * linearize(red) + 0.7152 * linearize(green) + 0.0722 * linearize(blue);
133
+ return luminance > 0.5 ? "#111111" : "#ffffff";
134
+ }
135
+ function labelColorPair(hex) {
136
+ const normalized = normalizeHex(hex);
137
+ if (normalized === void 0) return void 0;
138
+ return { background: `#${normalized}`, text: labelTextColor(normalized) };
139
+ }
140
+ function relativeTime(iso, now = Date.now()) {
141
+ const timestamp = Date.parse(iso);
142
+ if (Number.isNaN(timestamp)) return "";
143
+ const elapsedMinutes = Math.max(0, now - timestamp) / 6e4;
144
+ if (elapsedMinutes < 1) return "just now";
145
+ if (elapsedMinutes < MINUTES_PER_HOUR) return `${String(Math.floor(elapsedMinutes))}m`;
146
+ const hours = elapsedMinutes / MINUTES_PER_HOUR;
147
+ if (hours < 24) return `${String(Math.floor(hours))}h`;
148
+ const days = hours / 24;
149
+ if (days < 7) return `${String(Math.floor(days))}d`;
150
+ const weeks = days / 7;
151
+ if (weeks < 5) return `${String(Math.floor(weeks))}w`;
152
+ const months = days / 30;
153
+ if (months < 12) return `${String(Math.floor(months))}mo`;
154
+ return `${String(Math.floor(days / 365))}y`;
155
+ }
156
+ function formatDue(iso) {
157
+ if (iso === null || iso === void 0 || iso === "") return "";
158
+ const dateOnly = /^(\d{4})-(\d{2})-(\d{2})/.exec(iso);
159
+ if (dateOnly !== null) {
160
+ const [, year = "", month2 = "", day2 = ""] = dateOnly;
161
+ return `${year}-${month2}-${day2}`;
162
+ }
163
+ const parsed = new Date(iso);
164
+ if (Number.isNaN(parsed.getTime())) return iso;
165
+ const month = String(parsed.getMonth() + 1).padStart(2, "0");
166
+ const day = String(parsed.getDate()).padStart(2, "0");
167
+ return `${String(parsed.getFullYear())}-${month}-${day}`;
168
+ }
169
+ function priorityTone(name) {
170
+ const key = name.trim().toLowerCase();
171
+ if (key.startsWith("p0") || key === "urgent" || key === "critical" || key === "blocker") return "error";
172
+ if (key.startsWith("p1") || key === "high") return "warn";
173
+ if (key.startsWith("p2") || key === "medium" || key === "normal") return "info";
174
+ return "neutral";
175
+ }
176
+ function prioritySourceLabel(source) {
177
+ switch (source) {
178
+ case "project":
179
+ return "panel.priority.project";
180
+ case "issue-field":
181
+ return "panel.priority.issueField";
182
+ case "label":
183
+ return "panel.priority.label";
184
+ }
185
+ }
186
+ function stateLabelKey(state) {
187
+ return state === "OPEN" ? "panel.state.open" : "panel.state.closed";
188
+ }
189
+ function stateTone(state, stateReason) {
190
+ if (state === "OPEN") return "success";
191
+ if (stateReason === "NOT_PLANNED" || stateReason === "DUPLICATE") return "neutral";
192
+ return "info";
193
+ }
194
+ function prGlyph(pr) {
195
+ if (pr.merged) return { glyph: "\u25C6", tone: "info", label: "panel.merged" };
196
+ if (pr.isDraft) return { glyph: "\u25CD", tone: "neutral", label: "panel.draft" };
197
+ if (pr.state === "OPEN") return { glyph: "\u25CF", tone: "success", label: "panel.openPR" };
198
+ return { glyph: "\u2715", tone: "error", label: "panel.closedPR" };
199
+ }
200
+ function checksGlyph(pr) {
201
+ switch (pr.checks) {
202
+ case null:
203
+ return void 0;
204
+ case "SUCCESS":
205
+ return { glyph: "\u2713", tone: "success", label: "panel.checks.success" };
206
+ case "FAILURE":
207
+ case "ERROR":
208
+ return { glyph: "\u2715", tone: "error", label: "panel.checks.failure" };
209
+ case "PENDING":
210
+ case "EXPECTED":
211
+ return { glyph: "\u2026", tone: "warn", label: "panel.checks.pending" };
212
+ default:
213
+ return { glyph: "\u2013", tone: "neutral", label: "panel.checks.none" };
214
+ }
215
+ }
216
+ function reviewGlyph(pr) {
217
+ switch (pr.reviewDecision) {
218
+ case null:
219
+ return void 0;
220
+ case "APPROVED":
221
+ return { glyph: "\u2713", tone: "success", label: "panel.review.approved" };
222
+ case "CHANGES_REQUESTED":
223
+ return { glyph: "\u2715", tone: "error", label: "panel.review.changes" };
224
+ case "REVIEW_REQUIRED":
225
+ return { glyph: "\u25D4", tone: "warn", label: "panel.review.required" };
226
+ }
227
+ }
228
+ function labelsWithoutPriority(card) {
229
+ const priority = card.priority;
230
+ if (priority === void 0 || priority.source !== "label") return card.labels;
231
+ const name = priority.name.toLowerCase();
232
+ return card.labels.filter((label) => label.name.toLowerCase() !== name);
233
+ }
234
+
235
+ // src/client/views/Icon.tsx
236
+ var import_jsx_runtime = require("react/jsx-runtime");
237
+ function Glyph({ size = 14, children }) {
238
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
239
+ "svg",
240
+ {
241
+ width: size,
242
+ height: size,
243
+ viewBox: "0 0 24 24",
244
+ fill: "none",
245
+ stroke: "currentColor",
246
+ strokeWidth: 1.7,
247
+ strokeLinecap: "round",
248
+ strokeLinejoin: "round",
249
+ "aria-hidden": "true",
250
+ focusable: "false",
251
+ children
252
+ }
253
+ );
254
+ }
255
+ function GitHubIcon({ size = 16, active }) {
256
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
257
+ "svg",
258
+ {
259
+ width: size,
260
+ height: size,
261
+ viewBox: "0 0 24 24",
262
+ fill: "none",
263
+ stroke: "currentColor",
264
+ strokeWidth: 1.8,
265
+ strokeLinecap: "round",
266
+ strokeLinejoin: "round",
267
+ "aria-hidden": "true",
268
+ focusable: "false",
269
+ children: [
270
+ active === true && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "0", y: "0", width: "24", height: "24", rx: "6", fill: "currentColor", opacity: 0.1, stroke: "none" }),
271
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "7", cy: "7", r: "3.1" }),
272
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "7", cy: "7", r: "1", fill: "currentColor", stroke: "none" }),
273
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M7 10.2v3.3a4.5 4.5 0 0 0 4.5 4.5h2.3" }),
274
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "17", cy: "18", r: "2.4" }),
275
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M17 15.5v-6" }),
276
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "17", cy: "7", r: "2.4" })
277
+ ]
278
+ }
279
+ );
280
+ }
281
+ function CloseGlyph(props) {
282
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Glyph, { ...props, children: [
283
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M6 6l12 12" }),
284
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M18 6L6 18" })
285
+ ] });
286
+ }
287
+ function SearchGlyph(props) {
288
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Glyph, { ...props, children: [
289
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "10.5", cy: "10.5", r: "6.2" }),
290
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M15.2 15.2L20 20" })
291
+ ] });
292
+ }
293
+ function RefreshGlyph(props) {
294
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Glyph, { ...props, children: [
295
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M20 12a8 8 0 1 1-2.4-5.7" }),
296
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M20 4v4.6h-4.6" })
297
+ ] });
298
+ }
299
+ function LinkGlyph(props) {
300
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Glyph, { ...props, children: [
301
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M10.3 13.7a4 4 0 0 0 5.7 0l2.7-2.7a4 4 0 0 0-5.7-5.7l-1.4 1.4" }),
302
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M13.7 10.3a4 4 0 0 0-5.7 0l-2.7 2.7a4 4 0 1 0 5.7 5.7l1.4-1.4" })
303
+ ] });
304
+ }
305
+ function CommentGlyph(props) {
306
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Glyph, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M20 15a3 3 0 0 1-3 3H9l-5 3V7a3 3 0 0 1 3-3h10a3 3 0 0 1 3 3z" }) });
307
+ }
308
+ function CopyGlyph(props) {
309
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Glyph, { ...props, children: [
310
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "9", y: "9", width: "11", height: "11", rx: "2" }),
311
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5 15V6a2 2 0 0 1 2-2h9" })
312
+ ] });
313
+ }
314
+ function ExternalGlyph(props) {
315
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Glyph, { ...props, children: [
316
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M14 5h5v5" }),
317
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M19 5l-8.5 8.5" }),
318
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M18 14.5V18a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4" })
319
+ ] });
320
+ }
321
+ function PlusGlyph(props) {
322
+ const { size = 14 } = props;
323
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { viewBox: "0 0 16 16", width: size, height: size, fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 3.5v9M3.5 8h9", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round" }) });
324
+ }
325
+
326
+ // src/client/views/controls.tsx
327
+ var import_jsx_runtime2 = require("react/jsx-runtime");
328
+ var TONE = {
329
+ neutral: {
330
+ fg: "var(--dsw-alias-label-secondary)",
331
+ bg: "var(--dsw-alias-bg-layer-2)",
332
+ border: "var(--dsw-alias-border-l2)",
333
+ dot: "var(--dsw-alias-label-tertiary)"
334
+ },
335
+ success: {
336
+ fg: "var(--dsw-alias-state-success-primary)",
337
+ bg: "var(--dsw-alias-state-success-tertiary, var(--dsw-alias-bg-layer-2))",
338
+ border: "transparent",
339
+ dot: "var(--dsw-alias-state-success-primary)"
340
+ },
341
+ warn: {
342
+ fg: "var(--dsw-alias-state-warn-primary)",
343
+ bg: "var(--dsw-alias-state-warn-tertiary, var(--dsw-alias-bg-layer-2))",
344
+ border: "transparent",
345
+ dot: "var(--dsw-alias-state-warn-primary)"
346
+ },
347
+ error: {
348
+ fg: "var(--dsw-alias-state-error-primary)",
349
+ bg: "var(--dsw-alias-state-error-secondary, var(--dsw-alias-bg-layer-2))",
350
+ border: "transparent",
351
+ dot: "var(--dsw-alias-state-error-primary)"
352
+ },
353
+ info: {
354
+ fg: "var(--dsw-alias-state-business-primary, var(--dsw-alias-link))",
355
+ bg: "var(--dsw-alias-state-business-tertiary, var(--dsw-alias-bg-layer-2))",
356
+ border: "transparent",
357
+ dot: "var(--dsw-alias-state-business-primary, var(--dsw-alias-link))"
358
+ }
359
+ };
360
+ var PROJECT_SCOPE_COMMAND = "gh auth refresh -h github.com -s read:project";
361
+ function Button({ children, onClick, variant = "outline", size = "md", disabled, title, ariaLabel }) {
362
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
363
+ "button",
364
+ {
365
+ type: "button",
366
+ className: `gh-btn gh-btn-${variant} gh-btn-${size}`,
367
+ onClick,
368
+ disabled,
369
+ title,
370
+ "aria-label": ariaLabel,
371
+ children
372
+ }
373
+ );
374
+ }
375
+ function Chip({ label, color, tone = "neutral", dot, title }) {
376
+ const pair = color === void 0 ? void 0 : labelColorPair(color);
377
+ const toneStyle = TONE[tone];
378
+ const style = pair === void 0 ? { background: toneStyle.bg, color: toneStyle.fg, borderColor: toneStyle.border } : { background: pair.background, color: pair.text, borderColor: "transparent" };
379
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "gh-chip", style, title, children: [
380
+ dot === true && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "gh-dot", style: { background: toneStyle.dot }, "aria-hidden": "true" }),
381
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "gh-chip-label", children: label })
382
+ ] });
383
+ }
384
+ function Badge({ children, tone = "neutral", title }) {
385
+ const toneStyle = TONE[tone];
386
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
387
+ "span",
388
+ {
389
+ className: "gh-badge",
390
+ style: { background: toneStyle.bg, color: toneStyle.fg, borderColor: toneStyle.border },
391
+ title,
392
+ children
393
+ }
394
+ );
395
+ }
396
+ function Pill({ children, tone = "neutral", dot, title }) {
397
+ const toneStyle = TONE[tone];
398
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
399
+ "span",
400
+ {
401
+ className: "gh-pill",
402
+ style: { background: toneStyle.bg, color: toneStyle.fg, borderColor: toneStyle.border },
403
+ title,
404
+ children: [
405
+ dot === true && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "gh-dot", style: { background: toneStyle.dot }, "aria-hidden": "true" }),
406
+ children
407
+ ]
408
+ }
409
+ );
410
+ }
411
+ function ProgressBar({ value, width, label }) {
412
+ const clamped = Math.max(0, Math.min(100, Math.round(value)));
413
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
414
+ "div",
415
+ {
416
+ className: "gh-progress",
417
+ role: "progressbar",
418
+ "aria-valuemin": 0,
419
+ "aria-valuemax": 100,
420
+ "aria-valuenow": clamped,
421
+ "aria-label": label,
422
+ style: width === void 0 ? void 0 : { width },
423
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "gh-progress-fill", style: { width: `${String(clamped)}%` } })
424
+ }
425
+ );
426
+ }
427
+ function Select({ options, value, onChange, label, ariaLabel, disabled, placeholder }) {
428
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "gh-select-wrap", children: [
429
+ label !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "gh-field-label", children: label }),
430
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
431
+ "select",
432
+ {
433
+ className: "gh-select",
434
+ value: value ?? "",
435
+ "aria-label": ariaLabel ?? label,
436
+ disabled,
437
+ onChange: (event) => onChange(event.target.value),
438
+ children: [
439
+ placeholder !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "", disabled: true, children: placeholder }),
440
+ options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: option.value, disabled: option.disabled, children: option.label }, option.value))
441
+ ]
442
+ }
443
+ )
444
+ ] });
445
+ }
446
+ function TextInput({ value, onChange, ariaLabel, placeholder, disabled }) {
447
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
448
+ "input",
449
+ {
450
+ className: "gh-input",
451
+ type: "text",
452
+ value,
453
+ "aria-label": ariaLabel,
454
+ placeholder,
455
+ disabled,
456
+ onChange: (event) => onChange(event.target.value)
457
+ }
458
+ );
459
+ }
460
+ function TextArea({ value, onChange, ariaLabel, rows = 8, mono }) {
461
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
462
+ "textarea",
463
+ {
464
+ className: `gh-textarea${mono === true ? " gh-textarea-mono" : ""}`,
465
+ value,
466
+ rows,
467
+ "aria-label": ariaLabel,
468
+ spellCheck: false,
469
+ onChange: (event) => onChange(event.target.value)
470
+ }
471
+ );
472
+ }
473
+ function IconButton({ label, children, onClick, disabled, active }) {
474
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
475
+ "button",
476
+ {
477
+ type: "button",
478
+ className: `gh-icon-btn${active === true ? " gh-icon-btn-active" : ""}`,
479
+ "aria-label": label,
480
+ title: label,
481
+ onClick,
482
+ disabled,
483
+ children
484
+ }
485
+ );
486
+ }
487
+ function Spinner({ size = 14 }) {
488
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "gh-spinner", style: { width: size, height: size }, "aria-hidden": "true" });
489
+ }
490
+ function EmptyState({ title, hint, icon, action }) {
491
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "gh-empty", children: [
492
+ icon !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "gh-empty-icon", children: icon }),
493
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "gh-empty-title", children: title }),
494
+ hint !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "gh-empty-hint", children: hint }),
495
+ action !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "gh-empty-action", children: action })
496
+ ] });
497
+ }
498
+ function ErrorBanner({ message, retryLabel, onRetry, children }) {
499
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "gh-error", role: "alert", children: [
500
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "gh-error-row", children: [
501
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "gh-error-glyph", "aria-hidden": "true", children: "!" }),
502
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "gh-error-text", children: message }),
503
+ onRetry !== void 0 && retryLabel !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Button, { size: "sm", variant: "ghost", onClick: onRetry, children: retryLabel })
504
+ ] }),
505
+ children
506
+ ] });
507
+ }
508
+ function Toast({ text, onDismiss, dismissLabel }) {
509
+ if (text === "") return null;
510
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "gh-toast", role: "status", children: [
511
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "gh-toast-text", children: text }),
512
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: "gh-toast-close", "aria-label": dismissLabel, title: dismissLabel, onClick: onDismiss, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CloseGlyph, { size: 12 }) })
513
+ ] });
514
+ }
515
+ function CommandBlock({ command, copyLabel, onCopy }) {
516
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "gh-command", children: [
517
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("code", { className: "gh-command-text", children: command }),
518
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Button, { size: "sm", variant: "ghost", onClick: onCopy, children: [
519
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CopyGlyph, { size: 12 }),
520
+ copyLabel
521
+ ] })
522
+ ] });
523
+ }
524
+ function StyleSheet({ chunks }) {
525
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("style", { children: chunks.join("\n") });
526
+ }
527
+ var CONTROLS_CSS = `
528
+ .gh-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;box-sizing:border-box;border:0.5px solid transparent;border-radius:var(--dsw-radius-md,8px);font-family:inherit;font-size:var(--dsh-content-font-size-secondary,13px);line-height:20px;cursor:pointer;white-space:nowrap;text-decoration:none;transition:background-color .15s,border-color .15s,color .15s;color:var(--dsw-alias-label-primary);background:transparent}
529
+ .gh-btn-md{height:32px;padding:0 12px}
530
+ .gh-btn-sm{height:26px;padding:0 8px;font-size:12px;border-radius:var(--dsw-radius-sm,6px)}
531
+ .gh-btn-primary{background:var(--dsw-alias-button-primary-fill,var(--dsw-alias-state-business-primary,var(--dsw-alias-link)));color:var(--dsw-alias-label-primary-foreground,#fff)}
532
+ .gh-btn-primary:hover:not(:disabled){background:var(--dsw-alias-button-primary-hover,var(--dsw-alias-state-business-primary,var(--dsw-alias-link)))}
533
+ .gh-btn-outline{border-color:var(--dsw-alias-border-l3);color:var(--dsw-alias-label-primary)}
534
+ .gh-btn-outline:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);border-color:var(--dsw-alias-border-l2)}
535
+ .gh-btn-ghost{color:var(--dsw-alias-label-secondary)}
536
+ .gh-btn-ghost:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
537
+ .gh-btn:disabled{opacity:.45;cursor:default}
538
+ .gh-icon-btn{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;box-sizing:border-box;border:0.5px solid transparent;border-radius:var(--dsw-radius-sm,6px);background:transparent;color:var(--dsw-alias-label-tertiary);cursor:pointer;flex:none}
539
+ .gh-icon-btn:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
540
+ .gh-icon-btn-active{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
541
+ .gh-icon-btn:disabled{opacity:.45;cursor:default}
542
+ .gh-chip{display:inline-flex;align-items:center;gap:4px;box-sizing:border-box;min-width:0;max-width:180px;height:20px;padding:0 7px;border:0.5px solid transparent;border-radius:var(--dsw-radius-sm,6px);font-size:12px;line-height:18px;white-space:nowrap;vertical-align:middle}
543
+ .gh-chip-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
544
+ .gh-badge{display:inline-flex;align-items:center;gap:4px;box-sizing:border-box;max-width:100%;height:20px;padding:0 7px;border:0.5px solid transparent;border-radius:var(--dsw-radius-sm,6px);font-size:12px;line-height:18px;white-space:nowrap;vertical-align:middle}
545
+ .gh-pill{display:inline-flex;align-items:center;gap:6px;box-sizing:border-box;min-height:22px;padding:0 10px;border:0.5px solid transparent;border-radius:999px;font-size:12px;line-height:18px;white-space:nowrap}
546
+ .gh-dot{display:inline-block;width:8px;height:8px;border-radius:50%;flex:none}
547
+ .gh-progress{position:relative;height:4px;border-radius:999px;background:var(--dsw-alias-bg-layer-3);overflow:hidden;flex:none}
548
+ .gh-progress-fill{height:100%;border-radius:999px;background:var(--dsw-alias-state-business-primary,var(--dsw-alias-link));transition:width .2s}
549
+ .gh-field-label{font-size:12px;line-height:20px;color:var(--dsw-alias-label-tertiary);white-space:nowrap}
550
+ .gh-select-wrap{display:inline-flex;align-items:center;gap:6px;min-width:0}
551
+ .gh-select{box-sizing:border-box;height:28px;max-width:240px;padding:0 6px;border:0.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm,6px);background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary);font-family:inherit;font-size:var(--dsh-content-font-size-secondary,13px);cursor:pointer}
552
+ .gh-select:hover:not(:disabled){border-color:var(--dsw-alias-border-l2)}
553
+ .gh-select:disabled{opacity:.5;cursor:default}
554
+ .gh-input{box-sizing:border-box;height:32px;width:100%;padding:0 10px;border:0.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary);font-family:inherit;font-size:var(--dsh-content-font-size-secondary,13px);line-height:20px}
555
+ .gh-input::placeholder{color:var(--dsw-alias-label-tertiary)}
556
+ .gh-input:hover:not(:disabled){border-color:var(--dsw-alias-border-l2)}
557
+ .gh-input:focus{border-color:var(--dsw-alias-state-business-primary,var(--dsw-alias-link))}
558
+ .gh-textarea{box-sizing:border-box;width:100%;padding:8px 10px;border:0.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary);font-family:inherit;font-size:var(--dsh-content-font-size-secondary,13px);line-height:20px;resize:vertical;min-height:80px}
559
+ .gh-textarea:hover{border-color:var(--dsw-alias-border-l2)}
560
+ .gh-textarea:focus{border-color:var(--dsw-alias-state-business-primary,var(--dsw-alias-link))}
561
+ .gh-textarea-mono{font-family:var(--dsh-font-family-code,ui-monospace,SFMono-Regular,Menlo,monospace)}
562
+ .gh-spinner{display:inline-block;box-sizing:border-box;border:1.5px solid var(--dsw-alias-border-l3);border-top-color:var(--dsw-alias-label-secondary);border-radius:50%;animation:gh-spin .8s linear infinite;flex:none}
563
+ .gh-empty{display:flex;flex-direction:column;align-items:center;gap:6px;padding:44px 20px;text-align:center;color:var(--dsw-alias-label-tertiary)}
564
+ .gh-empty-icon{color:var(--dsw-alias-label-tertiary);margin-bottom:4px;display:flex}
565
+ .gh-empty-title{font-size:var(--dsh-content-font-size-secondary,13px);line-height:20px;color:var(--dsw-alias-label-secondary)}
566
+ .gh-empty-hint{font-size:12px;line-height:20px;color:var(--dsw-alias-label-tertiary);max-width:420px}
567
+ .gh-empty-action{margin-top:8px}
568
+ .gh-error{display:flex;flex-direction:column;gap:8px;box-sizing:border-box;padding:10px 12px;border:0.5px solid var(--dsw-alias-state-error-primary);border-radius:var(--dsw-radius-lg,12px);background:var(--dsw-alias-state-error-secondary,var(--dsw-alias-bg-layer-1))}
569
+ .gh-error-row{display:flex;align-items:flex-start;gap:8px}
570
+ .gh-error-glyph{flex:none;color:var(--dsw-alias-state-error-primary);font-weight:600;line-height:20px}
571
+ .gh-error-text{flex:1;min-width:0;font-size:var(--dsh-content-font-size-secondary,13px);line-height:20px;overflow-wrap:anywhere;color:var(--dsw-alias-label-primary)}
572
+ .gh-command{display:flex;align-items:center;gap:8px;flex-wrap:wrap;box-sizing:border-box;padding:6px 8px;border:0.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-bg-layer-1)}
573
+ .gh-command-text{flex:1;min-width:0;font-family:var(--dsh-font-family-code,ui-monospace,SFMono-Regular,Menlo,monospace);font-size:12px;line-height:20px;color:var(--dsw-alias-label-primary);overflow-wrap:anywhere}
574
+ .gh-toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);z-index:40;display:inline-flex;align-items:center;gap:8px;box-sizing:border-box;max-width:min(480px,calc(100vw - 32px));padding:6px 8px 6px 12px;border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-toast-bg,var(--dsw-alias-bg-layer-3));color:var(--dsw-alias-toast-label,var(--dsw-alias-label-primary));box-shadow:var(--dsw-shadow-lv3,0 6px 24px rgba(0,0,0,.18));font-size:12px;line-height:20px}
575
+ .gh-toast-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
576
+ .gh-toast-close{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;padding:0;border:0;border-radius:var(--dsw-radius-xs,4px);background:transparent;color:inherit;cursor:pointer;flex:none;opacity:.75}
577
+ .gh-toast-close:hover{opacity:1}
578
+ .gh-btn:focus-visible,.gh-icon-btn:focus-visible,.gh-select:focus-visible,.gh-input:focus-visible,.gh-textarea:focus-visible,.gh-toast-close:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}
579
+ @keyframes gh-spin{to{transform:rotate(360deg)}}
580
+ `.trim();
581
+
582
+ // src/client/views/Dock.tsx
583
+ var import_jsx_runtime3 = require("react/jsx-runtime");
584
+ var DOCK_CSS = `
585
+ .ghd-row{display:inline-flex;align-items:center;gap:6px;flex-wrap:nowrap;min-width:0;max-width:100%;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary)}
586
+ .ghd-chip{display:inline-flex;align-items:center;gap:5px;box-sizing:border-box;height:22px;max-width:300px;min-width:0;padding:0 8px;border:0.5px solid var(--dsw-alias-border-l2);border-radius:999px;background:transparent;color:var(--dsw-alias-label-secondary);cursor:pointer;font-family:inherit;font-size:11px;line-height:18px}
587
+ .ghd-chip:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-border-l3)}
588
+ .ghd-chip:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:1px}
589
+ .ghd-dot{width:7px;height:7px;border-radius:50%;flex:none}
590
+ .ghd-state{flex:none;font-size:10px;line-height:14px}
591
+ .ghd-prefix{font-family:var(--dsh-font-family-code,ui-monospace,SFMono-Regular,Menlo,monospace);min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
592
+ .ghd-num{font-family:var(--dsh-font-family-code,ui-monospace,SFMono-Regular,Menlo,monospace);flex:none}
593
+ .ghd-extra{flex:none;font-size:10px;line-height:14px;padding:0 4px;border-radius:999px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-tertiary)}
594
+ .ghd-pop{position:fixed;z-index:60;box-sizing:border-box;width:340px;max-width:calc(100vw - 16px);padding:12px;border:0.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-lg,12px);background:var(--dsw-alias-bg-overlay,var(--dsw-alias-bg-layer-1));box-shadow:0 8px 24px rgba(0,0,0,.18);color:var(--dsw-alias-label-primary);font-size:13px;line-height:20px}
595
+ .ghd-pop-head{display:flex;align-items:center;gap:8px;min-width:0}
596
+ .ghd-pop-ref{font-family:var(--dsh-font-family-code,ui-monospace,SFMono-Regular,Menlo,monospace);font-size:12px;color:var(--dsw-alias-label-secondary);text-decoration:none;white-space:nowrap}
597
+ .ghd-pop-ref:hover{color:var(--dsw-alias-link);text-decoration:underline}
598
+ .ghd-pop-spacer{flex:1}
599
+ .ghd-pop-title{margin-top:6px;font-weight:500;color:var(--dsw-alias-label-primary);display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow:hidden}
600
+ .ghd-pop-meta{margin-top:8px;display:flex;flex-direction:column;gap:4px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary)}
601
+ .ghd-pop-row{display:flex;gap:8px;min-width:0}
602
+ .ghd-pop-key{flex:none;width:64px;color:var(--dsw-alias-label-tertiary)}
603
+ .ghd-pop-val{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
604
+ .ghd-pop-actions{margin-top:10px;display:flex;align-items:center;gap:6px;flex-wrap:wrap}
605
+ .ghd-pop-note{font-size:12px;color:var(--dsw-alias-label-tertiary)}
606
+ .ghd-icon-btn{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--dsw-alias-label-tertiary);cursor:pointer}
607
+ .ghd-icon-btn:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
608
+ `.trim();
609
+ function ChipPopover(props) {
610
+ const { chip, anchor, t, onClose, onOpenPanel, onRemove } = props;
611
+ const { card } = chip;
612
+ const state = stateTone(card.state, card.stateReason);
613
+ const pr = card.linkedPRs[0];
614
+ const prState = pr === void 0 ? void 0 : prGlyph(pr);
615
+ const repoShort = card.repo.split("/")[1] ?? card.repo;
616
+ const session = chip.sessions[0];
617
+ (0, import_react.useEffect)(() => {
618
+ const onKey = (event) => {
619
+ if (event.key === "Escape") onClose();
620
+ };
621
+ const onPointer = (event) => {
622
+ const target = event.target;
623
+ if (target?.closest(".ghd-pop") !== null || target?.closest(".ghd-chip") !== null) return;
624
+ onClose();
625
+ };
626
+ const onMove = () => onClose();
627
+ document.addEventListener("keydown", onKey);
628
+ document.addEventListener("mousedown", onPointer, true);
629
+ window.addEventListener("resize", onMove);
630
+ window.addEventListener("scroll", onMove, true);
631
+ return () => {
632
+ document.removeEventListener("keydown", onKey);
633
+ document.removeEventListener("mousedown", onPointer, true);
634
+ window.removeEventListener("resize", onMove);
635
+ window.removeEventListener("scroll", onMove, true);
636
+ };
637
+ }, [onClose]);
638
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "ghd-pop", style: { left: anchor.left, bottom: anchor.bottom }, role: "dialog", "aria-label": card.title, children: [
639
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(StyleSheet, { chunks: [CONTROLS_CSS, DOCK_CSS] }),
640
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "ghd-pop-head", children: [
641
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(GitHubIcon, { size: 13 }),
642
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("a", { className: "ghd-pop-ref", href: card.url, target: "_blank", rel: "noreferrer", children: `${repoShort}#${String(card.number)}` }),
643
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Badge, { tone: state, children: t(stateLabelKey(card.state)) }),
644
+ chip.state === "draft" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Badge, { tone: "warn", children: t("dock.pending") }),
645
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "ghd-pop-spacer" }),
646
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "ghd-icon-btn", "aria-label": t("panel.close"), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CloseGlyph, { size: 12 }) })
647
+ ] }),
648
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "ghd-pop-title", children: card.title === "" ? t("dock.loading") : card.title }),
649
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "ghd-pop-meta", children: [
650
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "ghd-pop-row", children: [
651
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "ghd-pop-key", children: t("panel.repo") }),
652
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "ghd-pop-val", children: card.repo })
653
+ ] }),
654
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "ghd-pop-row", children: [
655
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "ghd-pop-key", children: t("panel.milestone") }),
656
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "ghd-pop-val", children: card.milestone === void 0 ? t("panel.noMilestone") : card.milestone.title })
657
+ ] }),
658
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "ghd-pop-row", children: [
659
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "ghd-pop-key", children: t("panel.priority") }),
660
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "ghd-pop-val", children: card.priority === void 0 ? t("panel.noPriority") : card.priority.name })
661
+ ] }),
662
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "ghd-pop-row", children: [
663
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "ghd-pop-key", children: t("panel.linkedPRs") }),
664
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "ghd-pop-val", children: pr === void 0 ? t("panel.noPRs") : `#${String(pr.number)} \xB7 ${t(prState?.label ?? "panel.noPRs")}` })
665
+ ] }),
666
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "ghd-pop-row", children: [
667
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "ghd-pop-key", children: t("dock.linked") }),
668
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "ghd-pop-val", children: session === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "ghd-pop-note", children: t("dock.pending") }) : session.title })
669
+ ] })
670
+ ] }),
671
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "ghd-pop-actions", children: [
672
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Button, { size: "sm", variant: "outline", onClick: onOpenPanel, children: [
673
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ExternalGlyph, { size: 12 }),
674
+ t("panel.openInPanel")
675
+ ] }),
676
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Button, { size: "sm", variant: "ghost", onClick: onRemove, children: chip.state === "draft" ? t("dock.removeDraft") : t("dock.unlink") })
677
+ ] })
678
+ ] });
679
+ }
680
+ function GitHubDock({ chips, t, onRemoveChip, onOpenChip }) {
681
+ const [openKey, setOpenKey] = (0, import_react.useState)(void 0);
682
+ const [anchor, setAnchor] = (0, import_react.useState)(void 0);
683
+ if (chips.length === 0) return null;
684
+ const toggle = (chip, element) => {
685
+ const key = `${chip.card.repo}#${String(chip.card.number)}`;
686
+ if (openKey === key) {
687
+ setOpenKey(void 0);
688
+ return;
689
+ }
690
+ const rect = element.getBoundingClientRect();
691
+ const width = 340;
692
+ const left = Math.min(Math.max(8, rect.left), window.innerWidth - width - 8);
693
+ setAnchor({ left, bottom: window.innerHeight - rect.top + 8 });
694
+ setOpenKey(key);
695
+ };
696
+ const open = openKey === void 0 ? void 0 : chips.find((chip) => `${chip.card.repo}#${String(chip.card.number)}` === openKey);
697
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
698
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "ghd-row", "data-github-handoff": true, children: [
699
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(StyleSheet, { chunks: [CONTROLS_CSS, DOCK_CSS] }),
700
+ chips.map((chip) => {
701
+ const state = stateTone(chip.card.state, chip.card.stateReason);
702
+ const repoShort = chip.card.repo.split("/")[1] ?? chip.card.repo;
703
+ const key = `${chip.card.repo}#${String(chip.card.number)}`;
704
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
705
+ "button",
706
+ {
707
+ type: "button",
708
+ className: "ghd-chip",
709
+ "aria-expanded": openKey === key,
710
+ title: `${chip.card.repo}#${String(chip.card.number)}`,
711
+ onClick: (event) => toggle(chip, event.currentTarget),
712
+ children: [
713
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(GitHubIcon, { size: 11 }),
714
+ chip.state !== "degraded" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
715
+ "span",
716
+ {
717
+ className: "ghd-dot",
718
+ style: { background: chip.card.state === "CLOSED" ? TONE.error.dot : TONE.success.dot },
719
+ "aria-label": t(stateLabelKey(chip.card.state))
720
+ }
721
+ ),
722
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "ghd-prefix", title: chip.card.repo, children: chip.card.repo }),
723
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "ghd-num", children: `#${String(chip.card.number)}` }),
724
+ chip.state === "draft" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "ghd-extra", children: t("dock.pending") })
725
+ ]
726
+ },
727
+ key
728
+ );
729
+ })
730
+ ] }),
731
+ open !== void 0 && anchor !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
732
+ ChipPopover,
733
+ {
734
+ chip: open,
735
+ anchor,
736
+ t,
737
+ onClose: () => setOpenKey(void 0),
738
+ onOpenPanel: () => {
739
+ setOpenKey(void 0);
740
+ onOpenChip(open);
741
+ },
742
+ onRemove: () => {
743
+ setOpenKey(void 0);
744
+ onRemoveChip(open);
745
+ }
746
+ }
747
+ )
748
+ ] });
749
+ }
750
+
751
+ // src/client/views/DropZone.tsx
752
+ var import_jsx_runtime4 = require("react/jsx-runtime");
753
+ var DROPZONE_CSS = `
754
+ .ghz-bar{display:flex;align-items:center;gap:8px;box-sizing:border-box;margin-bottom:6px;padding:10px 12px;border:1px dashed var(--dsw-alias-state-business-primary,var(--dsw-alias-border-l3));border-radius:10px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);font-size:12px;line-height:18px}
755
+ .ghz-bar strong{font-weight:600}
756
+ .ghz-hint{color:var(--dsw-alias-label-tertiary)}
757
+ `.trim();
758
+ function GitHubDropZone({ dragging, t, onDrop, onCancel }) {
759
+ if (dragging === void 0) return null;
760
+ const ref = `${dragging.repo}#${String(dragging.number)}`;
761
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
762
+ "div",
763
+ {
764
+ className: "ghz-bar",
765
+ "data-github-dropzone": true,
766
+ onDragOver: (event) => {
767
+ event.preventDefault();
768
+ event.dataTransfer.dropEffect = "copy";
769
+ },
770
+ onDrop: (event) => {
771
+ event.preventDefault();
772
+ event.stopPropagation();
773
+ onDrop();
774
+ },
775
+ children: [
776
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(StyleSheet, { chunks: [CONTROLS_CSS, DROPZONE_CSS] }),
777
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GitHubIcon, { size: 14 }),
778
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: t("drop.release") }),
779
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: ref }),
780
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "ghz-hint", children: t("drop.hint") }),
781
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { flex: 1 } }),
782
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
783
+ "button",
784
+ {
785
+ type: "button",
786
+ className: "ghz-hint",
787
+ style: { border: 0, background: "transparent", cursor: "pointer", font: "inherit" },
788
+ onClick: onCancel,
789
+ children: t("drop.cancel")
790
+ }
791
+ )
792
+ ]
793
+ }
794
+ );
795
+ }
796
+
797
+ // src/client/views/Pending.tsx
798
+ var import_jsx_runtime5 = require("react/jsx-runtime");
799
+ var PENDING_CSS = `
800
+ .ghp3-row{position:absolute;top:8px;left:12px;right:12px;z-index:2;display:flex;align-items:center;gap:6px;min-width:0;height:22px;font-size:12px;line-height:18px;pointer-events:none}
801
+ .ghp3-chip{pointer-events:auto;display:inline-flex;align-items:center;gap:5px;box-sizing:border-box;height:22px;max-width:100%;padding:0 8px;border-radius:999px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);font-size:11px;line-height:18px;cursor:pointer;border:0.5px solid var(--dsw-alias-border-l2)}
802
+ .ghp3-chip:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
803
+ .ghp3-chip:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:1px}
804
+ .ghp3-ref{font-family:var(--dsh-font-family-code,ui-monospace,SFMono-Regular,Menlo,monospace);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
805
+ .ghp3-remove{pointer-events:auto;display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--dsw-alias-label-tertiary);cursor:pointer;flex:none}
806
+ .ghp3-remove:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
807
+ `.trim();
808
+ function GitHubPendingChip(props) {
809
+ const { card, t, onOpenPanel, onRemove } = props;
810
+ const ref = `${card.repo}#${String(card.number)}`;
811
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "ghp3-row", "data-github-pending": true, children: [
812
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(StyleSheet, { chunks: [CONTROLS_CSS, PENDING_CSS] }),
813
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { type: "button", className: "ghp3-chip", title: `${ref} \xB7 ${card.title}
814
+ ${t("pending.tip")}`, onClick: onOpenPanel, children: [
815
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(GitHubIcon, { size: 12 }),
816
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "ghp3-ref", children: ref })
817
+ ] }),
818
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "ghp3-remove", "aria-label": t("dock.removeDraft"), onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CloseGlyph, { size: 12 }) })
819
+ ] });
820
+ }
821
+
822
+ // src/client/views/Page.tsx
823
+ var import_react2 = require("react");
824
+
825
+ // src/client/views/IssueDetail.tsx
826
+ var import_jsx_runtime6 = require("react/jsx-runtime");
827
+ var ISSUE_DETAIL_CSS = `
828
+ .ghx-pane{display:flex;flex-direction:column;gap:12px;box-sizing:border-box;flex:0 0 380px;width:380px;min-width:0;padding-left:20px;border-left:0.5px solid var(--dsw-alias-border-l2)}
829
+ .ghx-head{display:flex;align-items:center;gap:6px;flex-wrap:wrap;min-width:0}
830
+ .ghx-ref{font-family:var(--dsh-font-family-code,ui-monospace,SFMono-Regular,Menlo,monospace);font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary);text-decoration:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}
831
+ .ghx-ref:hover{color:var(--dsw-alias-link);text-decoration:underline}
832
+ .ghx-head-spacer{flex:1;min-width:0}
833
+ .ghx-title{margin:0;font-size:16px;line-height:24px;font-weight:500;overflow-wrap:anywhere;color:var(--dsw-alias-label-primary)}
834
+ .ghx-title a{color:inherit;text-decoration:none}
835
+ .ghx-title a:hover{text-decoration:underline}
836
+ .ghx-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
837
+ .ghx-actions-spacer{flex:1;min-width:0}
838
+ .ghx-inline-action{display:inline-flex;align-items:center;gap:4px;border:0;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:12px;line-height:18px;cursor:pointer;padding:2px 4px;border-radius:6px;text-decoration:none;white-space:nowrap}
839
+ .ghx-inline-action:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
840
+ .ghx-session-hint{font-size:11px;line-height:16px;color:var(--dsw-alias-label-tertiary)}
841
+ .ghx-session-list{display:flex;flex-direction:column;gap:6px}
842
+ .ghx-session{display:flex;align-items:center;gap:8px;min-width:0;padding:6px 8px;border:0.5px solid var(--dsw-alias-border-l2);border-radius:8px;background:var(--dsw-alias-bg-layer-1)}
843
+ .ghx-session-dot{width:7px;height:7px;border-radius:50%;flex:none;background:var(--dsw-alias-state-success-primary)}
844
+ .ghx-session[data-available='no'] .ghx-session-dot{background:var(--dsw-alias-label-tertiary)}
845
+ .ghx-session-text{display:flex;flex-direction:column;gap:1px;min-width:0;flex:1}
846
+ .ghx-session-title{font-size:12px;line-height:16px;color:var(--dsw-alias-label-primary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
847
+ .ghx-session-ws{font-size:11px;line-height:15px;color:var(--dsw-alias-label-tertiary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
848
+ .ghx-session-missing{font-size:11px;color:var(--dsw-alias-label-tertiary);flex:none}
849
+ .ghx-body{margin:0;max-height:320px;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;box-sizing:border-box;padding:10px 12px;border:0.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-bg-layer-1);font-family:inherit;font-size:var(--dsh-content-font-size-secondary,13px);line-height:20px;color:var(--dsw-alias-label-primary)}
850
+ .ghx-section{display:flex;flex-direction:column;gap:6px}
851
+ .ghx-section-title{margin:0;font-size:12px;line-height:18px;font-weight:500;color:var(--dsw-alias-label-tertiary);text-transform:uppercase;letter-spacing:.02em}
852
+ .ghx-muted{font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary)}
853
+ .ghx-chips{display:flex;flex-wrap:wrap;gap:4px;align-items:center}
854
+ .ghx-assignees{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
855
+ .ghx-assignee{display:inline-flex;align-items:center;gap:5px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary)}
856
+ .ghx-avatar{width:18px;height:18px;border-radius:50%;flex:none;object-fit:cover}
857
+ .ghx-avatar-fallback{display:inline-flex;align-items:center;justify-content:center;background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-secondary);font-size:9px;font-weight:600;text-transform:uppercase}
858
+ .ghx-prs{display:flex;flex-direction:column;gap:6px}
859
+ .ghx-pr{display:flex;flex-direction:column;gap:2px;box-sizing:border-box;padding:6px 8px;border:0.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-sm,6px);background:var(--dsw-alias-bg-layer-1)}
860
+ .ghx-pr-head{display:flex;align-items:center;gap:6px;min-width:0;flex-wrap:wrap}
861
+ .ghx-pr-title{font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}
862
+ .ghx-pr-link{font-family:var(--dsh-font-family-code,ui-monospace,SFMono-Regular,Menlo,monospace);font-size:12px;line-height:18px;color:var(--dsw-alias-link);text-decoration:none}
863
+ .ghx-pr-link:hover{text-decoration:underline}
864
+ .ghx-glyph{font-size:12px;line-height:1}
865
+ .ghx-skeleton{display:flex;flex-direction:column;gap:8px}
866
+ .ghx-skeleton-line{height:12px;border-radius:var(--dsw-radius-xs,4px);background:var(--dsw-alias-bg-skeleton,var(--dsw-alias-bg-layer-2));animation:gh-pulse 1.4s ease-in-out infinite}
867
+ @keyframes gh-pulse{0%,100%{opacity:.55}50%{opacity:1}}
868
+ `.trim();
869
+ function LinkedPRRow({ pr, t }) {
870
+ const state = prGlyph(pr);
871
+ const checks = checksGlyph(pr);
872
+ const review = reviewGlyph(pr);
873
+ const failing = pr.failingChecks ?? [];
874
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "ghx-pr", children: [
875
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "ghx-pr-head", children: [
876
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("a", { className: "ghx-pr-link", href: pr.url, target: "_blank", rel: "noreferrer", children: [
877
+ "#",
878
+ pr.number
879
+ ] }),
880
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Badge, { tone: state.tone, title: t(state.label), children: [
881
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "ghx-glyph", "aria-hidden": "true", children: state.glyph }),
882
+ t(state.label)
883
+ ] }),
884
+ checks !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { title: t(checks.label, { count: failing.length }), style: { color: TONE[checks.tone].dot }, children: [
885
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "ghx-glyph", "aria-hidden": "true", children: checks.glyph }),
886
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "ghx-muted", children: [
887
+ " ",
888
+ t(checks.label, { count: failing.length })
889
+ ] })
890
+ ] }),
891
+ review !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { title: t(review.label), style: { color: TONE[review.tone].dot }, children: [
892
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "ghx-glyph", "aria-hidden": "true", children: review.glyph }),
893
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "ghx-muted", children: [
894
+ " ",
895
+ t(review.label)
896
+ ] })
897
+ ] })
898
+ ] }),
899
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "ghx-pr-title", children: pr.title }),
900
+ failing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "ghx-muted", children: [
901
+ t("panel.checks.failure", { count: failing.length }),
902
+ ": ",
903
+ failing.slice(0, 4).join(", "),
904
+ failing.length > 4 ? "\u2026" : ""
905
+ ] })
906
+ ] });
907
+ }
908
+ function DetailFooter({ commentCount, updatedAt, t }) {
909
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "ghx-muted", children: [
910
+ t("panel.comments", { count: commentCount }),
911
+ " \xB7 ",
912
+ t("panel.updated", { time: relativeTime(updatedAt) })
913
+ ] });
914
+ }
915
+ function IssueDetailPane({ snapshot, actions, t, resolveSession }) {
916
+ const card = snapshot.detail ?? snapshot.selected;
917
+ if (card === void 0) return null;
918
+ const provisional = snapshot.detail === void 0 && snapshot.selected !== void 0 && snapshot.detailLoading;
919
+ const detail = snapshot.detail ?? (provisional ? { ...card, body: "", mentionedPRs: [] } : void 0);
920
+ const error = snapshot.error;
921
+ const detailFailed = detail === void 0 && !snapshot.detailLoading && error !== void 0;
922
+ const showHint = detail === void 0 && !snapshot.detailLoading && error === void 0;
923
+ const tone = stateTone(card.state, card.stateReason);
924
+ const body = detail?.body !== void 0 && detail.body !== "" ? detail.body : detail?.bodyExcerpt;
925
+ const sessionLinks = card.sessionLinks ?? [];
926
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("aside", { className: "ghx-pane", "aria-label": t("panel.detail"), children: [
927
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "ghx-head", children: [
928
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("a", { className: "ghx-ref", href: card.url, target: "_blank", rel: "noreferrer", children: [
929
+ card.repo,
930
+ "#",
931
+ card.number
932
+ ] }),
933
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Badge, { tone, children: t(stateLabelKey(card.state)) }),
934
+ card.priority !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Badge, { tone: priorityTone(card.priority.name), title: t(prioritySourceLabel(card.priority.source)), children: card.priority.name }),
935
+ card.issueType !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Badge, { tone: "neutral", title: t("panel.type"), children: card.issueType.name }),
936
+ card.projectStatus !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Badge, { tone: "info", title: t("panel.project"), children: card.projectStatus.name }),
937
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "ghx-head-spacer" }),
938
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IconButton, { label: t("panel.closeDetail"), onClick: () => actions.closeDetail(), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CloseGlyph, { size: 14 }) })
939
+ ] }),
940
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h2", { className: "ghx-title", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: card.url, target: "_blank", rel: "noreferrer", children: card.title }) }),
941
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "ghx-actions", children: [
942
+ sessionLinks.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Button, { size: "sm", variant: "primary", onClick: () => actions.handoff(card), children: [
943
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PlusGlyph, { size: 12 }),
944
+ t("panel.handToAgent")
945
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
946
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
947
+ Button,
948
+ {
949
+ size: "sm",
950
+ variant: "primary",
951
+ onClick: () => actions.openSession(sessionLinks[sessionLinks.length - 1]?.sessionId ?? ""),
952
+ children: [
953
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(LinkGlyph, { size: 12 }),
954
+ t("panel.openSession")
955
+ ]
956
+ }
957
+ ),
958
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Button, { size: "sm", variant: "outline", onClick: () => actions.handoff(card), children: [
959
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PlusGlyph, { size: 12 }),
960
+ t("panel.newSession")
961
+ ] })
962
+ ] }),
963
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "ghx-actions-spacer" }),
964
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("a", { className: "ghx-inline-action", href: card.url, target: "_blank", rel: "noreferrer", children: [
965
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ExternalGlyph, { size: 12 }),
966
+ t("panel.openOnGitHub")
967
+ ] }),
968
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("button", { type: "button", className: "ghx-inline-action", onClick: () => actions.copyPrompt(card), children: [
969
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CopyGlyph, { size: 12 }),
970
+ t("panel.copyPrompt")
971
+ ] })
972
+ ] }),
973
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("section", { className: "ghx-section", children: [
974
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { className: "ghx-section-title", children: t("panel.sessions") }),
975
+ sessionLinks.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "ghx-muted", children: t("panel.noSession") }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
976
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "ghx-session-hint", children: t("panel.sessionsHint") }),
977
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "ghx-session-list", children: sessionLinks.map((link) => {
978
+ const view = resolveSession(link.sessionId);
979
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
980
+ "div",
981
+ {
982
+ className: "ghx-session",
983
+ "data-available": view.available ? "yes" : "no",
984
+ children: [
985
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "ghx-session-dot", "aria-hidden": "true" }),
986
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "ghx-session-text", children: [
987
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "ghx-session-title", title: view.title, children: view.title }),
988
+ view.workspaceTitle !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "ghx-session-ws", children: view.workspaceTitle })
989
+ ] }),
990
+ view.available ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { size: "sm", variant: "outline", onClick: () => actions.openSession(link.sessionId), children: t("panel.enterSession") }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "ghx-session-missing", children: t("panel.sessionUnavailable") }),
991
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
992
+ Button,
993
+ {
994
+ size: "sm",
995
+ variant: "ghost",
996
+ title: t("panel.unlinkSessionHint"),
997
+ onClick: () => actions.unlinkSession(card, link.sessionId),
998
+ children: t("panel.unlinkSession")
999
+ }
1000
+ )
1001
+ ]
1002
+ },
1003
+ link.sessionId
1004
+ );
1005
+ }) })
1006
+ ] })
1007
+ ] }),
1008
+ detailFailed && error !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1009
+ ErrorBanner,
1010
+ {
1011
+ message: t("panel.error", { message: error.message }),
1012
+ retryLabel: t("panel.retry"),
1013
+ onRetry: () => actions.selectIssue(card)
1014
+ }
1015
+ ),
1016
+ showHint && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(EmptyState, { title: t("panel.detail.empty"), icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(GitHubIcon, { size: 24 }) }),
1017
+ detail !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1018
+ provisional ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "ghx-skeleton", "aria-hidden": "true", children: [
1019
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "ghx-skeleton-line", style: { width: "92%" } }),
1020
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "ghx-skeleton-line", style: { width: "78%" } }),
1021
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "ghx-skeleton-line", style: { width: "60%" } })
1022
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("pre", { className: "ghx-body", style: { whiteSpace: "pre-wrap" }, children: body === void 0 || body === "" ? t("panel.noBody") : body }),
1023
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("section", { className: "ghx-section", children: [
1024
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { className: "ghx-section-title", children: t("panel.milestone") }),
1025
+ detail.milestone === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "ghx-muted", children: t("panel.noMilestone") }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1026
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: "var(--dsh-content-font-size-secondary, 13px)", lineHeight: "20px", fontWeight: 500 }, children: detail.milestone.title }),
1027
+ detail.milestone.dueOn !== null && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "ghx-muted", children: t("panel.due", { date: formatDue(detail.milestone.dueOn) }) }),
1028
+ detail.milestone.progress !== null && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1029
+ ProgressBar,
1030
+ {
1031
+ value: detail.milestone.progress,
1032
+ label: t("panel.progress", { percent: detail.milestone.progress })
1033
+ }
1034
+ )
1035
+ ] })
1036
+ ] }),
1037
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("section", { className: "ghx-section", children: [
1038
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { className: "ghx-section-title", children: t("panel.labels") }),
1039
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "ghx-chips", children: labelsWithoutPriority(detail).length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "ghx-muted", children: "\u2014" }) : labelsWithoutPriority(detail).map((label) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Chip, { label: label.name, color: label.color }, label.name)) })
1040
+ ] }),
1041
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("section", { className: "ghx-section", children: [
1042
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { className: "ghx-section-title", children: t("panel.assignees") }),
1043
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "ghx-assignees", children: detail.assignees.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "ghx-muted", children: t("panel.noAssignees") }) : detail.assignees.map((assignee) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "ghx-assignee", children: [
1044
+ assignee.avatarUrl === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "ghx-avatar ghx-avatar-fallback", "aria-hidden": "true", children: assignee.login.slice(0, 1) }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("img", { className: "ghx-avatar", src: assignee.avatarUrl, alt: "", width: 18, height: 18, loading: "lazy" }),
1045
+ assignee.login
1046
+ ] }, assignee.login)) })
1047
+ ] }),
1048
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("section", { className: "ghx-section", children: [
1049
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { className: "ghx-section-title", children: t("panel.linkedPRs") }),
1050
+ detail.linkedPRs.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "ghx-muted", children: t("panel.noPRs") }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "ghx-prs", children: detail.linkedPRs.map((pr) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(LinkedPRRow, { pr, t }, pr.number)) })
1051
+ ] }),
1052
+ snapshot.mentionedLoading === true && detail.mentionedPRs.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("section", { className: "ghx-section", children: [
1053
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { className: "ghx-section-title", children: t("panel.mentionedPRs") }),
1054
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "ghx-muted", children: t("panel.loading") })
1055
+ ] }),
1056
+ detail.mentionedPRs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("section", { className: "ghx-section", children: [
1057
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { className: "ghx-section-title", children: t("panel.mentionedPRs") }),
1058
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "ghx-prs", children: detail.mentionedPRs.map((pr) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(LinkedPRRow, { pr, t }, pr.number)) })
1059
+ ] }),
1060
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DetailFooter, { commentCount: detail.commentCount, updatedAt: detail.updatedAt, t })
1061
+ ] })
1062
+ ] });
1063
+ }
1064
+
1065
+ // src/client/views/IssueRow.tsx
1066
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1067
+ var ISSUE_MIME = "application/x-dsh-github-issue+json";
1068
+ var MAX_LABELS = 4;
1069
+ var MAX_ASSIGNEES = 3;
1070
+ var MAX_PRS = 2;
1071
+ var ISSUE_ROW_CSS = `
1072
+ .ghr-row{display:flex;flex-direction:column;gap:4px;box-sizing:border-box;padding:10px 8px;border-top:0.5px solid var(--dsw-alias-border-l2);cursor:pointer;outline:none;text-align:left;color:var(--dsw-alias-label-primary)}
1073
+ .ghr-row:first-child{border-top:0}
1074
+ .ghr-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
1075
+ .ghr-row:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px;border-radius:var(--dsw-radius-sm,6px)}
1076
+ .ghr-row[aria-pressed=true]{background:var(--dsw-alias-interactive-bg-hover)}
1077
+ .ghr-top{display:flex;align-items:center;gap:6px;min-width:0}
1078
+ .ghr-dot{width:8px;height:8px;border-radius:50%;flex:none}
1079
+ .ghr-ref{flex:none;font-family:var(--dsh-font-family-code,ui-monospace,SFMono-Regular,Menlo,monospace);font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary);text-decoration:none;max-width:50%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
1080
+ .ghr-ref:hover{color:var(--dsw-alias-link);text-decoration:underline}
1081
+ .ghr-private{display:inline-flex;align-items:center;color:var(--dsw-alias-label-tertiary);flex:none}
1082
+ .ghr-title{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow:hidden;font-size:var(--dsh-content-font-size,14px);line-height:20px;font-weight:500;color:var(--dsw-alias-label-primary);overflow-wrap:anywhere}
1083
+ .ghr-meta{display:flex;align-items:center;flex-wrap:wrap;gap:6px;min-width:0;color:var(--dsw-alias-label-tertiary)}
1084
+ .ghr-milestone{display:inline-flex;align-items:center;gap:6px;min-width:0;max-width:260px}
1085
+ .ghr-meta-item{display:inline-flex;align-items:center;gap:3px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary);white-space:nowrap}
1086
+ .ghr-avatar{width:16px;height:16px;border-radius:50%;flex:none;object-fit:cover}
1087
+ .ghr-avatar-fallback{display:inline-flex;align-items:center;justify-content:center;background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-secondary);font-size:9px;line-height:1;font-weight:600;text-transform:uppercase}
1088
+ .ghr-pr{display:inline-flex;align-items:center;gap:2px;padding:0 4px;border-radius:var(--dsw-radius-xs,4px);font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);text-decoration:none;background:var(--dsw-alias-bg-layer-2);white-space:nowrap}
1089
+ .ghr-pr:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
1090
+ .ghr-glyph{font-size:11px;line-height:1}
1091
+ `.trim();
1092
+ function IssueRow({ card, t, selected, onSelect, promptText }) {
1093
+ const tone = stateTone(card.state, card.stateReason);
1094
+ const updated = relativeTime(card.updatedAt);
1095
+ const renderable = labelsWithoutPriority(card);
1096
+ const labels = renderable.slice(0, MAX_LABELS);
1097
+ const hiddenLabels = renderable.length - labels.length;
1098
+ const assignees = card.assignees.slice(0, MAX_ASSIGNEES);
1099
+ const prs = card.linkedPRs.slice(0, MAX_PRS);
1100
+ const hiddenPRs = card.linkedPRs.length - prs.length;
1101
+ const handleDragStart = (event) => {
1102
+ const transfer = event.dataTransfer;
1103
+ transfer.setData("text/plain", promptText(card));
1104
+ transfer.setData(ISSUE_MIME, JSON.stringify(card));
1105
+ transfer.effectAllowed = "copy";
1106
+ };
1107
+ const handleKeyDown = (event) => {
1108
+ if (event.target !== event.currentTarget) return;
1109
+ if (event.key !== "Enter" && event.key !== " ") return;
1110
+ event.preventDefault();
1111
+ onSelect(card);
1112
+ };
1113
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1114
+ "div",
1115
+ {
1116
+ className: "ghr-row",
1117
+ role: "button",
1118
+ tabIndex: 0,
1119
+ "aria-pressed": selected,
1120
+ draggable: true,
1121
+ onClick: () => onSelect(card),
1122
+ onKeyDown: handleKeyDown,
1123
+ onDragStart: handleDragStart,
1124
+ "data-issue-id": card.id,
1125
+ children: [
1126
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "ghr-top", children: [
1127
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "ghr-dot", style: { background: TONE[tone].dot }, title: t(stateLabelKey(card.state)), "aria-hidden": "true" }),
1128
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1129
+ "a",
1130
+ {
1131
+ className: "ghr-ref",
1132
+ href: card.url,
1133
+ target: "_blank",
1134
+ rel: "noreferrer",
1135
+ onClick: (event) => event.stopPropagation(),
1136
+ children: [
1137
+ card.repo,
1138
+ "#",
1139
+ card.number
1140
+ ]
1141
+ }
1142
+ ),
1143
+ card.isPrivate && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "ghr-private", role: "img", "aria-label": t("panel.private"), title: t("panel.private"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(LinkGlyph, { size: 11 }) })
1144
+ ] }),
1145
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "ghr-title", children: card.title }),
1146
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "ghr-meta", children: [
1147
+ card.priority !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1148
+ Chip,
1149
+ {
1150
+ label: card.priority.name,
1151
+ tone: priorityTone(card.priority.name),
1152
+ dot: true,
1153
+ title: `${t("panel.priority")} \xB7 ${t(prioritySourceLabel(card.priority.source))}`
1154
+ }
1155
+ ),
1156
+ card.milestone !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1157
+ "span",
1158
+ {
1159
+ className: "ghr-milestone",
1160
+ title: card.milestone.dueOn === null ? t("panel.milestone") : t("panel.due", { date: formatDue(card.milestone.dueOn) }),
1161
+ children: [
1162
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Chip, { label: card.milestone.title, tone: "info", dot: true }),
1163
+ card.milestone.progress !== null && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1164
+ ProgressBar,
1165
+ {
1166
+ value: card.milestone.progress,
1167
+ width: 40,
1168
+ label: t("panel.progress", { percent: card.milestone.progress })
1169
+ }
1170
+ )
1171
+ ]
1172
+ }
1173
+ ),
1174
+ labels.map((label) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Chip, { label: label.name, color: label.color, title: label.name }, label.name)),
1175
+ hiddenLabels > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Chip, { label: t("panel.more", { count: hiddenLabels }) }),
1176
+ assignees.map((assignee) => assignee.avatarUrl === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "ghr-avatar ghr-avatar-fallback", title: assignee.login, "aria-label": assignee.login, children: assignee.login.slice(0, 1) }, assignee.login) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1177
+ "img",
1178
+ {
1179
+ className: "ghr-avatar",
1180
+ src: assignee.avatarUrl,
1181
+ alt: assignee.login,
1182
+ title: assignee.login,
1183
+ width: 16,
1184
+ height: 16,
1185
+ loading: "lazy"
1186
+ },
1187
+ assignee.login
1188
+ )),
1189
+ card.commentCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "ghr-meta-item", title: t("panel.comments", { count: card.commentCount }), children: [
1190
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CommentGlyph, { size: 11 }),
1191
+ card.commentCount
1192
+ ] }),
1193
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("time", { className: "ghr-meta-item", dateTime: card.updatedAt, title: card.updatedAt, children: updated }),
1194
+ prs.map((pr) => {
1195
+ const state = prGlyph(pr);
1196
+ const checks = checksGlyph(pr);
1197
+ const review = reviewGlyph(pr);
1198
+ const parts = [`#${pr.number}`, pr.title, t(state.label)];
1199
+ if (checks !== void 0) parts.push(t(checks.label, { count: pr.failingChecks?.length ?? 0 }));
1200
+ if (review !== void 0) parts.push(t(review.label));
1201
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1202
+ "a",
1203
+ {
1204
+ className: "ghr-pr",
1205
+ href: pr.url,
1206
+ target: "_blank",
1207
+ rel: "noreferrer",
1208
+ title: parts.join(" \xB7 "),
1209
+ onClick: (event) => event.stopPropagation(),
1210
+ children: [
1211
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "ghr-glyph", style: { color: TONE[state.tone].dot }, "aria-hidden": "true", children: state.glyph }),
1212
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
1213
+ "#",
1214
+ pr.number
1215
+ ] }),
1216
+ checks !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "ghr-glyph", style: { color: TONE[checks.tone].dot }, "aria-hidden": "true", children: checks.glyph }),
1217
+ review !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "ghr-glyph", style: { color: TONE[review.tone].dot }, "aria-hidden": "true", children: review.glyph })
1218
+ ]
1219
+ },
1220
+ pr.number
1221
+ );
1222
+ }),
1223
+ hiddenPRs > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { tone: "neutral", title: t("panel.linkedPRs"), children: t("panel.more", { count: hiddenPRs }) })
1224
+ ] })
1225
+ ]
1226
+ }
1227
+ );
1228
+ }
1229
+
1230
+ // src/client/views/Page.tsx
1231
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1232
+ var PAGE_ROOT_STYLE = {
1233
+ height: "100%",
1234
+ overflow: "auto",
1235
+ boxSizing: "border-box",
1236
+ color: "var(--dsw-alias-label-primary)",
1237
+ background: "var(--dsw-alias-bg-base)"
1238
+ };
1239
+ var PAGE_CONTENT_STYLE = {
1240
+ width: "100%",
1241
+ maxWidth: 960,
1242
+ margin: "0 auto",
1243
+ boxSizing: "border-box",
1244
+ padding: "0 clamp(24px, 4vw, 48px) 48px"
1245
+ };
1246
+ var PAGE_HEAD_STYLE = {
1247
+ display: "flex",
1248
+ justifyContent: "space-between",
1249
+ alignItems: "flex-start",
1250
+ gap: 16,
1251
+ flexWrap: "wrap",
1252
+ paddingTop: "calc(28px + var(--dsh-frame-top-clearance, 0px))"
1253
+ };
1254
+ var PAGE_H1_STYLE = {
1255
+ margin: 0,
1256
+ fontSize: 20,
1257
+ lineHeight: "28px",
1258
+ fontWeight: 500,
1259
+ color: "var(--dsw-alias-label-primary)"
1260
+ };
1261
+ var PAGE_SUBTITLE_STYLE = {
1262
+ marginTop: 2,
1263
+ fontSize: 13,
1264
+ lineHeight: "20px",
1265
+ color: "var(--dsw-alias-label-secondary)"
1266
+ };
1267
+ var PAGE_CSS = `
1268
+ .ghp-page{box-sizing:border-box;height:100%;overflow:auto;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-base);font-size:var(--dsh-content-font-size,14px)}
1269
+ .ghp-content{box-sizing:border-box;width:100%;max-width:960px;margin:0 auto;padding:0 clamp(24px,4vw,48px) 48px}
1270
+ .ghp-head{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;flex-wrap:wrap}
1271
+ .ghp-title-block{min-width:0}
1272
+ .ghp-h1{margin:0;font-size:20px;line-height:28px;font-weight:500;color:var(--dsw-alias-label-primary)}
1273
+ .ghp-subtitle{margin-top:2px;font-size:13px;line-height:20px;color:var(--dsw-alias-label-secondary)}
1274
+ .ghp-head-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end}
1275
+ .ghp-scope{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px;align-items:end;margin-top:18px}
1276
+ .ghp-field{display:flex;flex-direction:column;gap:4px;min-width:0}
1277
+ .ghp-field-label{font-size:12px;line-height:16px;color:var(--dsw-alias-label-tertiary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
1278
+ .ghp-field .gh-select-wrap{width:100%;min-width:0}
1279
+ .ghp-field .gh-select-wrap .gh-field-label{display:none}
1280
+ .ghp-field .gh-select{width:100%;height:30px;box-sizing:border-box}
1281
+ .ghp-field .gh-input{width:100%;height:30px;box-sizing:border-box}
1282
+ .ghp-notice{display:flex;flex-direction:column;gap:6px;box-sizing:border-box;width:100%;padding:10px 12px;border:0.5px solid var(--dsw-alias-state-warn-primary);border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-state-warn-tertiary,var(--dsw-alias-bg-layer-1));font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);margin-top:12px}
1283
+ .ghp-filters{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:16px 0 8px}
1284
+ .ghp-search{display:flex;align-items:center;gap:6px;flex:1;min-width:180px;max-width:360px;height:32px;padding:0 4px 0 10px;box-sizing:border-box;border:0.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-md,8px);color:var(--dsw-alias-label-tertiary);background:var(--dsw-alias-bg-base)}
1285
+ .ghp-search:hover{border-color:var(--dsw-alias-border-l2)}
1286
+ .ghp-search:focus-within{border-color:var(--dsw-alias-state-business-primary,var(--dsw-alias-link))}
1287
+ .ghp-search .gh-input{flex:1;min-width:0;height:30px;width:auto;padding:0;border:0;background:transparent}
1288
+ .ghp-search .gh-input:hover,.ghp-search .gh-input:focus{border:0}
1289
+ .ghp-search-icon{display:inline-flex;align-items:center;color:var(--dsw-alias-label-tertiary);flex:none}
1290
+ .ghp-muted{font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary)}
1291
+ .ghp-body{display:block;margin-top:4px}
1292
+ .ghp-split{display:flex;align-items:flex-start;gap:24px}
1293
+ .ghp-list-pane{flex:1;min-width:0}
1294
+ .ghp-footer{display:flex;justify-content:center;padding-top:16px}
1295
+ .ghp-skeleton-row{display:flex;flex-direction:column;gap:6px;padding:12px 8px;border-top:0.5px solid var(--dsw-alias-border-l2)}
1296
+ .ghp-skeleton-row:first-child{border-top:0}
1297
+ .ghp-skeleton-line{height:10px;border-radius:var(--dsw-radius-xs,4px);background:var(--dsw-alias-bg-skeleton,var(--dsw-alias-bg-layer-2));animation:gh-pulse 1.4s ease-in-out infinite}
1298
+ @keyframes gh-pulse{0%,100%{opacity:.55}50%{opacity:1}}
1299
+ @media (max-width:760px){.ghp-split{flex-direction:column}.ghp-split .ghx-pane{flex:1 1 auto;width:100%;padding-left:0;border-left:0;padding-top:16px;border-top:0.5px solid var(--dsw-alias-border-l2)}}
1300
+ `.trim();
1301
+ var STATE_LABEL = {
1302
+ open: "panel.state.open",
1303
+ closed: "panel.state.closed",
1304
+ all: "panel.state.all"
1305
+ };
1306
+ function Field(props) {
1307
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "ghp-field", children: [
1308
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "ghp-field-label", children: props.label }),
1309
+ props.children
1310
+ ] });
1311
+ }
1312
+ function ScopeCombo(props) {
1313
+ const { label, value, placeholder, options, disabled, onChange } = props;
1314
+ const listId = (0, import_react2.useId)();
1315
+ const selected = options.find((option) => option.value === value);
1316
+ const [text, setText] = (0, import_react2.useState)(selected?.label ?? "");
1317
+ (0, import_react2.useEffect)(() => {
1318
+ const current = options.find((option) => option.value === value);
1319
+ setText(current?.label ?? "");
1320
+ }, [value, options]);
1321
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
1322
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1323
+ "input",
1324
+ {
1325
+ className: "gh-input",
1326
+ list: listId,
1327
+ value: text,
1328
+ disabled: disabled === true,
1329
+ placeholder,
1330
+ "aria-label": label,
1331
+ onChange: (event) => {
1332
+ const next = event.target.value;
1333
+ setText(next);
1334
+ if (next === "") {
1335
+ onChange(void 0);
1336
+ return;
1337
+ }
1338
+ const match = options.find((option) => option.label === next || option.value === next);
1339
+ if (match !== void 0) onChange(match.value);
1340
+ },
1341
+ onBlur: () => {
1342
+ const current = options.find((option) => option.value === value);
1343
+ setText(current?.label ?? "");
1344
+ }
1345
+ }
1346
+ ),
1347
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("datalist", { id: listId, children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: option.label }, option.value)) })
1348
+ ] });
1349
+ }
1350
+ function GitHubPage({ snapshot, actions, t, resolveSession }) {
1351
+ const [filter, setFilter] = (0, import_react2.useState)("");
1352
+ const prefs = snapshot.prefs;
1353
+ (0, import_react2.useEffect)(() => {
1354
+ if (snapshot.catalog === void 0) actions.loadCatalog();
1355
+ }, [snapshot.catalog, actions]);
1356
+ const items = snapshot.list?.items;
1357
+ const filtered = (0, import_react2.useMemo)(() => {
1358
+ const all = items ?? [];
1359
+ const query = filter.trim().toLowerCase();
1360
+ if (query === "") return all;
1361
+ return all.filter((card) => {
1362
+ const haystack = `${card.repo}#${card.number} ${card.title} ${card.labels.map((label) => label.name).join(" ")}`;
1363
+ return haystack.toLowerCase().includes(query);
1364
+ });
1365
+ }, [items, filter]);
1366
+ const stateOptions = Object.keys(STATE_LABEL).map((state) => ({
1367
+ value: state,
1368
+ label: t(STATE_LABEL[state])
1369
+ }));
1370
+ const orgs = snapshot.catalog?.orgs ?? [];
1371
+ const orgOptions = [
1372
+ { value: "", label: t("panel.allOrgs") },
1373
+ ...orgs.map((org) => ({ value: org.login, label: org.name === void 0 ? org.login : `${org.login} \xB7 ${org.name}` }))
1374
+ ];
1375
+ const projectOptions = [
1376
+ { value: "", label: t("panel.allProjects") },
1377
+ ...(snapshot.orgProjects ?? []).map((project) => ({ value: project.id, label: project.title }))
1378
+ ];
1379
+ const repoSource = prefs.org === void 0 ? snapshot.catalog?.repos ?? [] : snapshot.orgRepos?.items ?? [];
1380
+ const repoOptions = repoSource.map((repo) => ({
1381
+ value: repo.nameWithOwner,
1382
+ label: `${repo.nameWithOwner}${repo.isPrivate ? ` \xB7 ${t("panel.private")}` : ""}${repo.isFork === true ? ` \xB7 ${t("panel.fork")}` : ""}`
1383
+ }));
1384
+ const assigneeOptions = [
1385
+ { value: "@me", label: t("panel.assignee.me") },
1386
+ { value: "all", label: t("panel.assignee.all") }
1387
+ ];
1388
+ const totalCount = snapshot.list?.totalCount;
1389
+ const waitingForDetail = snapshot.selected !== void 0 && snapshot.detail === void 0;
1390
+ const listError = snapshot.error !== void 0 && !waitingForDetail ? snapshot.error : void 0;
1391
+ const showSkeleton = snapshot.loading && snapshot.list === void 0;
1392
+ const showEmpty = !snapshot.loading && listError === void 0 && filtered.length === 0;
1393
+ const noAuth = snapshot.status?.signedIn === false;
1394
+ const subtitle = snapshot.status?.signedIn === true && snapshot.status.login !== void 0 ? t("settings.signedIn", { login: snapshot.status.login }) : snapshot.loading ? t("panel.loading") : "";
1395
+ const split = snapshot.selected !== void 0;
1396
+ const scopeHint = prefs.org === void 0 ? t("panel.scopeGlobal") : `${prefs.org}${prefs.projectId === void 0 ? "" : ` \xB7 ${t("panel.project")}`}${prefs.repo === void 0 ? "" : ` \xB7 ${prefs.repo}`}`;
1397
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("section", { className: "ghp-page", style: PAGE_ROOT_STYLE, "data-github-panel": true, "aria-label": t("panel"), children: [
1398
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(StyleSheet, { chunks: [CONTROLS_CSS, PAGE_CSS, ISSUE_ROW_CSS, ISSUE_DETAIL_CSS] }),
1399
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "ghp-content", style: PAGE_CONTENT_STYLE, children: [
1400
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("header", { className: "ghp-head", style: PAGE_HEAD_STYLE, "data-window-drag": true, children: [
1401
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "ghp-title-block", children: [
1402
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h1", { className: "ghp-h1", style: PAGE_H1_STYLE, children: t("panel") }),
1403
+ (subtitle !== "" || scopeHint !== "") && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "ghp-subtitle", style: PAGE_SUBTITLE_STYLE, children: [
1404
+ subtitle,
1405
+ subtitle !== "" && scopeHint !== "" ? " \xB7 " : "",
1406
+ scopeHint
1407
+ ] })
1408
+ ] }),
1409
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "ghp-head-actions", children: [
1410
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Button, { variant: "ghost", onClick: () => actions.openInSidebar(), children: t("panel.openSidebar") }),
1411
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Button, { variant: "outline", onClick: () => actions.refresh(), disabled: snapshot.loading, children: [
1412
+ snapshot.loading ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Spinner, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(RefreshGlyph, { size: 13 }),
1413
+ snapshot.loading ? t("panel.loading") : t("panel.refresh")
1414
+ ] })
1415
+ ] })
1416
+ ] }),
1417
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "ghp-scope", children: [
1418
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Field, { label: t("panel.org"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1419
+ Select,
1420
+ {
1421
+ ariaLabel: t("panel.org"),
1422
+ value: prefs.org ?? "",
1423
+ options: orgOptions,
1424
+ onChange: (value) => actions.setOrg(value === "" ? void 0 : value)
1425
+ }
1426
+ ) }),
1427
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Field, { label: t("panel.project"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1428
+ Select,
1429
+ {
1430
+ ariaLabel: t("panel.project"),
1431
+ value: prefs.org === void 0 ? "" : prefs.projectId ?? "",
1432
+ options: projectOptions,
1433
+ disabled: prefs.org === void 0 || snapshot.projectsBlocked,
1434
+ onChange: (value) => actions.setProject(value === "" ? void 0 : value)
1435
+ }
1436
+ ) }),
1437
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Field, { label: t("panel.repoFilter"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1438
+ ScopeCombo,
1439
+ {
1440
+ label: t("panel.repoFilter"),
1441
+ value: prefs.repo,
1442
+ placeholder: prefs.org === void 0 ? t("panel.allRepos") : `${t("panel.allRepos")}\uFF08${String(repoOptions.length)}\uFF09`,
1443
+ options: repoOptions,
1444
+ onChange: (repo) => actions.setRepo(repo)
1445
+ }
1446
+ ) }),
1447
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Field, { label: t("panel.assignee"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1448
+ Select,
1449
+ {
1450
+ ariaLabel: t("panel.assignee"),
1451
+ value: prefs.assignee,
1452
+ options: assigneeOptions,
1453
+ onChange: (value) => actions.setAssignee(value)
1454
+ }
1455
+ ) }),
1456
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Field, { label: t("panel.stateFilter"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1457
+ Select,
1458
+ {
1459
+ ariaLabel: t("panel.stateFilter"),
1460
+ value: prefs.state,
1461
+ options: stateOptions,
1462
+ onChange: (value) => actions.setStateFilter(value)
1463
+ }
1464
+ ) })
1465
+ ] }),
1466
+ prefs.org === void 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "ghp-notice", role: "note", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: t("panel.pickOrgHint") }) }),
1467
+ snapshot.projectsBlocked && prefs.org !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "ghp-notice", role: "note", children: [
1468
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: t("panel.projectsBlocked") }),
1469
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1470
+ CommandBlock,
1471
+ {
1472
+ command: PROJECT_SCOPE_COMMAND,
1473
+ copyLabel: t("panel.copyCommand"),
1474
+ onCopy: () => actions.copyText(PROJECT_SCOPE_COMMAND)
1475
+ }
1476
+ )
1477
+ ] }),
1478
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "ghp-filters", children: [
1479
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "ghp-search", children: [
1480
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "ghp-search-icon", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SearchGlyph, { size: 13 }) }),
1481
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1482
+ TextInput,
1483
+ {
1484
+ value: filter,
1485
+ onChange: setFilter,
1486
+ placeholder: t("panel.search"),
1487
+ ariaLabel: t("panel.search")
1488
+ }
1489
+ ),
1490
+ filter !== "" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(IconButton, { label: t("panel.clearSearch"), onClick: () => setFilter(""), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CloseGlyph, { size: 12 }) })
1491
+ ] }),
1492
+ totalCount !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "ghp-muted", children: t("panel.total", { count: totalCount }) }),
1493
+ snapshot.scopeLoading && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "ghp-muted", children: t("panel.loadingScope") })
1494
+ ] }),
1495
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: split ? "ghp-body ghp-split" : "ghp-body", children: [
1496
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "ghp-list-pane", children: [
1497
+ listError !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1498
+ ErrorBanner,
1499
+ {
1500
+ message: t("panel.error", { message: listError.message }),
1501
+ retryLabel: t("panel.refresh"),
1502
+ onRetry: () => actions.refresh(),
1503
+ children: listError.code === "missing_scope" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1504
+ CommandBlock,
1505
+ {
1506
+ command: PROJECT_SCOPE_COMMAND,
1507
+ copyLabel: t("panel.copyCommand"),
1508
+ onCopy: () => actions.copyText(PROJECT_SCOPE_COMMAND)
1509
+ }
1510
+ )
1511
+ }
1512
+ ),
1513
+ showSkeleton && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "ghp-list", "aria-hidden": "true", children: [0, 1, 2, 3, 4].map((index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "ghp-skeleton-row", children: [
1514
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "ghp-skeleton-line", style: { width: `${String(30 + index * 8)}%` } }),
1515
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "ghp-skeleton-line", style: { width: `${String(70 + index % 3 * 8)}%` } })
1516
+ ] }, index)) }),
1517
+ showEmpty && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1518
+ EmptyState,
1519
+ {
1520
+ icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(GitHubIcon, { size: 28 }),
1521
+ title: noAuth ? t("panel.emptyAuth") : snapshot.list?.notice ?? emptyTitle(prefs, snapshot.list?.totalCount, t)
1522
+ }
1523
+ ),
1524
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "ghp-list", children: filtered.map((card) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1525
+ IssueRow,
1526
+ {
1527
+ card,
1528
+ t,
1529
+ selected: snapshot.selected?.id === card.id,
1530
+ onSelect: (selected) => actions.selectIssue(selected),
1531
+ promptText: (target) => actions.promptText(target)
1532
+ },
1533
+ card.id
1534
+ )) }),
1535
+ snapshot.list !== void 0 && snapshot.list.pageInfo.hasNextPage && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "ghp-footer", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Button, { variant: "outline", size: "sm", onClick: () => actions.loadMore(), disabled: snapshot.loadingMore, children: [
1536
+ snapshot.loadingMore && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Spinner, { size: 12 }),
1537
+ snapshot.loadingMore ? t("panel.loading") : t("panel.loadMore")
1538
+ ] }) }),
1539
+ snapshot.list !== void 0 && !snapshot.list.pageInfo.hasNextPage && filtered.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "ghp-footer", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "ghp-muted", children: t("panel.showing", { count: filtered.length }) }) })
1540
+ ] }),
1541
+ split && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(IssueDetailPane, { snapshot, actions, t, resolveSession })
1542
+ ] })
1543
+ ] }),
1544
+ snapshot.toast !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Toast, { text: t(snapshot.toast), onDismiss: () => actions.clearToast(), dismissLabel: t("panel.close") })
1545
+ ] });
1546
+ }
1547
+ function emptyTitle(prefs, total, t) {
1548
+ const projectId = prefs.org === void 0 ? void 0 : prefs.projectId;
1549
+ if (projectId !== void 0 && prefs.assignee === "@me") {
1550
+ return t("panel.emptyProjectMe", { count: total ?? 0 });
1551
+ }
1552
+ if (projectId !== void 0 && prefs.state === "open") {
1553
+ return t("panel.emptyProjectOpen");
1554
+ }
1555
+ return t("panel.empty");
1556
+ }
1557
+
1558
+ // src/client/views/Settings.tsx
1559
+ var import_react3 = require("react");
1560
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1561
+ var SETTINGS_CSS = `
1562
+ .ghs-cards{display:flex;flex-direction:column;gap:16px;margin-top:20px;padding-bottom:8px}
1563
+ .ghs-card{display:flex;flex-direction:column;gap:10px;box-sizing:border-box;padding:16px;border:0.5px solid var(--dsw-alias-settings-card-stroke,var(--dsw-alias-border-l3));border-radius:var(--dsw-radius-xl,16px);background:var(--dsw-alias-settings-card-fill,var(--dsw-alias-bg-layer-1))}
1564
+ .ghs-card-head{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
1565
+ .ghs-card-title{margin:0;font-size:var(--dsh-content-font-size,14px);line-height:22px;font-weight:500;color:var(--dsw-alias-label-primary)}
1566
+ .ghs-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
1567
+ .ghs-kv{display:flex;flex-direction:column;gap:4px;margin:0}
1568
+ .ghs-kv-row{display:flex;gap:8px;align-items:baseline;font-size:12px;line-height:18px}
1569
+ .ghs-kv-row dt{flex:none;min-width:88px;margin:0;color:var(--dsw-alias-label-tertiary)}
1570
+ .ghs-kv-row dd{margin:0;color:var(--dsw-alias-label-primary);overflow-wrap:anywhere}
1571
+ .ghs-scopes{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
1572
+ .ghs-warn{display:flex;flex-direction:column;gap:6px;box-sizing:border-box;padding:10px 12px;border:0.5px solid var(--dsw-alias-state-warn-primary);border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-state-warn-tertiary,var(--dsw-alias-bg-layer-1));font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary)}
1573
+ .ghs-choices{display:flex;flex-direction:column;gap:6px}
1574
+ .ghs-choice{display:flex;align-items:center;gap:8px;box-sizing:border-box;width:100%;padding:8px 10px;border:0.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-md,8px);background:transparent;color:var(--dsw-alias-label-secondary);font-family:inherit;font-size:var(--dsh-content-font-size-secondary,13px);line-height:20px;cursor:pointer;text-align:left}
1575
+ .ghs-choice:hover{background:var(--dsw-alias-interactive-bg-hover)}
1576
+ .ghs-choice[aria-checked=true]{border-color:var(--dsw-alias-state-business-primary,var(--dsw-alias-link));background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary)}
1577
+ .ghs-choice:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}
1578
+ .ghs-choice-dot{box-sizing:border-box;width:14px;height:14px;border:1.5px solid var(--dsw-alias-border-l3);border-radius:50%;flex:none}
1579
+ .ghs-choice[aria-checked=true] .ghs-choice-dot{border:4px solid var(--dsw-alias-state-business-primary,var(--dsw-alias-link))}
1580
+ .ghs-field{display:flex;flex-direction:column;gap:6px}
1581
+ .ghs-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
1582
+ .ghs-about{display:flex;flex-direction:column;gap:6px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary)}
1583
+ .ghs-about p{margin:0}
1584
+ .ghs-page-head{padding-bottom:0}
1585
+ `.trim();
1586
+ var CARDS_STYLE = { display: "flex", flexDirection: "column" };
1587
+ function GitHubSettings({ snapshot, actions, t }) {
1588
+ const status = snapshot.status;
1589
+ const prefs = snapshot.prefs;
1590
+ const [template, setTemplate] = (0, import_react3.useState)(prefs.promptTemplate);
1591
+ (0, import_react3.useEffect)(() => {
1592
+ setTemplate(prefs.promptTemplate);
1593
+ }, [prefs.promptTemplate]);
1594
+ const authTone = status === void 0 ? "neutral" : status.ghInstalled === false ? "error" : status.signedIn ? "success" : "warn";
1595
+ const authLabel = status === void 0 ? t("settings.loading") : status.ghInstalled === false ? t("settings.ghMissing") : status.signedIn ? t("settings.signedIn", { login: status.login ?? status.host }) : t("settings.signedOut");
1596
+ const subtitle = status === void 0 ? t("settings.loading") : status.signedIn ? t("settings.signedIn", { login: status.login ?? status.host }) : t("settings.signedOut");
1597
+ const resetTemplate = () => {
1598
+ setTemplate(DEFAULT_PROMPT_TEMPLATE);
1599
+ actions.savePrefs({ promptTemplate: DEFAULT_PROMPT_TEMPLATE });
1600
+ };
1601
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("section", { className: "ghp-page", style: PAGE_ROOT_STYLE, "data-github-settings": true, "aria-label": t("settings.title"), children: [
1602
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(StyleSheet, { chunks: [CONTROLS_CSS, PAGE_CSS, SETTINGS_CSS] }),
1603
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "ghp-content", style: PAGE_CONTENT_STYLE, children: [
1604
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("header", { className: "ghp-head", style: PAGE_HEAD_STYLE, "data-window-drag": true, children: [
1605
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "ghp-title-block", children: [
1606
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h1", { className: "ghp-h1", style: PAGE_H1_STYLE, children: t("settings.title") }),
1607
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "ghp-subtitle", style: PAGE_SUBTITLE_STYLE, children: subtitle })
1608
+ ] }),
1609
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "ghp-head-actions", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Button, { variant: "outline", onClick: () => actions.refresh(), disabled: snapshot.loading, children: [
1610
+ snapshot.loading ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Spinner, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(RefreshGlyph, { size: 13 }),
1611
+ snapshot.loading ? t("settings.loading") : t("settings.refresh")
1612
+ ] }) })
1613
+ ] }),
1614
+ snapshot.error !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1615
+ ErrorBanner,
1616
+ {
1617
+ message: t("settings.error", { message: snapshot.error.message }),
1618
+ retryLabel: t("settings.refresh"),
1619
+ onRetry: () => actions.refresh()
1620
+ }
1621
+ ),
1622
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "ghs-cards", style: CARDS_STYLE, children: [
1623
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("section", { className: "ghs-card", "aria-labelledby": "gh-settings-auth", children: [
1624
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "ghs-card-head", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h2", { className: "ghs-card-title", id: "gh-settings-auth", children: t("settings.auth") }) }),
1625
+ status === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "ghp-muted", children: t("settings.loading") }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
1626
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "ghs-row", children: [
1627
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Pill, { tone: authTone, dot: true, children: authLabel }),
1628
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "ghp-muted", children: t("settings.authModeGh") })
1629
+ ] }),
1630
+ status.error !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ErrorBanner, { message: t("settings.error", { message: status.error }) }),
1631
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("dl", { className: "ghs-kv", children: [
1632
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "ghs-kv-row", children: [
1633
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dt", { children: t("settings.login") }),
1634
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dd", { children: status.login ?? "\u2014" })
1635
+ ] }),
1636
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "ghs-kv-row", children: [
1637
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dt", { children: t("settings.host") }),
1638
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dd", { children: status.host })
1639
+ ] }),
1640
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "ghs-kv-row", children: [
1641
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dt", { children: t("settings.tokenSource") }),
1642
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dd", { children: status.tokenSource ?? "\u2014" })
1643
+ ] })
1644
+ ] }),
1645
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "ghs-scopes", children: [
1646
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "gh-field-label", children: t("settings.scopes") }),
1647
+ status.scopes.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "ghp-muted", children: "\u2014" }) : status.scopes.map((scope) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Badge, { tone: "neutral", children: scope }, scope))
1648
+ ] }),
1649
+ status.missingProjectScope && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "ghs-warn", role: "note", children: [
1650
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: t("settings.missingProject") }),
1651
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "ghp-muted", children: t("settings.command") }),
1652
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1653
+ CommandBlock,
1654
+ {
1655
+ command: PROJECT_SCOPE_COMMAND,
1656
+ copyLabel: t("settings.copy"),
1657
+ onCopy: () => actions.copyText(PROJECT_SCOPE_COMMAND)
1658
+ }
1659
+ )
1660
+ ] })
1661
+ ] })
1662
+ ] }),
1663
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("section", { className: "ghs-card", "aria-labelledby": "gh-settings-handoff", children: [
1664
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h2", { className: "ghs-card-title", id: "gh-settings-handoff", children: t("settings.handoff") }),
1665
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "ghs-choices", role: "radiogroup", "aria-label": t("settings.handoff"), children: ["draft", "send"].map((mode) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1666
+ "button",
1667
+ {
1668
+ type: "button",
1669
+ role: "radio",
1670
+ "aria-checked": prefs.handoffMode === mode,
1671
+ className: "ghs-choice",
1672
+ onClick: () => actions.savePrefs({ handoffMode: mode }),
1673
+ children: [
1674
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "ghs-choice-dot", "aria-hidden": "true" }),
1675
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: mode === "draft" ? t("settings.handoff.draft") : t("settings.handoff.send") })
1676
+ ]
1677
+ },
1678
+ mode
1679
+ )) })
1680
+ ] }),
1681
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("section", { className: "ghs-card", "aria-labelledby": "gh-settings-template", children: [
1682
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h2", { className: "ghs-card-title", id: "gh-settings-template", children: t("settings.template") }),
1683
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "ghs-field", children: [
1684
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1685
+ TextArea,
1686
+ {
1687
+ value: template,
1688
+ onChange: setTemplate,
1689
+ ariaLabel: t("settings.template"),
1690
+ rows: 9,
1691
+ mono: true
1692
+ }
1693
+ ),
1694
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "ghp-muted", children: t("settings.template.help") })
1695
+ ] }),
1696
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "ghs-actions", children: [
1697
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1698
+ Button,
1699
+ {
1700
+ variant: "primary",
1701
+ size: "sm",
1702
+ onClick: () => actions.savePrefs({ promptTemplate: template }),
1703
+ disabled: template === prefs.promptTemplate,
1704
+ children: t("settings.save")
1705
+ }
1706
+ ),
1707
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button, { variant: "ghost", size: "sm", onClick: resetTemplate, children: t("settings.reset") })
1708
+ ] })
1709
+ ] }),
1710
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("section", { className: "ghs-card", "aria-labelledby": "gh-settings-about", children: [
1711
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h2", { className: "ghs-card-title", id: "gh-settings-about", children: t("settings.about") }),
1712
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "ghs-about", children: [
1713
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: t("settings.aboutText") }),
1714
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: t("settings.credentialHint") })
1715
+ ] })
1716
+ ] })
1717
+ ] })
1718
+ ] }),
1719
+ snapshot.toast !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Toast, { text: t(snapshot.toast), onDismiss: () => actions.clearToast(), dismissLabel: t("panel.close") })
1720
+ ] });
1721
+ }
1722
+
1723
+ // src/client/views/Sidebar.tsx
1724
+ var import_react4 = require("react");
1725
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1726
+ var SIDEBAR_CSS = `
1727
+ .ghs-wrap{display:flex;flex-direction:column;height:100%;min-height:0;box-sizing:border-box;color:var(--dsw-alias-label-primary);font-size:13px}
1728
+ .ghs-head{display:flex;align-items:center;gap:8px;padding:10px 12px 6px;flex:none}
1729
+ .ghs-scope{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;color:var(--dsw-alias-label-tertiary)}
1730
+ .ghs-search{padding:0 12px 8px;flex:none}
1731
+ .ghs-list{flex:1;min-height:0;overflow:auto;padding:2px 6px 6px}
1732
+ .ghs-row{display:flex;gap:8px;align-items:flex-start;box-sizing:border-box;padding:7px 8px;border-radius:8px;cursor:grab;user-select:none}
1733
+ .ghs-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
1734
+ .ghs-row:active{cursor:grabbing}
1735
+ .ghs-row:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-1px}
1736
+ .ghs-dot{width:7px;height:7px;border-radius:50%;flex:none;margin-top:6px}
1737
+ .ghs-row-main{flex:1;min-width:0}
1738
+ .ghs-row-head{display:flex;align-items:center;gap:6px;min-width:0}
1739
+ .ghs-ref{font-family:var(--dsh-font-family-code,ui-monospace,SFMono-Regular,Menlo,monospace);font-size:11px;color:var(--dsw-alias-label-tertiary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
1740
+ .ghs-state{font-size:10px;line-height:14px;padding:0 5px;border-radius:999px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);flex:none}
1741
+ .ghs-title{margin-top:2px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-primary);display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow:hidden}
1742
+ .ghs-empty{padding:24px 12px}
1743
+ .ghs-loading{display:flex;align-items:center;justify-content:center;gap:8px;padding:28px 12px;color:var(--dsw-alias-label-tertiary);font-size:12px}
1744
+ .ghs-hint{padding:8px 12px 10px;border-top:0.5px solid var(--dsw-alias-border-l2);flex:none;color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}
1745
+ `.trim();
1746
+ function GitHubSidebar({ snapshot, actions, t }) {
1747
+ const [query, setQuery] = (0, import_react4.useState)("");
1748
+ const items = snapshot.list?.items;
1749
+ const filtered = (0, import_react4.useMemo)(() => {
1750
+ const all = items ?? [];
1751
+ const needle = query.trim().toLowerCase();
1752
+ if (needle === "") return all;
1753
+ return all.filter((card) => `${card.repo}#${String(card.number)} ${card.title}`.toLowerCase().includes(needle));
1754
+ }, [items, query]);
1755
+ const scope = snapshot.prefs.projectId === void 0 ? snapshot.prefs.org ?? t("panel.scopeGlobal") : t("panel.project");
1756
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "ghs-wrap", "data-github-sidebar": true, children: [
1757
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(StyleSheet, { chunks: [CONTROLS_CSS, SIDEBAR_CSS] }),
1758
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "ghs-head", children: [
1759
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "ghs-scope", title: scope, children: `${scope} \xB7 ${String(snapshot.list?.totalCount ?? 0)}` }),
1760
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { size: "sm", variant: "ghost", onClick: () => actions.refresh(), disabled: snapshot.loading, children: t("panel.refresh") })
1761
+ ] }),
1762
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "ghs-search", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1763
+ TextInput,
1764
+ {
1765
+ value: query,
1766
+ onChange: setQuery,
1767
+ ariaLabel: t("sidebar.search"),
1768
+ placeholder: t("sidebar.search")
1769
+ }
1770
+ ) }),
1771
+ snapshot.list === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "ghs-loading", children: [
1772
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Spinner, {}),
1773
+ t("panel.loading")
1774
+ ] }) : filtered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "ghs-empty", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(EmptyState, { title: t("sidebar.empty"), hint: t("sidebar.emptyHint"), icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GitHubIcon, { size: 18 }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "ghs-list", role: "list", children: filtered.map((card) => {
1775
+ const tone = stateTone(card.state, card.stateReason);
1776
+ const ref = `${card.repo}#${String(card.number)}`;
1777
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1778
+ "div",
1779
+ {
1780
+ className: "ghs-row",
1781
+ role: "listitem",
1782
+ draggable: true,
1783
+ tabIndex: 0,
1784
+ title: `${ref}
1785
+ ${card.title}`,
1786
+ onDragStart: (event) => {
1787
+ actions.dragIssue(card);
1788
+ event.dataTransfer.effectAllowed = "copy";
1789
+ event.dataTransfer.setData("text/plain", ref);
1790
+ },
1791
+ onDragEnd: () => actions.endDrag(),
1792
+ onClick: () => actions.openInPanel(card),
1793
+ onKeyDown: (event) => {
1794
+ if (event.key === "Enter" || event.key === " ") {
1795
+ event.preventDefault();
1796
+ actions.openInPanel(card);
1797
+ }
1798
+ },
1799
+ children: [
1800
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "ghs-dot", style: { background: TONE[tone].dot }, "aria-hidden": "true" }),
1801
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "ghs-row-main", children: [
1802
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "ghs-row-head", children: [
1803
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "ghs-ref", children: ref }),
1804
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "ghs-state", children: t(stateLabelKey(card.state)) })
1805
+ ] }),
1806
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "ghs-title", children: card.title })
1807
+ ] })
1808
+ ]
1809
+ },
1810
+ `${ref}`
1811
+ );
1812
+ }) }),
1813
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "ghs-hint", children: t("sidebar.dragHint") })
1814
+ ] });
1815
+ }
1816
+
1817
+ // src/client/containers.tsx
1818
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1819
+ var EMPTY_SESSIONS = { byId: {} };
1820
+ var EMPTY_WORKSPACES = { items: [] };
1821
+ function usePanel(store) {
1822
+ return (0, import_react5.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
1823
+ }
1824
+ function useCatalog(source, empty) {
1825
+ const subscribe = (0, import_react5.useCallback)(
1826
+ (listener) => source?.subscribe(listener) ?? (() => {
1827
+ }),
1828
+ [source]
1829
+ );
1830
+ const snapshot = (0, import_react5.useCallback)(() => source?.getSnapshot() ?? empty, [source, empty]);
1831
+ return (0, import_react5.useSyncExternalStore)(subscribe, snapshot, snapshot);
1832
+ }
1833
+ function resolveSessionLink(sessions, workspaces, sessionId) {
1834
+ const workspace = workspaces.items?.find((item) => item.sessionIds?.includes(sessionId));
1835
+ const title = sessions.byId?.[sessionId]?.title;
1836
+ const archived = workspaces.archivedSessionIds?.includes(sessionId) ?? false;
1837
+ const known = sessions.byId?.[sessionId] !== void 0 || workspace !== void 0;
1838
+ return {
1839
+ sessionId,
1840
+ title: typeof title === "string" && title.trim() !== "" ? title : sessionId,
1841
+ ...typeof workspace?.title === "string" && workspace.title !== "" ? { workspaceTitle: workspace.title } : {},
1842
+ available: known && !archived
1843
+ };
1844
+ }
1845
+ function PageHost({ store, t, runtime }) {
1846
+ const snapshot = usePanel(store);
1847
+ const sessionCatalog = runtime.getService("sessions")?.list;
1848
+ const workspaceCatalog = runtime.getService("workspaces")?.list;
1849
+ const sessions = useCatalog(sessionCatalog, EMPTY_SESSIONS);
1850
+ const workspaces = useCatalog(workspaceCatalog, EMPTY_WORKSPACES);
1851
+ const resolveSession = (0, import_react5.useCallback)(
1852
+ (sessionId) => resolveSessionLink(sessions, workspaces, sessionId),
1853
+ [sessions, workspaces]
1854
+ );
1855
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(GitHubPage, { snapshot, actions: store, t, resolveSession });
1856
+ }
1857
+ function placeholderCard(repo, number) {
1858
+ return {
1859
+ id: `${repo}#${String(number)}`,
1860
+ repo,
1861
+ number,
1862
+ title: "",
1863
+ url: `https://github.com/${repo}/issues/${String(number)}`,
1864
+ state: "OPEN",
1865
+ stateReason: null,
1866
+ isPrivate: false,
1867
+ labels: [],
1868
+ assignees: [],
1869
+ updatedAt: "",
1870
+ commentCount: 0,
1871
+ linkedPRs: [],
1872
+ sessionLinks: []
1873
+ };
1874
+ }
1875
+ function DockHost({ store, t, runtime, sessionId }) {
1876
+ const snapshot = usePanel(store);
1877
+ const sessionCatalog = runtime.getService("sessions")?.list;
1878
+ const workspaceCatalog = runtime.getService("workspaces")?.list;
1879
+ const sessions = useCatalog(sessionCatalog, EMPTY_SESSIONS);
1880
+ const workspaces = useCatalog(workspaceCatalog, EMPTY_WORKSPACES);
1881
+ const resolveSession = (0, import_react5.useCallback)(
1882
+ (id) => resolveSessionLink(sessions, workspaces, id),
1883
+ [sessions, workspaces]
1884
+ );
1885
+ const sessionLinks = snapshot.links.filter((link) => link.sessionId === sessionId);
1886
+ (0, import_react5.useEffect)(() => {
1887
+ if (sessionLinks.length !== 0) void store.ensureCards(sessionLinks);
1888
+ }, [snapshot.links, store]);
1889
+ const chips = [];
1890
+ const seen = /* @__PURE__ */ new Set();
1891
+ for (const link of sessionLinks) {
1892
+ const key = `${link.repo}#${String(link.number)}`;
1893
+ if (seen.has(key)) continue;
1894
+ seen.add(key);
1895
+ const live = snapshot.linkCards[key];
1896
+ chips.push({
1897
+ card: live ?? placeholderCard(link.repo, link.number),
1898
+ state: live === void 0 ? "degraded" : "linked",
1899
+ sessions: [resolveSession(link.sessionId)]
1900
+ });
1901
+ }
1902
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1903
+ GitHubDock,
1904
+ {
1905
+ chips,
1906
+ t,
1907
+ onRemoveChip: (chip) => {
1908
+ if (sessionId !== void 0) void store.unlinkSession(chip.card, sessionId);
1909
+ },
1910
+ onOpenChip: (chip) => store.openInPanel(chip.card)
1911
+ }
1912
+ );
1913
+ }
1914
+ function PendingOverlayHost({ store, t, sessionId, useInput, inputActions }) {
1915
+ const snapshot = usePanel(store);
1916
+ const [pending, setPending] = (0, import_react5.useState)(void 0);
1917
+ const markerSeen = (0, import_react5.useRef)(false);
1918
+ const submitSeen = (0, import_react5.useRef)(false);
1919
+ const sending = (0, import_react5.useRef)(false);
1920
+ const marker = pending === void 0 ? "" : `${pending.repo}#${String(pending.number)}`;
1921
+ const input = useInput === void 0 ? void 0 : useInput((state) => state);
1922
+ const latestInput = (0, import_react5.useRef)(input);
1923
+ latestInput.current = input;
1924
+ (0, import_react5.useEffect)(() => {
1925
+ const card = store.consumeHandoff(sessionId);
1926
+ if (card === void 0) return;
1927
+ markerSeen.current = false;
1928
+ submitSeen.current = false;
1929
+ sending.current = false;
1930
+ setPending(card);
1931
+ if (inputActions !== void 0) inputActions.setDraft(EMPTY_DRAFT_HOLD);
1932
+ }, [snapshot.pendingHandoff, snapshot.pendingHandoffSession, inputActions, sessionId, store]);
1933
+ (0, import_react5.useEffect)(() => {
1934
+ if (pending === void 0 || input === void 0 || sessionId === void 0) return;
1935
+ const text = input.draft;
1936
+ if (text.includes(marker)) {
1937
+ markerSeen.current = true;
1938
+ if (input.phase !== "plain") submitSeen.current = true;
1939
+ }
1940
+ if (markerSeen.current && submitSeen.current) {
1941
+ void store.linkIssue(pending, sessionId);
1942
+ setPending(void 0);
1943
+ markerSeen.current = false;
1944
+ submitSeen.current = false;
1945
+ sending.current = false;
1946
+ return;
1947
+ }
1948
+ if (text === "") {
1949
+ setPending(void 0);
1950
+ markerSeen.current = false;
1951
+ submitSeen.current = false;
1952
+ sending.current = false;
1953
+ return;
1954
+ }
1955
+ if (markerSeen.current && !text.includes(marker)) {
1956
+ setPending(void 0);
1957
+ markerSeen.current = false;
1958
+ submitSeen.current = false;
1959
+ sending.current = false;
1960
+ }
1961
+ }, [input, pending, marker, sessionId, store]);
1962
+ (0, import_react5.useEffect)(() => {
1963
+ if (pending === void 0 || inputActions === void 0) return;
1964
+ const composerCard = () => {
1965
+ const chip = document.querySelector("[data-github-pending]");
1966
+ const anchor = chip?.closest("[data-composer-overlay]");
1967
+ return anchor?.parentElement ?? null;
1968
+ };
1969
+ const submitButton = (card) => {
1970
+ const buttons = [...card.querySelectorAll("button")];
1971
+ return buttons.find((button) => /_primary(\s|$)/.test(String(button.className))) ?? buttons[buttons.length - 1];
1972
+ };
1973
+ const send = () => {
1974
+ if (sending.current) return;
1975
+ sending.current = true;
1976
+ const card = pending;
1977
+ const composed = composeHandoffPrompt(store.promptFor(card), latestInput.current?.draft ?? "");
1978
+ inputActions.setDraft(composed);
1979
+ window.setTimeout(() => {
1980
+ inputActions.submit();
1981
+ window.setTimeout(() => {
1982
+ const after = latestInput.current?.draft ?? "";
1983
+ const cleared = !after.includes(`${card.repo}#${String(card.number)}`);
1984
+ if (!cleared) {
1985
+ sending.current = false;
1986
+ return;
1987
+ }
1988
+ if (sessionId !== void 0) void store.linkIssue(card, sessionId);
1989
+ setPending(void 0);
1990
+ markerSeen.current = false;
1991
+ submitSeen.current = false;
1992
+ sending.current = false;
1993
+ }, 700);
1994
+ }, 16);
1995
+ };
1996
+ const onClick = (event) => {
1997
+ const card = composerCard();
1998
+ if (card === null) return;
1999
+ const button = event.target?.closest("button");
2000
+ if (button === null || button === void 0 || button.closest("[data-github-pending]") !== null) return;
2001
+ if (button !== submitButton(card)) return;
2002
+ event.preventDefault();
2003
+ event.stopImmediatePropagation();
2004
+ send();
2005
+ };
2006
+ const onKeyDown = (event) => {
2007
+ if (event.key !== "Enter" || event.shiftKey || event.isComposing) return;
2008
+ const card = composerCard();
2009
+ if (card === null) return;
2010
+ const target = event.target;
2011
+ if (target === null || !card.contains(target) || target.closest("[data-github-pending]") !== null) return;
2012
+ event.preventDefault();
2013
+ event.stopImmediatePropagation();
2014
+ send();
2015
+ };
2016
+ document.addEventListener("click", onClick, true);
2017
+ document.addEventListener("keydown", onKeyDown, true);
2018
+ return () => {
2019
+ document.removeEventListener("click", onClick, true);
2020
+ document.removeEventListener("keydown", onKeyDown, true);
2021
+ };
2022
+ }, [pending, inputActions, store]);
2023
+ if (pending === void 0) return null;
2024
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2025
+ GitHubPendingChip,
2026
+ {
2027
+ card: pending,
2028
+ t,
2029
+ onOpenPanel: () => store.openInPanel(pending),
2030
+ onRemove: () => {
2031
+ setPending(void 0);
2032
+ markerSeen.current = false;
2033
+ submitSeen.current = false;
2034
+ sending.current = false;
2035
+ inputActions?.setDraft("");
2036
+ }
2037
+ }
2038
+ );
2039
+ }
2040
+ function DropZoneHost({ store, t, sessionId }) {
2041
+ const snapshot = usePanel(store);
2042
+ const dragging = snapshot.dragging;
2043
+ (0, import_react5.useEffect)(() => {
2044
+ if (dragging === void 0) return;
2045
+ const onDragOver = (event) => {
2046
+ event.preventDefault();
2047
+ if (event.dataTransfer !== null) event.dataTransfer.dropEffect = "copy";
2048
+ };
2049
+ const onDrop = (event) => {
2050
+ const target = event.target;
2051
+ if (target?.closest("[data-github-sidebar]") !== null && target !== null) {
2052
+ event.preventDefault();
2053
+ store.endDrag();
2054
+ return;
2055
+ }
2056
+ event.preventDefault();
2057
+ store.dropHandoff(sessionId);
2058
+ };
2059
+ const onDragEnd = () => {
2060
+ store.endDrag();
2061
+ };
2062
+ window.addEventListener("dragover", onDragOver);
2063
+ window.addEventListener("drop", onDrop);
2064
+ window.addEventListener("dragend", onDragEnd);
2065
+ return () => {
2066
+ window.removeEventListener("dragover", onDragOver);
2067
+ window.removeEventListener("drop", onDrop);
2068
+ window.removeEventListener("dragend", onDragEnd);
2069
+ };
2070
+ }, [dragging, sessionId, store]);
2071
+ if (dragging === void 0) return null;
2072
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2073
+ GitHubDropZone,
2074
+ {
2075
+ dragging,
2076
+ t,
2077
+ onDrop: () => store.dropHandoff(sessionId),
2078
+ onCancel: () => store.endDrag()
2079
+ }
2080
+ );
2081
+ }
2082
+ function SidebarHost({ store, t }) {
2083
+ const snapshot = usePanel(store);
2084
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(GitHubSidebar, { snapshot, actions: store, t });
2085
+ }
2086
+ function SettingsHost({ store, t }) {
2087
+ const snapshot = usePanel(store);
2088
+ const resolveSession = (sessionId) => ({
2089
+ sessionId,
2090
+ title: sessionId,
2091
+ available: false
2092
+ });
2093
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(GitHubSettings, { snapshot, actions: store, t, resolveSession });
2094
+ }
2095
+ function GitHubRailIcon(props) {
2096
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(GitHubIcon, { ...props });
2097
+ }
2098
+
2099
+ // src/client/locale.ts
2100
+ var NS = "github-issues";
2101
+ var en = {
2102
+ panel: "GitHub",
2103
+ "panel.assigned": "Assigned to me",
2104
+ "panel.created": "Created by me",
2105
+ "panel.open": "All open",
2106
+ "panel.repo": "Repository",
2107
+ "panel.project": "Project",
2108
+ "panel.allRepos": "All repositories",
2109
+ "panel.selectRepo": "Select a repository\u2026",
2110
+ "panel.selectProject": "Select a project\u2026",
2111
+ "panel.state.open": "Open",
2112
+ "panel.state.closed": "Closed",
2113
+ "panel.state.all": "All",
2114
+ "panel.search": "Filter this list\u2026",
2115
+ "panel.refresh": "Refresh",
2116
+ "panel.openSidebar": "Right column",
2117
+ "panel.loadMore": "Load more",
2118
+ "panel.loading": "Loading\u2026",
2119
+ "panel.empty": "No issues match these filters.",
2120
+ "panel.emptyAuth": "GitHub is not authorized yet. Open Settings \u2192 GitHub.",
2121
+ "panel.error": "Could not load: {message}",
2122
+ "panel.total": "{count} issues",
2123
+ "panel.openOnGitHub": "Open on GitHub",
2124
+ "panel.handoff": "Hand to agent",
2125
+ "panel.pin": "Pin to handoff strip",
2126
+ "panel.close": "Close",
2127
+ "panel.detail": "Details",
2128
+ "panel.closeDetail": "Close detail",
2129
+ "panel.milestone": "Milestone",
2130
+ "panel.priority": "Priority",
2131
+ "panel.labels": "Labels",
2132
+ "panel.assignees": "Assignees",
2133
+ "panel.linkedPRs": "Linked pull requests",
2134
+ "panel.mentionedPRs": "Mentioned in",
2135
+ "panel.noPRs": "No linked pull requests",
2136
+ "panel.comments": "{count} comments",
2137
+ "panel.updated": "updated {time}",
2138
+ "panel.due": "due {date}",
2139
+ "panel.progress": "{percent}%",
2140
+ "panel.priority.project": "project field",
2141
+ "panel.priority.issueField": "issue field",
2142
+ "panel.priority.label": "label",
2143
+ "panel.projectsBlocked": "Projects v2 needs the read:project scope.",
2144
+ "panel.scopeHint": "Run in a terminal: {command}",
2145
+ "panel.copyCommand": "Copy command",
2146
+ "panel.allOrgs": "All organizations",
2147
+ "panel.org": "Organization",
2148
+ "panel.allProjects": "All projects",
2149
+ "panel.repoFilter": "Repository",
2150
+ "panel.comboHint": "{count} in list",
2151
+ "panel.fork": "fork",
2152
+ "panel.assignee": "Assignee",
2153
+ "panel.assignee.me": "Assigned to me",
2154
+ "panel.assignee.all": "Everyone",
2155
+ "panel.pickOrgHint": "Pick an organization to browse its projects and repositories; without one, the list spans every organization.",
2156
+ "panel.loadingScope": "Loading the organization\u2026",
2157
+ "panel.scopeGlobal": "all organizations",
2158
+ "panel.emptyProjectMe": "No items on this project are assigned to you (project has {count} items). Switch the assignee filter to Everyone.",
2159
+ "panel.emptyProjectOpen": "No open items on this project. Switch the state filter to All or Closed.",
2160
+ "panel.toast.copied": "Copied",
2161
+ "panel.toast.promptCopied": "Prompt copied",
2162
+ "panel.toast.pinned": "Pinned to the handoff strip",
2163
+ "panel.filter.milestone": "Milestone",
2164
+ "panel.filter.label": "Label",
2165
+ "panel.filter.all": "All",
2166
+ "panel.private": "Private",
2167
+ "panel.type": "Type",
2168
+ "panel.view": "View",
2169
+ "panel.settings": "Settings",
2170
+ "panel.noAssignees": "Unassigned",
2171
+ "panel.noMilestone": "No milestone",
2172
+ "panel.noPriority": "No priority",
2173
+ "panel.noType": "No type",
2174
+ "panel.draft": "Draft",
2175
+ "panel.merged": "Merged",
2176
+ "panel.closedPR": "Closed",
2177
+ "panel.openPR": "Open",
2178
+ "panel.checks.failure": "{count} failing checks",
2179
+ "panel.review.approved": "approved",
2180
+ "panel.review.changes": "changes requested",
2181
+ "panel.review.required": "review required",
2182
+ "dock.pending": "pending",
2183
+ "sidebar.tab": "Issues",
2184
+ "sidebar.search": "Filter the sidebar list\u2026",
2185
+ "sidebar.dragHint": "Drag a row into the composer to hand it to this Session.",
2186
+ "sidebar.empty": "No issues in this filter",
2187
+ "sidebar.emptyHint": "Adjust the cascade in the main GitHub panel.",
2188
+ "drop.release": "Release to hand off",
2189
+ "drop.hint": "fills the composer draft as an issue chip",
2190
+ "drop.cancel": "Cancel",
2191
+ "pending.hint": "Sent with the prompt; it becomes the linked issue chip below.",
2192
+ "pending.tip": "On send this card becomes the issue prompt; anything you type is appended.",
2193
+ "dock.loading": "Loading issue details\u2026",
2194
+ "dock.removeDraft": "Clear draft",
2195
+ "dock.unlink": "Unlink this session",
2196
+ "dock.linked": "handed to",
2197
+ "dock.remove": "Remove from this conversation",
2198
+ "panel.noSession": "Not handed to a session yet.",
2199
+ "panel.openSession": "Open session",
2200
+ "panel.enterSession": "Open",
2201
+ "panel.newSession": "New session",
2202
+ "panel.sessions": "Linked Sessions",
2203
+ "panel.sessionsHint": "Open a Session to continue, or unlink it. Unlinking never deletes the Session.",
2204
+ "panel.unlinkSession": "Unlink",
2205
+ "panel.unlinkSessionHint": "Remove the issue \u2194 session link only; the Session stays.",
2206
+ "panel.sessionUnavailable": "unavailable (deleted or archived)",
2207
+ "panel.copyPrompt": "Copy prompt",
2208
+ "panel.openSessionNamed": "Open {title}",
2209
+ "panel.sessionMissing": "Session not available",
2210
+ "panel.linkedBadge": "{count} session(s)",
2211
+ "panel.handToAgent": "Hand to agent",
2212
+ "panel.handoffNewSession": "opens a new Session in the matching workspace",
2213
+ "panel.openInPanel": "Open in GitHub panel",
2214
+ "dock.title": "GitHub Issues",
2215
+ "dock.pinned": "Current issue",
2216
+ "dock.empty": "Pin an issue in the GitHub panel, or drop one here.",
2217
+ "dock.insert": "Fill draft",
2218
+ "dock.send": "Send now",
2219
+ "dock.clear": "Unpin",
2220
+ "dock.drop": "Drop to put this issue in the composer",
2221
+ "dock.drag": "Drag this issue onto the composer to write the prompt",
2222
+ "dock.disabled": "The composer is not ready yet.",
2223
+ "dock.open": "Open on GitHub",
2224
+ "settings.title": "GitHub",
2225
+ "settings.auth": "Authorization",
2226
+ "settings.signedIn": "Signed in as {login}",
2227
+ "settings.signedOut": "Not signed in",
2228
+ "settings.ghMissing": "The gh CLI was not found.",
2229
+ "settings.scopes": "Token scopes",
2230
+ "settings.missingProject": "Missing the read:project scope (Projects v2).",
2231
+ "settings.command": "Run this once in a terminal, then refresh:",
2232
+ "settings.copy": "Copy",
2233
+ "settings.handoff": "Handoff behavior",
2234
+ "settings.handoff.draft": "Fill the draft (recommended)",
2235
+ "settings.handoff.send": "Send immediately",
2236
+ "settings.template": "Prompt template",
2237
+ "settings.template.help": "Placeholders: {{repo}} {{number}} {{title}} {{url}} {{state}} {{milestone}} {{priority}} {{assignees}} {{labels}} {{prs}}",
2238
+ "settings.save": "Save",
2239
+ "settings.saved": "Saved",
2240
+ "settings.reset": "Reset to default",
2241
+ "settings.refresh": "Refresh status",
2242
+ "settings.about": "About",
2243
+ "settings.aboutText": "Everything stays on this machine: the token is read from the gh CLI and never written to configuration or to the page; issue data is fetched from GitHub by the local Host process.",
2244
+ "settings.error": "Error: {message}",
2245
+ "settings.authModeGh": "Reuse the gh CLI token",
2246
+ "settings.loading": "Checking\u2026",
2247
+ "settings.credentialHint": "The token stays in the system keychain: this plugin only asks gh for it.",
2248
+ "settings.login": "Login",
2249
+ "settings.host": "Host",
2250
+ "settings.tokenSource": "Token source",
2251
+ "panel.stateFilter": "State",
2252
+ "panel.clearSearch": "Clear filter",
2253
+ "panel.more": "+{count}",
2254
+ "panel.showing": "Showing {count}",
2255
+ "panel.retry": "Retry",
2256
+ "panel.detail.empty": "Select an issue to see its details.",
2257
+ "panel.noBody": "No description provided.",
2258
+ "panel.noRepos": "No repositories found for this token.",
2259
+ "panel.noProjects": "No Projects v2 projects found.",
2260
+ "panel.checks.success": "checks passed",
2261
+ "panel.checks.pending": "checks running",
2262
+ "panel.checks.none": "no checks"
2263
+ };
2264
+ var zh = {
2265
+ panel: "GitHub",
2266
+ "panel.assigned": "\u5206\u914D\u7ED9\u6211",
2267
+ "panel.created": "\u6211\u521B\u5EFA\u7684",
2268
+ "panel.open": "\u5168\u90E8 Open",
2269
+ "panel.repo": "\u4ED3\u5E93",
2270
+ "panel.project": "\u9879\u76EE",
2271
+ "panel.allRepos": "\u5168\u90E8\u4ED3\u5E93",
2272
+ "panel.selectRepo": "\u9009\u62E9\u4ED3\u5E93\u2026",
2273
+ "panel.selectProject": "\u9009\u62E9\u9879\u76EE\u2026",
2274
+ "panel.state.open": "\u6253\u5F00",
2275
+ "panel.state.closed": "\u5DF2\u5173\u95ED",
2276
+ "panel.state.all": "\u5168\u90E8",
2277
+ "panel.search": "\u7B5B\u9009\u5F53\u524D\u5217\u8868\u2026",
2278
+ "panel.refresh": "\u5237\u65B0",
2279
+ "panel.openSidebar": "\u53F3\u680F",
2280
+ "panel.loadMore": "\u52A0\u8F7D\u66F4\u591A",
2281
+ "panel.loading": "\u52A0\u8F7D\u4E2D\u2026",
2282
+ "panel.empty": "\u6CA1\u6709\u7B26\u5408\u6761\u4EF6\u7684 Issue\u3002",
2283
+ "panel.emptyAuth": "GitHub \u5C1A\u672A\u6388\u6743\u3002\u6253\u5F00 \u8BBE\u7F6E \u2192 GitHub\u3002",
2284
+ "panel.error": "\u52A0\u8F7D\u5931\u8D25\uFF1A{message}",
2285
+ "panel.total": "{count} \u4E2A Issue",
2286
+ "panel.openOnGitHub": "\u5728 GitHub \u6253\u5F00",
2287
+ "panel.handoff": "\u4EA4\u7ED9 Agent",
2288
+ "panel.pin": "\u56FA\u5B9A\u5230\u4EA4\u529E\u6761",
2289
+ "panel.close": "\u5173\u95ED",
2290
+ "panel.detail": "\u8BE6\u60C5",
2291
+ "panel.closeDetail": "\u5173\u95ED\u8BE6\u60C5\u9762\u677F",
2292
+ "panel.milestone": "\u91CC\u7A0B\u7891",
2293
+ "panel.priority": "\u4F18\u5148\u7EA7",
2294
+ "panel.labels": "\u6807\u7B7E",
2295
+ "panel.assignees": "\u6307\u6D3E",
2296
+ "panel.linkedPRs": "\u5173\u8054 PR",
2297
+ "panel.mentionedPRs": "\u63D0\u53CA\u7684 PR",
2298
+ "panel.noPRs": "\u65E0\u5173\u8054 PR",
2299
+ "panel.comments": "{count} \u6761\u8BC4\u8BBA",
2300
+ "panel.updated": "\u66F4\u65B0\u4E8E {time}",
2301
+ "panel.due": "{date} \u5230\u671F",
2302
+ "panel.progress": "{percent}%",
2303
+ "panel.priority.project": "\u9879\u76EE\u5B57\u6BB5",
2304
+ "panel.priority.issueField": "Issue \u5B57\u6BB5",
2305
+ "panel.priority.label": "\u6807\u7B7E",
2306
+ "panel.projectsBlocked": "Projects v2 \u9700\u8981 read:project \u6743\u9650\u3002",
2307
+ "panel.scopeHint": "\u5728\u7EC8\u7AEF\u8FD0\u884C\uFF1A{command}",
2308
+ "panel.copyCommand": "\u590D\u5236\u547D\u4EE4",
2309
+ "panel.allOrgs": "\u5168\u90E8\u7EC4\u7EC7",
2310
+ "panel.org": "\u7EC4\u7EC7",
2311
+ "panel.allProjects": "\u5168\u90E8\u9879\u76EE",
2312
+ "panel.repoFilter": "\u4ED3\u5E93",
2313
+ "panel.comboHint": "\u5171 {count} \u4E2A",
2314
+ "panel.fork": "fork",
2315
+ "panel.assignee": "\u6307\u6D3E",
2316
+ "panel.assignee.me": "\u5206\u914D\u7ED9\u6211",
2317
+ "panel.assignee.all": "\u6240\u6709\u4EBA",
2318
+ "panel.pickOrgHint": "\u9009\u62E9\u7EC4\u7EC7\u540E\u53EF\u6D4F\u89C8\u8BE5\u7EC4\u7EC7\u4E0B\u7684\u9879\u76EE\u4E0E\u4ED3\u5E93\uFF1B\u4E0D\u9009\u7EC4\u7EC7\u5219\u8DE8\u6240\u6709\u7EC4\u7EC7\u67E5\u8BE2\u3002",
2319
+ "panel.loadingScope": "\u6B63\u5728\u52A0\u8F7D\u7EC4\u7EC7\u2026",
2320
+ "panel.scopeGlobal": "\u5168\u90E8\u7EC4\u7EC7",
2321
+ "panel.emptyProjectMe": "\u8BE5\u9879\u76EE\u91CC\u6CA1\u6709\u6307\u6D3E\u7ED9\u4F60\u7684\u6761\u76EE\uFF08\u9879\u76EE\u5171 {count} \u9879\uFF09\u3002\u53EF\u628A\u6307\u6D3E\u7B5B\u9009\u5207\u5230\u300C\u6240\u6709\u4EBA\u300D\u3002",
2322
+ "panel.emptyProjectOpen": "\u8BE5\u9879\u76EE\u6CA1\u6709\u6253\u5F00\u72B6\u6001\u7684\u6761\u76EE\u3002\u53EF\u628A\u72B6\u6001\u7B5B\u9009\u5207\u5230\u300C\u5168\u90E8\u300D\u6216\u300C\u5DF2\u5173\u95ED\u300D\u3002",
2323
+ "panel.toast.copied": "\u5DF2\u590D\u5236",
2324
+ "panel.toast.promptCopied": "Prompt \u5DF2\u590D\u5236",
2325
+ "panel.toast.pinned": "\u5DF2\u56FA\u5B9A\u5230\u4EA4\u529E\u6761",
2326
+ "panel.filter.milestone": "\u91CC\u7A0B\u7891",
2327
+ "panel.filter.label": "\u6807\u7B7E",
2328
+ "panel.filter.all": "\u5168\u90E8",
2329
+ "panel.private": "\u79C1\u6709",
2330
+ "panel.type": "\u7C7B\u578B",
2331
+ "panel.view": "\u89C6\u56FE",
2332
+ "panel.settings": "\u8BBE\u7F6E",
2333
+ "panel.noAssignees": "\u672A\u6307\u6D3E",
2334
+ "panel.noMilestone": "\u65E0\u91CC\u7A0B\u7891",
2335
+ "panel.noPriority": "\u65E0\u4F18\u5148\u7EA7",
2336
+ "panel.noType": "\u65E0\u7C7B\u578B",
2337
+ "panel.draft": "\u8349\u7A3F",
2338
+ "panel.merged": "\u5DF2\u5408\u5E76",
2339
+ "panel.closedPR": "\u5DF2\u5173\u95ED",
2340
+ "panel.openPR": "\u6253\u5F00",
2341
+ "panel.checks.failure": "{count} \u4E2A\u68C0\u67E5\u5931\u8D25",
2342
+ "panel.review.approved": "\u5DF2\u901A\u8FC7",
2343
+ "panel.review.changes": "\u8981\u6C42\u4FEE\u6539",
2344
+ "panel.review.required": "\u7B49\u5F85\u5BA1\u67E5",
2345
+ "dock.title": "GitHub Issues",
2346
+ "dock.pending": "\u5F85\u53D1\u9001",
2347
+ "sidebar.tab": "Issues",
2348
+ "sidebar.search": "\u7B5B\u9009\u53F3\u680F\u5217\u8868\u2026",
2349
+ "sidebar.dragHint": "\u628A\u4E00\u884C\u62D6\u8FDB\u8F93\u5165\u6846\uFF0C\u5373\u53EF\u4EA4\u7ED9\u5F53\u524D Session\u3002",
2350
+ "sidebar.empty": "\u5F53\u524D\u7B5B\u9009\u4E0B\u6CA1\u6709 Issue",
2351
+ "sidebar.emptyHint": "\u5728\u4E3B GitHub \u9762\u677F\u91CC\u8C03\u6574\u7EA7\u8054\u7B5B\u9009\u3002",
2352
+ "drop.release": "\u677E\u5F00\u4EE5\u4EA4\u7ED9 Agent",
2353
+ "drop.hint": "\u4F1A\u586B\u5165\u8349\u7A3F\u5E76\u4F5C\u4E3A Issue chip \u663E\u793A",
2354
+ "drop.cancel": "\u53D6\u6D88",
2355
+ "pending.hint": "\u968F\u63D0\u793A\u8BCD\u4E00\u8D77\u53D1\u9001\uFF0C\u53D1\u9001\u540E\u53D8\u6210\u4E0B\u65B9\u5DF2\u5173\u8054 chip\u3002",
2356
+ "pending.tip": "\u53D1\u9001\u65F6\u8FD9\u5F20\u5361\u7247\u4F1A\u81EA\u52A8\u8F6C\u6210 Issue \u63D0\u793A\u8BCD\uFF0C\u4F60\u8F93\u5165\u7684\u5185\u5BB9\u4F1A\u9644\u5728\u540E\u9762\u3002",
2357
+ "dock.loading": "\u6B63\u5728\u52A0\u8F7D Issue\u2026",
2358
+ "dock.removeDraft": "\u6E05\u7A7A\u8349\u7A3F",
2359
+ "dock.unlink": "\u89E3\u9664\u672C Session \u5173\u8054",
2360
+ "dock.linked": "\u4EA4\u529E\u7ED9",
2361
+ "dock.remove": "\u4ECE\u5F53\u524D\u5BF9\u8BDD\u79FB\u9664",
2362
+ "panel.noSession": "\u8FD8\u6CA1\u6709\u4EA4\u529E\u7ED9\u4EFB\u4F55 Session\u3002",
2363
+ "panel.openSession": "\u8FDB\u5165 Session",
2364
+ "panel.enterSession": "\u8FDB\u5165",
2365
+ "panel.newSession": "\u518D\u5F00\u4E00\u4E2A Session",
2366
+ "panel.sessions": "\u5173\u8054\u7684 Session",
2367
+ "panel.sessionsHint": "\u8FDB\u5165\u67D0\u4E2A Session \u7EE7\u7EED\u5904\u7406\uFF1B\u89E3\u9664\u53EA\u79FB\u9664\u5173\u8054\uFF0C\u4E0D\u4F1A\u5220\u9664 Session\u3002",
2368
+ "panel.unlinkSession": "\u89E3\u9664",
2369
+ "panel.unlinkSessionHint": "\u53EA\u79FB\u9664 Issue \u4E0E Session \u7684\u5173\u8054\uFF0C\u4E0D\u4F1A\u5220\u9664 Session\u3002",
2370
+ "panel.sessionUnavailable": "\u5DF2\u4E0D\u53EF\u7528\uFF08\u5DF2\u5220\u9664\u6216\u5F52\u6863\uFF09",
2371
+ "panel.copyPrompt": "\u590D\u5236\u63D0\u793A\u8BCD",
2372
+ "panel.openSessionNamed": "\u8FDB\u5165 {title}",
2373
+ "panel.sessionMissing": "Session \u4E0D\u53EF\u7528",
2374
+ "panel.linkedBadge": "{count} \u4E2A Session",
2375
+ "panel.handToAgent": "\u4EA4\u7ED9 Agent",
2376
+ "panel.handoffNewSession": "\u4F1A\u5728\u5339\u914D\u7684\u5DE5\u4F5C\u533A\u65B0\u5F00\u4E00\u4E2A Session \u5904\u7406",
2377
+ "panel.openInPanel": "\u5728 GitHub \u9762\u677F\u6253\u5F00",
2378
+ "dock.pinned": "\u5F53\u524D Issue",
2379
+ "dock.empty": "\u5728 GitHub \u9762\u677F\u91CC\u56FA\u5B9A\u4E00\u4E2A Issue\uFF0C\u6216\u628A Issue \u62D6\u5230\u8FD9\u91CC\u3002",
2380
+ "dock.insert": "\u586B\u5165\u8349\u7A3F",
2381
+ "dock.send": "\u76F4\u63A5\u53D1\u9001",
2382
+ "dock.clear": "\u53D6\u6D88\u56FA\u5B9A",
2383
+ "dock.drop": "\u677E\u624B\u5373\u628A\u8BE5 Issue \u586B\u5165\u8F93\u5165\u6846",
2384
+ "dock.drag": "\u628A\u8FD9\u4E2A Issue \u62D6\u5230\u8F93\u5165\u6846\uFF0C\u5373\u53EF\u5199\u5165 prompt",
2385
+ "dock.disabled": "\u8F93\u5165\u6846\u5C1A\u672A\u5C31\u7EEA\u3002",
2386
+ "dock.open": "\u5728 GitHub \u6253\u5F00",
2387
+ "settings.title": "GitHub",
2388
+ "settings.auth": "\u6388\u6743",
2389
+ "settings.signedIn": "\u5DF2\u767B\u5F55 {login}",
2390
+ "settings.signedOut": "\u672A\u767B\u5F55",
2391
+ "settings.ghMissing": "\u672A\u627E\u5230 gh CLI\u3002",
2392
+ "settings.scopes": "Token \u6743\u9650",
2393
+ "settings.missingProject": "\u7F3A\u5C11 read:project \u6743\u9650\uFF08Projects v2\uFF09\u3002",
2394
+ "settings.command": "\u5728\u7EC8\u7AEF\u6267\u884C\u4E00\u6B21\uFF0C\u7136\u540E\u5237\u65B0\uFF1A",
2395
+ "settings.copy": "\u590D\u5236",
2396
+ "settings.handoff": "\u4EA4\u529E\u884C\u4E3A",
2397
+ "settings.handoff.draft": "\u53EA\u586B\u5165\u8349\u7A3F\uFF08\u63A8\u8350\uFF09",
2398
+ "settings.handoff.send": "\u76F4\u63A5\u53D1\u9001",
2399
+ "settings.template": "Prompt \u6A21\u677F",
2400
+ "settings.template.help": "\u53EF\u7528\u53D8\u91CF\uFF1A{{repo}} {{number}} {{title}} {{url}} {{state}} {{milestone}} {{priority}} {{assignees}} {{labels}} {{prs}}",
2401
+ "settings.save": "\u4FDD\u5B58",
2402
+ "settings.saved": "\u5DF2\u4FDD\u5B58",
2403
+ "settings.reset": "\u6062\u590D\u9ED8\u8BA4",
2404
+ "settings.refresh": "\u5237\u65B0\u72B6\u6001",
2405
+ "settings.about": "\u8BF4\u660E",
2406
+ "settings.aboutText": "\u6240\u6709\u6570\u636E\u53EA\u5728\u672C\u673A\u6D41\u8F6C\uFF1Atoken \u4ECE gh CLI \u8BFB\u53D6\uFF0C\u4E0D\u5199\u5165\u914D\u7F6E\u6216\u9875\u9762\uFF1BIssue \u6570\u636E\u7531\u672C\u673A Host \u8FDB\u7A0B\u8BF7\u6C42 GitHub\u3002",
2407
+ "settings.error": "\u9519\u8BEF\uFF1A{message}",
2408
+ "settings.authModeGh": "\u590D\u7528 gh CLI token",
2409
+ "settings.loading": "\u68C0\u67E5\u4E2D\u2026",
2410
+ "settings.credentialHint": "token \u7559\u5728\u7CFB\u7EDF\u94A5\u5319\u4E32\uFF1A\u672C\u63D2\u4EF6\u53EA\u662F\u5411 gh \u8BFB\u53D6\u5B83\u3002",
2411
+ "settings.login": "\u8D26\u53F7",
2412
+ "settings.host": "\u4E3B\u673A",
2413
+ "settings.tokenSource": "Token \u6765\u6E90",
2414
+ "panel.stateFilter": "\u72B6\u6001",
2415
+ "panel.clearSearch": "\u6E05\u9664\u7B5B\u9009",
2416
+ "panel.more": "+{count}",
2417
+ "panel.showing": "\u663E\u793A {count} \u6761",
2418
+ "panel.retry": "\u91CD\u8BD5",
2419
+ "panel.detail.empty": "\u9009\u62E9\u4E00\u4E2A Issue \u67E5\u770B\u8BE6\u60C5\u3002",
2420
+ "panel.noBody": "\u672A\u63D0\u4F9B\u6B63\u6587\u3002",
2421
+ "panel.noRepos": "\u6B64 token \u4E0B\u672A\u627E\u5230\u4ED3\u5E93\u3002",
2422
+ "panel.noProjects": "\u672A\u627E\u5230 Projects v2 \u9879\u76EE\u3002",
2423
+ "panel.checks.success": "\u68C0\u67E5\u901A\u8FC7",
2424
+ "panel.checks.pending": "\u68C0\u67E5\u8FD0\u884C\u4E2D",
2425
+ "panel.checks.none": "\u65E0\u68C0\u67E5"
2426
+ };
2427
+ var DICTS = { en, zh };
2428
+
2429
+ // src/remote-methods.ts
2430
+ var REMOTE_METHODS = [
2431
+ { method: "status", parameters: [] },
2432
+ { method: "catalog", parameters: [] },
2433
+ { method: "orgProjects", parameters: [{ wire: "org" }] },
2434
+ { method: "orgRepos", parameters: [{ wire: "org" }] },
2435
+ { method: "listIssues", parameters: [{ wire: "request" }] },
2436
+ { method: "issueDetail", parameters: [{ wire: "repo" }, { wire: "number" }] },
2437
+ { method: "issueMentionedPRs", parameters: [{ wire: "repo" }, { wire: "number" }] },
2438
+ { method: "loadPrefs", parameters: [] },
2439
+ { method: "savePrefs", parameters: [{ wire: "patch" }] },
2440
+ { method: "refresh", parameters: [] },
2441
+ { method: "links", parameters: [] },
2442
+ { method: "linkIssue", parameters: [{ wire: "repo" }, { wire: "number" }, { wire: "sessionId" }] },
2443
+ { method: "unlinkIssue", parameters: [{ wire: "repo" }, { wire: "number" }, { wire: "sessionId", optional: true }] }
2444
+ ];
2445
+ var REMOTE_SERVICE_KEY = "githubIssuesController";
2446
+ var REMOTE_NAMESPACE = "githubIssues";
2447
+
2448
+ // src/client/remote.ts
2449
+ var PACKAGE = "dsh-plugin-github-issues";
2450
+ var RESULT_CODEC = { mode: "src-json" };
2451
+ function parameterCodec(typeSymbol) {
2452
+ return {
2453
+ mode: "strict",
2454
+ typeSymbol,
2455
+ create: () => ({ parse: (value) => value })
2456
+ };
2457
+ }
2458
+ function remoteContribution() {
2459
+ return {
2460
+ package: PACKAGE,
2461
+ descriptors: REMOTE_METHODS.map(({ method, parameters }) => ({
2462
+ id: `${PACKAGE}#${REMOTE_NAMESPACE}/${method}`,
2463
+ service: REMOTE_SERVICE_KEY,
2464
+ namespace: REMOTE_NAMESPACE,
2465
+ method,
2466
+ invocation: { kind: "direct" },
2467
+ parameters: parameters.map(({ wire, optional }) => ({
2468
+ name: wire,
2469
+ wire,
2470
+ source: "json",
2471
+ codec: parameterCodec(`${PACKAGE}#${REMOTE_NAMESPACE}/${method}:${wire}`),
2472
+ ...optional === true ? { acceptsUndefined: true } : {}
2473
+ })),
2474
+ result: RESULT_CODEC,
2475
+ // Point the descriptor at the declaration it mirrors so a Gateway diagnostic
2476
+ // leads to the method it is really about.
2477
+ sourceLocation: { file: "src/controller.ts", line: 1, column: 1 }
2478
+ }))
2479
+ };
2480
+ }
2481
+
2482
+ // src/client/result.ts
2483
+ var RemoteRefusal = class extends Error {
2484
+ code;
2485
+ /**
2486
+ * @param message - human text for the panel.
2487
+ * @param code - the Host's machine code, when it sent one.
2488
+ */
2489
+ constructor(message, code) {
2490
+ super(message);
2491
+ this.name = "RemoteRefusal";
2492
+ this.code = code;
2493
+ }
2494
+ };
2495
+ function unwrap(result) {
2496
+ if (result.ok) return result.value;
2497
+ const code = result.error?.code;
2498
+ const message = result.error?.message;
2499
+ if (message === void 0 || message.length === 0) {
2500
+ throw new RemoteRefusal(code === void 0 ? "the GitHub service refused the request" : `GitHub request failed (${code})`, code);
2501
+ }
2502
+ throw new RemoteRefusal(message, code);
2503
+ }
2504
+
2505
+ // src/workspace.ts
2506
+ function basename(path) {
2507
+ const trimmed = path.replace(/[/\\]+$/, "");
2508
+ const index = Math.max(trimmed.lastIndexOf("/"), trimmed.lastIndexOf("\\"));
2509
+ return (index === -1 ? trimmed : trimmed.slice(index + 1)).toLowerCase();
2510
+ }
2511
+ function resolveHandoffWorkspace(input) {
2512
+ const workspaces = input.workspaces;
2513
+ if (workspaces.length === 0) return void 0;
2514
+ const bySession = (sessionIds) => {
2515
+ for (const sessionId of sessionIds) {
2516
+ const hit = workspaces.find((workspace) => workspace.sessionIds.includes(sessionId));
2517
+ if (hit !== void 0) return hit.workspaceId;
2518
+ }
2519
+ return void 0;
2520
+ };
2521
+ if (input.currentSessionId !== void 0) {
2522
+ const source = bySession([input.currentSessionId]);
2523
+ if (source !== void 0) return source;
2524
+ }
2525
+ if (input.linkedSessionIds !== void 0 && input.linkedSessionIds.length !== 0) {
2526
+ const linked = bySession(input.linkedSessionIds);
2527
+ if (linked !== void 0) return linked;
2528
+ }
2529
+ const repoName = basename(input.repo);
2530
+ const directory = workspaces.find((workspace) => workspace.path !== void 0 && basename(workspace.path) === repoName || workspace.title !== void 0 && workspace.title.toLowerCase() === repoName);
2531
+ if (directory !== void 0) return directory.workspaceId;
2532
+ return void 0;
2533
+ }
2534
+
2535
+ // src/client/store.ts
2536
+ var REMOTE_WAIT_MS = 15e3;
2537
+ var REMOTE_POLL_MS = 250;
2538
+ var REMOTE_KEY = `remote.${REMOTE_NAMESPACE}`;
2539
+ var SIDEBAR_KIND = "github-issues";
2540
+ var TOAST_MS = 2500;
2541
+ function asPanelError(error) {
2542
+ if (error instanceof RemoteRefusal) {
2543
+ return { message: error.message, ...error.code === void 0 ? {} : { code: error.code } };
2544
+ }
2545
+ return { message: error instanceof Error ? error.message : String(error) };
2546
+ }
2547
+ async function waitForRemote(ctx) {
2548
+ const deadline = Date.now() + REMOTE_WAIT_MS;
2549
+ for (; ; ) {
2550
+ const namespace = ctx.get(REMOTE_KEY);
2551
+ if (typeof namespace?.listIssues === "function") return namespace;
2552
+ if (Date.now() >= deadline) {
2553
+ throw new Error("the GitHub service is not reachable from this window; reload the window and try again");
2554
+ }
2555
+ await new Promise((resolve) => {
2556
+ setTimeout(resolve, REMOTE_POLL_MS);
2557
+ });
2558
+ }
2559
+ }
2560
+ var GitHubStore = class {
2561
+ /**
2562
+ * @param ctx - the browser plugin context.
2563
+ * @param mounting - settles when the hand-written Remote namespace is mounted.
2564
+ */
2565
+ constructor(ctx, runtime, mounting) {
2566
+ this.ctx = ctx;
2567
+ this.runtime = runtime;
2568
+ this.mounting = mounting;
2569
+ void mounting.then(() => void 0);
2570
+ }
2571
+ snapshot = {
2572
+ loading: false,
2573
+ loadingMore: false,
2574
+ scopeLoading: false,
2575
+ detailLoading: false,
2576
+ prefs: DEFAULT_PREFS,
2577
+ projectsBlocked: false,
2578
+ links: [],
2579
+ linkCards: {}
2580
+ };
2581
+ listeners = /* @__PURE__ */ new Set();
2582
+ orgScopes = /* @__PURE__ */ new Map();
2583
+ remote;
2584
+ started = false;
2585
+ pollTimer;
2586
+ toastTimer;
2587
+ listSeq = 0;
2588
+ /** Subscribe one renderer to state changes. */
2589
+ subscribe = (listener) => {
2590
+ this.listeners.add(listener);
2591
+ return () => {
2592
+ this.listeners.delete(listener);
2593
+ };
2594
+ };
2595
+ /** The current immutable snapshot. */
2596
+ getSnapshot = () => this.snapshot;
2597
+ /** Start loading and polling. Idempotent. */
2598
+ start() {
2599
+ if (this.started) return;
2600
+ this.started = true;
2601
+ void this.bootstrap();
2602
+ }
2603
+ /** Stop every timer this store owns. */
2604
+ stop() {
2605
+ this.started = false;
2606
+ if (this.pollTimer !== void 0) clearInterval(this.pollTimer);
2607
+ if (this.toastTimer !== void 0) clearTimeout(this.toastTimer);
2608
+ this.pollTimer = void 0;
2609
+ this.toastTimer = void 0;
2610
+ }
2611
+ /** Load prefs, auth facts, the catalog, the saved scope, and the first page. */
2612
+ async bootstrap() {
2613
+ this.update({ loading: true, error: void 0 });
2614
+ try {
2615
+ const remote = await this.api();
2616
+ const [status, prefs] = await Promise.all([
2617
+ remote.status().then((result) => unwrap(result)),
2618
+ remote.loadPrefs().then((result) => unwrap(result))
2619
+ ]);
2620
+ const sanePrefs = prefs.projectId !== void 0 && prefs.org === void 0 ? { ...prefs, projectId: void 0, repo: prefs.repo } : prefs;
2621
+ this.update({
2622
+ status,
2623
+ prefs: sanePrefs,
2624
+ projectsBlocked: status.missingProjectScope,
2625
+ loading: false
2626
+ });
2627
+ if (sanePrefs !== prefs) void this.savePrefs({ projectId: null });
2628
+ void this.loadCatalog();
2629
+ void this.loadLinks();
2630
+ if (prefs.org !== void 0) void this.loadOrgScope(prefs.org);
2631
+ await this.reloadList();
2632
+ this.schedulePolling(status.config.pollSeconds);
2633
+ void this.hydratePinned();
2634
+ } catch (error) {
2635
+ this.update({ loading: false, error: asPanelError(error) });
2636
+ }
2637
+ }
2638
+ /** Poll only while the page is visible, at the configured cadence. */
2639
+ schedulePolling(configuredSeconds) {
2640
+ const seconds = Number.isFinite(configuredSeconds) ? Math.min(Math.max(configuredSeconds, 30), 600) : 90;
2641
+ if (this.pollTimer !== void 0) clearInterval(this.pollTimer);
2642
+ this.pollTimer = setInterval(() => {
2643
+ if (typeof document !== "undefined" && document.visibilityState !== "visible") return;
2644
+ if (this.snapshot.loading || this.snapshot.loadingMore) return;
2645
+ void this.reloadList(true);
2646
+ }, seconds * 1e3);
2647
+ }
2648
+ /** Resolve the Remote namespace, or throw the mount's own refusal. */
2649
+ async api() {
2650
+ if (this.remote !== void 0) return this.remote;
2651
+ const refused = await this.mounting;
2652
+ if (refused !== void 0) throw new Error(`the GitHub service could not be mounted: ${refused}`);
2653
+ this.remote = await waitForRemote(this.ctx);
2654
+ return this.remote;
2655
+ }
2656
+ /** Merge one snapshot patch and notify renderers. */
2657
+ update(patch) {
2658
+ this.snapshot = { ...this.snapshot, ...patch };
2659
+ for (const listener of this.listeners) listener();
2660
+ }
2661
+ /** Show one transient confirmation. */
2662
+ toast(text) {
2663
+ this.update({ toast: text });
2664
+ if (this.toastTimer !== void 0) clearTimeout(this.toastTimer);
2665
+ this.toastTimer = setTimeout(() => {
2666
+ this.update({ toast: void 0 });
2667
+ }, TOAST_MS);
2668
+ }
2669
+ /** Build the list request the current cascade describes. */
2670
+ request(after) {
2671
+ const prefs = this.snapshot.prefs;
2672
+ const request = {
2673
+ state: prefs.state,
2674
+ assignee: prefs.assignee,
2675
+ first: 30,
2676
+ after
2677
+ };
2678
+ if (prefs.org !== void 0) request.org = prefs.org;
2679
+ if (prefs.org !== void 0 && prefs.projectId !== void 0) request.projectId = prefs.projectId;
2680
+ if (prefs.repo !== void 0) request.repos = [prefs.repo];
2681
+ return request;
2682
+ }
2683
+ /** Fetch the first page of the current cascade. */
2684
+ async reloadList(quiet = false) {
2685
+ const seq = ++this.listSeq;
2686
+ if (!quiet) this.update({ loading: true, error: void 0 });
2687
+ try {
2688
+ const remote = await this.api();
2689
+ const page = await remote.listIssues(this.request(null)).then((result) => unwrap(result));
2690
+ if (seq !== this.listSeq) return;
2691
+ this.update({
2692
+ list: page,
2693
+ loading: false,
2694
+ loadingMore: false,
2695
+ error: void 0
2696
+ });
2697
+ this.refreshPinnedCard();
2698
+ } catch (error) {
2699
+ if (seq !== this.listSeq) return;
2700
+ this.update({ loading: false, loadingMore: false, error: asPanelError(error) });
2701
+ }
2702
+ }
2703
+ /** Load the viewer/organization catalog once. */
2704
+ async loadCatalog() {
2705
+ if (this.snapshot.catalog !== void 0) return;
2706
+ try {
2707
+ const remote = await this.api();
2708
+ const catalog = await remote.catalog().then((result) => unwrap(result));
2709
+ this.update({
2710
+ catalog,
2711
+ projectsBlocked: this.snapshot.status?.missingProjectScope === true || catalog.projectsBlocked
2712
+ });
2713
+ } catch (error) {
2714
+ this.update({ error: asPanelError(error) });
2715
+ }
2716
+ }
2717
+ /**
2718
+ * Load the projects and repositories of one organization, once per session.
2719
+ * A Projects v2 permission failure degrades to `projectsBlocked` while the
2720
+ * repository list still works.
2721
+ */
2722
+ async loadOrgScope(org) {
2723
+ const cached = this.orgScopes.get(org);
2724
+ if (cached !== void 0) {
2725
+ this.update({
2726
+ orgProjects: cached.projects,
2727
+ orgRepos: cached.repos,
2728
+ projectsBlocked: cached.blocked || this.snapshot.status?.missingProjectScope === true,
2729
+ ...cached.error === void 0 ? { projectsError: void 0 } : { projectsError: cached.error }
2730
+ });
2731
+ return;
2732
+ }
2733
+ this.update({ scopeLoading: true });
2734
+ try {
2735
+ const remote = await this.api();
2736
+ const [projects, repos] = await Promise.all([
2737
+ remote.orgProjects(org).then((result) => unwrap(result)),
2738
+ remote.orgRepos(org).then((result) => unwrap(result))
2739
+ ]);
2740
+ const scope = {
2741
+ projects: projects.projects,
2742
+ repos,
2743
+ blocked: projects.blocked || this.snapshot.status?.missingProjectScope === true,
2744
+ ...projects.error === void 0 ? {} : { error: projects.error }
2745
+ };
2746
+ this.orgScopes.set(org, scope);
2747
+ this.update({
2748
+ orgProjects: scope.projects,
2749
+ orgRepos: scope.repos,
2750
+ projectsBlocked: scope.blocked,
2751
+ ...scope.error === void 0 ? { projectsError: void 0 } : { projectsError: scope.error },
2752
+ scopeLoading: false
2753
+ });
2754
+ } catch (error) {
2755
+ this.update({ scopeLoading: false, error: asPanelError(error) });
2756
+ }
2757
+ }
2758
+ /** Keep the dock's copy of the pinned issue in sync with the loaded list. */
2759
+ refreshPinnedCard() {
2760
+ const pinned = this.snapshot.prefs.pinned;
2761
+ if (pinned === void 0) {
2762
+ if (this.snapshot.pinnedCard !== void 0) this.update({ pinnedCard: void 0 });
2763
+ return;
2764
+ }
2765
+ const found = this.snapshot.list?.items.find((item) => item.repo === pinned.repo && item.number === pinned.number);
2766
+ if (found !== void 0 && this.snapshot.pinnedCard?.id !== found.id) this.update({ pinnedCard: found });
2767
+ }
2768
+ /** A card for one issue from the loaded list, or a minimal placeholder. */
2769
+ cardFor(repo, number) {
2770
+ const found = this.snapshot.list?.items.find((item) => item.repo === repo && item.number === number);
2771
+ if (found !== void 0) return found;
2772
+ return {
2773
+ id: `${repo}#${String(number)}`,
2774
+ repo,
2775
+ number,
2776
+ title: "",
2777
+ url: `https://github.com/${repo}/issues/${String(number)}`,
2778
+ state: "OPEN",
2779
+ stateReason: null,
2780
+ isPrivate: false,
2781
+ labels: [],
2782
+ assignees: [],
2783
+ updatedAt: "",
2784
+ commentCount: 0,
2785
+ linkedPRs: [],
2786
+ sessionLinks: []
2787
+ };
2788
+ }
2789
+ /** The pinned issue's card, when the loaded list carries it. */
2790
+ async hydratePinned() {
2791
+ const pinned = this.snapshot.prefs.pinned;
2792
+ if (pinned === void 0 || this.snapshot.pinnedCard !== void 0) return;
2793
+ const found = this.snapshot.list?.items.find((item) => item.repo === pinned.repo && item.number === pinned.number);
2794
+ if (found !== void 0) this.update({ pinnedCard: found });
2795
+ }
2796
+ // ── PanelActions ────────────────────────────────────────────────────────────
2797
+ refresh() {
2798
+ void (async () => {
2799
+ try {
2800
+ const remote = await this.api();
2801
+ await remote.refresh();
2802
+ const status = await remote.status().then((result) => unwrap(result));
2803
+ this.orgScopes.clear();
2804
+ this.update({
2805
+ status,
2806
+ catalog: void 0,
2807
+ orgProjects: void 0,
2808
+ orgRepos: void 0,
2809
+ projectsBlocked: status.missingProjectScope,
2810
+ projectsError: void 0
2811
+ });
2812
+ } catch (error) {
2813
+ this.update({ error: asPanelError(error) });
2814
+ return;
2815
+ }
2816
+ const org = this.snapshot.prefs.org;
2817
+ if (org !== void 0) void this.loadOrgScope(org);
2818
+ await this.reloadList();
2819
+ void this.loadCatalog();
2820
+ })();
2821
+ }
2822
+ loadMore() {
2823
+ const page = this.snapshot.list;
2824
+ if (page === void 0 || !page.pageInfo.hasNextPage || this.snapshot.loadingMore) return;
2825
+ this.update({ loadingMore: true });
2826
+ void (async () => {
2827
+ try {
2828
+ const remote = await this.api();
2829
+ const next = await remote.listIssues(this.request(page.pageInfo.endCursor)).then((result) => unwrap(result));
2830
+ this.update({
2831
+ loadingMore: false,
2832
+ list: {
2833
+ ...page,
2834
+ items: [...page.items, ...next.items.filter((item) => !page.items.some((existing) => existing.id === item.id))],
2835
+ pageInfo: next.pageInfo,
2836
+ ...next.totalCount === void 0 ? {} : { totalCount: next.totalCount }
2837
+ }
2838
+ });
2839
+ } catch (error) {
2840
+ this.update({ loadingMore: false, error: asPanelError(error) });
2841
+ }
2842
+ })();
2843
+ }
2844
+ setOrg(org) {
2845
+ void this.savePrefs({ org: org ?? null, projectId: null, repo: null }, async (saved) => {
2846
+ this.update({ orgProjects: void 0, orgRepos: void 0 });
2847
+ if (saved.org !== void 0) await this.loadOrgScope(saved.org);
2848
+ });
2849
+ }
2850
+ setProject(projectId) {
2851
+ void this.savePrefs({ projectId: projectId ?? null });
2852
+ }
2853
+ setRepo(repo) {
2854
+ void this.savePrefs({ repo: repo ?? null });
2855
+ }
2856
+ setAssignee(assignee) {
2857
+ void this.savePrefs({ assignee });
2858
+ }
2859
+ setStateFilter(state) {
2860
+ void this.savePrefs({ state });
2861
+ }
2862
+ selectIssue(card) {
2863
+ this.update({ selected: card, detail: void 0, detailLoading: true, mentionedLoading: false });
2864
+ void (async () => {
2865
+ try {
2866
+ const remote = await this.api();
2867
+ const body = await remote.issueDetail(card.repo, card.number).then((result) => unwrap(result));
2868
+ this.update({
2869
+ detail: { ...card, body: body.body, mentionedPRs: [] },
2870
+ detailLoading: false,
2871
+ mentionedLoading: true
2872
+ });
2873
+ const mentioned = await remote.issueMentionedPRs(card.repo, card.number).then((result) => unwrap(result));
2874
+ const current = this.snapshot.detail;
2875
+ if (current === void 0 || current.repo !== card.repo || current.number !== card.number) return;
2876
+ const closing = new Set(current.linkedPRs.map((pr) => pr.number));
2877
+ this.update({
2878
+ detail: { ...current, mentionedPRs: mentioned.mentionedPRs.filter((pr) => !closing.has(pr.number)) },
2879
+ mentionedLoading: false
2880
+ });
2881
+ } catch (error) {
2882
+ this.update({ detailLoading: false, mentionedLoading: false, error: asPanelError(error) });
2883
+ }
2884
+ })();
2885
+ }
2886
+ closeDetail() {
2887
+ this.update({ selected: void 0, detail: void 0, detailLoading: false, mentionedLoading: false });
2888
+ }
2889
+ async savePrefs(patch, after) {
2890
+ try {
2891
+ const remote = await this.api();
2892
+ const saved = await remote.savePrefs(patch).then((result) => unwrap(result));
2893
+ const affectsList = ["org", "projectId", "repo", "assignee", "state"].some((key) => key in patch);
2894
+ this.update({ prefs: saved });
2895
+ if (affectsList) {
2896
+ await this.reloadList();
2897
+ this.refreshPinnedCard();
2898
+ } else if ("handoffMode" in patch || "promptTemplate" in patch) {
2899
+ this.toast("settings.saved");
2900
+ }
2901
+ if (after !== void 0) await after(saved);
2902
+ } catch (error) {
2903
+ this.update({ error: asPanelError(error) });
2904
+ }
2905
+ }
2906
+ pin(card) {
2907
+ this.update({ pinnedCard: card });
2908
+ this.toast("panel.toast.pinned");
2909
+ void this.savePrefs({ pinned: { repo: card.repo, number: card.number } });
2910
+ }
2911
+ unpin() {
2912
+ this.update({ pinnedCard: void 0, pendingHandoff: void 0 });
2913
+ void this.savePrefs({ pinned: null });
2914
+ }
2915
+ /** Start a drag from the right-sidebar list; the composer shows the target. */
2916
+ dragIssue(card) {
2917
+ this.update({ dragging: card });
2918
+ }
2919
+ /** End a drag without a handoff. */
2920
+ endDrag() {
2921
+ if (this.snapshot.dragging !== void 0) this.update({ dragging: void 0 });
2922
+ }
2923
+ /**
2924
+ * Drop the dragged issue on the composer of the Session it was dragged into:
2925
+ * the dock that mounts with this Session consumes the pending handoff and
2926
+ * writes the prompt. No new Session is created for a drag.
2927
+ */
2928
+ dropHandoff(sessionId) {
2929
+ const card = this.snapshot.dragging;
2930
+ this.update({
2931
+ dragging: void 0,
2932
+ ...card === void 0 ? {} : {
2933
+ pendingHandoff: card,
2934
+ ...sessionId === void 0 ? {} : { pendingHandoffSession: sessionId }
2935
+ }
2936
+ });
2937
+ }
2938
+ /** Open the co-visible right-sidebar tab for the on-screen Session. */
2939
+ openInSidebar() {
2940
+ this.service("layout")?.selectPanel(null);
2941
+ setTimeout(() => {
2942
+ this.service("sidebarRight")?.openTab(SIDEBAR_KIND);
2943
+ }, 80);
2944
+ }
2945
+ /** The Workspace a new handoff Session should open in, per the agreed priority. */
2946
+ workspaceForHandoff(repo) {
2947
+ const workspaces = this.runtime.getService("workspaces")?.list?.getSnapshot();
2948
+ const items = [];
2949
+ for (const item of workspaces?.items ?? []) {
2950
+ const entry = item;
2951
+ if (entry.workspaceId === void 0) continue;
2952
+ items.push({
2953
+ workspaceId: entry.workspaceId,
2954
+ ...entry.path === void 0 ? {} : { path: entry.path },
2955
+ ...entry.title === void 0 || entry.title === null ? {} : { title: entry.title },
2956
+ sessionIds: item.sessionIds ?? []
2957
+ });
2958
+ }
2959
+ const currentSessionId = this.runtime.getService("uiSession")?.adapter?.current?.getSnapshot()?.key;
2960
+ const linkedSessionIds = this.snapshot.links.filter((link) => link.repo === repo).map((link) => link.sessionId);
2961
+ return resolveHandoffWorkspace({
2962
+ repo,
2963
+ ...currentSessionId === void 0 ? {} : { currentSessionId },
2964
+ linkedSessionIds,
2965
+ workspaces: items
2966
+ });
2967
+ }
2968
+ handoff(card) {
2969
+ this.pin(card);
2970
+ const uiWorkspace = this.service("uiWorkspace");
2971
+ if (uiWorkspace === void 0) {
2972
+ this.update({ pendingHandoff: card, pendingHandoffSession: void 0 });
2973
+ this.service("layout")?.selectPanel(null);
2974
+ return;
2975
+ }
2976
+ const workspaceId = this.workspaceForHandoff(card.repo);
2977
+ const prompt = this.promptFor(card);
2978
+ void (async () => {
2979
+ try {
2980
+ const sessionId = await uiWorkspace.connectWorkspace(workspaceId);
2981
+ this.update({ pendingHandoff: card, pendingHandoffSession: sessionId });
2982
+ uiWorkspace.startSession(workspaceId, { prompt, whenDraftExists: "replace" });
2983
+ } catch (error) {
2984
+ this.update({ error: asPanelError(error) });
2985
+ }
2986
+ })();
2987
+ }
2988
+ copyPrompt(card) {
2989
+ this.copyText(renderPrompt(card, this.snapshot.prefs.promptTemplate));
2990
+ this.toast("panel.toast.promptCopied");
2991
+ }
2992
+ /** The prompt text this profile hands to the agent for one issue. */
2993
+ promptText(card) {
2994
+ return renderPrompt(card, this.snapshot.prefs.promptTemplate);
2995
+ }
2996
+ copyText(text) {
2997
+ try {
2998
+ void navigator.clipboard?.writeText(text);
2999
+ } catch {
3000
+ }
3001
+ this.toast("panel.toast.copied");
3002
+ }
3003
+ clearToast() {
3004
+ if (this.toastTimer !== void 0) clearTimeout(this.toastTimer);
3005
+ this.toastTimer = void 0;
3006
+ this.update({ toast: void 0 });
3007
+ }
3008
+ /** The issue key used by the link map. */
3009
+ keyOf(repo, number) {
3010
+ return `${repo}#${String(number)}`;
3011
+ }
3012
+ /** Load every recorded link and resolve the linked issues to cards. */
3013
+ async loadLinks() {
3014
+ try {
3015
+ const remote = await this.api();
3016
+ const links = await remote.links().then((result) => unwrap(result));
3017
+ this.update({ links });
3018
+ this.decorateLoadedCards(links);
3019
+ void this.ensureCards(links);
3020
+ } catch {
3021
+ }
3022
+ }
3023
+ /** Fetch the cards of linked issues that are not in the current list yet. */
3024
+ async ensureCards(links) {
3025
+ const missing = /* @__PURE__ */ new Map();
3026
+ for (const link of links) {
3027
+ const key = this.keyOf(link.repo, link.number);
3028
+ if (this.snapshot.linkCards[key] !== void 0) continue;
3029
+ missing.set(key, { repo: link.repo, number: link.number });
3030
+ }
3031
+ if (missing.size === 0) return;
3032
+ const cards = {};
3033
+ for (const [key, target] of missing.entries()) cards[key] = this.cardFor(target.repo, target.number);
3034
+ if (Object.keys(cards).length === 0) return;
3035
+ this.update({ linkCards: { ...this.snapshot.linkCards, ...cards } });
3036
+ }
3037
+ /** Attach resolved session links to every card the snapshot currently holds. */
3038
+ decorateLoadedCards(links) {
3039
+ const byKey = /* @__PURE__ */ new Map();
3040
+ for (const link of links) {
3041
+ const key = this.keyOf(link.repo, link.number);
3042
+ byKey.set(key, [...byKey.get(key) ?? [], link]);
3043
+ }
3044
+ const decorate = (card) => {
3045
+ const records = byKey.get(this.keyOf(card.repo, card.number));
3046
+ if (records === void 0) return card;
3047
+ return {
3048
+ ...card,
3049
+ sessionLinks: records.map((record) => ({ sessionId: record.sessionId, at: record.at }))
3050
+ };
3051
+ };
3052
+ const list = this.snapshot.list;
3053
+ this.update({
3054
+ ...list === void 0 ? {} : {
3055
+ list: { ...list, items: list.items.map((card) => decorate(card)) }
3056
+ },
3057
+ ...this.snapshot.selected === void 0 ? {} : { selected: decorate(this.snapshot.selected) },
3058
+ ...this.snapshot.detail === void 0 ? {} : { detail: decorate(this.snapshot.detail) },
3059
+ ...this.snapshot.pinnedCard === void 0 ? {} : { pinnedCard: decorate(this.snapshot.pinnedCard) }
3060
+ });
3061
+ }
3062
+ /** Record that a session received this issue (send confirmed). */
3063
+ async linkIssue(card, sessionId) {
3064
+ try {
3065
+ const remote = await this.api();
3066
+ const links = await remote.linkIssue(card.repo, card.number, sessionId).then((result) => unwrap(result));
3067
+ this.update({
3068
+ links,
3069
+ linkCards: { ...this.snapshot.linkCards, [this.keyOf(card.repo, card.number)]: card }
3070
+ });
3071
+ this.decorateLoadedCards(links);
3072
+ } catch {
3073
+ }
3074
+ }
3075
+ /** Remove one issue → session link (or every link of the issue). */
3076
+ async unlinkSession(card, sessionId) {
3077
+ try {
3078
+ const remote = await this.api();
3079
+ const links = await remote.unlinkIssue(card.repo, card.number, sessionId).then((result) => unwrap(result));
3080
+ this.update({ links });
3081
+ const without = (target) => {
3082
+ const remaining = (target.sessionLinks ?? []).filter((link) => sessionId === void 0 || link.sessionId !== sessionId);
3083
+ return { ...target, sessionLinks: remaining };
3084
+ };
3085
+ const list = this.snapshot.list;
3086
+ this.update({
3087
+ ...list === void 0 ? {} : { list: { ...list, items: list.items.map((card2) => without(card2)) } },
3088
+ ...this.snapshot.selected === void 0 ? {} : { selected: without(this.snapshot.selected) },
3089
+ ...this.snapshot.detail === void 0 ? {} : { detail: without(this.snapshot.detail) },
3090
+ ...this.snapshot.pinnedCard === void 0 ? {} : { pinnedCard: without(this.snapshot.pinnedCard) }
3091
+ });
3092
+ } catch (error) {
3093
+ this.update({ error: asPanelError(error) });
3094
+ }
3095
+ }
3096
+ /** Read one optional client service without tripping the context proxy. */
3097
+ service(name) {
3098
+ return this.runtime.getService(name);
3099
+ }
3100
+ /** Open (navigate to) one Session. */
3101
+ openSession(sessionId) {
3102
+ this.service("uiWorkspace")?.openSession(sessionId);
3103
+ }
3104
+ /** Open the GitHub panel focused on one issue. */
3105
+ openInPanel(card) {
3106
+ this.update({ selected: card, detail: void 0, detailLoading: true });
3107
+ this.service("layout")?.selectPanel("github");
3108
+ void (async () => {
3109
+ try {
3110
+ const remote = await this.api();
3111
+ const body = await remote.issueDetail(card.repo, card.number).then((result) => unwrap(result));
3112
+ this.update({
3113
+ detail: { ...card, body: body.body, mentionedPRs: [] },
3114
+ detailLoading: false,
3115
+ mentionedLoading: true
3116
+ });
3117
+ const mentioned = await remote.issueMentionedPRs(card.repo, card.number).then((result) => unwrap(result));
3118
+ const current = this.snapshot.detail;
3119
+ if (current === void 0 || current.repo !== card.repo || current.number !== card.number) return;
3120
+ const closing = new Set(current.linkedPRs.map((pr) => pr.number));
3121
+ this.update({
3122
+ detail: { ...current, mentionedPRs: mentioned.mentionedPRs.filter((pr) => !closing.has(pr.number)) },
3123
+ mentionedLoading: false
3124
+ });
3125
+ } catch (error) {
3126
+ this.update({ detailLoading: false, error: asPanelError(error) });
3127
+ }
3128
+ })();
3129
+ }
3130
+ /**
3131
+ * Take the pending handoff when it belongs to this Session.
3132
+ * @param sessionId - the Session whose dock asks; a handoff stamped for a
3133
+ * different Session is left for that one.
3134
+ * @returns the issue to stage, or `undefined`.
3135
+ */
3136
+ consumeHandoff(sessionId) {
3137
+ const card = this.snapshot.pendingHandoff;
3138
+ if (card === void 0) return void 0;
3139
+ const target = this.snapshot.pendingHandoffSession;
3140
+ if (target !== void 0 && sessionId !== void 0 && target !== sessionId) return void 0;
3141
+ this.update({ pendingHandoff: void 0, pendingHandoffSession: void 0 });
3142
+ return card;
3143
+ }
3144
+ /** Render the profile's handoff prompt for one issue. */
3145
+ promptFor(card) {
3146
+ return renderPrompt(card, this.snapshot.prefs.promptTemplate);
3147
+ }
3148
+ /** Insert one issue into the composer, per the configured handoff behavior. */
3149
+ async insertIntoComposer(card, inputActions) {
3150
+ if (inputActions === void 0) return;
3151
+ const text = this.promptFor(card);
3152
+ if (text === "") return;
3153
+ inputActions.setDraft(text);
3154
+ if (this.snapshot.prefs.handoffMode === "send") inputActions.submit();
3155
+ }
3156
+ };
3157
+
3158
+ // src/client/index.tsx
3159
+ var PANEL_ID = "github";
3160
+ var SETTINGS_ID = "github-issues";
3161
+ var SIDEBAR_KIND2 = "github-issues";
3162
+ var inject = ["slots", "locale", "remote"];
3163
+ function apply(ctx) {
3164
+ ctx.effect(() => ctx.locale.register(NS, DICTS), "github-issues: dictionaries");
3165
+ const t = ctx.locale.bind(NS);
3166
+ const mounting = ctx.remote.$mount(remoteContribution()).then(
3167
+ () => void 0,
3168
+ (error) => error instanceof Error ? error.message : String(error)
3169
+ );
3170
+ const runtime = {
3171
+ getService: (name) => ctx.get(name)
3172
+ };
3173
+ const store = new GitHubStore(ctx, runtime, mounting);
3174
+ ctx.effect(() => {
3175
+ store.start();
3176
+ return () => {
3177
+ store.stop();
3178
+ };
3179
+ }, "github-issues: store");
3180
+ ctx.slots.inject("main", () => ctx.slots.register({
3181
+ name: "main",
3182
+ key: PANEL_ID,
3183
+ locale: NS,
3184
+ inject: () => ({ store, t, runtime })
3185
+ }, PageHost));
3186
+ ctx.slots.inject("sidebar.panellist", () => ctx.slots.register({
3187
+ name: "sidebar.panellist",
3188
+ id: PANEL_ID,
3189
+ order: 20,
3190
+ locale: NS,
3191
+ label: () => t("panel")
3192
+ }, GitHubRailIcon));
3193
+ ctx.slots.inject("conversation.composer.dock", () => ctx.slots.register({
3194
+ name: "conversation.composer.dock",
3195
+ id: "github-issues-handoff",
3196
+ order: -10,
3197
+ locale: NS,
3198
+ inject: () => ({ store, t, runtime })
3199
+ }, DockHost));
3200
+ ctx.slots.inject("settings.section", () => ctx.slots.register({
3201
+ name: "settings.section",
3202
+ id: SETTINGS_ID,
3203
+ order: 30,
3204
+ locale: NS,
3205
+ label: () => t("settings.title"),
3206
+ inject: () => ({ store, t })
3207
+ }, SettingsHost));
3208
+ ctx.slots.inject("conversation.input.overlay", () => ctx.slots.register({
3209
+ name: "conversation.input.overlay",
3210
+ id: "github-issues-pending",
3211
+ order: 20,
3212
+ locale: NS,
3213
+ inject: () => ({ store, t })
3214
+ }, PendingOverlayHost));
3215
+ ctx.slots.inject("conversation.input.dock", () => ctx.slots.register({
3216
+ name: "conversation.input.dock",
3217
+ id: "github-issues-drop",
3218
+ order: 25,
3219
+ locale: NS,
3220
+ inject: () => ({ store, t })
3221
+ }, DropZoneHost));
3222
+ ctx.inject(["sidebarRightTabs"], (scoped) => {
3223
+ const tabs = scoped.sidebarRightTabs;
3224
+ scoped.effect(() => tabs.register({
3225
+ id: SIDEBAR_KIND2,
3226
+ kind: SIDEBAR_KIND2,
3227
+ priority: "extension",
3228
+ title: () => t("sidebar.tab"),
3229
+ guide: [{ id: SIDEBAR_KIND2, title: () => t("sidebar.tab"), order: 45 }]
3230
+ }), "github-issues: right-sidebar type");
3231
+ scoped.slots.inject("sidebar.right.pane.tab", () => scoped.slots.register({
3232
+ name: "sidebar.right.pane.tab",
3233
+ key: SIDEBAR_KIND2,
3234
+ locale: NS,
3235
+ inject: () => ({ store, t })
3236
+ }, SidebarHost));
3237
+ });
3238
+ }
3239
+
3240
+ })(module, exports, require);
3241
+ return module.exports;
3242
+ },
3243
+ });