@aiwayds/dsh-opentui 0.23.1 → 0.23.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/client/index.js +2208 -2170
- package/dist/client/index.js.map +12 -12
- package/dist/locales/en.json +6 -1
- package/dist/locales/zh-CN.json +6 -1
- package/package.json +1 -1
package/dist/client/index.js
CHANGED
|
@@ -50401,6 +50401,8 @@ function Transcript(props) {
|
|
|
50401
50401
|
const color = {
|
|
50402
50402
|
text: () => theme?.text.base ?? "#e6e6e6",
|
|
50403
50403
|
user: () => theme?.text.action.primary.base ?? "#7aa2f7",
|
|
50404
|
+
userBorder: () => theme?.hue.interactive[400] ?? unfocusedBorderColor(theme),
|
|
50405
|
+
codeBorder: () => theme ? theme.increase(theme.markdown.code, 2) : undefined,
|
|
50404
50406
|
reasoningBorder: () => theme?.border.base ?? "#565f89",
|
|
50405
50407
|
done: () => theme?.text.feedback.success.base ?? "#9ece6a",
|
|
50406
50408
|
running: () => theme?.text.feedback.warning.base ?? "#e0af68",
|
|
@@ -50428,7 +50430,7 @@ function Transcript(props) {
|
|
|
50428
50430
|
cellPaddingX: 1
|
|
50429
50431
|
});
|
|
50430
50432
|
effect((_p$) => {
|
|
50431
|
-
var _v$ = skinRenderNode(row.key, row.final, props.renderNode, renderer,
|
|
50433
|
+
var _v$ = skinRenderNode(row.key, row.final, props.renderNode, renderer, color.codeBorder()), _v$2 = row.text, _v$3 = !row.final, _v$4 = syntaxStyle(), _v$5 = color.text();
|
|
50432
50434
|
_v$ !== _p$.e && (_p$.e = setProp(_el$2, "renderNode", _v$, _p$.e));
|
|
50433
50435
|
_v$2 !== _p$.t && (_p$.t = setProp(_el$2, "content", _v$2, _p$.t));
|
|
50434
50436
|
_v$3 !== _p$.a && (_p$.a = setProp(_el$2, "streaming", _v$3, _p$.a));
|
|
@@ -50479,7 +50481,7 @@ function Transcript(props) {
|
|
|
50479
50481
|
return row.text;
|
|
50480
50482
|
}
|
|
50481
50483
|
}), null);
|
|
50482
|
-
effect((_$p) => setProp(_el$3, "borderColor",
|
|
50484
|
+
effect((_$p) => setProp(_el$3, "borderColor", color.userBorder(), _$p));
|
|
50483
50485
|
return _el$3;
|
|
50484
50486
|
})();
|
|
50485
50487
|
case "interrupted":
|
|
@@ -50757,7 +50759,7 @@ function requestEchoLine(text) {
|
|
|
50757
50759
|
`)[0] ?? text;
|
|
50758
50760
|
if (first.trim() === "")
|
|
50759
50761
|
return;
|
|
50760
|
-
return `\
|
|
50762
|
+
return `\uD83D\uDC64 ${first}`;
|
|
50761
50763
|
}
|
|
50762
50764
|
function childLineText(child, isLast, spin, width) {
|
|
50763
50765
|
const track = isLast ? "\u2514\u2500 " : "\u251C\u2500 ";
|
|
@@ -50825,7 +50827,7 @@ function lastRequestLines(rows, request, width) {
|
|
|
50825
50827
|
function LastRequestDock(props) {
|
|
50826
50828
|
const dimensions = useTerminalSize();
|
|
50827
50829
|
const theme = useThemeOptional();
|
|
50828
|
-
const fgFor = (tone) => tone === "running" ? theme?.text.feedback.warning.base ?? "#e0af68" : theme?.text.
|
|
50830
|
+
const fgFor = (tone) => tone === "running" ? theme?.text.feedback.warning.base ?? "#e0af68" : theme?.text.base ?? "#e6e6e6";
|
|
50829
50831
|
const contentWidth = () => Math.max(16, dimensions().width - 1);
|
|
50830
50832
|
const lineWidth = (line) => Math.max(1, contentWidth() - (line.indent ?? 0));
|
|
50831
50833
|
const lines = () => lastRequestLines(props.rows, props.lastRequest, contentWidth()).filter((line) => line.id === "lr:echo");
|
|
@@ -52075,1442 +52077,1324 @@ var init_pane_focus = __esm(() => {
|
|
|
52075
52077
|
init_keymap();
|
|
52076
52078
|
});
|
|
52077
52079
|
|
|
52078
|
-
// ../tui-base/src/routes/session/
|
|
52079
|
-
function
|
|
52080
|
-
|
|
52081
|
-
|
|
52082
|
-
|
|
52083
|
-
|
|
52084
|
-
|
|
52085
|
-
|
|
52080
|
+
// ../tui-base/src/routes/session/ask-keys.ts
|
|
52081
|
+
function printableText(event) {
|
|
52082
|
+
const text = event.sequence;
|
|
52083
|
+
if (text.length !== 1)
|
|
52084
|
+
return;
|
|
52085
|
+
if (event.ctrl || event.meta || event.super === true || event.hyper === true)
|
|
52086
|
+
return;
|
|
52087
|
+
if (text === " ")
|
|
52088
|
+
return;
|
|
52089
|
+
if (text >= "0" && text <= "9")
|
|
52090
|
+
return;
|
|
52091
|
+
const code = text.codePointAt(0) ?? 0;
|
|
52092
|
+
if (code < 32 || code === 127)
|
|
52093
|
+
return;
|
|
52094
|
+
return text;
|
|
52086
52095
|
}
|
|
52087
|
-
function
|
|
52088
|
-
|
|
52089
|
-
|
|
52090
|
-
|
|
52091
|
-
|
|
52092
|
-
|
|
52093
|
-
|
|
52094
|
-
|
|
52095
|
-
|
|
52096
|
-
|
|
52097
|
-
|
|
52098
|
-
},
|
|
52099
|
-
reset() {
|
|
52100
|
-
armedAt = undefined;
|
|
52101
|
-
}
|
|
52096
|
+
function useAskKeys(options) {
|
|
52097
|
+
const keymap = Keymap2.useOptional();
|
|
52098
|
+
if (keymap === undefined)
|
|
52099
|
+
return;
|
|
52100
|
+
const renderer = useRenderer();
|
|
52101
|
+
const ownership = useInputOwnershipOptional();
|
|
52102
|
+
const ownsDock = () => ownership === undefined || ownership.top().kind === "dock";
|
|
52103
|
+
const ask = () => options.controller.pendingAsk;
|
|
52104
|
+
const question = () => {
|
|
52105
|
+
const batch = ask();
|
|
52106
|
+
return batch?.questions[batch.index];
|
|
52102
52107
|
};
|
|
52103
|
-
|
|
52104
|
-
|
|
52105
|
-
|
|
52106
|
-
|
|
52107
|
-
let timer;
|
|
52108
|
-
let armedKey;
|
|
52109
|
-
const disarm = () => {
|
|
52110
|
-
if (timer)
|
|
52111
|
-
clearTimeout(timer);
|
|
52112
|
-
timer = undefined;
|
|
52113
|
-
const key = armedKey;
|
|
52114
|
-
armedKey = undefined;
|
|
52115
|
-
if (key)
|
|
52116
|
-
onArm(false, key);
|
|
52108
|
+
const needsReview = () => askNeedsReview(ask()?.questions ?? []);
|
|
52109
|
+
const currentRow = () => {
|
|
52110
|
+
const batch = ask();
|
|
52111
|
+
return batch === undefined ? 0 : batch.cursors[batch.index] ?? 0;
|
|
52117
52112
|
};
|
|
52118
|
-
const
|
|
52119
|
-
|
|
52120
|
-
|
|
52121
|
-
armedKey = key;
|
|
52122
|
-
onArm(true, key);
|
|
52123
|
-
timer = setTimeout(() => {
|
|
52124
|
-
timer = undefined;
|
|
52125
|
-
beforeExpire?.();
|
|
52126
|
-
disarm();
|
|
52127
|
-
}, windowMs);
|
|
52113
|
+
const inputFocused = () => {
|
|
52114
|
+
const input = options.input();
|
|
52115
|
+
return input !== undefined && renderer.currentFocusedRenderable === input;
|
|
52128
52116
|
};
|
|
52129
|
-
|
|
52130
|
-
|
|
52131
|
-
|
|
52132
|
-
|
|
52133
|
-
|
|
52134
|
-
|
|
52117
|
+
onCleanup(keymap.intercept("key", ({ event }) => {
|
|
52118
|
+
if (!ownsDock())
|
|
52119
|
+
return;
|
|
52120
|
+
const batch = ask();
|
|
52121
|
+
if (batch === undefined || batch.phase !== "questions")
|
|
52122
|
+
return;
|
|
52123
|
+
if (printableText(event) === undefined)
|
|
52124
|
+
return;
|
|
52125
|
+
options.controller.focusInput();
|
|
52126
|
+
options.input()?.focus();
|
|
52127
|
+
}));
|
|
52128
|
+
function move(delta) {
|
|
52129
|
+
const batch = ask();
|
|
52130
|
+
if (batch === undefined)
|
|
52131
|
+
return false;
|
|
52132
|
+
if (batch.phase === "review") {
|
|
52133
|
+
options.controller.moveReviewCursor(delta);
|
|
52134
|
+
return true;
|
|
52135
|
+
}
|
|
52136
|
+
if (batch.phase === "input")
|
|
52137
|
+
return false;
|
|
52138
|
+
options.controller.moveCursor(delta);
|
|
52139
|
+
return true;
|
|
52140
|
+
}
|
|
52141
|
+
function page(direction) {
|
|
52142
|
+
return move(direction * ASK_PAGE_ROWS);
|
|
52143
|
+
}
|
|
52144
|
+
function boundary(toEnd) {
|
|
52145
|
+
const batch = ask();
|
|
52146
|
+
if (batch === undefined)
|
|
52147
|
+
return false;
|
|
52148
|
+
if (batch.phase === "review") {
|
|
52149
|
+
options.controller.setReviewCursor(toEnd ? batch.questions.length : 0);
|
|
52150
|
+
return true;
|
|
52151
|
+
}
|
|
52152
|
+
if (batch.phase === "input")
|
|
52153
|
+
return false;
|
|
52154
|
+
const current = question();
|
|
52155
|
+
if (current === undefined)
|
|
52156
|
+
return false;
|
|
52157
|
+
options.controller.setCursor(toEnd ? questionRowCount(current, needsReview()) - 1 : 0);
|
|
52158
|
+
return true;
|
|
52159
|
+
}
|
|
52160
|
+
function switchQuestion(direction) {
|
|
52161
|
+
const batch = ask();
|
|
52162
|
+
if (batch === undefined)
|
|
52163
|
+
return false;
|
|
52164
|
+
if (batch.phase === "input")
|
|
52165
|
+
return false;
|
|
52166
|
+
if (batch.phase === "review") {
|
|
52167
|
+
if (direction === -1) {
|
|
52168
|
+
options.controller.backToQuestions(batch.questions.length - 1);
|
|
52135
52169
|
return true;
|
|
52136
52170
|
}
|
|
52137
|
-
|
|
52138
|
-
|
|
52139
|
-
|
|
52171
|
+
return false;
|
|
52172
|
+
}
|
|
52173
|
+
if (batch.questions.length < 2)
|
|
52174
|
+
return false;
|
|
52175
|
+
options.controller.switchFocus(direction);
|
|
52176
|
+
return true;
|
|
52177
|
+
}
|
|
52178
|
+
function enter() {
|
|
52179
|
+
const batch = ask();
|
|
52180
|
+
if (batch === undefined)
|
|
52181
|
+
return false;
|
|
52182
|
+
if (batch.phase === "input")
|
|
52183
|
+
return false;
|
|
52184
|
+
if (batch.phase === "review") {
|
|
52185
|
+
const intent = reviewRowIntent(batch.reviewCursor, batch.questions.length);
|
|
52186
|
+
if (intent.kind === "submit") {
|
|
52187
|
+
options.controller.submit();
|
|
52140
52188
|
return true;
|
|
52141
52189
|
}
|
|
52142
|
-
|
|
52190
|
+
options.controller.backToQuestions(intent.question);
|
|
52143
52191
|
return true;
|
|
52144
|
-
}
|
|
52145
|
-
|
|
52146
|
-
|
|
52147
|
-
|
|
52148
|
-
|
|
52149
|
-
|
|
52150
|
-
|
|
52151
|
-
|
|
52152
|
-
|
|
52153
|
-
|
|
52154
|
-
|
|
52192
|
+
}
|
|
52193
|
+
const current = question();
|
|
52194
|
+
if (current === undefined)
|
|
52195
|
+
return false;
|
|
52196
|
+
const row = currentRow();
|
|
52197
|
+
if (hasReviewRow(current, needsReview()) && row === current.options.length) {
|
|
52198
|
+
return options.controller.enterReview();
|
|
52199
|
+
}
|
|
52200
|
+
const option = current.options[row];
|
|
52201
|
+
if (option === undefined)
|
|
52202
|
+
return false;
|
|
52203
|
+
if (current.multiSelect === true)
|
|
52204
|
+
return options.controller.confirmQuestion();
|
|
52205
|
+
options.controller.toggle(option.label);
|
|
52206
|
+
return true;
|
|
52207
|
+
}
|
|
52208
|
+
function space() {
|
|
52209
|
+
const batch = ask();
|
|
52210
|
+
if (batch === undefined || batch.phase !== "questions")
|
|
52211
|
+
return false;
|
|
52212
|
+
const current = question();
|
|
52213
|
+
if (current === undefined || current.multiSelect !== true)
|
|
52214
|
+
return false;
|
|
52215
|
+
if (inputFocused())
|
|
52216
|
+
return false;
|
|
52217
|
+
const option = current.options[currentRow()];
|
|
52218
|
+
if (option === undefined)
|
|
52219
|
+
return false;
|
|
52220
|
+
options.controller.toggle(option.label);
|
|
52221
|
+
return true;
|
|
52222
|
+
}
|
|
52223
|
+
function digit(index) {
|
|
52224
|
+
const batch = ask();
|
|
52225
|
+
if (batch === undefined || batch.phase !== "questions")
|
|
52226
|
+
return false;
|
|
52227
|
+
if (inputFocused())
|
|
52228
|
+
return false;
|
|
52229
|
+
const option = question()?.options[index];
|
|
52230
|
+
if (option === undefined)
|
|
52231
|
+
return false;
|
|
52232
|
+
options.controller.toggle(option.label);
|
|
52233
|
+
return true;
|
|
52234
|
+
}
|
|
52235
|
+
function atOutermost(batch) {
|
|
52236
|
+
if (batch.phase === "review" || batch.index > 0)
|
|
52237
|
+
return false;
|
|
52238
|
+
if (batch.phase === "input")
|
|
52239
|
+
return (batch.questions[batch.index]?.options.length ?? 0) === 0;
|
|
52240
|
+
return true;
|
|
52241
|
+
}
|
|
52242
|
+
function backOut() {
|
|
52243
|
+
const batch = ask();
|
|
52244
|
+
if (batch === undefined)
|
|
52245
|
+
return false;
|
|
52246
|
+
if (batch.phase === "review") {
|
|
52247
|
+
options.controller.backToQuestions(batch.questions.length - 1);
|
|
52248
|
+
return true;
|
|
52249
|
+
}
|
|
52250
|
+
if (batch.phase === "input") {
|
|
52251
|
+
const current = batch.questions[batch.index];
|
|
52252
|
+
if (current !== undefined && current.options.length > 0) {
|
|
52253
|
+
options.controller.focusOptions();
|
|
52155
52254
|
return true;
|
|
52156
52255
|
}
|
|
52157
|
-
|
|
52158
|
-
|
|
52159
|
-
|
|
52256
|
+
}
|
|
52257
|
+
if (batch.index > 0) {
|
|
52258
|
+
options.controller.switchFocus(-1);
|
|
52160
52259
|
return true;
|
|
52161
|
-
}
|
|
52162
|
-
|
|
52163
|
-
|
|
52164
|
-
}
|
|
52165
|
-
function
|
|
52166
|
-
|
|
52167
|
-
|
|
52168
|
-
|
|
52169
|
-
|
|
52260
|
+
}
|
|
52261
|
+
options.controller.decline();
|
|
52262
|
+
return true;
|
|
52263
|
+
}
|
|
52264
|
+
function interrupt() {
|
|
52265
|
+
const batch = ask();
|
|
52266
|
+
if (batch === undefined)
|
|
52267
|
+
return false;
|
|
52268
|
+
if (atOutermost(batch))
|
|
52269
|
+
armNonArmingInterrupt();
|
|
52270
|
+
return backOut();
|
|
52271
|
+
}
|
|
52170
52272
|
Keymap2.createLayer(() => ({
|
|
52171
52273
|
mode: "global",
|
|
52172
|
-
enabled:
|
|
52173
|
-
commands: [
|
|
52174
|
-
bind: "
|
|
52175
|
-
|
|
52176
|
-
|
|
52177
|
-
run: () =>
|
|
52178
|
-
|
|
52179
|
-
bind: "
|
|
52180
|
-
|
|
52181
|
-
|
|
52182
|
-
|
|
52183
|
-
|
|
52184
|
-
|
|
52185
|
-
|
|
52186
|
-
|
|
52187
|
-
|
|
52188
|
-
|
|
52189
|
-
|
|
52190
|
-
|
|
52191
|
-
|
|
52192
|
-
|
|
52193
|
-
setProp(_el$, "flexShrink", 0);
|
|
52194
|
-
setProp(_el$, "paddingLeft", 1);
|
|
52195
|
-
setProp(_el$2, "wrapMode", "none");
|
|
52196
|
-
insert(_el$2, (() => {
|
|
52197
|
-
var _c$ = memo2(() => armed() === "escape");
|
|
52198
|
-
return () => _c$() ? t("turn.stop.escHint") : "Press Ctrl+C again to quit";
|
|
52199
|
-
})());
|
|
52200
|
-
effect((_$p) => setProp(_el$2, "fg", theme?.text.feedback.warning.base ?? "#e0af68", _$p));
|
|
52201
|
-
return _el$;
|
|
52202
|
-
}
|
|
52203
|
-
});
|
|
52274
|
+
enabled: ownsDock,
|
|
52275
|
+
commands: [
|
|
52276
|
+
{ bind: "up,ctrl+p", run: () => move(-1) },
|
|
52277
|
+
{ bind: "down,ctrl+n", run: () => move(1) },
|
|
52278
|
+
{ bind: "pageup", run: () => page(-1) },
|
|
52279
|
+
{ bind: "pagedown", run: () => page(1) },
|
|
52280
|
+
{ bind: "home", run: () => boundary(false) },
|
|
52281
|
+
{ bind: "end", run: () => boundary(true) },
|
|
52282
|
+
{ bind: "return", run: enter },
|
|
52283
|
+
{ bind: "space", run: space },
|
|
52284
|
+
...Array.from({ length: 9 }, (_, index) => ({
|
|
52285
|
+
bind: `${index + 1}`,
|
|
52286
|
+
enabled: () => !inputFocused(),
|
|
52287
|
+
run: () => digit(index)
|
|
52288
|
+
})),
|
|
52289
|
+
{ bind: "left", run: () => switchQuestion(-1) },
|
|
52290
|
+
{ bind: "right", run: () => switchQuestion(1) },
|
|
52291
|
+
{ bind: "escape", run: backOut },
|
|
52292
|
+
{ bind: "ctrl+c", run: interrupt }
|
|
52293
|
+
]
|
|
52294
|
+
}));
|
|
52204
52295
|
}
|
|
52205
|
-
var
|
|
52206
|
-
var
|
|
52207
|
-
init_index_bun();
|
|
52208
|
-
init_index_bun();
|
|
52209
|
-
init_index_bun();
|
|
52210
|
-
init_index_bun();
|
|
52211
|
-
init_index_bun();
|
|
52212
|
-
init_index_bun();
|
|
52296
|
+
var ASK_PAGE_ROWS = 5;
|
|
52297
|
+
var init_ask_keys = __esm(() => {
|
|
52213
52298
|
init_index_bun();
|
|
52214
52299
|
init_server();
|
|
52215
52300
|
init_keymap();
|
|
52216
|
-
|
|
52217
|
-
|
|
52301
|
+
init_input_ownership();
|
|
52302
|
+
init_ask_options();
|
|
52303
|
+
init_turn_cancel();
|
|
52218
52304
|
});
|
|
52219
52305
|
|
|
52220
|
-
// ../tui-base/src/routes/session/
|
|
52221
|
-
|
|
52222
|
-
|
|
52223
|
-
|
|
52224
|
-
|
|
52225
|
-
|
|
52226
|
-
|
|
52227
|
-
|
|
52228
|
-
|
|
52229
|
-
|
|
52230
|
-
} catch {}
|
|
52231
|
-
return {
|
|
52232
|
-
parent,
|
|
52233
|
-
children: dispositions.filter((row) => row.disposition === "cancel-issued").length,
|
|
52234
|
-
dispositions
|
|
52235
|
-
};
|
|
52236
|
-
}
|
|
52237
|
-
let children = 0;
|
|
52238
|
-
for (const view of seam.subagentViews?.() ?? []) {
|
|
52239
|
-
if (view.status !== "running" || !seam.interruptChild)
|
|
52240
|
-
continue;
|
|
52241
|
-
try {
|
|
52242
|
-
await seam.interruptChild(view.id);
|
|
52243
|
-
children++;
|
|
52244
|
-
} catch {}
|
|
52306
|
+
// ../tui-base/src/routes/session/dock-host.tsx
|
|
52307
|
+
function firstFocusable(node) {
|
|
52308
|
+
if (node === undefined)
|
|
52309
|
+
return;
|
|
52310
|
+
for (const child of node.getChildren()) {
|
|
52311
|
+
if (child.focusable)
|
|
52312
|
+
return child;
|
|
52313
|
+
const nested = firstFocusable(child);
|
|
52314
|
+
if (nested !== undefined)
|
|
52315
|
+
return nested;
|
|
52245
52316
|
}
|
|
52246
|
-
return
|
|
52247
|
-
}
|
|
52248
|
-
|
|
52249
|
-
// ../tui-base/src/routes/session/turn-overlay-controller.ts
|
|
52250
|
-
function askSignature(questions) {
|
|
52251
|
-
return JSON.stringify(questions.map((question) => [
|
|
52252
|
-
question.id,
|
|
52253
|
-
question.prompt,
|
|
52254
|
-
question.header,
|
|
52255
|
-
question.description,
|
|
52256
|
-
question.detail,
|
|
52257
|
-
question.multiSelect === true,
|
|
52258
|
-
question.options.map((option) => [option.label, option.description])
|
|
52259
|
-
]));
|
|
52317
|
+
return;
|
|
52260
52318
|
}
|
|
52261
|
-
|
|
52262
|
-
|
|
52263
|
-
|
|
52264
|
-
|
|
52265
|
-
|
|
52266
|
-
|
|
52267
|
-
|
|
52268
|
-
|
|
52269
|
-
|
|
52270
|
-
|
|
52271
|
-
|
|
52272
|
-
|
|
52273
|
-
}
|
|
52274
|
-
attachPendingAsks(read) {
|
|
52275
|
-
this.#pendingAsks = read;
|
|
52276
|
-
}
|
|
52277
|
-
invalidateAsk(eventId, reason) {
|
|
52278
|
-
if (eventId === "")
|
|
52279
|
-
return;
|
|
52280
|
-
if (this.#approvals.some((entry) => entry.request.invalidatedReason !== undefined && entry.request.eventId === eventId))
|
|
52319
|
+
function DockProvider(props) {
|
|
52320
|
+
const renderer = useRenderer();
|
|
52321
|
+
const ownership = useInputOwnershipOptional();
|
|
52322
|
+
const [queue, setQueue] = createSignal([]);
|
|
52323
|
+
let frame;
|
|
52324
|
+
let composerFocus;
|
|
52325
|
+
let focusTarget;
|
|
52326
|
+
let cancelAfterLayout;
|
|
52327
|
+
const hasRequests = () => queue().length > 0;
|
|
52328
|
+
function afterLayout(callback) {
|
|
52329
|
+
cancelAfterLayout?.();
|
|
52330
|
+
if (renderer.isDestroyed)
|
|
52281
52331
|
return;
|
|
52282
|
-
|
|
52283
|
-
|
|
52284
|
-
|
|
52285
|
-
|
|
52286
|
-
|
|
52287
|
-
|
|
52288
|
-
|
|
52289
|
-
|
|
52290
|
-
|
|
52291
|
-
|
|
52292
|
-
|
|
52293
|
-
|
|
52294
|
-
|
|
52295
|
-
|
|
52296
|
-
|
|
52297
|
-
|
|
52298
|
-
|
|
52299
|
-
|
|
52300
|
-
|
|
52301
|
-
|
|
52302
|
-
|
|
52303
|
-
|
|
52332
|
+
let done = false;
|
|
52333
|
+
const handler = () => {
|
|
52334
|
+
if (done)
|
|
52335
|
+
return;
|
|
52336
|
+
done = true;
|
|
52337
|
+
renderer.off("frame", handler);
|
|
52338
|
+
if (cancelAfterLayout === cancel)
|
|
52339
|
+
cancelAfterLayout = undefined;
|
|
52340
|
+
callback();
|
|
52341
|
+
};
|
|
52342
|
+
const cancel = () => {
|
|
52343
|
+
if (done)
|
|
52344
|
+
return;
|
|
52345
|
+
done = true;
|
|
52346
|
+
renderer.off("frame", handler);
|
|
52347
|
+
if (cancelAfterLayout === cancel)
|
|
52348
|
+
cancelAfterLayout = undefined;
|
|
52349
|
+
};
|
|
52350
|
+
cancelAfterLayout = cancel;
|
|
52351
|
+
renderer.on("frame", handler);
|
|
52352
|
+
}
|
|
52353
|
+
function focusDock() {
|
|
52354
|
+
afterLayout(() => {
|
|
52355
|
+
if (!hasRequests())
|
|
52356
|
+
return;
|
|
52357
|
+
const target = focusTarget?.();
|
|
52358
|
+
if (target !== undefined) {
|
|
52359
|
+
target.focus();
|
|
52360
|
+
return;
|
|
52361
|
+
}
|
|
52362
|
+
renderer.currentFocusedRenderable?.blur();
|
|
52304
52363
|
});
|
|
52305
|
-
this.#changed();
|
|
52306
52364
|
}
|
|
52307
|
-
|
|
52308
|
-
|
|
52365
|
+
function remove(entry) {
|
|
52366
|
+
const before = queue();
|
|
52367
|
+
if (!before.includes(entry))
|
|
52309
52368
|
return;
|
|
52310
|
-
const
|
|
52311
|
-
|
|
52369
|
+
const next = before.filter((item) => item !== entry);
|
|
52370
|
+
setQueue(next);
|
|
52371
|
+
if (next.length > 0) {
|
|
52372
|
+
if (before[0] !== next[0])
|
|
52373
|
+
focusDock();
|
|
52312
52374
|
return;
|
|
52313
|
-
const terminals = [];
|
|
52314
|
-
for (const entry of this.#approvals) {
|
|
52315
|
-
terminals.push({
|
|
52316
|
-
request: {
|
|
52317
|
-
id: ++this.#seq,
|
|
52318
|
-
name: "ask",
|
|
52319
|
-
args: {},
|
|
52320
|
-
...entry.request.eventId !== undefined ? { eventId: entry.request.eventId } : {},
|
|
52321
|
-
escalation: false,
|
|
52322
|
-
invalidatedReason: reason
|
|
52323
|
-
},
|
|
52324
|
-
resolve: () => {}
|
|
52325
|
-
});
|
|
52326
|
-
}
|
|
52327
|
-
for (const entry of this.#asks) {
|
|
52328
|
-
terminals.push({
|
|
52329
|
-
request: {
|
|
52330
|
-
id: ++this.#seq,
|
|
52331
|
-
name: "ask",
|
|
52332
|
-
args: {},
|
|
52333
|
-
...entry.eventId !== undefined ? { eventId: entry.eventId } : {},
|
|
52334
|
-
escalation: false,
|
|
52335
|
-
invalidatedReason: reason
|
|
52336
|
-
},
|
|
52337
|
-
resolve: () => {}
|
|
52338
|
-
});
|
|
52339
52375
|
}
|
|
52340
|
-
|
|
52341
|
-
|
|
52342
|
-
|
|
52343
|
-
entry.resolve([]);
|
|
52344
|
-
this.#approvals = terminals;
|
|
52345
|
-
this.#asks = [];
|
|
52346
|
-
this.#changed();
|
|
52347
|
-
}
|
|
52348
|
-
pendingInvalidated() {
|
|
52349
|
-
const out = new Map;
|
|
52350
|
-
for (const entry of this.#approvals) {
|
|
52351
|
-
if (entry.request.invalidatedReason !== undefined && entry.request.eventId !== undefined) {
|
|
52352
|
-
out.set(entry.request.eventId, entry.request.invalidatedReason);
|
|
52353
|
-
}
|
|
52376
|
+
if (frame !== undefined) {
|
|
52377
|
+
ownership?.pop(frame);
|
|
52378
|
+
frame = undefined;
|
|
52354
52379
|
}
|
|
52355
|
-
|
|
52356
|
-
|
|
52357
|
-
|
|
52358
|
-
|
|
52359
|
-
|
|
52380
|
+
afterLayout(() => {
|
|
52381
|
+
if (hasRequests())
|
|
52382
|
+
return;
|
|
52383
|
+
composerFocus?.();
|
|
52384
|
+
});
|
|
52360
52385
|
}
|
|
52361
|
-
|
|
52362
|
-
|
|
52363
|
-
|
|
52364
|
-
|
|
52365
|
-
|
|
52366
|
-
|
|
52367
|
-
|
|
52368
|
-
|
|
52369
|
-
|
|
52370
|
-
|
|
52371
|
-
|
|
52372
|
-
|
|
52373
|
-
|
|
52374
|
-
|
|
52375
|
-
|
|
52376
|
-
|
|
52377
|
-
|
|
52378
|
-
|
|
52379
|
-
|
|
52380
|
-
|
|
52381
|
-
|
|
52382
|
-
|
|
52383
|
-
|
|
52384
|
-
|
|
52385
|
-
|
|
52386
|
-
|
|
52387
|
-
|
|
52388
|
-
|
|
52389
|
-
|
|
52390
|
-
|
|
52391
|
-
});
|
|
52392
|
-
this.#changed();
|
|
52393
|
-
});
|
|
52394
|
-
return promise;
|
|
52395
|
-
}
|
|
52396
|
-
#matchApproval(name, args) {
|
|
52397
|
-
const asks = (this.#pendingAsks?.() ?? []).filter((ask) => ask.kind === "approval");
|
|
52398
|
-
if (asks.length === 0)
|
|
52399
|
-
return;
|
|
52400
|
-
const callId = typeof args.callId === "string" ? args.callId : undefined;
|
|
52401
|
-
if (callId !== undefined) {
|
|
52402
|
-
const byCall = asks.filter((ask) => ask.callId === callId);
|
|
52403
|
-
return byCall.length > 0 ? byCall[byCall.length - 1] : undefined;
|
|
52386
|
+
const api = {
|
|
52387
|
+
open(render, options = {}) {
|
|
52388
|
+
const id = ++ordinal2;
|
|
52389
|
+
const entry = {
|
|
52390
|
+
id,
|
|
52391
|
+
kind: options.kind,
|
|
52392
|
+
options,
|
|
52393
|
+
close: () => remove(entry),
|
|
52394
|
+
render
|
|
52395
|
+
};
|
|
52396
|
+
const before = queue();
|
|
52397
|
+
setQueue([...before, entry]);
|
|
52398
|
+
if (before.length === 0) {
|
|
52399
|
+
frame = ownership?.push("dock");
|
|
52400
|
+
focusDock();
|
|
52401
|
+
}
|
|
52402
|
+
return {
|
|
52403
|
+
id,
|
|
52404
|
+
close: entry.close
|
|
52405
|
+
};
|
|
52406
|
+
},
|
|
52407
|
+
queueDepth: () => Math.max(0, queue().length - 1),
|
|
52408
|
+
isOpen: () => hasRequests(),
|
|
52409
|
+
currentKind: () => queue()[0]?.kind,
|
|
52410
|
+
current: () => queue()[0],
|
|
52411
|
+
bindComposerFocus(refocus) {
|
|
52412
|
+
composerFocus = refocus;
|
|
52413
|
+
},
|
|
52414
|
+
bindFocusTarget(resolve) {
|
|
52415
|
+
focusTarget = resolve;
|
|
52404
52416
|
}
|
|
52405
|
-
|
|
52406
|
-
|
|
52407
|
-
|
|
52408
|
-
|
|
52409
|
-
|
|
52410
|
-
|
|
52411
|
-
confirmApproval() {
|
|
52412
|
-
this.#settleApproval("allowed-once");
|
|
52413
|
-
}
|
|
52414
|
-
rejectApproval() {
|
|
52415
|
-
this.#settleApproval("rejected");
|
|
52416
|
-
}
|
|
52417
|
-
approveAlways() {
|
|
52418
|
-
this.#settleEscalated("always");
|
|
52419
|
-
}
|
|
52420
|
-
approveSession() {
|
|
52421
|
-
this.#settleEscalated("session");
|
|
52422
|
-
}
|
|
52423
|
-
#settleEscalated(verdict) {
|
|
52424
|
-
if (this.#approvals[0]?.request.escalation !== true)
|
|
52425
|
-
return;
|
|
52426
|
-
this.#settleApproval(verdict);
|
|
52427
|
-
}
|
|
52428
|
-
#settleApproval(verdict) {
|
|
52429
|
-
const head = this.#approvals.shift();
|
|
52430
|
-
if (!head)
|
|
52431
|
-
return;
|
|
52432
|
-
head.resolve(verdict);
|
|
52433
|
-
this.#changed();
|
|
52434
|
-
}
|
|
52435
|
-
syncPendingAsks() {
|
|
52436
|
-
if (this.#pendingAsks === undefined)
|
|
52437
|
-
return;
|
|
52438
|
-
const asks = this.#pendingAsks();
|
|
52439
|
-
let changed = false;
|
|
52440
|
-
const approvalsBefore = this.#approvals.length;
|
|
52441
|
-
this.#approvals = this.#approvals.filter((entry) => {
|
|
52442
|
-
if (this.#approvalStillPending(entry.request, asks))
|
|
52443
|
-
return true;
|
|
52444
|
-
entry.resolve("rejected");
|
|
52445
|
-
return false;
|
|
52446
|
-
});
|
|
52447
|
-
if (this.#approvals.length !== approvalsBefore)
|
|
52448
|
-
changed = true;
|
|
52449
|
-
const questionsBefore = this.#asks.length;
|
|
52450
|
-
this.#asks = this.#asks.filter((entry) => {
|
|
52451
|
-
if (this.#questionStillPending(entry, asks))
|
|
52452
|
-
return true;
|
|
52453
|
-
entry.resolve([]);
|
|
52454
|
-
return false;
|
|
52455
|
-
});
|
|
52456
|
-
if (this.#asks.length !== questionsBefore)
|
|
52457
|
-
changed = true;
|
|
52458
|
-
if (changed)
|
|
52459
|
-
this.#changed();
|
|
52460
|
-
}
|
|
52461
|
-
#approvalStillPending(request, asks) {
|
|
52462
|
-
if (request.eventId !== undefined)
|
|
52463
|
-
return asks.some((ask) => ask.eventId === request.eventId);
|
|
52464
|
-
return asks.some((ask) => ask.kind === "approval");
|
|
52465
|
-
}
|
|
52466
|
-
#questionStillPending(entry, asks) {
|
|
52467
|
-
if (entry.eventId !== undefined)
|
|
52468
|
-
return asks.some((ask) => ask.eventId === entry.eventId);
|
|
52469
|
-
return asks.some((ask) => ask.kind === "questions");
|
|
52470
|
-
}
|
|
52471
|
-
cancelAllApprovals() {
|
|
52472
|
-
if (this.#approvals.length === 0)
|
|
52473
|
-
return;
|
|
52474
|
-
const entries = this.#approvals.splice(0);
|
|
52475
|
-
for (const entry of entries)
|
|
52476
|
-
entry.resolve("rejected");
|
|
52477
|
-
this.#changed();
|
|
52478
|
-
}
|
|
52479
|
-
cancelAllAsks() {
|
|
52480
|
-
if (this.#asks.length === 0)
|
|
52481
|
-
return;
|
|
52482
|
-
const entries = this.#asks.splice(0);
|
|
52483
|
-
for (const entry of entries)
|
|
52484
|
-
entry.resolve([]);
|
|
52485
|
-
this.#changed();
|
|
52486
|
-
}
|
|
52487
|
-
get pendingAsk() {
|
|
52488
|
-
const head = this.#asks[0];
|
|
52489
|
-
if (!head)
|
|
52490
|
-
return;
|
|
52491
|
-
return {
|
|
52492
|
-
id: head.id,
|
|
52493
|
-
...head.eventId !== undefined ? { eventId: head.eventId } : {},
|
|
52494
|
-
questions: head.questions,
|
|
52495
|
-
index: head.index,
|
|
52496
|
-
picks: head.picks,
|
|
52497
|
-
phase: head.phase,
|
|
52498
|
-
customs: [...head.customs],
|
|
52499
|
-
customDraft: head.customDrafts[head.index] ?? null,
|
|
52500
|
-
cursors: [...head.cursors],
|
|
52501
|
-
listCursors: [...head.listCursors],
|
|
52502
|
-
reviewCursor: head.reviewCursor
|
|
52503
|
-
};
|
|
52504
|
-
}
|
|
52505
|
-
get currentQuestion() {
|
|
52506
|
-
const head = this.#asks[0];
|
|
52507
|
-
return head?.questions[head.index];
|
|
52508
|
-
}
|
|
52509
|
-
#matchAsk(questions) {
|
|
52510
|
-
const asks = (this.#pendingAsks?.() ?? []).filter((ask) => ask.kind === "questions");
|
|
52511
|
-
if (asks.length === 0)
|
|
52512
|
-
return;
|
|
52513
|
-
const claimed = new Set(this.#asks.map((entry) => entry.eventId));
|
|
52514
|
-
const available = asks.filter((ask) => !claimed.has(ask.eventId));
|
|
52515
|
-
if (available.length === 0)
|
|
52516
|
-
return;
|
|
52517
|
-
const signature = askSignature(questions);
|
|
52518
|
-
const exact = available.filter((ask) => askSignature(ask.questions ?? []) === signature);
|
|
52519
|
-
if (exact.length > 0)
|
|
52520
|
-
return exact[0];
|
|
52521
|
-
return available.length === 1 ? available[0] : undefined;
|
|
52522
|
-
}
|
|
52523
|
-
answer(questions) {
|
|
52524
|
-
if (questions.length === 0)
|
|
52525
|
-
return Promise.resolve([]);
|
|
52526
|
-
const ask = this.#matchAsk(questions);
|
|
52527
|
-
return new Promise((resolve) => {
|
|
52528
|
-
this.#asks.push({
|
|
52529
|
-
id: ++this.#seq,
|
|
52530
|
-
...ask !== undefined ? { eventId: ask.eventId } : {},
|
|
52531
|
-
questions,
|
|
52532
|
-
index: 0,
|
|
52533
|
-
picks: questions.map((question) => recommendedPicks(question)),
|
|
52534
|
-
phase: questions[0]?.options.length === 0 ? "input" : "questions",
|
|
52535
|
-
customs: questions.map(() => {
|
|
52536
|
-
return;
|
|
52537
|
-
}),
|
|
52538
|
-
customDrafts: questions.map(() => null),
|
|
52539
|
-
cursors: questions.map(() => 0),
|
|
52540
|
-
listCursors: questions.map(() => 0),
|
|
52541
|
-
reviewCursor: 0,
|
|
52542
|
-
resolve
|
|
52543
|
-
});
|
|
52544
|
-
this.#changed();
|
|
52545
|
-
});
|
|
52546
|
-
}
|
|
52547
|
-
toggle(option) {
|
|
52548
|
-
const head = this.#asks[0];
|
|
52549
|
-
const question = head?.questions[head.index];
|
|
52550
|
-
if (!head || !question || head.phase === "review")
|
|
52551
|
-
return;
|
|
52552
|
-
if (head.phase === "input")
|
|
52553
|
-
return;
|
|
52554
|
-
head.customs[head.index] = undefined;
|
|
52555
|
-
head.customDrafts[head.index] = null;
|
|
52556
|
-
if (question.multiSelect === true) {
|
|
52557
|
-
const current = head.picks[head.index] ?? [];
|
|
52558
|
-
head.picks[head.index] = current.includes(option) ? current.filter((label) => label !== option) : [...current, option];
|
|
52559
|
-
this.#changed();
|
|
52560
|
-
return;
|
|
52417
|
+
};
|
|
52418
|
+
onCleanup(() => {
|
|
52419
|
+
cancelAfterLayout?.();
|
|
52420
|
+
if (frame !== undefined) {
|
|
52421
|
+
ownership?.pop(frame);
|
|
52422
|
+
frame = undefined;
|
|
52561
52423
|
}
|
|
52562
|
-
|
|
52563
|
-
|
|
52564
|
-
|
|
52565
|
-
|
|
52566
|
-
|
|
52567
|
-
return;
|
|
52424
|
+
setQueue([]);
|
|
52425
|
+
});
|
|
52426
|
+
return createComponent2(Context7.Provider, {
|
|
52427
|
+
value: api,
|
|
52428
|
+
get children() {
|
|
52429
|
+
return props.children;
|
|
52568
52430
|
}
|
|
52569
|
-
|
|
52570
|
-
|
|
52571
|
-
|
|
52572
|
-
|
|
52573
|
-
|
|
52574
|
-
|
|
52575
|
-
|
|
52576
|
-
|
|
52577
|
-
|
|
52578
|
-
|
|
52579
|
-
|
|
52580
|
-
|
|
52581
|
-
|
|
52582
|
-
|
|
52583
|
-
|
|
52584
|
-
|
|
52431
|
+
});
|
|
52432
|
+
}
|
|
52433
|
+
function useDock() {
|
|
52434
|
+
const value = useContext(Context7);
|
|
52435
|
+
if (!value)
|
|
52436
|
+
throw new Error("Dock.Provider is missing");
|
|
52437
|
+
return value;
|
|
52438
|
+
}
|
|
52439
|
+
function DockSeat(props) {
|
|
52440
|
+
const dock = useDock();
|
|
52441
|
+
const dimensions = useTerminalSize();
|
|
52442
|
+
const theme = useThemeOptional();
|
|
52443
|
+
let scroll;
|
|
52444
|
+
let body;
|
|
52445
|
+
let disposed = false;
|
|
52446
|
+
const [measured, setMeasured] = createSignal(undefined);
|
|
52447
|
+
const resolveFocus = () => {
|
|
52448
|
+
const designated = dock.current()?.options.focusRef?.();
|
|
52449
|
+
return designated ?? firstFocusable(body);
|
|
52450
|
+
};
|
|
52451
|
+
dock.bindFocusTarget(resolveFocus);
|
|
52452
|
+
onCleanup(() => {
|
|
52453
|
+
disposed = true;
|
|
52454
|
+
dock.bindFocusTarget(undefined);
|
|
52455
|
+
});
|
|
52456
|
+
const capRows = () => Math.max(1, Math.floor(dimensions().height * DOCK_MAX_ROWS_RATIO));
|
|
52457
|
+
const contentRows = () => measured() ?? dock.current()?.options.contentRows ?? capRows();
|
|
52458
|
+
const overflows = () => contentRows() > capRows() && capRows() > 1;
|
|
52459
|
+
const viewportRows = () => Math.max(1, Math.min(contentRows(), capRows() - (overflows() ? 1 : 0)));
|
|
52460
|
+
const hiddenRows = () => Math.max(0, contentRows() - viewportRows());
|
|
52461
|
+
const indicatorText = () => {
|
|
52462
|
+
const label = dock.current()?.options.overflowLabel;
|
|
52463
|
+
return label ? label(hiddenRows()) : `\u2191\u2193 ${hiddenRows()}`;
|
|
52464
|
+
};
|
|
52465
|
+
const muted = () => theme?.text.muted ?? "#9aa5ce";
|
|
52466
|
+
const background = () => theme?.background.base ?? "black";
|
|
52467
|
+
createEffect(on(() => dock.current()?.id, () => {
|
|
52468
|
+
if (scroll !== undefined && !scroll.isDestroyed)
|
|
52469
|
+
scroll.scrollTo(0);
|
|
52470
|
+
}, {
|
|
52471
|
+
defer: true
|
|
52472
|
+
}));
|
|
52473
|
+
createEffect(on(capRows, () => {
|
|
52474
|
+
if (scroll === undefined || scroll.isDestroyed)
|
|
52475
|
+
return;
|
|
52476
|
+
scroll.afterLayout(() => {
|
|
52477
|
+
if (scroll === undefined || scroll.isDestroyed)
|
|
52478
|
+
return;
|
|
52479
|
+
const max = Math.max(0, scroll.scrollHeight - scroll.viewport.height);
|
|
52480
|
+
if (scroll.scrollTop > max)
|
|
52481
|
+
scroll.scrollTo(max);
|
|
52482
|
+
});
|
|
52483
|
+
}, {
|
|
52484
|
+
defer: true
|
|
52485
|
+
}));
|
|
52486
|
+
return (() => {
|
|
52487
|
+
var _el$ = createElement("box"), _el$2 = createElement("box");
|
|
52488
|
+
insertNode(_el$, _el$2);
|
|
52489
|
+
setProp(_el$, "width", "100%");
|
|
52490
|
+
setProp(_el$, "flexShrink", 0);
|
|
52491
|
+
setProp(_el$, "flexDirection", "column");
|
|
52492
|
+
setProp(_el$2, "width", "100%");
|
|
52493
|
+
setProp(_el$2, "flexShrink", 0);
|
|
52494
|
+
insert(_el$2, () => props.composer());
|
|
52495
|
+
insert(_el$, createComponent2(Show, {
|
|
52496
|
+
get when() {
|
|
52497
|
+
return dock.current();
|
|
52498
|
+
},
|
|
52499
|
+
children: (request) => (() => {
|
|
52500
|
+
var _el$3 = createElement("box"), _el$4 = createElement("scrollbox"), _el$5 = createElement("box");
|
|
52501
|
+
insertNode(_el$3, _el$4);
|
|
52502
|
+
setProp(_el$3, "width", "100%");
|
|
52503
|
+
setProp(_el$3, "flexShrink", 0);
|
|
52504
|
+
setProp(_el$3, "flexDirection", "column");
|
|
52505
|
+
insertNode(_el$4, _el$5);
|
|
52506
|
+
use((value) => {
|
|
52507
|
+
scroll = value;
|
|
52508
|
+
}, _el$4);
|
|
52509
|
+
setProp(_el$4, "width", "100%");
|
|
52510
|
+
setProp(_el$4, "flexShrink", 0);
|
|
52511
|
+
setProp(_el$4, "focusable", false);
|
|
52512
|
+
setProp(_el$4, "scrollY", true);
|
|
52513
|
+
setProp(_el$4, "scrollX", false);
|
|
52514
|
+
setProp(_el$4, "overflow", "hidden");
|
|
52515
|
+
setProp(_el$4, "verticalScrollbarOptions", {
|
|
52516
|
+
visible: false
|
|
52517
|
+
});
|
|
52518
|
+
use((value) => {
|
|
52519
|
+
body = value;
|
|
52520
|
+
}, _el$5);
|
|
52521
|
+
setProp(_el$5, "width", "100%");
|
|
52522
|
+
setProp(_el$5, "flexDirection", "column");
|
|
52523
|
+
setProp(_el$5, "onSizeChange", function() {
|
|
52524
|
+
if (disposed)
|
|
52525
|
+
return;
|
|
52526
|
+
const next = Math.max(0, Math.floor(this.height));
|
|
52527
|
+
if (next !== measured())
|
|
52528
|
+
setMeasured(next);
|
|
52529
|
+
});
|
|
52530
|
+
insert(_el$5, () => request().render({
|
|
52531
|
+
id: request().id,
|
|
52532
|
+
close: request().close,
|
|
52533
|
+
width: () => dimensions().width,
|
|
52534
|
+
maxHeight: capRows
|
|
52535
|
+
}));
|
|
52536
|
+
insert(_el$3, createComponent2(Show, {
|
|
52537
|
+
get when() {
|
|
52538
|
+
return memo2(() => !!overflows())() && hiddenRows() > 0;
|
|
52539
|
+
},
|
|
52540
|
+
get children() {
|
|
52541
|
+
var _el$6 = createElement("text");
|
|
52542
|
+
setProp(_el$6, "wrapMode", "none");
|
|
52543
|
+
setProp(_el$6, "paddingLeft", 1);
|
|
52544
|
+
insert(_el$6, indicatorText);
|
|
52545
|
+
effect((_$p) => setProp(_el$6, "fg", muted(), _$p));
|
|
52546
|
+
return _el$6;
|
|
52547
|
+
}
|
|
52548
|
+
}), null);
|
|
52549
|
+
effect((_p$) => {
|
|
52550
|
+
var _v$ = background(), _v$2 = viewportRows();
|
|
52551
|
+
_v$ !== _p$.e && (_p$.e = setProp(_el$3, "backgroundColor", _v$, _p$.e));
|
|
52552
|
+
_v$2 !== _p$.t && (_p$.t = setProp(_el$4, "height", _v$2, _p$.t));
|
|
52553
|
+
return _p$;
|
|
52554
|
+
}, {
|
|
52555
|
+
e: undefined,
|
|
52556
|
+
t: undefined
|
|
52557
|
+
});
|
|
52558
|
+
return _el$3;
|
|
52559
|
+
})()
|
|
52560
|
+
}), null);
|
|
52561
|
+
effect((_$p) => setProp(_el$2, "visible", !dock.isOpen(), _$p));
|
|
52562
|
+
return _el$;
|
|
52563
|
+
})();
|
|
52564
|
+
}
|
|
52565
|
+
var DOCK_MAX_ROWS_RATIO = 0.6, Context7, ordinal2 = 0;
|
|
52566
|
+
var init_dock_host = __esm(() => {
|
|
52567
|
+
init_index_bun();
|
|
52568
|
+
init_index_bun();
|
|
52569
|
+
init_index_bun();
|
|
52570
|
+
init_index_bun();
|
|
52571
|
+
init_index_bun();
|
|
52572
|
+
init_index_bun();
|
|
52573
|
+
init_index_bun();
|
|
52574
|
+
init_index_bun();
|
|
52575
|
+
init_server();
|
|
52576
|
+
init_index_bun();
|
|
52577
|
+
init_input_ownership();
|
|
52578
|
+
init_theme3();
|
|
52579
|
+
init_terminal_size();
|
|
52580
|
+
Context7 = createContext(undefined);
|
|
52581
|
+
});
|
|
52582
|
+
|
|
52583
|
+
// ../tui-base/src/routes/session/ask-panel.tsx
|
|
52584
|
+
function resolveFocus(ask, list, input) {
|
|
52585
|
+
if (ask === undefined)
|
|
52586
|
+
return;
|
|
52587
|
+
if (ask.phase === "input")
|
|
52588
|
+
return input;
|
|
52589
|
+
return list ?? input;
|
|
52590
|
+
}
|
|
52591
|
+
function nearestScroller(node) {
|
|
52592
|
+
let current = node;
|
|
52593
|
+
while (current !== null && current !== undefined) {
|
|
52594
|
+
const candidate = current;
|
|
52595
|
+
if (typeof candidate.scrollChildIntoView === "function")
|
|
52596
|
+
return current;
|
|
52597
|
+
current = current.parent;
|
|
52585
52598
|
}
|
|
52586
|
-
|
|
52587
|
-
|
|
52588
|
-
|
|
52599
|
+
return;
|
|
52600
|
+
}
|
|
52601
|
+
function AskPanel(props) {
|
|
52602
|
+
const theme = useThemeOptional();
|
|
52603
|
+
const dock = useDock();
|
|
52604
|
+
let configCursorStyle;
|
|
52605
|
+
try {
|
|
52606
|
+
configCursorStyle = useCursorStyle();
|
|
52607
|
+
} catch {
|
|
52608
|
+
configCursorStyle = undefined;
|
|
52609
|
+
}
|
|
52610
|
+
const [version, setVersion] = createSignal(0);
|
|
52611
|
+
onMount(() => {
|
|
52612
|
+
const unsubscribe = props.controller.subscribe(() => setVersion((value) => value + 1));
|
|
52613
|
+
onCleanup(unsubscribe);
|
|
52614
|
+
});
|
|
52615
|
+
const ask = () => {
|
|
52616
|
+
version();
|
|
52617
|
+
return props.controller.pendingAsk;
|
|
52618
|
+
};
|
|
52619
|
+
const questions = () => ask()?.questions ?? [];
|
|
52620
|
+
const question = () => {
|
|
52621
|
+
const batch = ask();
|
|
52622
|
+
return batch?.questions[batch.index];
|
|
52623
|
+
};
|
|
52624
|
+
const index = () => ask()?.index ?? 0;
|
|
52625
|
+
const phase = () => ask()?.phase ?? "questions";
|
|
52626
|
+
const phaseOf = () => {
|
|
52627
|
+
if (phase() === "review")
|
|
52628
|
+
return "review";
|
|
52629
|
+
return phase() === "input" ? "input" : "options";
|
|
52630
|
+
};
|
|
52631
|
+
const picks = () => {
|
|
52632
|
+
const batch = ask();
|
|
52633
|
+
return batch ? batch.picks[batch.index] ?? [] : [];
|
|
52634
|
+
};
|
|
52635
|
+
const cursor = () => {
|
|
52636
|
+
const batch = ask();
|
|
52637
|
+
return batch ? batch.cursors[batch.index] ?? 0 : 0;
|
|
52638
|
+
};
|
|
52639
|
+
const listCursor = () => {
|
|
52640
|
+
const batch = ask();
|
|
52641
|
+
return batch ? batch.listCursors[batch.index] ?? 0 : 0;
|
|
52642
|
+
};
|
|
52643
|
+
const markedRow = () => phaseOf() === "input" ? listCursor() : cursor();
|
|
52644
|
+
const reviewCursor = () => ask()?.reviewCursor ?? 0;
|
|
52645
|
+
const multi = () => question()?.multiSelect === true;
|
|
52646
|
+
const compact = () => props.width() < ASK_COMPACT_COLUMNS;
|
|
52647
|
+
const needsReview = () => askNeedsReview(questions());
|
|
52648
|
+
const eyebrow = () => {
|
|
52649
|
+
if (phaseOf() === "review")
|
|
52589
52650
|
return;
|
|
52590
|
-
|
|
52651
|
+
const current = question();
|
|
52652
|
+
if (current?.header === undefined || current.header === current.prompt)
|
|
52591
52653
|
return;
|
|
52592
|
-
|
|
52593
|
-
|
|
52654
|
+
return current.header;
|
|
52655
|
+
};
|
|
52656
|
+
const muted = () => theme?.text.muted ?? "#9aa5ce";
|
|
52657
|
+
const faint = () => theme?.text.faint ?? "#565f89";
|
|
52658
|
+
const base = () => theme?.text.base ?? "#e6e6e6";
|
|
52659
|
+
const accent = () => theme?.hue.interactive[500] ?? "#7aa2f7";
|
|
52660
|
+
const currentBg = () => theme?.background.action.primary.focused;
|
|
52661
|
+
const currentFg = () => theme?.text.action.primary.focused ?? accent();
|
|
52662
|
+
const rule = () => theme?.border.base ?? "#565f89";
|
|
52663
|
+
const cursorShape = () => {
|
|
52664
|
+
try {
|
|
52665
|
+
return configCursorStyle?.()?.style;
|
|
52666
|
+
} catch {
|
|
52594
52667
|
return;
|
|
52595
|
-
head.index = next;
|
|
52596
|
-
const question = head.questions[next];
|
|
52597
|
-
head.phase = question?.options.length === 0 ? "input" : "questions";
|
|
52598
|
-
if (head.phase === "input" && question !== undefined) {
|
|
52599
|
-
head.cursors[next] = inlineRowIndex(question, askNeedsReview(head.questions));
|
|
52600
52668
|
}
|
|
52601
|
-
|
|
52602
|
-
|
|
52603
|
-
|
|
52604
|
-
|
|
52605
|
-
|
|
52606
|
-
|
|
52607
|
-
|
|
52608
|
-
|
|
52609
|
-
|
|
52610
|
-
|
|
52611
|
-
|
|
52612
|
-
|
|
52613
|
-
|
|
52614
|
-
|
|
52615
|
-
|
|
52616
|
-
head.cursors[next] = inlineRowIndex(target, askNeedsReview(head.questions));
|
|
52617
|
-
}
|
|
52618
|
-
} else {
|
|
52619
|
-
head.phase = "review";
|
|
52620
|
-
head.reviewCursor = 0;
|
|
52621
|
-
}
|
|
52622
|
-
this.#changed();
|
|
52623
|
-
return true;
|
|
52624
|
-
}
|
|
52625
|
-
beginCustom() {
|
|
52626
|
-
const head = this.#asks[0];
|
|
52627
|
-
if (!head || head.phase === "review")
|
|
52628
|
-
return false;
|
|
52629
|
-
const question = head.questions[head.index];
|
|
52630
|
-
head.customDrafts[head.index] = head.customs[head.index] ?? "";
|
|
52631
|
-
head.phase = "input";
|
|
52632
|
-
if (question !== undefined) {
|
|
52633
|
-
head.cursors[head.index] = inlineRowIndex(question, askNeedsReview(head.questions));
|
|
52634
|
-
}
|
|
52635
|
-
this.#changed();
|
|
52636
|
-
return true;
|
|
52637
|
-
}
|
|
52638
|
-
patchCustom(text) {
|
|
52639
|
-
const head = this.#asks[0];
|
|
52640
|
-
if (!head || head.customDrafts[head.index] === null)
|
|
52641
|
-
return;
|
|
52642
|
-
head.customDrafts[head.index] = text;
|
|
52643
|
-
this.#changed();
|
|
52644
|
-
}
|
|
52645
|
-
commitCustom() {
|
|
52646
|
-
const head = this.#asks[0];
|
|
52647
|
-
const question = head?.questions[head.index];
|
|
52648
|
-
if (!head || !question)
|
|
52649
|
-
return;
|
|
52650
|
-
const draft = head.customDrafts[head.index] ?? null;
|
|
52651
|
-
if (draft === null)
|
|
52652
|
-
return;
|
|
52653
|
-
const text = draft.trim();
|
|
52654
|
-
head.customDrafts[head.index] = null;
|
|
52655
|
-
if (text === "") {
|
|
52656
|
-
this.#backToList(head);
|
|
52657
|
-
this.#changed();
|
|
52658
|
-
return;
|
|
52659
|
-
}
|
|
52660
|
-
head.customs[head.index] = text;
|
|
52661
|
-
head.picks[head.index] = [];
|
|
52662
|
-
if (question.multiSelect !== true && head.questions.length === 1) {
|
|
52663
|
-
this.#asks.shift();
|
|
52664
|
-
head.resolve(this.#envelope(head));
|
|
52665
|
-
this.#changed();
|
|
52666
|
-
return;
|
|
52667
|
-
}
|
|
52668
|
-
if (this.#allAnswered(head)) {
|
|
52669
|
-
head.phase = "review";
|
|
52670
|
-
head.reviewCursor = 0;
|
|
52671
|
-
} else {
|
|
52672
|
-
const next = head.questions.findIndex((_, qi) => qi > head.index && (head.picks[qi]?.length ?? 0) === 0 && !head.customs[qi]);
|
|
52673
|
-
if (next >= 0)
|
|
52674
|
-
head.index = next;
|
|
52675
|
-
head.phase = head.questions[head.index]?.options.length === 0 ? "input" : "questions";
|
|
52676
|
-
}
|
|
52677
|
-
this.#changed();
|
|
52678
|
-
}
|
|
52679
|
-
cancelCustomEdit() {
|
|
52680
|
-
const head = this.#asks[0];
|
|
52681
|
-
if (!head || head.customDrafts[head.index] === null)
|
|
52682
|
-
return;
|
|
52683
|
-
head.customDrafts[head.index] = null;
|
|
52684
|
-
this.#backToList(head);
|
|
52685
|
-
this.#changed();
|
|
52686
|
-
}
|
|
52687
|
-
get inlineText() {
|
|
52688
|
-
const head = this.#asks[0];
|
|
52689
|
-
if (!head)
|
|
52690
|
-
return "";
|
|
52691
|
-
const draft = head.customDrafts[head.index];
|
|
52692
|
-
if (draft !== null && draft !== undefined)
|
|
52693
|
-
return draft;
|
|
52694
|
-
return head.customs[head.index] ?? "";
|
|
52695
|
-
}
|
|
52696
|
-
setInlineText(text) {
|
|
52697
|
-
const head = this.#asks[0];
|
|
52698
|
-
const question = head?.questions[head.index];
|
|
52699
|
-
if (!head || !question || head.phase === "review")
|
|
52700
|
-
return;
|
|
52701
|
-
if ((head.customDrafts[head.index] ?? null) === null && text === "")
|
|
52702
|
-
return;
|
|
52703
|
-
head.customDrafts[head.index] = text;
|
|
52704
|
-
head.phase = "input";
|
|
52705
|
-
head.cursors[head.index] = inlineRowIndex(question, askNeedsReview(head.questions));
|
|
52706
|
-
this.#changed();
|
|
52707
|
-
}
|
|
52708
|
-
focusInput() {
|
|
52709
|
-
const head = this.#asks[0];
|
|
52710
|
-
const question = head?.questions[head.index];
|
|
52711
|
-
if (!head || !question || head.phase === "review")
|
|
52712
|
-
return;
|
|
52713
|
-
head.phase = "input";
|
|
52714
|
-
head.cursors[head.index] = inlineRowIndex(question, askNeedsReview(head.questions));
|
|
52715
|
-
this.#changed();
|
|
52716
|
-
}
|
|
52717
|
-
focusOptions() {
|
|
52718
|
-
const head = this.#asks[0];
|
|
52719
|
-
if (!head || head.phase !== "input")
|
|
52720
|
-
return;
|
|
52721
|
-
this.#backToList(head);
|
|
52722
|
-
this.#changed();
|
|
52723
|
-
}
|
|
52724
|
-
setCursor(row) {
|
|
52725
|
-
const head = this.#asks[0];
|
|
52726
|
-
const question = head?.questions[head.index];
|
|
52727
|
-
if (!head || !question || head.phase === "review")
|
|
52669
|
+
};
|
|
52670
|
+
let listEl;
|
|
52671
|
+
let inputEl;
|
|
52672
|
+
let inlineRowEl;
|
|
52673
|
+
useAskKeys({
|
|
52674
|
+
controller: props.controller,
|
|
52675
|
+
input: () => inputEl
|
|
52676
|
+
});
|
|
52677
|
+
const queuedCount = () => {
|
|
52678
|
+
version();
|
|
52679
|
+
return props.queued?.() ?? dock.queueDepth();
|
|
52680
|
+
};
|
|
52681
|
+
props.onFocusTarget?.(() => resolveFocus(ask(), listEl, inputEl));
|
|
52682
|
+
function revealRow(row) {
|
|
52683
|
+
if (row === undefined || row.isDestroyed)
|
|
52728
52684
|
return;
|
|
52729
|
-
const
|
|
52730
|
-
|
|
52731
|
-
const next = Math.max(0, Math.min(inline, Math.floor(row)));
|
|
52732
|
-
head.cursors[head.index] = next;
|
|
52733
|
-
head.phase = next === inline ? "input" : "questions";
|
|
52734
|
-
if (next !== inline)
|
|
52735
|
-
head.listCursors[head.index] = next;
|
|
52736
|
-
this.#changed();
|
|
52737
|
-
}
|
|
52738
|
-
moveCursor(delta) {
|
|
52739
|
-
const head = this.#asks[0];
|
|
52740
|
-
const question = head?.questions[head.index];
|
|
52741
|
-
if (!head || !question || head.phase === "review")
|
|
52685
|
+
const scroller = nearestScroller(row);
|
|
52686
|
+
if (scroller === undefined)
|
|
52742
52687
|
return;
|
|
52743
|
-
|
|
52744
|
-
|
|
52745
|
-
|
|
52746
|
-
const inline = inlineRowIndex(question, needsReview);
|
|
52747
|
-
head.cursors[head.index] = next;
|
|
52748
|
-
head.phase = next === inline ? "input" : "questions";
|
|
52749
|
-
if (next !== inline)
|
|
52750
|
-
head.listCursors[head.index] = next;
|
|
52751
|
-
this.#changed();
|
|
52688
|
+
scroller.scrollChildIntoView(row, {
|
|
52689
|
+
align: "nearest"
|
|
52690
|
+
});
|
|
52752
52691
|
}
|
|
52753
|
-
|
|
52754
|
-
const
|
|
52755
|
-
if (
|
|
52756
|
-
return;
|
|
52757
|
-
const next = Math.max(0, Math.min(head.questions.length, Math.floor(row)));
|
|
52758
|
-
if (next === head.reviewCursor)
|
|
52692
|
+
function focusInputRow() {
|
|
52693
|
+
const input = inputEl;
|
|
52694
|
+
if (input === undefined || input.isDestroyed)
|
|
52759
52695
|
return;
|
|
52760
|
-
|
|
52761
|
-
|
|
52762
|
-
}
|
|
52763
|
-
moveReviewCursor(delta) {
|
|
52764
|
-
this.setReviewCursor((this.#asks[0]?.reviewCursor ?? 0) + delta);
|
|
52696
|
+
input.focus();
|
|
52697
|
+
revealRow(inlineRowEl);
|
|
52765
52698
|
}
|
|
52766
|
-
|
|
52767
|
-
|
|
52768
|
-
|
|
52769
|
-
return;
|
|
52770
|
-
if (question.options.length === 0) {
|
|
52771
|
-
head.phase = "input";
|
|
52699
|
+
createEffect(on(() => phase(), (next) => {
|
|
52700
|
+
if (next === "input") {
|
|
52701
|
+
focusInputRow();
|
|
52772
52702
|
return;
|
|
52773
52703
|
}
|
|
52774
|
-
|
|
52775
|
-
const inline = inlineRowIndex(question, askNeedsReview(head.questions));
|
|
52776
|
-
const row = Math.max(0, Math.min(inline - 1, head.listCursors[head.index] ?? 0));
|
|
52777
|
-
head.cursors[head.index] = row;
|
|
52778
|
-
head.listCursors[head.index] = row;
|
|
52779
|
-
}
|
|
52780
|
-
enterReview() {
|
|
52781
|
-
const head = this.#asks[0];
|
|
52782
|
-
if (!head || head.phase === "review")
|
|
52783
|
-
return false;
|
|
52784
|
-
if (!askNeedsReview(head.questions))
|
|
52785
|
-
return false;
|
|
52786
|
-
head.phase = "review";
|
|
52787
|
-
head.reviewCursor = 0;
|
|
52788
|
-
this.#changed();
|
|
52789
|
-
return true;
|
|
52790
|
-
}
|
|
52791
|
-
backToQuestions(focus) {
|
|
52792
|
-
const head = this.#asks[0];
|
|
52793
|
-
if (!head || head.phase !== "review")
|
|
52794
|
-
return;
|
|
52795
|
-
head.phase = "questions";
|
|
52796
|
-
if (focus !== undefined && focus >= 0 && focus < head.questions.length)
|
|
52797
|
-
head.index = focus;
|
|
52798
|
-
const question = head.questions[head.index];
|
|
52799
|
-
if (question !== undefined && question.options.length === 0)
|
|
52800
|
-
head.phase = "input";
|
|
52801
|
-
this.#changed();
|
|
52802
|
-
}
|
|
52803
|
-
submit() {
|
|
52804
|
-
const head = this.#asks[0];
|
|
52805
|
-
if (!head)
|
|
52704
|
+
if (next !== "questions")
|
|
52806
52705
|
return;
|
|
52807
|
-
|
|
52808
|
-
|
|
52809
|
-
|
|
52810
|
-
|
|
52811
|
-
|
|
52812
|
-
|
|
52813
|
-
|
|
52814
|
-
|
|
52815
|
-
|
|
52816
|
-
|
|
52817
|
-
|
|
52818
|
-
|
|
52819
|
-
|
|
52820
|
-
|
|
52821
|
-
return {
|
|
52822
|
-
questionId: question.id,
|
|
52823
|
-
selected: picks[0] ?? "",
|
|
52824
|
-
...picks.length > 1 ? { selections: [...picks] } : {}
|
|
52825
|
-
};
|
|
52826
|
-
});
|
|
52827
|
-
}
|
|
52828
|
-
decline() {
|
|
52829
|
-
const head = this.#asks.shift();
|
|
52830
|
-
if (!head)
|
|
52706
|
+
const focusList = () => {
|
|
52707
|
+
if (listEl !== undefined && !listEl.isDestroyed)
|
|
52708
|
+
listEl.focus();
|
|
52709
|
+
};
|
|
52710
|
+
if (listEl !== undefined && !listEl.isDestroyed)
|
|
52711
|
+
focusList();
|
|
52712
|
+
else
|
|
52713
|
+
queueMicrotask(focusList);
|
|
52714
|
+
}));
|
|
52715
|
+
createEffect(on(() => index(), () => phase() === "input" ? focusInputRow() : undefined, {
|
|
52716
|
+
defer: true
|
|
52717
|
+
}));
|
|
52718
|
+
createEffect(on([() => index(), cursor], () => {
|
|
52719
|
+
if (phaseOf() !== "options")
|
|
52831
52720
|
return;
|
|
52832
|
-
|
|
52833
|
-
this.#changed();
|
|
52834
|
-
}
|
|
52835
|
-
}
|
|
52836
|
-
var init_turn_overlay_controller = __esm(() => {
|
|
52837
|
-
init_ask_options();
|
|
52838
|
-
});
|
|
52839
|
-
|
|
52840
|
-
// ../tui-base/src/ui/dialog-confirm.tsx
|
|
52841
|
-
import { TextAttributes as TextAttributes7 } from "@opentui/core";
|
|
52842
|
-
function DialogConfirm(props) {
|
|
52843
|
-
const dialog = useDialog();
|
|
52844
|
-
const theme = useTheme().surface("dialog");
|
|
52845
|
-
const newDesigns = useNewDesigns();
|
|
52846
|
-
const row = () => currentRowColors(theme);
|
|
52847
|
-
const [store, setStore] = createStore({
|
|
52848
|
-
active: "confirm"
|
|
52849
|
-
});
|
|
52850
|
-
const choose = (key) => {
|
|
52851
|
-
if (key === "confirm")
|
|
52852
|
-
props.onConfirm?.();
|
|
52853
|
-
if (key === "cancel")
|
|
52854
|
-
props.onCancel?.();
|
|
52855
|
-
dialog.clear();
|
|
52856
|
-
};
|
|
52857
|
-
const chooseExtra = (action) => {
|
|
52858
|
-
action.onTrigger();
|
|
52859
|
-
dialog.clear();
|
|
52860
|
-
};
|
|
52861
|
-
Keymap2.createLayer(() => ({
|
|
52862
|
-
mode: "modal",
|
|
52863
|
-
commands: [...newDesigns() ? [{
|
|
52864
|
-
bind: "return",
|
|
52865
|
-
title: "Confirm",
|
|
52866
|
-
group: "Dialog",
|
|
52867
|
-
run: () => choose("confirm")
|
|
52868
|
-
}, {
|
|
52869
|
-
bind: "escape",
|
|
52870
|
-
title: "Cancel",
|
|
52871
|
-
group: "Dialog",
|
|
52872
|
-
run: () => choose("cancel")
|
|
52873
|
-
}] : [{
|
|
52874
|
-
bind: "return",
|
|
52875
|
-
title: "Confirm dialog selection",
|
|
52876
|
-
group: "Dialog",
|
|
52877
|
-
run: () => choose(store.active)
|
|
52878
|
-
}, {
|
|
52879
|
-
bind: "left",
|
|
52880
|
-
title: "Previous dialog option",
|
|
52881
|
-
group: "Dialog",
|
|
52882
|
-
run: () => {
|
|
52883
|
-
setStore("active", store.active === "confirm" ? "cancel" : "confirm");
|
|
52884
|
-
}
|
|
52885
|
-
}, {
|
|
52886
|
-
bind: "right",
|
|
52887
|
-
title: "Next dialog option",
|
|
52888
|
-
group: "Dialog",
|
|
52889
|
-
run: () => {
|
|
52890
|
-
setStore("active", store.active === "confirm" ? "cancel" : "confirm");
|
|
52891
|
-
}
|
|
52892
|
-
}], ...(props.extraActions ?? []).map((action) => ({
|
|
52893
|
-
bind: action.bind,
|
|
52894
|
-
title: action.title ?? action.label,
|
|
52895
|
-
group: "Dialog",
|
|
52896
|
-
run: () => chooseExtra(action)
|
|
52897
|
-
}))]
|
|
52721
|
+
revealRow(listEl?.getChildren()[cursor()]);
|
|
52898
52722
|
}));
|
|
52899
|
-
|
|
52900
|
-
|
|
52901
|
-
|
|
52902
|
-
|
|
52903
|
-
|
|
52904
|
-
|
|
52905
|
-
|
|
52906
|
-
|
|
52907
|
-
|
|
52908
|
-
|
|
52909
|
-
|
|
52910
|
-
|
|
52911
|
-
|
|
52912
|
-
|
|
52913
|
-
|
|
52914
|
-
var _v$ = newDesigns() ? undefined : TextAttributes7.BOLD, _v$2 = theme.text.base;
|
|
52915
|
-
_v$ !== _p$.e && (_p$.e = setProp(_el$3, "attributes", _v$, _p$.e));
|
|
52916
|
-
_v$2 !== _p$.t && (_p$.t = setProp(_el$3, "fg", _v$2, _p$.t));
|
|
52917
|
-
return _p$;
|
|
52918
|
-
}, {
|
|
52919
|
-
e: undefined,
|
|
52920
|
-
t: undefined
|
|
52921
|
-
});
|
|
52922
|
-
return _el$2;
|
|
52923
|
-
})();
|
|
52924
|
-
}
|
|
52723
|
+
const optionRows = () => (question()?.options ?? []).map((option, position) => ({
|
|
52724
|
+
option,
|
|
52725
|
+
number: position + 1,
|
|
52726
|
+
selected: picks().includes(option.label)
|
|
52727
|
+
}));
|
|
52728
|
+
const labelColumn = (row) => GUTTER + CURSOR_CELLS + STATE_CELLS + `${row.number}. `.length;
|
|
52729
|
+
const footerHint = () => {
|
|
52730
|
+
if (phaseOf() === "review")
|
|
52731
|
+
return t("overlay.ask.footer.review", {
|
|
52732
|
+
esc: t("overlay.ask.esc.review")
|
|
52733
|
+
});
|
|
52734
|
+
if (phaseOf() === "input") {
|
|
52735
|
+
const escKey = question()?.options.length === 0 ? index() > 0 ? "overlay.ask.esc.prevQuestion" : "overlay.ask.esc.decline" : "overlay.ask.esc.back";
|
|
52736
|
+
return t("overlay.ask.footer.input", {
|
|
52737
|
+
esc: t(escKey)
|
|
52925
52738
|
});
|
|
52926
|
-
},
|
|
52927
|
-
get footer() {
|
|
52928
|
-
return {
|
|
52929
|
-
actions: {
|
|
52930
|
-
secondary: (props.extraActions ?? []).map((action) => ({
|
|
52931
|
-
title: action.label.toLowerCase(),
|
|
52932
|
-
key: action.bind,
|
|
52933
|
-
onTrigger: () => chooseExtra(action)
|
|
52934
|
-
})),
|
|
52935
|
-
primary: [
|
|
52936
|
-
{
|
|
52937
|
-
title: (props.label?.cancel ?? "cancel").toLowerCase(),
|
|
52938
|
-
key: "esc",
|
|
52939
|
-
onTrigger: () => choose("cancel")
|
|
52940
|
-
},
|
|
52941
|
-
{
|
|
52942
|
-
title: (props.label?.confirm ?? "confirm").toLowerCase(),
|
|
52943
|
-
key: "enter",
|
|
52944
|
-
onTrigger: () => choose("confirm")
|
|
52945
|
-
}
|
|
52946
|
-
]
|
|
52947
|
-
}
|
|
52948
|
-
};
|
|
52949
|
-
},
|
|
52950
|
-
get legacyFooter() {
|
|
52951
|
-
return (() => {
|
|
52952
|
-
var _el$4 = createElement("box"), _el$5 = createElement("box"), _el$6 = createElement("box");
|
|
52953
|
-
insertNode(_el$4, _el$5);
|
|
52954
|
-
insertNode(_el$4, _el$6);
|
|
52955
|
-
setProp(_el$4, "flexDirection", "row");
|
|
52956
|
-
setProp(_el$4, "justifyContent", "space-between");
|
|
52957
|
-
setProp(_el$4, "gap", 1);
|
|
52958
|
-
setProp(_el$5, "flexDirection", "row");
|
|
52959
|
-
insert(_el$5, createComponent2(For, {
|
|
52960
|
-
get each() {
|
|
52961
|
-
return props.extraActions ?? [];
|
|
52962
|
-
},
|
|
52963
|
-
children: (action) => (() => {
|
|
52964
|
-
var _el$7 = createElement("box"), _el$8 = createElement("text");
|
|
52965
|
-
insertNode(_el$7, _el$8);
|
|
52966
|
-
setProp(_el$7, "paddingLeft", 1);
|
|
52967
|
-
setProp(_el$7, "paddingRight", 1);
|
|
52968
|
-
setProp(_el$7, "onMouseUp", () => chooseExtra(action));
|
|
52969
|
-
insert(_el$8, () => `${action.label} [${action.bind}]`);
|
|
52970
|
-
effect((_$p) => setProp(_el$8, "fg", theme.text.muted, _$p));
|
|
52971
|
-
return _el$7;
|
|
52972
|
-
})()
|
|
52973
|
-
}));
|
|
52974
|
-
setProp(_el$6, "flexDirection", "row");
|
|
52975
|
-
insert(_el$6, createComponent2(For, {
|
|
52976
|
-
each: ["cancel", "confirm"],
|
|
52977
|
-
children: (key) => (() => {
|
|
52978
|
-
var _el$9 = createElement("box"), _el$0 = createElement("text");
|
|
52979
|
-
insertNode(_el$9, _el$0);
|
|
52980
|
-
setProp(_el$9, "paddingLeft", 1);
|
|
52981
|
-
setProp(_el$9, "paddingRight", 1);
|
|
52982
|
-
setProp(_el$9, "onMouseUp", () => choose(key));
|
|
52983
|
-
insert(_el$0, () => titlecase(props.label?.[key] ?? key));
|
|
52984
|
-
effect((_p$) => {
|
|
52985
|
-
var _v$3 = key === store.active ? row().backgroundColor : undefined, _v$4 = key === store.active ? row().textColor : theme.text.muted;
|
|
52986
|
-
_v$3 !== _p$.e && (_p$.e = setProp(_el$9, "backgroundColor", _v$3, _p$.e));
|
|
52987
|
-
_v$4 !== _p$.t && (_p$.t = setProp(_el$0, "fg", _v$4, _p$.t));
|
|
52988
|
-
return _p$;
|
|
52989
|
-
}, {
|
|
52990
|
-
e: undefined,
|
|
52991
|
-
t: undefined
|
|
52992
|
-
});
|
|
52993
|
-
return _el$9;
|
|
52994
|
-
})()
|
|
52995
|
-
}));
|
|
52996
|
-
return _el$4;
|
|
52997
|
-
})();
|
|
52998
|
-
},
|
|
52999
|
-
get children() {
|
|
53000
|
-
var _el$ = createElement("text");
|
|
53001
|
-
insert(_el$, () => props.message);
|
|
53002
|
-
effect((_$p) => setProp(_el$, "fg", theme.text.muted, _$p));
|
|
53003
|
-
return _el$;
|
|
53004
52739
|
}
|
|
53005
|
-
|
|
53006
|
-
|
|
53007
|
-
|
|
53008
|
-
|
|
53009
|
-
init_index_bun();
|
|
53010
|
-
init_index_bun();
|
|
53011
|
-
init_index_bun();
|
|
53012
|
-
init_index_bun();
|
|
53013
|
-
init_index_bun();
|
|
53014
|
-
init_index_bun();
|
|
53015
|
-
init_keymap();
|
|
53016
|
-
init_theme3();
|
|
53017
|
-
init_config();
|
|
53018
|
-
init_dialog();
|
|
53019
|
-
init_server2();
|
|
53020
|
-
init_server();
|
|
53021
|
-
init_locale();
|
|
53022
|
-
init_semantic();
|
|
53023
|
-
init_turn_overlays();
|
|
53024
|
-
});
|
|
53025
|
-
|
|
53026
|
-
// ../tui-base/src/routes/session/ask-keys.ts
|
|
53027
|
-
function printableText(event) {
|
|
53028
|
-
const text = event.sequence;
|
|
53029
|
-
if (text.length !== 1)
|
|
53030
|
-
return;
|
|
53031
|
-
if (event.ctrl || event.meta || event.super === true || event.hyper === true)
|
|
53032
|
-
return;
|
|
53033
|
-
if (text === " ")
|
|
53034
|
-
return;
|
|
53035
|
-
if (text >= "0" && text <= "9")
|
|
53036
|
-
return;
|
|
53037
|
-
const code = text.codePointAt(0) ?? 0;
|
|
53038
|
-
if (code < 32 || code === 127)
|
|
53039
|
-
return;
|
|
53040
|
-
return text;
|
|
53041
|
-
}
|
|
53042
|
-
function useAskKeys(options) {
|
|
53043
|
-
const keymap = Keymap2.useOptional();
|
|
53044
|
-
if (keymap === undefined)
|
|
53045
|
-
return;
|
|
53046
|
-
const renderer = useRenderer();
|
|
53047
|
-
const ownership = useInputOwnershipOptional();
|
|
53048
|
-
const ownsDock = () => ownership === undefined || ownership.top().kind === "dock";
|
|
53049
|
-
const ask = () => options.controller.pendingAsk;
|
|
53050
|
-
const question = () => {
|
|
53051
|
-
const batch = ask();
|
|
53052
|
-
return batch?.questions[batch.index];
|
|
52740
|
+
const escKey = questions().length > 1 && index() > 0 ? "overlay.ask.esc.prevQuestion" : "overlay.ask.esc.decline";
|
|
52741
|
+
return t(multi() ? "overlay.ask.footer.multi" : "overlay.ask.footer.options", {
|
|
52742
|
+
esc: t(escKey)
|
|
52743
|
+
});
|
|
53053
52744
|
};
|
|
53054
|
-
const
|
|
53055
|
-
const currentRow = () => {
|
|
52745
|
+
const answerText = (qi) => {
|
|
53056
52746
|
const batch = ask();
|
|
53057
|
-
|
|
53058
|
-
|
|
53059
|
-
|
|
53060
|
-
|
|
53061
|
-
|
|
52747
|
+
if (!batch)
|
|
52748
|
+
return "";
|
|
52749
|
+
const custom = batch.customs[qi];
|
|
52750
|
+
if (custom !== undefined && custom !== "")
|
|
52751
|
+
return custom;
|
|
52752
|
+
return (batch.picks[qi] ?? []).map((label) => splitRecommended(label).label).join(", ");
|
|
53062
52753
|
};
|
|
53063
|
-
|
|
53064
|
-
|
|
53065
|
-
|
|
53066
|
-
|
|
53067
|
-
|
|
53068
|
-
|
|
53069
|
-
|
|
53070
|
-
|
|
53071
|
-
|
|
53072
|
-
|
|
53073
|
-
|
|
53074
|
-
|
|
53075
|
-
|
|
53076
|
-
|
|
53077
|
-
|
|
53078
|
-
|
|
53079
|
-
|
|
53080
|
-
|
|
53081
|
-
|
|
53082
|
-
|
|
53083
|
-
|
|
53084
|
-
|
|
53085
|
-
|
|
53086
|
-
|
|
53087
|
-
|
|
53088
|
-
|
|
53089
|
-
|
|
53090
|
-
|
|
53091
|
-
|
|
53092
|
-
|
|
53093
|
-
|
|
53094
|
-
|
|
53095
|
-
|
|
53096
|
-
|
|
53097
|
-
|
|
53098
|
-
|
|
53099
|
-
return
|
|
53100
|
-
|
|
53101
|
-
|
|
53102
|
-
|
|
53103
|
-
|
|
53104
|
-
|
|
53105
|
-
|
|
53106
|
-
|
|
53107
|
-
|
|
53108
|
-
|
|
53109
|
-
|
|
53110
|
-
|
|
53111
|
-
|
|
53112
|
-
|
|
53113
|
-
|
|
53114
|
-
options.controller.backToQuestions(batch.questions.length - 1);
|
|
53115
|
-
return true;
|
|
52754
|
+
const reviewRowActive = (qi) => reviewCursor() === qi;
|
|
52755
|
+
const reviewSubmitActive = () => reviewRowIntent(reviewCursor(), questions().length).kind === "submit";
|
|
52756
|
+
return (() => {
|
|
52757
|
+
var _el$ = createElement("box"), _el$2 = createElement("box"), _el$3 = createElement("box"), _el$4 = createElement("text"), _el$1 = createElement("box"), _el$10 = createElement("text"), _el$12 = createElement("box");
|
|
52758
|
+
insertNode(_el$, _el$2);
|
|
52759
|
+
insertNode(_el$, _el$3);
|
|
52760
|
+
insertNode(_el$, _el$1);
|
|
52761
|
+
insertNode(_el$, _el$12);
|
|
52762
|
+
setProp(_el$, "flexDirection", "column");
|
|
52763
|
+
setProp(_el$, "width", "100%");
|
|
52764
|
+
setProp(_el$, "flexShrink", 0);
|
|
52765
|
+
setProp(_el$2, "width", "100%");
|
|
52766
|
+
setProp(_el$2, "flexShrink", 0);
|
|
52767
|
+
setProp(_el$2, "border", ["top"]);
|
|
52768
|
+
setProp(_el$2, "borderStyle", "single");
|
|
52769
|
+
insert(_el$, createComponent2(Show, {
|
|
52770
|
+
get when() {
|
|
52771
|
+
return eyebrow();
|
|
52772
|
+
},
|
|
52773
|
+
children: (header) => (() => {
|
|
52774
|
+
var _el$13 = createElement("box"), _el$14 = createElement("text");
|
|
52775
|
+
insertNode(_el$13, _el$14);
|
|
52776
|
+
setProp(_el$13, "paddingLeft", 2);
|
|
52777
|
+
setProp(_el$13, "paddingRight", 2);
|
|
52778
|
+
setProp(_el$14, "wrapMode", "none");
|
|
52779
|
+
insert(_el$14, header);
|
|
52780
|
+
effect((_$p) => setProp(_el$14, "fg", muted(), _$p));
|
|
52781
|
+
return _el$13;
|
|
52782
|
+
})()
|
|
52783
|
+
}), _el$3);
|
|
52784
|
+
insertNode(_el$3, _el$4);
|
|
52785
|
+
setProp(_el$3, "paddingLeft", 2);
|
|
52786
|
+
setProp(_el$3, "paddingRight", 2);
|
|
52787
|
+
setProp(_el$4, "wrapMode", "word");
|
|
52788
|
+
insert(_el$4, (() => {
|
|
52789
|
+
var _c$ = memo2(() => phaseOf() === "review");
|
|
52790
|
+
return () => _c$() ? t("overlay.ask.reviewTitle") : question()?.prompt ?? "";
|
|
52791
|
+
})());
|
|
52792
|
+
insert(_el$, createComponent2(Show, {
|
|
52793
|
+
get when() {
|
|
52794
|
+
return questions().length >= 2;
|
|
52795
|
+
},
|
|
52796
|
+
get children() {
|
|
52797
|
+
var _el$5 = createElement("box"), _el$6 = createElement("text");
|
|
52798
|
+
insertNode(_el$5, _el$6);
|
|
52799
|
+
setProp(_el$5, "paddingLeft", 2);
|
|
52800
|
+
setProp(_el$5, "paddingRight", 2);
|
|
52801
|
+
setProp(_el$6, "wrapMode", "none");
|
|
52802
|
+
insert(_el$6, () => askTabStrip(questions(), ask()?.picks ?? [], index(), ask()?.customs));
|
|
52803
|
+
effect((_$p) => setProp(_el$6, "fg", muted(), _$p));
|
|
52804
|
+
return _el$5;
|
|
53116
52805
|
}
|
|
53117
|
-
|
|
53118
|
-
|
|
53119
|
-
|
|
53120
|
-
|
|
53121
|
-
|
|
53122
|
-
|
|
53123
|
-
|
|
53124
|
-
|
|
53125
|
-
|
|
53126
|
-
|
|
53127
|
-
|
|
53128
|
-
|
|
53129
|
-
|
|
53130
|
-
|
|
53131
|
-
|
|
53132
|
-
|
|
53133
|
-
|
|
53134
|
-
|
|
52806
|
+
}), _el$1);
|
|
52807
|
+
insert(_el$, createComponent2(Show, {
|
|
52808
|
+
get when() {
|
|
52809
|
+
return memo2(() => phaseOf() !== "review")() ? question()?.detail : undefined;
|
|
52810
|
+
},
|
|
52811
|
+
children: (detail) => (() => {
|
|
52812
|
+
var _el$15 = createElement("box"), _el$16 = createElement("text");
|
|
52813
|
+
insertNode(_el$15, _el$16);
|
|
52814
|
+
setProp(_el$15, "paddingLeft", 2);
|
|
52815
|
+
setProp(_el$15, "paddingRight", 2);
|
|
52816
|
+
setProp(_el$16, "wrapMode", "word");
|
|
52817
|
+
insert(_el$16, detail);
|
|
52818
|
+
effect((_$p) => setProp(_el$16, "fg", muted(), _$p));
|
|
52819
|
+
return _el$15;
|
|
52820
|
+
})()
|
|
52821
|
+
}), _el$1);
|
|
52822
|
+
insert(_el$, createComponent2(Show, {
|
|
52823
|
+
get when() {
|
|
52824
|
+
return phaseOf() === "review";
|
|
52825
|
+
},
|
|
52826
|
+
get fallback() {
|
|
52827
|
+
return [(() => {
|
|
52828
|
+
var _el$17 = createElement("box");
|
|
52829
|
+
use((value) => {
|
|
52830
|
+
listEl = value;
|
|
52831
|
+
}, _el$17);
|
|
52832
|
+
setProp(_el$17, "flexDirection", "column");
|
|
52833
|
+
setProp(_el$17, "width", "100%");
|
|
52834
|
+
setProp(_el$17, "flexShrink", 0);
|
|
52835
|
+
setProp(_el$17, "focusable", true);
|
|
52836
|
+
insert(_el$17, createComponent2(Index, {
|
|
52837
|
+
get each() {
|
|
52838
|
+
return optionRows();
|
|
52839
|
+
},
|
|
52840
|
+
children: (row, position) => createComponent2(OptionRow, {
|
|
52841
|
+
row,
|
|
52842
|
+
cursor: () => phaseOf() !== "input" && position === cursor(),
|
|
52843
|
+
marked: () => position === markedRow(),
|
|
52844
|
+
multi: () => multi(),
|
|
52845
|
+
compact: () => compact(),
|
|
52846
|
+
width: () => props.width(),
|
|
52847
|
+
labelColumn: () => labelColumn(row())
|
|
52848
|
+
})
|
|
52849
|
+
}), null);
|
|
52850
|
+
insert(_el$17, createComponent2(Show, {
|
|
52851
|
+
get when() {
|
|
52852
|
+
return memo2(() => question() !== undefined)() && hasReviewRow(question(), needsReview());
|
|
52853
|
+
},
|
|
52854
|
+
get children() {
|
|
52855
|
+
var _el$18 = createElement("box"), _el$19 = createElement("text"), _el$20 = createElement("text");
|
|
52856
|
+
insertNode(_el$18, _el$19);
|
|
52857
|
+
insertNode(_el$18, _el$20);
|
|
52858
|
+
setProp(_el$18, "flexDirection", "row");
|
|
52859
|
+
setProp(_el$18, "width", "100%");
|
|
52860
|
+
setProp(_el$18, "flexShrink", 0);
|
|
52861
|
+
setProp(_el$18, "paddingLeft", 2);
|
|
52862
|
+
insert(_el$19, () => markedRow() === (question()?.options.length ?? 0) ? "\u203A " : " ");
|
|
52863
|
+
setProp(_el$20, "wrapMode", "word");
|
|
52864
|
+
insert(_el$20, () => t("overlay.ask.reviewRow"));
|
|
52865
|
+
effect((_p$) => {
|
|
52866
|
+
var _v$8 = phaseOf() !== "input" && markedRow() === (question()?.options.length ?? 0) ? currentBg() : undefined, _v$9 = phaseOf() !== "input" && markedRow() === (question()?.options.length ?? 0) ? accent() : faint(), _v$0 = phaseOf() !== "input" && markedRow() === (question()?.options.length ?? 0) ? currentFg() : muted();
|
|
52867
|
+
_v$8 !== _p$.e && (_p$.e = setProp(_el$18, "backgroundColor", _v$8, _p$.e));
|
|
52868
|
+
_v$9 !== _p$.t && (_p$.t = setProp(_el$19, "fg", _v$9, _p$.t));
|
|
52869
|
+
_v$0 !== _p$.a && (_p$.a = setProp(_el$20, "fg", _v$0, _p$.a));
|
|
52870
|
+
return _p$;
|
|
52871
|
+
}, {
|
|
52872
|
+
e: undefined,
|
|
52873
|
+
t: undefined,
|
|
52874
|
+
a: undefined
|
|
52875
|
+
});
|
|
52876
|
+
return _el$18;
|
|
52877
|
+
}
|
|
52878
|
+
}), null);
|
|
52879
|
+
return _el$17;
|
|
52880
|
+
})(), (() => {
|
|
52881
|
+
var _el$21 = createElement("box"), _el$22 = createElement("text"), _el$24 = createElement("input");
|
|
52882
|
+
insertNode(_el$21, _el$22);
|
|
52883
|
+
insertNode(_el$21, _el$24);
|
|
52884
|
+
use((value) => {
|
|
52885
|
+
inlineRowEl = value;
|
|
52886
|
+
}, _el$21);
|
|
52887
|
+
setProp(_el$21, "flexDirection", "row");
|
|
52888
|
+
setProp(_el$21, "width", "100%");
|
|
52889
|
+
setProp(_el$21, "flexShrink", 0);
|
|
52890
|
+
setProp(_el$21, "paddingLeft", 2);
|
|
52891
|
+
insertNode(_el$22, createTextNode(`\u270E `));
|
|
52892
|
+
use((value) => {
|
|
52893
|
+
inputEl = value;
|
|
52894
|
+
}, _el$24);
|
|
52895
|
+
setProp(_el$24, "flexGrow", 1);
|
|
52896
|
+
setProp(_el$24, "onInput", (value) => props.controller.setInlineText(value));
|
|
52897
|
+
setProp(_el$24, "onSubmit", () => props.controller.commitCustom());
|
|
52898
|
+
effect((_p$) => {
|
|
52899
|
+
var _v$1 = phaseOf() === "input" ? currentBg() : undefined, _v$10 = phaseOf() === "input" ? currentFg() : muted(), _v$11 = props.controller.inlineText, _v$12 = t("overlay.ask.inputPlaceholder"), _v$13 = muted(), _v$14 = base(), _v$15 = currentFg(), _v$16 = phaseOf() === "input" ? currentFg() : accent(), _v$17 = cursorShape();
|
|
52900
|
+
_v$1 !== _p$.e && (_p$.e = setProp(_el$21, "backgroundColor", _v$1, _p$.e));
|
|
52901
|
+
_v$10 !== _p$.t && (_p$.t = setProp(_el$22, "fg", _v$10, _p$.t));
|
|
52902
|
+
_v$11 !== _p$.a && (_p$.a = setProp(_el$24, "value", _v$11, _p$.a));
|
|
52903
|
+
_v$12 !== _p$.o && (_p$.o = setProp(_el$24, "placeholder", _v$12, _p$.o));
|
|
52904
|
+
_v$13 !== _p$.i && (_p$.i = setProp(_el$24, "placeholderColor", _v$13, _p$.i));
|
|
52905
|
+
_v$14 !== _p$.n && (_p$.n = setProp(_el$24, "textColor", _v$14, _p$.n));
|
|
52906
|
+
_v$15 !== _p$.s && (_p$.s = setProp(_el$24, "focusedTextColor", _v$15, _p$.s));
|
|
52907
|
+
_v$16 !== _p$.h && (_p$.h = setProp(_el$24, "cursorColor", _v$16, _p$.h));
|
|
52908
|
+
_v$17 !== _p$.r && (_p$.r = setProp(_el$24, "cursorStyle", _v$17, _p$.r));
|
|
52909
|
+
return _p$;
|
|
52910
|
+
}, {
|
|
52911
|
+
e: undefined,
|
|
52912
|
+
t: undefined,
|
|
52913
|
+
a: undefined,
|
|
52914
|
+
o: undefined,
|
|
52915
|
+
i: undefined,
|
|
52916
|
+
n: undefined,
|
|
52917
|
+
s: undefined,
|
|
52918
|
+
h: undefined,
|
|
52919
|
+
r: undefined
|
|
52920
|
+
});
|
|
52921
|
+
return _el$21;
|
|
52922
|
+
})()];
|
|
52923
|
+
},
|
|
52924
|
+
get children() {
|
|
52925
|
+
var _el$7 = createElement("box"), _el$8 = createElement("box"), _el$9 = createElement("text"), _el$0 = createElement("text");
|
|
52926
|
+
insertNode(_el$7, _el$8);
|
|
52927
|
+
setProp(_el$7, "flexDirection", "column");
|
|
52928
|
+
setProp(_el$7, "width", "100%");
|
|
52929
|
+
setProp(_el$7, "flexShrink", 0);
|
|
52930
|
+
insert(_el$7, createComponent2(Index, {
|
|
52931
|
+
get each() {
|
|
52932
|
+
return questions();
|
|
52933
|
+
},
|
|
52934
|
+
children: (item, qi) => (() => {
|
|
52935
|
+
var _el$25 = createElement("box"), _el$26 = createElement("box"), _el$27 = createElement("text"), _el$28 = createElement("text"), _el$30 = createElement("text"), _el$31 = createElement("box"), _el$32 = createElement("text");
|
|
52936
|
+
insertNode(_el$25, _el$26);
|
|
52937
|
+
insertNode(_el$25, _el$31);
|
|
52938
|
+
setProp(_el$25, "flexDirection", "column");
|
|
52939
|
+
setProp(_el$25, "width", "100%");
|
|
52940
|
+
setProp(_el$25, "flexShrink", 0);
|
|
52941
|
+
insertNode(_el$26, _el$27);
|
|
52942
|
+
insertNode(_el$26, _el$28);
|
|
52943
|
+
insertNode(_el$26, _el$30);
|
|
52944
|
+
setProp(_el$26, "flexDirection", "row");
|
|
52945
|
+
setProp(_el$26, "width", "100%");
|
|
52946
|
+
setProp(_el$26, "flexShrink", 0);
|
|
52947
|
+
setProp(_el$26, "paddingLeft", 2);
|
|
52948
|
+
insert(_el$27, () => reviewRowActive(qi) ? "\u203A " : " ");
|
|
52949
|
+
insertNode(_el$28, createTextNode(`\u2713 `));
|
|
52950
|
+
setProp(_el$30, "wrapMode", "word");
|
|
52951
|
+
insert(_el$30, () => item().prompt);
|
|
52952
|
+
insertNode(_el$31, _el$32);
|
|
52953
|
+
setProp(_el$31, "paddingLeft", 6);
|
|
52954
|
+
setProp(_el$32, "wrapMode", "word");
|
|
52955
|
+
insert(_el$32, () => `\u2192 ${answerText(qi) !== "" ? answerText(qi) : t("overlay.ask.unanswered")}`);
|
|
52956
|
+
effect((_p$) => {
|
|
52957
|
+
var _v$18 = reviewRowActive(qi) ? currentBg() : undefined, _v$19 = reviewRowActive(qi) ? currentFg() : accent(), _v$20 = reviewRowActive(qi) ? currentFg() : muted(), _v$21 = reviewRowActive(qi) ? currentFg() : base(), _v$22 = answerText(qi) !== "" ? accent() : faint();
|
|
52958
|
+
_v$18 !== _p$.e && (_p$.e = setProp(_el$26, "backgroundColor", _v$18, _p$.e));
|
|
52959
|
+
_v$19 !== _p$.t && (_p$.t = setProp(_el$27, "fg", _v$19, _p$.t));
|
|
52960
|
+
_v$20 !== _p$.a && (_p$.a = setProp(_el$28, "fg", _v$20, _p$.a));
|
|
52961
|
+
_v$21 !== _p$.o && (_p$.o = setProp(_el$30, "fg", _v$21, _p$.o));
|
|
52962
|
+
_v$22 !== _p$.i && (_p$.i = setProp(_el$32, "fg", _v$22, _p$.i));
|
|
52963
|
+
return _p$;
|
|
52964
|
+
}, {
|
|
52965
|
+
e: undefined,
|
|
52966
|
+
t: undefined,
|
|
52967
|
+
a: undefined,
|
|
52968
|
+
o: undefined,
|
|
52969
|
+
i: undefined
|
|
52970
|
+
});
|
|
52971
|
+
return _el$25;
|
|
52972
|
+
})()
|
|
52973
|
+
}), _el$8);
|
|
52974
|
+
insertNode(_el$8, _el$9);
|
|
52975
|
+
insertNode(_el$8, _el$0);
|
|
52976
|
+
setProp(_el$8, "flexDirection", "row");
|
|
52977
|
+
setProp(_el$8, "width", "100%");
|
|
52978
|
+
setProp(_el$8, "flexShrink", 0);
|
|
52979
|
+
setProp(_el$8, "paddingLeft", 2);
|
|
52980
|
+
insert(_el$9, () => reviewSubmitActive() ? "\u203A " : " ");
|
|
52981
|
+
setProp(_el$0, "wrapMode", "none");
|
|
52982
|
+
insert(_el$0, () => t("overlay.ask.submitRow"));
|
|
52983
|
+
effect((_p$) => {
|
|
52984
|
+
var _v$ = reviewSubmitActive() ? currentBg() : undefined, _v$2 = reviewSubmitActive() ? currentFg() : accent(), _v$3 = reviewSubmitActive() ? currentFg() : base();
|
|
52985
|
+
_v$ !== _p$.e && (_p$.e = setProp(_el$8, "backgroundColor", _v$, _p$.e));
|
|
52986
|
+
_v$2 !== _p$.t && (_p$.t = setProp(_el$9, "fg", _v$2, _p$.t));
|
|
52987
|
+
_v$3 !== _p$.a && (_p$.a = setProp(_el$0, "fg", _v$3, _p$.a));
|
|
52988
|
+
return _p$;
|
|
52989
|
+
}, {
|
|
52990
|
+
e: undefined,
|
|
52991
|
+
t: undefined,
|
|
52992
|
+
a: undefined
|
|
52993
|
+
});
|
|
52994
|
+
return _el$7;
|
|
53135
52995
|
}
|
|
53136
|
-
|
|
53137
|
-
|
|
53138
|
-
|
|
53139
|
-
|
|
53140
|
-
|
|
53141
|
-
|
|
53142
|
-
|
|
53143
|
-
|
|
53144
|
-
|
|
53145
|
-
|
|
53146
|
-
|
|
53147
|
-
|
|
53148
|
-
|
|
53149
|
-
|
|
53150
|
-
|
|
53151
|
-
|
|
53152
|
-
|
|
53153
|
-
|
|
53154
|
-
|
|
53155
|
-
|
|
53156
|
-
|
|
53157
|
-
|
|
53158
|
-
|
|
53159
|
-
|
|
53160
|
-
|
|
53161
|
-
|
|
53162
|
-
|
|
53163
|
-
|
|
53164
|
-
|
|
53165
|
-
|
|
53166
|
-
|
|
53167
|
-
|
|
53168
|
-
|
|
53169
|
-
|
|
53170
|
-
|
|
53171
|
-
|
|
53172
|
-
|
|
53173
|
-
|
|
53174
|
-
|
|
53175
|
-
|
|
53176
|
-
|
|
53177
|
-
|
|
53178
|
-
|
|
53179
|
-
|
|
53180
|
-
|
|
53181
|
-
|
|
53182
|
-
|
|
53183
|
-
|
|
53184
|
-
|
|
53185
|
-
|
|
53186
|
-
|
|
53187
|
-
|
|
53188
|
-
|
|
53189
|
-
|
|
53190
|
-
|
|
52996
|
+
}), _el$1);
|
|
52997
|
+
insertNode(_el$1, _el$10);
|
|
52998
|
+
setProp(_el$1, "flexDirection", "row");
|
|
52999
|
+
setProp(_el$1, "width", "100%");
|
|
53000
|
+
setProp(_el$1, "justifyContent", "space-between");
|
|
53001
|
+
setProp(_el$1, "paddingLeft", 2);
|
|
53002
|
+
setProp(_el$1, "paddingRight", 2);
|
|
53003
|
+
setProp(_el$10, "wrapMode", "none");
|
|
53004
|
+
insert(_el$10, footerHint);
|
|
53005
|
+
insert(_el$1, createComponent2(Show, {
|
|
53006
|
+
get when() {
|
|
53007
|
+
return queuedCount() > 0;
|
|
53008
|
+
},
|
|
53009
|
+
get children() {
|
|
53010
|
+
var _el$11 = createElement("text");
|
|
53011
|
+
setProp(_el$11, "wrapMode", "none");
|
|
53012
|
+
insert(_el$11, () => t("overlay.ask.queued", {
|
|
53013
|
+
count: queuedCount()
|
|
53014
|
+
}));
|
|
53015
|
+
effect((_$p) => setProp(_el$11, "fg", muted(), _$p));
|
|
53016
|
+
return _el$11;
|
|
53017
|
+
}
|
|
53018
|
+
}), null);
|
|
53019
|
+
setProp(_el$12, "width", "100%");
|
|
53020
|
+
setProp(_el$12, "flexShrink", 0);
|
|
53021
|
+
setProp(_el$12, "border", ["bottom"]);
|
|
53022
|
+
setProp(_el$12, "borderStyle", "single");
|
|
53023
|
+
effect((_p$) => {
|
|
53024
|
+
var _v$4 = rule(), _v$5 = warningColor(theme), _v$6 = muted(), _v$7 = rule();
|
|
53025
|
+
_v$4 !== _p$.e && (_p$.e = setProp(_el$2, "borderColor", _v$4, _p$.e));
|
|
53026
|
+
_v$5 !== _p$.t && (_p$.t = setProp(_el$4, "fg", _v$5, _p$.t));
|
|
53027
|
+
_v$6 !== _p$.a && (_p$.a = setProp(_el$10, "fg", _v$6, _p$.a));
|
|
53028
|
+
_v$7 !== _p$.o && (_p$.o = setProp(_el$12, "borderColor", _v$7, _p$.o));
|
|
53029
|
+
return _p$;
|
|
53030
|
+
}, {
|
|
53031
|
+
e: undefined,
|
|
53032
|
+
t: undefined,
|
|
53033
|
+
a: undefined,
|
|
53034
|
+
o: undefined
|
|
53035
|
+
});
|
|
53036
|
+
return _el$;
|
|
53037
|
+
})();
|
|
53038
|
+
}
|
|
53039
|
+
function OptionRow(props) {
|
|
53040
|
+
const theme = useThemeOptional();
|
|
53041
|
+
const muted = () => theme?.text.muted ?? "#9aa5ce";
|
|
53042
|
+
const faint = () => theme?.text.faint ?? "#565f89";
|
|
53043
|
+
const base = () => theme?.text.base ?? "#e6e6e6";
|
|
53044
|
+
const accent = () => theme?.hue.interactive[500] ?? "#7aa2f7";
|
|
53045
|
+
const success = () => theme?.text.feedback.success.base ?? "#9ece6a";
|
|
53046
|
+
const currentBg = () => theme?.background.action.primary.focused;
|
|
53047
|
+
const currentFg = () => theme?.text.action.primary.focused ?? accent();
|
|
53048
|
+
const label = () => splitRecommended(props.row().option.label);
|
|
53049
|
+
const number = () => `${props.row().number}. `;
|
|
53050
|
+
const badge = () => `[${t("overlay.ask.recommended")}]`;
|
|
53051
|
+
const stateGlyph = () => {
|
|
53052
|
+
if (props.multi())
|
|
53053
|
+
return props.row().selected ? "\u25A0 " : "\u25A1 ";
|
|
53054
|
+
return props.row().selected ? "\u25CF " : "\u25CB ";
|
|
53055
|
+
};
|
|
53056
|
+
const stateColor = () => {
|
|
53057
|
+
if (props.cursor())
|
|
53058
|
+
return currentFg();
|
|
53059
|
+
return props.row().selected ? success() : faint();
|
|
53060
|
+
};
|
|
53061
|
+
const badgeInline = () => {
|
|
53062
|
+
if (!label().recommended || props.compact())
|
|
53191
53063
|
return false;
|
|
53192
|
-
|
|
53193
|
-
|
|
53194
|
-
|
|
53195
|
-
|
|
53196
|
-
|
|
53197
|
-
|
|
53198
|
-
|
|
53199
|
-
|
|
53200
|
-
|
|
53064
|
+
const used = props.labelColumn() + stringWidth(label().label) + BADGE_GAP + stringWidth(badge());
|
|
53065
|
+
return used <= props.width();
|
|
53066
|
+
};
|
|
53067
|
+
const labelColor = () => props.cursor() ? currentFg() : base();
|
|
53068
|
+
return (() => {
|
|
53069
|
+
var _el$33 = createElement("box"), _el$34 = createElement("box"), _el$35 = createElement("text"), _el$36 = createElement("text"), _el$37 = createElement("text"), _el$38 = createElement("text");
|
|
53070
|
+
insertNode(_el$33, _el$34);
|
|
53071
|
+
setProp(_el$33, "flexDirection", "column");
|
|
53072
|
+
setProp(_el$33, "width", "100%");
|
|
53073
|
+
setProp(_el$33, "flexShrink", 0);
|
|
53074
|
+
insertNode(_el$34, _el$35);
|
|
53075
|
+
insertNode(_el$34, _el$36);
|
|
53076
|
+
insertNode(_el$34, _el$37);
|
|
53077
|
+
insertNode(_el$34, _el$38);
|
|
53078
|
+
setProp(_el$34, "flexDirection", "row");
|
|
53079
|
+
setProp(_el$34, "width", "100%");
|
|
53080
|
+
setProp(_el$34, "flexShrink", 0);
|
|
53081
|
+
setProp(_el$34, "paddingLeft", 2);
|
|
53082
|
+
insert(_el$35, () => props.marked() ? "\u203A " : " ");
|
|
53083
|
+
insert(_el$36, stateGlyph);
|
|
53084
|
+
insert(_el$37, number);
|
|
53085
|
+
setProp(_el$38, "wrapMode", "word");
|
|
53086
|
+
insert(_el$38, () => label().label);
|
|
53087
|
+
insert(_el$34, createComponent2(Show, {
|
|
53088
|
+
get when() {
|
|
53089
|
+
return badgeInline();
|
|
53090
|
+
},
|
|
53091
|
+
get children() {
|
|
53092
|
+
var _el$39 = createElement("text");
|
|
53093
|
+
insert(_el$39, () => ` ${badge()}`);
|
|
53094
|
+
effect((_$p) => setProp(_el$39, "fg", props.cursor() ? currentFg() : success(), _$p));
|
|
53095
|
+
return _el$39;
|
|
53201
53096
|
}
|
|
53202
|
-
}
|
|
53203
|
-
|
|
53204
|
-
|
|
53205
|
-
|
|
53206
|
-
|
|
53207
|
-
|
|
53208
|
-
|
|
53209
|
-
|
|
53210
|
-
|
|
53211
|
-
|
|
53212
|
-
|
|
53213
|
-
|
|
53214
|
-
|
|
53215
|
-
|
|
53216
|
-
|
|
53217
|
-
|
|
53218
|
-
|
|
53219
|
-
|
|
53220
|
-
|
|
53221
|
-
|
|
53222
|
-
|
|
53223
|
-
|
|
53224
|
-
|
|
53225
|
-
|
|
53226
|
-
|
|
53227
|
-
|
|
53228
|
-
|
|
53229
|
-
|
|
53230
|
-
|
|
53231
|
-
|
|
53232
|
-
|
|
53233
|
-
|
|
53234
|
-
|
|
53235
|
-
|
|
53236
|
-
|
|
53237
|
-
|
|
53238
|
-
|
|
53239
|
-
|
|
53240
|
-
|
|
53097
|
+
}), null);
|
|
53098
|
+
insert(_el$33, createComponent2(Show, {
|
|
53099
|
+
get when() {
|
|
53100
|
+
return memo2(() => !!label().recommended)() && !badgeInline();
|
|
53101
|
+
},
|
|
53102
|
+
get children() {
|
|
53103
|
+
var _el$40 = createElement("box"), _el$41 = createElement("text");
|
|
53104
|
+
insertNode(_el$40, _el$41);
|
|
53105
|
+
setProp(_el$41, "wrapMode", "none");
|
|
53106
|
+
insert(_el$41, badge);
|
|
53107
|
+
effect((_p$) => {
|
|
53108
|
+
var _v$23 = props.labelColumn(), _v$24 = success();
|
|
53109
|
+
_v$23 !== _p$.e && (_p$.e = setProp(_el$40, "paddingLeft", _v$23, _p$.e));
|
|
53110
|
+
_v$24 !== _p$.t && (_p$.t = setProp(_el$41, "fg", _v$24, _p$.t));
|
|
53111
|
+
return _p$;
|
|
53112
|
+
}, {
|
|
53113
|
+
e: undefined,
|
|
53114
|
+
t: undefined
|
|
53115
|
+
});
|
|
53116
|
+
return _el$40;
|
|
53117
|
+
}
|
|
53118
|
+
}), null);
|
|
53119
|
+
insert(_el$33, createComponent2(Show, {
|
|
53120
|
+
get when() {
|
|
53121
|
+
return props.row().option.description;
|
|
53122
|
+
},
|
|
53123
|
+
children: (description) => (() => {
|
|
53124
|
+
var _el$42 = createElement("box"), _el$43 = createElement("text");
|
|
53125
|
+
insertNode(_el$42, _el$43);
|
|
53126
|
+
setProp(_el$43, "wrapMode", "word");
|
|
53127
|
+
insert(_el$43, description);
|
|
53128
|
+
effect((_p$) => {
|
|
53129
|
+
var _v$31 = props.labelColumn(), _v$32 = muted();
|
|
53130
|
+
_v$31 !== _p$.e && (_p$.e = setProp(_el$42, "paddingLeft", _v$31, _p$.e));
|
|
53131
|
+
_v$32 !== _p$.t && (_p$.t = setProp(_el$43, "fg", _v$32, _p$.t));
|
|
53132
|
+
return _p$;
|
|
53133
|
+
}, {
|
|
53134
|
+
e: undefined,
|
|
53135
|
+
t: undefined
|
|
53136
|
+
});
|
|
53137
|
+
return _el$42;
|
|
53138
|
+
})()
|
|
53139
|
+
}), null);
|
|
53140
|
+
effect((_p$) => {
|
|
53141
|
+
var _v$25 = props.cursor() ? currentBg() : undefined, _v$26 = props.cursor() ? currentFg() : faint(), _v$27 = stateColor(), _v$28 = props.cursor() ? currentFg() : faint(), _v$29 = labelColor(), _v$30 = badgeInline() ? 0 : 1;
|
|
53142
|
+
_v$25 !== _p$.e && (_p$.e = setProp(_el$34, "backgroundColor", _v$25, _p$.e));
|
|
53143
|
+
_v$26 !== _p$.t && (_p$.t = setProp(_el$35, "fg", _v$26, _p$.t));
|
|
53144
|
+
_v$27 !== _p$.a && (_p$.a = setProp(_el$36, "fg", _v$27, _p$.a));
|
|
53145
|
+
_v$28 !== _p$.o && (_p$.o = setProp(_el$37, "fg", _v$28, _p$.o));
|
|
53146
|
+
_v$29 !== _p$.i && (_p$.i = setProp(_el$38, "fg", _v$29, _p$.i));
|
|
53147
|
+
_v$30 !== _p$.n && (_p$.n = setProp(_el$38, "flexGrow", _v$30, _p$.n));
|
|
53148
|
+
return _p$;
|
|
53149
|
+
}, {
|
|
53150
|
+
e: undefined,
|
|
53151
|
+
t: undefined,
|
|
53152
|
+
a: undefined,
|
|
53153
|
+
o: undefined,
|
|
53154
|
+
i: undefined,
|
|
53155
|
+
n: undefined
|
|
53156
|
+
});
|
|
53157
|
+
return _el$33;
|
|
53158
|
+
})();
|
|
53241
53159
|
}
|
|
53242
|
-
var
|
|
53243
|
-
var
|
|
53160
|
+
var ASK_COMPACT_COLUMNS = 64, GUTTER = 2, CURSOR_CELLS = 2, STATE_CELLS = 2, BADGE_GAP = 2;
|
|
53161
|
+
var init_ask_panel = __esm(() => {
|
|
53162
|
+
init_index_bun();
|
|
53163
|
+
init_index_bun();
|
|
53164
|
+
init_index_bun();
|
|
53165
|
+
init_index_bun();
|
|
53166
|
+
init_index_bun();
|
|
53167
|
+
init_index_bun();
|
|
53168
|
+
init_index_bun();
|
|
53169
|
+
init_index_bun();
|
|
53244
53170
|
init_index_bun();
|
|
53245
53171
|
init_server();
|
|
53246
|
-
|
|
53247
|
-
|
|
53172
|
+
init_i18n();
|
|
53173
|
+
init_theme3();
|
|
53174
|
+
init_config();
|
|
53175
|
+
init_semantic();
|
|
53248
53176
|
init_ask_options();
|
|
53249
|
-
|
|
53177
|
+
init_ask_keys();
|
|
53178
|
+
init_dock_host();
|
|
53179
|
+
init_string_width();
|
|
53250
53180
|
});
|
|
53251
53181
|
|
|
53252
|
-
// ../tui-base/src/routes/session/
|
|
53253
|
-
function
|
|
53254
|
-
|
|
53255
|
-
|
|
53256
|
-
|
|
53257
|
-
|
|
53258
|
-
|
|
53259
|
-
|
|
53260
|
-
|
|
53261
|
-
return nested;
|
|
53262
|
-
}
|
|
53263
|
-
return;
|
|
53182
|
+
// ../tui-base/src/routes/session/turn-overlays.tsx
|
|
53183
|
+
function summarizeArgs(name, args, limit = 160) {
|
|
53184
|
+
let body = JSON.stringify(args);
|
|
53185
|
+
if (body === undefined)
|
|
53186
|
+
body = "";
|
|
53187
|
+
body = body.trim();
|
|
53188
|
+
if (body.length > limit)
|
|
53189
|
+
body = body.slice(0, limit - 1) + "\u2026";
|
|
53190
|
+
return `${name} ${body}`.trim();
|
|
53264
53191
|
}
|
|
53265
|
-
function
|
|
53266
|
-
const
|
|
53267
|
-
|
|
53268
|
-
|
|
53269
|
-
|
|
53270
|
-
|
|
53271
|
-
|
|
53272
|
-
|
|
53273
|
-
|
|
53274
|
-
|
|
53275
|
-
|
|
53276
|
-
|
|
53277
|
-
return;
|
|
53278
|
-
let done = false;
|
|
53279
|
-
const handler = () => {
|
|
53280
|
-
if (done)
|
|
53281
|
-
return;
|
|
53282
|
-
done = true;
|
|
53283
|
-
renderer.off("frame", handler);
|
|
53284
|
-
if (cancelAfterLayout === cancel)
|
|
53285
|
-
cancelAfterLayout = undefined;
|
|
53286
|
-
callback();
|
|
53287
|
-
};
|
|
53288
|
-
const cancel = () => {
|
|
53289
|
-
if (done)
|
|
53290
|
-
return;
|
|
53291
|
-
done = true;
|
|
53292
|
-
renderer.off("frame", handler);
|
|
53293
|
-
if (cancelAfterLayout === cancel)
|
|
53294
|
-
cancelAfterLayout = undefined;
|
|
53295
|
-
};
|
|
53296
|
-
cancelAfterLayout = cancel;
|
|
53297
|
-
renderer.on("frame", handler);
|
|
53298
|
-
}
|
|
53299
|
-
function focusDock() {
|
|
53300
|
-
afterLayout(() => {
|
|
53301
|
-
if (!hasRequests())
|
|
53302
|
-
return;
|
|
53303
|
-
const target = focusTarget?.();
|
|
53304
|
-
if (target !== undefined) {
|
|
53305
|
-
target.focus();
|
|
53306
|
-
return;
|
|
53307
|
-
}
|
|
53308
|
-
renderer.currentFocusedRenderable?.blur();
|
|
53309
|
-
});
|
|
53310
|
-
}
|
|
53311
|
-
function remove(entry) {
|
|
53312
|
-
const before = queue();
|
|
53313
|
-
if (!before.includes(entry))
|
|
53314
|
-
return;
|
|
53315
|
-
const next = before.filter((item) => item !== entry);
|
|
53316
|
-
setQueue(next);
|
|
53317
|
-
if (next.length > 0) {
|
|
53318
|
-
if (before[0] !== next[0])
|
|
53319
|
-
focusDock();
|
|
53320
|
-
return;
|
|
53321
|
-
}
|
|
53322
|
-
if (frame !== undefined) {
|
|
53323
|
-
ownership?.pop(frame);
|
|
53324
|
-
frame = undefined;
|
|
53325
|
-
}
|
|
53326
|
-
afterLayout(() => {
|
|
53327
|
-
if (hasRequests())
|
|
53328
|
-
return;
|
|
53329
|
-
composerFocus?.();
|
|
53330
|
-
});
|
|
53331
|
-
}
|
|
53332
|
-
const api = {
|
|
53333
|
-
open(render, options = {}) {
|
|
53334
|
-
const id = ++ordinal2;
|
|
53335
|
-
const entry = {
|
|
53336
|
-
id,
|
|
53337
|
-
kind: options.kind,
|
|
53338
|
-
options,
|
|
53339
|
-
close: () => remove(entry),
|
|
53340
|
-
render
|
|
53341
|
-
};
|
|
53342
|
-
const before = queue();
|
|
53343
|
-
setQueue([...before, entry]);
|
|
53344
|
-
if (before.length === 0) {
|
|
53345
|
-
frame = ownership?.push("dock");
|
|
53346
|
-
focusDock();
|
|
53347
|
-
}
|
|
53348
|
-
return {
|
|
53349
|
-
id,
|
|
53350
|
-
close: entry.close
|
|
53351
|
-
};
|
|
53192
|
+
function ApprovalCard(props) {
|
|
53193
|
+
const invalidated = () => props.invalidatedReason !== undefined;
|
|
53194
|
+
return createComponent2(DialogConfirm, {
|
|
53195
|
+
get title() {
|
|
53196
|
+
return memo2(() => !!invalidated())() ? t("overlay.ask.invalidatedTitle") : t("overlay.ask.approvalTitle", {
|
|
53197
|
+
name: props.name
|
|
53198
|
+
});
|
|
53199
|
+
},
|
|
53200
|
+
get message() {
|
|
53201
|
+
return memo2(() => !!invalidated())() ? t("overlay.ask.invalidated", {
|
|
53202
|
+
reason: props.invalidatedReason ?? ""
|
|
53203
|
+
}) : summarizeArgs(props.name, props.args);
|
|
53352
53204
|
},
|
|
53353
|
-
|
|
53354
|
-
|
|
53355
|
-
|
|
53356
|
-
|
|
53357
|
-
|
|
53358
|
-
|
|
53205
|
+
get label() {
|
|
53206
|
+
return memo2(() => !!invalidated())() ? {
|
|
53207
|
+
confirm: t("overlay.ask.invalidatedAck"),
|
|
53208
|
+
cancel: t("overlay.ask.invalidatedAck")
|
|
53209
|
+
} : {
|
|
53210
|
+
confirm: t("overlay.ask.allow"),
|
|
53211
|
+
cancel: t("overlay.ask.reject")
|
|
53212
|
+
};
|
|
53359
53213
|
},
|
|
53360
|
-
|
|
53361
|
-
|
|
53362
|
-
|
|
53363
|
-
|
|
53364
|
-
|
|
53365
|
-
|
|
53366
|
-
|
|
53367
|
-
|
|
53368
|
-
|
|
53369
|
-
|
|
53370
|
-
|
|
53371
|
-
|
|
53372
|
-
return createComponent2(Context7.Provider, {
|
|
53373
|
-
value: api,
|
|
53374
|
-
get children() {
|
|
53375
|
-
return props.children;
|
|
53214
|
+
onConfirm: () => props.onVerdict("allowed-once"),
|
|
53215
|
+
onCancel: () => props.onVerdict("rejected"),
|
|
53216
|
+
get extraActions() {
|
|
53217
|
+
return memo2(() => !!(!invalidated() && props.escalation === true))() ? [{
|
|
53218
|
+
label: t("overlay.ask.allowAlways"),
|
|
53219
|
+
bind: "a",
|
|
53220
|
+
onTrigger: () => props.onVerdict("always")
|
|
53221
|
+
}, {
|
|
53222
|
+
label: t("overlay.ask.allowSession"),
|
|
53223
|
+
bind: "s",
|
|
53224
|
+
onTrigger: () => props.onVerdict("session")
|
|
53225
|
+
}] : undefined;
|
|
53376
53226
|
}
|
|
53377
53227
|
});
|
|
53378
53228
|
}
|
|
53379
|
-
function
|
|
53380
|
-
const value = useContext(Context7);
|
|
53381
|
-
if (!value)
|
|
53382
|
-
throw new Error("Dock.Provider is missing");
|
|
53383
|
-
return value;
|
|
53384
|
-
}
|
|
53385
|
-
function DockSeat(props) {
|
|
53386
|
-
const dock = useDock();
|
|
53387
|
-
const dimensions = useTerminalSize();
|
|
53229
|
+
function ReminderBadge() {
|
|
53388
53230
|
const theme = useThemeOptional();
|
|
53389
|
-
|
|
53390
|
-
|
|
53391
|
-
|
|
53392
|
-
|
|
53393
|
-
const
|
|
53394
|
-
|
|
53395
|
-
|
|
53396
|
-
|
|
53397
|
-
|
|
53398
|
-
|
|
53399
|
-
|
|
53400
|
-
dock.bindFocusTarget(undefined);
|
|
53401
|
-
});
|
|
53402
|
-
const capRows = () => Math.max(1, Math.floor(dimensions().height * DOCK_MAX_ROWS_RATIO));
|
|
53403
|
-
const contentRows = () => measured() ?? dock.current()?.options.contentRows ?? capRows();
|
|
53404
|
-
const overflows = () => contentRows() > capRows() && capRows() > 1;
|
|
53405
|
-
const viewportRows = () => Math.max(1, Math.min(contentRows(), capRows() - (overflows() ? 1 : 0)));
|
|
53406
|
-
const hiddenRows = () => Math.max(0, contentRows() - viewportRows());
|
|
53407
|
-
const indicatorText = () => {
|
|
53408
|
-
const label = dock.current()?.options.overflowLabel;
|
|
53409
|
-
return label ? label(hiddenRows()) : `\u2191\u2193 ${hiddenRows()}`;
|
|
53231
|
+
const [tick, setTick] = createSignal(0);
|
|
53232
|
+
const startedAt = Date.now();
|
|
53233
|
+
const pulsing = () => motionDecorationsEnabled() && Date.now() - startedAt < SKIN_PULSE_MS;
|
|
53234
|
+
onAnimationTick(() => pulsing() && motionAnimationRunning() ? motionFrameRate() : undefined, () => setTick((t) => t + 1));
|
|
53235
|
+
const fg = () => {
|
|
53236
|
+
tick();
|
|
53237
|
+
const target = warningColor(theme);
|
|
53238
|
+
if (!motionDecorationsEnabled())
|
|
53239
|
+
return target;
|
|
53240
|
+
const bright = skinPulseBrightness(Date.now() - startedAt);
|
|
53241
|
+
return bright >= 1 ? target : mixSkinColor(target, theme?.background.base ?? "#000000", 1 - bright);
|
|
53410
53242
|
};
|
|
53411
|
-
const muted = () => theme?.text.muted ?? "#9aa5ce";
|
|
53412
|
-
const background = () => theme?.background.base ?? "black";
|
|
53413
|
-
createEffect(on(() => dock.current()?.id, () => {
|
|
53414
|
-
if (scroll !== undefined && !scroll.isDestroyed)
|
|
53415
|
-
scroll.scrollTo(0);
|
|
53416
|
-
}, {
|
|
53417
|
-
defer: true
|
|
53418
|
-
}));
|
|
53419
|
-
createEffect(on(capRows, () => {
|
|
53420
|
-
if (scroll === undefined || scroll.isDestroyed)
|
|
53421
|
-
return;
|
|
53422
|
-
scroll.afterLayout(() => {
|
|
53423
|
-
if (scroll === undefined || scroll.isDestroyed)
|
|
53424
|
-
return;
|
|
53425
|
-
const max = Math.max(0, scroll.scrollHeight - scroll.viewport.height);
|
|
53426
|
-
if (scroll.scrollTop > max)
|
|
53427
|
-
scroll.scrollTo(max);
|
|
53428
|
-
});
|
|
53429
|
-
}, {
|
|
53430
|
-
defer: true
|
|
53431
|
-
}));
|
|
53432
53243
|
return (() => {
|
|
53433
|
-
var _el$ = createElement("
|
|
53434
|
-
insertNode(_el$,
|
|
53435
|
-
setProp(_el$, "width", "100%");
|
|
53244
|
+
var _el$ = createElement("text");
|
|
53245
|
+
insertNode(_el$, createTextNode(`\u26A0 `));
|
|
53436
53246
|
setProp(_el$, "flexShrink", 0);
|
|
53437
|
-
setProp(_el$, "
|
|
53438
|
-
|
|
53439
|
-
|
|
53440
|
-
|
|
53441
|
-
|
|
53442
|
-
|
|
53443
|
-
|
|
53444
|
-
|
|
53445
|
-
|
|
53446
|
-
|
|
53447
|
-
|
|
53448
|
-
|
|
53449
|
-
|
|
53450
|
-
|
|
53451
|
-
|
|
53452
|
-
|
|
53453
|
-
|
|
53454
|
-
|
|
53455
|
-
|
|
53456
|
-
|
|
53457
|
-
|
|
53458
|
-
|
|
53459
|
-
|
|
53460
|
-
|
|
53461
|
-
|
|
53462
|
-
|
|
53463
|
-
|
|
53464
|
-
|
|
53465
|
-
|
|
53466
|
-
|
|
53467
|
-
|
|
53468
|
-
|
|
53469
|
-
|
|
53470
|
-
|
|
53471
|
-
|
|
53472
|
-
|
|
53473
|
-
|
|
53474
|
-
|
|
53475
|
-
|
|
53476
|
-
|
|
53477
|
-
|
|
53478
|
-
|
|
53479
|
-
|
|
53480
|
-
|
|
53481
|
-
|
|
53482
|
-
|
|
53483
|
-
|
|
53484
|
-
|
|
53247
|
+
effect((_$p) => setProp(_el$, "fg", fg(), _$p));
|
|
53248
|
+
return _el$;
|
|
53249
|
+
})();
|
|
53250
|
+
}
|
|
53251
|
+
function TurnOverlayHost(props) {
|
|
53252
|
+
const dialog = useDialog();
|
|
53253
|
+
const dock = useDock();
|
|
53254
|
+
const pageOwns = useIsPageOwner();
|
|
53255
|
+
const [version, setVersion] = createSignal(0);
|
|
53256
|
+
onMount(() => {
|
|
53257
|
+
const unsubscribe = props.controller.subscribe(() => setVersion((value) => value + 1));
|
|
53258
|
+
onCleanup(unsubscribe);
|
|
53259
|
+
const timer = setInterval(() => props.controller.syncPendingAsks(), 200);
|
|
53260
|
+
onCleanup(() => clearInterval(timer));
|
|
53261
|
+
});
|
|
53262
|
+
props.controller.onIdle(() => {
|
|
53263
|
+
setTimeout(() => props.reclaimFocus?.(), 3);
|
|
53264
|
+
});
|
|
53265
|
+
let panelFocus;
|
|
53266
|
+
let askHandle;
|
|
53267
|
+
let askId;
|
|
53268
|
+
let shown;
|
|
53269
|
+
function closeAsk() {
|
|
53270
|
+
askHandle?.close();
|
|
53271
|
+
askHandle = undefined;
|
|
53272
|
+
askId = undefined;
|
|
53273
|
+
}
|
|
53274
|
+
createEffect(() => {
|
|
53275
|
+
version();
|
|
53276
|
+
const approval = props.controller.pendingApproval;
|
|
53277
|
+
const ask = props.controller.pendingAsk;
|
|
53278
|
+
const askShowing = askHandle !== undefined && ask !== undefined && askId === ask.id;
|
|
53279
|
+
const pageOwned = pageOwns();
|
|
53280
|
+
const approvalWins = approval !== undefined && !askShowing;
|
|
53281
|
+
const askAdmitted = ask !== undefined && (askShowing || pageOwned);
|
|
53282
|
+
const key = approvalWins ? `approval:${approval.id}` : askAdmitted ? `ask:${ask.id}` : "";
|
|
53283
|
+
if (key === shown)
|
|
53284
|
+
return;
|
|
53285
|
+
const previousKey = shown;
|
|
53286
|
+
shown = key;
|
|
53287
|
+
if (previousKey?.startsWith("approval:") === true && dialog.stack.at(-1)?.key === previousKey) {
|
|
53288
|
+
dialog.clear();
|
|
53289
|
+
}
|
|
53290
|
+
if (approvalWins) {
|
|
53291
|
+
closeAsk();
|
|
53292
|
+
const atOpen = key;
|
|
53293
|
+
const approvalId = approval.id;
|
|
53294
|
+
try {
|
|
53295
|
+
dialog.replace(() => createComponent2(ApprovalCard, {
|
|
53296
|
+
get name() {
|
|
53297
|
+
return approval.name;
|
|
53485
53298
|
},
|
|
53486
|
-
get
|
|
53487
|
-
|
|
53488
|
-
|
|
53489
|
-
|
|
53490
|
-
|
|
53491
|
-
|
|
53492
|
-
|
|
53299
|
+
get args() {
|
|
53300
|
+
return approval.args;
|
|
53301
|
+
},
|
|
53302
|
+
get escalation() {
|
|
53303
|
+
return approval.escalation;
|
|
53304
|
+
},
|
|
53305
|
+
get invalidatedReason() {
|
|
53306
|
+
return approval.invalidatedReason;
|
|
53307
|
+
},
|
|
53308
|
+
onVerdict: (verdict) => {
|
|
53309
|
+
switch (verdict) {
|
|
53310
|
+
case "allowed-once":
|
|
53311
|
+
props.controller.confirmApproval();
|
|
53312
|
+
break;
|
|
53313
|
+
case "always":
|
|
53314
|
+
props.controller.approveAlways();
|
|
53315
|
+
break;
|
|
53316
|
+
case "session":
|
|
53317
|
+
props.controller.approveSession();
|
|
53318
|
+
break;
|
|
53319
|
+
default:
|
|
53320
|
+
props.controller.rejectApproval();
|
|
53321
|
+
}
|
|
53322
|
+
}
|
|
53323
|
+
}), () => {
|
|
53324
|
+
if (shown === atOpen && props.controller.pendingApproval?.id === approvalId) {
|
|
53325
|
+
props.controller.rejectApproval();
|
|
53493
53326
|
}
|
|
53494
|
-
}), null);
|
|
53495
|
-
effect((_p$) => {
|
|
53496
|
-
var _v$ = background(), _v$2 = viewportRows();
|
|
53497
|
-
_v$ !== _p$.e && (_p$.e = setProp(_el$3, "backgroundColor", _v$, _p$.e));
|
|
53498
|
-
_v$2 !== _p$.t && (_p$.t = setProp(_el$4, "height", _v$2, _p$.t));
|
|
53499
|
-
return _p$;
|
|
53500
53327
|
}, {
|
|
53501
|
-
|
|
53502
|
-
|
|
53328
|
+
key,
|
|
53329
|
+
tone: "warning"
|
|
53503
53330
|
});
|
|
53504
|
-
|
|
53505
|
-
|
|
53506
|
-
|
|
53507
|
-
|
|
53508
|
-
|
|
53509
|
-
|
|
53331
|
+
} catch {
|
|
53332
|
+
props.controller.rejectApproval();
|
|
53333
|
+
}
|
|
53334
|
+
return;
|
|
53335
|
+
}
|
|
53336
|
+
if (ask !== undefined && askAdmitted) {
|
|
53337
|
+
if (askHandle !== undefined && askId === ask.id)
|
|
53338
|
+
return;
|
|
53339
|
+
const previous = askHandle;
|
|
53340
|
+
askId = ask.id;
|
|
53341
|
+
askHandle = dock.open((ctx) => createComponent2(AskPanel, {
|
|
53342
|
+
get controller() {
|
|
53343
|
+
return props.controller;
|
|
53344
|
+
},
|
|
53345
|
+
get width() {
|
|
53346
|
+
return ctx.width;
|
|
53347
|
+
},
|
|
53348
|
+
queued: () => Math.max(0, props.controller.pendingAskCount + props.controller.pendingApprovalCount - 1),
|
|
53349
|
+
onFocusTarget: (resolve) => {
|
|
53350
|
+
panelFocus = resolve;
|
|
53351
|
+
}
|
|
53352
|
+
}), {
|
|
53353
|
+
kind: "ask",
|
|
53354
|
+
contentRows: estimateAskRows(ask),
|
|
53355
|
+
focusRef: () => panelFocus?.(),
|
|
53356
|
+
overflowLabel: (hidden) => t("overlay.ask.overflow", {
|
|
53357
|
+
count: hidden
|
|
53358
|
+
})
|
|
53359
|
+
});
|
|
53360
|
+
previous?.close();
|
|
53361
|
+
return;
|
|
53362
|
+
}
|
|
53363
|
+
closeAsk();
|
|
53364
|
+
});
|
|
53365
|
+
onCleanup(closeAsk);
|
|
53366
|
+
return createComponent2(Show, {
|
|
53367
|
+
when: false,
|
|
53368
|
+
children: null
|
|
53369
|
+
});
|
|
53510
53370
|
}
|
|
53511
|
-
|
|
53512
|
-
|
|
53513
|
-
|
|
53371
|
+
function registerTurnOverlays(seam, controller, options) {
|
|
53372
|
+
if (typeof seam.pendingAsks === "function") {
|
|
53373
|
+
const read = seam.pendingAsks.bind(seam);
|
|
53374
|
+
controller.attachPendingAsks(() => read() ?? []);
|
|
53375
|
+
}
|
|
53376
|
+
if (typeof seam.onSessionEvent === "function") {
|
|
53377
|
+
seam.onSessionEvent((event) => {
|
|
53378
|
+
if (event.type === "bridge.dead") {
|
|
53379
|
+
const configured = options?.deadReason;
|
|
53380
|
+
if (configured === undefined)
|
|
53381
|
+
return;
|
|
53382
|
+
const reason = typeof configured === "function" ? configured(event.details) : configured;
|
|
53383
|
+
if (reason !== "")
|
|
53384
|
+
controller.invalidateAll(reason);
|
|
53385
|
+
return;
|
|
53386
|
+
}
|
|
53387
|
+
if (event.type !== "bridge.ask.invalidated")
|
|
53388
|
+
return;
|
|
53389
|
+
const details = event.details;
|
|
53390
|
+
if (typeof details?.eventId !== "string")
|
|
53391
|
+
return;
|
|
53392
|
+
controller.invalidateAsk(details.eventId, typeof details.reason === "string" ? details.reason : "");
|
|
53393
|
+
});
|
|
53394
|
+
}
|
|
53395
|
+
seam.registerAskProvider((questions) => controller.answer(questions));
|
|
53396
|
+
}
|
|
53397
|
+
var init_turn_overlays = __esm(() => {
|
|
53514
53398
|
init_index_bun();
|
|
53515
53399
|
init_index_bun();
|
|
53516
53400
|
init_index_bun();
|
|
@@ -53520,847 +53404,995 @@ var init_dock_host = __esm(() => {
|
|
|
53520
53404
|
init_index_bun();
|
|
53521
53405
|
init_server();
|
|
53522
53406
|
init_index_bun();
|
|
53407
|
+
init_dialog_confirm();
|
|
53408
|
+
init_dialog();
|
|
53523
53409
|
init_input_ownership();
|
|
53524
53410
|
init_theme3();
|
|
53525
|
-
|
|
53526
|
-
|
|
53411
|
+
init_i18n();
|
|
53412
|
+
init_motion();
|
|
53413
|
+
init_semantic();
|
|
53414
|
+
init_widgets_dock();
|
|
53415
|
+
init_ask_panel();
|
|
53416
|
+
init_ask_options();
|
|
53417
|
+
init_dock_host();
|
|
53527
53418
|
});
|
|
53528
53419
|
|
|
53529
|
-
// ../tui-base/src/
|
|
53530
|
-
|
|
53531
|
-
|
|
53532
|
-
|
|
53533
|
-
|
|
53534
|
-
|
|
53535
|
-
|
|
53536
|
-
|
|
53537
|
-
|
|
53538
|
-
let current = node;
|
|
53539
|
-
while (current !== null && current !== undefined) {
|
|
53540
|
-
const candidate = current;
|
|
53541
|
-
if (typeof candidate.scrollChildIntoView === "function")
|
|
53542
|
-
return current;
|
|
53543
|
-
current = current.parent;
|
|
53544
|
-
}
|
|
53545
|
-
return;
|
|
53546
|
-
}
|
|
53547
|
-
function AskPanel(props) {
|
|
53548
|
-
const theme = useThemeOptional();
|
|
53549
|
-
const dock = useDock();
|
|
53550
|
-
let configCursorStyle;
|
|
53551
|
-
try {
|
|
53552
|
-
configCursorStyle = useCursorStyle();
|
|
53553
|
-
} catch {
|
|
53554
|
-
configCursorStyle = undefined;
|
|
53555
|
-
}
|
|
53556
|
-
const [version, setVersion] = createSignal(0);
|
|
53557
|
-
onMount(() => {
|
|
53558
|
-
const unsubscribe = props.controller.subscribe(() => setVersion((value) => value + 1));
|
|
53559
|
-
onCleanup(unsubscribe);
|
|
53560
|
-
});
|
|
53561
|
-
const ask = () => {
|
|
53562
|
-
version();
|
|
53563
|
-
return props.controller.pendingAsk;
|
|
53564
|
-
};
|
|
53565
|
-
const questions = () => ask()?.questions ?? [];
|
|
53566
|
-
const question = () => {
|
|
53567
|
-
const batch = ask();
|
|
53568
|
-
return batch?.questions[batch.index];
|
|
53569
|
-
};
|
|
53570
|
-
const index = () => ask()?.index ?? 0;
|
|
53571
|
-
const phase = () => ask()?.phase ?? "questions";
|
|
53572
|
-
const phaseOf = () => {
|
|
53573
|
-
if (phase() === "review")
|
|
53574
|
-
return "review";
|
|
53575
|
-
return phase() === "input" ? "input" : "options";
|
|
53576
|
-
};
|
|
53577
|
-
const picks = () => {
|
|
53578
|
-
const batch = ask();
|
|
53579
|
-
return batch ? batch.picks[batch.index] ?? [] : [];
|
|
53580
|
-
};
|
|
53581
|
-
const cursor = () => {
|
|
53582
|
-
const batch = ask();
|
|
53583
|
-
return batch ? batch.cursors[batch.index] ?? 0 : 0;
|
|
53584
|
-
};
|
|
53585
|
-
const listCursor = () => {
|
|
53586
|
-
const batch = ask();
|
|
53587
|
-
return batch ? batch.listCursors[batch.index] ?? 0 : 0;
|
|
53588
|
-
};
|
|
53589
|
-
const markedRow = () => phaseOf() === "input" ? listCursor() : cursor();
|
|
53590
|
-
const reviewCursor = () => ask()?.reviewCursor ?? 0;
|
|
53591
|
-
const multi = () => question()?.multiSelect === true;
|
|
53592
|
-
const compact = () => props.width() < ASK_COMPACT_COLUMNS;
|
|
53593
|
-
const needsReview = () => askNeedsReview(questions());
|
|
53594
|
-
const eyebrow = () => {
|
|
53595
|
-
if (phaseOf() === "review")
|
|
53596
|
-
return;
|
|
53597
|
-
const current = question();
|
|
53598
|
-
if (current?.header === undefined || current.header === current.prompt)
|
|
53599
|
-
return;
|
|
53600
|
-
return current.header;
|
|
53601
|
-
};
|
|
53602
|
-
const muted = () => theme?.text.muted ?? "#9aa5ce";
|
|
53603
|
-
const faint = () => theme?.text.faint ?? "#565f89";
|
|
53604
|
-
const base = () => theme?.text.base ?? "#e6e6e6";
|
|
53605
|
-
const accent = () => theme?.hue.interactive[500] ?? "#7aa2f7";
|
|
53606
|
-
const currentBg = () => theme?.background.action.primary.focused;
|
|
53607
|
-
const currentFg = () => theme?.text.action.primary.focused ?? accent();
|
|
53608
|
-
const rule = () => theme?.border.base ?? "#565f89";
|
|
53609
|
-
const cursorShape = () => {
|
|
53610
|
-
try {
|
|
53611
|
-
return configCursorStyle?.()?.style;
|
|
53612
|
-
} catch {
|
|
53613
|
-
return;
|
|
53614
|
-
}
|
|
53615
|
-
};
|
|
53616
|
-
let listEl;
|
|
53617
|
-
let inputEl;
|
|
53618
|
-
let inlineRowEl;
|
|
53619
|
-
useAskKeys({
|
|
53620
|
-
controller: props.controller,
|
|
53621
|
-
input: () => inputEl
|
|
53420
|
+
// ../tui-base/src/ui/dialog-confirm.tsx
|
|
53421
|
+
import { TextAttributes as TextAttributes7 } from "@opentui/core";
|
|
53422
|
+
function DialogConfirm(props) {
|
|
53423
|
+
const dialog = useDialog();
|
|
53424
|
+
const theme = useTheme().surface("dialog");
|
|
53425
|
+
const newDesigns = useNewDesigns();
|
|
53426
|
+
const row = () => currentRowColors(theme);
|
|
53427
|
+
const [store, setStore] = createStore({
|
|
53428
|
+
active: "confirm"
|
|
53622
53429
|
});
|
|
53623
|
-
const
|
|
53624
|
-
|
|
53625
|
-
|
|
53626
|
-
|
|
53627
|
-
|
|
53628
|
-
|
|
53629
|
-
if (row === undefined || row.isDestroyed)
|
|
53630
|
-
return;
|
|
53631
|
-
const scroller = nearestScroller(row);
|
|
53632
|
-
if (scroller === undefined)
|
|
53633
|
-
return;
|
|
53634
|
-
scroller.scrollChildIntoView(row, {
|
|
53635
|
-
align: "nearest"
|
|
53636
|
-
});
|
|
53637
|
-
}
|
|
53638
|
-
function focusInputRow() {
|
|
53639
|
-
const input = inputEl;
|
|
53640
|
-
if (input === undefined || input.isDestroyed)
|
|
53641
|
-
return;
|
|
53642
|
-
input.focus();
|
|
53643
|
-
revealRow(inlineRowEl);
|
|
53644
|
-
}
|
|
53645
|
-
createEffect(on(() => phase(), (next) => {
|
|
53646
|
-
if (next === "input") {
|
|
53647
|
-
focusInputRow();
|
|
53648
|
-
return;
|
|
53649
|
-
}
|
|
53650
|
-
if (next !== "questions")
|
|
53651
|
-
return;
|
|
53652
|
-
const focusList = () => {
|
|
53653
|
-
if (listEl !== undefined && !listEl.isDestroyed)
|
|
53654
|
-
listEl.focus();
|
|
53655
|
-
};
|
|
53656
|
-
if (listEl !== undefined && !listEl.isDestroyed)
|
|
53657
|
-
focusList();
|
|
53658
|
-
else
|
|
53659
|
-
queueMicrotask(focusList);
|
|
53660
|
-
}));
|
|
53661
|
-
createEffect(on(() => index(), () => phase() === "input" ? focusInputRow() : undefined, {
|
|
53662
|
-
defer: true
|
|
53663
|
-
}));
|
|
53664
|
-
createEffect(on([() => index(), cursor], () => {
|
|
53665
|
-
if (phaseOf() !== "options")
|
|
53666
|
-
return;
|
|
53667
|
-
revealRow(listEl?.getChildren()[cursor()]);
|
|
53668
|
-
}));
|
|
53669
|
-
const optionRows = () => (question()?.options ?? []).map((option, position) => ({
|
|
53670
|
-
option,
|
|
53671
|
-
number: position + 1,
|
|
53672
|
-
selected: picks().includes(option.label)
|
|
53673
|
-
}));
|
|
53674
|
-
const labelColumn = (row) => GUTTER + CURSOR_CELLS + STATE_CELLS + `${row.number}. `.length;
|
|
53675
|
-
const footerHint = () => {
|
|
53676
|
-
if (phaseOf() === "review")
|
|
53677
|
-
return t("overlay.ask.footer.review", {
|
|
53678
|
-
esc: t("overlay.ask.esc.review")
|
|
53679
|
-
});
|
|
53680
|
-
if (phaseOf() === "input") {
|
|
53681
|
-
const escKey = question()?.options.length === 0 ? index() > 0 ? "overlay.ask.esc.prevQuestion" : "overlay.ask.esc.decline" : "overlay.ask.esc.back";
|
|
53682
|
-
return t("overlay.ask.footer.input", {
|
|
53683
|
-
esc: t(escKey)
|
|
53684
|
-
});
|
|
53685
|
-
}
|
|
53686
|
-
const escKey = questions().length > 1 && index() > 0 ? "overlay.ask.esc.prevQuestion" : "overlay.ask.esc.decline";
|
|
53687
|
-
return t(multi() ? "overlay.ask.footer.multi" : "overlay.ask.footer.options", {
|
|
53688
|
-
esc: t(escKey)
|
|
53689
|
-
});
|
|
53430
|
+
const choose = (key) => {
|
|
53431
|
+
if (key === "confirm")
|
|
53432
|
+
props.onConfirm?.();
|
|
53433
|
+
if (key === "cancel")
|
|
53434
|
+
props.onCancel?.();
|
|
53435
|
+
dialog.clear();
|
|
53690
53436
|
};
|
|
53691
|
-
const
|
|
53692
|
-
|
|
53693
|
-
|
|
53694
|
-
return "";
|
|
53695
|
-
const custom = batch.customs[qi];
|
|
53696
|
-
if (custom !== undefined && custom !== "")
|
|
53697
|
-
return custom;
|
|
53698
|
-
return (batch.picks[qi] ?? []).map((label) => splitRecommended(label).label).join(", ");
|
|
53437
|
+
const chooseExtra = (action) => {
|
|
53438
|
+
action.onTrigger();
|
|
53439
|
+
dialog.clear();
|
|
53699
53440
|
};
|
|
53700
|
-
|
|
53701
|
-
|
|
53702
|
-
|
|
53703
|
-
|
|
53704
|
-
|
|
53705
|
-
|
|
53706
|
-
|
|
53707
|
-
|
|
53708
|
-
|
|
53709
|
-
|
|
53710
|
-
|
|
53711
|
-
|
|
53712
|
-
|
|
53713
|
-
|
|
53714
|
-
|
|
53715
|
-
|
|
53716
|
-
|
|
53717
|
-
|
|
53718
|
-
},
|
|
53719
|
-
children: (header) => (() => {
|
|
53720
|
-
var _el$13 = createElement("box"), _el$14 = createElement("text");
|
|
53721
|
-
insertNode(_el$13, _el$14);
|
|
53722
|
-
setProp(_el$13, "paddingLeft", 2);
|
|
53723
|
-
setProp(_el$13, "paddingRight", 2);
|
|
53724
|
-
setProp(_el$14, "wrapMode", "none");
|
|
53725
|
-
insert(_el$14, header);
|
|
53726
|
-
effect((_$p) => setProp(_el$14, "fg", muted(), _$p));
|
|
53727
|
-
return _el$13;
|
|
53728
|
-
})()
|
|
53729
|
-
}), _el$3);
|
|
53730
|
-
insertNode(_el$3, _el$4);
|
|
53731
|
-
setProp(_el$3, "paddingLeft", 2);
|
|
53732
|
-
setProp(_el$3, "paddingRight", 2);
|
|
53733
|
-
setProp(_el$4, "wrapMode", "word");
|
|
53734
|
-
insert(_el$4, (() => {
|
|
53735
|
-
var _c$ = memo2(() => phaseOf() === "review");
|
|
53736
|
-
return () => _c$() ? t("overlay.ask.reviewTitle") : question()?.prompt ?? "";
|
|
53737
|
-
})());
|
|
53738
|
-
insert(_el$, createComponent2(Show, {
|
|
53739
|
-
get when() {
|
|
53740
|
-
return questions().length >= 2;
|
|
53441
|
+
Keymap2.createLayer(() => ({
|
|
53442
|
+
mode: "modal",
|
|
53443
|
+
commands: [...newDesigns() ? [{
|
|
53444
|
+
bind: "return",
|
|
53445
|
+
title: "Confirm",
|
|
53446
|
+
group: "Dialog",
|
|
53447
|
+
run: () => choose("confirm")
|
|
53448
|
+
}, {
|
|
53449
|
+
bind: "escape",
|
|
53450
|
+
title: "Cancel",
|
|
53451
|
+
group: "Dialog",
|
|
53452
|
+
run: () => choose("cancel")
|
|
53453
|
+
}] : [
|
|
53454
|
+
{
|
|
53455
|
+
bind: "return",
|
|
53456
|
+
title: "Confirm dialog selection",
|
|
53457
|
+
group: "Dialog",
|
|
53458
|
+
run: () => choose(store.active)
|
|
53741
53459
|
},
|
|
53742
|
-
|
|
53743
|
-
|
|
53744
|
-
|
|
53745
|
-
|
|
53746
|
-
|
|
53747
|
-
|
|
53748
|
-
|
|
53749
|
-
effect((_$p) => setProp(_el$6, "fg", muted(), _$p));
|
|
53750
|
-
return _el$5;
|
|
53751
|
-
}
|
|
53752
|
-
}), _el$1);
|
|
53753
|
-
insert(_el$, createComponent2(Show, {
|
|
53754
|
-
get when() {
|
|
53755
|
-
return memo2(() => phaseOf() !== "review")() ? question()?.detail : undefined;
|
|
53460
|
+
{
|
|
53461
|
+
bind: "left",
|
|
53462
|
+
title: "Previous dialog option",
|
|
53463
|
+
group: "Dialog",
|
|
53464
|
+
run: () => {
|
|
53465
|
+
setStore("active", store.active === "confirm" ? "cancel" : "confirm");
|
|
53466
|
+
}
|
|
53756
53467
|
},
|
|
53757
|
-
|
|
53758
|
-
|
|
53759
|
-
|
|
53760
|
-
|
|
53761
|
-
|
|
53762
|
-
|
|
53763
|
-
|
|
53764
|
-
effect((_$p) => setProp(_el$16, "fg", muted(), _$p));
|
|
53765
|
-
return _el$15;
|
|
53766
|
-
})()
|
|
53767
|
-
}), _el$1);
|
|
53768
|
-
insert(_el$, createComponent2(Show, {
|
|
53769
|
-
get when() {
|
|
53770
|
-
return phaseOf() === "review";
|
|
53468
|
+
{
|
|
53469
|
+
bind: "right",
|
|
53470
|
+
title: "Next dialog option",
|
|
53471
|
+
group: "Dialog",
|
|
53472
|
+
run: () => {
|
|
53473
|
+
setStore("active", store.active === "confirm" ? "cancel" : "confirm");
|
|
53474
|
+
}
|
|
53771
53475
|
},
|
|
53772
|
-
|
|
53773
|
-
|
|
53774
|
-
|
|
53775
|
-
|
|
53776
|
-
|
|
53777
|
-
|
|
53778
|
-
|
|
53779
|
-
setProp(_el$17, "width", "100%");
|
|
53780
|
-
setProp(_el$17, "flexShrink", 0);
|
|
53781
|
-
setProp(_el$17, "focusable", true);
|
|
53782
|
-
insert(_el$17, createComponent2(Index, {
|
|
53783
|
-
get each() {
|
|
53784
|
-
return optionRows();
|
|
53785
|
-
},
|
|
53786
|
-
children: (row, position) => createComponent2(OptionRow, {
|
|
53787
|
-
row,
|
|
53788
|
-
cursor: () => phaseOf() !== "input" && position === cursor(),
|
|
53789
|
-
marked: () => position === markedRow(),
|
|
53790
|
-
multi: () => multi(),
|
|
53791
|
-
compact: () => compact(),
|
|
53792
|
-
width: () => props.width(),
|
|
53793
|
-
labelColumn: () => labelColumn(row())
|
|
53794
|
-
})
|
|
53795
|
-
}), null);
|
|
53796
|
-
insert(_el$17, createComponent2(Show, {
|
|
53797
|
-
get when() {
|
|
53798
|
-
return memo2(() => question() !== undefined)() && hasReviewRow(question(), needsReview());
|
|
53799
|
-
},
|
|
53800
|
-
get children() {
|
|
53801
|
-
var _el$18 = createElement("box"), _el$19 = createElement("text"), _el$20 = createElement("text");
|
|
53802
|
-
insertNode(_el$18, _el$19);
|
|
53803
|
-
insertNode(_el$18, _el$20);
|
|
53804
|
-
setProp(_el$18, "flexDirection", "row");
|
|
53805
|
-
setProp(_el$18, "width", "100%");
|
|
53806
|
-
setProp(_el$18, "flexShrink", 0);
|
|
53807
|
-
setProp(_el$18, "paddingLeft", 2);
|
|
53808
|
-
insert(_el$19, () => markedRow() === (question()?.options.length ?? 0) ? "\u203A " : " ");
|
|
53809
|
-
setProp(_el$20, "wrapMode", "word");
|
|
53810
|
-
insert(_el$20, () => t("overlay.ask.reviewRow"));
|
|
53811
|
-
effect((_p$) => {
|
|
53812
|
-
var _v$8 = phaseOf() !== "input" && markedRow() === (question()?.options.length ?? 0) ? currentBg() : undefined, _v$9 = phaseOf() !== "input" && markedRow() === (question()?.options.length ?? 0) ? accent() : faint(), _v$0 = phaseOf() !== "input" && markedRow() === (question()?.options.length ?? 0) ? currentFg() : muted();
|
|
53813
|
-
_v$8 !== _p$.e && (_p$.e = setProp(_el$18, "backgroundColor", _v$8, _p$.e));
|
|
53814
|
-
_v$9 !== _p$.t && (_p$.t = setProp(_el$19, "fg", _v$9, _p$.t));
|
|
53815
|
-
_v$0 !== _p$.a && (_p$.a = setProp(_el$20, "fg", _v$0, _p$.a));
|
|
53816
|
-
return _p$;
|
|
53817
|
-
}, {
|
|
53818
|
-
e: undefined,
|
|
53819
|
-
t: undefined,
|
|
53820
|
-
a: undefined
|
|
53821
|
-
});
|
|
53822
|
-
return _el$18;
|
|
53823
|
-
}
|
|
53824
|
-
}), null);
|
|
53825
|
-
return _el$17;
|
|
53826
|
-
})(), (() => {
|
|
53827
|
-
var _el$21 = createElement("box"), _el$22 = createElement("text"), _el$24 = createElement("input");
|
|
53828
|
-
insertNode(_el$21, _el$22);
|
|
53829
|
-
insertNode(_el$21, _el$24);
|
|
53830
|
-
use((value) => {
|
|
53831
|
-
inlineRowEl = value;
|
|
53832
|
-
}, _el$21);
|
|
53833
|
-
setProp(_el$21, "flexDirection", "row");
|
|
53834
|
-
setProp(_el$21, "width", "100%");
|
|
53835
|
-
setProp(_el$21, "flexShrink", 0);
|
|
53836
|
-
setProp(_el$21, "paddingLeft", 2);
|
|
53837
|
-
insertNode(_el$22, createTextNode(`\u270E `));
|
|
53838
|
-
use((value) => {
|
|
53839
|
-
inputEl = value;
|
|
53840
|
-
}, _el$24);
|
|
53841
|
-
setProp(_el$24, "flexGrow", 1);
|
|
53842
|
-
setProp(_el$24, "onInput", (value) => props.controller.setInlineText(value));
|
|
53843
|
-
setProp(_el$24, "onSubmit", () => props.controller.commitCustom());
|
|
53844
|
-
effect((_p$) => {
|
|
53845
|
-
var _v$1 = phaseOf() === "input" ? currentBg() : undefined, _v$10 = phaseOf() === "input" ? currentFg() : muted(), _v$11 = props.controller.inlineText, _v$12 = t("overlay.ask.inputPlaceholder"), _v$13 = muted(), _v$14 = base(), _v$15 = currentFg(), _v$16 = phaseOf() === "input" ? currentFg() : accent(), _v$17 = cursorShape();
|
|
53846
|
-
_v$1 !== _p$.e && (_p$.e = setProp(_el$21, "backgroundColor", _v$1, _p$.e));
|
|
53847
|
-
_v$10 !== _p$.t && (_p$.t = setProp(_el$22, "fg", _v$10, _p$.t));
|
|
53848
|
-
_v$11 !== _p$.a && (_p$.a = setProp(_el$24, "value", _v$11, _p$.a));
|
|
53849
|
-
_v$12 !== _p$.o && (_p$.o = setProp(_el$24, "placeholder", _v$12, _p$.o));
|
|
53850
|
-
_v$13 !== _p$.i && (_p$.i = setProp(_el$24, "placeholderColor", _v$13, _p$.i));
|
|
53851
|
-
_v$14 !== _p$.n && (_p$.n = setProp(_el$24, "textColor", _v$14, _p$.n));
|
|
53852
|
-
_v$15 !== _p$.s && (_p$.s = setProp(_el$24, "focusedTextColor", _v$15, _p$.s));
|
|
53853
|
-
_v$16 !== _p$.h && (_p$.h = setProp(_el$24, "cursorColor", _v$16, _p$.h));
|
|
53854
|
-
_v$17 !== _p$.r && (_p$.r = setProp(_el$24, "cursorStyle", _v$17, _p$.r));
|
|
53855
|
-
return _p$;
|
|
53856
|
-
}, {
|
|
53857
|
-
e: undefined,
|
|
53858
|
-
t: undefined,
|
|
53859
|
-
a: undefined,
|
|
53860
|
-
o: undefined,
|
|
53861
|
-
i: undefined,
|
|
53862
|
-
n: undefined,
|
|
53863
|
-
s: undefined,
|
|
53864
|
-
h: undefined,
|
|
53865
|
-
r: undefined
|
|
53866
|
-
});
|
|
53867
|
-
return _el$21;
|
|
53868
|
-
})()];
|
|
53476
|
+
{
|
|
53477
|
+
bind: "tab",
|
|
53478
|
+
title: "Next dialog option",
|
|
53479
|
+
group: "Dialog",
|
|
53480
|
+
run: () => {
|
|
53481
|
+
setStore("active", store.active === "confirm" ? "cancel" : "confirm");
|
|
53482
|
+
}
|
|
53869
53483
|
},
|
|
53870
|
-
|
|
53871
|
-
|
|
53872
|
-
|
|
53873
|
-
|
|
53874
|
-
|
|
53875
|
-
|
|
53876
|
-
|
|
53484
|
+
{
|
|
53485
|
+
bind: "shift+tab",
|
|
53486
|
+
title: "Previous dialog option",
|
|
53487
|
+
group: "Dialog",
|
|
53488
|
+
run: () => {
|
|
53489
|
+
setStore("active", store.active === "confirm" ? "cancel" : "confirm");
|
|
53490
|
+
}
|
|
53491
|
+
}
|
|
53492
|
+
], ...(props.extraActions ?? []).map((action) => ({
|
|
53493
|
+
bind: action.bind,
|
|
53494
|
+
title: action.title ?? action.label,
|
|
53495
|
+
group: "Dialog",
|
|
53496
|
+
run: () => chooseExtra(action)
|
|
53497
|
+
}))]
|
|
53498
|
+
}));
|
|
53499
|
+
return createComponent2(DialogLayout, {
|
|
53500
|
+
get header() {
|
|
53501
|
+
return createComponent2(DialogHeader, {
|
|
53502
|
+
get title() {
|
|
53503
|
+
return props.title;
|
|
53504
|
+
},
|
|
53505
|
+
get titleView() {
|
|
53506
|
+
return (() => {
|
|
53507
|
+
var _el$2 = createElement("box"), _el$3 = createElement("text");
|
|
53508
|
+
insertNode(_el$2, _el$3);
|
|
53509
|
+
setProp(_el$2, "flexDirection", "row");
|
|
53510
|
+
insert(_el$2, createComponent2(ReminderBadge, {}), _el$3);
|
|
53511
|
+
setProp(_el$3, "wrapMode", "none");
|
|
53512
|
+
insert(_el$3, () => props.title.replace(/^\u26A0\s*/, ""));
|
|
53513
|
+
effect((_p$) => {
|
|
53514
|
+
var _v$ = newDesigns() ? undefined : TextAttributes7.BOLD, _v$2 = theme.text.base;
|
|
53515
|
+
_v$ !== _p$.e && (_p$.e = setProp(_el$3, "attributes", _v$, _p$.e));
|
|
53516
|
+
_v$2 !== _p$.t && (_p$.t = setProp(_el$3, "fg", _v$2, _p$.t));
|
|
53517
|
+
return _p$;
|
|
53518
|
+
}, {
|
|
53519
|
+
e: undefined,
|
|
53520
|
+
t: undefined
|
|
53521
|
+
});
|
|
53522
|
+
return _el$2;
|
|
53523
|
+
})();
|
|
53524
|
+
}
|
|
53525
|
+
});
|
|
53526
|
+
},
|
|
53527
|
+
get footer() {
|
|
53528
|
+
return {
|
|
53529
|
+
actions: {
|
|
53530
|
+
secondary: (props.extraActions ?? []).map((action) => ({
|
|
53531
|
+
title: action.label.toLowerCase(),
|
|
53532
|
+
key: action.bind,
|
|
53533
|
+
onTrigger: () => chooseExtra(action)
|
|
53534
|
+
})),
|
|
53535
|
+
primary: [
|
|
53536
|
+
{
|
|
53537
|
+
title: (props.label?.cancel ?? "cancel").toLowerCase(),
|
|
53538
|
+
key: "esc",
|
|
53539
|
+
onTrigger: () => choose("cancel")
|
|
53540
|
+
},
|
|
53541
|
+
{
|
|
53542
|
+
title: (props.label?.confirm ?? "confirm").toLowerCase(),
|
|
53543
|
+
key: "enter",
|
|
53544
|
+
onTrigger: () => choose("confirm")
|
|
53545
|
+
}
|
|
53546
|
+
]
|
|
53547
|
+
}
|
|
53548
|
+
};
|
|
53549
|
+
},
|
|
53550
|
+
get legacyFooter() {
|
|
53551
|
+
return (() => {
|
|
53552
|
+
var _el$4 = createElement("box"), _el$5 = createElement("box"), _el$6 = createElement("box");
|
|
53553
|
+
insertNode(_el$4, _el$5);
|
|
53554
|
+
insertNode(_el$4, _el$6);
|
|
53555
|
+
setProp(_el$4, "flexDirection", "row");
|
|
53556
|
+
setProp(_el$4, "justifyContent", "space-between");
|
|
53557
|
+
setProp(_el$4, "gap", 1);
|
|
53558
|
+
setProp(_el$5, "flexDirection", "row");
|
|
53559
|
+
insert(_el$5, createComponent2(For, {
|
|
53877
53560
|
get each() {
|
|
53878
|
-
return
|
|
53561
|
+
return props.extraActions ?? [];
|
|
53879
53562
|
},
|
|
53880
|
-
children: (
|
|
53881
|
-
var _el$
|
|
53882
|
-
insertNode(_el$
|
|
53883
|
-
|
|
53884
|
-
setProp(_el$
|
|
53885
|
-
setProp(_el$
|
|
53886
|
-
|
|
53887
|
-
|
|
53888
|
-
|
|
53889
|
-
|
|
53890
|
-
|
|
53891
|
-
|
|
53892
|
-
|
|
53893
|
-
|
|
53894
|
-
|
|
53895
|
-
|
|
53896
|
-
|
|
53897
|
-
|
|
53898
|
-
|
|
53899
|
-
setProp(_el$
|
|
53900
|
-
|
|
53901
|
-
insert(_el$32, () => `\u2192 ${answerText(qi) !== "" ? answerText(qi) : t("overlay.ask.unanswered")}`);
|
|
53563
|
+
children: (action) => (() => {
|
|
53564
|
+
var _el$7 = createElement("box"), _el$8 = createElement("text");
|
|
53565
|
+
insertNode(_el$7, _el$8);
|
|
53566
|
+
setProp(_el$7, "paddingLeft", 1);
|
|
53567
|
+
setProp(_el$7, "paddingRight", 1);
|
|
53568
|
+
setProp(_el$7, "onMouseUp", () => chooseExtra(action));
|
|
53569
|
+
insert(_el$8, () => `${action.label} [${action.bind}]`);
|
|
53570
|
+
effect((_$p) => setProp(_el$8, "fg", theme.text.muted, _$p));
|
|
53571
|
+
return _el$7;
|
|
53572
|
+
})()
|
|
53573
|
+
}));
|
|
53574
|
+
setProp(_el$6, "flexDirection", "row");
|
|
53575
|
+
insert(_el$6, createComponent2(For, {
|
|
53576
|
+
each: ["cancel", "confirm"],
|
|
53577
|
+
children: (key) => (() => {
|
|
53578
|
+
var _el$9 = createElement("box"), _el$0 = createElement("text");
|
|
53579
|
+
insertNode(_el$9, _el$0);
|
|
53580
|
+
setProp(_el$9, "paddingLeft", 1);
|
|
53581
|
+
setProp(_el$9, "paddingRight", 1);
|
|
53582
|
+
setProp(_el$9, "onMouseUp", () => choose(key));
|
|
53583
|
+
insert(_el$0, () => titlecase(props.label?.[key] ?? key));
|
|
53902
53584
|
effect((_p$) => {
|
|
53903
|
-
var _v$
|
|
53904
|
-
_v$
|
|
53905
|
-
_v$
|
|
53906
|
-
_v$20 !== _p$.a && (_p$.a = setProp(_el$28, "fg", _v$20, _p$.a));
|
|
53907
|
-
_v$21 !== _p$.o && (_p$.o = setProp(_el$30, "fg", _v$21, _p$.o));
|
|
53908
|
-
_v$22 !== _p$.i && (_p$.i = setProp(_el$32, "fg", _v$22, _p$.i));
|
|
53585
|
+
var _v$3 = key === store.active ? row().backgroundColor : undefined, _v$4 = key === store.active ? row().textColor : theme.text.muted;
|
|
53586
|
+
_v$3 !== _p$.e && (_p$.e = setProp(_el$9, "backgroundColor", _v$3, _p$.e));
|
|
53587
|
+
_v$4 !== _p$.t && (_p$.t = setProp(_el$0, "fg", _v$4, _p$.t));
|
|
53909
53588
|
return _p$;
|
|
53910
53589
|
}, {
|
|
53911
53590
|
e: undefined,
|
|
53912
|
-
t: undefined
|
|
53913
|
-
a: undefined,
|
|
53914
|
-
o: undefined,
|
|
53915
|
-
i: undefined
|
|
53591
|
+
t: undefined
|
|
53916
53592
|
});
|
|
53917
|
-
return _el$
|
|
53593
|
+
return _el$9;
|
|
53918
53594
|
})()
|
|
53919
|
-
})
|
|
53920
|
-
|
|
53921
|
-
|
|
53922
|
-
|
|
53923
|
-
|
|
53924
|
-
|
|
53925
|
-
|
|
53926
|
-
|
|
53927
|
-
|
|
53928
|
-
|
|
53929
|
-
|
|
53930
|
-
|
|
53931
|
-
|
|
53932
|
-
|
|
53933
|
-
|
|
53934
|
-
|
|
53935
|
-
|
|
53936
|
-
|
|
53937
|
-
|
|
53938
|
-
|
|
53939
|
-
|
|
53940
|
-
|
|
53595
|
+
}));
|
|
53596
|
+
return _el$4;
|
|
53597
|
+
})();
|
|
53598
|
+
},
|
|
53599
|
+
get children() {
|
|
53600
|
+
var _el$ = createElement("text");
|
|
53601
|
+
insert(_el$, () => props.message);
|
|
53602
|
+
effect((_$p) => setProp(_el$, "fg", theme.text.muted, _$p));
|
|
53603
|
+
return _el$;
|
|
53604
|
+
}
|
|
53605
|
+
});
|
|
53606
|
+
}
|
|
53607
|
+
var init_dialog_confirm = __esm(() => {
|
|
53608
|
+
init_index_bun();
|
|
53609
|
+
init_index_bun();
|
|
53610
|
+
init_index_bun();
|
|
53611
|
+
init_index_bun();
|
|
53612
|
+
init_index_bun();
|
|
53613
|
+
init_index_bun();
|
|
53614
|
+
init_index_bun();
|
|
53615
|
+
init_keymap();
|
|
53616
|
+
init_theme3();
|
|
53617
|
+
init_config();
|
|
53618
|
+
init_dialog();
|
|
53619
|
+
init_server2();
|
|
53620
|
+
init_server();
|
|
53621
|
+
init_locale();
|
|
53622
|
+
init_semantic();
|
|
53623
|
+
init_turn_overlays();
|
|
53624
|
+
});
|
|
53625
|
+
|
|
53626
|
+
// ../tui-base/src/routes/session/turn-cancel.tsx
|
|
53627
|
+
function armNonArmingInterrupt() {
|
|
53628
|
+
nonArmingInterrupt = true;
|
|
53629
|
+
}
|
|
53630
|
+
function consumeNonArmingInterrupt() {
|
|
53631
|
+
const armed = nonArmingInterrupt;
|
|
53632
|
+
nonArmingInterrupt = false;
|
|
53633
|
+
return armed;
|
|
53634
|
+
}
|
|
53635
|
+
function createTurnCancel(props, onArm, confirmQuit) {
|
|
53636
|
+
const windowMs = props.windowMs ?? CTRL_C_QUIT_WINDOW_MS;
|
|
53637
|
+
let timer;
|
|
53638
|
+
let armedKey;
|
|
53639
|
+
let busyInterrupted = false;
|
|
53640
|
+
let lastBusy = false;
|
|
53641
|
+
const disarm = () => {
|
|
53642
|
+
if (timer)
|
|
53643
|
+
clearTimeout(timer);
|
|
53644
|
+
timer = undefined;
|
|
53645
|
+
const key = armedKey;
|
|
53646
|
+
armedKey = undefined;
|
|
53647
|
+
if (key)
|
|
53648
|
+
onArm(false, key);
|
|
53649
|
+
};
|
|
53650
|
+
const arm = (key, beforeExpire) => {
|
|
53651
|
+
if (timer)
|
|
53652
|
+
clearTimeout(timer);
|
|
53653
|
+
armedKey = key;
|
|
53654
|
+
onArm(true, key);
|
|
53655
|
+
timer = setTimeout(() => {
|
|
53656
|
+
timer = undefined;
|
|
53657
|
+
beforeExpire?.();
|
|
53658
|
+
disarm();
|
|
53659
|
+
}, windowMs);
|
|
53660
|
+
};
|
|
53661
|
+
return {
|
|
53662
|
+
escape() {
|
|
53663
|
+
if (!props.busy() || props.escapeYields?.())
|
|
53664
|
+
return false;
|
|
53665
|
+
if (!props.confirmStop) {
|
|
53666
|
+
props.interrupt();
|
|
53667
|
+
return true;
|
|
53941
53668
|
}
|
|
53942
|
-
|
|
53943
|
-
|
|
53944
|
-
|
|
53945
|
-
|
|
53946
|
-
|
|
53947
|
-
|
|
53948
|
-
|
|
53949
|
-
|
|
53950
|
-
|
|
53951
|
-
|
|
53952
|
-
|
|
53953
|
-
|
|
53669
|
+
if (armedKey === "escape") {
|
|
53670
|
+
disarm();
|
|
53671
|
+
props.confirmStop();
|
|
53672
|
+
return true;
|
|
53673
|
+
}
|
|
53674
|
+
arm("escape");
|
|
53675
|
+
return true;
|
|
53676
|
+
},
|
|
53677
|
+
ctrlC() {
|
|
53678
|
+
if (armedKey === "escape")
|
|
53679
|
+
disarm();
|
|
53680
|
+
const busy = props.busy();
|
|
53681
|
+
if (busy && !lastBusy)
|
|
53682
|
+
busyInterrupted = false;
|
|
53683
|
+
if (consumeNonArmingInterrupt() && busy) {
|
|
53684
|
+
props.interrupt();
|
|
53685
|
+
busyInterrupted = true;
|
|
53686
|
+
lastBusy = props.busy();
|
|
53687
|
+
return true;
|
|
53688
|
+
}
|
|
53689
|
+
if (busy && !busyInterrupted) {
|
|
53690
|
+
props.interrupt();
|
|
53691
|
+
busyInterrupted = true;
|
|
53692
|
+
lastBusy = props.busy();
|
|
53693
|
+
return true;
|
|
53694
|
+
}
|
|
53695
|
+
busyInterrupted = false;
|
|
53696
|
+
lastBusy = props.busy();
|
|
53697
|
+
confirmQuit();
|
|
53698
|
+
return true;
|
|
53699
|
+
},
|
|
53700
|
+
dispose: disarm
|
|
53701
|
+
};
|
|
53702
|
+
}
|
|
53703
|
+
function TurnCancelKeys(props) {
|
|
53704
|
+
const theme = useThemeOptional();
|
|
53705
|
+
const dialog = useDialog();
|
|
53706
|
+
const [armed, setArmed] = createSignal(undefined);
|
|
53707
|
+
const openQuitDialog = () => {
|
|
53708
|
+
dialog.replace(() => createComponent2(DialogConfirm, {
|
|
53709
|
+
get title() {
|
|
53710
|
+
return t("turn.quit.confirmTitle");
|
|
53711
|
+
},
|
|
53712
|
+
get message() {
|
|
53713
|
+
return t("turn.quit.confirmMessage");
|
|
53714
|
+
},
|
|
53715
|
+
get label() {
|
|
53716
|
+
return {
|
|
53717
|
+
confirm: t("turn.quit.confirmLabel"),
|
|
53718
|
+
cancel: t("turn.quit.cancelLabel")
|
|
53719
|
+
};
|
|
53720
|
+
},
|
|
53721
|
+
get onConfirm() {
|
|
53722
|
+
return props.quit;
|
|
53723
|
+
}
|
|
53724
|
+
}), undefined, {
|
|
53725
|
+
tone: "warning"
|
|
53726
|
+
});
|
|
53727
|
+
};
|
|
53728
|
+
const cancel = createTurnCancel(props, (value, key) => setArmed(value ? key : undefined), openQuitDialog);
|
|
53729
|
+
onCleanup(() => cancel.dispose());
|
|
53730
|
+
Keymap2.createLayer(() => ({
|
|
53731
|
+
mode: "global",
|
|
53732
|
+
enabled: props.enabled(),
|
|
53733
|
+
commands: [{
|
|
53734
|
+
bind: "escape",
|
|
53735
|
+
title: props.confirmStop ? "Stop current turn (press Esc twice)" : "Interrupt current turn",
|
|
53736
|
+
group: "Session",
|
|
53737
|
+
run: () => cancel.escape()
|
|
53738
|
+
}, {
|
|
53739
|
+
bind: "ctrl+c",
|
|
53740
|
+
title: "Quit / interrupt turn",
|
|
53741
|
+
group: "Session",
|
|
53742
|
+
run: () => cancel.ctrlC()
|
|
53743
|
+
}]
|
|
53744
|
+
}));
|
|
53745
|
+
return createComponent2(Show, {
|
|
53746
|
+
get when() {
|
|
53747
|
+
return armed();
|
|
53748
|
+
},
|
|
53749
|
+
get children() {
|
|
53750
|
+
var _el$ = createElement("box"), _el$2 = createElement("text");
|
|
53751
|
+
insertNode(_el$, _el$2);
|
|
53752
|
+
setProp(_el$, "height", 1);
|
|
53753
|
+
setProp(_el$, "flexShrink", 0);
|
|
53754
|
+
setProp(_el$, "paddingLeft", 1);
|
|
53755
|
+
setProp(_el$2, "wrapMode", "none");
|
|
53756
|
+
insert(_el$2, () => t("turn.stop.escHint"));
|
|
53757
|
+
effect((_$p) => setProp(_el$2, "fg", theme?.text.feedback.warning.base ?? "#e0af68", _$p));
|
|
53758
|
+
return _el$;
|
|
53759
|
+
}
|
|
53760
|
+
});
|
|
53761
|
+
}
|
|
53762
|
+
var CTRL_C_QUIT_WINDOW_MS = 500, nonArmingInterrupt = false;
|
|
53763
|
+
var init_turn_cancel = __esm(() => {
|
|
53764
|
+
init_index_bun();
|
|
53765
|
+
init_index_bun();
|
|
53766
|
+
init_index_bun();
|
|
53767
|
+
init_index_bun();
|
|
53768
|
+
init_index_bun();
|
|
53769
|
+
init_index_bun();
|
|
53770
|
+
init_server();
|
|
53771
|
+
init_keymap();
|
|
53772
|
+
init_theme3();
|
|
53773
|
+
init_i18n();
|
|
53774
|
+
init_dialog();
|
|
53775
|
+
init_dialog_confirm();
|
|
53776
|
+
});
|
|
53777
|
+
|
|
53778
|
+
// ../tui-base/src/routes/session/stop-all.ts
|
|
53779
|
+
async function stopEverything(seam) {
|
|
53780
|
+
const turn = seam.status?.().turn;
|
|
53781
|
+
const parent = turn !== undefined && turn !== "idle";
|
|
53782
|
+
if (parent)
|
|
53783
|
+
seam.interrupt();
|
|
53784
|
+
if (seam.hasBridgeCapability?.("subagents.stopChildren") === true && seam.stopChildren) {
|
|
53785
|
+
let dispositions = [];
|
|
53786
|
+
try {
|
|
53787
|
+
dispositions = await seam.stopChildren();
|
|
53788
|
+
} catch {}
|
|
53789
|
+
return {
|
|
53790
|
+
parent,
|
|
53791
|
+
children: dispositions.filter((row) => row.disposition === "cancel-issued").length,
|
|
53792
|
+
dispositions
|
|
53793
|
+
};
|
|
53794
|
+
}
|
|
53795
|
+
let children = 0;
|
|
53796
|
+
for (const view of seam.subagentViews?.() ?? []) {
|
|
53797
|
+
if (view.status !== "running" || !seam.interruptChild)
|
|
53798
|
+
continue;
|
|
53799
|
+
try {
|
|
53800
|
+
await seam.interruptChild(view.id);
|
|
53801
|
+
children++;
|
|
53802
|
+
} catch {}
|
|
53803
|
+
}
|
|
53804
|
+
return { parent, children };
|
|
53805
|
+
}
|
|
53806
|
+
|
|
53807
|
+
// ../tui-base/src/routes/session/turn-overlay-controller.ts
|
|
53808
|
+
function askSignature(questions) {
|
|
53809
|
+
return JSON.stringify(questions.map((question) => [
|
|
53810
|
+
question.id,
|
|
53811
|
+
question.prompt,
|
|
53812
|
+
question.header,
|
|
53813
|
+
question.description,
|
|
53814
|
+
question.detail,
|
|
53815
|
+
question.multiSelect === true,
|
|
53816
|
+
question.options.map((option) => [option.label, option.description])
|
|
53817
|
+
]));
|
|
53818
|
+
}
|
|
53819
|
+
|
|
53820
|
+
class TurnOverlayController {
|
|
53821
|
+
#approvals = [];
|
|
53822
|
+
#asks = [];
|
|
53823
|
+
#seq = 0;
|
|
53824
|
+
#listeners = new Set;
|
|
53825
|
+
#idleHandlers = new Set;
|
|
53826
|
+
#busy = false;
|
|
53827
|
+
#pendingAsks;
|
|
53828
|
+
subscribe(fn) {
|
|
53829
|
+
this.#listeners.add(fn);
|
|
53830
|
+
return () => this.#listeners.delete(fn);
|
|
53831
|
+
}
|
|
53832
|
+
attachPendingAsks(read) {
|
|
53833
|
+
this.#pendingAsks = read;
|
|
53834
|
+
}
|
|
53835
|
+
invalidateAsk(eventId, reason) {
|
|
53836
|
+
if (eventId === "")
|
|
53837
|
+
return;
|
|
53838
|
+
if (this.#approvals.some((entry) => entry.request.invalidatedReason !== undefined && entry.request.eventId === eventId))
|
|
53839
|
+
return;
|
|
53840
|
+
this.#approvals = this.#approvals.filter((entry) => {
|
|
53841
|
+
if (entry.request.eventId !== eventId)
|
|
53842
|
+
return true;
|
|
53843
|
+
entry.resolve("rejected");
|
|
53844
|
+
return false;
|
|
53845
|
+
});
|
|
53846
|
+
this.#asks = this.#asks.filter((entry) => {
|
|
53847
|
+
if (entry.eventId !== eventId)
|
|
53848
|
+
return true;
|
|
53849
|
+
entry.resolve([]);
|
|
53850
|
+
return false;
|
|
53851
|
+
});
|
|
53852
|
+
this.#approvals.push({
|
|
53853
|
+
request: {
|
|
53854
|
+
id: ++this.#seq,
|
|
53855
|
+
name: "ask",
|
|
53856
|
+
args: {},
|
|
53857
|
+
eventId,
|
|
53858
|
+
escalation: false,
|
|
53859
|
+
invalidatedReason: reason
|
|
53954
53860
|
},
|
|
53955
|
-
|
|
53956
|
-
|
|
53957
|
-
|
|
53958
|
-
|
|
53959
|
-
|
|
53960
|
-
|
|
53961
|
-
|
|
53962
|
-
|
|
53861
|
+
resolve: () => {}
|
|
53862
|
+
});
|
|
53863
|
+
this.#changed();
|
|
53864
|
+
}
|
|
53865
|
+
invalidateAll(reason) {
|
|
53866
|
+
if (reason === "")
|
|
53867
|
+
return;
|
|
53868
|
+
const open = this.#approvals.length + this.#asks.length;
|
|
53869
|
+
if (open === 0)
|
|
53870
|
+
return;
|
|
53871
|
+
const terminals = [];
|
|
53872
|
+
for (const entry of this.#approvals) {
|
|
53873
|
+
terminals.push({
|
|
53874
|
+
request: {
|
|
53875
|
+
id: ++this.#seq,
|
|
53876
|
+
name: "ask",
|
|
53877
|
+
args: {},
|
|
53878
|
+
...entry.request.eventId !== undefined ? { eventId: entry.request.eventId } : {},
|
|
53879
|
+
escalation: false,
|
|
53880
|
+
invalidatedReason: reason
|
|
53881
|
+
},
|
|
53882
|
+
resolve: () => {}
|
|
53883
|
+
});
|
|
53884
|
+
}
|
|
53885
|
+
for (const entry of this.#asks) {
|
|
53886
|
+
terminals.push({
|
|
53887
|
+
request: {
|
|
53888
|
+
id: ++this.#seq,
|
|
53889
|
+
name: "ask",
|
|
53890
|
+
args: {},
|
|
53891
|
+
...entry.eventId !== undefined ? { eventId: entry.eventId } : {},
|
|
53892
|
+
escalation: false,
|
|
53893
|
+
invalidatedReason: reason
|
|
53894
|
+
},
|
|
53895
|
+
resolve: () => {}
|
|
53896
|
+
});
|
|
53897
|
+
}
|
|
53898
|
+
for (const entry of this.#approvals)
|
|
53899
|
+
entry.resolve("rejected");
|
|
53900
|
+
for (const entry of this.#asks)
|
|
53901
|
+
entry.resolve([]);
|
|
53902
|
+
this.#approvals = terminals;
|
|
53903
|
+
this.#asks = [];
|
|
53904
|
+
this.#changed();
|
|
53905
|
+
}
|
|
53906
|
+
pendingInvalidated() {
|
|
53907
|
+
const out = new Map;
|
|
53908
|
+
for (const entry of this.#approvals) {
|
|
53909
|
+
if (entry.request.invalidatedReason !== undefined && entry.request.eventId !== undefined) {
|
|
53910
|
+
out.set(entry.request.eventId, entry.request.invalidatedReason);
|
|
53963
53911
|
}
|
|
53964
|
-
}
|
|
53965
|
-
|
|
53966
|
-
|
|
53967
|
-
|
|
53968
|
-
|
|
53969
|
-
|
|
53970
|
-
|
|
53971
|
-
|
|
53972
|
-
|
|
53973
|
-
|
|
53974
|
-
|
|
53975
|
-
|
|
53976
|
-
|
|
53977
|
-
|
|
53978
|
-
|
|
53979
|
-
|
|
53980
|
-
|
|
53912
|
+
}
|
|
53913
|
+
return out;
|
|
53914
|
+
}
|
|
53915
|
+
onIdle(fn) {
|
|
53916
|
+
this.#idleHandlers.add(fn);
|
|
53917
|
+
return () => this.#idleHandlers.delete(fn);
|
|
53918
|
+
}
|
|
53919
|
+
#changed() {
|
|
53920
|
+
for (const listener of this.#listeners)
|
|
53921
|
+
listener();
|
|
53922
|
+
const busy = this.#approvals.length > 0 || this.#asks.length > 0;
|
|
53923
|
+
if (this.#busy && !busy)
|
|
53924
|
+
for (const handler of this.#idleHandlers)
|
|
53925
|
+
handler();
|
|
53926
|
+
this.#busy = busy;
|
|
53927
|
+
}
|
|
53928
|
+
get pendingApproval() {
|
|
53929
|
+
return this.#approvals[0]?.request;
|
|
53930
|
+
}
|
|
53931
|
+
get pendingApprovalCount() {
|
|
53932
|
+
return this.#approvals.length;
|
|
53933
|
+
}
|
|
53934
|
+
get pendingAskCount() {
|
|
53935
|
+
return this.#asks.length;
|
|
53936
|
+
}
|
|
53937
|
+
requestApproval(name, args) {
|
|
53938
|
+
const ask = this.#matchApproval(name, args);
|
|
53939
|
+
const promise = new Promise((resolve) => {
|
|
53940
|
+
this.#approvals.push({
|
|
53941
|
+
request: {
|
|
53942
|
+
id: ++this.#seq,
|
|
53943
|
+
name,
|
|
53944
|
+
args,
|
|
53945
|
+
escalation: ask?.escalation === true,
|
|
53946
|
+
...ask !== undefined ? { eventId: ask.eventId } : {}
|
|
53947
|
+
},
|
|
53948
|
+
resolve
|
|
53949
|
+
});
|
|
53950
|
+
this.#changed();
|
|
53951
|
+
});
|
|
53952
|
+
return promise;
|
|
53953
|
+
}
|
|
53954
|
+
#matchApproval(name, args) {
|
|
53955
|
+
const asks = (this.#pendingAsks?.() ?? []).filter((ask) => ask.kind === "approval");
|
|
53956
|
+
if (asks.length === 0)
|
|
53957
|
+
return;
|
|
53958
|
+
const callId = typeof args.callId === "string" ? args.callId : undefined;
|
|
53959
|
+
if (callId !== undefined) {
|
|
53960
|
+
const byCall = asks.filter((ask) => ask.callId === callId);
|
|
53961
|
+
return byCall.length > 0 ? byCall[byCall.length - 1] : undefined;
|
|
53962
|
+
}
|
|
53963
|
+
const reason = typeof args.reason === "string" ? args.reason : undefined;
|
|
53964
|
+
const byName = asks.filter((ask) => (ask.toolName ?? "tool") === name && (reason === undefined || ask.reason === reason));
|
|
53965
|
+
if (byName.length > 0)
|
|
53966
|
+
return byName[byName.length - 1];
|
|
53967
|
+
return asks.length === 1 ? asks[0] : undefined;
|
|
53968
|
+
}
|
|
53969
|
+
confirmApproval() {
|
|
53970
|
+
this.#settleApproval("allowed-once");
|
|
53971
|
+
}
|
|
53972
|
+
rejectApproval() {
|
|
53973
|
+
this.#settleApproval("rejected");
|
|
53974
|
+
}
|
|
53975
|
+
approveAlways() {
|
|
53976
|
+
this.#settleEscalated("always");
|
|
53977
|
+
}
|
|
53978
|
+
approveSession() {
|
|
53979
|
+
this.#settleEscalated("session");
|
|
53980
|
+
}
|
|
53981
|
+
#settleEscalated(verdict) {
|
|
53982
|
+
if (this.#approvals[0]?.request.escalation !== true)
|
|
53983
|
+
return;
|
|
53984
|
+
this.#settleApproval(verdict);
|
|
53985
|
+
}
|
|
53986
|
+
#settleApproval(verdict) {
|
|
53987
|
+
const head = this.#approvals.shift();
|
|
53988
|
+
if (!head)
|
|
53989
|
+
return;
|
|
53990
|
+
head.resolve(verdict);
|
|
53991
|
+
this.#changed();
|
|
53992
|
+
}
|
|
53993
|
+
syncPendingAsks() {
|
|
53994
|
+
if (this.#pendingAsks === undefined)
|
|
53995
|
+
return;
|
|
53996
|
+
const asks = this.#pendingAsks();
|
|
53997
|
+
let changed = false;
|
|
53998
|
+
const approvalsBefore = this.#approvals.length;
|
|
53999
|
+
this.#approvals = this.#approvals.filter((entry) => {
|
|
54000
|
+
if (this.#approvalStillPending(entry.request, asks))
|
|
54001
|
+
return true;
|
|
54002
|
+
entry.resolve("rejected");
|
|
54003
|
+
return false;
|
|
53981
54004
|
});
|
|
53982
|
-
|
|
53983
|
-
|
|
53984
|
-
|
|
53985
|
-
|
|
53986
|
-
|
|
53987
|
-
|
|
53988
|
-
|
|
53989
|
-
const base = () => theme?.text.base ?? "#e6e6e6";
|
|
53990
|
-
const accent = () => theme?.hue.interactive[500] ?? "#7aa2f7";
|
|
53991
|
-
const success = () => theme?.text.feedback.success.base ?? "#9ece6a";
|
|
53992
|
-
const currentBg = () => theme?.background.action.primary.focused;
|
|
53993
|
-
const currentFg = () => theme?.text.action.primary.focused ?? accent();
|
|
53994
|
-
const label = () => splitRecommended(props.row().option.label);
|
|
53995
|
-
const number = () => `${props.row().number}. `;
|
|
53996
|
-
const badge = () => `[${t("overlay.ask.recommended")}]`;
|
|
53997
|
-
const stateGlyph = () => {
|
|
53998
|
-
if (props.multi())
|
|
53999
|
-
return props.row().selected ? "\u25A0 " : "\u25A1 ";
|
|
54000
|
-
return props.row().selected ? "\u25CF " : "\u25CB ";
|
|
54001
|
-
};
|
|
54002
|
-
const stateColor = () => {
|
|
54003
|
-
if (props.cursor())
|
|
54004
|
-
return currentFg();
|
|
54005
|
-
return props.row().selected ? success() : faint();
|
|
54006
|
-
};
|
|
54007
|
-
const badgeInline = () => {
|
|
54008
|
-
if (!label().recommended || props.compact())
|
|
54005
|
+
if (this.#approvals.length !== approvalsBefore)
|
|
54006
|
+
changed = true;
|
|
54007
|
+
const questionsBefore = this.#asks.length;
|
|
54008
|
+
this.#asks = this.#asks.filter((entry) => {
|
|
54009
|
+
if (this.#questionStillPending(entry, asks))
|
|
54010
|
+
return true;
|
|
54011
|
+
entry.resolve([]);
|
|
54009
54012
|
return false;
|
|
54010
|
-
const used = props.labelColumn() + stringWidth(label().label) + BADGE_GAP + stringWidth(badge());
|
|
54011
|
-
return used <= props.width();
|
|
54012
|
-
};
|
|
54013
|
-
const labelColor = () => props.cursor() ? currentFg() : base();
|
|
54014
|
-
return (() => {
|
|
54015
|
-
var _el$33 = createElement("box"), _el$34 = createElement("box"), _el$35 = createElement("text"), _el$36 = createElement("text"), _el$37 = createElement("text"), _el$38 = createElement("text");
|
|
54016
|
-
insertNode(_el$33, _el$34);
|
|
54017
|
-
setProp(_el$33, "flexDirection", "column");
|
|
54018
|
-
setProp(_el$33, "width", "100%");
|
|
54019
|
-
setProp(_el$33, "flexShrink", 0);
|
|
54020
|
-
insertNode(_el$34, _el$35);
|
|
54021
|
-
insertNode(_el$34, _el$36);
|
|
54022
|
-
insertNode(_el$34, _el$37);
|
|
54023
|
-
insertNode(_el$34, _el$38);
|
|
54024
|
-
setProp(_el$34, "flexDirection", "row");
|
|
54025
|
-
setProp(_el$34, "width", "100%");
|
|
54026
|
-
setProp(_el$34, "flexShrink", 0);
|
|
54027
|
-
setProp(_el$34, "paddingLeft", 2);
|
|
54028
|
-
insert(_el$35, () => props.marked() ? "\u203A " : " ");
|
|
54029
|
-
insert(_el$36, stateGlyph);
|
|
54030
|
-
insert(_el$37, number);
|
|
54031
|
-
setProp(_el$38, "wrapMode", "word");
|
|
54032
|
-
insert(_el$38, () => label().label);
|
|
54033
|
-
insert(_el$34, createComponent2(Show, {
|
|
54034
|
-
get when() {
|
|
54035
|
-
return badgeInline();
|
|
54036
|
-
},
|
|
54037
|
-
get children() {
|
|
54038
|
-
var _el$39 = createElement("text");
|
|
54039
|
-
insert(_el$39, () => ` ${badge()}`);
|
|
54040
|
-
effect((_$p) => setProp(_el$39, "fg", props.cursor() ? currentFg() : success(), _$p));
|
|
54041
|
-
return _el$39;
|
|
54042
|
-
}
|
|
54043
|
-
}), null);
|
|
54044
|
-
insert(_el$33, createComponent2(Show, {
|
|
54045
|
-
get when() {
|
|
54046
|
-
return memo2(() => !!label().recommended)() && !badgeInline();
|
|
54047
|
-
},
|
|
54048
|
-
get children() {
|
|
54049
|
-
var _el$40 = createElement("box"), _el$41 = createElement("text");
|
|
54050
|
-
insertNode(_el$40, _el$41);
|
|
54051
|
-
setProp(_el$41, "wrapMode", "none");
|
|
54052
|
-
insert(_el$41, badge);
|
|
54053
|
-
effect((_p$) => {
|
|
54054
|
-
var _v$23 = props.labelColumn(), _v$24 = success();
|
|
54055
|
-
_v$23 !== _p$.e && (_p$.e = setProp(_el$40, "paddingLeft", _v$23, _p$.e));
|
|
54056
|
-
_v$24 !== _p$.t && (_p$.t = setProp(_el$41, "fg", _v$24, _p$.t));
|
|
54057
|
-
return _p$;
|
|
54058
|
-
}, {
|
|
54059
|
-
e: undefined,
|
|
54060
|
-
t: undefined
|
|
54061
|
-
});
|
|
54062
|
-
return _el$40;
|
|
54063
|
-
}
|
|
54064
|
-
}), null);
|
|
54065
|
-
insert(_el$33, createComponent2(Show, {
|
|
54066
|
-
get when() {
|
|
54067
|
-
return props.row().option.description;
|
|
54068
|
-
},
|
|
54069
|
-
children: (description) => (() => {
|
|
54070
|
-
var _el$42 = createElement("box"), _el$43 = createElement("text");
|
|
54071
|
-
insertNode(_el$42, _el$43);
|
|
54072
|
-
setProp(_el$43, "wrapMode", "word");
|
|
54073
|
-
insert(_el$43, description);
|
|
54074
|
-
effect((_p$) => {
|
|
54075
|
-
var _v$31 = props.labelColumn(), _v$32 = muted();
|
|
54076
|
-
_v$31 !== _p$.e && (_p$.e = setProp(_el$42, "paddingLeft", _v$31, _p$.e));
|
|
54077
|
-
_v$32 !== _p$.t && (_p$.t = setProp(_el$43, "fg", _v$32, _p$.t));
|
|
54078
|
-
return _p$;
|
|
54079
|
-
}, {
|
|
54080
|
-
e: undefined,
|
|
54081
|
-
t: undefined
|
|
54082
|
-
});
|
|
54083
|
-
return _el$42;
|
|
54084
|
-
})()
|
|
54085
|
-
}), null);
|
|
54086
|
-
effect((_p$) => {
|
|
54087
|
-
var _v$25 = props.cursor() ? currentBg() : undefined, _v$26 = props.cursor() ? currentFg() : faint(), _v$27 = stateColor(), _v$28 = props.cursor() ? currentFg() : faint(), _v$29 = labelColor(), _v$30 = badgeInline() ? 0 : 1;
|
|
54088
|
-
_v$25 !== _p$.e && (_p$.e = setProp(_el$34, "backgroundColor", _v$25, _p$.e));
|
|
54089
|
-
_v$26 !== _p$.t && (_p$.t = setProp(_el$35, "fg", _v$26, _p$.t));
|
|
54090
|
-
_v$27 !== _p$.a && (_p$.a = setProp(_el$36, "fg", _v$27, _p$.a));
|
|
54091
|
-
_v$28 !== _p$.o && (_p$.o = setProp(_el$37, "fg", _v$28, _p$.o));
|
|
54092
|
-
_v$29 !== _p$.i && (_p$.i = setProp(_el$38, "fg", _v$29, _p$.i));
|
|
54093
|
-
_v$30 !== _p$.n && (_p$.n = setProp(_el$38, "flexGrow", _v$30, _p$.n));
|
|
54094
|
-
return _p$;
|
|
54095
|
-
}, {
|
|
54096
|
-
e: undefined,
|
|
54097
|
-
t: undefined,
|
|
54098
|
-
a: undefined,
|
|
54099
|
-
o: undefined,
|
|
54100
|
-
i: undefined,
|
|
54101
|
-
n: undefined
|
|
54102
54013
|
});
|
|
54103
|
-
|
|
54104
|
-
|
|
54105
|
-
|
|
54106
|
-
|
|
54107
|
-
|
|
54108
|
-
|
|
54109
|
-
|
|
54110
|
-
|
|
54111
|
-
|
|
54112
|
-
|
|
54113
|
-
|
|
54114
|
-
|
|
54115
|
-
|
|
54116
|
-
|
|
54117
|
-
|
|
54118
|
-
|
|
54119
|
-
|
|
54120
|
-
|
|
54121
|
-
|
|
54122
|
-
|
|
54123
|
-
|
|
54124
|
-
|
|
54125
|
-
|
|
54126
|
-
|
|
54127
|
-
|
|
54128
|
-
|
|
54129
|
-
|
|
54130
|
-
|
|
54131
|
-
|
|
54132
|
-
|
|
54133
|
-
|
|
54134
|
-
|
|
54135
|
-
|
|
54136
|
-
|
|
54137
|
-
|
|
54138
|
-
|
|
54139
|
-
|
|
54140
|
-
|
|
54141
|
-
|
|
54142
|
-
|
|
54143
|
-
|
|
54014
|
+
if (this.#asks.length !== questionsBefore)
|
|
54015
|
+
changed = true;
|
|
54016
|
+
if (changed)
|
|
54017
|
+
this.#changed();
|
|
54018
|
+
}
|
|
54019
|
+
#approvalStillPending(request, asks) {
|
|
54020
|
+
if (request.eventId !== undefined)
|
|
54021
|
+
return asks.some((ask) => ask.eventId === request.eventId);
|
|
54022
|
+
return asks.some((ask) => ask.kind === "approval");
|
|
54023
|
+
}
|
|
54024
|
+
#questionStillPending(entry, asks) {
|
|
54025
|
+
if (entry.eventId !== undefined)
|
|
54026
|
+
return asks.some((ask) => ask.eventId === entry.eventId);
|
|
54027
|
+
return asks.some((ask) => ask.kind === "questions");
|
|
54028
|
+
}
|
|
54029
|
+
cancelAllApprovals() {
|
|
54030
|
+
if (this.#approvals.length === 0)
|
|
54031
|
+
return;
|
|
54032
|
+
const entries = this.#approvals.splice(0);
|
|
54033
|
+
for (const entry of entries)
|
|
54034
|
+
entry.resolve("rejected");
|
|
54035
|
+
this.#changed();
|
|
54036
|
+
}
|
|
54037
|
+
cancelAllAsks() {
|
|
54038
|
+
if (this.#asks.length === 0)
|
|
54039
|
+
return;
|
|
54040
|
+
const entries = this.#asks.splice(0);
|
|
54041
|
+
for (const entry of entries)
|
|
54042
|
+
entry.resolve([]);
|
|
54043
|
+
this.#changed();
|
|
54044
|
+
}
|
|
54045
|
+
get pendingAsk() {
|
|
54046
|
+
const head = this.#asks[0];
|
|
54047
|
+
if (!head)
|
|
54048
|
+
return;
|
|
54049
|
+
return {
|
|
54050
|
+
id: head.id,
|
|
54051
|
+
...head.eventId !== undefined ? { eventId: head.eventId } : {},
|
|
54052
|
+
questions: head.questions,
|
|
54053
|
+
index: head.index,
|
|
54054
|
+
picks: head.picks,
|
|
54055
|
+
phase: head.phase,
|
|
54056
|
+
customs: [...head.customs],
|
|
54057
|
+
customDraft: head.customDrafts[head.index] ?? null,
|
|
54058
|
+
cursors: [...head.cursors],
|
|
54059
|
+
listCursors: [...head.listCursors],
|
|
54060
|
+
reviewCursor: head.reviewCursor
|
|
54061
|
+
};
|
|
54062
|
+
}
|
|
54063
|
+
get currentQuestion() {
|
|
54064
|
+
const head = this.#asks[0];
|
|
54065
|
+
return head?.questions[head.index];
|
|
54066
|
+
}
|
|
54067
|
+
#matchAsk(questions) {
|
|
54068
|
+
const asks = (this.#pendingAsks?.() ?? []).filter((ask) => ask.kind === "questions");
|
|
54069
|
+
if (asks.length === 0)
|
|
54070
|
+
return;
|
|
54071
|
+
const claimed = new Set(this.#asks.map((entry) => entry.eventId));
|
|
54072
|
+
const available = asks.filter((ask) => !claimed.has(ask.eventId));
|
|
54073
|
+
if (available.length === 0)
|
|
54074
|
+
return;
|
|
54075
|
+
const signature = askSignature(questions);
|
|
54076
|
+
const exact = available.filter((ask) => askSignature(ask.questions ?? []) === signature);
|
|
54077
|
+
if (exact.length > 0)
|
|
54078
|
+
return exact[0];
|
|
54079
|
+
return available.length === 1 ? available[0] : undefined;
|
|
54080
|
+
}
|
|
54081
|
+
answer(questions) {
|
|
54082
|
+
if (questions.length === 0)
|
|
54083
|
+
return Promise.resolve([]);
|
|
54084
|
+
const ask = this.#matchAsk(questions);
|
|
54085
|
+
return new Promise((resolve) => {
|
|
54086
|
+
this.#asks.push({
|
|
54087
|
+
id: ++this.#seq,
|
|
54088
|
+
...ask !== undefined ? { eventId: ask.eventId } : {},
|
|
54089
|
+
questions,
|
|
54090
|
+
index: 0,
|
|
54091
|
+
picks: questions.map((question) => recommendedPicks(question)),
|
|
54092
|
+
phase: questions[0]?.options.length === 0 ? "input" : "questions",
|
|
54093
|
+
customs: questions.map(() => {
|
|
54094
|
+
return;
|
|
54095
|
+
}),
|
|
54096
|
+
customDrafts: questions.map(() => null),
|
|
54097
|
+
cursors: questions.map(() => 0),
|
|
54098
|
+
listCursors: questions.map(() => 0),
|
|
54099
|
+
reviewCursor: 0,
|
|
54100
|
+
resolve
|
|
54144
54101
|
});
|
|
54145
|
-
|
|
54146
|
-
|
|
54147
|
-
|
|
54148
|
-
|
|
54149
|
-
|
|
54150
|
-
|
|
54151
|
-
|
|
54152
|
-
return
|
|
54153
|
-
|
|
54154
|
-
|
|
54155
|
-
|
|
54156
|
-
|
|
54157
|
-
|
|
54158
|
-
|
|
54159
|
-
|
|
54160
|
-
|
|
54161
|
-
|
|
54162
|
-
get extraActions() {
|
|
54163
|
-
return memo2(() => !!(!invalidated() && props.escalation === true))() ? [{
|
|
54164
|
-
label: t("overlay.ask.allowAlways"),
|
|
54165
|
-
bind: "a",
|
|
54166
|
-
onTrigger: () => props.onVerdict("always")
|
|
54167
|
-
}, {
|
|
54168
|
-
label: t("overlay.ask.allowSession"),
|
|
54169
|
-
bind: "s",
|
|
54170
|
-
onTrigger: () => props.onVerdict("session")
|
|
54171
|
-
}] : undefined;
|
|
54102
|
+
this.#changed();
|
|
54103
|
+
});
|
|
54104
|
+
}
|
|
54105
|
+
toggle(option) {
|
|
54106
|
+
const head = this.#asks[0];
|
|
54107
|
+
const question = head?.questions[head.index];
|
|
54108
|
+
if (!head || !question || head.phase === "review")
|
|
54109
|
+
return;
|
|
54110
|
+
if (head.phase === "input")
|
|
54111
|
+
return;
|
|
54112
|
+
head.customs[head.index] = undefined;
|
|
54113
|
+
head.customDrafts[head.index] = null;
|
|
54114
|
+
if (question.multiSelect === true) {
|
|
54115
|
+
const current = head.picks[head.index] ?? [];
|
|
54116
|
+
head.picks[head.index] = current.includes(option) ? current.filter((label) => label !== option) : [...current, option];
|
|
54117
|
+
this.#changed();
|
|
54118
|
+
return;
|
|
54172
54119
|
}
|
|
54173
|
-
|
|
54174
|
-
|
|
54175
|
-
|
|
54176
|
-
|
|
54177
|
-
|
|
54178
|
-
|
|
54179
|
-
|
|
54180
|
-
|
|
54181
|
-
|
|
54182
|
-
|
|
54183
|
-
|
|
54184
|
-
|
|
54185
|
-
|
|
54186
|
-
|
|
54187
|
-
|
|
54188
|
-
|
|
54189
|
-
|
|
54190
|
-
|
|
54191
|
-
|
|
54192
|
-
|
|
54193
|
-
|
|
54194
|
-
|
|
54195
|
-
|
|
54196
|
-
}
|
|
54197
|
-
|
|
54198
|
-
|
|
54199
|
-
|
|
54200
|
-
|
|
54201
|
-
|
|
54202
|
-
|
|
54203
|
-
const
|
|
54204
|
-
|
|
54205
|
-
|
|
54206
|
-
|
|
54207
|
-
|
|
54208
|
-
|
|
54209
|
-
|
|
54210
|
-
|
|
54211
|
-
|
|
54212
|
-
|
|
54213
|
-
|
|
54214
|
-
|
|
54215
|
-
|
|
54216
|
-
|
|
54217
|
-
|
|
54218
|
-
|
|
54120
|
+
head.picks[head.index] = [option];
|
|
54121
|
+
if (head.questions.length === 1) {
|
|
54122
|
+
this.#asks.shift();
|
|
54123
|
+
head.resolve(this.#envelope(head));
|
|
54124
|
+
this.#changed();
|
|
54125
|
+
return;
|
|
54126
|
+
}
|
|
54127
|
+
if (this.#allAnswered(head)) {
|
|
54128
|
+
head.phase = "review";
|
|
54129
|
+
head.reviewCursor = 0;
|
|
54130
|
+
} else {
|
|
54131
|
+
const next = head.questions.findIndex((_, qi) => qi > head.index && (head.picks[qi]?.length ?? 0) === 0 && !head.customs[qi]);
|
|
54132
|
+
if (next >= 0)
|
|
54133
|
+
head.index = next;
|
|
54134
|
+
head.phase = head.questions[head.index]?.options.length === 0 ? "input" : "questions";
|
|
54135
|
+
if (head.phase === "input") {
|
|
54136
|
+
const question = head.questions[head.index];
|
|
54137
|
+
if (question !== undefined) {
|
|
54138
|
+
head.cursors[head.index] = inlineRowIndex(question, askNeedsReview(head.questions));
|
|
54139
|
+
}
|
|
54140
|
+
}
|
|
54141
|
+
}
|
|
54142
|
+
this.#changed();
|
|
54143
|
+
}
|
|
54144
|
+
switchFocus(direction) {
|
|
54145
|
+
const head = this.#asks[0];
|
|
54146
|
+
if (!head || head.phase === "review" || head.questions.length < 2)
|
|
54147
|
+
return;
|
|
54148
|
+
if (head.phase === "input" && (head.questions[head.index]?.options.length ?? 0) > 0)
|
|
54149
|
+
return;
|
|
54150
|
+
const next = Math.max(0, Math.min(head.questions.length - 1, head.index + direction));
|
|
54151
|
+
if (next === head.index)
|
|
54152
|
+
return;
|
|
54153
|
+
head.index = next;
|
|
54154
|
+
const question = head.questions[next];
|
|
54155
|
+
head.phase = question?.options.length === 0 ? "input" : "questions";
|
|
54156
|
+
if (head.phase === "input" && question !== undefined) {
|
|
54157
|
+
head.cursors[next] = inlineRowIndex(question, askNeedsReview(head.questions));
|
|
54158
|
+
}
|
|
54159
|
+
this.#changed();
|
|
54160
|
+
}
|
|
54161
|
+
confirmQuestion() {
|
|
54162
|
+
const head = this.#asks[0];
|
|
54163
|
+
if (!head || head.phase === "review" || head.phase === "input")
|
|
54164
|
+
return false;
|
|
54165
|
+
const question = head.questions[head.index];
|
|
54166
|
+
if (question === undefined || !askNeedsReview(head.questions))
|
|
54167
|
+
return false;
|
|
54168
|
+
const next = head.questions.findIndex((_, qi) => qi > head.index && (head.picks[qi]?.length ?? 0) === 0 && !head.customs[qi]);
|
|
54169
|
+
if (next >= 0) {
|
|
54170
|
+
head.index = next;
|
|
54171
|
+
const target = head.questions[next];
|
|
54172
|
+
head.phase = target?.options.length === 0 ? "input" : "questions";
|
|
54173
|
+
if (head.phase === "input" && target !== undefined) {
|
|
54174
|
+
head.cursors[next] = inlineRowIndex(target, askNeedsReview(head.questions));
|
|
54175
|
+
}
|
|
54176
|
+
} else {
|
|
54177
|
+
head.phase = "review";
|
|
54178
|
+
head.reviewCursor = 0;
|
|
54179
|
+
}
|
|
54180
|
+
this.#changed();
|
|
54181
|
+
return true;
|
|
54182
|
+
}
|
|
54183
|
+
beginCustom() {
|
|
54184
|
+
const head = this.#asks[0];
|
|
54185
|
+
if (!head || head.phase === "review")
|
|
54186
|
+
return false;
|
|
54187
|
+
const question = head.questions[head.index];
|
|
54188
|
+
head.customDrafts[head.index] = head.customs[head.index] ?? "";
|
|
54189
|
+
head.phase = "input";
|
|
54190
|
+
if (question !== undefined) {
|
|
54191
|
+
head.cursors[head.index] = inlineRowIndex(question, askNeedsReview(head.questions));
|
|
54192
|
+
}
|
|
54193
|
+
this.#changed();
|
|
54194
|
+
return true;
|
|
54195
|
+
}
|
|
54196
|
+
patchCustom(text) {
|
|
54197
|
+
const head = this.#asks[0];
|
|
54198
|
+
if (!head || head.customDrafts[head.index] === null)
|
|
54199
|
+
return;
|
|
54200
|
+
head.customDrafts[head.index] = text;
|
|
54201
|
+
this.#changed();
|
|
54202
|
+
}
|
|
54203
|
+
commitCustom() {
|
|
54204
|
+
const head = this.#asks[0];
|
|
54205
|
+
const question = head?.questions[head.index];
|
|
54206
|
+
if (!head || !question)
|
|
54207
|
+
return;
|
|
54208
|
+
const draft = head.customDrafts[head.index] ?? null;
|
|
54209
|
+
if (draft === null)
|
|
54210
|
+
return;
|
|
54211
|
+
const text = draft.trim();
|
|
54212
|
+
head.customDrafts[head.index] = null;
|
|
54213
|
+
if (text === "") {
|
|
54214
|
+
this.#backToList(head);
|
|
54215
|
+
this.#changed();
|
|
54216
|
+
return;
|
|
54217
|
+
}
|
|
54218
|
+
head.customs[head.index] = text;
|
|
54219
|
+
head.picks[head.index] = [];
|
|
54220
|
+
if (question.multiSelect !== true && head.questions.length === 1) {
|
|
54221
|
+
this.#asks.shift();
|
|
54222
|
+
head.resolve(this.#envelope(head));
|
|
54223
|
+
this.#changed();
|
|
54224
|
+
return;
|
|
54225
|
+
}
|
|
54226
|
+
if (this.#allAnswered(head)) {
|
|
54227
|
+
head.phase = "review";
|
|
54228
|
+
head.reviewCursor = 0;
|
|
54229
|
+
} else {
|
|
54230
|
+
const next = head.questions.findIndex((_, qi) => qi > head.index && (head.picks[qi]?.length ?? 0) === 0 && !head.customs[qi]);
|
|
54231
|
+
if (next >= 0)
|
|
54232
|
+
head.index = next;
|
|
54233
|
+
head.phase = head.questions[head.index]?.options.length === 0 ? "input" : "questions";
|
|
54234
|
+
}
|
|
54235
|
+
this.#changed();
|
|
54236
|
+
}
|
|
54237
|
+
cancelCustomEdit() {
|
|
54238
|
+
const head = this.#asks[0];
|
|
54239
|
+
if (!head || head.customDrafts[head.index] === null)
|
|
54240
|
+
return;
|
|
54241
|
+
head.customDrafts[head.index] = null;
|
|
54242
|
+
this.#backToList(head);
|
|
54243
|
+
this.#changed();
|
|
54244
|
+
}
|
|
54245
|
+
get inlineText() {
|
|
54246
|
+
const head = this.#asks[0];
|
|
54247
|
+
if (!head)
|
|
54248
|
+
return "";
|
|
54249
|
+
const draft = head.customDrafts[head.index];
|
|
54250
|
+
if (draft !== null && draft !== undefined)
|
|
54251
|
+
return draft;
|
|
54252
|
+
return head.customs[head.index] ?? "";
|
|
54253
|
+
}
|
|
54254
|
+
setInlineText(text) {
|
|
54255
|
+
const head = this.#asks[0];
|
|
54256
|
+
const question = head?.questions[head.index];
|
|
54257
|
+
if (!head || !question || head.phase === "review")
|
|
54258
|
+
return;
|
|
54259
|
+
if ((head.customDrafts[head.index] ?? null) === null && text === "")
|
|
54260
|
+
return;
|
|
54261
|
+
head.customDrafts[head.index] = text;
|
|
54262
|
+
head.phase = "input";
|
|
54263
|
+
head.cursors[head.index] = inlineRowIndex(question, askNeedsReview(head.questions));
|
|
54264
|
+
this.#changed();
|
|
54265
|
+
}
|
|
54266
|
+
focusInput() {
|
|
54267
|
+
const head = this.#asks[0];
|
|
54268
|
+
const question = head?.questions[head.index];
|
|
54269
|
+
if (!head || !question || head.phase === "review")
|
|
54270
|
+
return;
|
|
54271
|
+
head.phase = "input";
|
|
54272
|
+
head.cursors[head.index] = inlineRowIndex(question, askNeedsReview(head.questions));
|
|
54273
|
+
this.#changed();
|
|
54219
54274
|
}
|
|
54220
|
-
|
|
54221
|
-
|
|
54222
|
-
|
|
54223
|
-
const ask = props.controller.pendingAsk;
|
|
54224
|
-
const askShowing = askHandle !== undefined && ask !== undefined && askId === ask.id;
|
|
54225
|
-
const pageOwned = pageOwns();
|
|
54226
|
-
const approvalWins = approval !== undefined && !askShowing;
|
|
54227
|
-
const askAdmitted = ask !== undefined && (askShowing || pageOwned);
|
|
54228
|
-
const key = approvalWins ? `approval:${approval.id}` : askAdmitted ? `ask:${ask.id}` : "";
|
|
54229
|
-
if (key === shown)
|
|
54275
|
+
focusOptions() {
|
|
54276
|
+
const head = this.#asks[0];
|
|
54277
|
+
if (!head || head.phase !== "input")
|
|
54230
54278
|
return;
|
|
54231
|
-
|
|
54232
|
-
|
|
54233
|
-
|
|
54234
|
-
|
|
54235
|
-
|
|
54236
|
-
|
|
54237
|
-
|
|
54238
|
-
const atOpen = key;
|
|
54239
|
-
const approvalId = approval.id;
|
|
54240
|
-
try {
|
|
54241
|
-
dialog.replace(() => createComponent2(ApprovalCard, {
|
|
54242
|
-
get name() {
|
|
54243
|
-
return approval.name;
|
|
54244
|
-
},
|
|
54245
|
-
get args() {
|
|
54246
|
-
return approval.args;
|
|
54247
|
-
},
|
|
54248
|
-
get escalation() {
|
|
54249
|
-
return approval.escalation;
|
|
54250
|
-
},
|
|
54251
|
-
get invalidatedReason() {
|
|
54252
|
-
return approval.invalidatedReason;
|
|
54253
|
-
},
|
|
54254
|
-
onVerdict: (verdict) => {
|
|
54255
|
-
switch (verdict) {
|
|
54256
|
-
case "allowed-once":
|
|
54257
|
-
props.controller.confirmApproval();
|
|
54258
|
-
break;
|
|
54259
|
-
case "always":
|
|
54260
|
-
props.controller.approveAlways();
|
|
54261
|
-
break;
|
|
54262
|
-
case "session":
|
|
54263
|
-
props.controller.approveSession();
|
|
54264
|
-
break;
|
|
54265
|
-
default:
|
|
54266
|
-
props.controller.rejectApproval();
|
|
54267
|
-
}
|
|
54268
|
-
}
|
|
54269
|
-
}), () => {
|
|
54270
|
-
if (shown === atOpen && props.controller.pendingApproval?.id === approvalId) {
|
|
54271
|
-
props.controller.rejectApproval();
|
|
54272
|
-
}
|
|
54273
|
-
}, {
|
|
54274
|
-
key,
|
|
54275
|
-
tone: "warning"
|
|
54276
|
-
});
|
|
54277
|
-
} catch {
|
|
54278
|
-
props.controller.rejectApproval();
|
|
54279
|
-
}
|
|
54279
|
+
this.#backToList(head);
|
|
54280
|
+
this.#changed();
|
|
54281
|
+
}
|
|
54282
|
+
setCursor(row) {
|
|
54283
|
+
const head = this.#asks[0];
|
|
54284
|
+
const question = head?.questions[head.index];
|
|
54285
|
+
if (!head || !question || head.phase === "review")
|
|
54280
54286
|
return;
|
|
54281
|
-
|
|
54282
|
-
|
|
54283
|
-
|
|
54284
|
-
|
|
54285
|
-
|
|
54286
|
-
|
|
54287
|
-
|
|
54288
|
-
|
|
54289
|
-
|
|
54290
|
-
|
|
54291
|
-
|
|
54292
|
-
|
|
54293
|
-
|
|
54294
|
-
|
|
54295
|
-
|
|
54296
|
-
|
|
54297
|
-
|
|
54298
|
-
|
|
54299
|
-
|
|
54300
|
-
|
|
54301
|
-
|
|
54302
|
-
|
|
54303
|
-
|
|
54304
|
-
|
|
54305
|
-
|
|
54306
|
-
|
|
54287
|
+
const needsReview = askNeedsReview(head.questions);
|
|
54288
|
+
const inline = inlineRowIndex(question, needsReview);
|
|
54289
|
+
const next = Math.max(0, Math.min(inline, Math.floor(row)));
|
|
54290
|
+
head.cursors[head.index] = next;
|
|
54291
|
+
head.phase = next === inline ? "input" : "questions";
|
|
54292
|
+
if (next !== inline)
|
|
54293
|
+
head.listCursors[head.index] = next;
|
|
54294
|
+
this.#changed();
|
|
54295
|
+
}
|
|
54296
|
+
moveCursor(delta) {
|
|
54297
|
+
const head = this.#asks[0];
|
|
54298
|
+
const question = head?.questions[head.index];
|
|
54299
|
+
if (!head || !question || head.phase === "review")
|
|
54300
|
+
return;
|
|
54301
|
+
const needsReview = askNeedsReview(head.questions);
|
|
54302
|
+
const last = questionRowCount(question, needsReview) - 1;
|
|
54303
|
+
const next = Math.max(0, Math.min(last, (head.cursors[head.index] ?? 0) + delta));
|
|
54304
|
+
const inline = inlineRowIndex(question, needsReview);
|
|
54305
|
+
head.cursors[head.index] = next;
|
|
54306
|
+
head.phase = next === inline ? "input" : "questions";
|
|
54307
|
+
if (next !== inline)
|
|
54308
|
+
head.listCursors[head.index] = next;
|
|
54309
|
+
this.#changed();
|
|
54310
|
+
}
|
|
54311
|
+
setReviewCursor(row) {
|
|
54312
|
+
const head = this.#asks[0];
|
|
54313
|
+
if (!head || head.phase !== "review")
|
|
54314
|
+
return;
|
|
54315
|
+
const next = Math.max(0, Math.min(head.questions.length, Math.floor(row)));
|
|
54316
|
+
if (next === head.reviewCursor)
|
|
54317
|
+
return;
|
|
54318
|
+
head.reviewCursor = next;
|
|
54319
|
+
this.#changed();
|
|
54320
|
+
}
|
|
54321
|
+
moveReviewCursor(delta) {
|
|
54322
|
+
this.setReviewCursor((this.#asks[0]?.reviewCursor ?? 0) + delta);
|
|
54323
|
+
}
|
|
54324
|
+
#backToList(head) {
|
|
54325
|
+
const question = head.questions[head.index];
|
|
54326
|
+
if (question === undefined)
|
|
54327
|
+
return;
|
|
54328
|
+
if (question.options.length === 0) {
|
|
54329
|
+
head.phase = "input";
|
|
54307
54330
|
return;
|
|
54308
54331
|
}
|
|
54309
|
-
|
|
54310
|
-
|
|
54311
|
-
|
|
54312
|
-
|
|
54313
|
-
|
|
54314
|
-
children: null
|
|
54315
|
-
});
|
|
54316
|
-
}
|
|
54317
|
-
function registerTurnOverlays(seam, controller, options) {
|
|
54318
|
-
if (typeof seam.pendingAsks === "function") {
|
|
54319
|
-
const read = seam.pendingAsks.bind(seam);
|
|
54320
|
-
controller.attachPendingAsks(() => read() ?? []);
|
|
54332
|
+
head.phase = "questions";
|
|
54333
|
+
const inline = inlineRowIndex(question, askNeedsReview(head.questions));
|
|
54334
|
+
const row = Math.max(0, Math.min(inline - 1, head.listCursors[head.index] ?? 0));
|
|
54335
|
+
head.cursors[head.index] = row;
|
|
54336
|
+
head.listCursors[head.index] = row;
|
|
54321
54337
|
}
|
|
54322
|
-
|
|
54323
|
-
|
|
54324
|
-
|
|
54325
|
-
|
|
54326
|
-
|
|
54327
|
-
|
|
54328
|
-
|
|
54329
|
-
|
|
54330
|
-
|
|
54331
|
-
|
|
54338
|
+
enterReview() {
|
|
54339
|
+
const head = this.#asks[0];
|
|
54340
|
+
if (!head || head.phase === "review")
|
|
54341
|
+
return false;
|
|
54342
|
+
if (!askNeedsReview(head.questions))
|
|
54343
|
+
return false;
|
|
54344
|
+
head.phase = "review";
|
|
54345
|
+
head.reviewCursor = 0;
|
|
54346
|
+
this.#changed();
|
|
54347
|
+
return true;
|
|
54348
|
+
}
|
|
54349
|
+
backToQuestions(focus) {
|
|
54350
|
+
const head = this.#asks[0];
|
|
54351
|
+
if (!head || head.phase !== "review")
|
|
54352
|
+
return;
|
|
54353
|
+
head.phase = "questions";
|
|
54354
|
+
if (focus !== undefined && focus >= 0 && focus < head.questions.length)
|
|
54355
|
+
head.index = focus;
|
|
54356
|
+
const question = head.questions[head.index];
|
|
54357
|
+
if (question !== undefined && question.options.length === 0)
|
|
54358
|
+
head.phase = "input";
|
|
54359
|
+
this.#changed();
|
|
54360
|
+
}
|
|
54361
|
+
submit() {
|
|
54362
|
+
const head = this.#asks[0];
|
|
54363
|
+
if (!head)
|
|
54364
|
+
return;
|
|
54365
|
+
this.#asks.shift();
|
|
54366
|
+
head.resolve(this.#envelope(head));
|
|
54367
|
+
this.#changed();
|
|
54368
|
+
}
|
|
54369
|
+
#allAnswered(head) {
|
|
54370
|
+
return head.questions.every((_, qi) => (head.picks[qi]?.length ?? 0) > 0 || head.customs[qi] !== undefined && head.customs[qi] !== "");
|
|
54371
|
+
}
|
|
54372
|
+
#envelope(head) {
|
|
54373
|
+
return head.questions.map((question, qi) => {
|
|
54374
|
+
const custom = head.customs[qi];
|
|
54375
|
+
if (custom !== undefined && custom !== "") {
|
|
54376
|
+
return { questionId: question.id, selected: "", custom };
|
|
54332
54377
|
}
|
|
54333
|
-
|
|
54334
|
-
|
|
54335
|
-
|
|
54336
|
-
|
|
54337
|
-
|
|
54338
|
-
|
|
54378
|
+
const picks = head.picks[qi] ?? [];
|
|
54379
|
+
return {
|
|
54380
|
+
questionId: question.id,
|
|
54381
|
+
selected: picks[0] ?? "",
|
|
54382
|
+
...picks.length > 1 ? { selections: [...picks] } : {}
|
|
54383
|
+
};
|
|
54339
54384
|
});
|
|
54340
54385
|
}
|
|
54341
|
-
|
|
54386
|
+
decline() {
|
|
54387
|
+
const head = this.#asks.shift();
|
|
54388
|
+
if (!head)
|
|
54389
|
+
return;
|
|
54390
|
+
head.resolve([]);
|
|
54391
|
+
this.#changed();
|
|
54392
|
+
}
|
|
54342
54393
|
}
|
|
54343
|
-
var
|
|
54344
|
-
init_index_bun();
|
|
54345
|
-
init_index_bun();
|
|
54346
|
-
init_index_bun();
|
|
54347
|
-
init_index_bun();
|
|
54348
|
-
init_index_bun();
|
|
54349
|
-
init_index_bun();
|
|
54350
|
-
init_index_bun();
|
|
54351
|
-
init_server();
|
|
54352
|
-
init_index_bun();
|
|
54353
|
-
init_dialog_confirm();
|
|
54354
|
-
init_dialog();
|
|
54355
|
-
init_input_ownership();
|
|
54356
|
-
init_theme3();
|
|
54357
|
-
init_i18n();
|
|
54358
|
-
init_motion();
|
|
54359
|
-
init_semantic();
|
|
54360
|
-
init_widgets_dock();
|
|
54361
|
-
init_ask_panel();
|
|
54394
|
+
var init_turn_overlay_controller = __esm(() => {
|
|
54362
54395
|
init_ask_options();
|
|
54363
|
-
init_dock_host();
|
|
54364
54396
|
});
|
|
54365
54397
|
|
|
54366
54398
|
// ../tui-base/src/routes/session/hotkeys.ts
|
|
@@ -54758,12 +54790,19 @@ function coreCommands() {
|
|
|
54758
54790
|
ctx.refreshFooter?.();
|
|
54759
54791
|
return;
|
|
54760
54792
|
}
|
|
54761
|
-
|
|
54793
|
+
let catalog;
|
|
54794
|
+
let current;
|
|
54795
|
+
try {
|
|
54796
|
+
catalog = await ctx.seam.modelCatalog();
|
|
54797
|
+
current = await ctx.seam.currentModelSelection();
|
|
54798
|
+
} catch (error) {
|
|
54799
|
+
ctx.say(t("command.model.unavailable", { reason: seamFailureReason(error) }));
|
|
54800
|
+
return;
|
|
54801
|
+
}
|
|
54762
54802
|
if (catalog.length === 0) {
|
|
54763
54803
|
ctx.say(t("command.model.emptyCatalog"));
|
|
54764
54804
|
return;
|
|
54765
54805
|
}
|
|
54766
|
-
const current = await ctx.seam.currentModelSelection();
|
|
54767
54806
|
const prefs = readModelPrefsFromConfig(ctx.seam.configLoad?.());
|
|
54768
54807
|
let favorites = prefs.favoriteModels;
|
|
54769
54808
|
let hidden = prefs.hiddenModels;
|
|
@@ -63665,7 +63704,7 @@ var init_subagents_viewer = __esm(() => {
|
|
|
63665
63704
|
import { TextAttributes as TextAttributes12 } from "@opentui/core";
|
|
63666
63705
|
function resolveVersion() {
|
|
63667
63706
|
try {
|
|
63668
|
-
return "0.23.
|
|
63707
|
+
return "0.23.2";
|
|
63669
63708
|
} catch {
|
|
63670
63709
|
return "dev";
|
|
63671
63710
|
}
|
|
@@ -68550,7 +68589,6 @@ function V2SessionPageBody(props) {
|
|
|
68550
68589
|
};
|
|
68551
68590
|
const reloadSession = (sessionId) => {
|
|
68552
68591
|
setLastRequest(undefined);
|
|
68553
|
-
setSessionIdFromRecovery(undefined);
|
|
68554
68592
|
composerRef?.resetDeliveries();
|
|
68555
68593
|
setComposerPending([]);
|
|
68556
68594
|
setTools(0);
|
|
@@ -69653,5 +69691,5 @@ export {
|
|
|
69653
69691
|
themeNameFromConfig
|
|
69654
69692
|
};
|
|
69655
69693
|
|
|
69656
|
-
//# debugId=
|
|
69694
|
+
//# debugId=A551D22BBC95CF9464756E2164756E21
|
|
69657
69695
|
//# sourceMappingURL=index.js.map
|