dsh-better-ask-user 0.1.7 → 0.3.0
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/LICENSE +202 -674
- package/NOTICE +23 -1
- package/README.md +23 -4
- package/lib/client.js +772 -360
- package/package.json +14 -13
- package/src/ask-tool.js +7 -1
- package/src/client/AskHistoryRow.module.css +21 -45
- package/src/client/AskHistoryRow.tsx +25 -19
- package/src/client/PlanReviewPanel.module.css +198 -68
- package/src/client/PlanReviewPanel.tsx +69 -13
- package/src/client/QuestionComposer.module.css +289 -357
- package/src/client/QuestionComposer.tsx +92 -85
- package/src/client/QuestionReplyView.module.css +79 -171
- package/src/client/QuestionReplyView.tsx +36 -17
- package/src/client/QuestionWaitBar.module.css +50 -0
- package/src/client/QuestionWaitBar.tsx +39 -0
- package/src/client/contract/slots.ts +19 -4
- package/src/client/index.ts +6 -6
- package/src/client/locales.ts +10 -2
- package/src/client/settings-locales.ts +44 -28
- package/src/client/settings.module.css +119 -0
- package/src/client/settings.tsx +120 -84
- package/src/index.js +2 -14
package/lib/client.js
CHANGED
|
@@ -25,12 +25,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
25
25
|
var index_exports = {};
|
|
26
26
|
__export(index_exports, {
|
|
27
27
|
PendingQuestion: () => PendingQuestion,
|
|
28
|
+
SettingsEntry: () => SettingsEntry,
|
|
28
29
|
apply: () => apply,
|
|
29
30
|
inject: () => inject
|
|
30
31
|
});
|
|
31
32
|
module.exports = __toCommonJS(index_exports);
|
|
32
33
|
|
|
33
|
-
//
|
|
34
|
+
// node_modules/@deepseek-ai/dsh-brand/lib/index.js
|
|
34
35
|
function brandString(value) {
|
|
35
36
|
return value;
|
|
36
37
|
}
|
|
@@ -160,6 +161,7 @@ var PendingQuestion = class _PendingQuestion {
|
|
|
160
161
|
#siblings;
|
|
161
162
|
#listeners = /* @__PURE__ */ new Set();
|
|
162
163
|
#snapshot;
|
|
164
|
+
#requiresDecision;
|
|
163
165
|
#waitMs;
|
|
164
166
|
#timeoutMode = "native";
|
|
165
167
|
#defaultAnswer;
|
|
@@ -173,6 +175,7 @@ var PendingQuestion = class _PendingQuestion {
|
|
|
173
175
|
constructor(sessionId, questions, callId, siblings, review, settings) {
|
|
174
176
|
this.sessionId = sessionId;
|
|
175
177
|
this.questions = questions;
|
|
178
|
+
this.#requiresDecision = questions.some((question) => question.intent?.kind === "plan-review" || question.intent?.kind === "approval");
|
|
176
179
|
this.#waitMs = settings?.waitMs;
|
|
177
180
|
this.#timeoutMode = settings?.timeoutMode ?? "native";
|
|
178
181
|
this.#defaultAnswer = settings?.defaultAnswer;
|
|
@@ -210,6 +213,13 @@ var PendingQuestion = class _PendingQuestion {
|
|
|
210
213
|
this.#listeners.delete(listener);
|
|
211
214
|
};
|
|
212
215
|
};
|
|
216
|
+
/** Apply timing policy when the forwarded request arrives after its projection created the card. */
|
|
217
|
+
configure(settings) {
|
|
218
|
+
this.#waitMs = settings.waitMs;
|
|
219
|
+
this.#timeoutMode = settings.timeoutMode ?? "native";
|
|
220
|
+
this.#defaultAnswer = settings.defaultAnswer;
|
|
221
|
+
this.publish();
|
|
222
|
+
}
|
|
213
223
|
/** Read the stable current card state. */
|
|
214
224
|
snapshot = () => this.#snapshot;
|
|
215
225
|
/** Observable snapshot read by the renderer's keyed Hook. */
|
|
@@ -266,11 +276,12 @@ var PendingQuestion = class _PendingQuestion {
|
|
|
266
276
|
*/
|
|
267
277
|
attachWaterfall(channel) {
|
|
268
278
|
this.#waterfall = channel;
|
|
269
|
-
|
|
279
|
+
const deadline = this.#requiresDecision ? void 0 : channel.deadline;
|
|
280
|
+
this.#timedWait = deadline !== void 0;
|
|
270
281
|
if (!this.#held && !this.#engaged) {
|
|
271
|
-
this.#deadline =
|
|
272
|
-
if (this.#focused &&
|
|
273
|
-
this.#remainingMs = Math.max(0,
|
|
282
|
+
this.#deadline = deadline;
|
|
283
|
+
if (this.#focused && deadline !== void 0) {
|
|
284
|
+
this.#remainingMs = Math.max(0, deadline - Date.now());
|
|
274
285
|
this.#deadline = void 0;
|
|
275
286
|
}
|
|
276
287
|
}
|
|
@@ -379,6 +390,7 @@ var PendingQuestion = class _PendingQuestion {
|
|
|
379
390
|
}
|
|
380
391
|
/** Settle with the host-authored default answer in default timeout mode. */
|
|
381
392
|
autoSelect() {
|
|
393
|
+
if (this.#requiresDecision) return;
|
|
382
394
|
if (this.#held || this.#engaged || this.#focused) return;
|
|
383
395
|
const channel = this.#waterfall;
|
|
384
396
|
if (channel === void 0) return;
|
|
@@ -395,6 +407,7 @@ var PendingQuestion = class _PendingQuestion {
|
|
|
395
407
|
}
|
|
396
408
|
/** Local countdown reached zero: default-select or settle with `ASK_TIMED_OUT`. */
|
|
397
409
|
timeout() {
|
|
410
|
+
if (this.#requiresDecision) return;
|
|
398
411
|
if (this.#held || this.#engaged || this.#focused) return;
|
|
399
412
|
if (this.#timeoutMode === "default" && this.#defaultAnswer !== void 0) {
|
|
400
413
|
this.autoSelect();
|
|
@@ -484,10 +497,11 @@ function createQuestionDraftStore() {
|
|
|
484
497
|
}
|
|
485
498
|
|
|
486
499
|
// src/client/AskHistoryRow.tsx
|
|
500
|
+
var import_react = require("react");
|
|
487
501
|
var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
488
502
|
|
|
489
503
|
// src/client/AskHistoryRow.module.css
|
|
490
|
-
var css = ".
|
|
504
|
+
var css = "/* src/client/AskHistoryRow.module.css */\n.AskHistoryRow_frame {\n --cfg-line: var(--dsw-alias-border-l2);\n --cfg-ink: var(--dsw-alias-label-primary);\n --cfg-muted: var(--dsw-alias-label-secondary);\n --cfg-accent: #3388bb;\n --cfg-accent-text: #14587f;\n --cfg-hover: var(--dsw-alias-interactive-bg-hover);\n min-width: 0;\n}\n.AskHistoryRow_row {\n appearance: none;\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n min-height: 32px;\n min-width: 0;\n padding: 4px 8px;\n border: 0;\n border-radius: 8px;\n background: transparent;\n color: var(--cfg-muted);\n font: inherit;\n line-height: 20px;\n text-align: left;\n}\nbutton.AskHistoryRow_row {\n cursor: pointer;\n transition: background-color 140ms ease, color 140ms ease;\n}\nbutton.AskHistoryRow_row:hover {\n background: var(--cfg-hover);\n color: var(--cfg-ink);\n}\nbutton.AskHistoryRow_row:active {\n background: color-mix(in srgb, var(--cfg-accent) 9%, transparent);\n}\nbutton.AskHistoryRow_row:focus-visible {\n outline: 2px solid var(--cfg-accent);\n outline-offset: -2px;\n}\n.AskHistoryRow_icon {\n display: inline-flex;\n flex: none;\n color: var(--dsw-alias-label-tertiary);\n}\n.AskHistoryRow_icon svg {\n width: 14px;\n height: 14px;\n}\n.AskHistoryRow_summary {\n min-width: 0;\n flex: 1;\n overflow: hidden;\n color: var(--cfg-ink);\n font-size: 13px;\n line-height: 20px;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.AskHistoryRow_open {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n flex: none;\n color: var(--cfg-muted);\n font-size: 11px;\n line-height: 18px;\n white-space: nowrap;\n}\n.AskHistoryRow_error {\n display: block;\n padding: 4px 8px 4px 30px;\n color: var(--dsw-alias-state-error-primary);\n font-size: 12px;\n line-height: 18px;\n overflow-wrap: anywhere;\n}\n@media (pointer: coarse) {\n .AskHistoryRow_row {\n min-height: 44px;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n button.AskHistoryRow_row {\n transition: none;\n }\n}\n[data-ds-dark-theme] .AskHistoryRow_frame {\n --cfg-accent: #4eb0e8;\n --cfg-accent-text: #6fc0ee;\n}\n";
|
|
491
505
|
var id = "dsh-better-ask-user/AskHistoryRow.module.css";
|
|
492
506
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(id) + "]") === null) {
|
|
493
507
|
const tag = document.createElement("style");
|
|
@@ -496,7 +510,15 @@ if (typeof document !== "undefined" && document.querySelector("style[data-plugin
|
|
|
496
510
|
tag.textContent = css;
|
|
497
511
|
document.head.appendChild(tag);
|
|
498
512
|
}
|
|
499
|
-
var AskHistoryRow_default = {
|
|
513
|
+
var AskHistoryRow_default = {
|
|
514
|
+
frame: "AskHistoryRow_frame",
|
|
515
|
+
row: "AskHistoryRow_row",
|
|
516
|
+
icon: "AskHistoryRow_icon",
|
|
517
|
+
summary: "AskHistoryRow_summary",
|
|
518
|
+
open: "AskHistoryRow_open",
|
|
519
|
+
error: "AskHistoryRow_error"
|
|
520
|
+
};
|
|
521
|
+
var css_modules_entry_default = AskHistoryRow_default;
|
|
500
522
|
|
|
501
523
|
// src/client/AskHistoryRow.tsx
|
|
502
524
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -528,13 +550,14 @@ function questionList(argsRaw) {
|
|
|
528
550
|
id: candidate.id,
|
|
529
551
|
question: candidate.question,
|
|
530
552
|
...typeof candidate.header === "string" ? { header: candidate.header } : {},
|
|
553
|
+
...typeof candidate.detail === "string" ? { detail: candidate.detail } : {},
|
|
531
554
|
...Array.isArray(candidate.options) ? {
|
|
532
555
|
options: candidate.options.flatMap((option) => isRecord(option) && typeof option.label === "string" ? [{
|
|
533
556
|
label: option.label,
|
|
534
557
|
...typeof option.description === "string" ? { description: option.description } : {}
|
|
535
558
|
}] : [])
|
|
536
559
|
} : {},
|
|
537
|
-
...typeof candidate.multi_select === "boolean" ? {
|
|
560
|
+
...typeof candidate.multi_select === "boolean" ? { multiSelect: candidate.multi_select } : {}
|
|
538
561
|
});
|
|
539
562
|
}
|
|
540
563
|
return questions;
|
|
@@ -567,6 +590,7 @@ function AskHistoryRow({
|
|
|
567
590
|
reviewPanel,
|
|
568
591
|
t
|
|
569
592
|
}) {
|
|
593
|
+
const [failedAction, setFailedAction] = (0, import_react.useState)(null);
|
|
570
594
|
const argsRaw = "kind" in block ? block.call?.argsRaw ?? "" : block.argsRaw;
|
|
571
595
|
const output = "kind" in block ? resultText(block.content) : void 0;
|
|
572
596
|
const questions = questionList(argsRaw);
|
|
@@ -574,32 +598,39 @@ function AskHistoryRow({
|
|
|
574
598
|
const record = questions !== void 0 && answers !== void 0 ? { questions, answers } : void 0;
|
|
575
599
|
const summary = questions?.[0]?.question.split("\n").find((line) => line.trim() !== "")?.trim() ?? t("history.title");
|
|
576
600
|
const review = record !== void 0;
|
|
577
|
-
const action = review ? () =>
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
601
|
+
const action = review ? () => reviewPanel(callId, record) : isPending(output) || phase === "start" ? () => revealPanel(callId) : void 0;
|
|
602
|
+
const actionKey = `${callId}-${review ? "review" : "open"}`;
|
|
603
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
604
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css_modules_entry_default.icon, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconQuestionOutlineRegular, {}) }),
|
|
605
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css_modules_entry_default.summary, title: summary, children: summary }),
|
|
606
|
+
action !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: css_modules_entry_default.open, children: [
|
|
607
|
+
review ? t("history.review") : t("history.reopen"),
|
|
608
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconChevronRightOutlineRegular, { size: 14 })
|
|
609
|
+
] })
|
|
610
|
+
] });
|
|
611
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css_modules_entry_default.frame, role: "group", "aria-label": t("history.title"), children: [
|
|
612
|
+
action === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: css_modules_entry_default.row, "data-question-history": callId, children: content }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
587
613
|
"button",
|
|
588
614
|
{
|
|
589
615
|
type: "button",
|
|
590
|
-
className:
|
|
591
|
-
|
|
592
|
-
"
|
|
593
|
-
|
|
616
|
+
className: css_modules_entry_default.row,
|
|
617
|
+
"data-question-history": callId,
|
|
618
|
+
"data-history-action": review ? "review" : "open",
|
|
619
|
+
onClick: () => {
|
|
620
|
+
setFailedAction(action() ? null : actionKey);
|
|
621
|
+
},
|
|
622
|
+
"aria-label": `${review ? t("history.review") : t("history.reopen")} \xB7 ${summary}`,
|
|
623
|
+
children: content
|
|
594
624
|
}
|
|
595
|
-
)
|
|
625
|
+
),
|
|
626
|
+
failedAction === actionKey && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css_modules_entry_default.error, role: "alert", children: t("history.unavailable") })
|
|
596
627
|
] });
|
|
597
628
|
}
|
|
598
629
|
|
|
599
630
|
// src/client/QuestionComposer.tsx
|
|
600
|
-
var
|
|
631
|
+
var import_react4 = require("react");
|
|
601
632
|
|
|
602
|
-
//
|
|
633
|
+
// node_modules/clsx/dist/clsx.mjs
|
|
603
634
|
function r(e) {
|
|
604
635
|
var t, f, n = "";
|
|
605
636
|
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
@@ -619,12 +650,15 @@ var clsx_default = clsx;
|
|
|
619
650
|
var import_dsh_client_ui_primitives3 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
620
651
|
|
|
621
652
|
// src/client/PlanReviewPanel.tsx
|
|
622
|
-
var
|
|
653
|
+
var import_react3 = require("react");
|
|
623
654
|
var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
624
655
|
|
|
625
|
-
// src/client/
|
|
626
|
-
var
|
|
627
|
-
|
|
656
|
+
// src/client/QuestionWaitBar.tsx
|
|
657
|
+
var import_react2 = require("react");
|
|
658
|
+
|
|
659
|
+
// src/client/QuestionWaitBar.module.css
|
|
660
|
+
var css2 = "/* src/client/QuestionWaitBar.module.css */\n.QuestionWaitBar_bar {\n --ui-accent: #3388bb;\n --ui-accent-text: #14587f;\n --ui-ink-1: var(--dsw-alias-label-primary, #0f1115);\n --ui-ink-2: var(--dsw-alias-label-secondary, #61666b);\n --ui-ink-3: var(--dsw-alias-label-tertiary, #81858c);\n --ui-line-1: var(--dsw-alias-border-l1, #0000000a);\n --ui-line-2: var(--dsw-alias-border-l2, #0000001a);\n --ui-raised: var(--dsw-alias-bg-layer-2, #fff);\n --ui-hover: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, var(--ui-ink-1) 5%, transparent));\n display: flex;\n align-items: center;\n flex-shrink: 0;\n gap: 8px;\n min-width: 0;\n min-height: 36px;\n margin: 0 16px 10px;\n padding: 4px 6px 4px 10px;\n border: 1px solid var(--ui-line-2);\n border-radius: 8px;\n background: var(--ui-raised);\n color: var(--ui-ink-1);\n}\n.QuestionWaitBar_clock {\n position: relative;\n display: grid;\n place-items: center;\n width: 24px;\n height: 24px;\n flex: none;\n}\n.QuestionWaitBar_ring {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n fill: none;\n stroke-width: 2;\n transform: rotate(-90deg);\n}\n.QuestionWaitBar_track {\n stroke: var(--ui-line-2);\n}\n.QuestionWaitBar_remaining {\n stroke: var(--ui-accent);\n}\n.QuestionWaitBar_clockHand {\n width: 8px;\n height: 9px;\n margin-top: -4px;\n margin-left: 5px;\n border-left: 1.5px solid var(--ui-ink-2);\n border-bottom: 1.5px solid var(--ui-ink-2);\n}\n.QuestionWaitBar_pause {\n width: 16px;\n height: 16px;\n color: var(--ui-ink-2);\n}\n.QuestionWaitBar_status {\n display: flex;\n align-items: center;\n min-width: 0;\n}\n.QuestionWaitBar_time {\n color: var(--ui-ink-1);\n font-size: 12px;\n line-height: 20px;\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n}\n.QuestionWaitBar_bar[data-wait-state=counting] .QuestionWaitBar_time {\n font-weight: 500;\n}\n.QuestionWaitBar_takeTime {\n appearance: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n margin-left: auto;\n min-height: 28px;\n padding: 0 10px;\n border: 0;\n border-radius: 6px;\n background: transparent;\n color: var(--ui-ink-3);\n font: inherit;\n font-size: 12px;\n line-height: 18px;\n font-weight: 500;\n cursor: pointer;\n transition: background-color 140ms ease, color 140ms ease;\n}\n.QuestionWaitBar_takeTime:hover:not(:disabled) {\n background: var(--ui-hover);\n color: var(--ui-ink-1);\n}\n.QuestionWaitBar_takeTime:focus-visible {\n outline: 2px solid var(--ui-accent);\n outline-offset: 2px;\n}\n.QuestionWaitBar_takeTime:disabled {\n opacity: .4;\n cursor: default;\n}\n@media (max-width: 720px) {\n .QuestionWaitBar_bar {\n margin: 0 12px 8px;\n padding: 4px 6px 4px 8px;\n }\n}\n@media (pointer: coarse) {\n .QuestionWaitBar_takeTime {\n min-height: 44px;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .QuestionWaitBar_takeTime {\n transition: none;\n }\n}\n[data-ds-dark-theme] .QuestionWaitBar_bar {\n --ui-accent: #4eb0e8;\n --ui-accent-text: #6fc0ee;\n}\n";
|
|
661
|
+
var id2 = "dsh-better-ask-user/QuestionWaitBar.module.css";
|
|
628
662
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(id2) + "]") === null) {
|
|
629
663
|
const tag = document.createElement("style");
|
|
630
664
|
tag.dataset.plugin = "dsh-better-ask-user";
|
|
@@ -632,19 +666,122 @@ if (typeof document !== "undefined" && document.querySelector("style[data-plugin
|
|
|
632
666
|
tag.textContent = css2;
|
|
633
667
|
document.head.appendChild(tag);
|
|
634
668
|
}
|
|
635
|
-
var
|
|
669
|
+
var QuestionWaitBar_default = {
|
|
670
|
+
bar: "QuestionWaitBar_bar",
|
|
671
|
+
clock: "QuestionWaitBar_clock",
|
|
672
|
+
ring: "QuestionWaitBar_ring",
|
|
673
|
+
track: "QuestionWaitBar_track",
|
|
674
|
+
remaining: "QuestionWaitBar_remaining",
|
|
675
|
+
clockHand: "QuestionWaitBar_clockHand",
|
|
676
|
+
pause: "QuestionWaitBar_pause",
|
|
677
|
+
status: "QuestionWaitBar_status",
|
|
678
|
+
time: "QuestionWaitBar_time",
|
|
679
|
+
takeTime: "QuestionWaitBar_takeTime"
|
|
680
|
+
};
|
|
681
|
+
var css_modules_entry_default2 = QuestionWaitBar_default;
|
|
636
682
|
|
|
637
|
-
// src/client/
|
|
683
|
+
// src/client/QuestionWaitBar.tsx
|
|
638
684
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
685
|
+
function QuestionWaitBar({ card, t, busy, onTakeTime }) {
|
|
686
|
+
const countdown = card?.countdown;
|
|
687
|
+
const initialWindow = (0, import_react2.useRef)(countdown?.remainingMs);
|
|
688
|
+
if (card === void 0 || countdown === void 0 && card.state !== "continued") return null;
|
|
689
|
+
const continued = card.state === "continued";
|
|
690
|
+
const held = card.waitState === "waiting" || card.waitState === "editing";
|
|
691
|
+
const running = !held && !continued && countdown?.running === true;
|
|
692
|
+
const seconds = Math.max(0, Math.ceil((countdown?.remainingMs ?? 0) / 1e3));
|
|
693
|
+
const duration = card.waitMs ?? initialWindow.current;
|
|
694
|
+
const fraction = duration === void 0 || duration <= 0 ? void 0 : Math.min(1, Math.max(0, (countdown?.remainingMs ?? 0) / duration));
|
|
695
|
+
const status = continued ? t("wait.continued") : held ? t("wait.held") : t(!running ? "wait.paused" : card.timeoutMode === "default" ? "wait.autoCountdown" : "wait.countdown", { seconds });
|
|
696
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: css_modules_entry_default2.bar, "data-question-wait": true, "data-wait-state": continued ? "continued" : held ? "held" : running ? "counting" : "paused", children: [
|
|
697
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: css_modules_entry_default2.clock, "aria-hidden": "true", children: [
|
|
698
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { viewBox: "0 0 32 32", className: css_modules_entry_default2.ring, children: [
|
|
699
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { className: css_modules_entry_default2.track, cx: "16", cy: "16", r: "13" }),
|
|
700
|
+
!held && !continued && fraction !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { className: css_modules_entry_default2.remaining, cx: "16", cy: "16", r: "13", pathLength: "100", strokeDasharray: "100", strokeDashoffset: 100 * (1 - fraction) })
|
|
701
|
+
] }),
|
|
702
|
+
!running ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { className: css_modules_entry_default2.pause, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: continued ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m3 8 3 3 7-7" }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M6 4v8M10 4v8" }) }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: css_modules_entry_default2.clockHand })
|
|
703
|
+
] }),
|
|
704
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: css_modules_entry_default2.status, role: held || continued ? "status" : void 0, "aria-atomic": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: css_modules_entry_default2.time, "aria-label": status, children: held || continued ? status : `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, "0")}` }) }),
|
|
705
|
+
!held && !continued && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: css_modules_entry_default2.takeTime, disabled: busy, onClick: onTakeTime, children: t("wait.takeTime") })
|
|
706
|
+
] });
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
// src/client/PlanReviewPanel.module.css
|
|
710
|
+
var css3 = "/* src/client/PlanReviewPanel.module.css */\n.PlanReviewPanel_frame {\n --cfg-line: var(--dsw-alias-border-l2);\n --cfg-line-strong: var(--dsw-alias-border-l3);\n --cfg-surface: var(--dsw-alias-bg-layer-2);\n --cfg-sunken: color-mix(in srgb, var(--dsw-alias-label-primary) 4%, var(--dsw-alias-bg-layer-1));\n --cfg-ink: var(--dsw-alias-label-primary);\n --cfg-muted: var(--dsw-alias-label-secondary);\n --cfg-accent: #3388bb;\n --cfg-accent-text: #14587f;\n --cfg-hover: var(--dsw-alias-interactive-bg-hover);\n --cfg-danger: var(--dsw-alias-state-error-primary);\n --cfg-solid: #20709e;\n --cfg-solid-hover: #1c638d;\n --cfg-on-solid: #fff;\n display: flex;\n justify-content: center;\n padding: 6px calc(var(--dsh-composer-side-clearance) + 16px) calc(10px + env(safe-area-inset-bottom));\n}\n.PlanReviewPanel_card {\n display: flex;\n flex-direction: column;\n width: 100%;\n min-width: 0;\n max-width: var(--dsh-chat-content-width);\n max-height: min(75vh, 640px);\n max-height: min(75dvh, 640px);\n overflow: hidden;\n border: 1px solid var(--cfg-line);\n border-top-color: var(--cfg-accent);\n border-radius: 12px;\n background: var(--cfg-surface);\n color: var(--cfg-ink);\n --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2);\n --dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2);\n}\n.PlanReviewPanel_card,\n.PlanReviewPanel_card * {\n box-sizing: border-box;\n}\n.PlanReviewPanel_strip {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n flex-wrap: wrap;\n gap: 8px;\n min-width: 0;\n padding: 8px 12px 8px 16px;\n border-bottom: 1px solid var(--cfg-line);\n}\n.PlanReviewPanel_panelLabel {\n display: inline-flex;\n align-items: center;\n height: 20px;\n padding: 0 7px;\n border: 1px solid var(--cfg-line);\n border-radius: 999px;\n background: var(--cfg-sunken);\n color: var(--cfg-muted);\n font-size: 11px;\n line-height: 18px;\n font-weight: 500;\n white-space: nowrap;\n}\n.PlanReviewPanel_previewActions {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 4px;\n min-width: 0;\n margin-left: auto;\n}\n.PlanReviewPanel_summary {\n min-width: 0;\n min-height: 0;\n overflow-y: auto;\n overscroll-behavior: contain;\n scrollbar-gutter: stable;\n padding: 12px 16px;\n}\n.PlanReviewPanel_documentHeading {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n}\n.PlanReviewPanel_documentIcon {\n flex: none;\n width: 18px;\n height: 20px;\n color: var(--dsw-alias-label-tertiary);\n}\n.PlanReviewPanel_title,\n.PlanReviewPanel_description {\n min-width: 0;\n overflow-wrap: anywhere;\n word-break: break-word;\n}\n.PlanReviewPanel_title {\n margin: 0;\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n}\n.PlanReviewPanel_description {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n margin: 4px 0 0;\n color: var(--cfg-muted);\n font-size: 12px;\n line-height: 18px;\n}\n.PlanReviewPanel_footer {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n flex-shrink: 0;\n flex-wrap: wrap;\n gap: 8px 12px;\n padding: 8px 12px;\n border-top: 1px solid var(--cfg-line);\n}\n.PlanReviewPanel_feedback {\n flex: 1;\n min-width: 0;\n display: flex;\n align-items: center;\n gap: 6px;\n color: var(--cfg-muted);\n font-size: 12px;\n line-height: 18px;\n overflow-wrap: anywhere;\n}\n.PlanReviewPanel_feedback[data-error] {\n color: var(--cfg-danger);\n}\n.PlanReviewPanel_discuss,\n.PlanReviewPanel_primary,\n.PlanReviewPanel_decline {\n appearance: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n height: 32px;\n padding: 0 12px;\n border: 1px solid var(--cfg-line);\n border-radius: 8px;\n background: var(--cfg-surface);\n color: var(--cfg-ink);\n box-shadow: none;\n font: inherit;\n font-size: 13px;\n font-weight: 500;\n cursor: pointer;\n transition:\n background-color 140ms ease,\n border-color 140ms ease,\n color 140ms ease;\n}\n.PlanReviewPanel_discuss:hover:not(:disabled) {\n background: var(--cfg-hover);\n}\n.PlanReviewPanel_primary {\n border-color: transparent;\n background: var(--cfg-solid);\n color: var(--cfg-on-solid);\n}\n.PlanReviewPanel_primary:hover:not(:disabled) {\n background: var(--cfg-solid-hover);\n}\n.PlanReviewPanel_spinner {\n flex: none;\n width: 12px;\n height: 12px;\n border: 1px solid currentColor;\n border-right-color: transparent;\n border-radius: 50%;\n animation: PlanReviewPanel_spin 800ms linear infinite;\n}\n@keyframes PlanReviewPanel_spin {\n to {\n transform: rotate(360deg);\n }\n}\n.PlanReviewPanel_feedback:empty {\n display: none;\n}\n.PlanReviewPanel_actions {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 8px;\n}\n.PlanReviewPanel_decline {\n min-height: 32px;\n padding: 0 12px;\n border: 0;\n border-radius: 8px;\n background: transparent;\n color: var(--cfg-muted);\n font: inherit;\n font-size: 13px;\n line-height: 20px;\n cursor: pointer;\n}\n.PlanReviewPanel_decline:hover:not(:disabled),\n.PlanReviewPanel_decline:active:not(:disabled) {\n background: var(--cfg-hover);\n color: var(--cfg-ink);\n}\n.PlanReviewPanel_discuss {\n gap: 6px;\n}\n.PlanReviewPanel_card button:focus-visible {\n outline: 2px solid var(--cfg-accent);\n outline-offset: -2px;\n}\n.PlanReviewPanel_card button:disabled {\n opacity: 0.4;\n cursor: default;\n}\n.PlanReviewPanel_srOnly {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n padding: 0;\n border: 0;\n clip-path: inset(50%);\n white-space: nowrap;\n}\n@media (max-width: 720px) {\n .PlanReviewPanel_card {\n max-height: calc(100vh - 160px);\n max-height: calc(100dvh - 160px);\n }\n .PlanReviewPanel_strip {\n padding: 8px 12px;\n }\n .PlanReviewPanel_summary {\n padding: 12px;\n }\n .PlanReviewPanel_footer {\n padding: 8px;\n }\n .PlanReviewPanel_feedback {\n flex: 1 1 100%;\n }\n}\n@media (max-width: 420px) {\n .PlanReviewPanel_actions {\n display: grid;\n grid-template-columns: 1fr 1fr;\n width: 100%;\n gap: 8px;\n }\n .PlanReviewPanel_decline {\n grid-column: 1 / -1;\n justify-content: flex-start;\n }\n .PlanReviewPanel_actions > button {\n flex: none;\n width: 100%;\n }\n .PlanReviewPanel_discuss,\n .PlanReviewPanel_primary,\n .PlanReviewPanel_decline {\n white-space: nowrap;\n }\n}\n@media (pointer: coarse) {\n .PlanReviewPanel_card button {\n min-height: 44px;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .PlanReviewPanel_spinner {\n animation: none;\n }\n}\n[data-ds-dark-theme] .PlanReviewPanel_frame {\n --cfg-accent: #4eb0e8;\n --cfg-accent-text: #6fc0ee;\n --cfg-solid: #4eb0e8;\n --cfg-solid-hover: #6fc0ee;\n --cfg-on-solid: #0e1014;\n}\n";
|
|
711
|
+
var id3 = "dsh-better-ask-user/PlanReviewPanel.module.css";
|
|
712
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(id3) + "]") === null) {
|
|
713
|
+
const tag = document.createElement("style");
|
|
714
|
+
tag.dataset.plugin = "dsh-better-ask-user";
|
|
715
|
+
tag.dataset.pluginCss = id3;
|
|
716
|
+
tag.textContent = css3;
|
|
717
|
+
document.head.appendChild(tag);
|
|
718
|
+
}
|
|
719
|
+
var PlanReviewPanel_default = {
|
|
720
|
+
frame: "PlanReviewPanel_frame",
|
|
721
|
+
card: "PlanReviewPanel_card",
|
|
722
|
+
strip: "PlanReviewPanel_strip",
|
|
723
|
+
panelLabel: "PlanReviewPanel_panelLabel",
|
|
724
|
+
previewActions: "PlanReviewPanel_previewActions",
|
|
725
|
+
summary: "PlanReviewPanel_summary",
|
|
726
|
+
documentHeading: "PlanReviewPanel_documentHeading",
|
|
727
|
+
documentIcon: "PlanReviewPanel_documentIcon",
|
|
728
|
+
title: "PlanReviewPanel_title",
|
|
729
|
+
description: "PlanReviewPanel_description",
|
|
730
|
+
footer: "PlanReviewPanel_footer",
|
|
731
|
+
feedback: "PlanReviewPanel_feedback",
|
|
732
|
+
discuss: "PlanReviewPanel_discuss",
|
|
733
|
+
primary: "PlanReviewPanel_primary",
|
|
734
|
+
decline: "PlanReviewPanel_decline",
|
|
735
|
+
spinner: "PlanReviewPanel_spinner",
|
|
736
|
+
spin: "PlanReviewPanel_spin",
|
|
737
|
+
actions: "PlanReviewPanel_actions",
|
|
738
|
+
srOnly: "PlanReviewPanel_srOnly"
|
|
739
|
+
};
|
|
740
|
+
var css_modules_entry_default3 = PlanReviewPanel_default;
|
|
741
|
+
|
|
742
|
+
// src/client/PlanReviewPanel.tsx
|
|
743
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
639
744
|
function tooltip(description) {
|
|
640
745
|
return description === void 0 ? {} : { title: description };
|
|
641
746
|
}
|
|
642
|
-
function PlanReviewPanel({ pending, review, t, renderSlot }) {
|
|
643
|
-
const [busy, setBusy] = (0,
|
|
644
|
-
const [error, setError] = (0,
|
|
747
|
+
function PlanReviewPanel({ pending, review, t, renderSlot, useQuestionCard }) {
|
|
748
|
+
const [busy, setBusy] = (0, import_react3.useState)(false);
|
|
749
|
+
const [error, setError] = (0, import_react3.useState)(null);
|
|
750
|
+
const card = useQuestionCard(pending.key, (snapshot) => snapshot);
|
|
751
|
+
const canDecide = card !== void 0 && !card.closed && card.channel !== "none";
|
|
752
|
+
const surface = (0, import_react3.useRef)(null);
|
|
753
|
+
const sentVia = (0, import_react3.useRef)(null);
|
|
754
|
+
(0, import_react3.useEffect)(() => {
|
|
755
|
+
if (sentVia.current !== "waterfall" || card?.state !== "continued") return;
|
|
756
|
+
sentVia.current = null;
|
|
757
|
+
setBusy(false);
|
|
758
|
+
setError(t("error.resubmit"));
|
|
759
|
+
}, [card?.state, t]);
|
|
760
|
+
(0, import_react3.useEffect)(() => {
|
|
761
|
+
const release = () => {
|
|
762
|
+
pending.releaseFocus();
|
|
763
|
+
};
|
|
764
|
+
const refocus = () => {
|
|
765
|
+
if (surface.current?.contains(document.activeElement) === true) pending.holdFocus();
|
|
766
|
+
};
|
|
767
|
+
const visibilityChanged = () => {
|
|
768
|
+
if (document.hidden) release();
|
|
769
|
+
else refocus();
|
|
770
|
+
};
|
|
771
|
+
window.addEventListener("blur", release);
|
|
772
|
+
window.addEventListener("focus", refocus);
|
|
773
|
+
document.addEventListener("visibilitychange", visibilityChanged);
|
|
774
|
+
return () => {
|
|
775
|
+
release();
|
|
776
|
+
window.removeEventListener("blur", release);
|
|
777
|
+
window.removeEventListener("focus", refocus);
|
|
778
|
+
document.removeEventListener("visibilitychange", visibilityChanged);
|
|
779
|
+
};
|
|
780
|
+
}, [pending]);
|
|
645
781
|
const settle = (send, remote = false) => {
|
|
646
782
|
setBusy(true);
|
|
647
783
|
setError(null);
|
|
784
|
+
sentVia.current = pending.snapshot().channel === "waterfall" ? "waterfall" : null;
|
|
648
785
|
void send().then(() => {
|
|
649
786
|
if (!remote) return;
|
|
650
787
|
setBusy(false);
|
|
@@ -652,6 +789,7 @@ function PlanReviewPanel({ pending, review, t, renderSlot }) {
|
|
|
652
789
|
setError(t("status.sent"));
|
|
653
790
|
});
|
|
654
791
|
}).catch((cause) => {
|
|
792
|
+
sentVia.current = null;
|
|
655
793
|
setBusy(false);
|
|
656
794
|
setError(cause instanceof Error ? cause.message : String(cause));
|
|
657
795
|
});
|
|
@@ -659,68 +797,155 @@ function PlanReviewPanel({ pending, review, t, renderSlot }) {
|
|
|
659
797
|
const decide = (label) => {
|
|
660
798
|
settle(() => pending.answer({ answers: [{ id: review.id, selected: [label] }] }), pending.snapshot().channel === "rpc");
|
|
661
799
|
};
|
|
662
|
-
const
|
|
800
|
+
const decline = review.decline;
|
|
801
|
+
const summary = (0, import_react3.useMemo)(() => {
|
|
663
802
|
const title = (0, import_dsh_client_ui_primitives2.extractMarkdownPlainText)(review.plan, { mode: "first-line" });
|
|
664
803
|
const description = (0, import_dsh_client_ui_primitives2.extractMarkdownPlainText)(review.plan, { mode: "first-paragraph" });
|
|
665
804
|
return { title, description: description === title ? "" : description };
|
|
666
805
|
}, [review.plan]);
|
|
667
|
-
return /* @__PURE__ */ (0,
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
{
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
children:
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: css_modules_entry_default3.frame, "data-plan-review-key": pending.key, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
807
|
+
"section",
|
|
808
|
+
{
|
|
809
|
+
ref: surface,
|
|
810
|
+
className: css_modules_entry_default3.card,
|
|
811
|
+
"aria-label": review.question,
|
|
812
|
+
"aria-busy": busy,
|
|
813
|
+
onFocusCapture: (event) => {
|
|
814
|
+
if (!event.currentTarget.contains(event.relatedTarget)) pending.holdFocus();
|
|
815
|
+
},
|
|
816
|
+
onBlurCapture: (event) => {
|
|
817
|
+
if (!event.currentTarget.contains(event.relatedTarget)) pending.releaseFocus();
|
|
818
|
+
},
|
|
819
|
+
children: [
|
|
820
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css_modules_entry_default3.strip, children: [
|
|
821
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css_modules_entry_default3.panelLabel, children: t("plan.header") }),
|
|
822
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: css_modules_entry_default3.previewActions, children: renderSlot("conversation.plan-review.actions", { review, requestKey: pending.key }) })
|
|
823
|
+
] }),
|
|
824
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(QuestionWaitBar, { card, t, busy, onTakeTime: () => {
|
|
825
|
+
pending.takeTime();
|
|
826
|
+
} }),
|
|
827
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css_modules_entry_default3.summary, "data-plan-document": true, children: [
|
|
828
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css_modules_entry_default3.documentHeading, children: [
|
|
829
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { className: css_modules_entry_default3.documentIcon, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M14 3H6a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8zM14 3v5h5M9 12h6M9 16h6" }) }),
|
|
830
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { className: css_modules_entry_default3.title, children: summary.title })
|
|
831
|
+
] }),
|
|
832
|
+
summary.description !== "" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css_modules_entry_default3.description, children: summary.description })
|
|
833
|
+
] }),
|
|
834
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css_modules_entry_default3.footer, "data-plan-decision": true, children: [
|
|
835
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css_modules_entry_default3.feedback, role: error === null ? "status" : "alert", "aria-atomic": "true", "data-error": error !== null || void 0, children: [
|
|
836
|
+
busy && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css_modules_entry_default3.spinner, "aria-hidden": "true" }),
|
|
837
|
+
error ?? (busy ? t("submitting") : null)
|
|
838
|
+
] }),
|
|
839
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css_modules_entry_default3.actions, children: [
|
|
840
|
+
decline !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
841
|
+
"button",
|
|
842
|
+
{
|
|
843
|
+
type: "button",
|
|
844
|
+
className: css_modules_entry_default3.decline,
|
|
845
|
+
...tooltip(decline.description),
|
|
846
|
+
"aria-describedby": decline.description === void 0 ? void 0 : `plan-decline-${pending.key}`,
|
|
847
|
+
disabled: busy || !canDecide,
|
|
848
|
+
onClick: () => {
|
|
849
|
+
decide(decline.label);
|
|
850
|
+
},
|
|
851
|
+
children: decline.label
|
|
852
|
+
}
|
|
853
|
+
),
|
|
854
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
855
|
+
import_dsh_client_ui_primitives2.Button,
|
|
856
|
+
{
|
|
857
|
+
variant: "outline",
|
|
858
|
+
className: css_modules_entry_default3.discuss,
|
|
859
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.IconEditOutlineRegular, { size: 14 }),
|
|
860
|
+
disabled: busy,
|
|
861
|
+
onClick: () => {
|
|
862
|
+
settle(() => pending.dismiss());
|
|
863
|
+
},
|
|
864
|
+
children: t("plan.discuss")
|
|
865
|
+
}
|
|
866
|
+
),
|
|
867
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
868
|
+
import_dsh_client_ui_primitives2.Button,
|
|
869
|
+
{
|
|
870
|
+
variant: "primary",
|
|
871
|
+
className: css_modules_entry_default3.primary,
|
|
872
|
+
...tooltip(review.approve.description),
|
|
873
|
+
"aria-describedby": review.approve.description === void 0 ? void 0 : `plan-approve-${pending.key}`,
|
|
874
|
+
disabled: busy || !canDecide,
|
|
875
|
+
onClick: () => {
|
|
876
|
+
decide(review.approve.label);
|
|
877
|
+
},
|
|
878
|
+
children: t("plan.approve")
|
|
879
|
+
}
|
|
880
|
+
)
|
|
881
|
+
] })
|
|
882
|
+
] }),
|
|
883
|
+
decline?.description !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css_modules_entry_default3.srOnly, id: `plan-decline-${pending.key}`, children: decline.description }),
|
|
884
|
+
review.approve.description !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css_modules_entry_default3.srOnly, id: `plan-approve-${pending.key}`, children: review.approve.description })
|
|
885
|
+
]
|
|
886
|
+
}
|
|
887
|
+
) });
|
|
708
888
|
}
|
|
709
889
|
|
|
710
890
|
// src/client/QuestionComposer.module.css
|
|
711
|
-
var css3 = "/* The takeover seats where the input card sits, centered on the InputBar\n axis at the shared content width (input card - 32): sides = clearance +\n 16px so the relation also holds on narrow viewports. */\n.bau-frame {\n display: flex;\n justify-content: center;\n padding: 6px calc(var(--dsh-composer-side-clearance) + 16px) 10px;\n}\n\n/* Figma Input 973:36348 body over the 1019:36938 header: no banner strip \u2014\n the card keeps zero padding and sections carry their own insets. */\n.bau-card {\n display: flex;\n flex-direction: column;\n width: 100%;\n max-width: var(--dsh-chat-content-width);\n /* Composer seat sits in a fixed-height conversation column (overflow\n hidden): cap the card against the viewport and scroll the option list\n so header and footer actions stay reachable on long batches. */\n max-height: min(60vh, 520px);\n padding: 0 0 10px;\n border: 0;\n --dsw-elevation-stroke-color: var(--dsw-alias-border-l2-darkmode-thin);\n border-radius: var(--dsw-radius-xl);\n background: var(--dsw-specific-input-major);\n box-shadow: var(--dsw-elevation-panel);\n color: var(--dsw-alias-label-primary);\n overflow: hidden;\n /* Elevated surface in dark, same as the menus: the body inside scrolls\n once the card hits the cap above, so the thumb takes the l2 pair. Declared\n on the card because the elevation belongs to the surface, and the custom\n properties inherit down to `.bau-body` (see ui-theme styles/scrollbar.bau-css\n for the rebinding contract). */\n --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2);\n --dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2);\n}\n\n.bau-card,\n.bau-card * {\n box-sizing: border-box;\n}\n\n/* Collapsed to the header strip: drop the height cap and the inner scroll\n seat so the card hugs the title row, freeing the viewport for the\n conversation above while the question stays pending. */\n.bau-cardMinimized {\n max-height: none;\n}\n\n/* The header strip is the whole card when collapsed: the title row needs\n bottom padding once the body that normally carries it is hidden. */\n.bau-cardMinimized .bau-header {\n padding-bottom: 14px;\n}\n\n/* Header button group: minimize sits next to the close action, both on the\n same 24px icon-button grid. */\n.bau-headerActions {\n display: flex;\n align-items: center;\n gap: 4px;\n flex-shrink: 0;\n}\n\n.bau-waitButton {\n white-space: nowrap;\n}\n\n.bau-waitStatus {\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n line-height: 24px;\n white-space: nowrap;\n}\n\n/* Figma 1019:36938 header, user-tuned: heading block left, close right; the\n pager sits in the footer to balance the card. */\n.bau-header {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: 16px;\n flex-shrink: 0;\n padding: 20px 16px 0 24px;\n}\n\n.bau-headingBlock {\n min-width: 0;\n}\n\n.bau-eyebrow {\n /* Eyebrow-to-title gap widened from the figma 2px (user-tuned). */\n margin-bottom: 5px;\n color: var(--dsw-alias-label-tertiary);\n font-size: 11px;\n line-height: 16px;\n}\n\n.bau-title {\n margin: 0;\n font-size: 16px;\n line-height: 22px;\n font-weight: 500;\n}\n\n.bau-detail {\n margin: 0 2px 8px;\n}\n\n.bau-footerActions {\n display: flex;\n align-items: center;\n gap: 12px;\n flex-shrink: 0;\n}\n\n.bau-pager {\n display: flex;\n align-items: center;\n gap: 6px;\n flex-shrink: 0;\n}\n\n.bau-progress {\n padding: 0 4px;\n color: var(--dsw-alias-label-secondary);\n font-size: 14px;\n line-height: 24px;\n font-weight: 500;\n white-space: nowrap;\n /* Narrow the plain spaces around the slash without touching glyph tracking. */\n word-spacing: -2px;\n}\n\n.bau-iconButton {\n display: grid;\n place-items: center;\n width: 24px;\n height: 24px;\n padding: 0;\n border: none;\n border-radius: 999px;\n corner-shape: round;\n background: transparent;\n color: var(--dsw-alias-label-tertiary);\n cursor: pointer;\n}\n\n.bau-iconButton:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover);\n color: var(--dsw-alias-label-primary);\n}\n\n.bau-iconButton:disabled {\n color: var(--dsw-alias-label-dimmed);\n cursor: default;\n}\n\n.bau-body {\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n min-height: 0;\n overflow-y: auto;\n overscroll-behavior: contain;\n}\n\n.bau-options {\n display: flex;\n flex-direction: column;\n gap: 1px;\n margin: 8px 0 0;\n padding: 4px 12px;\n}\n\n.bau-option {\n display: flex;\n /* flex-start, not center: with a wrapped description the indicator must\n stay on the FIRST line (centering drifts it down the taller copy block).\n The 8px padding makes a single-line row 40px exactly, so nothing reads\n as top-heavy; .bau-number/.bau-checkbox re-center against the first line box. */\n align-items: flex-start;\n gap: 8px;\n width: 100%;\n min-height: 40px;\n /* Rows are the scroll content, never the slack absorber: a shrinkable row\n collapses to min-height while its wrapped copy keeps the taller\n intrinsic height, and centered content then paints outside the row box \u2014\n over the title and the next row. Overflow belongs to .bau-options. */\n flex-shrink: 0;\n padding: 8px 12px 8px 8px;\n border: 1px solid transparent;\n border-radius: var(--dsw-radius-md);\n background: transparent;\n color: inherit;\n text-align: left;\n cursor: pointer;\n transition: background-color 120ms ease, border-color 120ms ease;\n}\n\n.bau-option:hover:not(:disabled),\n.bau-optionSelected {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.bau-optionSelected {\n border-color: var(--dsw-alias-border-l2);\n}\n\n.bau-option:disabled {\n cursor: default;\n}\n\n/* Leading indicator (20\xD720): single-select shows the option\n number, multi-select swaps in a checkbox; the custom-answer row follows \u2014\n its checkbox mirrors the typed draft (styling only, exclusivity holds). */\n.bau-number {\n display: grid;\n place-items: center;\n flex: 0 0 20px;\n width: 20px;\n height: 20px;\n /* (24px first-line box \u2212 20px indicator) / 2: centers the indicator against\n the first text line under the row's flex-start alignment. */\n margin-top: 2px;\n border-radius: var(--dsw-radius-xs);\n background: var(--dsw-alias-bg-overlay);\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n font-weight: 500;\n line-height: 18px;\n}\n\n/* Multi-select box (figma 1055:41594, user-tuned down to 14\xD714): a radius-4\n box centered in the 20px indicator seat; the box itself is the ::before\n layer so the check icon stacks over it in the same grid cell. */\n.bau-checkbox {\n display: grid;\n place-items: center;\n flex: 0 0 20px;\n width: 20px;\n height: 20px;\n /* Same first-line centering as .bau-number under flex-start alignment. */\n margin-top: 2px;\n}\n\n.bau-checkbox::before {\n content: '';\n grid-area: 1 / 1;\n width: 14px;\n height: 14px;\n border: 0.5px solid var(--dsw-alias-border-l4);\n border-radius: var(--dsw-radius-xs);\n transition: background-color 120ms ease, border-color 120ms ease;\n}\n\n.bau-checkbox > svg {\n grid-area: 1 / 1;\n}\n\n/* Checked: label-primary fill with a primary-foreground check \u2014 the pair\n inverts with the theme (dark fill in light mode, light fill in dark mode). */\n.bau-checkboxChecked {\n color: var(--dsw-alias-label-primary-foreground);\n}\n\n.bau-checkboxChecked::before {\n border-color: var(--dsw-alias-label-primary);\n background: var(--dsw-alias-label-primary);\n}\n\n.bau-optionCopy {\n min-width: 0;\n flex: 1;\n}\n\n.bau-optionLine {\n display: flex;\n align-items: baseline;\n flex-wrap: wrap;\n gap: 2px 6px;\n}\n\n.bau-optionLabel {\n font-size: 14px;\n line-height: 24px;\n font-weight: 500;\n}\n\n.bau-badge {\n padding: 0 4px;\n border-radius: var(--dsw-radius-xs);\n background: var(--dsw-specific-sidebar-nav-item-active-accent);\n color: var(--dsw-alias-button-info-fill);\n font-size: 11px;\n line-height: 18px;\n font-weight: 600;\n}\n\n.bau-description {\n color: var(--dsw-alias-label-tertiary);\n font-size: 14px;\n line-height: 24px;\n font-weight: 400;\n}\n\n/* Read-only note standing in for a question the user skipped: it takes the\n option rows' horizontal padding so it lines up with the choices above it. */\n.bau-reviewNote {\n margin: 0;\n padding: 8px 12px;\n color: var(--dsw-alias-label-tertiary);\n font-size: 14px;\n line-height: 24px;\n}\n\n/* Custom answer row (figma 973:36427): an option-shaped row whose copy is an\n inline text input; focus or a typed draft gives it the selected look.\n While a single-select option is chosen, focus alone does not apply that\n look, so the radio group shows one selection; typing clears the option. */\n.bau-customRow {\n display: flex;\n /* Same first-line alignment as .bau-option \u2014 the indicator seat carries the\n 2px re-centering margin. */\n align-items: flex-start;\n gap: 8px;\n width: 100%;\n min-height: 40px;\n /* Same reason as .bau-option: the custom row is scroll content, and shrinking\n it pushes the inline input past the footer. */\n flex-shrink: 0;\n padding: 8px 12px 8px 8px;\n border: 1px solid transparent;\n border-radius: var(--dsw-radius-md);\n transition: background-color 120ms ease, border-color 120ms ease;\n}\n\n.bau-customRow:hover,\n.bau-customRow:focus-within:not(.bau-customRowYielded),\n.bau-customRowActive {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.bau-customRow:focus-within:not(.bau-customRowYielded),\n.bau-customRowActive {\n border-color: var(--dsw-alias-border-l2);\n}\n\n/* Auto-growing free-text answer (see AnswerField): mirror and textarea share\n one grid cell, the mirror sizes it, and the textarea stretches to it. The\n two layers MUST keep identical type, padding and wrapping \u2014 a mismatch\n makes the box the wrong height for the text the user is typing. */\n.bau-field {\n display: grid;\n min-width: 0;\n --dsh-answer-field-padding: 0;\n}\n\n.bau-field > * {\n grid-area: 1 / 1;\n min-width: 0;\n padding: var(--dsh-answer-field-padding);\n font: inherit;\n font-size: 14px;\n line-height: 24px;\n white-space: pre-wrap;\n word-break: break-word;\n overflow-wrap: anywhere;\n}\n\n/* The height ruler, never painted. Growth stops at 6 lines: the card body is\n capped at 520px and still owes that budget to the title, the option rows and\n the footer actions, so a long answer scrolls in the textarea instead of\n pushing the choices it belongs to out of view.\n content-box overrides the card-wide border-box so the cap counts TEXT lines\n in both variants: under border-box the block variant's 16px of vertical\n padding eats two thirds of a line and the sixth one arrives as an 8px sliver.\n Width is unaffected \u2014 a stretched grid item's used width comes from the\n track, not from this box-sizing. */\n.bau-fieldMirror {\n box-sizing: content-box;\n max-height: 144px;\n overflow: hidden;\n visibility: hidden;\n}\n\n.bau-fieldInput {\n resize: none;\n /* The stack's only scrollport: past the mirror's cap the field stops growing\n and this scrolls. */\n overflow-y: auto;\n border: none;\n outline: none;\n background: transparent;\n color: var(--dsw-alias-label-primary);\n caret-color: var(--dsw-alias-state-business-primary);\n}\n\n.bau-fieldInput::placeholder {\n color: var(--dsw-alias-label-caption);\n}\n\n/* Inline variant: the custom row's copy column, borrowing the row's chrome. */\n.bau-customInline {\n flex: 1;\n}\n\n/* Optionless question: the free-form answer is the whole body, so it carries\n its own frame. The 12px side margins add to the .bau-options 12px padding so both\n edges align with the title's 24px inset; two lines are reserved before the\n answer starts growing. */\n.bau-customBlock {\n min-height: 64px;\n flex-shrink: 0;\n margin: 0 12px;\n border: 0.5px solid var(--dsw-alias-border-l4);\n border-radius: var(--dsw-radius-lg);\n background: var(--dsw-alias-bg-module-platform);\n --dsh-answer-field-padding: 8px 12px;\n}\n\n.bau-customBlock:focus-within {\n border-color: var(--dsw-alias-state-business-primary);\n}\n\n.bau-footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n flex-shrink: 0;\n margin-top: 12px;\n padding: 0 10px 0 18px;\n}\n\n.bau-feedback {\n flex: 1;\n min-height: 16px;\n color: var(--dsw-alias-state-error-primary);\n font-size: 11px;\n line-height: 16px;\n text-align: right;\n}\n\n@media (max-width: 720px) {\n .bau-card {\n border-radius: var(--dsw-radius-xl);\n }\n\n .bau-header {\n padding: 10px 12px 0 18px;\n }\n\n .bau-options {\n padding: 4px 8px;\n }\n\n .bau-title {\n font-size: 15px;\n line-height: 21px;\n }\n\n .bau-option,\n .bau-customRow {\n padding: 8px 6px;\n }\n\n .bau-footer {\n align-items: flex-end;\n padding: 0 10px;\n }\n\n .bau-footerActions {\n flex-shrink: 0;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .bau-option,\n .bau-customRow {\n transition: none;\n }\n}\n\n/* \u2500\u2500 Better ask-user adaptations: markdown / long text / narrow screens \u2500\u2500 */\n.bau-title,\n.bau-eyebrow,\n.bau-optionLabel,\n.bau-description {\n min-width: 0;\n overflow-wrap: anywhere;\n word-break: break-word;\n}\n\n.bau-title {\n max-height: 30vh;\n overflow-y: auto;\n}\n\n.bau-title > div,\n.bau-eyebrow > div,\n.bau-optionLabel > div,\n.bau-description > div {\n margin: 0;\n}\n\n.bau-optionLabel {\n display: block;\n}\n\n.bau-description {\n display: block;\n}\n\n.bau-card {\n max-height: min(75vh, 640px);\n max-height: min(75dvh, 640px);\n}\n\n.bau-frame {\n padding-bottom: calc(10px + env(safe-area-inset-bottom));\n}\n\n@media (max-width: 720px) {\n .bau-header {\n flex-wrap: wrap;\n }\n\n .bau-headingBlock {\n flex: 1 1 100%;\n }\n\n .bau-headerActions {\n flex-wrap: wrap;\n justify-content: flex-end;\n margin-left: auto;\n }\n\n .bau-waitStatus {\n white-space: normal;\n }\n\n .bau-card {\n max-height: calc(100vh - 160px);\n max-height: calc(100dvh - 160px);\n }\n\n .bau-title {\n max-height: 24vh;\n max-height: 24dvh;\n font-size: 15px;\n line-height: 21px;\n }\n\n .bau-footer {\n flex-wrap: wrap;\n }\n\n .bau-feedback {\n flex: 1 1 100%;\n text-align: left;\n }\n\n .bau-footerActions {\n width: 100%;\n justify-content: flex-end;\n flex-wrap: wrap;\n }\n\n .bau-option,\n .bau-customRow {\n min-height: 44px;\n }\n}\n\n@media (max-width: 420px) {\n .bau-footer {\n align-items: stretch;\n flex-direction: column;\n }\n\n .bau-pager {\n justify-content: space-between;\n width: 100%;\n }\n\n .bau-footerActions {\n width: 100%;\n }\n\n .bau-footerActions > button {\n flex: 1 1 auto;\n }\n}\n";
|
|
712
|
-
var
|
|
713
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(
|
|
891
|
+
var css4 = '/* src/client/QuestionComposer.module.css */\n.QuestionComposer_frame {\n --cfg-line: var(--dsw-alias-border-l2);\n --cfg-line-strong: var(--dsw-alias-border-l3);\n --cfg-surface: var(--dsw-alias-bg-layer-2);\n --cfg-sunken: color-mix(in srgb, var(--dsw-alias-label-primary) 4%, var(--dsw-alias-bg-layer-1));\n --cfg-ink: var(--dsw-alias-label-primary);\n --cfg-muted: var(--dsw-alias-label-secondary);\n --cfg-accent: #3388bb;\n --cfg-accent-text: #14587f;\n --cfg-hover: var(--dsw-alias-interactive-bg-hover);\n --cfg-danger: var(--dsw-alias-state-error-primary);\n --cfg-solid: #20709e;\n --cfg-solid-hover: #1c638d;\n --cfg-on-solid: #fff;\n display: flex;\n justify-content: center;\n padding: 6px calc(var(--dsh-composer-side-clearance) + 16px) calc(10px + env(safe-area-inset-bottom));\n}\n.QuestionComposer_card {\n display: flex;\n flex-direction: column;\n width: 100%;\n min-width: 0;\n max-width: var(--dsh-chat-content-width);\n max-height: min(75vh, 640px);\n max-height: min(75dvh, 640px);\n overflow: hidden;\n border: 1px solid var(--cfg-line);\n border-top-color: var(--cfg-accent);\n border-radius: 12px;\n background: var(--cfg-surface);\n color: var(--cfg-ink);\n font-size: inherit;\n --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2);\n --dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2);\n}\n.QuestionComposer_card,\n.QuestionComposer_card * {\n box-sizing: border-box;\n}\n.QuestionComposer_cardMinimized {\n max-height: none;\n}\n.QuestionComposer_header {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n flex-shrink: 0;\n gap: 12px;\n padding: 12px 12px 8px 16px;\n}\n.QuestionComposer_headingBlock {\n flex: 1;\n min-width: 0;\n}\n.QuestionComposer_titleRow {\n display: flex;\n align-items: flex-start;\n flex-wrap: wrap;\n gap: 6px;\n min-width: 0;\n}\n.QuestionComposer_title {\n flex: 1 1 auto;\n margin: 0;\n max-height: 24vh;\n max-height: 24dvh;\n overflow-y: auto;\n font-size: 14px;\n line-height: 20px;\n font-weight: 500;\n}\n.QuestionComposer_headerChip,\n.QuestionComposer_statusChip {\n display: inline-flex;\n align-items: center;\n flex: none;\n height: 20px;\n max-width: 200px;\n padding: 0 7px;\n overflow: hidden;\n border: 1px solid var(--cfg-line);\n border-radius: 999px;\n background: var(--cfg-sunken);\n color: var(--cfg-muted);\n font-size: 11px;\n line-height: 18px;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n.QuestionComposer_statusChip {\n border-color: color-mix(in srgb, var(--cfg-accent) 30%, var(--cfg-line));\n background: color-mix(in srgb, var(--cfg-accent) 10%, transparent);\n color: var(--cfg-accent-text);\n font-weight: 500;\n}\n.QuestionComposer_title,\n.QuestionComposer_headerChip,\n.QuestionComposer_statusChip,\n.QuestionComposer_optionLabel,\n.QuestionComposer_description,\n.QuestionComposer_detail {\n min-width: 0;\n overflow-wrap: anywhere;\n word-break: break-word;\n}\n.QuestionComposer_title > div,\n.QuestionComposer_headerChip > div,\n.QuestionComposer_statusChip > div,\n.QuestionComposer_optionLabel > div,\n.QuestionComposer_description > div {\n margin: 0;\n}\n.QuestionComposer_title > [data-markdown-variant=compact],\n.QuestionComposer_headerChip > [data-markdown-variant=compact],\n.QuestionComposer_optionLabel > [data-markdown-variant=compact],\n.QuestionComposer_title > [data-markdown-variant=compact] > p,\n.QuestionComposer_headerChip > [data-markdown-variant=compact] > p,\n.QuestionComposer_optionLabel > [data-markdown-variant=compact] > p {\n color: inherit;\n font: inherit;\n}\n.QuestionComposer_headerActions,\n.QuestionComposer_footerActions,\n.QuestionComposer_pager {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n gap: 4px;\n}\n.QuestionComposer_footerActions {\n margin-left: auto;\n gap: 8px;\n}\n.QuestionComposer_iconButton {\n display: grid;\n place-items: center;\n width: 28px;\n height: 28px;\n padding: 0;\n border: 0;\n border-radius: 6px;\n background: transparent;\n color: var(--cfg-muted);\n cursor: pointer;\n}\n.QuestionComposer_iconButton:hover:not(:disabled) {\n background: var(--cfg-hover);\n color: var(--cfg-ink);\n}\n.QuestionComposer_card button:focus-visible {\n outline: 2px solid var(--cfg-accent);\n outline-offset: -2px;\n}\n.QuestionComposer_card button:disabled {\n cursor: default;\n}\n.QuestionComposer_iconButton:disabled,\n.QuestionComposer_footerActions > button:disabled,\n.QuestionComposer_card[aria-busy=true] .QuestionComposer_option {\n opacity: 0.4;\n}\n.QuestionComposer_iconButton:active:not(:disabled),\n.QuestionComposer_option:active:not(:disabled) {\n background: var(--cfg-hover);\n}\n.QuestionComposer_body {\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n min-height: 0;\n overflow-y: auto;\n overscroll-behavior: contain;\n scrollbar-gutter: stable;\n}\n.QuestionComposer_detail {\n margin: 0 16px 8px;\n color: var(--cfg-muted);\n}\n.QuestionComposer_options {\n display: flex;\n flex-direction: column;\n gap: 2px;\n padding: 0 8px 8px;\n}\n.QuestionComposer_option,\n.QuestionComposer_customRow {\n display: flex;\n align-items: flex-start;\n flex-shrink: 0;\n gap: 8px;\n width: 100%;\n min-height: 36px;\n padding: 7px 8px;\n border: 1px solid transparent;\n border-radius: 8px;\n transition: background-color 140ms ease, border-color 140ms ease;\n}\n.QuestionComposer_option {\n background: transparent;\n color: inherit;\n text-align: left;\n cursor: pointer;\n font: inherit;\n}\n.QuestionComposer_option:hover:not(:disabled),\n.QuestionComposer_customRow:hover {\n background: var(--cfg-hover);\n}\n.QuestionComposer_optionSelected,\n.QuestionComposer_optionSelected:hover:not(:disabled),\n.QuestionComposer_customRowActive {\n border-color: var(--cfg-accent);\n background: color-mix(in srgb, var(--cfg-accent) 8%, transparent);\n}\n.QuestionComposer_radio,\n.QuestionComposer_checkbox,\n.QuestionComposer_customIcon {\n display: grid;\n place-items: center;\n flex: 0 0 20px;\n width: 20px;\n height: 20px;\n color: var(--cfg-muted);\n}\n.QuestionComposer_radio::before,\n.QuestionComposer_checkbox::before {\n content: "";\n box-sizing: border-box;\n grid-area: 1 / 1;\n width: 16px;\n height: 16px;\n border: 1px solid var(--dsw-alias-border-l4);\n}\n.QuestionComposer_radio::before {\n border-radius: 50%;\n}\n.QuestionComposer_radioChecked::before {\n border: 5px solid var(--cfg-accent);\n}\n.QuestionComposer_checkbox::before {\n border-radius: 4px;\n}\n.QuestionComposer_checkbox > svg {\n grid-area: 1 / 1;\n}\n.QuestionComposer_checkboxChecked {\n color: var(--cfg-accent);\n}\n.QuestionComposer_checkboxChecked::before {\n border-color: currentColor;\n background: color-mix(in srgb, var(--cfg-accent) 10%, transparent);\n}\n.QuestionComposer_optionCopy {\n display: grid;\n gap: 2px;\n min-width: 0;\n flex: 1;\n}\n.QuestionComposer_optionLine {\n display: flex;\n align-items: baseline;\n flex-wrap: wrap;\n gap: 2px 6px;\n}\n.QuestionComposer_optionLabel {\n display: block;\n font-size: inherit;\n font-weight: 500;\n line-height: 20px;\n}\n.QuestionComposer_badge {\n display: inline-flex;\n align-items: center;\n height: 20px;\n padding: 0 6px;\n border: 1px solid color-mix(in srgb, var(--cfg-accent) 30%, var(--cfg-line));\n border-radius: 999px;\n background: color-mix(in srgb, var(--cfg-accent) 10%, transparent);\n color: var(--cfg-accent-text);\n font-size: 11px;\n font-weight: 500;\n line-height: 18px;\n}\n.QuestionComposer_description {\n display: block;\n color: var(--cfg-muted);\n font-size: 12px;\n line-height: 18px;\n font-weight: 400;\n}\n.QuestionComposer_reviewNote {\n margin: 0;\n padding: 6px 8px;\n color: var(--cfg-muted);\n font-size: 12px;\n line-height: 20px;\n}\n.QuestionComposer_customRow {\n margin-top: 8px;\n border-color: var(--cfg-line);\n background: var(--cfg-surface);\n}\n.QuestionComposer_customRow:has(.QuestionComposer_fieldInput:focus-visible),\n.QuestionComposer_customBlock:has(.QuestionComposer_fieldInput:focus-visible) {\n outline: 2px solid var(--cfg-accent);\n outline-offset: -2px;\n}\n.QuestionComposer_field {\n display: grid;\n min-width: 0;\n --dsh-answer-field-padding: 0;\n}\n.QuestionComposer_field > * {\n grid-area: 1 / 1;\n min-width: 0;\n padding: var(--dsh-answer-field-padding);\n font: inherit;\n font-size: inherit;\n line-height: 20px;\n white-space: pre-wrap;\n word-break: break-word;\n overflow-wrap: anywhere;\n}\n.QuestionComposer_fieldMirror {\n box-sizing: content-box;\n max-height: 120px;\n overflow: hidden;\n visibility: hidden;\n}\n.QuestionComposer_fieldInput {\n resize: none;\n overflow-y: auto;\n border: 0;\n outline: none;\n background: transparent;\n color: var(--cfg-ink);\n caret-color: var(--cfg-accent);\n}\n.QuestionComposer_fieldInput::placeholder {\n color: var(--dsw-alias-label-tertiary);\n}\n.QuestionComposer_customInline {\n flex: 1;\n}\n.QuestionComposer_customBlock {\n min-height: 60px;\n flex-shrink: 0;\n margin: 0 8px;\n border: 1px solid var(--cfg-line);\n border-radius: 8px;\n background: var(--cfg-surface);\n --dsh-answer-field-padding: 8px 12px;\n}\n.QuestionComposer_footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-shrink: 0;\n gap: 8px;\n padding: 8px 12px;\n border-top: 1px solid var(--cfg-line);\n}\n.QuestionComposer_progress {\n padding: 0 4px;\n color: var(--cfg-muted);\n font-size: 11px;\n font-variant-numeric: tabular-nums;\n line-height: 20px;\n white-space: nowrap;\n}\n.QuestionComposer_feedback {\n flex: 1;\n min-width: 0;\n color: var(--cfg-muted);\n font-size: 12px;\n line-height: 18px;\n overflow-wrap: anywhere;\n text-align: right;\n}\n.QuestionComposer_feedback[data-error] {\n color: var(--cfg-danger);\n}\n.QuestionComposer_button,\n.QuestionComposer_primary {\n appearance: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n height: 32px;\n padding: 0 12px;\n border: 1px solid var(--cfg-line);\n border-radius: 8px;\n box-shadow: none;\n background: var(--cfg-surface);\n color: var(--cfg-ink);\n font: inherit;\n font-size: 13px;\n font-weight: 500;\n cursor: pointer;\n transition:\n background-color 140ms ease,\n border-color 140ms ease,\n color 140ms ease;\n}\n.QuestionComposer_button:hover:not(:disabled) {\n background: var(--cfg-hover);\n}\n.QuestionComposer_primary {\n min-width: 128px;\n border-color: transparent;\n background: var(--cfg-solid);\n color: var(--cfg-on-solid);\n}\n.QuestionComposer_primary:hover:not(:disabled) {\n background: var(--cfg-solid-hover);\n}\n.QuestionComposer_button:active:not(:disabled),\n.QuestionComposer_primary:active:not(:disabled) {\n background: color-mix(in srgb, var(--cfg-accent) 12%, var(--cfg-surface));\n}\n.QuestionComposer_iconButton,\n.QuestionComposer_option {\n appearance: none;\n box-shadow: none;\n}\n.QuestionComposer_spinner {\n width: 12px;\n height: 12px;\n border: 1px solid currentColor;\n border-right-color: transparent;\n border-radius: 50%;\n animation: QuestionComposer_spin 800ms linear infinite;\n}\n@keyframes QuestionComposer_spin {\n to {\n transform: rotate(360deg);\n }\n}\n.QuestionComposer_feedback:empty {\n display: none;\n}\n@media (max-width: 720px) {\n .QuestionComposer_card {\n max-height: calc(100vh - 160px);\n max-height: calc(100dvh - 160px);\n }\n .QuestionComposer_header {\n gap: 8px;\n padding: 10px 8px 8px 12px;\n }\n .QuestionComposer_field > * {\n font-size: 16px;\n line-height: 24px;\n }\n .QuestionComposer_fieldMirror {\n max-height: 144px;\n }\n .QuestionComposer_footer {\n flex-wrap: wrap;\n padding: 8px;\n }\n .QuestionComposer_feedback {\n flex: 1 1 100%;\n order: 1;\n text-align: left;\n }\n .QuestionComposer_footerActions {\n margin-left: auto;\n }\n}\n@media (max-width: 420px) {\n .QuestionComposer_header {\n flex-wrap: wrap;\n }\n .QuestionComposer_headingBlock {\n flex-basis: calc(100% - 104px);\n }\n .QuestionComposer_footerActions {\n flex: 1 1 100%;\n }\n .QuestionComposer_footerActions > button {\n flex: 1;\n }\n}\n@media (pointer: coarse) {\n .QuestionComposer_option,\n .QuestionComposer_customRow,\n .QuestionComposer_card button {\n min-height: 44px;\n }\n .QuestionComposer_iconButton {\n width: 44px;\n height: 44px;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .QuestionComposer_spinner {\n animation: none;\n }\n .QuestionComposer_option,\n .QuestionComposer_customRow {\n transition: none;\n }\n}\n[data-ds-dark-theme] .QuestionComposer_frame {\n --cfg-accent: #4eb0e8;\n --cfg-accent-text: #6fc0ee;\n --cfg-solid: #4eb0e8;\n --cfg-solid-hover: #6fc0ee;\n --cfg-on-solid: #0e1014;\n}\n';
|
|
892
|
+
var id4 = "dsh-better-ask-user/QuestionComposer.module.css";
|
|
893
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(id4) + "]") === null) {
|
|
714
894
|
const tag = document.createElement("style");
|
|
715
895
|
tag.dataset.plugin = "dsh-better-ask-user";
|
|
716
|
-
tag.dataset.pluginCss =
|
|
717
|
-
tag.textContent =
|
|
896
|
+
tag.dataset.pluginCss = id4;
|
|
897
|
+
tag.textContent = css4;
|
|
718
898
|
document.head.appendChild(tag);
|
|
719
899
|
}
|
|
720
|
-
var QuestionComposer_default = {
|
|
900
|
+
var QuestionComposer_default = {
|
|
901
|
+
frame: "QuestionComposer_frame",
|
|
902
|
+
card: "QuestionComposer_card",
|
|
903
|
+
cardMinimized: "QuestionComposer_cardMinimized",
|
|
904
|
+
header: "QuestionComposer_header",
|
|
905
|
+
headingBlock: "QuestionComposer_headingBlock",
|
|
906
|
+
titleRow: "QuestionComposer_titleRow",
|
|
907
|
+
title: "QuestionComposer_title",
|
|
908
|
+
headerChip: "QuestionComposer_headerChip",
|
|
909
|
+
statusChip: "QuestionComposer_statusChip",
|
|
910
|
+
optionLabel: "QuestionComposer_optionLabel",
|
|
911
|
+
description: "QuestionComposer_description",
|
|
912
|
+
detail: "QuestionComposer_detail",
|
|
913
|
+
headerActions: "QuestionComposer_headerActions",
|
|
914
|
+
footerActions: "QuestionComposer_footerActions",
|
|
915
|
+
pager: "QuestionComposer_pager",
|
|
916
|
+
iconButton: "QuestionComposer_iconButton",
|
|
917
|
+
option: "QuestionComposer_option",
|
|
918
|
+
body: "QuestionComposer_body",
|
|
919
|
+
options: "QuestionComposer_options",
|
|
920
|
+
customRow: "QuestionComposer_customRow",
|
|
921
|
+
optionSelected: "QuestionComposer_optionSelected",
|
|
922
|
+
customRowActive: "QuestionComposer_customRowActive",
|
|
923
|
+
radio: "QuestionComposer_radio",
|
|
924
|
+
checkbox: "QuestionComposer_checkbox",
|
|
925
|
+
customIcon: "QuestionComposer_customIcon",
|
|
926
|
+
radioChecked: "QuestionComposer_radioChecked",
|
|
927
|
+
checkboxChecked: "QuestionComposer_checkboxChecked",
|
|
928
|
+
optionCopy: "QuestionComposer_optionCopy",
|
|
929
|
+
optionLine: "QuestionComposer_optionLine",
|
|
930
|
+
badge: "QuestionComposer_badge",
|
|
931
|
+
reviewNote: "QuestionComposer_reviewNote",
|
|
932
|
+
fieldInput: "QuestionComposer_fieldInput",
|
|
933
|
+
customBlock: "QuestionComposer_customBlock",
|
|
934
|
+
field: "QuestionComposer_field",
|
|
935
|
+
fieldMirror: "QuestionComposer_fieldMirror",
|
|
936
|
+
customInline: "QuestionComposer_customInline",
|
|
937
|
+
footer: "QuestionComposer_footer",
|
|
938
|
+
progress: "QuestionComposer_progress",
|
|
939
|
+
feedback: "QuestionComposer_feedback",
|
|
940
|
+
button: "QuestionComposer_button",
|
|
941
|
+
primary: "QuestionComposer_primary",
|
|
942
|
+
spinner: "QuestionComposer_spinner",
|
|
943
|
+
spin: "QuestionComposer_spin"
|
|
944
|
+
};
|
|
945
|
+
var css_modules_entry_default4 = QuestionComposer_default;
|
|
721
946
|
|
|
722
947
|
// src/client/QuestionComposer.tsx
|
|
723
|
-
var
|
|
948
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
724
949
|
var REMOVED_CARD = {
|
|
725
950
|
state: "open",
|
|
726
951
|
waitState: "counting",
|
|
@@ -733,6 +958,7 @@ function parseRecommendedLabel(label) {
|
|
|
733
958
|
return suffix.test(label) ? { label: label.replace(suffix, ""), recommended: true } : { label, recommended: false };
|
|
734
959
|
}
|
|
735
960
|
function recommendedFirstOption(question) {
|
|
961
|
+
if (question.intent?.kind === "approval" || question.intent?.kind === "plan-review") return void 0;
|
|
736
962
|
const label = question.options?.[0]?.label;
|
|
737
963
|
return label !== void 0 && parseRecommendedLabel(label).recommended ? label : void 0;
|
|
738
964
|
}
|
|
@@ -750,18 +976,19 @@ function isComposing(event) {
|
|
|
750
976
|
return event.nativeEvent.isComposing || Reflect.get(event.nativeEvent, "keyCode") === 229;
|
|
751
977
|
}
|
|
752
978
|
function AnswerField(props) {
|
|
753
|
-
return /* @__PURE__ */ (0,
|
|
754
|
-
/* @__PURE__ */ (0,
|
|
979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: clsx_default(css_modules_entry_default4.field, props.variant === "inline" ? css_modules_entry_default4.customInline : css_modules_entry_default4.customBlock), children: [
|
|
980
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { "aria-hidden": true, className: css_modules_entry_default4.fieldMirror, children: `${props.value}
|
|
755
981
|
` }),
|
|
756
|
-
/* @__PURE__ */ (0,
|
|
982
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
757
983
|
"textarea",
|
|
758
984
|
{
|
|
759
985
|
autoFocus: props.autoFocus,
|
|
760
|
-
className:
|
|
986
|
+
className: css_modules_entry_default4.fieldInput,
|
|
761
987
|
value: props.value,
|
|
762
988
|
disabled: props.disabled,
|
|
763
989
|
rows: 1,
|
|
764
990
|
placeholder: props.placeholder,
|
|
991
|
+
"aria-labelledby": props.labelledBy,
|
|
765
992
|
onFocus: props.onFocus,
|
|
766
993
|
onChange: props.onChange,
|
|
767
994
|
onKeyDown: props.onKeyDown
|
|
@@ -771,8 +998,8 @@ function AnswerField(props) {
|
|
|
771
998
|
}
|
|
772
999
|
function QuestionComposer(props) {
|
|
773
1000
|
const question = props.matched;
|
|
774
|
-
const review = (0,
|
|
775
|
-
return review === void 0 ? /* @__PURE__ */ (0,
|
|
1001
|
+
const review = (0, import_react4.useMemo)(() => planReviewOf(question.questions), [question]);
|
|
1002
|
+
return review === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
776
1003
|
QuestionFlow,
|
|
777
1004
|
{
|
|
778
1005
|
pending: question,
|
|
@@ -782,16 +1009,16 @@ function QuestionComposer(props) {
|
|
|
782
1009
|
actions: props.actions
|
|
783
1010
|
},
|
|
784
1011
|
question.key
|
|
785
|
-
) : /* @__PURE__ */ (0,
|
|
1012
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PlanReviewPanel, { pending: question, review, t: props.t, renderSlot: props.renderSlot, useQuestionCard: props.useQuestionCard }, question.key);
|
|
786
1013
|
}
|
|
787
1014
|
function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
788
1015
|
const questions = pending.questions;
|
|
789
1016
|
const review = pending.review;
|
|
790
|
-
const markdownLabels = (0,
|
|
1017
|
+
const markdownLabels = (0, import_react4.useMemo)(() => ({
|
|
791
1018
|
code: { copyLabel: t("copy"), copiedLabel: t("copied"), toolbarLabels: { codeLabel: t("codeBlock.title"), wrapLabel: t("codeBlock.wrap"), unwrapLabel: t("codeBlock.unwrap") } },
|
|
792
1019
|
footnotes: t("markdown.footnotes")
|
|
793
1020
|
}), [t]);
|
|
794
|
-
const initialDrafts = (0,
|
|
1021
|
+
const initialDrafts = (0, import_react4.useMemo)(() => {
|
|
795
1022
|
const recorded = new Map((review ?? []).map((answer) => [answer.id, answer]));
|
|
796
1023
|
return questions.map((item) => {
|
|
797
1024
|
const answer = recorded.get(item.id);
|
|
@@ -811,36 +1038,38 @@ function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
|
811
1038
|
const index = validStored?.index ?? 0;
|
|
812
1039
|
const drafts = storedProgress?.drafts ?? initialDrafts;
|
|
813
1040
|
const restoredWait = storedProgress?.wait ?? (storedProgress?.drafts.some((item, itemIndex) => item.selected.length !== initialDrafts[itemIndex]?.selected.length || item.selected.some((label, labelIndex) => label !== initialDrafts[itemIndex]?.selected[labelIndex]) || item.custom !== "" || item.skipped) === true ? "editing" : void 0);
|
|
814
|
-
const [busy, setBusy] = (0,
|
|
815
|
-
const [error, setError] = (0,
|
|
1041
|
+
const [busy, setBusy] = (0, import_react4.useState)(null);
|
|
1042
|
+
const [error, setError] = (0, import_react4.useState)(null);
|
|
816
1043
|
const card = useQuestionCard(pending.key, (snapshot) => snapshot ?? REMOVED_CARD);
|
|
817
|
-
const canSubmit = card.channel !== "none";
|
|
1044
|
+
const canSubmit = !card.closed && card.channel !== "none";
|
|
818
1045
|
const locked = busy !== null || review !== void 0;
|
|
819
|
-
const sentVia = (0,
|
|
820
|
-
(0,
|
|
1046
|
+
const sentVia = (0, import_react4.useRef)(null);
|
|
1047
|
+
(0, import_react4.useEffect)(() => {
|
|
821
1048
|
if (sentVia.current !== "waterfall" || card.state !== "continued") return;
|
|
822
1049
|
sentVia.current = null;
|
|
823
1050
|
setBusy(null);
|
|
824
1051
|
setError({ key: "error.resubmit" });
|
|
825
1052
|
}, [card.state]);
|
|
826
|
-
(0,
|
|
1053
|
+
(0, import_react4.useEffect)(() => {
|
|
827
1054
|
if (card.closed) actions.clear(pending.key);
|
|
828
1055
|
}, [actions, card.closed, pending.key]);
|
|
829
|
-
(0,
|
|
1056
|
+
(0, import_react4.useEffect)(() => {
|
|
830
1057
|
actions.prune(pending.liveKeys());
|
|
831
1058
|
}, [actions, pending]);
|
|
832
|
-
const waitDisposition = (0,
|
|
833
|
-
(0,
|
|
1059
|
+
const waitDisposition = (0, import_react4.useRef)(restoredWait);
|
|
1060
|
+
(0, import_react4.useEffect)(() => {
|
|
834
1061
|
if (waitDisposition.current === "waiting") pending.takeTime();
|
|
835
1062
|
if (waitDisposition.current === "editing") pending.bump();
|
|
836
1063
|
}, [pending]);
|
|
837
1064
|
const countdown = card.countdown;
|
|
838
|
-
const [minimized, setMinimized] = (0,
|
|
839
|
-
const focusedQuestions = (0,
|
|
840
|
-
const answerSurface = (0,
|
|
1065
|
+
const [minimized, setMinimized] = (0, import_react4.useState)(false);
|
|
1066
|
+
const focusedQuestions = (0, import_react4.useRef)(/* @__PURE__ */ new Set());
|
|
1067
|
+
const answerSurface = (0, import_react4.useRef)(null);
|
|
841
1068
|
const question = questions[index];
|
|
842
1069
|
const draft = drafts[index];
|
|
843
1070
|
const hasOptions = (question.options?.length ?? 0) > 0;
|
|
1071
|
+
const fixedActions = question.intent?.kind === "approval";
|
|
1072
|
+
const questionId = `question-${pending.key}-${String(index)}`;
|
|
844
1073
|
const replaceProgress = (nextIndex, nextDrafts) => {
|
|
845
1074
|
pending.bump();
|
|
846
1075
|
actions.replace(pending.key, {
|
|
@@ -860,7 +1089,7 @@ function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
|
860
1089
|
const blurAnswerSurface = (event) => {
|
|
861
1090
|
if (!event.currentTarget.contains(event.relatedTarget)) pending.releaseFocus();
|
|
862
1091
|
};
|
|
863
|
-
(0,
|
|
1092
|
+
(0, import_react4.useEffect)(() => {
|
|
864
1093
|
const release = () => {
|
|
865
1094
|
pending.releaseFocus();
|
|
866
1095
|
};
|
|
@@ -904,14 +1133,28 @@ function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
|
904
1133
|
replaceProgress(nextIndex, nextDrafts);
|
|
905
1134
|
setError(null);
|
|
906
1135
|
};
|
|
907
|
-
const choose = (label) => {
|
|
1136
|
+
const choose = (label, advance = true) => {
|
|
908
1137
|
updateDraft((current) => {
|
|
909
1138
|
if (question.multiSelect === true) {
|
|
910
1139
|
const selected = current.selected.includes(label) ? current.selected.filter((item) => item !== label) : [...current.selected, label];
|
|
911
1140
|
return { ...current, selected, skipped: false };
|
|
912
1141
|
}
|
|
913
1142
|
return { selected: [label], custom: "", skipped: false };
|
|
914
|
-
}, question.multiSelect !== true && index < questions.length - 1 ? index + 1 : index);
|
|
1143
|
+
}, advance && question.multiSelect !== true && index < questions.length - 1 ? index + 1 : index);
|
|
1144
|
+
};
|
|
1145
|
+
const navigateOptions = (event, optionIndex) => {
|
|
1146
|
+
if (question.multiSelect === true || locked || event.defaultPrevented) return;
|
|
1147
|
+
const options = question.options ?? [];
|
|
1148
|
+
let next;
|
|
1149
|
+
if (event.key === "ArrowDown" || event.key === "ArrowRight") next = (optionIndex + 1) % options.length;
|
|
1150
|
+
else if (event.key === "ArrowUp" || event.key === "ArrowLeft") next = (optionIndex - 1 + options.length) % options.length;
|
|
1151
|
+
else if (event.key === "Home") next = 0;
|
|
1152
|
+
else if (event.key === "End") next = options.length - 1;
|
|
1153
|
+
else return;
|
|
1154
|
+
event.preventDefault();
|
|
1155
|
+
event.stopPropagation();
|
|
1156
|
+
event.currentTarget.parentElement?.querySelectorAll('[role="radio"]')[next]?.focus();
|
|
1157
|
+
choose(options[next].label, false);
|
|
915
1158
|
};
|
|
916
1159
|
const answered = (item) => item.selected.length > 0 || item.custom.trim() !== "";
|
|
917
1160
|
const completed = (item) => answered(item) || item.skipped;
|
|
@@ -978,7 +1221,7 @@ function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
|
978
1221
|
}));
|
|
979
1222
|
};
|
|
980
1223
|
const continueFromCustom = (event) => {
|
|
981
|
-
if (event.key !== "Enter" || event.shiftKey || isComposing(event)) return;
|
|
1224
|
+
if (event.defaultPrevented || event.repeat || event.key !== "Enter" || event.shiftKey || isComposing(event)) return;
|
|
982
1225
|
event.preventDefault();
|
|
983
1226
|
continueFlow();
|
|
984
1227
|
};
|
|
@@ -991,40 +1234,37 @@ function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
|
991
1234
|
}
|
|
992
1235
|
submitDrafts(nextDrafts);
|
|
993
1236
|
};
|
|
994
|
-
return /* @__PURE__ */ (0,
|
|
1237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: css_modules_entry_default4.frame, "data-question-key": pending.key, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
995
1238
|
"section",
|
|
996
1239
|
{
|
|
997
|
-
|
|
998
|
-
|
|
1240
|
+
ref: answerSurface,
|
|
1241
|
+
className: clsx_default(css_modules_entry_default4.card, minimized && css_modules_entry_default4.cardMinimized),
|
|
1242
|
+
onFocusCapture: focusAnswerSurface,
|
|
1243
|
+
onBlurCapture: blurAnswerSurface,
|
|
1244
|
+
"aria-labelledby": questionId,
|
|
1245
|
+
"aria-busy": busy !== null,
|
|
999
1246
|
children: [
|
|
1000
|
-
/* @__PURE__ */ (0,
|
|
1001
|
-
/* @__PURE__ */ (0,
|
|
1002
|
-
|
|
1003
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1247
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("header", { className: css_modules_entry_default4.header, children: [
|
|
1248
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: css_modules_entry_default4.headingBlock, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css_modules_entry_default4.titleRow, children: [
|
|
1249
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1004
1250
|
"div",
|
|
1005
1251
|
{
|
|
1006
|
-
className:
|
|
1007
|
-
id:
|
|
1252
|
+
className: css_modules_entry_default4.title,
|
|
1253
|
+
id: questionId,
|
|
1008
1254
|
role: "heading",
|
|
1009
1255
|
"aria-level": 2,
|
|
1010
|
-
children: /* @__PURE__ */ (0,
|
|
1256
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.MarkdownText, { text: question.question, variant: "compact", labels: markdownLabels })
|
|
1011
1257
|
}
|
|
1012
|
-
)
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
countdown !== void 0 && card.waitState !== "waiting" && card.waitState !== "editing" && card.waitState !== "continued" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: QuestionComposer_default.waitStatus, children: t(card.timeoutMode === "default" ? "wait.auto" : "wait.extend") }),
|
|
1019
|
-
countdown !== void 0 && card.waitState !== "waiting" && card.waitState !== "editing" && card.waitState !== "continued" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "outline", className: QuestionComposer_default.waitButton, onClick: takeTime, children: t("wait.takeTime") }),
|
|
1020
|
-
card.state === "continued" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: QuestionComposer_default.waitStatus, children: t("wait.continued") }),
|
|
1021
|
-
countdown !== void 0 && (card.waitState === "waiting" || card.waitState === "editing") && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: QuestionComposer_default.waitStatus, children: t("wait.held") }),
|
|
1022
|
-
review !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: QuestionComposer_default.waitStatus, children: t("review.status") }),
|
|
1023
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1258
|
+
),
|
|
1259
|
+
question.header !== void 0 && question.header.trim() !== question.question.trim() && !question.question.toLocaleLowerCase().includes(question.header.trim().toLocaleLowerCase()) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css_modules_entry_default4.headerChip, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.MarkdownText, { text: question.header, variant: "compact", labels: markdownLabels }) }),
|
|
1260
|
+
review !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css_modules_entry_default4.statusChip, children: t("review.status") })
|
|
1261
|
+
] }) }),
|
|
1262
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css_modules_entry_default4.headerActions, children: [
|
|
1263
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1024
1264
|
"button",
|
|
1025
1265
|
{
|
|
1026
1266
|
type: "button",
|
|
1027
|
-
className:
|
|
1267
|
+
className: css_modules_entry_default4.iconButton,
|
|
1028
1268
|
"aria-label": t(minimized ? "nav.maximize" : "nav.minimize"),
|
|
1029
1269
|
title: t(minimized ? "nav.maximize" : "nav.minimize"),
|
|
1030
1270
|
"aria-expanded": !minimized,
|
|
@@ -1032,99 +1272,99 @@ function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
|
1032
1272
|
onClick: () => {
|
|
1033
1273
|
setMinimized((current) => !current);
|
|
1034
1274
|
},
|
|
1035
|
-
children: minimized ? /* @__PURE__ */ (0,
|
|
1275
|
+
children: minimized ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.IconChevronUpOutlineRegular, {}) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.IconChevronDownOutlineRegular, {})
|
|
1036
1276
|
}
|
|
1037
1277
|
),
|
|
1038
|
-
/* @__PURE__ */ (0,
|
|
1278
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1039
1279
|
"button",
|
|
1040
1280
|
{
|
|
1041
1281
|
type: "button",
|
|
1042
|
-
className:
|
|
1282
|
+
className: css_modules_entry_default4.iconButton,
|
|
1043
1283
|
"aria-label": t(pending.dismissal === "hide" ? "nav.close" : "nav.cancel"),
|
|
1044
1284
|
title: t(pending.dismissal === "hide" ? "nav.close" : "nav.cancel"),
|
|
1045
1285
|
disabled: busy !== null,
|
|
1046
1286
|
onClick: dismissFlow,
|
|
1047
|
-
children: /* @__PURE__ */ (0,
|
|
1287
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.IconCloseOutlineRegular, {})
|
|
1048
1288
|
}
|
|
1049
1289
|
)
|
|
1050
1290
|
] })
|
|
1051
1291
|
] }),
|
|
1052
|
-
|
|
1053
|
-
|
|
1292
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(QuestionWaitBar, { card, t, busy: busy !== null, onTakeTime: takeTime }),
|
|
1293
|
+
!minimized && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1294
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1054
1295
|
"div",
|
|
1055
1296
|
{
|
|
1056
|
-
|
|
1057
|
-
className: QuestionComposer_default.body,
|
|
1297
|
+
className: css_modules_entry_default4.body,
|
|
1058
1298
|
"data-question-scroll": true,
|
|
1059
|
-
onFocusCapture: focusAnswerSurface,
|
|
1060
|
-
onBlurCapture: blurAnswerSurface,
|
|
1061
1299
|
children: [
|
|
1062
|
-
question.detail !== void 0 && /* @__PURE__ */ (0,
|
|
1063
|
-
/* @__PURE__ */ (0,
|
|
1300
|
+
question.detail !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: css_modules_entry_default4.detail, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.MarkdownText, { text: question.detail, labels: markdownLabels }) }),
|
|
1301
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css_modules_entry_default4.options, role: hasOptions && question.multiSelect !== true ? "radiogroup" : "group", "aria-labelledby": questionId, children: [
|
|
1064
1302
|
(question.options ?? []).map((option, optionIndex) => {
|
|
1065
1303
|
const selected = draft.selected.includes(option.label);
|
|
1066
1304
|
const display = parseRecommendedLabel(option.label);
|
|
1067
|
-
return /* @__PURE__ */ (0,
|
|
1305
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1068
1306
|
"button",
|
|
1069
1307
|
{
|
|
1070
1308
|
type: "button",
|
|
1071
|
-
className: clsx_default(
|
|
1309
|
+
className: clsx_default(css_modules_entry_default4.option, selected && css_modules_entry_default4.optionSelected),
|
|
1072
1310
|
role: question.multiSelect === true ? "checkbox" : "radio",
|
|
1073
1311
|
"aria-checked": selected,
|
|
1074
|
-
"aria-label": display.label,
|
|
1312
|
+
"aria-label": display.recommended ? `${display.label}, ${t("option.recommended")}` : display.label,
|
|
1313
|
+
"aria-describedby": option.description === void 0 ? void 0 : `${questionId}-option-${String(optionIndex)}`,
|
|
1075
1314
|
disabled: locked,
|
|
1315
|
+
tabIndex: question.multiSelect === true || selected || draft.selected.length === 0 && optionIndex === 0 ? 0 : -1,
|
|
1316
|
+
onKeyDown: (event) => {
|
|
1317
|
+
navigateOptions(event, optionIndex);
|
|
1318
|
+
},
|
|
1076
1319
|
onClick: () => {
|
|
1077
1320
|
choose(option.label);
|
|
1078
1321
|
},
|
|
1079
|
-
onKeyDown: (event) => {
|
|
1080
|
-
if (event.key !== "Enter") return;
|
|
1081
|
-
event.preventDefault();
|
|
1082
|
-
submitDrafts(drafts);
|
|
1083
|
-
},
|
|
1084
1322
|
children: [
|
|
1085
|
-
question.multiSelect === true ? /* @__PURE__ */ (0,
|
|
1086
|
-
/* @__PURE__ */ (0,
|
|
1087
|
-
/* @__PURE__ */ (0,
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1323
|
+
question.multiSelect === true ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: clsx_default(css_modules_entry_default4.checkbox, selected && css_modules_entry_default4.checkboxChecked), "aria-hidden": "true", children: selected && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.IconCheckOutlineRegular, { size: 12 }) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: clsx_default(css_modules_entry_default4.radio, selected && css_modules_entry_default4.radioChecked), "aria-hidden": "true" }),
|
|
1324
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: css_modules_entry_default4.optionCopy, children: [
|
|
1325
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: css_modules_entry_default4.optionLine, children: [
|
|
1326
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css_modules_entry_default4.optionLabel, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.MarkdownText, { text: display.label, variant: "compact", labels: markdownLabels }) }),
|
|
1327
|
+
display.recommended && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css_modules_entry_default4.badge, children: t("option.recommended") })
|
|
1328
|
+
] }),
|
|
1329
|
+
option.description !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css_modules_entry_default4.description, id: `${questionId}-option-${String(optionIndex)}`, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.MarkdownText, { text: option.description, variant: "compact", labels: markdownLabels }) })
|
|
1330
|
+
] })
|
|
1091
1331
|
]
|
|
1092
1332
|
},
|
|
1093
1333
|
`${option.label}-${String(optionIndex)}`
|
|
1094
1334
|
);
|
|
1095
1335
|
}),
|
|
1096
|
-
review !== void 0 && draft.skipped && /* @__PURE__ */ (0,
|
|
1097
|
-
(review === void 0 || draft.custom !== "") && (hasOptions ? /* @__PURE__ */ (0,
|
|
1336
|
+
review !== void 0 && draft.skipped && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: css_modules_entry_default4.reviewNote, children: t("review.skipped") }),
|
|
1337
|
+
!fixedActions && (review === void 0 || draft.custom !== "") && (hasOptions ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1098
1338
|
"div",
|
|
1099
1339
|
{
|
|
1100
1340
|
className: clsx_default(
|
|
1101
|
-
|
|
1102
|
-
draft.custom !== "" &&
|
|
1103
|
-
question.multiSelect !== true && draft.selected.length > 0 && QuestionComposer_default.customRowYielded
|
|
1341
|
+
css_modules_entry_default4.customRow,
|
|
1342
|
+
draft.custom !== "" && css_modules_entry_default4.customRowActive
|
|
1104
1343
|
),
|
|
1105
1344
|
children: [
|
|
1106
|
-
question.multiSelect === true ? /* @__PURE__ */ (0,
|
|
1345
|
+
question.multiSelect === true ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1107
1346
|
"span",
|
|
1108
1347
|
{
|
|
1109
|
-
className: clsx_default(
|
|
1348
|
+
className: clsx_default(css_modules_entry_default4.checkbox, draft.custom !== "" && css_modules_entry_default4.checkboxChecked),
|
|
1110
1349
|
"aria-hidden": "true",
|
|
1111
|
-
children: draft.custom !== "" && /* @__PURE__ */ (0,
|
|
1350
|
+
children: draft.custom !== "" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.IconCheckOutlineRegular, { size: 12 })
|
|
1112
1351
|
}
|
|
1113
|
-
) : /* @__PURE__ */ (0,
|
|
1114
|
-
/* @__PURE__ */ (0,
|
|
1352
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css_modules_entry_default4.customIcon, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.IconEditOutlineRegular, { size: 12 }) }),
|
|
1353
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1115
1354
|
AnswerField,
|
|
1116
1355
|
{
|
|
1117
1356
|
variant: "inline",
|
|
1118
1357
|
value: draft.custom,
|
|
1119
1358
|
disabled: locked,
|
|
1120
1359
|
placeholder: t("custom.placeholder"),
|
|
1360
|
+
labelledBy: questionId,
|
|
1121
1361
|
onChange: draftCustom,
|
|
1122
1362
|
onKeyDown: continueFromCustom
|
|
1123
1363
|
}
|
|
1124
1364
|
)
|
|
1125
1365
|
]
|
|
1126
1366
|
}
|
|
1127
|
-
) : /* @__PURE__ */ (0,
|
|
1367
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1128
1368
|
AnswerField,
|
|
1129
1369
|
{
|
|
1130
1370
|
autoFocus: canSubmit && countdown === void 0 && !locked && !focusedQuestions.current.has(index),
|
|
@@ -1132,6 +1372,7 @@ function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
|
1132
1372
|
value: draft.custom,
|
|
1133
1373
|
disabled: locked,
|
|
1134
1374
|
placeholder: t("custom.placeholder"),
|
|
1375
|
+
labelledBy: questionId,
|
|
1135
1376
|
onFocus: () => {
|
|
1136
1377
|
focusedQuestions.current.add(index);
|
|
1137
1378
|
},
|
|
@@ -1143,52 +1384,57 @@ function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
|
1143
1384
|
]
|
|
1144
1385
|
}
|
|
1145
1386
|
),
|
|
1146
|
-
/* @__PURE__ */ (0,
|
|
1147
|
-
/* @__PURE__ */ (0,
|
|
1148
|
-
/* @__PURE__ */ (0,
|
|
1387
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("footer", { className: css_modules_entry_default4.footer, children: [
|
|
1388
|
+
questions.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css_modules_entry_default4.pager, children: [
|
|
1389
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1149
1390
|
"button",
|
|
1150
1391
|
{
|
|
1151
1392
|
type: "button",
|
|
1152
|
-
className:
|
|
1393
|
+
className: css_modules_entry_default4.iconButton,
|
|
1153
1394
|
"aria-label": t("nav.prev"),
|
|
1154
1395
|
disabled: index === 0 || busy !== null,
|
|
1155
1396
|
onClick: () => {
|
|
1156
1397
|
replaceProgress(index - 1, drafts);
|
|
1157
1398
|
setError(null);
|
|
1158
1399
|
},
|
|
1159
|
-
children: /* @__PURE__ */ (0,
|
|
1400
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.IconChevronLeftOutlineRegular, {})
|
|
1160
1401
|
}
|
|
1161
1402
|
),
|
|
1162
|
-
/* @__PURE__ */ (0,
|
|
1403
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: css_modules_entry_default4.progress, children: [
|
|
1163
1404
|
index + 1,
|
|
1164
1405
|
" / ",
|
|
1165
1406
|
questions.length
|
|
1166
1407
|
] }),
|
|
1167
|
-
/* @__PURE__ */ (0,
|
|
1408
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1168
1409
|
"button",
|
|
1169
1410
|
{
|
|
1170
1411
|
type: "button",
|
|
1171
|
-
className:
|
|
1412
|
+
className: css_modules_entry_default4.iconButton,
|
|
1172
1413
|
"aria-label": t("nav.next"),
|
|
1173
1414
|
disabled: index === questions.length - 1 || busy !== null,
|
|
1174
1415
|
onClick: () => {
|
|
1175
1416
|
replaceProgress(index + 1, drafts);
|
|
1176
1417
|
setError(null);
|
|
1177
1418
|
},
|
|
1178
|
-
children: /* @__PURE__ */ (0,
|
|
1419
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.IconChevronRightOutlineRegular, {})
|
|
1179
1420
|
}
|
|
1180
1421
|
)
|
|
1181
1422
|
] }),
|
|
1182
|
-
/* @__PURE__ */ (0,
|
|
1183
|
-
review === void 0 && /* @__PURE__ */ (0,
|
|
1184
|
-
/* @__PURE__ */ (0,
|
|
1185
|
-
/* @__PURE__ */ (0,
|
|
1423
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: css_modules_entry_default4.feedback, role: "status", "aria-atomic": "true", "data-error": error !== null && (!("key" in error) || error.key !== "status.sent") || void 0, children: error === null ? null : "key" in error ? t(error.key) : error.text }),
|
|
1424
|
+
review === void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css_modules_entry_default4.footerActions, children: [
|
|
1425
|
+
!fixedActions && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "outline", className: css_modules_entry_default4.button, disabled: busy !== null, onClick: skipQuestion, children: t("action.skip") }),
|
|
1426
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1186
1427
|
import_dsh_client_ui_primitives3.Button,
|
|
1187
1428
|
{
|
|
1188
1429
|
variant: "primary",
|
|
1430
|
+
className: css_modules_entry_default4.primary,
|
|
1431
|
+
"aria-busy": busy === "answer",
|
|
1189
1432
|
disabled: busy !== null || !answered(draft) || index === questions.length - 1 && !canSubmit,
|
|
1190
1433
|
onClick: continueFlow,
|
|
1191
|
-
children:
|
|
1434
|
+
children: [
|
|
1435
|
+
busy === "answer" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css_modules_entry_default4.spinner, "aria-hidden": "true" }),
|
|
1436
|
+
busy === "answer" ? t("submitting") : index === questions.length - 1 ? t("submit") : t("action.next")
|
|
1437
|
+
]
|
|
1192
1438
|
}
|
|
1193
1439
|
)
|
|
1194
1440
|
] })
|
|
@@ -1199,7 +1445,7 @@ function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
|
1199
1445
|
) });
|
|
1200
1446
|
}
|
|
1201
1447
|
|
|
1202
|
-
//
|
|
1448
|
+
// node_modules/@deepseek-ai/dsh-session/lib/types/surface.js
|
|
1203
1449
|
var SURFACE_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
1204
1450
|
"system/message",
|
|
1205
1451
|
"developer/message",
|
|
@@ -1258,8 +1504,8 @@ function replyPairsOf(text) {
|
|
|
1258
1504
|
}
|
|
1259
1505
|
return { questions, answers };
|
|
1260
1506
|
}
|
|
1261
|
-
function replyAnswerValues(data,
|
|
1262
|
-
const answer = data.answers.find((item) => item.id ===
|
|
1507
|
+
function replyAnswerValues(data, id7) {
|
|
1508
|
+
const answer = data.answers.find((item) => item.id === id7);
|
|
1263
1509
|
const custom = answer?.custom?.trim() ?? "";
|
|
1264
1510
|
return [...answer?.selected ?? [], ...custom === "" ? [] : [custom]];
|
|
1265
1511
|
}
|
|
@@ -1318,86 +1564,130 @@ var questionReplyDefinition = {
|
|
|
1318
1564
|
};
|
|
1319
1565
|
|
|
1320
1566
|
// src/client/QuestionReplyView.tsx
|
|
1321
|
-
var
|
|
1567
|
+
var import_react5 = require("react");
|
|
1322
1568
|
var import_dsh_client_ui_primitives4 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
1323
1569
|
|
|
1324
1570
|
// src/client/QuestionReplyView.module.css
|
|
1325
|
-
var
|
|
1326
|
-
var
|
|
1327
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(
|
|
1571
|
+
var css5 = "/* src/client/QuestionReplyView.module.css */\n.QuestionReplyView_row {\n --cfg-line: var(--dsw-alias-border-l2);\n --cfg-line-strong: var(--dsw-alias-border-l3);\n --cfg-surface: var(--dsw-alias-bg-layer-2);\n --cfg-sunken: color-mix(in srgb, var(--dsw-alias-label-primary) 4%, var(--dsw-alias-bg-layer-1));\n --cfg-ink: var(--dsw-alias-label-primary);\n --cfg-muted: var(--dsw-alias-label-secondary);\n --cfg-accent: #3388bb;\n --cfg-accent-text: #14587f;\n --cfg-hover: var(--dsw-alias-interactive-bg-hover);\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n gap: 4px;\n min-width: 0;\n padding: 4px 0;\n}\n.QuestionReplyView_bubble {\n max-width: 85%;\n min-width: 0;\n overflow: hidden;\n border: 1px solid var(--cfg-line);\n border-radius: 12px;\n background: var(--cfg-surface);\n color: var(--cfg-ink);\n font-size: inherit;\n line-height: 1.5;\n text-align: left;\n overflow-wrap: anywhere;\n}\n.QuestionReplyView_toggle {\n appearance: none;\n display: block;\n width: 100%;\n padding: 10px 12px;\n border: 0;\n background: transparent;\n color: inherit;\n cursor: pointer;\n font: inherit;\n text-align: left;\n transition: background-color 100ms ease;\n}\n.QuestionReplyView_toggle:hover {\n background: var(--cfg-hover);\n}\n.QuestionReplyView_toggle:focus-visible {\n outline: 2px solid var(--cfg-accent);\n outline-offset: -3px;\n border-radius: 8px;\n}\n.QuestionReplyView_labelRow {\n display: flex;\n align-items: center;\n gap: 6px;\n}\n.QuestionReplyView_caret {\n display: inline-flex;\n flex: none;\n color: var(--cfg-muted);\n}\n.QuestionReplyView_caret svg {\n width: 12px;\n height: 12px;\n}\n.QuestionReplyView_label {\n color: var(--cfg-muted);\n font-size: 11px;\n line-height: 18px;\n font-weight: 500;\n}\n.QuestionReplyView_summary {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n margin-top: 4px;\n white-space: pre-wrap;\n}\n.QuestionReplyView_text {\n margin: 0;\n padding: 0 12px 12px;\n white-space: pre-wrap;\n}\n.QuestionReplyView_details {\n max-height: min(50vh, 400px);\n margin: 0;\n padding: 0 12px 12px;\n overflow: auto;\n overscroll-behavior: contain;\n scrollbar-width: thin;\n scrollbar-gutter: stable;\n}\n.QuestionReplyView_details > div {\n padding-top: 10px;\n border-top: 1px solid var(--cfg-line);\n}\n.QuestionReplyView_details > div + div {\n margin-top: 12px;\n}\n.QuestionReplyView_question {\n display: grid;\n gap: 4px;\n font-size: inherit;\n}\n.QuestionReplyView_questionText {\n font-weight: 500;\n}\n.QuestionReplyView_header,\n.QuestionReplyView_detail,\n.QuestionReplyView_options {\n color: var(--cfg-muted);\n font-size: 12px;\n}\n.QuestionReplyView_detail {\n white-space: pre-wrap;\n}\n.QuestionReplyView_options {\n display: grid;\n gap: 4px;\n margin: 4px 0 0;\n padding: 0;\n list-style: none;\n}\n.QuestionReplyView_options li {\n display: flex;\n align-items: flex-start;\n gap: 6px;\n padding: 6px 8px;\n border: 1px solid transparent;\n border-radius: 8px;\n}\n.QuestionReplyView_options li[data-selected] {\n border-color: var(--cfg-accent);\n color: var(--cfg-ink);\n background: color-mix(in srgb, var(--cfg-accent) 8%, transparent);\n}\n.QuestionReplyView_selection {\n display: grid;\n place-items: center;\n width: 16px;\n height: 18px;\n flex: none;\n color: var(--cfg-accent);\n}\n.QuestionReplyView_optionCopy {\n display: grid;\n min-width: 0;\n gap: 2px;\n}\n.QuestionReplyView_optionDescription {\n color: var(--cfg-muted);\n}\n.QuestionReplyView_answer {\n margin: 8px 0 0;\n white-space: pre-wrap;\n}\n.QuestionReplyView_answerLabel {\n margin-right: 4px;\n color: var(--cfg-muted);\n font-size: 11px;\n line-height: 18px;\n}\n.QuestionReplyView_actions {\n display: flex;\n align-items: center;\n gap: 4px;\n padding-right: 2px;\n color: var(--dsw-alias-label-tertiary);\n}\n.QuestionReplyView_time {\n font-size: 11px;\n font-variant-numeric: tabular-nums;\n}\n.QuestionReplyView_action {\n appearance: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n padding: 0;\n border: 0;\n border-radius: 6px;\n background: transparent;\n color: inherit;\n cursor: pointer;\n transition: background-color 140ms ease, color 140ms ease;\n}\n.QuestionReplyView_action svg {\n width: 14px;\n height: 14px;\n}\n.QuestionReplyView_action:hover {\n background: var(--cfg-hover);\n color: var(--cfg-ink);\n}\n.QuestionReplyView_action:focus-visible {\n outline: 2px solid var(--cfg-accent);\n outline-offset: 2px;\n}\n.QuestionReplyView_action:disabled {\n opacity: .4;\n cursor: default;\n}\n.QuestionReplyView_copyFeedback {\n color: var(--cfg-muted);\n font-size: 12px;\n}\n.QuestionReplyView_copyFeedback[role=alert] {\n color: var(--dsw-alias-state-error-primary);\n}\n.QuestionReplyView_copyFeedback:empty {\n display: none;\n}\n.QuestionReplyView_spinner {\n width: 12px;\n height: 12px;\n border: 1px solid currentColor;\n border-right-color: transparent;\n border-radius: 50%;\n animation: QuestionReplyView_spin 800ms linear infinite;\n}\n@keyframes QuestionReplyView_spin {\n to {\n transform: rotate(360deg);\n }\n}\n.QuestionReplyView_question,\n.QuestionReplyView_answer,\n.QuestionReplyView_text {\n min-width: 0;\n overflow-wrap: anywhere;\n}\n@media (max-width: 640px) {\n .QuestionReplyView_bubble {\n max-width: 100%;\n }\n}\n@media (pointer: coarse) {\n .QuestionReplyView_toggle {\n min-height: 44px;\n }\n .QuestionReplyView_action {\n width: 44px;\n height: 44px;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .QuestionReplyView_toggle,\n .QuestionReplyView_action {\n transition: none;\n }\n .QuestionReplyView_spinner {\n animation: none;\n }\n}\n[data-ds-dark-theme] .QuestionReplyView_row {\n --cfg-accent: #4eb0e8;\n --cfg-accent-text: #6fc0ee;\n}\n";
|
|
1572
|
+
var id5 = "dsh-better-ask-user/QuestionReplyView.module.css";
|
|
1573
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(id5) + "]") === null) {
|
|
1328
1574
|
const tag = document.createElement("style");
|
|
1329
1575
|
tag.dataset.plugin = "dsh-better-ask-user";
|
|
1330
|
-
tag.dataset.pluginCss =
|
|
1331
|
-
tag.textContent =
|
|
1576
|
+
tag.dataset.pluginCss = id5;
|
|
1577
|
+
tag.textContent = css5;
|
|
1332
1578
|
document.head.appendChild(tag);
|
|
1333
1579
|
}
|
|
1334
|
-
var QuestionReplyView_default = {
|
|
1580
|
+
var QuestionReplyView_default = {
|
|
1581
|
+
row: "QuestionReplyView_row",
|
|
1582
|
+
bubble: "QuestionReplyView_bubble",
|
|
1583
|
+
toggle: "QuestionReplyView_toggle",
|
|
1584
|
+
labelRow: "QuestionReplyView_labelRow",
|
|
1585
|
+
caret: "QuestionReplyView_caret",
|
|
1586
|
+
label: "QuestionReplyView_label",
|
|
1587
|
+
summary: "QuestionReplyView_summary",
|
|
1588
|
+
text: "QuestionReplyView_text",
|
|
1589
|
+
details: "QuestionReplyView_details",
|
|
1590
|
+
question: "QuestionReplyView_question",
|
|
1591
|
+
questionText: "QuestionReplyView_questionText",
|
|
1592
|
+
header: "QuestionReplyView_header",
|
|
1593
|
+
detail: "QuestionReplyView_detail",
|
|
1594
|
+
options: "QuestionReplyView_options",
|
|
1595
|
+
selection: "QuestionReplyView_selection",
|
|
1596
|
+
optionCopy: "QuestionReplyView_optionCopy",
|
|
1597
|
+
optionDescription: "QuestionReplyView_optionDescription",
|
|
1598
|
+
answer: "QuestionReplyView_answer",
|
|
1599
|
+
answerLabel: "QuestionReplyView_answerLabel",
|
|
1600
|
+
actions: "QuestionReplyView_actions",
|
|
1601
|
+
time: "QuestionReplyView_time",
|
|
1602
|
+
action: "QuestionReplyView_action",
|
|
1603
|
+
copyFeedback: "QuestionReplyView_copyFeedback",
|
|
1604
|
+
spinner: "QuestionReplyView_spinner",
|
|
1605
|
+
spin: "QuestionReplyView_spin"
|
|
1606
|
+
};
|
|
1607
|
+
var css_modules_entry_default5 = QuestionReplyView_default;
|
|
1335
1608
|
|
|
1336
1609
|
// src/client/QuestionReplyView.tsx
|
|
1337
|
-
var
|
|
1338
|
-
var QuestionReplyView = (0,
|
|
1339
|
-
return /* @__PURE__ */ (0,
|
|
1610
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1611
|
+
var QuestionReplyView = (0, import_react5.memo)(function QuestionReplyView2({ node, t }) {
|
|
1612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(QuestionReplyBubble, { data: node.data, t });
|
|
1340
1613
|
});
|
|
1341
1614
|
function QuestionReplyBubble({ data, t }) {
|
|
1342
1615
|
const label = t("reply.label");
|
|
1343
|
-
const [open, setOpen] = (0,
|
|
1616
|
+
const [open, setOpen] = (0, import_react5.useState)(false);
|
|
1344
1617
|
const toggleLabel = t(open ? "reply.close" : "reply.open");
|
|
1345
|
-
const summary = data.questions.
|
|
1618
|
+
const summary = data.questions.length === 0 ? data.text : data.questions.flatMap((question) => replyAnswerValues(data, question.id)).join(", ");
|
|
1346
1619
|
const copyText = replyClipboardText(data, t);
|
|
1347
|
-
const
|
|
1348
|
-
const
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1620
|
+
const detailsId = (0, import_react5.useId)();
|
|
1621
|
+
const [copyState, setCopyState] = (0, import_react5.useState)("idle");
|
|
1622
|
+
const copyTimer = (0, import_react5.useRef)();
|
|
1623
|
+
(0, import_react5.useEffect)(() => () => {
|
|
1624
|
+
window.clearTimeout(copyTimer.current);
|
|
1625
|
+
}, []);
|
|
1626
|
+
const onCopy = (0, import_react5.useCallback)(async () => {
|
|
1627
|
+
if (copyState === "copying" || copyState === "copied") return;
|
|
1628
|
+
window.clearTimeout(copyTimer.current);
|
|
1629
|
+
setCopyState("copying");
|
|
1630
|
+
try {
|
|
1631
|
+
const ok = await (0, import_dsh_client_ui_primitives4.writeClipboard)(copyText);
|
|
1632
|
+
setCopyState(ok ? "copied" : "error");
|
|
1633
|
+
if (ok) copyTimer.current = window.setTimeout(() => {
|
|
1634
|
+
setCopyState("idle");
|
|
1635
|
+
}, 1500);
|
|
1636
|
+
} catch {
|
|
1637
|
+
setCopyState("error");
|
|
1638
|
+
}
|
|
1639
|
+
}, [copyState, copyText]);
|
|
1640
|
+
const copyLabel = copyState === "copied" ? t("copied") : t("copy");
|
|
1641
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: css_modules_entry_default5.row, "data-question-reply": data.callId, "data-reply-outcome": data.outcome, role: "group", "aria-label": label, children: [
|
|
1642
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: css_modules_entry_default5.bubble, children: [
|
|
1643
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1361
1644
|
"button",
|
|
1362
1645
|
{
|
|
1363
1646
|
type: "button",
|
|
1364
|
-
className:
|
|
1647
|
+
className: css_modules_entry_default5.toggle,
|
|
1365
1648
|
"aria-expanded": open,
|
|
1649
|
+
"aria-controls": open ? detailsId : void 0,
|
|
1366
1650
|
"aria-label": `${label} \xB7 ${toggleLabel}`,
|
|
1367
1651
|
onClick: () => {
|
|
1368
1652
|
setOpen((value) => !value);
|
|
1369
1653
|
},
|
|
1370
1654
|
children: [
|
|
1371
|
-
/* @__PURE__ */ (0,
|
|
1372
|
-
/* @__PURE__ */ (0,
|
|
1373
|
-
/* @__PURE__ */ (0,
|
|
1655
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: css_modules_entry_default5.labelRow, children: [
|
|
1656
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css_modules_entry_default5.caret, "aria-hidden": "true", children: open ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives4.IconChevronDownOutlineRegular, {}) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives4.IconChevronRightOutlineRegular, {}) }),
|
|
1657
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css_modules_entry_default5.label, children: label })
|
|
1374
1658
|
] }),
|
|
1375
|
-
!open && /* @__PURE__ */ (0,
|
|
1659
|
+
!open && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css_modules_entry_default5.summary, children: summary === "" ? t("reply.skipped") : summary })
|
|
1376
1660
|
]
|
|
1377
1661
|
}
|
|
1378
1662
|
),
|
|
1379
|
-
open && (data.questions.length === 0 ? /* @__PURE__ */ (0,
|
|
1663
|
+
open && (data.questions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: css_modules_entry_default5.text, id: detailsId, children: data.text }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dl", { className: css_modules_entry_default5.details, id: detailsId, children: data.questions.map((question) => {
|
|
1380
1664
|
const values = replyAnswerValues(data, question.id);
|
|
1381
|
-
return /* @__PURE__ */ (0,
|
|
1382
|
-
/* @__PURE__ */ (0,
|
|
1383
|
-
question.header && question.header !== question.question && /* @__PURE__ */ (0,
|
|
1384
|
-
/* @__PURE__ */ (0,
|
|
1385
|
-
question.detail && /* @__PURE__ */ (0,
|
|
1386
|
-
question.options && question.options.length > 0 && /* @__PURE__ */ (0,
|
|
1387
|
-
option.label,
|
|
1388
|
-
|
|
1665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
1666
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("dt", { className: css_modules_entry_default5.question, children: [
|
|
1667
|
+
question.header && question.header !== question.question && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css_modules_entry_default5.header, children: question.header }),
|
|
1668
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css_modules_entry_default5.questionText, children: question.question }),
|
|
1669
|
+
question.detail && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css_modules_entry_default5.detail, children: question.detail }),
|
|
1670
|
+
question.options && question.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { className: css_modules_entry_default5.options, children: question.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("li", { "data-selected": values.includes(option.label) || void 0, children: [
|
|
1671
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css_modules_entry_default5.selection, "aria-hidden": "true", children: values.includes(option.label) ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives4.IconCheckOutlineRegular, { size: 12 }) : null }),
|
|
1672
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: css_modules_entry_default5.optionCopy, children: [
|
|
1673
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: option.label }),
|
|
1674
|
+
option.description && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css_modules_entry_default5.optionDescription, children: option.description })
|
|
1675
|
+
] })
|
|
1389
1676
|
] }, option.label)) })
|
|
1390
1677
|
] }),
|
|
1391
|
-
/* @__PURE__ */ (0,
|
|
1392
|
-
/* @__PURE__ */ (0,
|
|
1678
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("dd", { className: css_modules_entry_default5.answer, children: [
|
|
1679
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css_modules_entry_default5.answerLabel, children: t("reply.answerLabel") }),
|
|
1393
1680
|
values.length === 0 ? t("reply.skipped") : values.join(", ")
|
|
1394
1681
|
] })
|
|
1395
1682
|
] }, question.id);
|
|
1396
1683
|
}) }))
|
|
1397
1684
|
] }),
|
|
1398
|
-
/* @__PURE__ */ (0,
|
|
1399
|
-
/* @__PURE__ */ (0,
|
|
1400
|
-
/* @__PURE__ */ (0,
|
|
1685
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: css_modules_entry_default5.actions, children: [
|
|
1686
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css_modules_entry_default5.time, children: new Intl.DateTimeFormat(void 0, { hour: "2-digit", minute: "2-digit", hour12: false }).format(data.time) }),
|
|
1687
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives4.Tooltip, { label: copyLabel, side: "bottom", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: css_modules_entry_default5.action, "aria-label": copyLabel, "aria-busy": copyState === "copying", disabled: copyState === "copying", onClick: () => {
|
|
1688
|
+
void onCopy();
|
|
1689
|
+
}, children: copyState === "copying" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css_modules_entry_default5.spinner, "aria-hidden": "true" }) : copyState === "copied" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives4.IconCheckOutlineRegular, {}) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives4.IconCopyOutlineRegular, {}) }) }),
|
|
1690
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css_modules_entry_default5.copyFeedback, role: copyState === "error" ? "alert" : "status", children: copyState === "error" ? t("reply.copyFailed") : copyState === "copied" ? t("copied") : null })
|
|
1401
1691
|
] })
|
|
1402
1692
|
] });
|
|
1403
1693
|
}
|
|
@@ -1412,8 +1702,12 @@ var zh = {
|
|
|
1412
1702
|
"history.title": "\u95EE\u9898",
|
|
1413
1703
|
"history.review": "\u67E5\u770B",
|
|
1414
1704
|
"history.reopen": "\u6253\u5F00",
|
|
1705
|
+
"history.unavailable": "\u95EE\u9898\u6682\u65F6\u65E0\u6CD5\u6253\u5F00\uFF0C\u8BF7\u91CD\u8BD5\u3002",
|
|
1706
|
+
"reply.copyFailed": "\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002",
|
|
1415
1707
|
"wait.takeTime": "\u6162\u6162\u56DE\u7B54",
|
|
1416
1708
|
"wait.countdown": "{seconds} \u79D2\u540E\u7EE7\u7EED\u5DE5\u4F5C",
|
|
1709
|
+
"wait.autoCountdown": "{seconds} \u79D2\u540E\u81EA\u52A8\u9009\u62E9\u9ED8\u8BA4\u9879",
|
|
1710
|
+
"wait.pauseLabel": "\u5DF2\u6682\u505C",
|
|
1417
1711
|
"wait.paused": "\u5DF2\u6682\u505C \xB7 \u5269\u4F59 {seconds} \u79D2",
|
|
1418
1712
|
"wait.held": "\u4F1A\u4E00\u76F4\u7B49\u4F60\u56DE\u7B54",
|
|
1419
1713
|
"wait.extend": "\u8F93\u5165\u4F1A\u81EA\u52A8\u7EED\u671F",
|
|
@@ -1421,7 +1715,7 @@ var zh = {
|
|
|
1421
1715
|
"wait.continued": "\u5DF2\u7EE7\u7EED\u5DE5\u4F5C\uFF0C\u4ECD\u53EF\u56DE\u7B54",
|
|
1422
1716
|
"review.status": "\u5DF2\u56DE\u7B54",
|
|
1423
1717
|
"review.skipped": "\u8FD9\u9053\u95EE\u9898\u5F53\u65F6\u88AB\u8DF3\u8FC7\u3002",
|
|
1424
|
-
"reply.label": "\
|
|
1718
|
+
"reply.label": "\u95EE\u9898\u56DE\u590D",
|
|
1425
1719
|
"reply.open": "\u5C55\u5F00\u95EE\u9898\u8BE6\u60C5",
|
|
1426
1720
|
"reply.close": "\u6536\u8D77\u95EE\u9898\u8BE6\u60C5",
|
|
1427
1721
|
"reply.answerLabel": "\u56DE\u7B54\uFF1A",
|
|
@@ -1450,8 +1744,12 @@ var en = {
|
|
|
1450
1744
|
"history.title": "Question",
|
|
1451
1745
|
"history.review": "Review",
|
|
1452
1746
|
"history.reopen": "Open",
|
|
1747
|
+
"history.unavailable": "Cannot open this question right now. Try again.",
|
|
1748
|
+
"reply.copyFailed": "Copy failed. Try again.",
|
|
1453
1749
|
"wait.takeTime": "Take time",
|
|
1454
1750
|
"wait.countdown": "Continuing in {seconds}s",
|
|
1751
|
+
"wait.autoCountdown": "Defaults selected in {seconds}s",
|
|
1752
|
+
"wait.pauseLabel": "Paused",
|
|
1455
1753
|
"wait.paused": "Paused \xB7 {seconds}s remaining",
|
|
1456
1754
|
"wait.held": "Waiting until you answer",
|
|
1457
1755
|
"wait.extend": "Typing extends the wait",
|
|
@@ -1459,7 +1757,7 @@ var en = {
|
|
|
1459
1757
|
"wait.continued": "Work continued \u2014 you can still answer",
|
|
1460
1758
|
"review.status": "Answered",
|
|
1461
1759
|
"review.skipped": "This question was skipped.",
|
|
1462
|
-
"reply.label": "
|
|
1760
|
+
"reply.label": "Question reply",
|
|
1463
1761
|
"reply.open": "Open question details",
|
|
1464
1762
|
"reply.close": "Close question details",
|
|
1465
1763
|
"reply.answerLabel": "Answer: ",
|
|
@@ -1481,60 +1779,117 @@ var en = {
|
|
|
1481
1779
|
};
|
|
1482
1780
|
|
|
1483
1781
|
// src/client/settings.tsx
|
|
1484
|
-
var
|
|
1782
|
+
var import_react6 = require("react");
|
|
1485
1783
|
|
|
1486
1784
|
// src/client/settings-locales.ts
|
|
1487
1785
|
var settingsZh = {
|
|
1488
|
-
summary: "\
|
|
1489
|
-
title: "\u63D0\u95EE
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1786
|
+
summary: "\u7B49\u5F85\u4E0E\u8D85\u65F6",
|
|
1787
|
+
title: "\u63D0\u95EE",
|
|
1788
|
+
waitLabel: "\u7B49\u5F85",
|
|
1789
|
+
durationLabel: "\u7B49\u5F85\u65F6\u957F\uFF08\u79D2\uFF09",
|
|
1790
|
+
timed: "\u5012\u8BA1\u65F6",
|
|
1791
|
+
unlimited: "\u4E0D\u9650\u65F6",
|
|
1792
|
+
seconds: "\u79D2",
|
|
1793
|
+
waitHint: "\u8F93\u5165\u65F6\u91CD\u65B0\u8BA1\u65F6\u3002",
|
|
1794
|
+
unlimitedHint: "\u4E00\u76F4\u7B49\u5F85\u56DE\u7B54\uFF0C\u8F93\u5165\u65E0\u9700\u7EED\u671F\u3002",
|
|
1795
|
+
timeoutTitle: "\u8D85\u65F6\u540E",
|
|
1796
|
+
behaviorLabel: "\u666E\u901A\u4F1A\u8BDD",
|
|
1797
|
+
goalBehaviorLabel: "Goal \u6D3B\u8DC3\u65F6",
|
|
1798
|
+
native: "\u7EE7\u7EED\u5DE5\u4F5C",
|
|
1799
|
+
default: "\u9009\u62E9\u9ED8\u8BA4\u7B54\u6848",
|
|
1800
|
+
advanced: "\u9AD8\u7EA7",
|
|
1801
|
+
discard: "\u653E\u5F03\u6539\u52A8",
|
|
1802
|
+
nativeHint: "\u8D85\u65F6\u540E\u4ECD\u53EF\u56DE\u7B54\uFF0C\u4E0D\u4F1A\u81EA\u52A8\u540C\u610F\u3002",
|
|
1803
|
+
defaultHint: "\u8D85\u65F6\u540E\u81EA\u52A8\u63D0\u4EA4\u9ED8\u8BA4\u7B54\u6848\u3002",
|
|
1804
|
+
timeoutDisabled: "\u4E0D\u9650\u65F6\u6A21\u5F0F\u4E0B\u4E0D\u89E6\u53D1\u8D85\u65F6\u884C\u4E3A\uFF0C\u4FDD\u7559\u4EE5\u4E0B\u6B21\u4F7F\u7528\u3002",
|
|
1499
1805
|
readonly: "\u5F53\u524D\u914D\u7F6E\u4E3A\u53EA\u8BFB\u3002",
|
|
1500
1806
|
loading: "\u6B63\u5728\u8BFB\u53D6\u8BBE\u7F6E\u2026",
|
|
1501
1807
|
unavailable: "\u5F53\u524D\u8FDE\u63A5\u4E0B\u8BE5\u914D\u7F6E\u4E0D\u53EF\u7528\u3002",
|
|
1502
|
-
waiting: "\u6B63\u5728\u7B49\u5F85\u5BBF\u4E3B\
|
|
1503
|
-
invalidWait: "\u7B49\u5F85\u65F6\u957F\
|
|
1808
|
+
waiting: "\u6B63\u5728\u7B49\u5F85\u5BBF\u4E3B\u914D\u7F6E\u2026",
|
|
1809
|
+
invalidWait: "\u7B49\u5F85\u65F6\u957F\u987B\u4E3A 1 \u5230 2147483 \u7684\u6574\u6570\u3002",
|
|
1504
1810
|
save: "\u4FDD\u5B58",
|
|
1505
1811
|
saving: "\u4FDD\u5B58\u4E2D\u2026",
|
|
1506
|
-
saved: "\u5DF2\u4FDD\u5B58\
|
|
1812
|
+
saved: "\u5DF2\u4FDD\u5B58\uFF0C\u5BF9\u65B0\u63D0\u95EE\u751F\u6548",
|
|
1507
1813
|
conflict: "\u8BBE\u7F6E\u5DF2\u88AB\u5176\u4ED6\u7A97\u53E3\u4FEE\u6539\uFF0C\u8BF7\u91CD\u8BD5\u3002",
|
|
1508
1814
|
saveFailed: "\u4FDD\u5B58\u5931\u8D25\uFF1A",
|
|
1509
1815
|
dirty: "\u6709\u672A\u4FDD\u5B58\u7684\u4FEE\u6539"
|
|
1510
1816
|
};
|
|
1511
1817
|
var settingsEn = {
|
|
1512
|
-
summary: "
|
|
1513
|
-
title: "
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1818
|
+
summary: "Wait and timeout",
|
|
1819
|
+
title: "Questions",
|
|
1820
|
+
waitLabel: "Wait",
|
|
1821
|
+
durationLabel: "Wait duration in seconds",
|
|
1822
|
+
timed: "Countdown",
|
|
1823
|
+
unlimited: "Unlimited",
|
|
1824
|
+
seconds: "sec",
|
|
1825
|
+
waitHint: "Typing restarts the countdown.",
|
|
1826
|
+
unlimitedHint: "Wait until answered, with no countdown to extend.",
|
|
1827
|
+
timeoutTitle: "At timeout",
|
|
1828
|
+
behaviorLabel: "Standard session",
|
|
1829
|
+
goalBehaviorLabel: "Active Goal",
|
|
1830
|
+
native: "Continue work",
|
|
1831
|
+
default: "Use defaults",
|
|
1832
|
+
advanced: "Advanced",
|
|
1833
|
+
discard: "Discard",
|
|
1834
|
+
nativeHint: "You can still answer after timeout. Nothing is automatically approved.",
|
|
1835
|
+
defaultHint: "Submits default answers when the countdown ends.",
|
|
1836
|
+
timeoutDisabled: "Timeout behavior is inactive while waiting without a limit. Your choices are kept.",
|
|
1523
1837
|
readonly: "This configuration is read-only.",
|
|
1524
1838
|
loading: "Loading settings\u2026",
|
|
1525
1839
|
unavailable: "This configuration is unavailable on the current connection.",
|
|
1526
|
-
waiting: "Waiting for
|
|
1527
|
-
invalidWait: "
|
|
1840
|
+
waiting: "Waiting for host configuration\u2026",
|
|
1841
|
+
invalidWait: "Enter a whole number from 1 to 2147483 seconds.",
|
|
1528
1842
|
save: "Save",
|
|
1529
1843
|
saving: "Saving\u2026",
|
|
1530
|
-
saved: "Saved
|
|
1844
|
+
saved: "Saved for new questions",
|
|
1531
1845
|
conflict: "The settings changed in another window; try again.",
|
|
1532
1846
|
saveFailed: "Save failed: ",
|
|
1533
1847
|
dirty: "Unsaved changes"
|
|
1534
1848
|
};
|
|
1535
1849
|
|
|
1850
|
+
// src/client/settings.module.css
|
|
1851
|
+
var css6 = "/* src/client/settings.module.css */\n.settings_cfg {\n --ui-accent: #3388bb;\n --ui-accent-solid: #20709e;\n --ui-accent-text: #14587f;\n --ui-accent-fg: #fff;\n --ui-accent-soft: color-mix(in srgb, var(--ui-accent) 10%, transparent);\n --ui-ink-1: var(--dsw-alias-label-primary, #0f1115);\n --ui-ink-2: var(--dsw-alias-label-secondary, #61666b);\n --ui-ink-3: color-mix(in srgb, var(--dsw-alias-label-tertiary, #81858c) 80%, var(--dsw-alias-label-primary, #0f1115));\n --ui-line-1: var(--dsw-alias-border-l1, #0000000a);\n --ui-line-2: var(--dsw-alias-border-l2, #0000001a);\n --ui-line-3: var(--dsw-alias-border-l3, #0000001f);\n --ui-canvas: var(--dsw-alias-bg-layer-1, #fff);\n --ui-raised: var(--dsw-alias-bg-layer-2, #fff);\n --ui-sunken: color-mix(in srgb, var(--ui-ink-1) 4%, var(--ui-canvas));\n --ui-hover: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, var(--ui-ink-1) 5%, transparent));\n --ui-danger: var(--dsw-alias-state-error-primary, #c8322b);\n --ui-radius-sm: 6px;\n --ui-radius-md: 8px;\n display: flex;\n flex-direction: column;\n gap: 20px;\n width: 100%;\n max-width: 920px;\n margin: 0 auto;\n min-width: 0;\n color: var(--ui-ink-1);\n font: inherit;\n line-height: 20px;\n font-variant-numeric: tabular-nums;\n}\n.settings_cfg *,\n.settings_cfg {\n box-sizing: border-box;\n}\n.settings_pageHead {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n min-width: 0;\n}\n.settings_title {\n margin: 0;\n font-size: 20px;\n line-height: 28px;\n font-weight: 500;\n letter-spacing: -.01em;\n}\n.settings_badge {\n display: inline-flex;\n align-items: center;\n height: 20px;\n padding: 0 8px;\n border: 1px solid var(--ui-line-2);\n border-radius: 999px;\n background: var(--ui-raised);\n color: var(--ui-ink-3);\n font-size: 11px;\n line-height: 18px;\n white-space: nowrap;\n}\n.settings_group {\n display: flex;\n flex-direction: column;\n min-width: 0;\n border-top: 1px solid var(--ui-line-2);\n}\n.settings_row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 24px;\n min-height: 44px;\n min-width: 0;\n padding: 10px 0;\n border-bottom: 1px solid var(--ui-line-1);\n}\n.settings_rowText {\n display: flex;\n flex-direction: column;\n gap: 2px;\n flex: 1;\n min-width: 0;\n}\n.settings_rowTitle {\n color: var(--ui-ink-1);\n font-size: 13px;\n line-height: 20px;\n font-weight: 500;\n}\n.settings_rowDesc {\n color: var(--ui-ink-3);\n font-size: 12px;\n line-height: 18px;\n}\n.settings_control {\n display: flex;\n align-items: center;\n gap: 8px;\n flex: none;\n min-width: 0;\n}\n.settings_choices {\n display: inline-flex;\n flex: none;\n gap: 2px;\n height: 32px;\n padding: 1px;\n border: 1px solid var(--ui-line-2);\n border-radius: var(--ui-radius-md);\n background: var(--ui-sunken);\n}\n.settings_choice {\n position: relative;\n display: inline-flex;\n min-width: 0;\n}\n.settings_choice input {\n appearance: none;\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n margin: 0;\n opacity: 0;\n cursor: pointer;\n}\n.settings_choice span {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 28px;\n padding: 0 12px;\n border-radius: var(--ui-radius-sm);\n color: var(--ui-ink-3);\n font-size: 13px;\n line-height: 20px;\n white-space: nowrap;\n transition:\n background-color 140ms ease,\n color 140ms ease,\n box-shadow 140ms ease;\n}\n.settings_choice:has(input:checked) span {\n background: var(--ui-raised);\n box-shadow: inset 0 0 0 1px var(--ui-line-2);\n color: var(--ui-accent-text);\n font-weight: 500;\n}\n.settings_choice:has(input:hover:not(:disabled):not(:checked)) span {\n background: var(--ui-hover);\n color: var(--ui-ink-1);\n}\n.settings_choice:has(input:focus-visible) span {\n outline: 2px solid var(--ui-accent);\n outline-offset: 2px;\n}\n.settings_choice:has(input:disabled) {\n opacity: .4;\n}\n.settings_choice input:disabled {\n cursor: not-allowed;\n}\n.settings_input {\n appearance: none;\n width: 76px;\n min-width: 0;\n height: 32px;\n padding: 0 8px;\n border: 1px solid var(--ui-line-2);\n border-radius: var(--ui-radius-md);\n background: var(--ui-raised);\n color: var(--ui-ink-1);\n font: inherit;\n font-size: 13px;\n line-height: 20px;\n font-variant-numeric: tabular-nums;\n transition: border-color 140ms ease, box-shadow 140ms ease;\n}\n.settings_input:hover:not(:disabled) {\n border-color: var(--ui-line-3);\n}\n.settings_input:focus-visible {\n outline: none;\n border-color: var(--ui-accent);\n box-shadow: 0 0 0 2px var(--ui-accent-soft);\n}\n.settings_input[aria-invalid=true] {\n border-color: var(--ui-danger);\n}\n.settings_input:disabled {\n opacity: .4;\n cursor: not-allowed;\n}\n.settings_duration {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n flex: none;\n}\n.settings_unit {\n color: var(--ui-ink-3);\n font-size: 12px;\n line-height: 18px;\n}\n.settings_srOnly {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n}\n.settings_fieldError {\n margin: 6px 0 0;\n color: var(--ui-danger);\n font-size: 12px;\n line-height: 18px;\n overflow-wrap: anywhere;\n}\n.settings_sectionLabel {\n margin: 20px 0 0;\n padding-bottom: 6px;\n border-bottom: 1px solid var(--ui-line-2);\n color: var(--ui-ink-3);\n font-size: 12px;\n line-height: 18px;\n font-weight: 500;\n letter-spacing: .02em;\n}\n.settings_advanced {\n margin-top: 12px;\n border-top: 1px solid var(--ui-line-1);\n}\n.settings_advanced summary {\n display: flex;\n align-items: center;\n gap: 8px;\n min-height: 32px;\n padding: 4px 0;\n color: var(--ui-ink-2);\n font-size: 13px;\n line-height: 20px;\n font-weight: 500;\n list-style: none;\n cursor: pointer;\n}\n.settings_advanced summary::-webkit-details-marker {\n display: none;\n}\n.settings_advanced summary:hover {\n color: var(--ui-ink-1);\n}\n.settings_advanced summary:focus-visible {\n outline: 2px solid var(--ui-accent);\n outline-offset: 2px;\n border-radius: 4px;\n}\n.settings_advancedValue {\n margin-left: auto;\n color: var(--ui-ink-3);\n font-size: 11px;\n line-height: 18px;\n font-weight: 400;\n white-space: nowrap;\n}\n.settings_chevron {\n width: 6px;\n height: 6px;\n margin: 0 4px 3px auto;\n border-right: 1px solid currentColor;\n border-bottom: 1px solid currentColor;\n transform: rotate(45deg);\n transition: transform 140ms ease;\n}\n.settings_advancedValue + .settings_chevron {\n margin-left: 0;\n}\n.settings_advanced[open] .settings_chevron {\n transform: rotate(225deg);\n margin-bottom: -3px;\n}\n.settings_status {\n margin: 0;\n color: var(--ui-ink-3);\n font-size: 12px;\n line-height: 18px;\n overflow-wrap: anywhere;\n}\n.settings_footer {\n position: sticky;\n bottom: 0;\n z-index: 2;\n display: flex;\n align-items: center;\n gap: 8px;\n flex-wrap: wrap;\n padding: 12px 0;\n border-top: 1px solid var(--ui-line-2);\n background: var(--ui-canvas);\n margin-top: auto;\n}\n.settings_footer .settings_status {\n flex: 1;\n min-width: 0;\n}\n.settings_button,\n.settings_primary {\n appearance: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n gap: 6px;\n height: 32px;\n padding: 0 12px;\n border: 1px solid var(--ui-line-2);\n border-radius: var(--ui-radius-md);\n background: var(--ui-raised);\n color: var(--ui-ink-1);\n font: inherit;\n font-size: 13px;\n line-height: 20px;\n font-weight: 500;\n cursor: pointer;\n transition:\n background-color 140ms ease,\n border-color 140ms ease,\n color 140ms ease;\n}\n.settings_button:hover:not(:disabled) {\n background: var(--ui-hover);\n}\n.settings_button:active:not(:disabled) {\n background: var(--ui-sunken);\n}\n.settings_primary {\n min-width: 96px;\n border-color: transparent;\n background: var(--ui-accent-solid);\n color: var(--ui-accent-fg);\n}\n.settings_primary:hover:not(:disabled) {\n background: color-mix(in srgb, var(--ui-accent-solid) 88%, black);\n}\n.settings_primary:active:not(:disabled) {\n background: color-mix(in srgb, var(--ui-accent-solid) 80%, black);\n}\n.settings_button:focus-visible,\n.settings_primary:focus-visible {\n outline: 2px solid var(--ui-accent);\n outline-offset: 2px;\n}\n.settings_button:disabled,\n.settings_primary:disabled {\n opacity: .4;\n cursor: not-allowed;\n}\n.settings_spinner {\n width: 12px;\n height: 12px;\n border: 1px solid currentColor;\n border-right-color: transparent;\n border-radius: 50%;\n animation: settings_spin 800ms linear infinite;\n}\n@keyframes settings_spin {\n to {\n transform: rotate(360deg);\n }\n}\n@media (max-width: 640px) {\n .settings_title {\n font-size: 18px;\n line-height: 26px;\n }\n .settings_row {\n align-items: stretch;\n flex-direction: column;\n gap: 8px;\n }\n .settings_control {\n width: 100%;\n flex-wrap: wrap;\n }\n .settings_choice {\n flex: 1;\n }\n .settings_choice span {\n width: 100%;\n }\n .settings_footer {\n flex-wrap: wrap;\n }\n .settings_footer .settings_status {\n flex-basis: 100%;\n }\n .settings_advancedValue {\n max-width: 65%;\n text-align: right;\n white-space: normal;\n }\n}\n@media (pointer: coarse) {\n .settings_choices {\n height: auto;\n }\n .settings_choice span,\n .settings_input,\n .settings_button,\n .settings_primary {\n min-height: 44px;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .settings_spinner {\n animation: none;\n }\n .settings_input,\n .settings_choice span,\n .settings_button,\n .settings_primary,\n .settings_chevron {\n transition: none;\n }\n}\n[data-ds-dark-theme] .settings_cfg {\n --ui-accent: #4eb0e8;\n --ui-accent-solid: #4eb0e8;\n --ui-accent-text: #6fc0ee;\n --ui-accent-fg: #0e1014;\n --ui-accent-soft: color-mix(in srgb, var(--ui-accent) 14%, transparent);\n}\n";
|
|
1852
|
+
var id6 = "dsh-better-ask-user/settings.module.css";
|
|
1853
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(id6) + "]") === null) {
|
|
1854
|
+
const tag = document.createElement("style");
|
|
1855
|
+
tag.dataset.plugin = "dsh-better-ask-user";
|
|
1856
|
+
tag.dataset.pluginCss = id6;
|
|
1857
|
+
tag.textContent = css6;
|
|
1858
|
+
document.head.appendChild(tag);
|
|
1859
|
+
}
|
|
1860
|
+
var settings_default = {
|
|
1861
|
+
cfg: "settings_cfg",
|
|
1862
|
+
pageHead: "settings_pageHead",
|
|
1863
|
+
title: "settings_title",
|
|
1864
|
+
badge: "settings_badge",
|
|
1865
|
+
group: "settings_group",
|
|
1866
|
+
row: "settings_row",
|
|
1867
|
+
rowText: "settings_rowText",
|
|
1868
|
+
rowTitle: "settings_rowTitle",
|
|
1869
|
+
rowDesc: "settings_rowDesc",
|
|
1870
|
+
control: "settings_control",
|
|
1871
|
+
choices: "settings_choices",
|
|
1872
|
+
choice: "settings_choice",
|
|
1873
|
+
input: "settings_input",
|
|
1874
|
+
duration: "settings_duration",
|
|
1875
|
+
unit: "settings_unit",
|
|
1876
|
+
srOnly: "settings_srOnly",
|
|
1877
|
+
fieldError: "settings_fieldError",
|
|
1878
|
+
sectionLabel: "settings_sectionLabel",
|
|
1879
|
+
advanced: "settings_advanced",
|
|
1880
|
+
advancedValue: "settings_advancedValue",
|
|
1881
|
+
chevron: "settings_chevron",
|
|
1882
|
+
status: "settings_status",
|
|
1883
|
+
footer: "settings_footer",
|
|
1884
|
+
button: "settings_button",
|
|
1885
|
+
primary: "settings_primary",
|
|
1886
|
+
spinner: "settings_spinner",
|
|
1887
|
+
spin: "settings_spin"
|
|
1888
|
+
};
|
|
1889
|
+
var css_modules_entry_default6 = settings_default;
|
|
1890
|
+
|
|
1536
1891
|
// src/client/settings.tsx
|
|
1537
|
-
var
|
|
1892
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1538
1893
|
var DEFAULTS = { questionTimeoutSeconds: 120, timeoutBehavior: "native", goalTimeoutBehavior: "native" };
|
|
1539
1894
|
var MAX_QUESTION_TIMEOUT_SECONDS = 2147483;
|
|
1540
1895
|
var fallbackT = (key) => settingsEn[key];
|
|
@@ -1568,24 +1923,50 @@ function parseDraft(draft) {
|
|
|
1568
1923
|
if (seconds === void 0) return void 0;
|
|
1569
1924
|
return { questionTimeoutSeconds: seconds, timeoutBehavior: draft.timeoutBehavior, goalTimeoutBehavior: draft.goalTimeoutBehavior };
|
|
1570
1925
|
}
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1926
|
+
function Row({ id: id7, label, hint, children }) {
|
|
1927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: css_modules_entry_default6.row, children: [
|
|
1928
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: css_modules_entry_default6.rowText, children: [
|
|
1929
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: css_modules_entry_default6.rowTitle, id: `${id7}-label`, children: label }),
|
|
1930
|
+
hint ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: css_modules_entry_default6.rowDesc, id: `${id7}-hint`, children: hint }) : null
|
|
1931
|
+
] }),
|
|
1932
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: css_modules_entry_default6.control, children })
|
|
1933
|
+
] });
|
|
1934
|
+
}
|
|
1935
|
+
function Choices({ id: id7, value, options, disabled, describedBy, onChange }) {
|
|
1936
|
+
const name = (0, import_react6.useId)();
|
|
1937
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: css_modules_entry_default6.choices, id: id7, role: "radiogroup", "aria-labelledby": `${id7}-label`, "aria-disabled": disabled, children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: css_modules_entry_default6.choice, children: [
|
|
1938
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1939
|
+
"input",
|
|
1940
|
+
{
|
|
1941
|
+
id: `${id7}-${option.value}`,
|
|
1942
|
+
type: "radio",
|
|
1943
|
+
name,
|
|
1944
|
+
value: option.value,
|
|
1945
|
+
checked: value === option.value,
|
|
1946
|
+
disabled,
|
|
1947
|
+
"aria-describedby": describedBy,
|
|
1948
|
+
onChange: () => {
|
|
1949
|
+
onChange(option.value);
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
),
|
|
1953
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: option.label })
|
|
1954
|
+
] }, option.value)) });
|
|
1955
|
+
}
|
|
1576
1956
|
function SettingsPage({ form, t = fallbackT }) {
|
|
1577
1957
|
const state = form?.state;
|
|
1578
1958
|
const revision = state?.revision;
|
|
1579
1959
|
const host = state?.status === "ready" ? normalize(state.value) : null;
|
|
1580
1960
|
const base = host === null ? null : toDraft(host);
|
|
1581
|
-
const [draft, setDraft] = (0,
|
|
1582
|
-
const [busy, setBusy] = (0,
|
|
1583
|
-
const [
|
|
1961
|
+
const [draft, setDraft] = (0, import_react6.useState)(null);
|
|
1962
|
+
const [busy, setBusy] = (0, import_react6.useState)(false);
|
|
1963
|
+
const [timedSeconds, setTimedSeconds] = (0, import_react6.useState)(String(DEFAULTS.questionTimeoutSeconds));
|
|
1964
|
+
const [notice, setNotice] = (0, import_react6.useState)(null);
|
|
1584
1965
|
const live = draft !== null && draft.revision === revision ? draft.value : base;
|
|
1585
1966
|
const parsed = live === null ? void 0 : parseDraft(live);
|
|
1586
1967
|
const writable = state?.status === "ready" && state?.writable === true;
|
|
1587
|
-
const dirty = host !== null && parsed
|
|
1588
|
-
const edit = (0,
|
|
1968
|
+
const dirty = host !== null && (parsed === void 0 || !same(host, parsed));
|
|
1969
|
+
const edit = (0, import_react6.useCallback)((mutate) => {
|
|
1589
1970
|
setNotice(null);
|
|
1590
1971
|
if (base === null) return;
|
|
1591
1972
|
setDraft((previous) => {
|
|
@@ -1593,7 +1974,7 @@ function SettingsPage({ form, t = fallbackT }) {
|
|
|
1593
1974
|
return { revision: revision ?? 0, value: mutate(current) };
|
|
1594
1975
|
});
|
|
1595
1976
|
}, [base, revision]);
|
|
1596
|
-
const save = (0,
|
|
1977
|
+
const save = (0, import_react6.useCallback)(async () => {
|
|
1597
1978
|
if (form === void 0 || host === null || parsed === void 0) return;
|
|
1598
1979
|
if (!writable || busy || !dirty) return;
|
|
1599
1980
|
const ops = [];
|
|
@@ -1612,10 +1993,7 @@ function SettingsPage({ form, t = fallbackT }) {
|
|
|
1612
1993
|
try {
|
|
1613
1994
|
const accepted = await form.mutate(ops, revision);
|
|
1614
1995
|
if (accepted) setNotice({ tone: "ok", text: t("saved") });
|
|
1615
|
-
else {
|
|
1616
|
-
setDraft(null);
|
|
1617
|
-
setNotice({ tone: "error", text: t("conflict") });
|
|
1618
|
-
}
|
|
1996
|
+
else setNotice({ tone: "error", text: t("conflict") });
|
|
1619
1997
|
} catch (error) {
|
|
1620
1998
|
setNotice({ tone: "error", text: t("saveFailed") + String(error?.message ?? error) });
|
|
1621
1999
|
} finally {
|
|
@@ -1623,104 +2001,138 @@ function SettingsPage({ form, t = fallbackT }) {
|
|
|
1623
2001
|
}
|
|
1624
2002
|
}, [busy, dirty, form, host, parsed, revision, t, writable]);
|
|
1625
2003
|
if (state === void 0) {
|
|
1626
|
-
return /* @__PURE__ */ (0,
|
|
2004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: css_modules_entry_default6.cfg, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: css_modules_entry_default6.note, role: "status", children: t("waiting") }) });
|
|
1627
2005
|
}
|
|
1628
2006
|
if (state.status === "loading") {
|
|
1629
|
-
return /* @__PURE__ */ (0,
|
|
2007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: css_modules_entry_default6.cfg, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: css_modules_entry_default6.note, role: "status", children: t("loading") }) });
|
|
1630
2008
|
}
|
|
1631
2009
|
if (host === null || live === null) {
|
|
1632
|
-
return /* @__PURE__ */ (0,
|
|
2010
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: css_modules_entry_default6.cfg, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: css_modules_entry_default6.note, role: "alert", children: t("unavailable") }) });
|
|
1633
2011
|
}
|
|
1634
2012
|
const invalid = parsed === void 0;
|
|
1635
|
-
const
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
/* @__PURE__ */ (0,
|
|
1642
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1643
|
-
"input",
|
|
1644
|
-
{
|
|
1645
|
-
id: "better-ask-user-wait",
|
|
1646
|
-
type: "number",
|
|
1647
|
-
min: -1,
|
|
1648
|
-
max: MAX_QUESTION_TIMEOUT_SECONDS,
|
|
1649
|
-
step: 1,
|
|
1650
|
-
style: inputStyle,
|
|
1651
|
-
value: live.questionTimeoutSeconds,
|
|
1652
|
-
disabled: !writable || busy,
|
|
1653
|
-
onChange: (event) => {
|
|
1654
|
-
const next = event.target.value;
|
|
1655
|
-
edit((current) => ({ ...current, questionTimeoutSeconds: next }));
|
|
1656
|
-
}
|
|
1657
|
-
}
|
|
1658
|
-
),
|
|
1659
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { style: hintStyle, children: t("waitHint") })
|
|
2013
|
+
const unlimited = live.questionTimeoutSeconds === "-1";
|
|
2014
|
+
const controlsDisabled = !writable || busy;
|
|
2015
|
+
const behaviors = [{ value: "native", label: t("native") }, { value: "default", label: t("default") }];
|
|
2016
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: css_modules_entry_default6.cfg, "aria-busy": busy, "data-settings-dirty": dirty, "data-settings-busy": busy, children: [
|
|
2017
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: css_modules_entry_default6.pageHead, children: [
|
|
2018
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h2", { className: css_modules_entry_default6.title, id: "better-ask-user-title", children: t("title") }),
|
|
2019
|
+
writable ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: css_modules_entry_default6.badge, role: "status", children: t("readonly") })
|
|
1660
2020
|
] }),
|
|
1661
|
-
/* @__PURE__ */ (0,
|
|
1662
|
-
/* @__PURE__ */ (0,
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
),
|
|
1701
|
-
/* @__PURE__ */ (0,
|
|
2021
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("section", { className: css_modules_entry_default6.group, "aria-label": t("title"), children: [
|
|
2022
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Row, { id: "better-ask-user-wait-mode", label: t("waitLabel"), children: [
|
|
2023
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2024
|
+
Choices,
|
|
2025
|
+
{
|
|
2026
|
+
id: "better-ask-user-wait-mode",
|
|
2027
|
+
value: unlimited ? "unlimited" : "timed",
|
|
2028
|
+
options: [{ value: "timed", label: t("timed") }, { value: "unlimited", label: t("unlimited") }],
|
|
2029
|
+
disabled: controlsDisabled,
|
|
2030
|
+
describedBy: "better-ask-user-wait-hint",
|
|
2031
|
+
onChange: (value) => {
|
|
2032
|
+
const nextUnlimited = value === "unlimited";
|
|
2033
|
+
if (nextUnlimited && !invalid) setTimedSeconds(live.questionTimeoutSeconds);
|
|
2034
|
+
edit((current) => ({ ...current, questionTimeoutSeconds: nextUnlimited ? "-1" : timedSeconds }));
|
|
2035
|
+
}
|
|
2036
|
+
}
|
|
2037
|
+
),
|
|
2038
|
+
unlimited ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: css_modules_entry_default6.duration, children: [
|
|
2039
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2040
|
+
"input",
|
|
2041
|
+
{
|
|
2042
|
+
id: "better-ask-user-wait",
|
|
2043
|
+
className: css_modules_entry_default6.input,
|
|
2044
|
+
"aria-label": t("durationLabel"),
|
|
2045
|
+
"aria-describedby": invalid ? "better-ask-user-error" : "better-ask-user-wait-hint",
|
|
2046
|
+
type: "text",
|
|
2047
|
+
inputMode: "numeric",
|
|
2048
|
+
"aria-invalid": invalid || void 0,
|
|
2049
|
+
value: live.questionTimeoutSeconds,
|
|
2050
|
+
disabled: controlsDisabled,
|
|
2051
|
+
onChange: (event) => {
|
|
2052
|
+
edit((current) => ({ ...current, questionTimeoutSeconds: event.target.value }));
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
),
|
|
2056
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: css_modules_entry_default6.unit, children: t("seconds") })
|
|
2057
|
+
] })
|
|
2058
|
+
] }),
|
|
2059
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: css_modules_entry_default6.srOnly, id: "better-ask-user-wait-hint", children: t(unlimited ? "unlimitedHint" : "waitHint") }),
|
|
2060
|
+
invalid && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: css_modules_entry_default6.fieldError, id: "better-ask-user-error", role: "alert", children: t("invalidWait") }),
|
|
2061
|
+
!unlimited && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
2062
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { className: css_modules_entry_default6.sectionLabel, children: t("timeoutTitle") }),
|
|
2063
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { id: "better-ask-user-behavior", label: t("behaviorLabel"), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2064
|
+
Choices,
|
|
2065
|
+
{
|
|
2066
|
+
id: "better-ask-user-behavior",
|
|
2067
|
+
value: live.timeoutBehavior,
|
|
2068
|
+
options: behaviors,
|
|
2069
|
+
disabled: controlsDisabled,
|
|
2070
|
+
describedBy: "better-ask-user-timeout-hint",
|
|
2071
|
+
onChange: (value) => {
|
|
2072
|
+
edit((current) => ({ ...current, timeoutBehavior: value }));
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2075
|
+
) }),
|
|
2076
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: css_modules_entry_default6.srOnly, id: "better-ask-user-timeout-hint", children: t(live.timeoutBehavior === "default" ? "defaultHint" : "nativeHint") }),
|
|
2077
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("details", { className: css_modules_entry_default6.advanced, children: [
|
|
2078
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("summary", { children: [
|
|
2079
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: t("advanced") }),
|
|
2080
|
+
live.goalTimeoutBehavior !== DEFAULTS.goalTimeoutBehavior && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: css_modules_entry_default6.advancedValue, children: [
|
|
2081
|
+
t("goalBehaviorLabel"),
|
|
2082
|
+
" \xB7 ",
|
|
2083
|
+
t(live.goalTimeoutBehavior)
|
|
2084
|
+
] }),
|
|
2085
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: css_modules_entry_default6.chevron, "aria-hidden": "true" })
|
|
2086
|
+
] }),
|
|
2087
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { id: "better-ask-user-goal-behavior", label: t("goalBehaviorLabel"), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2088
|
+
Choices,
|
|
2089
|
+
{
|
|
2090
|
+
id: "better-ask-user-goal-behavior",
|
|
2091
|
+
value: live.goalTimeoutBehavior,
|
|
2092
|
+
options: behaviors,
|
|
2093
|
+
disabled: controlsDisabled,
|
|
2094
|
+
describedBy: "better-ask-user-goal-hint",
|
|
2095
|
+
onChange: (value) => {
|
|
2096
|
+
edit((current) => ({ ...current, goalTimeoutBehavior: value }));
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
) }),
|
|
2100
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: css_modules_entry_default6.srOnly, id: "better-ask-user-goal-hint", children: t(live.goalTimeoutBehavior === "default" ? "defaultHint" : "nativeHint") })
|
|
2101
|
+
] })
|
|
2102
|
+
] })
|
|
1702
2103
|
] }),
|
|
1703
|
-
/* @__PURE__ */ (0,
|
|
1704
|
-
|
|
2104
|
+
notice !== null && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: notice.tone === "ok" ? css_modules_entry_default6.status : css_modules_entry_default6.fieldError, role: notice.tone === "error" ? "alert" : "status", children: notice.text }),
|
|
2105
|
+
dirty && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: css_modules_entry_default6.footer, id: "better-ask-user-settings-footer", children: [
|
|
2106
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: css_modules_entry_default6.status, children: t("dirty") }),
|
|
2107
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: css_modules_entry_default6.button, id: "better-ask-user-discard", disabled: controlsDisabled, onClick: () => {
|
|
2108
|
+
setDraft(null);
|
|
2109
|
+
setNotice(null);
|
|
2110
|
+
setTimedSeconds(String(host.questionTimeoutSeconds === -1 ? DEFAULTS.questionTimeoutSeconds : host.questionTimeoutSeconds));
|
|
2111
|
+
}, children: t("discard") }),
|
|
2112
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1705
2113
|
"button",
|
|
1706
2114
|
{
|
|
1707
2115
|
type: "button",
|
|
1708
|
-
|
|
2116
|
+
className: css_modules_entry_default6.primary,
|
|
2117
|
+
"data-settings-save": true,
|
|
2118
|
+
disabled: controlsDisabled || invalid,
|
|
2119
|
+
"aria-busy": busy,
|
|
1709
2120
|
onClick: () => {
|
|
1710
2121
|
void save();
|
|
1711
2122
|
},
|
|
1712
|
-
|
|
1713
|
-
|
|
2123
|
+
children: [
|
|
2124
|
+
busy && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: css_modules_entry_default6.spinner, "aria-hidden": "true" }),
|
|
2125
|
+
busy ? t("saving") : t("save")
|
|
2126
|
+
]
|
|
1714
2127
|
}
|
|
1715
|
-
)
|
|
1716
|
-
status
|
|
2128
|
+
)
|
|
1717
2129
|
] })
|
|
1718
2130
|
] });
|
|
1719
2131
|
}
|
|
1720
2132
|
function SettingsEntry(props) {
|
|
1721
2133
|
const t = props.t ?? fallbackT;
|
|
1722
|
-
if (props.view === "summary") return /* @__PURE__ */ (0,
|
|
1723
|
-
return /* @__PURE__ */ (0,
|
|
2134
|
+
if (props.view === "summary") return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: t("summary") });
|
|
2135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SettingsPage, { form: props.form, t });
|
|
1724
2136
|
}
|
|
1725
2137
|
|
|
1726
2138
|
// src/client/index.ts
|
|
@@ -1752,7 +2164,10 @@ var QuestionCards = class {
|
|
|
1752
2164
|
ensure(sessionId, questions, callId, settings) {
|
|
1753
2165
|
if (callId !== void 0) {
|
|
1754
2166
|
const existing = this.byCallId(sessionId, callId);
|
|
1755
|
-
if (existing !== void 0)
|
|
2167
|
+
if (existing !== void 0) {
|
|
2168
|
+
if (settings !== void 0) existing.pending.configure(settings);
|
|
2169
|
+
return existing;
|
|
2170
|
+
}
|
|
1756
2171
|
}
|
|
1757
2172
|
return this.#create(new PendingQuestion(sessionId, questions, callId, () => this.keysFor(sessionId), void 0, settings));
|
|
1758
2173
|
}
|
|
@@ -2017,10 +2432,7 @@ function apply(ctx) {
|
|
|
2017
2432
|
name: "tool.call.toolview",
|
|
2018
2433
|
key: "ask_user_question",
|
|
2019
2434
|
locale: NS,
|
|
2020
|
-
// The
|
|
2021
|
-
// `ask-question-toolview` for this key at priority 0, and the slot registry
|
|
2022
|
-
// rejects a second entry at the same priority (which failed the whole client
|
|
2023
|
-
// boot). A lower priority shadows it: lowest renders.
|
|
2435
|
+
// The host already owns this key at priority 0; lower priority shadows it.
|
|
2024
2436
|
priority: -1,
|
|
2025
2437
|
inject: (sessionId) => ({
|
|
2026
2438
|
revealPanel: (callId) => ctx.get("userQuestionPanels")?.reveal(sessionId, callId) ?? false,
|