@staff0rd/assist 0.1217.4 → 0.1217.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.build-files +15 -15
- package/dist/built-version +1 -1
- package/dist/{chunk-VJULCOYT.js → chunk-3RAEAQWV.js} +1 -1
- package/dist/{chunk-YHV4UETG.js → chunk-5LSPCC7W.js} +1 -1
- package/dist/{chunk-FLYNSV6L.js → chunk-BAIGEXPY.js} +20 -0
- package/dist/{chunk-BNPRVYGA.js → chunk-DEN7NCH4.js} +26 -38
- package/dist/{chunk-HOBSS6DQ.js → chunk-K4KEGWZH.js} +1 -1
- package/dist/{chunk-JA2OX46V.js → chunk-KMFYHSFK.js} +1 -1
- package/dist/{chunk-S2GJNVPT.js → chunk-PC2KU7KX.js} +1 -1
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/{doctorNodes-5HZQ6IPJ.js → doctorNodes-BKNH3XH7.js} +3 -3
- package/dist/index.js +12 -12
- package/dist/{restartNode-3MTDY3UY.js → restartNode-FERKTPPG.js} +5 -5
- package/dist/{review-6ZV6272L.js → review-CAWOM22J.js} +302 -246
- package/dist/{runDaemon-KBN2FOBR.js → runDaemon-E342D57U.js} +2 -2
- package/dist/{signExtension-5Q2OQCZV.js → signExtension-XD3ZWXW7.js} +1 -1
- package/dist/{updateNode-XLNH2SHX.js → updateNode-EVH7ATSQ.js} +5 -5
- package/dist/{web-IIYRREHL.js → web-IQDTOLUZ.js} +6 -6
- package/dist/{web-R5V7RYR3.js → web-LXKGHGU5.js} +6 -6
- package/package.json +1 -1
package/dist/.build-files
CHANGED
|
@@ -52,6 +52,7 @@ chunk-3M6IUF5H.js
|
|
|
52
52
|
chunk-3NK55YVZ.js
|
|
53
53
|
chunk-3OYU2N5M.js
|
|
54
54
|
chunk-3PM5JCHE.js
|
|
55
|
+
chunk-3RAEAQWV.js
|
|
55
56
|
chunk-3VDV7VHX.js
|
|
56
57
|
chunk-3WJYRKC3.js
|
|
57
58
|
chunk-4AZGXA6X.js
|
|
@@ -74,6 +75,7 @@ chunk-5AAHWTRQ.js
|
|
|
74
75
|
chunk-5AQT32G3.js
|
|
75
76
|
chunk-5H7EHZ3J.js
|
|
76
77
|
chunk-5JOVEUBS.js
|
|
78
|
+
chunk-5LSPCC7W.js
|
|
77
79
|
chunk-5Q7MUHCK.js
|
|
78
80
|
chunk-5QBWGZWK.js
|
|
79
81
|
chunk-5RFKHBSM.js
|
|
@@ -110,11 +112,11 @@ chunk-B5ZOANOD.js
|
|
|
110
112
|
chunk-B6RAZW2L.js
|
|
111
113
|
chunk-B7B26YPF.js
|
|
112
114
|
chunk-B7VOTF5Q.js
|
|
115
|
+
chunk-BAIGEXPY.js
|
|
113
116
|
chunk-BBE5K7OG.js
|
|
114
117
|
chunk-BGN4WP7H.js
|
|
115
118
|
chunk-BHB7X7F2.js
|
|
116
119
|
chunk-BJOMALJ3.js
|
|
117
|
-
chunk-BNPRVYGA.js
|
|
118
120
|
chunk-BO5JCCC5.js
|
|
119
121
|
chunk-BU6VFZP4.js
|
|
120
122
|
chunk-BVHK2VVT.js
|
|
@@ -130,6 +132,7 @@ chunk-CS7HC5ZN.js
|
|
|
130
132
|
chunk-CVMH6FBE.js
|
|
131
133
|
chunk-D6WBUFXT.js
|
|
132
134
|
chunk-D7UZLH36.js
|
|
135
|
+
chunk-DEN7NCH4.js
|
|
133
136
|
chunk-DFGM4JEV.js
|
|
134
137
|
chunk-DM6BIOGS.js
|
|
135
138
|
chunk-DOVFHJNY.js
|
|
@@ -155,7 +158,6 @@ chunk-EYM57SNL.js
|
|
|
155
158
|
chunk-F4XCHVD7.js
|
|
156
159
|
chunk-F7QYFJB2.js
|
|
157
160
|
chunk-FJMFJN4I.js
|
|
158
|
-
chunk-FLYNSV6L.js
|
|
159
161
|
chunk-FMGU4HY6.js
|
|
160
162
|
chunk-FOPR6LRY.js
|
|
161
163
|
chunk-FPWL4VRC.js
|
|
@@ -177,7 +179,6 @@ chunk-HB2TXZX4.js
|
|
|
177
179
|
chunk-HKGCLAZ7.js
|
|
178
180
|
chunk-HMK7EFEL.js
|
|
179
181
|
chunk-HN7MFXZ7.js
|
|
180
|
-
chunk-HOBSS6DQ.js
|
|
181
182
|
chunk-HR7HIPYM.js
|
|
182
183
|
chunk-I3TEQBTO.js
|
|
183
184
|
chunk-IBPSXDUB.js
|
|
@@ -187,7 +188,6 @@ chunk-IOYGR6YV.js
|
|
|
187
188
|
chunk-IUZKITBG.js
|
|
188
189
|
chunk-IVBWOIGE.js
|
|
189
190
|
chunk-J2OF6KJ4.js
|
|
190
|
-
chunk-JA2OX46V.js
|
|
191
191
|
chunk-JAZX2JSS.js
|
|
192
192
|
chunk-JEARMN2W.js
|
|
193
193
|
chunk-JHBA5IZR.js
|
|
@@ -208,7 +208,9 @@ chunk-JWMBBFAS.js
|
|
|
208
208
|
chunk-JXSVTYHL.js
|
|
209
209
|
chunk-K45LIKCT.js
|
|
210
210
|
chunk-K4DJEFDZ.js
|
|
211
|
+
chunk-K4KEGWZH.js
|
|
211
212
|
chunk-KD2PWI4Z.js
|
|
213
|
+
chunk-KMFYHSFK.js
|
|
212
214
|
chunk-KP5S3FE5.js
|
|
213
215
|
chunk-KQE6OV74.js
|
|
214
216
|
chunk-KQOUE3WV.js
|
|
@@ -261,6 +263,7 @@ chunk-P253KAVC.js
|
|
|
261
263
|
chunk-P26XSDFU.js
|
|
262
264
|
chunk-P5LQVJWN.js
|
|
263
265
|
chunk-P7FVAGFQ.js
|
|
266
|
+
chunk-PC2KU7KX.js
|
|
264
267
|
chunk-PIDKNOD6.js
|
|
265
268
|
chunk-PQX57SJI.js
|
|
266
269
|
chunk-PTWD34JK.js
|
|
@@ -288,7 +291,6 @@ chunk-RFMBA6WA.js
|
|
|
288
291
|
chunk-RNFWWESE.js
|
|
289
292
|
chunk-RQL36BCO.js
|
|
290
293
|
chunk-RXKI4XAU.js
|
|
291
|
-
chunk-S2GJNVPT.js
|
|
292
294
|
chunk-S5PTNGA6.js
|
|
293
295
|
chunk-S6G65GYJ.js
|
|
294
296
|
chunk-S6XYTJU2.js
|
|
@@ -335,7 +337,6 @@ chunk-VEZ3FL5H.js
|
|
|
335
337
|
chunk-VFJK5XMC.js
|
|
336
338
|
chunk-VHRROHRC.js
|
|
337
339
|
chunk-VJQ4IRIH.js
|
|
338
|
-
chunk-VJULCOYT.js
|
|
339
340
|
chunk-VN4XGDT3.js
|
|
340
341
|
chunk-VPJ265PL.js
|
|
341
342
|
chunk-VPMI4LV2.js
|
|
@@ -381,7 +382,6 @@ chunk-Y4C5PXGS.js
|
|
|
381
382
|
chunk-Y7VRIUV2.js
|
|
382
383
|
chunk-YC6BVWED.js
|
|
383
384
|
chunk-YDA62L6J.js
|
|
384
|
-
chunk-YHV4UETG.js
|
|
385
385
|
chunk-YIBSK5OC.js
|
|
386
386
|
chunk-YJ72SXVD.js
|
|
387
387
|
chunk-YKONRK6A.js
|
|
@@ -476,7 +476,7 @@ deps-RSUOIZPE.js
|
|
|
476
476
|
docsConfirm-7BB72JTA.js
|
|
477
477
|
docsScreenshots-JDCKHHDG.js
|
|
478
478
|
docsUnlock-5LTKHHCE.js
|
|
479
|
-
doctorNodes-
|
|
479
|
+
doctorNodes-BKNH3XH7.js
|
|
480
480
|
done-OERWZMJP.js
|
|
481
481
|
drainDaemon-AJVBJMP2.js
|
|
482
482
|
dropRetiredTables-JBLALSG5.js
|
|
@@ -583,15 +583,15 @@ repos-PPGMWO4B.js
|
|
|
583
583
|
resolveHarness-Q53GCTJE.js
|
|
584
584
|
resolveModel-G7GJGUAY.js
|
|
585
585
|
restartDaemon-SGNXXO6H.js
|
|
586
|
-
restartNode-
|
|
586
|
+
restartNode-FERKTPPG.js
|
|
587
587
|
restructure-NBVT3EZS.js
|
|
588
|
-
review-
|
|
588
|
+
review-CAWOM22J.js
|
|
589
589
|
reviewPrComments-5LXAP6G5.js
|
|
590
590
|
rewindPhase-HXENH4NQ.js
|
|
591
591
|
rulesAdd-VIY2XT3H.js
|
|
592
592
|
run-3F43QON5.js
|
|
593
593
|
run-UJTFXZUG.js
|
|
594
|
-
runDaemon-
|
|
594
|
+
runDaemon-E342D57U.js
|
|
595
595
|
runExtract-Q6OMVRSJ.js
|
|
596
596
|
runParallelPhase-QECCEFMQ.js
|
|
597
597
|
runRefine-TGDYSBIQ.js
|
|
@@ -613,7 +613,7 @@ show-SAD23YAK.js
|
|
|
613
613
|
show-UI6QW7R7.js
|
|
614
614
|
showClaudeCodeIcon-E4SAM3GN.js
|
|
615
615
|
showCodexIcon-YUAKV4NI.js
|
|
616
|
-
signExtension-
|
|
616
|
+
signExtension-XD3ZWXW7.js
|
|
617
617
|
simulateDivergence-VB4UL4UR.js
|
|
618
618
|
skip-TSCPOI7Q.js
|
|
619
619
|
slack-VESXSF3I.js
|
|
@@ -641,7 +641,7 @@ unlinkNode-GKFA7U4W.js
|
|
|
641
641
|
unstar-3NROQLQD.js
|
|
642
642
|
update-RGQAZWZO.js
|
|
643
643
|
update-TZ7H4C2Z.js
|
|
644
|
-
updateNode-
|
|
644
|
+
updateNode-EVH7ATSQ.js
|
|
645
645
|
updatePhase-3YMRLEB4.js
|
|
646
646
|
updatePlan-VG5CYX7Z.js
|
|
647
647
|
version-SD3HTBJ2.js
|
|
@@ -649,8 +649,8 @@ viewIssue-N6W53LSK.js
|
|
|
649
649
|
watchLoop-MV7DVGC6.js
|
|
650
650
|
watchReport-A4W7UOAJ.js
|
|
651
651
|
watchWait-3ROYFVMY.js
|
|
652
|
-
web-
|
|
653
|
-
web-
|
|
652
|
+
web-IQDTOLUZ.js
|
|
653
|
+
web-LXKGHGU5.js
|
|
654
654
|
withPool-OXM4WN4L.js
|
|
655
655
|
wontdo-I4M7APVY.js
|
|
656
656
|
wontfix-WGDQ5UU4.js
|
package/dist/built-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1217.
|
|
1
|
+
0.1217.5
|
|
@@ -40,6 +40,25 @@ function ghFailure(error) {
|
|
|
40
40
|
return error instanceof Error ? error.message : "gh api failed";
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
// src/shared/ghRawFileAtSha.ts
|
|
44
|
+
import { execFile } from "child_process";
|
|
45
|
+
import { promisify } from "util";
|
|
46
|
+
var execFileAsync = promisify(execFile);
|
|
47
|
+
async function ghRawFileAtSha(repo, sha, path, maxBuffer) {
|
|
48
|
+
const encodedPath = path.split("/").map(encodeURIComponent).join("/");
|
|
49
|
+
const { stdout } = await execFileAsync(
|
|
50
|
+
"gh",
|
|
51
|
+
[
|
|
52
|
+
"api",
|
|
53
|
+
"-H",
|
|
54
|
+
"Accept: application/vnd.github.raw",
|
|
55
|
+
`repos/${repo}/contents/${encodedPath}?ref=${sha}`
|
|
56
|
+
],
|
|
57
|
+
{ encoding: "utf8", windowsHide: true, maxBuffer }
|
|
58
|
+
);
|
|
59
|
+
return stdout;
|
|
60
|
+
}
|
|
61
|
+
|
|
43
62
|
// src/commands/review/highLevel/progressStore/migrateHighLevelDrafts.ts
|
|
44
63
|
import { existsSync as existsSync2, readdirSync, rmSync } from "fs";
|
|
45
64
|
import { dirname as dirname2, join as join3 } from "path";
|
|
@@ -221,6 +240,7 @@ export {
|
|
|
221
240
|
redactConfigSecrets,
|
|
222
241
|
configEntryLayers,
|
|
223
242
|
ghFailure,
|
|
243
|
+
ghRawFileAtSha,
|
|
224
244
|
highLevelReviewPath,
|
|
225
245
|
readJsonFile,
|
|
226
246
|
writeJsonFile,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "./chunk-JM57BCD6.js";
|
|
11
11
|
import {
|
|
12
12
|
firstBrokenHop
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-K4KEGWZH.js";
|
|
14
14
|
import {
|
|
15
15
|
describePeerError,
|
|
16
16
|
fetchPeerJson
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
import {
|
|
49
49
|
ASSIST_VERSION,
|
|
50
50
|
PROTOCOL_VERSION
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-5LSPCC7W.js";
|
|
52
52
|
import {
|
|
53
53
|
findLinkSpec
|
|
54
54
|
} from "./chunk-JWMBBFAS.js";
|
|
@@ -89,11 +89,12 @@ import {
|
|
|
89
89
|
import {
|
|
90
90
|
configEntryLayers,
|
|
91
91
|
ghFailure,
|
|
92
|
+
ghRawFileAtSha,
|
|
92
93
|
isRedactedSecret,
|
|
93
94
|
loadHighLevelProgress,
|
|
94
95
|
redactConfigSecrets,
|
|
95
96
|
saveHighLevelProgress
|
|
96
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-BAIGEXPY.js";
|
|
97
98
|
import {
|
|
98
99
|
stripAnsi
|
|
99
100
|
} from "./chunk-YJ72SXVD.js";
|
|
@@ -2865,9 +2866,6 @@ async function githubAttachment(req, res) {
|
|
|
2865
2866
|
}
|
|
2866
2867
|
|
|
2867
2868
|
// src/commands/sessions/web/githubFileContent.ts
|
|
2868
|
-
import { execFile as execFile5 } from "child_process";
|
|
2869
|
-
import { promisify as promisify5 } from "util";
|
|
2870
|
-
var execFileAsync5 = promisify5(execFile5);
|
|
2871
2869
|
var MAX_FILE_BYTES2 = 2 * 1024 * 1024;
|
|
2872
2870
|
var REPO2 = /^[\w.-]+\/[\w.-]+$/;
|
|
2873
2871
|
var SHA = /^[0-9a-f]{7,40}$/i;
|
|
@@ -2883,19 +2881,9 @@ async function githubFileContent(req, res) {
|
|
|
2883
2881
|
respondJson(res, 400, { error: "Invalid repo, sha or path" });
|
|
2884
2882
|
return;
|
|
2885
2883
|
}
|
|
2886
|
-
const encodedPath = path7.split("/").map(encodeURIComponent).join("/");
|
|
2887
2884
|
try {
|
|
2888
|
-
const
|
|
2889
|
-
|
|
2890
|
-
[
|
|
2891
|
-
"api",
|
|
2892
|
-
"-H",
|
|
2893
|
-
"Accept: application/vnd.github.raw",
|
|
2894
|
-
`repos/${repo}/contents/${encodedPath}?ref=${sha}`
|
|
2895
|
-
],
|
|
2896
|
-
{ encoding: "utf8", windowsHide: true, maxBuffer: MAX_FILE_BYTES2 }
|
|
2897
|
-
);
|
|
2898
|
-
respondJson(res, 200, { content: stdout });
|
|
2885
|
+
const content = await ghRawFileAtSha(repo, sha, path7, MAX_FILE_BYTES2);
|
|
2886
|
+
respondJson(res, 200, { content });
|
|
2899
2887
|
} catch (error) {
|
|
2900
2888
|
respondJson(res, 502, { error: ghFailure(error) });
|
|
2901
2889
|
}
|
|
@@ -3802,7 +3790,7 @@ async function fetchLinkStateChunks(refs, query) {
|
|
|
3802
3790
|
}
|
|
3803
3791
|
|
|
3804
3792
|
// src/commands/sessions/web/linkStatus/queryLinkStates.ts
|
|
3805
|
-
import { execFile as
|
|
3793
|
+
import { execFile as execFile5 } from "child_process";
|
|
3806
3794
|
|
|
3807
3795
|
// src/commands/sessions/web/linkStatus/linkItemState.ts
|
|
3808
3796
|
function issueState({ state, stateReason }) {
|
|
@@ -3844,7 +3832,7 @@ function linkStatusQuery(refs) {
|
|
|
3844
3832
|
// src/commands/sessions/web/linkStatus/queryLinkStates.ts
|
|
3845
3833
|
function runGraphql(input) {
|
|
3846
3834
|
return new Promise((resolve3, reject) => {
|
|
3847
|
-
const child2 =
|
|
3835
|
+
const child2 = execFile5(
|
|
3848
3836
|
"gh",
|
|
3849
3837
|
["api", "graphql", "--input", "-"],
|
|
3850
3838
|
{ encoding: "utf8", windowsHide: true, maxBuffer: 16 * 1024 * 1024 },
|
|
@@ -4123,9 +4111,9 @@ function newsNavConfig(_req, res) {
|
|
|
4123
4111
|
}
|
|
4124
4112
|
|
|
4125
4113
|
// src/commands/sessions/web/releases/ghJson.ts
|
|
4126
|
-
import { execFile as
|
|
4127
|
-
import { promisify as
|
|
4128
|
-
var
|
|
4114
|
+
import { execFile as execFile6 } from "child_process";
|
|
4115
|
+
import { promisify as promisify5 } from "util";
|
|
4116
|
+
var execFileAsync5 = promisify5(execFile6);
|
|
4129
4117
|
var CACHE_TTL_MS7 = 3e4;
|
|
4130
4118
|
var cache4 = /* @__PURE__ */ new Map();
|
|
4131
4119
|
function partialGraphqlData(error) {
|
|
@@ -4140,7 +4128,7 @@ function partialGraphqlData(error) {
|
|
|
4140
4128
|
}
|
|
4141
4129
|
async function runGh(cwd, args) {
|
|
4142
4130
|
try {
|
|
4143
|
-
const { stdout } = await
|
|
4131
|
+
const { stdout } = await execFileAsync5("gh", args, {
|
|
4144
4132
|
encoding: "utf8",
|
|
4145
4133
|
windowsHide: true,
|
|
4146
4134
|
cwd,
|
|
@@ -5668,8 +5656,8 @@ function listUsageJobs(req, res) {
|
|
|
5668
5656
|
|
|
5669
5657
|
// src/commands/sessions/web/openInCode.ts
|
|
5670
5658
|
import { exec } from "child_process";
|
|
5671
|
-
import { promisify as
|
|
5672
|
-
var execAsync =
|
|
5659
|
+
import { promisify as promisify6 } from "util";
|
|
5660
|
+
var execAsync = promisify6(exec);
|
|
5673
5661
|
async function openInCode(req, res) {
|
|
5674
5662
|
const cwd = getCwdParam(req, res);
|
|
5675
5663
|
if (!cwd) return;
|
|
@@ -5685,9 +5673,9 @@ async function openInCode(req, res) {
|
|
|
5685
5673
|
}
|
|
5686
5674
|
|
|
5687
5675
|
// src/commands/sessions/web/createCachedGhJson.ts
|
|
5688
|
-
import { execFile as
|
|
5689
|
-
import { promisify as
|
|
5690
|
-
var
|
|
5676
|
+
import { execFile as execFile7 } from "child_process";
|
|
5677
|
+
import { promisify as promisify7 } from "util";
|
|
5678
|
+
var execFileAsync6 = promisify7(execFile7);
|
|
5691
5679
|
var CACHE_TTL_MS8 = 3e4;
|
|
5692
5680
|
function createCachedGhJson(args, parse, fallback, options = {}) {
|
|
5693
5681
|
const { cacheFallback = true } = options;
|
|
@@ -5699,7 +5687,7 @@ function createCachedGhJson(args, parse, fallback, options = {}) {
|
|
|
5699
5687
|
if (cached2 && cached2.expires > now) return cached2.value;
|
|
5700
5688
|
let value = fallback;
|
|
5701
5689
|
try {
|
|
5702
|
-
const { stdout } = await
|
|
5690
|
+
const { stdout } = await execFileAsync6("gh", [...args, ...extraArgs], {
|
|
5703
5691
|
encoding: "utf8",
|
|
5704
5692
|
windowsHide: true,
|
|
5705
5693
|
cwd
|
|
@@ -5768,12 +5756,12 @@ async function previewImage(req, res) {
|
|
|
5768
5756
|
}
|
|
5769
5757
|
|
|
5770
5758
|
// src/commands/sessions/web/getCurrentBranch.ts
|
|
5771
|
-
import { execFile as
|
|
5772
|
-
import { promisify as
|
|
5773
|
-
var
|
|
5759
|
+
import { execFile as execFile8 } from "child_process";
|
|
5760
|
+
import { promisify as promisify8 } from "util";
|
|
5761
|
+
var execFileAsync7 = promisify8(execFile8);
|
|
5774
5762
|
async function getCurrentBranch(cwd) {
|
|
5775
5763
|
try {
|
|
5776
|
-
const { stdout } = await
|
|
5764
|
+
const { stdout } = await execFileAsync7(
|
|
5777
5765
|
"git",
|
|
5778
5766
|
["rev-parse", "--abbrev-ref", "HEAD"],
|
|
5779
5767
|
{ encoding: "utf8", windowsHide: true, cwd }
|
|
@@ -7489,11 +7477,11 @@ async function uploadPrImage(req, res) {
|
|
|
7489
7477
|
import { readFile as readFile2, stat as stat3, writeFile } from "fs/promises";
|
|
7490
7478
|
|
|
7491
7479
|
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
7492
|
-
import { execFile as
|
|
7480
|
+
import { execFile as execFile9 } from "child_process";
|
|
7493
7481
|
import { existsSync as existsSync7 } from "fs";
|
|
7494
7482
|
import { dirname as dirname2, join as join7 } from "path";
|
|
7495
|
-
import { promisify as
|
|
7496
|
-
var
|
|
7483
|
+
import { promisify as promisify9 } from "util";
|
|
7484
|
+
var execFileAsync8 = promisify9(execFile9);
|
|
7497
7485
|
var TIMEOUT_MS = 15e3;
|
|
7498
7486
|
function findOxfmtScript(root) {
|
|
7499
7487
|
let dir = root;
|
|
@@ -7508,7 +7496,7 @@ function findOxfmtScript(root) {
|
|
|
7508
7496
|
async function formatWithOxfmt(target, root) {
|
|
7509
7497
|
const script = findOxfmtScript(root);
|
|
7510
7498
|
if (!script) return;
|
|
7511
|
-
await
|
|
7499
|
+
await execFileAsync8(process.execPath, [script, target], {
|
|
7512
7500
|
cwd: root,
|
|
7513
7501
|
windowsHide: true,
|
|
7514
7502
|
timeout: TIMEOUT_MS
|
|
@@ -4148,7 +4148,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4148
4148
|
`)){let n=t[t.length-1];r.startsWith("@@")||n===void 0?t.push(r):t[t.length-1]=`${n}
|
|
4149
4149
|
${r}`}return t}function $Zr(e){return BZr(e??"").filter(t=>t.startsWith("@@"))}function SKo(e){return Number(/^@@ -(\d+)/.exec(e)?.[1]??1)}function TKo(e){return/^@@[^@]*@@/.exec(e)?.[0]??e.split(`
|
|
4150
4150
|
`)[0]??""}function FZr(e,t){return e.reduce((r,n)=>r+OZr(n,t),0)}function zZr(e,t,r){let n=$Zr(e.patch),o=[],i=[];return n.forEach((a,s)=>{let l=r.get(`${e.path}#${s}`)??[];l.includes(t)?o.push(a):i.push({oldStart:SKo(a),header:TKo(a),slice:l[0]??0})}),o.length===0||i.length===0?e:{...e,patch:o.join(`
|
|
4151
|
-
`),additions:FZr(o,"+"),deletions:FZr(o,"-"),split:{hunks:o.length,of:n.length,elsewhere:i}}}function HZr(e){return e.flatMap(t=>{if(t.kind==="dir")return HZr(t.children);let{kind:r,name:n,...o}=t;return[o]})}function wKo(e){let t=new Map;return e.forEach((r,n)=>{for(let o of r.hunks)t.set(o,[...t.get(o)??[],n+1])}),t}function UZr(e,t,r=new Set,n=new Set){let o=HZr(e.tree).filter(a=>!r.has(a.path)).map(a=>n.has(a.path)?{...a,critical:!0}:a),i=wKo(t);return t.map((a,s)=>{let l=new Set(a.hunks.map(fY));return NZr(o.filter(u=>l.has(u.path)).map(u=>zZr(u,s+1,i)))})}function CKo(e,t){let r=-1,n=0;return t.forEach((o,i)=>{let a=o.hunks.filter(s=>fY(s)===e).length;a>n&&(r=i,n=a)}),r}function WZr(e,t){let r=t.map(()=>[]);for(let n of e)r[CKo(n.path,t)]?.push(n);return r}function VZr(e,t){let r=UZr(e.structure,t,new Set(e.tests.map(i=>i.path)),new Set(e.criticalDiffs.map(i=>i.path))),n=WZr(e.tests,t),o=jPe(t);return t.map((i,a)=>{let s=a+1;return{number:s,slice:i,structure:r[a]??e.structure,tests:n[a]??[],critical:e.criticalDiffs.filter(l=>o.get(l.path)?.some(u=>u.number===s))}})}function GZr(e){if(!e.slices)return;let t=VZr(e,e.slices);return{entries:EZr(e,t),slicing:{count:t.length,noCritical:new Set(t.filter(r=>r.critical.length===0).map(r=>r.number))}}}function qZr(e){let t=e;return typeof t?.id=="string"&&typeof t.title=="string"&&typeof t.reason=="string"&&(t.kind==="deterministic"||t.kind==="manual")&&["pass","fail","manual"].includes(t.status)}function MN(e,t){return Array.isArray(e)?t?e.filter(t):e:[]}var eyt=e=>typeof e=="string"?e:"";function jZr(e){return{repo:eyt(e.repo),prNumber:typeof e.prNumber=="number"?e.prNumber:0,headSha:eyt(e.headSha),body:eyt(e.body)}}var tyt={repo:"",prNumber:0,headSha:"",body:"",checks:[],structure:{tree:[],added:0,removed:0,modified:0,additions:0,deletions:0},criticalDiffs:[],criticalPaths:[],tests:[],testPaths:[],collapsedPaths:[]};function yAe(e){let t;try{t=JSON.parse(e)}catch{return tyt}return typeof t!="object"||t===null?tyt:{...jZr(t),checks:MN(t.checks,qZr),structure:{...tyt.structure,...t.structure},criticalDiffs:MN(t.criticalDiffs),criticalPaths:MN(t.criticalPaths),tests:MN(t.tests),testPaths:MN(t.testPaths),collapsedPaths:MN(t.collapsedPaths),...Array.isArray(t.slices)?{slices:t.slices}:{},...t.manualTesting?{manualTesting:t.manualTesting}:{},...t.saved?{saved:t.saved}:{},...t.progress?{progress:t.progress}:{}}}function YZr(e){let t=(0,ryt.useMemo)(()=>yAe(e.body),[e.body]),r=(0,ryt.useMemo)(()=>GZr(t),[t]);return{payload:t,sliced:r}}var KZr=x(te(),1);function XZr(e){let[t,r]=(0,KZr.useState)(()=>e?.reviewComments??[]);return{queued:t,onQueue:n=>r(o=>[...o,n]),onRemove:n=>r(o=>o.filter((i,a)=>a!==n)),onEdit:(n,o)=>r(i=>i.map((a,s)=>s===n?{...a,note:o}:a))}}var Ple=x(te(),1);function ZZr(e,t,r){let n=(0,Ple.useRef)(!1),o=(0,Ple.useRef)(r);o.current=r,(0,Ple.useEffect)(()=>{if(!n.current){n.current=!0;return}o.current({items:e,reviewComments:t})},[e,t])}function JZr(e,t,r,n){let{payload:o,sliced:i}=YZr(e),{progress:a}=n,s=kZr(o.checks,a,i?.slicing),l=XZr(a),u=mZr(i?.entries??[]),{comments:d,sentTo:f,clearSent:p}=Kj(t,r),h={...d,onQueue:l.onQueue};ZZr(s.items,l.queued,n.onChange);let m=(0,QZr.useMemo)(()=>xZr(o),[o]);return{payload:o,checklist:s,queue:l,details:bZr(o,h),counts:m,sentTo:f,clearSent:p,sliced:i,nav:u,diffComments:h}}var BS=x(_(),1);function eQr({preview:e,session:t,sendInput:r,stored:n,onDecision:o}){let i=JZr(e,t,r,n);return(0,BS.jsxs)(H,{sx:c0,children:[(0,BS.jsx)($h,{preview:e,draft:!1}),(0,BS.jsx)(Zj,{items:e.metadata??[]}),(0,BS.jsx)(jn,{}),(0,BS.jsx)(eZr,{payload:i.payload,checklist:i.checklist,details:i.details,counts:i.counts,sliced:i.sliced,nav:i.nav,comments:i.diffComments}),(0,BS.jsx)(jn,{}),(0,BS.jsx)(pZr,{pane:i,onDecision:(a,s)=>{n.close(),o(a,s)}}),(0,BS.jsx)(ff,{sessionName:i.sentTo,onClose:i.clearSent})]})}var xAe=x(te(),1);var Ale=x(te(),1);var vAe="/api/high-level-progress";function tQr(e,t){let r,n,o=!1,i=s=>$t(_r(vAe,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,...s})}).catch(l=>xr(l,"high-level progress write")),a=async()=>{for(;r;){let s=r;r=void 0,await i(s)}n=void 0};return{write(s){o||(r=s,n??(n=a()))},close(){o=!0}}}function rQr(e,t){let{repo:r,prNumber:n,headSha:o,requestId:i}=e,a=(0,Ale.useMemo)(()=>r&&o?tQr({repo:r,prNumber:n,headSha:o,requestId:i},t):void 0,[r,n,o,i,t]),s=(0,Ale.useRef)(!1),l=(0,Ale.useRef)(void 0);return{markLoaded:()=>(s.current=!0,l.current&&a?.write(l.current),l.current!==void 0),onChange:u=>{l.current=u,s.current&&a?.write(u)},close:()=>a?.close()}}var bAe=x(te(),1);async function nQr(e,t){let r=new URLSearchParams({repo:e.repo,prNumber:String(e.prNumber),headSha:e.headSha}),n=await $t(_r(`${vAe}?${r}`,t));if(!n.ok)throw new Error(`HTTP ${n.status}`);return(await n.json()).progress??void 0}function oQr(e,t,r){let n=(0,bAe.useRef)(r);n.current=r;let{repo:o,prNumber:i,headSha:a}=e;(0,bAe.useEffect)(()=>{if(!o||!a)return;let s=!1,l=u=>{s||n.current(u)};return nQr({repo:o,prNumber:i,headSha:a},t).then(l,()=>l(void 0)),()=>{s=!0}},[o,i,a,t])}function iQr(e,t){let r=(0,xAe.useMemo)(()=>yAe(e.body),[e.body]),n={repo:r.repo,prNumber:r.prNumber,headSha:r.headSha},[o,i]=(0,xAe.useState)(()=>({progress:r.progress??r.saved,version:0})),a=rQr({...n,requestId:e.requestId},t);return oQr(n,t,s=>{a.markLoaded()||!s||s.updatedAt!==r.progress?.updatedAt&&i(u=>({progress:s,version:u.version+1}))}),{...o,onChange:a.onChange,close:a.close}}var sQr=x(_(),1);function aQr({preview:e,session:t,sendInput:r,onDecision:n}){let o=iQr(e,t?.node);return(0,sQr.jsx)(eQr,{preview:e,session:t,sendInput:r,stored:o,onDecision:n},o.version)}var mQr=x(te(),1);var NN=x(_(),1);function kKo(e){return e.topLeft===null?"Click the top-left box":e.bottomRight===null?"Now click the bottom-right box":"Both anchors picked"}function lQr({selection:e,onConfirm:t,onReject:r}){let n=e.topLeft!==null&&e.bottomRight!==null;return(0,NN.jsxs)(bt,{direction:"row",spacing:1,sx:{p:2,alignItems:"center",justifyContent:"flex-end"},children:[(0,NN.jsx)(ve,{variant:"body2",sx:{flex:1,color:"text.secondary"},children:kKo(e)}),(0,NN.jsx)(et,{color:"error",variant:"outlined",onClick:r,children:"Cancel"}),(0,NN.jsx)(et,{variant:"outlined",onClick:e.reset,children:"Start over"}),(0,NN.jsx)(et,{color:"success",variant:"contained",disabled:!n,onClick:t,children:"Extract boxes"})]})}var _Ko={"top-left":nc.miro.topLeft,"bottom-right":nc.miro.bottomRight};function cQr(e,t){let r=e.right-e.left,n=e.bottom-e.top;return{width:r,height:n,fontSize:Math.max(6,Math.min(n*.3,r/6,28)),radius:Math.min(8,n/4),colour:t?_Ko[t]:nc.miro.box,opacity:t?.75:.35,strokeWidth:Math.max(1,r*.004)}}var Lle=x(_(),1);function uQr({box:e,role:t,onSelect:r}){let n=cQr(e,t);return(0,Lle.jsxs)("g",{role:"button",tabIndex:0,"aria-label":t?`${e.text} (${t})`:e.text,onClick:()=>r(e.id),onKeyDown:o=>{o.key==="Enter"&&r(e.id)},style:{cursor:"pointer"},children:[(0,Lle.jsx)("rect",{x:e.left,y:e.top,width:n.width,height:n.height,rx:n.radius,fill:n.colour,fillOpacity:n.opacity,stroke:n.colour,strokeWidth:n.strokeWidth}),(0,Lle.jsx)("text",{x:e.left+n.width/2,y:e.top+n.height/2,textAnchor:"middle",dominantBaseline:"central",fontSize:n.fontSize,fill:nc.miro.text,children:e.text})]})}function dQr(e){if(e.length===0)return"0 0 100 100";let t=Math.min(...e.map(a=>a.left)),r=Math.min(...e.map(a=>a.top)),n=Math.max(...e.map(a=>a.right))-t,o=Math.max(...e.map(a=>a.bottom))-r,i=Math.max(n*.02,8);return`${t-i} ${r-i} ${n+i*2} ${o+i*2}`}var SAe=x(_(),1);function fQr({boxes:e,selection:t}){return(0,SAe.jsx)(H,{sx:{flex:1,minHeight:0,overflow:"auto",p:2},children:(0,SAe.jsx)("svg",{role:"img","aria-label":"Miro board boxes",viewBox:dQr(e),preserveAspectRatio:"xMidYMid meet",style:{width:"100%",height:"100%"},children:e.map(r=>(0,SAe.jsx)(uQr,{box:r,role:t.roleOf(r.id),onSelect:t.choose},r.id))})})}function EKo(e){return typeof e?.id=="string"&&typeof e.text=="string"&&[e.left,e.top,e.right,e.bottom].every(t=>typeof t=="number"&&Number.isFinite(t))}function pQr(e){try{let t=JSON.parse(e);return Array.isArray(t?.boxes)?t.boxes.filter(EKo):[]}catch{return[]}}var nyt=x(te(),1);function hQr(){let[e,t]=(0,nyt.useState)(null),[r,n]=(0,nyt.useState)(null);return{topLeft:e,bottomRight:r,choose:s=>{if(e===null||r!==null){t(s),n(null);return}n(s)},reset:()=>{t(null),n(null)},roleOf:s=>s===e?"top-left":s===r?"bottom-right":null}}var Y3=x(_(),1);function gQr({preview:e,onDecision:t}){let r=(0,mQr.useMemo)(()=>pQr(e.body),[e.body]),n=hQr();return(0,Y3.jsxs)(H,{sx:c0,children:[(0,Y3.jsx)($h,{preview:e,draft:!1}),(0,Y3.jsx)(jn,{}),(0,Y3.jsx)(fQr,{boxes:r,selection:n}),(0,Y3.jsx)(jn,{}),(0,Y3.jsx)(lQr,{selection:n,onConfirm:()=>{let{topLeft:i,bottomRight:a}=n;i===null||a===null||t("approve",Vc({topLeft:i,bottomRight:a}))},onReject:()=>t("reject",Vc())})]})}var jQr=x(te(),1);function yQr(e){let t=[];return e.map(r=>(t.length=r+1,t[r]=(t[r]??0)+1,t.map(n=>n??1).join(".")))}function TAe(e){return e*22}function vQr(e){return Math.round(e/22)}var bQr={display:"flex",alignItems:"flex-start",gap:.25,"& .criterion-action":{opacity:0,transition:"opacity 120ms"},"&:hover .criterion-action":{opacity:1},"&:focus-within .criterion-action":{opacity:1},"& .criterion-action:focus-visible":{opacity:1}},xQr={p:.25,mt:"2px",color:"text.disabled",cursor:"grab",touchAction:"none","&:active":{cursor:"grabbing"}},SQr={fontFamily:"fontFamilyMono",fontSize:"0.8rem",color:"text.secondary",minWidth:32,pt:"5px",textAlign:"right",userSelect:"none",whiteSpace:"nowrap"},TQr={flex:1,fontSize:"inherit",lineHeight:1.5,px:.75,py:0,borderRadius:1,"&:hover":{bgcolor:"action.hover"},"&.Mui-focused":{bgcolor:"action.selected"}},oyt={p:.25,mt:"2px"},wQr={position:"absolute",right:8,height:2,borderRadius:1,bgcolor:"primary.main",pointerEvents:"none"};var kQr=x(_(),1),RKo=8;function CQr({drag:e}){return e?(0,kQr.jsx)(H,{sx:wQr,style:{top:e.top-1,left:RKo+TAe(e.depth)}}):null}var _Qr=x(_(),1),EQr=ot((0,_Qr.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator");var iyt=x(_(),1);function RQr({number:e,onGrip:t}){return(0,iyt.jsx)(Mt,{size:"small",className:"criterion-action",sx:xQr,"aria-label":`Reorder criterion ${e}`,onPointerDown:t,children:(0,iyt.jsx)(EQr,{fontSize:"inherit"})})}var gk=x(_(),1);function PQr({number:e,onAdd:t,onDelete:r}){return(0,gk.jsxs)(gk.Fragment,{children:[(0,gk.jsx)(Mt,{size:"small",className:"criterion-action",sx:oyt,"aria-label":`Add criterion after ${e}`,onClick:t,children:(0,gk.jsx)(Yd,{fontSize:"inherit"})}),(0,gk.jsx)(Mt,{size:"small",className:"criterion-action",sx:oyt,"aria-label":`Delete criterion ${e}`,onClick:r,children:(0,gk.jsx)(Eo,{fontSize:"inherit"})})]})}var wAe=x(te(),1);function AQr(e,t){return e==="start"?0:e==="end"?t:Math.min(Math.max(e,0),t)}function LQr(e){let t=(0,wAe.useRef)(null);return(0,wAe.useEffect)(()=>{let r=t.current;if(!e||!r)return;r.focus();let n=AQr(e.caret,r.value.length);r.setSelectionRange(n,n)},[e]),t}var ON=x(_(),1);function IQr({index:e,number:t,item:r,outline:n,dragging:o,onGrip:i}){let a=LQr(n.focus?.index===e?n.focus:null),s={marginLeft:TAe(r.depth),opacity:o?.4:1};return(0,ON.jsxs)(H,{sx:bQr,"data-criterion-row":!0,style:s,children:[(0,ON.jsx)(RQr,{number:t,onGrip:i}),(0,ON.jsx)(H,{component:"span",sx:SQr,"aria-hidden":"true",children:`${t}.`}),(0,ON.jsx)(Hi,{multiline:!0,value:r.text,sx:TQr,inputRef:a,inputProps:{"aria-label":`Criterion ${t}`},onChange:l=>n.onText(e,l.target.value),onKeyDown:l=>n.onKeyDown(e,l)}),(0,ON.jsx)(PQr,{number:t,onAdd:()=>n.onAdd(e),onDelete:()=>n.onDelete(e)})]})}var FQr=x(te(),1);function DQr(e,t,{key:r,shift:n,alt:o,caret:i,text:a}){return o||n?null:r==="ArrowUp"&&i===0&&t>0?{kind:"focus",index:t-1}:r==="ArrowDown"&&i===a.length&&t<e.length-1?{kind:"focus",index:t+1}:null}function K3(e){if(e.length===0)return[{text:"",depth:0}];let t=-1;return e.map(r=>{let n=Math.min(Math.max(r.depth,0),t+1);return t=n,r.depth===n?r:{...r,depth:n}})}function CAe(e,t,r,n){let o=e[t]?.depth??0,i=e.map((a,s)=>s===t?{...a,text:r}:a);return{items:K3([...i.slice(0,t+1),{text:n,depth:o},...i.slice(t+1)]),index:t+1}}function mg(e,t){let r=t+1;for(;r<e.length&&e[r].depth>e[t].depth;)r+=1;return r}function kAe(e,t){let r=e[t].depth;for(let n=t-1;n>=0;n-=1){if(e[n].depth<r)return-1;if(e[n].depth===r)return n}return-1}function MQr(e,t){let r=mg(e,t);return r<e.length&&e[r].depth===e[t].depth?r:-1}function NQr(e,t,r){let n=r<0?kAe(e,t):MQr(e,t);if(n<0)return null;let o=mg(e,t),i=e.slice(t,o),a=[...e.slice(0,t),...e.slice(o)],s=r<0?n:mg(e,n)-(o-t);return{items:[...a.slice(0,s),...i,...a.slice(s)],index:s}}function _Ae(e,t){let r=mg(e,t),n=e.map((o,i)=>i>t&&i<r?{...o,depth:o.depth-1}:o).filter((o,i)=>i!==t);return{items:K3(n),index:Math.max(0,t-1)}}function OQr(e,t,r){if(r<0&&e[t].depth===0||r>0&&kAe(e,t)<0)return null;let n=mg(e,t);return e.map((o,i)=>i>=t&&i<n?{...o,depth:o.depth+r}:o)}function EAe(e,t){return e?{kind:"edit",edit:e,caret:t}:null}function PKo(e,t,{caret:r,text:n}){let o=n.slice(0,r);return EAe(CAe(e,t,o,n.slice(r)),"start")}function AKo(e,t,{shift:r,caret:n}){let o=OQr(e,t,r?-1:1);return EAe(o?{items:o,index:t}:null,n)}function BQr(e,t,r){let{key:n,shift:o,alt:i,caret:a,text:s}=r;return n==="Enter"&&!o?PKo(e,t,r):n==="Tab"?AKo(e,t,r):i&&(n==="ArrowUp"||n==="ArrowDown")?EAe(NQr(e,t,n==="ArrowUp"?-1:1),a):n==="Backspace"&&a===0&&s===""?EAe(_Ae(e,t),"end"):null}function $Qr(e,t,r){return BQr(e,t,r)??DQr(e,t,r)}function zQr(e,t){let[r,n]=(0,FQr.useState)(null),o=(a,s)=>{a&&(t(a.items),n({index:a.index,caret:s}))};return{focus:r,onKeyDown:(a,s)=>{let l=s.currentTarget;(s.key==="Enter"||s.key==="Tab")&&s.preventDefault();let u=$Qr(e,a,{key:s.key,shift:s.shiftKey,alt:s.altKey,caret:l.selectionStart??0,text:l.value});u&&(s.preventDefault(),u.kind==="focus"?n({index:u.index,caret:"end"}):o(u.edit,u.caret))},onDrop:a=>o(a,"end"),onText:(a,s)=>t(e.map((l,u)=>u===a?{...l,text:s}:l)),onAdd:a=>o(CAe(e,a,e[a].text,""),"start"),onDelete:a=>o(_Ae(e,a),"end")}}var GQr=x(te(),1);function LKo(e,t,r,n){let o=t.length;for(let a=0;a<e.length;a+=1)if(n<e[a].top+e[a].height/2){o=a;break}let i=mg(t,r);return o>r&&o<i?r:o}function IKo(e,t,r,n){let o=mg(e,t),i=r-1,a=i>=t&&i<o?t-1:i,s=a>=0?e[a].depth+1:0;return Math.max(0,Math.min(e[t].depth+vQr(n),s))}function DKo(e,t){if(t<e.length)return e[t].top;let r=e[e.length-1];return r?r.top+r.height:0}function HQr(e,t,r,n,o){let i=LKo(e,t,r,o);return{target:i,depth:IKo(t,r,i,n),top:DKo(e,i)}}function MKo(e){let t=e.getBoundingClientRect().top;return{boxes:Array.from(e.querySelectorAll("[data-criterion-row]")).map(n=>{let o=n.getBoundingClientRect();return{top:o.top-t,height:o.height}}),origin:t}}function UQr(e,t,r,n){return o=>{let{boxes:i,origin:a}=MKo(t);return HQr(i,e,r,o.clientX-n,o.clientY-a)}}function WQr(e,t,r,n,o){let i=new AbortController,a=null,s=d=>{a=r(d),n(a)},l=()=>{i.abort(),a&&o(a)},u={signal:i.signal};return e.setPointerCapture(t),e.addEventListener("pointermove",s,u),e.addEventListener("pointerup",l,u),e.addEventListener("pointercancel",l,u),s}function VQr(e,t,r,n){let o=mg(e,t),i=n-e[t].depth,a=e.slice(t,o).map(u=>({...u,depth:Math.max(0,u.depth+i)})),s=[...e.slice(0,t),...e.slice(o)],l=r>t?r-a.length:r;return{items:K3([...s.slice(0,l),...a,...s.slice(l)]),index:l}}function qQr(e,t,r){let[n,o]=(0,GQr.useState)(null);return{drag:n,onGrip:a=>s=>{let l=t.current;if(!l||s.pointerType==="mouse"&&s.button!==0)return;s.preventDefault(),WQr(s.currentTarget,s.pointerId,UQr(e,l,a,s.clientX),d=>o({from:a,depth:d.depth,top:d.top}),d=>{o(null),r(VQr(e,a,d.target,d.depth))})(s)}}}var Ile=x(_(),1),NKo={my:1,px:1,py:.5,border:1,borderColor:"divider",borderRadius:1,position:"relative",userSelect:"text",cursor:"auto"},OKo=[{text:"",depth:0}];function YQr({items:e,onChange:t}){let r=(0,jQr.useRef)(null),n=e.length>0?e:OKo,o=zQr(n,t),{drag:i,onGrip:a}=qQr(n,r,o.onDrop),s=yQr(n.map(l=>l.depth));return(0,Ile.jsxs)(H,{sx:NKo,ref:r,"data-preview-skip":!0,"aria-label":"Acceptance criteria",children:[n.map((l,u)=>(0,Ile.jsx)(IQr,{index:u,number:s[u],item:l,outline:o,dragging:i?.from===u,onGrip:a(u)},`criterion-${u}`)),(0,Ile.jsx)(CQr,{drag:i})]})}var KQr=x(_(),1),XQr=ot((0,KQr.jsx)("path",{d:"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2zm1-9h1V4H2v1h1zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2zm5-6v2h14V5zm0 14h14v-2H7zm0-6h14v-2H7z"}),"FormatListNumbered");var Dle=x(_(),1),BKo={insert:"Add acceptance criteria",convert:"Convert to outline"};function ZQr({kind:e,onClick:t}){return(0,Dle.jsx)(H,{sx:{my:1},"data-preview-skip":!0,children:(0,Dle.jsx)(et,{size:"small",variant:"outlined",startIcon:e==="insert"?(0,Dle.jsx)(Yd,{}):(0,Dle.jsx)(XQr,{}),onClick:t,children:BKo[e]})})}var Mle=x(te(),1);function QQr(e,t,{color:r,pin:n}){let o=V6(e),i=[],a=o.nextNode();for(;a;){let u=a;if(t.intersectsNode(u)){let d=u===t.startContainer?t.startOffset:0,f=u===t.endContainer?t.endOffset:u.length;d<f&&i.push({node:u,start:d,end:f})}a=o.nextNode()}let l=i.map(u=>$Ko(u.node,u.start,u.end,r)).at(-1);l&&n&&(l.dataset.pin=n)}function $Ko(e,t,r,n){let o=document.createRange();o.setStart(e,t),o.setEnd(e,r);let i=document.createElement("mark");return i.className="pr-comment",i.style.backgroundColor=n,o.surroundContents(i),i}function JQr(e){for(let t of e.querySelectorAll("mark.pr-comment"))if(t.parentNode){for(;t.firstChild;)t.before(t.firstChild);t.remove()}}function eJr(e,t){for(let r of t){let n=u7t(e,r);n&&QQr(e,n,r)}}var Nle=x(_(),1);function tJr({content:e,control:t,trailing:r,ranges:n,contentRef:o}){let i=(0,Mle.useMemo)(()=>YD(e),[e]),a=(0,Mle.useMemo)(()=>YD(r??""),[r]);return(0,Mle.useLayoutEffect)(()=>{let s=o.current;s&&(JQr(s),eJr(s,n))},[i,a,n,o]),(0,Nle.jsxs)(H,{ref:o,children:[(0,Nle.jsx)(VD,{segments:i,skipDiagramText:!0}),t,t?(0,Nle.jsx)(VD,{segments:a,skipDiagramText:!0}):null]})}var BN=e=>e.split(",").map(t=>`&& .markdown ${t.trim()}`).join(", ");function RAe(e){let{color:t,radius:r}=e.tokens;return{px:2.5,py:2,fontSize:14,lineHeight:1.6,[BN("")]:{lineHeight:1.6},[BN("h1, h2, h3, h4, h5, h6")]:{fontSize:15,fontWeight:600,lineHeight:1.4,mt:2,mb:1},[BN("ul, ol")]:{pl:2.5,mb:2},[BN("li")]:{mb:"6px"},[BN("code")]:{fontFamily:e.typography.fontFamilyMono,fontSize:"0.86em",px:"5px",py:0,bgcolor:t.raised,border:1,borderColor:t.lineSoft,borderRadius:"4px"},[BN("pre")]:{bgcolor:t.raised,border:1,borderColor:t.lineSoft,borderRadius:`${r.sm}px`},[BN("pre code")]:{border:0,px:0,bgcolor:"transparent"}}}var rJr=e=>({flex:1,overflow:"auto",position:"relative",userSelect:"none",cursor:"text",wordBreak:"break-word","& .markdown":{...u9(e),maxWidth:"none"},"& a":{color:"primary.main"},"& mark.pr-comment":{color:"inherit",borderRadius:"2px"},...RAe(e)});var SY=x(_(),1);function nJr({content:e,control:t,trailing:r,ranges:n,wrapperRef:o,contentRef:i,dragRects:a,dragColor:s,onMouseDown:l,footer:u}){return(0,SY.jsxs)(H,{ref:o,onMouseDown:l,sx:rJr,children:[(0,SY.jsx)(tJr,{content:e,control:t,trailing:r,ranges:n,contentRef:i}),u&&(0,SY.jsx)(H,{sx:{userSelect:"text"},children:u}),(0,SY.jsx)(e9,{rects:a,color:s})]})}function oJr(e){let t=new Map,r=[];for(let n of e){if(!n.group){r.push(n);continue}t.set(n.group,[...t.get(n.group)??[],n])}return{groups:[...t],ungrouped:r}}var PAe=x(te(),1),iJr=x(_(),1);function ayt({label:e,value:t,onCommit:r,listId:n}){let[o,i]=(0,PAe.useState)(t);return(0,PAe.useEffect)(()=>i(t),[t]),(0,iJr.jsx)(An,{size:"small",variant:"standard",fullWidth:!0,label:e,value:o,onChange:s=>i(s.target.value),onBlur:()=>{let s=o.trim();i(t),s!==t&&r(s)},onKeyDown:s=>{s.key==="Enter"&&s.target.blur()},onMouseDown:s=>s.stopPropagation(),slotProps:{htmlInput:{list:n}}})}var Ole=x(_(),1),syt="screenshot-groups";function FKo(e){return(e.split(/[\\/]/).pop()??e).replace(/\.[^.]+$/,"")}function aJr({screenshot:e,onUpdate:t}){return(0,Ole.jsxs)(bt,{direction:"row",spacing:1,sx:{mt:.5},children:[(0,Ole.jsx)(ayt,{label:"Caption",value:e.alt,onCommit:r=>t(e.id,{alt:r||FKo(e.path)})}),(0,Ole.jsx)(ayt,{label:"Group",value:e.group??"",listId:syt,onCommit:r=>t(e.id,{group:r})})]})}var X3=x(_(),1),sJr={display:"block",maxWidth:"100%",borderRadius:1,border:1,borderColor:"divider"},zKo={position:"absolute",top:4,right:4,bgcolor:"background.paper","&:hover":{bgcolor:"background.paper"}};function lJr({screenshot:e,onRemove:t,onUpdate:r}){let n=e.contentType.startsWith("video/");return(0,X3.jsxs)(H,{sx:{position:"relative"},children:[n?(0,X3.jsx)(H,{component:"video",controls:!0,src:e.url,"aria-label":"screenshot",sx:sJr}):(0,X3.jsx)(H,{component:"img",src:e.url,alt:"screenshot",sx:sJr}),(0,X3.jsx)(Mt,{size:"small","aria-label":"Remove screenshot",sx:zKo,onMouseDown:o=>o.stopPropagation(),onClick:()=>t(e.id),children:(0,X3.jsx)(Eo,{fontSize:"small"})}),(0,X3.jsx)(aJr,{screenshot:e,onUpdate:r})]})}var y0=x(_(),1);function HKo(){return(0,y0.jsxs)(bt,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,y0.jsx)(ao,{size:16}),(0,y0.jsx)(ve,{variant:"caption",color:"text.secondary",children:"Attaching screenshot or video\u2026"})]})}function UKo({error:e}){return(0,y0.jsx)(ve,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:e})}function cJr({uploads:e,empty:t}){return e.length>0?(0,y0.jsx)(y0.Fragment,{children:e.map(r=>r.error?(0,y0.jsx)(UKo,{error:r.error},r.id):(0,y0.jsx)(HKo,{},r.id))}):t?(0,y0.jsx)(ve,{variant:"caption",color:"text.secondary",children:"Drop or paste an image or video to attach"}):null}var v0=x(_(),1),WKo={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:1};function uJr({screenshots:e,uploads:t,onRemove:r,onUpdate:n}){let{groups:o,ungrouped:i}=oJr(e),a=s=>(0,v0.jsx)(lJr,{screenshot:s,onRemove:r,onUpdate:n},s.id);return(0,v0.jsxs)(H,{sx:{mt:3},children:[e.length>0&&(0,v0.jsx)(H,{component:"h2",children:"Screenshots"}),(0,v0.jsx)("datalist",{id:syt,children:o.map(([s])=>(0,v0.jsx)("option",{value:s},s))}),o.map(([s,l])=>(0,v0.jsxs)(H,{sx:{mb:2},children:[(0,v0.jsx)(H,{component:"h3",children:s}),(0,v0.jsx)(H,{sx:WKo,children:l.map(a)})]},s)),(0,v0.jsxs)(bt,{spacing:1,children:[i.map(a),(0,v0.jsx)(cJr,{uploads:t,empty:e.length===0})]})]})}var Ble=x(_(),1);function VKo(e){let t=e.criteria;if(!t)return{content:e.body};let r={content:t.before,trailing:t.after};return t.kind==="outline"?{...r,control:(0,Ble.jsx)(YQr,{items:t.items,onChange:e.onCriteriaChange})}:{...r,control:(0,Ble.jsx)(ZQr,{kind:t.kind,onClick:t.kind==="insert"?e.onCriteriaInsert:e.onCriteriaConvert})}}function AAe({pane:e,screenshots:t}){return(0,Ble.jsx)(nJr,{...VKo(e),ranges:e.ranges,wrapperRef:e.wrapperRef,contentRef:e.contentRef,dragRects:e.dragRects,dragColor:e.dragColor,onMouseDown:e.onMouseDown,footer:t?(0,Ble.jsx)(uJr,{screenshots:e.screenshots,uploads:e.uploads,onRemove:e.removeScreenshot,onUpdate:e.updateScreenshot}):void 0})}var dJr=e=>({display:"grid",gap:1,maxHeight:220,overflow:"auto",px:2,py:1.25,borderTop:1,borderColor:e.tokens.color.lineSoft}),fJr={fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"text.secondary"},pJr=e=>({display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",gap:"4px 8px",px:1.25,py:1,borderRadius:`${e.tokens.radius.sm}px`,bgcolor:e.tokens.color.raised,border:1,borderColor:e.tokens.color.lineSoft,fontSize:12.5}),hJr={gridColumn:2,gridRow:1,width:20,height:20,color:"text.disabled","& .MuiSvgIcon-root":{fontSize:14}};var yk=x(_(),1);function mJr({comments:e,colors:t,onRemove:r}){return(0,yk.jsxs)(H,{sx:dJr,children:[(0,yk.jsxs)(ve,{sx:fJr,children:["Comments (",e.length,")"]}),e.map((n,o)=>(0,yk.jsxs)(H,{sx:pJr,children:[(0,yk.jsx)(X$,{text:n.quote,sx:{gridColumn:1,borderLeft:2,pl:1,borderColor:t[o]}}),(0,yk.jsx)(H,{sx:{gridColumn:1,wordBreak:"break-word"},children:n.note}),(0,yk.jsx)(Mt,{"aria-label":"Remove comment",onClick:()=>r(n.id),sx:hJr,children:(0,yk.jsx)(Eo,{})})]},n.id))]})}var yJr=x(_(),1);function gJr(e){return e.comments.length===0?null:(0,yJr.jsx)(mJr,{...e})}var vJr=x(_(),1),LAe=ot((0,vJr.jsx)("path",{d:"M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2zM4 6h16v10H4z"}),"Computer");var CJr=x(te(),1);var bJr=x(_(),1),xJr=ot((0,bJr.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2"}),"Circle");var b0="0.1217.4";var GKo={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function SJr(e){return e?GKo[e]:"success.main"}function TJr(e){return e.split("-")[0].split(".").map(Number)}function wJr(e,t){if(!e||!t||e===t)return;let r=TJr(e),n=TJr(t);for(let o=0;o<Math.max(r.length,n.length);o++){let i=(r[o]??0)-(n[o]??0);if(Number.isNaN(i))return;if(i!==0)return i<0?"behind":"ahead"}}var IAe=x(te(),1),lyt=(0,IAe.createContext)(null);function DAe(){return(0,IAe.useContext)(lyt)}var $N=x(_(),1),qKo={height:16,fontSize:10},jKo={opacity:.6,fontSize:"0.85em"};function YKo(e,t){if(t===e.local)return"this machine";let r=e.links.find(n=>n.name===t);return r?r.error?`${r.state}: ${r.error}`:r.state:""}function Z3({nodes:e,name:t,showVersion:r=!1}){let n=DAe()??b0,o=e.links.find(a=>a.name===t),i=wJr(o?.peerVersion,n);return(0,$N.jsx)(lr,{title:YKo(e,t),placement:"right",children:(0,$N.jsxs)(H,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,$N.jsx)(xJr,{sx:{fontSize:8,color:SJr(o?.state)}}),t,r&&o?.peerVersion&&(0,$N.jsxs)(H,{component:"span",sx:jKo,children:["v",o.peerVersion]}),i&&(0,$N.jsx)(vn,{label:i,size:"small",color:i==="behind"?"warning":"info",sx:qKo})]})})}var x0=x(_(),1),KKo={textTransform:"none"};function MAe({nodes:e,options:t,target:r,onPick:n}){let[o,i]=(0,CJr.useState)(null);return(0,x0.jsxs)(x0.Fragment,{children:[(0,x0.jsx)(et,{size:"small",color:"inherit",startIcon:(0,x0.jsx)(LAe,{fontSize:"small"}),"aria-label":"Start on node","aria-haspopup":"menu",onClick:a=>i(a.currentTarget),sx:KKo,children:(0,x0.jsx)(Z3,{nodes:e,name:r.node})}),(0,x0.jsx)(mi,{anchorEl:o,open:!!o,onClose:()=>i(null),children:t.map(({name:a,cwd:s})=>(0,x0.jsx)(Br,{disabled:!s,selected:a===r.node,onClick:()=>{n(a),i(null)},children:(0,x0.jsx)(Vu,{primary:(0,x0.jsx)(Z3,{nodes:e,name:a}),secondary:s?void 0:"no clone"})},a))})]})}var kJr=x(te(),1);function XKo(e,t){return e?.toLowerCase()===t.toLowerCase()}function NAe(e,t){let{nodes:r,names:n,visible:o}=ds(),{repos:i,selectedCwd:a,selectedNode:s,cloneOn:l,originOf:u}=_n(),[d,f]=(0,kJr.useState)(),p=e&&u(e)?e:a,h=t?i.find(b=>XKo(u(b),t)):p,m=n.map(b=>({name:b,cwd:h?l(h,b):void 0})),g=b=>m.find(S=>S.name===b&&S.cwd),y=g(d)??g(s??r?.local)??m.find(b=>b.cwd),v=o&&y?.cwd?{node:y.name,cwd:y.cwd}:void 0;return{nodes:r,visible:o,options:m,target:v,pick:f}}var Q3=x(_(),1);function _Jr({canStart:e,startOrigin:t,cwd:r,onApprove:n,onApproveAndStart:o}){let i=_ge(),a=NAe(r,t);return(0,Q3.jsxs)(Q3.Fragment,{children:[(0,Q3.jsx)(et,{color:"primary",variant:e?"tonal":"contained",onClick:n,...e?{}:i,children:"Approve"}),e&&a.nodes&&a.target&&(0,Q3.jsx)(MAe,{nodes:a.nodes,options:a.options,target:a.target,onPick:a.pick}),e&&(0,Q3.jsx)(et,{color:"primary",variant:"contained",onClick:()=>o(a.target),...i,children:"Approve & start"})]})}var cyt=x(_(),1),ZKo={"& .MuiFormControlLabel-label":{fontSize:12}};function $le({label:e,title:t,checked:r,onChange:n}){return(0,cyt.jsx)($d,{control:(0,cyt.jsx)(Mp,{size:"small",checked:r,onChange:o=>n(o.target.checked)}),label:e,title:t,sx:ZKo})}var FN=x(_(),1);function OAe({chain:e,newPr:t,onChange:r}){return(0,FN.jsxs)(bt,{direction:"row",sx:{mr:"auto"},children:[t&&(0,FN.jsx)($le,{label:"Draft",title:"Create the PR as a draft rather than ready for review",checked:e.draft,onChange:n=>r({...e,draft:n,autoMerge:n?!1:e.autoMerge})}),(0,FN.jsx)($le,{label:"Auto-merge (squash)",title:"Squash-merge the PR automatically once its required checks pass",checked:e.autoMerge,onChange:n=>r({...e,autoMerge:n,draft:n?!1:e.draft})}),(0,FN.jsx)($le,{label:"Review PR",title:"After raising, run a review that posts its findings and then addresses them",checked:e.reviewAfter,onChange:n=>r({...e,reviewAfter:n})}),(0,FN.jsx)($le,{label:"Post to Slack",title:"Announce the PR in Slack at the tail of the chain",checked:e.announceAfter,onChange:n=>r({...e,announceAfter:n})})]})}var zN=x(_(),1);function EJr({commentCount:e,chain:t,newPr:r,canStart:n,startOrigin:o,onChainChange:i,onApprove:a,cwd:s,onApproveAndStart:l,onReject:u,onRequestChanges:d}){return(0,zN.jsxs)(bt,{direction:"row",spacing:1,sx:{px:2,py:1.5,alignItems:"center",justifyContent:"flex-end"},children:[t&&(0,zN.jsx)(OAe,{chain:t,newPr:r,onChange:i}),(0,zN.jsx)(et,{color:"error",variant:"outlined",onClick:u,children:"Reject"}),e>0&&(0,zN.jsxs)(et,{color:"warning",variant:"tonal",onClick:d,children:["Request changes (",e,")"]}),(0,zN.jsx)(_Jr,{canStart:n,startOrigin:o,cwd:s,onApprove:a,onApproveAndStart:l})]})}var PJr=x(_(),1);function RJr({comments:e,cwd:t,onDecision:r,chain:n,newPr:o,canStart:i,startOrigin:a,onChainChange:s}){let l=()=>e.map(u=>({quote:u.quote,note:u.note}));return(0,PJr.jsx)(EJr,{commentCount:e.length,chain:n,newPr:o,canStart:i,startOrigin:a,onChainChange:s,onApprove:()=>r("approve",l()),cwd:t,onApproveAndStart:u=>r("approve",l(),u??!0),onReject:()=>r("reject",[]),onRequestChanges:()=>r("reject",l())})}var vk=x(_(),1);function AJr(e){let{comments:t,commentColors:r,pending:n,cwd:o,unavailable:i,onAdd:a,onQueue:s,onCite:l,onAddRule:u,onRemove:d,onCancel:f,onCollapse:p,editable:h}=e;return(0,vk.jsxs)(vk.Fragment,{children:[(0,vk.jsx)(gJr,{comments:t,colors:r,onRemove:d}),(0,vk.jsx)(jn,{}),(0,vk.jsx)(RJr,{...e}),(0,vk.jsx)(Hye,{pending:n,editable:h,cwd:o,unavailable:i,onAdd:a,onQueue:s,onCite:l,onAddRule:u,onCancel:f,onCollapse:p})]})}var Fle=x(_(),1),QKo={px:2,pb:2,display:"flex",alignItems:"center",gap:1.5,minWidth:0},JKo={color:"text.secondary",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function LJr({url:e}){return(0,Fle.jsxs)(H,{sx:QKo,children:[(0,Fle.jsx)(et,{variant:"contained",href:e,target:"_blank",rel:"noopener noreferrer",sx:{flexShrink:0},children:"Open design \u2197"}),(0,Fle.jsx)(ve,{variant:"body2",sx:JKo,title:e,children:e})]})}var uyt=x(_(),1);function IJr({preview:e}){let t=e.kind==="design"?e.metadata?.[0]?.url:void 0;return t?(0,uyt.jsx)(LJr,{url:t}):(0,uyt.jsx)(Zj,{items:e.metadata??[]})}function DJr({preview:e,pane:t,cwd:r,isPr:n,editable:o,sender:i,onCite:a,onAddRule:s}){return{comments:t.comments,commentColors:t.commentColors,pending:t.pending,cwd:r,unavailable:i.unavailable,onAdd:i.onSend,onQueue:t.onAdd,onCite:a,onAddRule:s,onRemove:t.remove,onCancel:t.onCancel,onCollapse:t.onCollapse,onDecision:t.onDecide,chain:n?t.chain:void 0,editable:o,newPr:n&&e.prNumber===null,canStart:e.kind==="backlog-item"&&e.canStart===!0,startOrigin:e.startOrigin,onChainChange:t.setChain}}function TY(e){let t=e??"pr";return{isPr:t==="pr",screenshots:t==="pr"||t==="github-issue"||t==="github-issue-edit"||t==="github-issue-comment",editable:t==="github-issue-edit",closeOnly:t==="show"}}function MJr(e,t){return e?`${e}:${t??"pr"}`:void 0}function BAe(e,t,r,n){return{...TY(e.kind),requestId:e.requestId,supersedes:e.supersedes,sessionId:t,cwd:r,onDecision:n,screenshotScope:MJr(t,e.kind),seededScreenshots:e.screenshots??[],chainDefaults:{draft:e.draft===!0,reviewAfter:e.reviewAfter??!0},initialBody:e.body}}function NJr(e,t,r,n){if(!(!e||!t))return o=>{r!==void 0&&dl(t,e,P_e({quote:r,note:o})),n()}}function OJr(e,t,r,n){if(!(!e||!t))return o=>{r!==void 0&&dl(t,e,Kx(r,Rye(o))),n()}}function $Ae(e,t,r,n){return{onCite:OJr(e,t,r,n),onAddRule:NJr(e,t,r,n)}}function BJr(e){return{criteria:e.criteria,onCriteriaChange:e.writeCriteria,onCriteriaInsert:e.insertCriteria,onCriteriaConvert:e.convertCriteria}}var qJr=x(te(),1);var bk=x(te(),1);var $Jr="assist:pr-preview-comments:",dyt=e=>`${$Jr}${e}`;function fyt(e){return oc(dyt(e))}function zle(e,t){Tu(dyt(e),t)}function FAe(e){JD(dyt(e))}function FJr(){_R($Jr)}function zJr(e){let t=V6(e),r="";for(let n=t.nextNode();n;n=t.nextNode())r+=n.textContent??"";return r}function eXo(e,t,r){let n=-1;for(let o=e.indexOf(t);o!==-1;o=e.indexOf(t,o+1))(n===-1||Math.abs(o-r)<Math.abs(n-r))&&(n=o);return n}function HJr(e,t){return e.flatMap(r=>{let n=eXo(t,r.quote,r.start);return n===-1?[]:[{...r,start:n,end:n+r.quote.length}]})}function UJr(e,t,r){let n=fyt(e);if(n.length>0||!t||!r)return n;let o=HJr(fyt(t),zJr(r));return zle(e,o),FAe(t),o}function WJr(e,t,r){let[n,o]=(0,bk.useState)([]),i=(0,bk.useRef)(0);(0,bk.useEffect)(()=>{FJr(),o(UJr(e,t,r.current).map(l=>({...l,id:i.current++})))},[e,t,r]);let a=(0,bk.useCallback)(l=>{o(u=>{let d=[...u,{...l,id:i.current++}];return zle(e,d),d})},[e]),s=(0,bk.useCallback)(l=>{o(u=>{let d=u.filter(f=>f.id!==l);return zle(e,d),d})},[e]);return{comments:n,add:a,remove:s}}function VJr(e,t){let r=e.map((i,a)=>MG(a).solid),n=MG(e.length).fill,o=e.map((i,a)=>({start:i.start,end:i.end,color:MG(a).fill,pin:String(a+1)}));return t&&o.push({start:t.start,end:t.end,color:n}),{commentColors:r,dragColor:n,ranges:o}}function GJr(e,t,r,n){return{onAdd:o=>{e&&t({quote:e.quote,note:o,start:e.start,end:e.end}),n()},onCollapse:()=>{e&&r(e.quote),n()}}}function jJr(e,t,r){let{wrapperRef:n,contentRef:o,pending:i,dragRects:a,onMouseDown:s,clear:l,select:u}=Ky(),{comments:d,add:f,remove:p}=WJr(e,t,o),{commentColors:h,dragColor:m,ranges:g}=(0,qJr.useMemo)(()=>VJr(d,i),[d,i]),{onAdd:y,onCollapse:v}=GJr(i,f,r,l);return{wrapperRef:n,contentRef:o,onMouseDown:s,comments:d,commentColors:h,remove:p,pending:i,ranges:g,dragRects:a,dragColor:m,onAdd:y,onCollapse:v,onCancel:l,onSelect:u}}var HAe=x(te(),1);var pyt="assist:preview-screenshots:",hyt=e=>`${pyt}${e}`,zAe=e=>`${pyt}seeded:${e}`;function YJr(e){return e?(_R(pyt),oc(hyt(e)).filter(t=>typeof t.path=="string")):[]}function HN(e,t){e&&Tu(hyt(e),t.map(({path:r,alt:n,group:o,contentType:i,seeded:a})=>({path:r,alt:n,group:o,contentType:i,seeded:a})))}function KJr(e){e&&(JD(hyt(e)),JD(zAe(e)))}var UN=x(te(),1);var XJr={"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg","video/mp4":"mp4","video/webm":"webm","video/quicktime":"mov"};function tXo(e){let t=e.split(".").pop()?.toLowerCase();return Object.entries(XJr).find(([,n])=>n===t)?.[0]??"application/octet-stream"}function ZJr(e){return e.map(t=>({...t,contentType:tXo(t.path),seeded:!0}))}function QJr(e,t,r){if(!e)return ZJr(r);let n=YJr(e);if(oc(zAe(e))[0]===t)return n;let o=[...ZJr(r),...n.filter(i=>!i.seeded)];return HN(e,o),Tu(zAe(e),[t]),o}function JJr(e,t){let r=new URLSearchParams({path:e});return t&&r.set("node",t),av(`/api/pr-preview/image?${r}`)}function een(e,t,r){let[n,o]=(0,UN.useState)([]),i=(0,UN.useRef)(0),a=cr(),s=(0,UN.useRef)(r);return s.current=r,(0,UN.useEffect)(()=>{o(QJr(e,t,s.current).map(l=>({...l,url:JJr(l.path,a),id:i.current++})))},[e,t,a]),{screenshots:n,setScreenshots:o,nextId:i}}var ten=x(te(),1);function ren(e,t){return(0,ten.useCallback)((r,n)=>{t(o=>{let i=o.map(a=>a.id===r?{...a,...n}:a);return HN(e,i),i})},[e,t])}function nen(e,t,r){let{screenshots:n,setScreenshots:o,nextId:i}=een(e,t,r),a=(0,HAe.useCallback)(d=>{o(f=>{let p=[...f,{...d,id:i.current++}];return HN(e,p),p})},[e,o,i]),s=(0,HAe.useCallback)(d=>{o(f=>{let p=f.find(m=>m.id===d);p?.url.startsWith("blob:")&&URL.revokeObjectURL(p.url);let h=f.filter(m=>m.id!==d);return HN(e,h),h})},[e,o]),l=ren(e,o),u=(0,HAe.useCallback)(()=>KJr(e),[e]);return{screenshots:n,add:a,remove:s,update:l,clearPersisted:u}}var wY=x(te(),1);async function oen(e,t,r){let n=new URLSearchParams;t&&n.set("cwd",t),r&&n.set("node",r),e instanceof File&&e.name&&n.set("name",e.name);let o=await $t(`/api/pr-preview/upload-image?${n}`,{method:"POST",headers:{"Content-Type":e.type||"application/octet-stream"},body:e,timeoutMs:12e4}),i=await o.json().catch(()=>null);if(!o.ok||!i?.path)throw new Error(i?.error??"Failed to attach file");return{path:i.path,alt:i.alt??"screenshot"}}var len=x(te(),1);function ien(e){return e.startsWith("image/")||e.startsWith("video/")}function aen(e){if(!e)return null;for(let t of e.items)if(t.kind==="file"&&ien(t.type)){let r=t.getAsFile();if(r)return r}return null}function sen(e){return e?Array.from(e.files).find(t=>ien(t.type))??null:null}function cen(e,t){return(0,len.useEffect)(()=>{if(!t)return;let o=i=>{let a=aen(i.clipboardData);a&&(i.preventDefault(),e(a))};return globalThis.addEventListener("paste",o),()=>globalThis.removeEventListener("paste",o)},[e,t]),t?{onDrop:o=>{let i=sen(o.dataTransfer);i&&(o.preventDefault(),e(i))},onDragOver:o=>{Array.from(o.dataTransfer.items).some(i=>i.kind==="file")&&o.preventDefault()}}:{onDrop:void 0,onDragOver:void 0}}function uen(e,t,r){let[n,o]=(0,wY.useState)([]),i=(0,wY.useRef)(0),a=cr(),s=(0,wY.useCallback)(async d=>{let f=i.current++;o(p=>[...p.filter(h=>!h.error),{id:f}]);try{let p=await oen(d,e,a);t({...p,url:URL.createObjectURL(d),contentType:d.type}),o(h=>h.filter(m=>m.id!==f))}catch(p){let h=p instanceof Error?p.message:"Failed to attach file";o(m=>m.map(g=>g.id===f?{id:f,error:h}:g))}},[e,a,t]),{onDrop:l,onDragOver:u}=cen(s,r);return{uploads:n,onDrop:l,onDragOver:u}}function den({cwd:e,screenshots:t,screenshotScope:r,requestId:n,seededScreenshots:o}){let{screenshots:i,add:a,remove:s,update:l,clearPersisted:u}=nen(t?r:void 0,n,t?o:[]),{uploads:d,onDrop:f,onDragOver:p}=uen(e,a,t);return{screenshots:i,removeScreenshot:s,updateScreenshot:l,decision:{attachments:()=>i.map(({path:h,alt:m,group:g})=>g?{path:h,alt:m,group:g}:{path:h,alt:m}),clearPersisted:u},uploads:d,onDrop:f,onDragOver:p}}var xen=x(te(),1);var fen="assist:pr-preview-chain:",myt=e=>`${fen}${e}`;function pen(e){if(e)return oc(myt(e))[0]}function hen(e,t){e&&Tu(myt(e),[t])}function men(e){e&&JD(myt(e))}function gen(){_R(fen)}function yen(e,t,r){if(!e)return{reviewAfter:!1,announceAfter:!1,draft:!1,autoMerge:!1};gen();let n=pen(t);return{reviewAfter:n?.reviewAfter??r.reviewAfter,announceAfter:n?.announceAfter??!0,draft:n?.draft??r.draft,autoMerge:n?.autoMerge??!1}}function ven(e,t,r,n,o){return{comments:t,screenshots:n,reviewAfter:e&&r.reviewAfter,announceAfter:e&&r.announceAfter,draft:r.draft,autoMerge:e&&r.autoMerge,...o===void 0?{}:{body:o}}}function ben(e,t){return!e||t===!1?{}:t===!0?{autostart:!0}:{autostart:!0,startOn:t}}function Sen(e,t,r,n,o,i,a){let[s,l]=(0,xen.useState)(()=>yen(n,t,o));return{chain:s,setChain:f=>{l(f),hen(t,f)},onDecide:(f,p,h=!1)=>{let m=f==="approve";r(f,{...ven(m,p,s,m?i.attachments():[],a()),...ben(m,h)}),FAe(e),m&&(men(t),i.clearPersisted())}}}var Len=x(te(),1);var rXo=/^ {0,3}#{1,6}[ \t]+acceptance criteria[ \t]*$/i,nXo=/^ {0,3}#{1,6}[ \t]/;function J3(e){let t=e.split(`
|
|
4151
|
+
`),additions:FZr(o,"+"),deletions:FZr(o,"-"),split:{hunks:o.length,of:n.length,elsewhere:i}}}function HZr(e){return e.flatMap(t=>{if(t.kind==="dir")return HZr(t.children);let{kind:r,name:n,...o}=t;return[o]})}function wKo(e){let t=new Map;return e.forEach((r,n)=>{for(let o of r.hunks)t.set(o,[...t.get(o)??[],n+1])}),t}function UZr(e,t,r=new Set,n=new Set){let o=HZr(e.tree).filter(a=>!r.has(a.path)).map(a=>n.has(a.path)?{...a,critical:!0}:a),i=wKo(t);return t.map((a,s)=>{let l=new Set(a.hunks.map(fY));return NZr(o.filter(u=>l.has(u.path)).map(u=>zZr(u,s+1,i)))})}function CKo(e,t){let r=-1,n=0;return t.forEach((o,i)=>{let a=o.hunks.filter(s=>fY(s)===e).length;a>n&&(r=i,n=a)}),r}function WZr(e,t){let r=t.map(()=>[]);for(let n of e)r[CKo(n.path,t)]?.push(n);return r}function VZr(e,t){let r=UZr(e.structure,t,new Set(e.tests.map(i=>i.path)),new Set(e.criticalDiffs.map(i=>i.path))),n=WZr(e.tests,t),o=jPe(t);return t.map((i,a)=>{let s=a+1;return{number:s,slice:i,structure:r[a]??e.structure,tests:n[a]??[],critical:e.criticalDiffs.filter(l=>o.get(l.path)?.some(u=>u.number===s))}})}function GZr(e){if(!e.slices)return;let t=VZr(e,e.slices);return{entries:EZr(e,t),slicing:{count:t.length,noCritical:new Set(t.filter(r=>r.critical.length===0).map(r=>r.number))}}}function qZr(e){let t=e;return typeof t?.id=="string"&&typeof t.title=="string"&&typeof t.reason=="string"&&(t.kind==="deterministic"||t.kind==="manual")&&["pass","fail","manual"].includes(t.status)}function MN(e,t){return Array.isArray(e)?t?e.filter(t):e:[]}var eyt=e=>typeof e=="string"?e:"";function jZr(e){return{repo:eyt(e.repo),prNumber:typeof e.prNumber=="number"?e.prNumber:0,headSha:eyt(e.headSha),body:eyt(e.body)}}var tyt={repo:"",prNumber:0,headSha:"",body:"",checks:[],structure:{tree:[],added:0,removed:0,modified:0,additions:0,deletions:0},criticalDiffs:[],criticalPaths:[],tests:[],testPaths:[],collapsedPaths:[]};function yAe(e){let t;try{t=JSON.parse(e)}catch{return tyt}return typeof t!="object"||t===null?tyt:{...jZr(t),checks:MN(t.checks,qZr),structure:{...tyt.structure,...t.structure},criticalDiffs:MN(t.criticalDiffs),criticalPaths:MN(t.criticalPaths),tests:MN(t.tests),testPaths:MN(t.testPaths),collapsedPaths:MN(t.collapsedPaths),...Array.isArray(t.slices)?{slices:t.slices}:{},...t.manualTesting?{manualTesting:t.manualTesting}:{},...t.saved?{saved:t.saved}:{},...t.progress?{progress:t.progress}:{}}}function YZr(e){let t=(0,ryt.useMemo)(()=>yAe(e.body),[e.body]),r=(0,ryt.useMemo)(()=>GZr(t),[t]);return{payload:t,sliced:r}}var KZr=x(te(),1);function XZr(e){let[t,r]=(0,KZr.useState)(()=>e?.reviewComments??[]);return{queued:t,onQueue:n=>r(o=>[...o,n]),onRemove:n=>r(o=>o.filter((i,a)=>a!==n)),onEdit:(n,o)=>r(i=>i.map((a,s)=>s===n?{...a,note:o}:a))}}var Ple=x(te(),1);function ZZr(e,t,r){let n=(0,Ple.useRef)(!1),o=(0,Ple.useRef)(r);o.current=r,(0,Ple.useEffect)(()=>{if(!n.current){n.current=!0;return}o.current({items:e,reviewComments:t})},[e,t])}function JZr(e,t,r,n){let{payload:o,sliced:i}=YZr(e),{progress:a}=n,s=kZr(o.checks,a,i?.slicing),l=XZr(a),u=mZr(i?.entries??[]),{comments:d,sentTo:f,clearSent:p}=Kj(t,r),h={...d,onQueue:l.onQueue};ZZr(s.items,l.queued,n.onChange);let m=(0,QZr.useMemo)(()=>xZr(o),[o]);return{payload:o,checklist:s,queue:l,details:bZr(o,h),counts:m,sentTo:f,clearSent:p,sliced:i,nav:u,diffComments:h}}var BS=x(_(),1);function eQr({preview:e,session:t,sendInput:r,stored:n,onDecision:o}){let i=JZr(e,t,r,n);return(0,BS.jsxs)(H,{sx:c0,children:[(0,BS.jsx)($h,{preview:e,draft:!1}),(0,BS.jsx)(Zj,{items:e.metadata??[]}),(0,BS.jsx)(jn,{}),(0,BS.jsx)(eZr,{payload:i.payload,checklist:i.checklist,details:i.details,counts:i.counts,sliced:i.sliced,nav:i.nav,comments:i.diffComments}),(0,BS.jsx)(jn,{}),(0,BS.jsx)(pZr,{pane:i,onDecision:(a,s)=>{n.close(),o(a,s)}}),(0,BS.jsx)(ff,{sessionName:i.sentTo,onClose:i.clearSent})]})}var xAe=x(te(),1);var Ale=x(te(),1);var vAe="/api/high-level-progress";function tQr(e,t){let r,n,o=!1,i=s=>$t(_r(vAe,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,...s})}).catch(l=>xr(l,"high-level progress write")),a=async()=>{for(;r;){let s=r;r=void 0,await i(s)}n=void 0};return{write(s){o||(r=s,n??(n=a()))},close(){o=!0}}}function rQr(e,t){let{repo:r,prNumber:n,headSha:o,requestId:i}=e,a=(0,Ale.useMemo)(()=>r&&o?tQr({repo:r,prNumber:n,headSha:o,requestId:i},t):void 0,[r,n,o,i,t]),s=(0,Ale.useRef)(!1),l=(0,Ale.useRef)(void 0);return{markLoaded:()=>(s.current=!0,l.current&&a?.write(l.current),l.current!==void 0),onChange:u=>{l.current=u,s.current&&a?.write(u)},close:()=>a?.close()}}var bAe=x(te(),1);async function nQr(e,t){let r=new URLSearchParams({repo:e.repo,prNumber:String(e.prNumber),headSha:e.headSha}),n=await $t(_r(`${vAe}?${r}`,t));if(!n.ok)throw new Error(`HTTP ${n.status}`);return(await n.json()).progress??void 0}function oQr(e,t,r){let n=(0,bAe.useRef)(r);n.current=r;let{repo:o,prNumber:i,headSha:a}=e;(0,bAe.useEffect)(()=>{if(!o||!a)return;let s=!1,l=u=>{s||n.current(u)};return nQr({repo:o,prNumber:i,headSha:a},t).then(l,()=>l(void 0)),()=>{s=!0}},[o,i,a,t])}function iQr(e,t){let r=(0,xAe.useMemo)(()=>yAe(e.body),[e.body]),n={repo:r.repo,prNumber:r.prNumber,headSha:r.headSha},[o,i]=(0,xAe.useState)(()=>({progress:r.progress??r.saved,version:0})),a=rQr({...n,requestId:e.requestId},t);return oQr(n,t,s=>{a.markLoaded()||!s||s.updatedAt!==r.progress?.updatedAt&&i(u=>({progress:s,version:u.version+1}))}),{...o,onChange:a.onChange,close:a.close}}var sQr=x(_(),1);function aQr({preview:e,session:t,sendInput:r,onDecision:n}){let o=iQr(e,t?.node);return(0,sQr.jsx)(eQr,{preview:e,session:t,sendInput:r,stored:o,onDecision:n},o.version)}var mQr=x(te(),1);var NN=x(_(),1);function kKo(e){return e.topLeft===null?"Click the top-left box":e.bottomRight===null?"Now click the bottom-right box":"Both anchors picked"}function lQr({selection:e,onConfirm:t,onReject:r}){let n=e.topLeft!==null&&e.bottomRight!==null;return(0,NN.jsxs)(bt,{direction:"row",spacing:1,sx:{p:2,alignItems:"center",justifyContent:"flex-end"},children:[(0,NN.jsx)(ve,{variant:"body2",sx:{flex:1,color:"text.secondary"},children:kKo(e)}),(0,NN.jsx)(et,{color:"error",variant:"outlined",onClick:r,children:"Cancel"}),(0,NN.jsx)(et,{variant:"outlined",onClick:e.reset,children:"Start over"}),(0,NN.jsx)(et,{color:"success",variant:"contained",disabled:!n,onClick:t,children:"Extract boxes"})]})}var _Ko={"top-left":nc.miro.topLeft,"bottom-right":nc.miro.bottomRight};function cQr(e,t){let r=e.right-e.left,n=e.bottom-e.top;return{width:r,height:n,fontSize:Math.max(6,Math.min(n*.3,r/6,28)),radius:Math.min(8,n/4),colour:t?_Ko[t]:nc.miro.box,opacity:t?.75:.35,strokeWidth:Math.max(1,r*.004)}}var Lle=x(_(),1);function uQr({box:e,role:t,onSelect:r}){let n=cQr(e,t);return(0,Lle.jsxs)("g",{role:"button",tabIndex:0,"aria-label":t?`${e.text} (${t})`:e.text,onClick:()=>r(e.id),onKeyDown:o=>{o.key==="Enter"&&r(e.id)},style:{cursor:"pointer"},children:[(0,Lle.jsx)("rect",{x:e.left,y:e.top,width:n.width,height:n.height,rx:n.radius,fill:n.colour,fillOpacity:n.opacity,stroke:n.colour,strokeWidth:n.strokeWidth}),(0,Lle.jsx)("text",{x:e.left+n.width/2,y:e.top+n.height/2,textAnchor:"middle",dominantBaseline:"central",fontSize:n.fontSize,fill:nc.miro.text,children:e.text})]})}function dQr(e){if(e.length===0)return"0 0 100 100";let t=Math.min(...e.map(a=>a.left)),r=Math.min(...e.map(a=>a.top)),n=Math.max(...e.map(a=>a.right))-t,o=Math.max(...e.map(a=>a.bottom))-r,i=Math.max(n*.02,8);return`${t-i} ${r-i} ${n+i*2} ${o+i*2}`}var SAe=x(_(),1);function fQr({boxes:e,selection:t}){return(0,SAe.jsx)(H,{sx:{flex:1,minHeight:0,overflow:"auto",p:2},children:(0,SAe.jsx)("svg",{role:"img","aria-label":"Miro board boxes",viewBox:dQr(e),preserveAspectRatio:"xMidYMid meet",style:{width:"100%",height:"100%"},children:e.map(r=>(0,SAe.jsx)(uQr,{box:r,role:t.roleOf(r.id),onSelect:t.choose},r.id))})})}function EKo(e){return typeof e?.id=="string"&&typeof e.text=="string"&&[e.left,e.top,e.right,e.bottom].every(t=>typeof t=="number"&&Number.isFinite(t))}function pQr(e){try{let t=JSON.parse(e);return Array.isArray(t?.boxes)?t.boxes.filter(EKo):[]}catch{return[]}}var nyt=x(te(),1);function hQr(){let[e,t]=(0,nyt.useState)(null),[r,n]=(0,nyt.useState)(null);return{topLeft:e,bottomRight:r,choose:s=>{if(e===null||r!==null){t(s),n(null);return}n(s)},reset:()=>{t(null),n(null)},roleOf:s=>s===e?"top-left":s===r?"bottom-right":null}}var Y3=x(_(),1);function gQr({preview:e,onDecision:t}){let r=(0,mQr.useMemo)(()=>pQr(e.body),[e.body]),n=hQr();return(0,Y3.jsxs)(H,{sx:c0,children:[(0,Y3.jsx)($h,{preview:e,draft:!1}),(0,Y3.jsx)(jn,{}),(0,Y3.jsx)(fQr,{boxes:r,selection:n}),(0,Y3.jsx)(jn,{}),(0,Y3.jsx)(lQr,{selection:n,onConfirm:()=>{let{topLeft:i,bottomRight:a}=n;i===null||a===null||t("approve",Vc({topLeft:i,bottomRight:a}))},onReject:()=>t("reject",Vc())})]})}var jQr=x(te(),1);function yQr(e){let t=[];return e.map(r=>(t.length=r+1,t[r]=(t[r]??0)+1,t.map(n=>n??1).join(".")))}function TAe(e){return e*22}function vQr(e){return Math.round(e/22)}var bQr={display:"flex",alignItems:"flex-start",gap:.25,"& .criterion-action":{opacity:0,transition:"opacity 120ms"},"&:hover .criterion-action":{opacity:1},"&:focus-within .criterion-action":{opacity:1},"& .criterion-action:focus-visible":{opacity:1}},xQr={p:.25,mt:"2px",color:"text.disabled",cursor:"grab",touchAction:"none","&:active":{cursor:"grabbing"}},SQr={fontFamily:"fontFamilyMono",fontSize:"0.8rem",color:"text.secondary",minWidth:32,pt:"5px",textAlign:"right",userSelect:"none",whiteSpace:"nowrap"},TQr={flex:1,fontSize:"inherit",lineHeight:1.5,px:.75,py:0,borderRadius:1,"&:hover":{bgcolor:"action.hover"},"&.Mui-focused":{bgcolor:"action.selected"}},oyt={p:.25,mt:"2px"},wQr={position:"absolute",right:8,height:2,borderRadius:1,bgcolor:"primary.main",pointerEvents:"none"};var kQr=x(_(),1),RKo=8;function CQr({drag:e}){return e?(0,kQr.jsx)(H,{sx:wQr,style:{top:e.top-1,left:RKo+TAe(e.depth)}}):null}var _Qr=x(_(),1),EQr=ot((0,_Qr.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator");var iyt=x(_(),1);function RQr({number:e,onGrip:t}){return(0,iyt.jsx)(Mt,{size:"small",className:"criterion-action",sx:xQr,"aria-label":`Reorder criterion ${e}`,onPointerDown:t,children:(0,iyt.jsx)(EQr,{fontSize:"inherit"})})}var gk=x(_(),1);function PQr({number:e,onAdd:t,onDelete:r}){return(0,gk.jsxs)(gk.Fragment,{children:[(0,gk.jsx)(Mt,{size:"small",className:"criterion-action",sx:oyt,"aria-label":`Add criterion after ${e}`,onClick:t,children:(0,gk.jsx)(Yd,{fontSize:"inherit"})}),(0,gk.jsx)(Mt,{size:"small",className:"criterion-action",sx:oyt,"aria-label":`Delete criterion ${e}`,onClick:r,children:(0,gk.jsx)(Eo,{fontSize:"inherit"})})]})}var wAe=x(te(),1);function AQr(e,t){return e==="start"?0:e==="end"?t:Math.min(Math.max(e,0),t)}function LQr(e){let t=(0,wAe.useRef)(null);return(0,wAe.useEffect)(()=>{let r=t.current;if(!e||!r)return;r.focus();let n=AQr(e.caret,r.value.length);r.setSelectionRange(n,n)},[e]),t}var ON=x(_(),1);function IQr({index:e,number:t,item:r,outline:n,dragging:o,onGrip:i}){let a=LQr(n.focus?.index===e?n.focus:null),s={marginLeft:TAe(r.depth),opacity:o?.4:1};return(0,ON.jsxs)(H,{sx:bQr,"data-criterion-row":!0,style:s,children:[(0,ON.jsx)(RQr,{number:t,onGrip:i}),(0,ON.jsx)(H,{component:"span",sx:SQr,"aria-hidden":"true",children:`${t}.`}),(0,ON.jsx)(Hi,{multiline:!0,value:r.text,sx:TQr,inputRef:a,inputProps:{"aria-label":`Criterion ${t}`},onChange:l=>n.onText(e,l.target.value),onKeyDown:l=>n.onKeyDown(e,l)}),(0,ON.jsx)(PQr,{number:t,onAdd:()=>n.onAdd(e),onDelete:()=>n.onDelete(e)})]})}var FQr=x(te(),1);function DQr(e,t,{key:r,shift:n,alt:o,caret:i,text:a}){return o||n?null:r==="ArrowUp"&&i===0&&t>0?{kind:"focus",index:t-1}:r==="ArrowDown"&&i===a.length&&t<e.length-1?{kind:"focus",index:t+1}:null}function K3(e){if(e.length===0)return[{text:"",depth:0}];let t=-1;return e.map(r=>{let n=Math.min(Math.max(r.depth,0),t+1);return t=n,r.depth===n?r:{...r,depth:n}})}function CAe(e,t,r,n){let o=e[t]?.depth??0,i=e.map((a,s)=>s===t?{...a,text:r}:a);return{items:K3([...i.slice(0,t+1),{text:n,depth:o},...i.slice(t+1)]),index:t+1}}function mg(e,t){let r=t+1;for(;r<e.length&&e[r].depth>e[t].depth;)r+=1;return r}function kAe(e,t){let r=e[t].depth;for(let n=t-1;n>=0;n-=1){if(e[n].depth<r)return-1;if(e[n].depth===r)return n}return-1}function MQr(e,t){let r=mg(e,t);return r<e.length&&e[r].depth===e[t].depth?r:-1}function NQr(e,t,r){let n=r<0?kAe(e,t):MQr(e,t);if(n<0)return null;let o=mg(e,t),i=e.slice(t,o),a=[...e.slice(0,t),...e.slice(o)],s=r<0?n:mg(e,n)-(o-t);return{items:[...a.slice(0,s),...i,...a.slice(s)],index:s}}function _Ae(e,t){let r=mg(e,t),n=e.map((o,i)=>i>t&&i<r?{...o,depth:o.depth-1}:o).filter((o,i)=>i!==t);return{items:K3(n),index:Math.max(0,t-1)}}function OQr(e,t,r){if(r<0&&e[t].depth===0||r>0&&kAe(e,t)<0)return null;let n=mg(e,t);return e.map((o,i)=>i>=t&&i<n?{...o,depth:o.depth+r}:o)}function EAe(e,t){return e?{kind:"edit",edit:e,caret:t}:null}function PKo(e,t,{caret:r,text:n}){let o=n.slice(0,r);return EAe(CAe(e,t,o,n.slice(r)),"start")}function AKo(e,t,{shift:r,caret:n}){let o=OQr(e,t,r?-1:1);return EAe(o?{items:o,index:t}:null,n)}function BQr(e,t,r){let{key:n,shift:o,alt:i,caret:a,text:s}=r;return n==="Enter"&&!o?PKo(e,t,r):n==="Tab"?AKo(e,t,r):i&&(n==="ArrowUp"||n==="ArrowDown")?EAe(NQr(e,t,n==="ArrowUp"?-1:1),a):n==="Backspace"&&a===0&&s===""?EAe(_Ae(e,t),"end"):null}function $Qr(e,t,r){return BQr(e,t,r)??DQr(e,t,r)}function zQr(e,t){let[r,n]=(0,FQr.useState)(null),o=(a,s)=>{a&&(t(a.items),n({index:a.index,caret:s}))};return{focus:r,onKeyDown:(a,s)=>{let l=s.currentTarget;(s.key==="Enter"||s.key==="Tab")&&s.preventDefault();let u=$Qr(e,a,{key:s.key,shift:s.shiftKey,alt:s.altKey,caret:l.selectionStart??0,text:l.value});u&&(s.preventDefault(),u.kind==="focus"?n({index:u.index,caret:"end"}):o(u.edit,u.caret))},onDrop:a=>o(a,"end"),onText:(a,s)=>t(e.map((l,u)=>u===a?{...l,text:s}:l)),onAdd:a=>o(CAe(e,a,e[a].text,""),"start"),onDelete:a=>o(_Ae(e,a),"end")}}var GQr=x(te(),1);function LKo(e,t,r,n){let o=t.length;for(let a=0;a<e.length;a+=1)if(n<e[a].top+e[a].height/2){o=a;break}let i=mg(t,r);return o>r&&o<i?r:o}function IKo(e,t,r,n){let o=mg(e,t),i=r-1,a=i>=t&&i<o?t-1:i,s=a>=0?e[a].depth+1:0;return Math.max(0,Math.min(e[t].depth+vQr(n),s))}function DKo(e,t){if(t<e.length)return e[t].top;let r=e[e.length-1];return r?r.top+r.height:0}function HQr(e,t,r,n,o){let i=LKo(e,t,r,o);return{target:i,depth:IKo(t,r,i,n),top:DKo(e,i)}}function MKo(e){let t=e.getBoundingClientRect().top;return{boxes:Array.from(e.querySelectorAll("[data-criterion-row]")).map(n=>{let o=n.getBoundingClientRect();return{top:o.top-t,height:o.height}}),origin:t}}function UQr(e,t,r,n){return o=>{let{boxes:i,origin:a}=MKo(t);return HQr(i,e,r,o.clientX-n,o.clientY-a)}}function WQr(e,t,r,n,o){let i=new AbortController,a=null,s=d=>{a=r(d),n(a)},l=()=>{i.abort(),a&&o(a)},u={signal:i.signal};return e.setPointerCapture(t),e.addEventListener("pointermove",s,u),e.addEventListener("pointerup",l,u),e.addEventListener("pointercancel",l,u),s}function VQr(e,t,r,n){let o=mg(e,t),i=n-e[t].depth,a=e.slice(t,o).map(u=>({...u,depth:Math.max(0,u.depth+i)})),s=[...e.slice(0,t),...e.slice(o)],l=r>t?r-a.length:r;return{items:K3([...s.slice(0,l),...a,...s.slice(l)]),index:l}}function qQr(e,t,r){let[n,o]=(0,GQr.useState)(null);return{drag:n,onGrip:a=>s=>{let l=t.current;if(!l||s.pointerType==="mouse"&&s.button!==0)return;s.preventDefault(),WQr(s.currentTarget,s.pointerId,UQr(e,l,a,s.clientX),d=>o({from:a,depth:d.depth,top:d.top}),d=>{o(null),r(VQr(e,a,d.target,d.depth))})(s)}}}var Ile=x(_(),1),NKo={my:1,px:1,py:.5,border:1,borderColor:"divider",borderRadius:1,position:"relative",userSelect:"text",cursor:"auto"},OKo=[{text:"",depth:0}];function YQr({items:e,onChange:t}){let r=(0,jQr.useRef)(null),n=e.length>0?e:OKo,o=zQr(n,t),{drag:i,onGrip:a}=qQr(n,r,o.onDrop),s=yQr(n.map(l=>l.depth));return(0,Ile.jsxs)(H,{sx:NKo,ref:r,"data-preview-skip":!0,"aria-label":"Acceptance criteria",children:[n.map((l,u)=>(0,Ile.jsx)(IQr,{index:u,number:s[u],item:l,outline:o,dragging:i?.from===u,onGrip:a(u)},`criterion-${u}`)),(0,Ile.jsx)(CQr,{drag:i})]})}var KQr=x(_(),1),XQr=ot((0,KQr.jsx)("path",{d:"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2zm1-9h1V4H2v1h1zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2zm5-6v2h14V5zm0 14h14v-2H7zm0-6h14v-2H7z"}),"FormatListNumbered");var Dle=x(_(),1),BKo={insert:"Add acceptance criteria",convert:"Convert to outline"};function ZQr({kind:e,onClick:t}){return(0,Dle.jsx)(H,{sx:{my:1},"data-preview-skip":!0,children:(0,Dle.jsx)(et,{size:"small",variant:"outlined",startIcon:e==="insert"?(0,Dle.jsx)(Yd,{}):(0,Dle.jsx)(XQr,{}),onClick:t,children:BKo[e]})})}var Mle=x(te(),1);function QQr(e,t,{color:r,pin:n}){let o=V6(e),i=[],a=o.nextNode();for(;a;){let u=a;if(t.intersectsNode(u)){let d=u===t.startContainer?t.startOffset:0,f=u===t.endContainer?t.endOffset:u.length;d<f&&i.push({node:u,start:d,end:f})}a=o.nextNode()}let l=i.map(u=>$Ko(u.node,u.start,u.end,r)).at(-1);l&&n&&(l.dataset.pin=n)}function $Ko(e,t,r,n){let o=document.createRange();o.setStart(e,t),o.setEnd(e,r);let i=document.createElement("mark");return i.className="pr-comment",i.style.backgroundColor=n,o.surroundContents(i),i}function JQr(e){for(let t of e.querySelectorAll("mark.pr-comment"))if(t.parentNode){for(;t.firstChild;)t.before(t.firstChild);t.remove()}}function eJr(e,t){for(let r of t){let n=u7t(e,r);n&&QQr(e,n,r)}}var Nle=x(_(),1);function tJr({content:e,control:t,trailing:r,ranges:n,contentRef:o}){let i=(0,Mle.useMemo)(()=>YD(e),[e]),a=(0,Mle.useMemo)(()=>YD(r??""),[r]);return(0,Mle.useLayoutEffect)(()=>{let s=o.current;s&&(JQr(s),eJr(s,n))},[i,a,n,o]),(0,Nle.jsxs)(H,{ref:o,children:[(0,Nle.jsx)(VD,{segments:i,skipDiagramText:!0}),t,t?(0,Nle.jsx)(VD,{segments:a,skipDiagramText:!0}):null]})}var BN=e=>e.split(",").map(t=>`&& .markdown ${t.trim()}`).join(", ");function RAe(e){let{color:t,radius:r}=e.tokens;return{px:2.5,py:2,fontSize:14,lineHeight:1.6,[BN("")]:{lineHeight:1.6},[BN("h1, h2, h3, h4, h5, h6")]:{fontSize:15,fontWeight:600,lineHeight:1.4,mt:2,mb:1},[BN("ul, ol")]:{pl:2.5,mb:2},[BN("li")]:{mb:"6px"},[BN("code")]:{fontFamily:e.typography.fontFamilyMono,fontSize:"0.86em",px:"5px",py:0,bgcolor:t.raised,border:1,borderColor:t.lineSoft,borderRadius:"4px"},[BN("pre")]:{bgcolor:t.raised,border:1,borderColor:t.lineSoft,borderRadius:`${r.sm}px`},[BN("pre code")]:{border:0,px:0,bgcolor:"transparent"}}}var rJr=e=>({flex:1,overflow:"auto",position:"relative",userSelect:"none",cursor:"text",wordBreak:"break-word","& .markdown":{...u9(e),maxWidth:"none"},"& a":{color:"primary.main"},"& mark.pr-comment":{color:"inherit",borderRadius:"2px"},...RAe(e)});var SY=x(_(),1);function nJr({content:e,control:t,trailing:r,ranges:n,wrapperRef:o,contentRef:i,dragRects:a,dragColor:s,onMouseDown:l,footer:u}){return(0,SY.jsxs)(H,{ref:o,onMouseDown:l,sx:rJr,children:[(0,SY.jsx)(tJr,{content:e,control:t,trailing:r,ranges:n,contentRef:i}),u&&(0,SY.jsx)(H,{sx:{userSelect:"text"},children:u}),(0,SY.jsx)(e9,{rects:a,color:s})]})}function oJr(e){let t=new Map,r=[];for(let n of e){if(!n.group){r.push(n);continue}t.set(n.group,[...t.get(n.group)??[],n])}return{groups:[...t],ungrouped:r}}var PAe=x(te(),1),iJr=x(_(),1);function ayt({label:e,value:t,onCommit:r,listId:n}){let[o,i]=(0,PAe.useState)(t);return(0,PAe.useEffect)(()=>i(t),[t]),(0,iJr.jsx)(An,{size:"small",variant:"standard",fullWidth:!0,label:e,value:o,onChange:s=>i(s.target.value),onBlur:()=>{let s=o.trim();i(t),s!==t&&r(s)},onKeyDown:s=>{s.key==="Enter"&&s.target.blur()},onMouseDown:s=>s.stopPropagation(),slotProps:{htmlInput:{list:n}}})}var Ole=x(_(),1),syt="screenshot-groups";function FKo(e){return(e.split(/[\\/]/).pop()??e).replace(/\.[^.]+$/,"")}function aJr({screenshot:e,onUpdate:t}){return(0,Ole.jsxs)(bt,{direction:"row",spacing:1,sx:{mt:.5},children:[(0,Ole.jsx)(ayt,{label:"Caption",value:e.alt,onCommit:r=>t(e.id,{alt:r||FKo(e.path)})}),(0,Ole.jsx)(ayt,{label:"Group",value:e.group??"",listId:syt,onCommit:r=>t(e.id,{group:r})})]})}var X3=x(_(),1),sJr={display:"block",maxWidth:"100%",borderRadius:1,border:1,borderColor:"divider"},zKo={position:"absolute",top:4,right:4,bgcolor:"background.paper","&:hover":{bgcolor:"background.paper"}};function lJr({screenshot:e,onRemove:t,onUpdate:r}){let n=e.contentType.startsWith("video/");return(0,X3.jsxs)(H,{sx:{position:"relative"},children:[n?(0,X3.jsx)(H,{component:"video",controls:!0,src:e.url,"aria-label":"screenshot",sx:sJr}):(0,X3.jsx)(H,{component:"img",src:e.url,alt:"screenshot",sx:sJr}),(0,X3.jsx)(Mt,{size:"small","aria-label":"Remove screenshot",sx:zKo,onMouseDown:o=>o.stopPropagation(),onClick:()=>t(e.id),children:(0,X3.jsx)(Eo,{fontSize:"small"})}),(0,X3.jsx)(aJr,{screenshot:e,onUpdate:r})]})}var y0=x(_(),1);function HKo(){return(0,y0.jsxs)(bt,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,y0.jsx)(ao,{size:16}),(0,y0.jsx)(ve,{variant:"caption",color:"text.secondary",children:"Attaching screenshot or video\u2026"})]})}function UKo({error:e}){return(0,y0.jsx)(ve,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:e})}function cJr({uploads:e,empty:t}){return e.length>0?(0,y0.jsx)(y0.Fragment,{children:e.map(r=>r.error?(0,y0.jsx)(UKo,{error:r.error},r.id):(0,y0.jsx)(HKo,{},r.id))}):t?(0,y0.jsx)(ve,{variant:"caption",color:"text.secondary",children:"Drop or paste an image or video to attach"}):null}var v0=x(_(),1),WKo={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:1};function uJr({screenshots:e,uploads:t,onRemove:r,onUpdate:n}){let{groups:o,ungrouped:i}=oJr(e),a=s=>(0,v0.jsx)(lJr,{screenshot:s,onRemove:r,onUpdate:n},s.id);return(0,v0.jsxs)(H,{sx:{mt:3},children:[e.length>0&&(0,v0.jsx)(H,{component:"h2",children:"Screenshots"}),(0,v0.jsx)("datalist",{id:syt,children:o.map(([s])=>(0,v0.jsx)("option",{value:s},s))}),o.map(([s,l])=>(0,v0.jsxs)(H,{sx:{mb:2},children:[(0,v0.jsx)(H,{component:"h3",children:s}),(0,v0.jsx)(H,{sx:WKo,children:l.map(a)})]},s)),(0,v0.jsxs)(bt,{spacing:1,children:[i.map(a),(0,v0.jsx)(cJr,{uploads:t,empty:e.length===0})]})]})}var Ble=x(_(),1);function VKo(e){let t=e.criteria;if(!t)return{content:e.body};let r={content:t.before,trailing:t.after};return t.kind==="outline"?{...r,control:(0,Ble.jsx)(YQr,{items:t.items,onChange:e.onCriteriaChange})}:{...r,control:(0,Ble.jsx)(ZQr,{kind:t.kind,onClick:t.kind==="insert"?e.onCriteriaInsert:e.onCriteriaConvert})}}function AAe({pane:e,screenshots:t}){return(0,Ble.jsx)(nJr,{...VKo(e),ranges:e.ranges,wrapperRef:e.wrapperRef,contentRef:e.contentRef,dragRects:e.dragRects,dragColor:e.dragColor,onMouseDown:e.onMouseDown,footer:t?(0,Ble.jsx)(uJr,{screenshots:e.screenshots,uploads:e.uploads,onRemove:e.removeScreenshot,onUpdate:e.updateScreenshot}):void 0})}var dJr=e=>({display:"grid",gap:1,maxHeight:220,overflow:"auto",px:2,py:1.25,borderTop:1,borderColor:e.tokens.color.lineSoft}),fJr={fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"text.secondary"},pJr=e=>({display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",gap:"4px 8px",px:1.25,py:1,borderRadius:`${e.tokens.radius.sm}px`,bgcolor:e.tokens.color.raised,border:1,borderColor:e.tokens.color.lineSoft,fontSize:12.5}),hJr={gridColumn:2,gridRow:1,width:20,height:20,color:"text.disabled","& .MuiSvgIcon-root":{fontSize:14}};var yk=x(_(),1);function mJr({comments:e,colors:t,onRemove:r}){return(0,yk.jsxs)(H,{sx:dJr,children:[(0,yk.jsxs)(ve,{sx:fJr,children:["Comments (",e.length,")"]}),e.map((n,o)=>(0,yk.jsxs)(H,{sx:pJr,children:[(0,yk.jsx)(X$,{text:n.quote,sx:{gridColumn:1,borderLeft:2,pl:1,borderColor:t[o]}}),(0,yk.jsx)(H,{sx:{gridColumn:1,wordBreak:"break-word"},children:n.note}),(0,yk.jsx)(Mt,{"aria-label":"Remove comment",onClick:()=>r(n.id),sx:hJr,children:(0,yk.jsx)(Eo,{})})]},n.id))]})}var yJr=x(_(),1);function gJr(e){return e.comments.length===0?null:(0,yJr.jsx)(mJr,{...e})}var vJr=x(_(),1),LAe=ot((0,vJr.jsx)("path",{d:"M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2zM4 6h16v10H4z"}),"Computer");var CJr=x(te(),1);var bJr=x(_(),1),xJr=ot((0,bJr.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2"}),"Circle");var b0="0.1217.5";var GKo={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function SJr(e){return e?GKo[e]:"success.main"}function TJr(e){return e.split("-")[0].split(".").map(Number)}function wJr(e,t){if(!e||!t||e===t)return;let r=TJr(e),n=TJr(t);for(let o=0;o<Math.max(r.length,n.length);o++){let i=(r[o]??0)-(n[o]??0);if(Number.isNaN(i))return;if(i!==0)return i<0?"behind":"ahead"}}var IAe=x(te(),1),lyt=(0,IAe.createContext)(null);function DAe(){return(0,IAe.useContext)(lyt)}var $N=x(_(),1),qKo={height:16,fontSize:10},jKo={opacity:.6,fontSize:"0.85em"};function YKo(e,t){if(t===e.local)return"this machine";let r=e.links.find(n=>n.name===t);return r?r.error?`${r.state}: ${r.error}`:r.state:""}function Z3({nodes:e,name:t,showVersion:r=!1}){let n=DAe()??b0,o=e.links.find(a=>a.name===t),i=wJr(o?.peerVersion,n);return(0,$N.jsx)(lr,{title:YKo(e,t),placement:"right",children:(0,$N.jsxs)(H,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,$N.jsx)(xJr,{sx:{fontSize:8,color:SJr(o?.state)}}),t,r&&o?.peerVersion&&(0,$N.jsxs)(H,{component:"span",sx:jKo,children:["v",o.peerVersion]}),i&&(0,$N.jsx)(vn,{label:i,size:"small",color:i==="behind"?"warning":"info",sx:qKo})]})})}var x0=x(_(),1),KKo={textTransform:"none"};function MAe({nodes:e,options:t,target:r,onPick:n}){let[o,i]=(0,CJr.useState)(null);return(0,x0.jsxs)(x0.Fragment,{children:[(0,x0.jsx)(et,{size:"small",color:"inherit",startIcon:(0,x0.jsx)(LAe,{fontSize:"small"}),"aria-label":"Start on node","aria-haspopup":"menu",onClick:a=>i(a.currentTarget),sx:KKo,children:(0,x0.jsx)(Z3,{nodes:e,name:r.node})}),(0,x0.jsx)(mi,{anchorEl:o,open:!!o,onClose:()=>i(null),children:t.map(({name:a,cwd:s})=>(0,x0.jsx)(Br,{disabled:!s,selected:a===r.node,onClick:()=>{n(a),i(null)},children:(0,x0.jsx)(Vu,{primary:(0,x0.jsx)(Z3,{nodes:e,name:a}),secondary:s?void 0:"no clone"})},a))})]})}var kJr=x(te(),1);function XKo(e,t){return e?.toLowerCase()===t.toLowerCase()}function NAe(e,t){let{nodes:r,names:n,visible:o}=ds(),{repos:i,selectedCwd:a,selectedNode:s,cloneOn:l,originOf:u}=_n(),[d,f]=(0,kJr.useState)(),p=e&&u(e)?e:a,h=t?i.find(b=>XKo(u(b),t)):p,m=n.map(b=>({name:b,cwd:h?l(h,b):void 0})),g=b=>m.find(S=>S.name===b&&S.cwd),y=g(d)??g(s??r?.local)??m.find(b=>b.cwd),v=o&&y?.cwd?{node:y.name,cwd:y.cwd}:void 0;return{nodes:r,visible:o,options:m,target:v,pick:f}}var Q3=x(_(),1);function _Jr({canStart:e,startOrigin:t,cwd:r,onApprove:n,onApproveAndStart:o}){let i=_ge(),a=NAe(r,t);return(0,Q3.jsxs)(Q3.Fragment,{children:[(0,Q3.jsx)(et,{color:"primary",variant:e?"tonal":"contained",onClick:n,...e?{}:i,children:"Approve"}),e&&a.nodes&&a.target&&(0,Q3.jsx)(MAe,{nodes:a.nodes,options:a.options,target:a.target,onPick:a.pick}),e&&(0,Q3.jsx)(et,{color:"primary",variant:"contained",onClick:()=>o(a.target),...i,children:"Approve & start"})]})}var cyt=x(_(),1),ZKo={"& .MuiFormControlLabel-label":{fontSize:12}};function $le({label:e,title:t,checked:r,onChange:n}){return(0,cyt.jsx)($d,{control:(0,cyt.jsx)(Mp,{size:"small",checked:r,onChange:o=>n(o.target.checked)}),label:e,title:t,sx:ZKo})}var FN=x(_(),1);function OAe({chain:e,newPr:t,onChange:r}){return(0,FN.jsxs)(bt,{direction:"row",sx:{mr:"auto"},children:[t&&(0,FN.jsx)($le,{label:"Draft",title:"Create the PR as a draft rather than ready for review",checked:e.draft,onChange:n=>r({...e,draft:n,autoMerge:n?!1:e.autoMerge})}),(0,FN.jsx)($le,{label:"Auto-merge (squash)",title:"Squash-merge the PR automatically once its required checks pass",checked:e.autoMerge,onChange:n=>r({...e,autoMerge:n,draft:n?!1:e.draft})}),(0,FN.jsx)($le,{label:"Review PR",title:"After raising, run a review that posts its findings and then addresses them",checked:e.reviewAfter,onChange:n=>r({...e,reviewAfter:n})}),(0,FN.jsx)($le,{label:"Post to Slack",title:"Announce the PR in Slack at the tail of the chain",checked:e.announceAfter,onChange:n=>r({...e,announceAfter:n})})]})}var zN=x(_(),1);function EJr({commentCount:e,chain:t,newPr:r,canStart:n,startOrigin:o,onChainChange:i,onApprove:a,cwd:s,onApproveAndStart:l,onReject:u,onRequestChanges:d}){return(0,zN.jsxs)(bt,{direction:"row",spacing:1,sx:{px:2,py:1.5,alignItems:"center",justifyContent:"flex-end"},children:[t&&(0,zN.jsx)(OAe,{chain:t,newPr:r,onChange:i}),(0,zN.jsx)(et,{color:"error",variant:"outlined",onClick:u,children:"Reject"}),e>0&&(0,zN.jsxs)(et,{color:"warning",variant:"tonal",onClick:d,children:["Request changes (",e,")"]}),(0,zN.jsx)(_Jr,{canStart:n,startOrigin:o,cwd:s,onApprove:a,onApproveAndStart:l})]})}var PJr=x(_(),1);function RJr({comments:e,cwd:t,onDecision:r,chain:n,newPr:o,canStart:i,startOrigin:a,onChainChange:s}){let l=()=>e.map(u=>({quote:u.quote,note:u.note}));return(0,PJr.jsx)(EJr,{commentCount:e.length,chain:n,newPr:o,canStart:i,startOrigin:a,onChainChange:s,onApprove:()=>r("approve",l()),cwd:t,onApproveAndStart:u=>r("approve",l(),u??!0),onReject:()=>r("reject",[]),onRequestChanges:()=>r("reject",l())})}var vk=x(_(),1);function AJr(e){let{comments:t,commentColors:r,pending:n,cwd:o,unavailable:i,onAdd:a,onQueue:s,onCite:l,onAddRule:u,onRemove:d,onCancel:f,onCollapse:p,editable:h}=e;return(0,vk.jsxs)(vk.Fragment,{children:[(0,vk.jsx)(gJr,{comments:t,colors:r,onRemove:d}),(0,vk.jsx)(jn,{}),(0,vk.jsx)(RJr,{...e}),(0,vk.jsx)(Hye,{pending:n,editable:h,cwd:o,unavailable:i,onAdd:a,onQueue:s,onCite:l,onAddRule:u,onCancel:f,onCollapse:p})]})}var Fle=x(_(),1),QKo={px:2,pb:2,display:"flex",alignItems:"center",gap:1.5,minWidth:0},JKo={color:"text.secondary",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function LJr({url:e}){return(0,Fle.jsxs)(H,{sx:QKo,children:[(0,Fle.jsx)(et,{variant:"contained",href:e,target:"_blank",rel:"noopener noreferrer",sx:{flexShrink:0},children:"Open design \u2197"}),(0,Fle.jsx)(ve,{variant:"body2",sx:JKo,title:e,children:e})]})}var uyt=x(_(),1);function IJr({preview:e}){let t=e.kind==="design"?e.metadata?.[0]?.url:void 0;return t?(0,uyt.jsx)(LJr,{url:t}):(0,uyt.jsx)(Zj,{items:e.metadata??[]})}function DJr({preview:e,pane:t,cwd:r,isPr:n,editable:o,sender:i,onCite:a,onAddRule:s}){return{comments:t.comments,commentColors:t.commentColors,pending:t.pending,cwd:r,unavailable:i.unavailable,onAdd:i.onSend,onQueue:t.onAdd,onCite:a,onAddRule:s,onRemove:t.remove,onCancel:t.onCancel,onCollapse:t.onCollapse,onDecision:t.onDecide,chain:n?t.chain:void 0,editable:o,newPr:n&&e.prNumber===null,canStart:e.kind==="backlog-item"&&e.canStart===!0,startOrigin:e.startOrigin,onChainChange:t.setChain}}function TY(e){let t=e??"pr";return{isPr:t==="pr",screenshots:t==="pr"||t==="github-issue"||t==="github-issue-edit"||t==="github-issue-comment",editable:t==="github-issue-edit",closeOnly:t==="show"}}function MJr(e,t){return e?`${e}:${t??"pr"}`:void 0}function BAe(e,t,r,n){return{...TY(e.kind),requestId:e.requestId,supersedes:e.supersedes,sessionId:t,cwd:r,onDecision:n,screenshotScope:MJr(t,e.kind),seededScreenshots:e.screenshots??[],chainDefaults:{draft:e.draft===!0,reviewAfter:e.reviewAfter??!0},initialBody:e.body}}function NJr(e,t,r,n){if(!(!e||!t))return o=>{r!==void 0&&dl(t,e,P_e({quote:r,note:o})),n()}}function OJr(e,t,r,n){if(!(!e||!t))return o=>{r!==void 0&&dl(t,e,Kx(r,Rye(o))),n()}}function $Ae(e,t,r,n){return{onCite:OJr(e,t,r,n),onAddRule:NJr(e,t,r,n)}}function BJr(e){return{criteria:e.criteria,onCriteriaChange:e.writeCriteria,onCriteriaInsert:e.insertCriteria,onCriteriaConvert:e.convertCriteria}}var qJr=x(te(),1);var bk=x(te(),1);var $Jr="assist:pr-preview-comments:",dyt=e=>`${$Jr}${e}`;function fyt(e){return oc(dyt(e))}function zle(e,t){Tu(dyt(e),t)}function FAe(e){JD(dyt(e))}function FJr(){_R($Jr)}function zJr(e){let t=V6(e),r="";for(let n=t.nextNode();n;n=t.nextNode())r+=n.textContent??"";return r}function eXo(e,t,r){let n=-1;for(let o=e.indexOf(t);o!==-1;o=e.indexOf(t,o+1))(n===-1||Math.abs(o-r)<Math.abs(n-r))&&(n=o);return n}function HJr(e,t){return e.flatMap(r=>{let n=eXo(t,r.quote,r.start);return n===-1?[]:[{...r,start:n,end:n+r.quote.length}]})}function UJr(e,t,r){let n=fyt(e);if(n.length>0||!t||!r)return n;let o=HJr(fyt(t),zJr(r));return zle(e,o),FAe(t),o}function WJr(e,t,r){let[n,o]=(0,bk.useState)([]),i=(0,bk.useRef)(0);(0,bk.useEffect)(()=>{FJr(),o(UJr(e,t,r.current).map(l=>({...l,id:i.current++})))},[e,t,r]);let a=(0,bk.useCallback)(l=>{o(u=>{let d=[...u,{...l,id:i.current++}];return zle(e,d),d})},[e]),s=(0,bk.useCallback)(l=>{o(u=>{let d=u.filter(f=>f.id!==l);return zle(e,d),d})},[e]);return{comments:n,add:a,remove:s}}function VJr(e,t){let r=e.map((i,a)=>MG(a).solid),n=MG(e.length).fill,o=e.map((i,a)=>({start:i.start,end:i.end,color:MG(a).fill,pin:String(a+1)}));return t&&o.push({start:t.start,end:t.end,color:n}),{commentColors:r,dragColor:n,ranges:o}}function GJr(e,t,r,n){return{onAdd:o=>{e&&t({quote:e.quote,note:o,start:e.start,end:e.end}),n()},onCollapse:()=>{e&&r(e.quote),n()}}}function jJr(e,t,r){let{wrapperRef:n,contentRef:o,pending:i,dragRects:a,onMouseDown:s,clear:l,select:u}=Ky(),{comments:d,add:f,remove:p}=WJr(e,t,o),{commentColors:h,dragColor:m,ranges:g}=(0,qJr.useMemo)(()=>VJr(d,i),[d,i]),{onAdd:y,onCollapse:v}=GJr(i,f,r,l);return{wrapperRef:n,contentRef:o,onMouseDown:s,comments:d,commentColors:h,remove:p,pending:i,ranges:g,dragRects:a,dragColor:m,onAdd:y,onCollapse:v,onCancel:l,onSelect:u}}var HAe=x(te(),1);var pyt="assist:preview-screenshots:",hyt=e=>`${pyt}${e}`,zAe=e=>`${pyt}seeded:${e}`;function YJr(e){return e?(_R(pyt),oc(hyt(e)).filter(t=>typeof t.path=="string")):[]}function HN(e,t){e&&Tu(hyt(e),t.map(({path:r,alt:n,group:o,contentType:i,seeded:a})=>({path:r,alt:n,group:o,contentType:i,seeded:a})))}function KJr(e){e&&(JD(hyt(e)),JD(zAe(e)))}var UN=x(te(),1);var XJr={"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg","video/mp4":"mp4","video/webm":"webm","video/quicktime":"mov"};function tXo(e){let t=e.split(".").pop()?.toLowerCase();return Object.entries(XJr).find(([,n])=>n===t)?.[0]??"application/octet-stream"}function ZJr(e){return e.map(t=>({...t,contentType:tXo(t.path),seeded:!0}))}function QJr(e,t,r){if(!e)return ZJr(r);let n=YJr(e);if(oc(zAe(e))[0]===t)return n;let o=[...ZJr(r),...n.filter(i=>!i.seeded)];return HN(e,o),Tu(zAe(e),[t]),o}function JJr(e,t){let r=new URLSearchParams({path:e});return t&&r.set("node",t),av(`/api/pr-preview/image?${r}`)}function een(e,t,r){let[n,o]=(0,UN.useState)([]),i=(0,UN.useRef)(0),a=cr(),s=(0,UN.useRef)(r);return s.current=r,(0,UN.useEffect)(()=>{o(QJr(e,t,s.current).map(l=>({...l,url:JJr(l.path,a),id:i.current++})))},[e,t,a]),{screenshots:n,setScreenshots:o,nextId:i}}var ten=x(te(),1);function ren(e,t){return(0,ten.useCallback)((r,n)=>{t(o=>{let i=o.map(a=>a.id===r?{...a,...n}:a);return HN(e,i),i})},[e,t])}function nen(e,t,r){let{screenshots:n,setScreenshots:o,nextId:i}=een(e,t,r),a=(0,HAe.useCallback)(d=>{o(f=>{let p=[...f,{...d,id:i.current++}];return HN(e,p),p})},[e,o,i]),s=(0,HAe.useCallback)(d=>{o(f=>{let p=f.find(m=>m.id===d);p?.url.startsWith("blob:")&&URL.revokeObjectURL(p.url);let h=f.filter(m=>m.id!==d);return HN(e,h),h})},[e,o]),l=ren(e,o),u=(0,HAe.useCallback)(()=>KJr(e),[e]);return{screenshots:n,add:a,remove:s,update:l,clearPersisted:u}}var wY=x(te(),1);async function oen(e,t,r){let n=new URLSearchParams;t&&n.set("cwd",t),r&&n.set("node",r),e instanceof File&&e.name&&n.set("name",e.name);let o=await $t(`/api/pr-preview/upload-image?${n}`,{method:"POST",headers:{"Content-Type":e.type||"application/octet-stream"},body:e,timeoutMs:12e4}),i=await o.json().catch(()=>null);if(!o.ok||!i?.path)throw new Error(i?.error??"Failed to attach file");return{path:i.path,alt:i.alt??"screenshot"}}var len=x(te(),1);function ien(e){return e.startsWith("image/")||e.startsWith("video/")}function aen(e){if(!e)return null;for(let t of e.items)if(t.kind==="file"&&ien(t.type)){let r=t.getAsFile();if(r)return r}return null}function sen(e){return e?Array.from(e.files).find(t=>ien(t.type))??null:null}function cen(e,t){return(0,len.useEffect)(()=>{if(!t)return;let o=i=>{let a=aen(i.clipboardData);a&&(i.preventDefault(),e(a))};return globalThis.addEventListener("paste",o),()=>globalThis.removeEventListener("paste",o)},[e,t]),t?{onDrop:o=>{let i=sen(o.dataTransfer);i&&(o.preventDefault(),e(i))},onDragOver:o=>{Array.from(o.dataTransfer.items).some(i=>i.kind==="file")&&o.preventDefault()}}:{onDrop:void 0,onDragOver:void 0}}function uen(e,t,r){let[n,o]=(0,wY.useState)([]),i=(0,wY.useRef)(0),a=cr(),s=(0,wY.useCallback)(async d=>{let f=i.current++;o(p=>[...p.filter(h=>!h.error),{id:f}]);try{let p=await oen(d,e,a);t({...p,url:URL.createObjectURL(d),contentType:d.type}),o(h=>h.filter(m=>m.id!==f))}catch(p){let h=p instanceof Error?p.message:"Failed to attach file";o(m=>m.map(g=>g.id===f?{id:f,error:h}:g))}},[e,a,t]),{onDrop:l,onDragOver:u}=cen(s,r);return{uploads:n,onDrop:l,onDragOver:u}}function den({cwd:e,screenshots:t,screenshotScope:r,requestId:n,seededScreenshots:o}){let{screenshots:i,add:a,remove:s,update:l,clearPersisted:u}=nen(t?r:void 0,n,t?o:[]),{uploads:d,onDrop:f,onDragOver:p}=uen(e,a,t);return{screenshots:i,removeScreenshot:s,updateScreenshot:l,decision:{attachments:()=>i.map(({path:h,alt:m,group:g})=>g?{path:h,alt:m,group:g}:{path:h,alt:m}),clearPersisted:u},uploads:d,onDrop:f,onDragOver:p}}var xen=x(te(),1);var fen="assist:pr-preview-chain:",myt=e=>`${fen}${e}`;function pen(e){if(e)return oc(myt(e))[0]}function hen(e,t){e&&Tu(myt(e),[t])}function men(e){e&&JD(myt(e))}function gen(){_R(fen)}function yen(e,t,r){if(!e)return{reviewAfter:!1,announceAfter:!1,draft:!1,autoMerge:!1};gen();let n=pen(t);return{reviewAfter:n?.reviewAfter??r.reviewAfter,announceAfter:n?.announceAfter??!0,draft:n?.draft??r.draft,autoMerge:n?.autoMerge??!1}}function ven(e,t,r,n,o){return{comments:t,screenshots:n,reviewAfter:e&&r.reviewAfter,announceAfter:e&&r.announceAfter,draft:r.draft,autoMerge:e&&r.autoMerge,...o===void 0?{}:{body:o}}}function ben(e,t){return!e||t===!1?{}:t===!0?{autostart:!0}:{autostart:!0,startOn:t}}function Sen(e,t,r,n,o,i,a){let[s,l]=(0,xen.useState)(()=>yen(n,t,o));return{chain:s,setChain:f=>{l(f),hen(t,f)},onDecide:(f,p,h=!1)=>{let m=f==="approve";r(f,{...ven(m,p,s,m?i.attachments():[],a()),...ben(m,h)}),FAe(e),m&&(men(t),i.clearPersisted())}}}var Len=x(te(),1);var rXo=/^ {0,3}#{1,6}[ \t]+acceptance criteria[ \t]*$/i,nXo=/^ {0,3}#{1,6}[ \t]/;function J3(e){let t=e.split(`
|
|
4152
4152
|
`),r=t.findIndex(a=>rXo.test(a));if(r===-1)return null;let n=r+1;for(;n<t.length&&!nXo.test(t[n]);)n+=1;let o=r+1;for(;o<n&&t[o].trim()==="";)o+=1;let i=n;for(;i>o&&t[i-1].trim()==="";)i-=1;return o===n&&(o=r+1,i=r+1),{before:t.slice(0,o),lines:t.slice(o,i),after:t.slice(i)}}function UAe(e){let t=0;for(let r of e)t+=r===" "?4:1;return t}function WAe(e){let t=[];return e.map(r=>{for(;t.length>0&&r<t[t.length-1];)t.pop();return(t.length===0||r>t[t.length-1])&&t.push(r),t.length-1})}var oXo=" ";function iXo({text:e,depth:t}){let r=`${oXo.repeat(t)}1.`;return e===""?r:`${r} ${e}`}function VAe(e,t){let r=J3(e);return r?[...r.before,...t.map(iXo),...r.after].join(`
|
|
4153
4153
|
`):e}var aXo=/^([ \t]*)(?:[-*+]|\d+[.)])(?:[ \t]+(.*))?$/,sXo=/^\[[ xX]\][ \t]*/;function lXo(e){return e.slice(0,e.length-e.trimStart().length)}function Ten(e){let t=J3(e);if(!t)return e;let r=t.lines.filter(o=>o.trim()!=="").map(o=>{let i=aXo.exec(o);return{width:UAe(i?i[1]:lXo(o)),text:(i?i[2]??"":o.trim()).replace(sXo,"")}}),n=WAe(r.map(o=>o.width));return VAe(e,K3(r.map((o,i)=>({text:o.text,depth:n[i]}))))}var wen=`## Acceptance criteria
|
|
4154
4154
|
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
buildDoctorProbes,
|
|
11
11
|
diagnoseLink
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-3RAEAQWV.js";
|
|
13
13
|
import "./chunk-VABNWHSE.js";
|
|
14
14
|
import "./chunk-DS2YJZZY.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-5LSPCC7W.js";
|
|
16
16
|
import {
|
|
17
17
|
loadLinkSpecs
|
|
18
18
|
} from "./chunk-JWMBBFAS.js";
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
detectPlatform
|
|
31
31
|
} from "./chunk-E36L7ASL.js";
|
|
32
32
|
import "./chunk-GIHVMELY.js";
|
|
33
|
-
import "./chunk-
|
|
33
|
+
import "./chunk-KMFYHSFK.js";
|
|
34
34
|
import "./chunk-XYZPWUS6.js";
|
|
35
35
|
import "./chunk-TH42OUCW.js";
|
|
36
36
|
import "./chunk-J2OF6KJ4.js";
|