@ryuu-64/dsh-find-all 0.1.11 → 0.1.12

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/lib/client.js CHANGED
@@ -32,9 +32,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
32
32
  ));
33
33
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
34
34
 
35
- // ../find-all-metadata-20261010/node_modules/semver/internal/debug.js
35
+ // ../find-all-cross-conversation-20261011/node_modules/semver/internal/debug.js
36
36
  var require_debug = __commonJS({
37
- "../find-all-metadata-20261010/node_modules/semver/internal/debug.js"(exports, module2) {
37
+ "../find-all-cross-conversation-20261011/node_modules/semver/internal/debug.js"(exports, module2) {
38
38
  "use strict";
39
39
  var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
40
40
  };
@@ -42,9 +42,9 @@ var require_debug = __commonJS({
42
42
  }
43
43
  });
44
44
 
45
- // ../find-all-metadata-20261010/node_modules/semver/internal/constants.js
45
+ // ../find-all-cross-conversation-20261011/node_modules/semver/internal/constants.js
46
46
  var require_constants = __commonJS({
47
- "../find-all-metadata-20261010/node_modules/semver/internal/constants.js"(exports, module2) {
47
+ "../find-all-cross-conversation-20261011/node_modules/semver/internal/constants.js"(exports, module2) {
48
48
  "use strict";
49
49
  var SEMVER_SPEC_VERSION = "2.0.0";
50
50
  var MAX_LENGTH = 256;
@@ -74,9 +74,9 @@ var require_constants = __commonJS({
74
74
  }
75
75
  });
76
76
 
77
- // ../find-all-metadata-20261010/node_modules/semver/internal/re.js
77
+ // ../find-all-cross-conversation-20261011/node_modules/semver/internal/re.js
78
78
  var require_re = __commonJS({
79
- "../find-all-metadata-20261010/node_modules/semver/internal/re.js"(exports, module2) {
79
+ "../find-all-cross-conversation-20261011/node_modules/semver/internal/re.js"(exports, module2) {
80
80
  "use strict";
81
81
  var {
82
82
  MAX_SAFE_COMPONENT_LENGTH,
@@ -162,9 +162,9 @@ var require_re = __commonJS({
162
162
  }
163
163
  });
164
164
 
165
- // ../find-all-metadata-20261010/node_modules/semver/internal/parse-options.js
165
+ // ../find-all-cross-conversation-20261011/node_modules/semver/internal/parse-options.js
166
166
  var require_parse_options = __commonJS({
167
- "../find-all-metadata-20261010/node_modules/semver/internal/parse-options.js"(exports, module2) {
167
+ "../find-all-cross-conversation-20261011/node_modules/semver/internal/parse-options.js"(exports, module2) {
168
168
  "use strict";
169
169
  var looseOption = Object.freeze({ loose: true });
170
170
  var emptyOpts = Object.freeze({});
@@ -181,9 +181,9 @@ var require_parse_options = __commonJS({
181
181
  }
182
182
  });
183
183
 
184
- // ../find-all-metadata-20261010/node_modules/semver/internal/identifiers.js
184
+ // ../find-all-cross-conversation-20261011/node_modules/semver/internal/identifiers.js
185
185
  var require_identifiers = __commonJS({
186
- "../find-all-metadata-20261010/node_modules/semver/internal/identifiers.js"(exports, module2) {
186
+ "../find-all-cross-conversation-20261011/node_modules/semver/internal/identifiers.js"(exports, module2) {
187
187
  "use strict";
188
188
  var numeric = /^[0-9]+$/;
189
189
  var compareIdentifiers = (a, b) => {
@@ -206,9 +206,9 @@ var require_identifiers = __commonJS({
206
206
  }
207
207
  });
208
208
 
209
- // ../find-all-metadata-20261010/node_modules/semver/classes/semver.js
209
+ // ../find-all-cross-conversation-20261011/node_modules/semver/classes/semver.js
210
210
  var require_semver = __commonJS({
211
- "../find-all-metadata-20261010/node_modules/semver/classes/semver.js"(exports, module2) {
211
+ "../find-all-cross-conversation-20261011/node_modules/semver/classes/semver.js"(exports, module2) {
212
212
  "use strict";
213
213
  var debug = require_debug();
214
214
  var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
@@ -498,9 +498,9 @@ var require_semver = __commonJS({
498
498
  }
499
499
  });
500
500
 
501
- // ../find-all-metadata-20261010/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js
501
+ // ../find-all-cross-conversation-20261011/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js
502
502
  var require_react_dom_server_legacy_browser_production_min = __commonJS({
503
- "../find-all-metadata-20261010/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js"(exports) {
503
+ "../find-all-cross-conversation-20261011/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js"(exports) {
504
504
  "use strict";
505
505
  /**
506
506
  * @license React
@@ -1301,7 +1301,7 @@ var require_react_dom_server_legacy_browser_production_min = __commonJS({
1301
1301
  var ob = null;
1302
1302
  var J = null;
1303
1303
  var K = null;
1304
- var L2 = false;
1304
+ var L3 = false;
1305
1305
  var M = false;
1306
1306
  var N = 0;
1307
1307
  var O = null;
@@ -1315,7 +1315,7 @@ var require_react_dom_server_legacy_browser_production_min = __commonJS({
1315
1315
  return { memoizedState: null, queue: null, next: null };
1316
1316
  }
1317
1317
  function qb() {
1318
- null === K ? null === J ? (L2 = false, J = K = pb()) : (L2 = true, K = J) : null === K.next ? (L2 = false, K = K.next = pb()) : (L2 = true, K = K.next);
1318
+ null === K ? null === J ? (L3 = false, J = K = pb()) : (L3 = true, K = J) : null === K.next ? (L3 = false, K = K.next = pb()) : (L3 = true, K = K.next);
1319
1319
  return K;
1320
1320
  }
1321
1321
  function rb() {
@@ -1331,7 +1331,7 @@ var require_react_dom_server_legacy_browser_production_min = __commonJS({
1331
1331
  function tb(a, b, c) {
1332
1332
  I = Q();
1333
1333
  K = qb();
1334
- if (L2) {
1334
+ if (L3) {
1335
1335
  var d = K.queue;
1336
1336
  b = d.dispatch;
1337
1337
  if (null !== O && (c = O.get(d), void 0 !== c)) {
@@ -2036,9 +2036,9 @@ var require_react_dom_server_legacy_browser_production_min = __commonJS({
2036
2036
  }
2037
2037
  });
2038
2038
 
2039
- // ../find-all-metadata-20261010/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js
2039
+ // ../find-all-cross-conversation-20261011/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js
2040
2040
  var require_react_dom_server_browser_production_min = __commonJS({
2041
- "../find-all-metadata-20261010/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js"(exports) {
2041
+ "../find-all-cross-conversation-20261011/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js"(exports) {
2042
2042
  "use strict";
2043
2043
  /**
2044
2044
  * @license React
@@ -2382,7 +2382,7 @@ var require_react_dom_server_browser_production_min = __commonJS({
2382
2382
  }
2383
2383
  var K = w(">");
2384
2384
  var Ka = w("/>");
2385
- function L2(a, b, c) {
2385
+ function L3(a, b, c) {
2386
2386
  if (null != b) {
2387
2387
  if (null != c) throw Error(k(60));
2388
2388
  if ("object" !== typeof b || !("__html" in b)) throw Error(k(61));
@@ -2415,7 +2415,7 @@ var require_react_dom_server_browser_production_min = __commonJS({
2415
2415
  }
2416
2416
  }
2417
2417
  a.push(K);
2418
- L2(a, f, c);
2418
+ L3(a, f, c);
2419
2419
  return "string" === typeof c ? (a.push(u(C(c))), null) : c;
2420
2420
  }
2421
2421
  var Oa = w("\n");
@@ -2453,7 +2453,7 @@ var require_react_dom_server_browser_production_min = __commonJS({
2453
2453
  }
2454
2454
  }
2455
2455
  a.push(K);
2456
- L2(a, g, e);
2456
+ L3(a, g, e);
2457
2457
  return e;
2458
2458
  case "option":
2459
2459
  g = f.selectedValue;
@@ -2487,7 +2487,7 @@ var require_react_dom_server_browser_production_min = __commonJS({
2487
2487
  else "" + g === c && a.push(Ma);
2488
2488
  else q && a.push(Ma);
2489
2489
  a.push(K);
2490
- L2(a, r, h);
2490
+ L3(a, r, h);
2491
2491
  return h;
2492
2492
  case "textarea":
2493
2493
  a.push(M("textarea"));
@@ -2652,7 +2652,7 @@ var require_react_dom_server_browser_production_min = __commonJS({
2652
2652
  ia(q) && "function" !== typeof h && "symbol" !== typeof h && a.push(H, u(q), I, u(C(h)), E);
2653
2653
  }
2654
2654
  a.push(K);
2655
- L2(a, g, e);
2655
+ L3(a, g, e);
2656
2656
  return e;
2657
2657
  }
2658
2658
  }
@@ -3671,9 +3671,9 @@ var require_react_dom_server_browser_production_min = __commonJS({
3671
3671
  }
3672
3672
  });
3673
3673
 
3674
- // ../find-all-metadata-20261010/node_modules/react-dom/server.browser.js
3674
+ // ../find-all-cross-conversation-20261011/node_modules/react-dom/server.browser.js
3675
3675
  var require_server_browser = __commonJS({
3676
- "../find-all-metadata-20261010/node_modules/react-dom/server.browser.js"(exports) {
3676
+ "../find-all-cross-conversation-20261011/node_modules/react-dom/server.browser.js"(exports) {
3677
3677
  "use strict";
3678
3678
  var l;
3679
3679
  var s;
@@ -3708,10 +3708,746 @@ __export(client_exports, {
3708
3708
  });
3709
3709
  module.exports = __toCommonJS(client_exports);
3710
3710
 
3711
+ // src/conversation-search.js
3712
+ var ENDPOINT = "api/dsh-find-all/search";
3713
+ var DEFAULT_SCOPE = "ordinary-unarchived";
3714
+ var ARCHIVED_SCOPE = "ordinary-including-archived";
3715
+ var PAGE_MATCH_TARGET = 20;
3716
+ var EMPTY = { items: [], cursor: null, scanned: 0, total: 0, failed: 0, skipped: 0, complete: false };
3717
+ var zh = typeof navigator !== "undefined" && /^zh/i.test(navigator.language || "");
3718
+ var L = zh ? {
3719
+ title: "\u5BF9\u8BDD\u5168\u6587\u641C\u7D22",
3720
+ close: "\u5173\u95ED\u5BF9\u8BDD\u5168\u6587\u641C\u7D22",
3721
+ placeholder: "\u641C\u7D22\u6807\u9898\u548C\u6B63\u6587\u2026",
3722
+ titlePlaceholder: "\u641C\u7D22\u6807\u9898\u2026",
3723
+ scope: "\u641C\u7D22\u8303\u56F4\uFF1A\u6240\u6709\u5DE5\u4F5C\u533A",
3724
+ scopeDetails: "\u641C\u7D22\u5F53\u524D\u8FDE\u63A5\u670D\u52A1\u4E2D\u3001\u6240\u6709\u5DE5\u4F5C\u533A\u7684\u666E\u901A\u975E\u7A7A\u5BF9\u8BDD\uFF1B\u9ED8\u8BA4\u4E0D\u542B\u5F52\u6863\uFF0C\u53EF\u52FE\u9009\u5305\u542B\u5F52\u6863\uFF1B\u4E0D\u5305\u542B\u5B50\u4EE3\u7406\u5BF9\u8BDD\u3002",
3725
+ includeArchived: "\u5305\u542B\u5F52\u6863",
3726
+ archived: "\u5DF2\u5F52\u6863",
3727
+ restore: "\u53D6\u6D88\u5F52\u6863\u5E76\u6253\u5F00",
3728
+ restoring: "\u6B63\u5728\u53D6\u6D88\u5F52\u6863\u2026",
3729
+ restoreUnavailable: "\u5F53\u524D\u5BBF\u4E3B\u4E0D\u652F\u6301\u53D6\u6D88\u5F52\u6863\u3002",
3730
+ restoreUnconfirmed: "\u672A\u80FD\u786E\u8BA4\u53D6\u6D88\u5F52\u6863\uFF0C\u5C1A\u672A\u6253\u5F00\uFF1B\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",
3731
+ restoredOpenFailed: "\u5DF2\u53D6\u6D88\u5F52\u6863\uFF0C\u4F46\u672A\u80FD\u6253\u5F00\u5BF9\u8BDD\u3002\u53EF\u8FD4\u56DE\u7ED3\u679C\u91CD\u8BD5\u3002",
3732
+ restoredFindFailed: "\u5DF2\u53D6\u6D88\u5F52\u6863\uFF0C\u4F46\u672A\u80FD\u63A5\u5165\u804A\u5929\u6B63\u6587\u67E5\u627E\u3002\u53EF\u8FD4\u56DE\u7ED3\u679C\u91CD\u8BD5\u3002",
3733
+ archivedNow: "\u8BE5\u5BF9\u8BDD\u5DF2\u5F52\u6863\uFF1B\u8BF7\u4F7F\u7528\u201C\u53D6\u6D88\u5F52\u6863\u5E76\u6253\u5F00\u201D\u3002",
3734
+ help: "\u641C\u7D22\u8BF4\u660E",
3735
+ shown: (n) => `${n}\u4E2A\u5BF9\u8BDD`,
3736
+ page: (n) => `\u5DF2\u663E\u793A${n}\u4E2A\u5BF9\u8BDD \xB7 \u8FD8\u6709\u672A\u641C\u7D22\u7684\u5BF9\u8BDD`,
3737
+ unavailableShort: "\u641C\u7D22\u670D\u52A1\u6682\u4E0D\u53EF\u7528",
3738
+ stoppedShort: "\u641C\u7D22\u5DF2\u505C\u6B62",
3739
+ partialShort: "\u641C\u7D22\u7ED3\u679C\u4E0D\u5B8C\u6574",
3740
+ noMatchesYet: "\u6682\u672A\u627E\u5230\u5339\u914D\u7684\u5BF9\u8BDD",
3741
+ semantics: "\u5B57\u9762\u5B50\u4E32\u5339\u914D\uFF0C\u4E0D\u533A\u5206\u5927\u5C0F\u5199\uFF1B\u6B63\u6587\u542B\u539F\u59CB Markdown\uFF0C\u4E0D\u542B\u601D\u8003\u6216\u5DE5\u5177\u5185\u5BB9\u3002",
3742
+ handoff: "\u6253\u5F00\u5BF9\u8BDD\u540E\u7EE7\u7EED\u7528\u6B64\u5173\u952E\u8BCD\u67E5\u627E\uFF0C\u4E0D\u76F4\u63A5\u8DF3\u5230\u6458\u8981\u539F\u53E5\u3002\u539F\u59CB Markdown \u4F4D\u7F6E\u4E0D\u662F\u9875\u9762\u4F4D\u7F6E\uFF1B\u8DE8\u683C\u5F0F\u7684\u53EF\u89C1\u77ED\u8BED\u53EF\u80FD\u4E0D\u5339\u914D\uFF0C\u4F1A\u8BDD\u5185\u67E5\u627E\u7ED3\u679C\u4E5F\u53EF\u80FD\u4E0D\u540C\u3002",
3743
+ snapshot: "\u5019\u9009\u5217\u8868\u5728\u5F00\u59CB\u65F6\u56FA\u5B9A\uFF1B\u65B0\u589E\u6216\u4FEE\u6539\u5BF9\u8BDD\u540E\uFF0C\u5728\u641C\u7D22\u6846\u6309 Enter \u5237\u65B0\u3002",
3744
+ emptyQuery: "\u8F93\u5165\u5173\u952E\u8BCD\u5F00\u59CB\u641C\u7D22\u3002",
3745
+ invalidShort: "\u8BF7\u8C03\u6574\u641C\u7D22\u5173\u952E\u8BCD",
3746
+ invalid: "\u5173\u952E\u8BCD\u6700\u591A 500 \u4E2A\u5B57\u7B26\uFF0C\u4E0D\u80FD\u5305\u542B\u7A7A\u5B57\u7B26\u3002",
3747
+ pending: "\u6B63\u5728\u626B\u63CF\u5BF9\u8BDD\u2026",
3748
+ unavailable: "\u5B8C\u6574\u641C\u7D22\u670D\u52A1\u4E0D\u53EF\u7528\uFF1B\u8BF7\u68C0\u67E5\u670D\u52A1\u7AEF\u6269\u5C55\u548C\u8FDE\u63A5\u540E\u91CD\u8BD5\u3002\u5DF2\u786E\u8BA4\u7684\u7ED3\u679C\u4FDD\u7559\u3002",
3749
+ stopped: "\u641C\u7D22\u5DF2\u505C\u6B62\uFF1B\u4FDD\u7559\u5DF2\u786E\u8BA4\u7684\u7ED3\u679C\uFF0C\u626B\u63CF\u5C1A\u672A\u5B8C\u6210\u3002",
3750
+ failedList: "\u4F1A\u8BDD\u5217\u8868\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u91CD\u8BD5\u3002",
3751
+ loading: "\u6B63\u5728\u8BFB\u53D6\u4F1A\u8BDD\u5217\u8868\u2026",
3752
+ unsupported: "\u5F53\u524D\u5BBF\u4E3B\u6682\u4E0D\u652F\u6301\u5BF9\u8BDD\u5168\u6587\u641C\u7D22\u3002",
3753
+ noMatches: "\u672A\u627E\u5230\u5339\u914D\u7684\u5BF9\u8BDD\u3002",
3754
+ more: "\u7EE7\u7EED\u52A0\u8F7D\u7ED3\u679C",
3755
+ titleOnly: "\u4EC5\u6807\u9898",
3756
+ progress: (n, total) => `\u5DF2\u626B\u63CF ${n} / ${total} \u4E2A\u5BF9\u8BDD`,
3757
+ partial: (failed, skipped) => `\u7ED3\u679C\u4E0D\u5B8C\u6574\uFF1A${failed} \u4E2A\u8BFB\u53D6\u5931\u8D25\uFF0C${skipped} \u4E2A\u8DF3\u8FC7\u3002`,
3758
+ incomplete: "\u5C1A\u6709\u5BF9\u8BDD\u672A\u626B\u63CF\u3002",
3759
+ retry: "\u91CD\u8BD5",
3760
+ cancel: "\u505C\u6B62\u641C\u7D22",
3761
+ untitled: "\u672A\u547D\u540D\u5BF9\u8BDD",
3762
+ order: "\u81EA\u52A8\u626B\u63CF\u5E76\u9010\u6B65\u663E\u793A\uFF0C\u76F4\u5230\u672C\u9875\u627E\u5230\u81F3\u5C11 20 \u4E2A\u5339\u914D\u5BF9\u8BDD\u6216\u626B\u63CF\u5B8C\u6BD5\uFF1B\u7EE7\u7EED\u52A0\u8F7D\u53EF\u67E5\u4E0B\u4E00\u9875\u3002\u7ED3\u679C\u6309\u626B\u63CF\u987A\u5E8F\u663E\u793A\u3002",
3763
+ missing: "\u8BE5\u5BF9\u8BDD\u5DF2\u4E0D\u5728\u53EF\u6253\u5F00\u7684\u5217\u8868\u4E2D\uFF0C\u53EF\u80FD\u5DF2\u5F52\u6863\u3001\u5220\u9664\u6216\u5931\u53BB\u8BBF\u95EE\u6743\u9650\u3002",
3764
+ opening: "\u6B63\u5728\u6253\u5F00\u5BF9\u8BDD\u2026",
3765
+ openFailed: "\u672A\u80FD\u6253\u5F00\u8BE5\u5BF9\u8BDD\u3002\u53EF\u4EE5\u8FD4\u56DE\u7ED3\u679C\u91CD\u8BD5\u3002",
3766
+ chatNeeded: "\u672A\u80FD\u63A5\u5165\u8BE5\u5BF9\u8BDD\u7684\u804A\u5929\u6B63\u6587\u3002\u8BF7\u5207\u6362\u5230 Chat\uFF0F\u804A\u5929\u89C6\u56FE\uFF0C\u518D\u4ECE\u641C\u7D22\u7ED3\u679C\u91CD\u8BD5\u3002",
3767
+ interrupted: "\u5DF2\u505C\u6B62\u7EE7\u7EED\u67E5\u627E\uFF1B\u53EF\u91CD\u65B0\u6253\u5F00\u641C\u7D22\u7ED3\u679C\u3002",
3768
+ back: "\u8FD4\u56DE\u641C\u7D22\u7ED3\u679C"
3769
+ } : {
3770
+ title: "Full-text conversation search",
3771
+ close: "Close full-text conversation search",
3772
+ placeholder: "Search titles and message text\u2026",
3773
+ titlePlaceholder: "Search titles\u2026",
3774
+ scope: "Search scope: All workspaces",
3775
+ scopeDetails: "Searches ordinary, nonempty conversations across all workspaces on the connected server. Archived conversations are excluded unless Include archived is checked. Subagent conversations are excluded.",
3776
+ includeArchived: "Include archived",
3777
+ archived: "Archived",
3778
+ restore: "Unarchive and open",
3779
+ restoring: "Unarchiving\u2026",
3780
+ restoreUnavailable: "This Host does not support unarchiving.",
3781
+ restoreUnconfirmed: "Unarchiving could not be confirmed, so the conversation was not opened. Try again shortly.",
3782
+ restoredOpenFailed: "Unarchived, but the conversation could not be opened. Return to the results to retry.",
3783
+ restoredFindFailed: "Unarchived, but chat text could not be reached for find. Return to the results to retry.",
3784
+ archivedNow: "This conversation is archived. Use Unarchive and open.",
3785
+ help: "Search help",
3786
+ shown: (n) => `${n} conversations`,
3787
+ page: (n) => `${n} conversations shown \xB7 More conversations remain unsearched`,
3788
+ unavailableShort: "Search service unavailable",
3789
+ stoppedShort: "Search stopped",
3790
+ partialShort: "Search results are incomplete",
3791
+ noMatchesYet: "No matching conversations yet",
3792
+ semantics: "Case-insensitive literal substring search. Body text includes raw Markdown, but excludes reasoning and tool content.",
3793
+ handoff: "Open a conversation to continue finding this query, without an exact-message jump. Raw Markdown offsets are not page positions; phrases crossing formatting may not match, and in-conversation find may differ.",
3794
+ snapshot: "Candidates are fixed when the scan starts. Press Enter in the search field to refresh after adding or changing conversations.",
3795
+ emptyQuery: "Enter a query to search.",
3796
+ invalidShort: "Adjust your search query",
3797
+ invalid: "Use at most 500 characters, without null characters.",
3798
+ pending: "Scanning conversations\u2026",
3799
+ unavailable: "Full search service unavailable. Check the server extension and connection, then retry. Confirmed results are kept.",
3800
+ stopped: "Search stopped. Confirmed results are kept; the scan is incomplete.",
3801
+ failedList: "Conversation list unavailable. Try again.",
3802
+ loading: "Loading conversation list\u2026",
3803
+ unsupported: "Full-text conversation search is unsupported on this Host.",
3804
+ noMatches: "No matching conversations found.",
3805
+ more: "Load more results",
3806
+ titleOnly: "Titles only",
3807
+ progress: (n, total) => `${n} / ${total} conversations scanned`,
3808
+ partial: (failed, skipped) => `Incomplete results: ${failed} failed, ${skipped} skipped.`,
3809
+ incomplete: "Some conversations remain unscanned.",
3810
+ retry: "Retry",
3811
+ cancel: "Stop search",
3812
+ untitled: "Untitled conversation",
3813
+ order: "Automatically scans and shows matches until at least 20 more conversations are found or the scan finishes. Load more results for the next page. Results follow scan order.",
3814
+ missing: "This conversation is no longer openable. It may be archived, deleted, or inaccessible.",
3815
+ opening: "Opening conversation\u2026",
3816
+ openFailed: "Could not open this conversation. Return to the results to retry.",
3817
+ chatNeeded: "The conversation\u2019s chat content is unavailable. Switch to Chat view, then retry from the search results.",
3818
+ interrupted: "Find handoff stopped. You can reopen the search results.",
3819
+ back: "Back to search results"
3820
+ };
3821
+ function catalog(sessions, workspaces, includeArchived = false) {
3822
+ const list = sessions?.list?.getSnapshot?.();
3823
+ const spaces = workspaces?.list?.getSnapshot?.();
3824
+ if (!list || !spaces || !Array.isArray(list.ids) || !list.byId || !Array.isArray(spaces.items) || !Array.isArray(spaces.archivedSessionIds)) return { status: "unsupported", rows: [] };
3825
+ if (spaces.state === "error") return { status: "failedList", rows: [] };
3826
+ if (list.phase !== "ready" || spaces.phase !== "ready" || spaces.state === "loading") return { status: "loading", rows: [] };
3827
+ const archived = new Set(spaces.archivedSessionIds);
3828
+ const names = /* @__PURE__ */ new Map();
3829
+ for (const space of spaces.items) for (const id of space.sessionIds || []) if (!names.has(id)) names.set(id, typeof space.title === "string" ? space.title : "");
3830
+ const rows = [];
3831
+ for (const id of list.ids) {
3832
+ const row = list.byId[id];
3833
+ if (!row || row.id !== id || row.origin === "subagent" || row.blank || !includeArchived && archived.has(id)) continue;
3834
+ rows.push({ id, archived: archived.has(id), title: typeof row.title === "string" ? row.title.trim() : "", updatedAt: Number.isFinite(row.updatedAt) ? row.updatedAt : 0, workspace: names.get(id) || "", selected: row.retainedBy?.mainView > 0 });
3835
+ }
3836
+ return { status: "ready", rows };
3837
+ }
3838
+ function merge(rows, content) {
3839
+ const valid = new Map(rows.map((row) => [row.id, row]));
3840
+ return { ...content, items: content.items.filter((item) => valid.has(item.sessionId)).map((item) => ({ ...valid.get(item.sessionId), ...item, archived: valid.get(item.sessionId).archived })) };
3841
+ }
3842
+ function literalMatcher(query) {
3843
+ return new RegExp(query.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "giu");
3844
+ }
3845
+ function literalRanges(text, query) {
3846
+ const needle = query.trim(), ranges = [];
3847
+ if (needle) for (const match of text.matchAll(literalMatcher(needle))) ranges.push({ start: match.index, end: match.index + match[0].length });
3848
+ return ranges;
3849
+ }
3850
+ function highlightedText(h, text, ranges) {
3851
+ const parts = [];
3852
+ let cursor = 0;
3853
+ for (const { start, end } of ranges) {
3854
+ parts.push(text.slice(cursor, start), h("mark", { key: start, className: "dsh-find-all-conversations-match" }, text.slice(start, end)));
3855
+ cursor = end;
3856
+ }
3857
+ parts.push(text.slice(cursor));
3858
+ return parts;
3859
+ }
3860
+ function searchValue(value, requestId, query, scope) {
3861
+ if (!value || value.version !== 1 || value.requestId !== requestId || value.scope !== scope || !Array.isArray(value.items) || !(value.cursor === null || typeof value.cursor === "string" && value.cursor.length > 0) || typeof value.complete !== "boolean" || value.complete !== (value.cursor === null) || ["scanned", "total", "failed", "skipped"].some((key) => !Number.isSafeInteger(value[key]) || value[key] < 0) || value.scanned > value.total || value.complete && value.scanned !== value.total) return null;
3862
+ const items = [];
3863
+ for (const row of value.items) {
3864
+ if (!row || typeof row.sessionId !== "string" || typeof row.archived !== "boolean" || typeof row.titleMatch !== "boolean" || typeof row.bodyMatch !== "boolean" || !(row.titleMatch || row.bodyMatch) || row.title !== void 0 && typeof row.title !== "string" || typeof row.snippet !== "string" || !Array.isArray(row.ranges)) return null;
3865
+ let last = 0;
3866
+ for (const range of row.ranges) {
3867
+ if (!range || !Number.isSafeInteger(range.start) || !Number.isSafeInteger(range.end) || range.start < last || range.end <= range.start || range.end > row.snippet.length || !literalRanges(row.snippet.slice(range.start, range.end), query).some((match) => match.start === 0 && match.end === range.end - range.start)) return null;
3868
+ last = range.end;
3869
+ }
3870
+ items.push({ sessionId: row.sessionId, archived: row.archived, ...row.title !== void 0 ? { title: row.title } : {}, titleMatch: row.titleMatch, bodyMatch: row.bodyMatch, snippet: row.snippet, ranges: row.ranges });
3871
+ }
3872
+ return { items, cursor: value.cursor, scanned: value.scanned, total: value.total, failed: value.failed, skipped: value.skipped, complete: value.complete };
3873
+ }
3874
+ function installConversationSearch(ctx, react, ui, bridge) {
3875
+ const h = react.createElement;
3876
+ let services = null, mounted = true, epoch = 0, request = null, timer = 0;
3877
+ let scanId = null, mode = "title-body", includeArchived = false;
3878
+ let restoreOperation = null, restoreFeedback = null;
3879
+ const scope = () => includeArchived ? ARCHIVED_SCOPE : DEFAULT_SCOPE;
3880
+ const invalidateRestoreNavigation = () => {
3881
+ if (restoreOperation) restoreOperation.navigate = false;
3882
+ restoreFeedback = null;
3883
+ };
3884
+ let open2 = false, query = "", body = "idle", content = EMPTY, scroll = 0, notice = "", focusOrigin = null;
3885
+ let handoff = null, handoffTimer = 0, handoffStops = [], listStops = [], lastCatalogStatus = "";
3886
+ const listeners = /* @__PURE__ */ new Set();
3887
+ let revision = 0;
3888
+ const publish = () => {
3889
+ revision++;
3890
+ for (const listener of listeners) listener();
3891
+ };
3892
+ const currentCatalog = () => {
3893
+ try {
3894
+ return services ? catalog(ctx.sessions, services.workspaces, includeArchived) : { status: "unsupported", rows: [] };
3895
+ } catch (_) {
3896
+ return { status: "failedList", rows: [] };
3897
+ }
3898
+ };
3899
+ const cancelRequest = () => {
3900
+ epoch++;
3901
+ clearTimeout(timer);
3902
+ timer = 0;
3903
+ request?.abort();
3904
+ request = null;
3905
+ const id = scanId;
3906
+ scanId = null;
3907
+ if (id) {
3908
+ content = { ...content, cursor: null };
3909
+ try {
3910
+ Promise.resolve(fetch(ENDPOINT, { method: "POST", credentials: "same-origin", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ version: 1, action: "cancel", requestId: id }), keepalive: true })).catch(() => {
3911
+ });
3912
+ } catch (_) {
3913
+ }
3914
+ }
3915
+ };
3916
+ function cancelHandoff(message = "") {
3917
+ if (!handoff) return;
3918
+ handoff = null;
3919
+ clearTimeout(handoffTimer);
3920
+ handoffTimer = 0;
3921
+ for (const stop of handoffStops) stop();
3922
+ handoffStops = [];
3923
+ notice = message;
3924
+ publish();
3925
+ }
3926
+ function stopLists() {
3927
+ for (const stop of listStops) stop();
3928
+ listStops = [];
3929
+ }
3930
+ function watchLists() {
3931
+ stopLists();
3932
+ if (!services || !open2) return;
3933
+ const changed = () => {
3934
+ const status = currentCatalog().status;
3935
+ if (status !== "ready" && (scanId || body === "pending")) {
3936
+ const unfinished = body === "pending" || !content.complete;
3937
+ cancelRequest();
3938
+ if (unfinished) body = "stopped";
3939
+ }
3940
+ const wasReady = lastCatalogStatus === "ready";
3941
+ lastCatalogStatus = status;
3942
+ if (!wasReady && status === "ready" && body === "idle") schedule();
3943
+ publish();
3944
+ };
3945
+ listStops = [ctx.sessions.list.subscribe(changed), services.workspaces.list.subscribe(changed)];
3946
+ changed();
3947
+ }
3948
+ function schedule() {
3949
+ cancelRequest();
3950
+ content = EMPTY;
3951
+ const q = query.trim();
3952
+ body = !q ? "idle" : q.length > 500 || q.includes("\0") ? "invalid" : "pending";
3953
+ if (body !== "pending" || !open2) {
3954
+ publish();
3955
+ return;
3956
+ }
3957
+ if (currentCatalog().status !== "ready") {
3958
+ body = "idle";
3959
+ publish();
3960
+ return;
3961
+ }
3962
+ timer = setTimeout(() => {
3963
+ timer = 0;
3964
+ scanBatch(false);
3965
+ }, 250);
3966
+ publish();
3967
+ }
3968
+ async function scanBatch(next) {
3969
+ if (!mounted || !open2 || request || currentCatalog().status !== "ready") return;
3970
+ const q = query.trim(), searchMode = mode, searchScope = scope(), owner = services, generation = epoch;
3971
+ if (next && (!scanId || !content.cursor)) return;
3972
+ const controller = new AbortController();
3973
+ request = controller;
3974
+ const alive = () => mounted && open2 && services === owner && epoch === generation && request === controller && query.trim() === q && mode === searchMode && scope() === searchScope && !controller.signal.aborted;
3975
+ const target = content.items.length + PAGE_MATCH_TARGET;
3976
+ body = "pending";
3977
+ publish();
3978
+ if (!alive()) return;
3979
+ try {
3980
+ const id = next ? scanId : crypto.randomUUID();
3981
+ scanId = id;
3982
+ const rows = currentCatalog().rows, seenCursors = /* @__PURE__ */ new Set();
3983
+ if (content.cursor) seenCursors.add(content.cursor);
3984
+ let continuation = next;
3985
+ while (alive()) {
3986
+ const previousScanned = content.scanned, previousTotal = content.total;
3987
+ const payload = {
3988
+ version: 1,
3989
+ action: continuation ? "next" : "start",
3990
+ requestId: id,
3991
+ query: q,
3992
+ mode: searchMode,
3993
+ scope: searchScope,
3994
+ ...continuation ? { cursor: content.cursor } : { sessionIds: rows.map((row) => row.id), catalog: rows.map((row) => ({ id: row.id, title: row.title })) }
3995
+ };
3996
+ const response = await fetch(ENDPOINT, { method: "POST", credentials: "same-origin", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), signal: controller.signal });
3997
+ if (!alive()) return;
3998
+ if (!response.ok) throw new Error("Search unavailable");
3999
+ const raw = await response.json();
4000
+ if (!alive()) return;
4001
+ const value = searchValue(raw, id, q, searchScope);
4002
+ if (!value || continuation && value.total !== previousTotal || value.scanned <= previousScanned && !(value.complete && value.total === 0 && !continuation) || value.cursor !== null && seenCursors.has(value.cursor)) throw new Error("Invalid or non-progressing search response");
4003
+ if (value.cursor) seenCursors.add(value.cursor);
4004
+ const accumulated = new Map(content.items.map((item) => [item.sessionId, item]));
4005
+ for (const item of value.items) accumulated.set(item.sessionId, item);
4006
+ content = { ...value, items: [...accumulated.values()] };
4007
+ const pageDone = value.complete || accumulated.size >= target;
4008
+ body = pageDone ? "ready" : "pending";
4009
+ publish();
4010
+ if (!alive() || pageDone) return;
4011
+ continuation = true;
4012
+ }
4013
+ } catch (_) {
4014
+ if (alive()) {
4015
+ cancelRequest();
4016
+ body = "unavailable";
4017
+ publish();
4018
+ }
4019
+ } finally {
4020
+ if (alive()) {
4021
+ request = null;
4022
+ publish();
4023
+ }
4024
+ }
4025
+ }
4026
+ function show(seed) {
4027
+ if (!mounted) return;
4028
+ invalidateRestoreNavigation();
4029
+ cancelHandoff();
4030
+ focusOrigin = document.activeElement;
4031
+ bridge.closeFind();
4032
+ if (typeof seed === "string" && seed !== query) {
4033
+ query = seed;
4034
+ scroll = 0;
4035
+ content = EMPTY;
4036
+ body = "idle";
4037
+ }
4038
+ open2 = true;
4039
+ notice = "";
4040
+ if (!ui.Modal || !ui.Input) {
4041
+ open2 = false;
4042
+ notice = L.unsupported;
4043
+ publish();
4044
+ return;
4045
+ }
4046
+ watchLists();
4047
+ if (body === "idle" || body === "pending") schedule();
4048
+ else publish();
4049
+ }
4050
+ function dismiss() {
4051
+ invalidateRestoreNavigation();
4052
+ const unfinished = body === "pending" || !content.complete && !!scanId;
4053
+ open2 = false;
4054
+ cancelRequest();
4055
+ stopLists();
4056
+ cancelHandoff();
4057
+ if (unfinished) body = "stopped";
4058
+ publish();
4059
+ }
4060
+ function change(value) {
4061
+ invalidateRestoreNavigation();
4062
+ query = value;
4063
+ scroll = 0;
4064
+ notice = "";
4065
+ cancelHandoff();
4066
+ schedule();
4067
+ }
4068
+ function launch(row, restored = false) {
4069
+ invalidateRestoreNavigation();
4070
+ const available = currentCatalog();
4071
+ if (!services || available.status !== "ready" || !available.rows.some((item) => item.id === row.id)) {
4072
+ notice = L.missing;
4073
+ publish();
4074
+ return;
4075
+ }
4076
+ if (available.rows.find((item) => item.id === row.id).archived) {
4077
+ notice = L.archivedNow;
4078
+ publish();
4079
+ return;
4080
+ }
4081
+ const owner = services, q = query.trim();
4082
+ dismiss();
4083
+ bridge.closeFind();
4084
+ notice = L.opening;
4085
+ const task = { id: row.id, query: q, owner, started: Date.now(), restored };
4086
+ handoff = task;
4087
+ try {
4088
+ owner.uiWorkspace.openSession(row.id);
4089
+ } catch (_) {
4090
+ cancelHandoff(restored ? L.restoredOpenFailed : L.openFailed);
4091
+ return;
4092
+ }
4093
+ function stillSelected() {
4094
+ try {
4095
+ const row2 = ctx.sessions.list.getSnapshot().byId[task.id];
4096
+ return row2?.retainedBy?.mainView > 0 && owner.layout.panelInfo.getSnapshot().activePanelId === null;
4097
+ } catch (_) {
4098
+ return false;
4099
+ }
4100
+ }
4101
+ const navigationChanged = () => {
4102
+ if (handoff === task && !stillSelected()) cancelHandoff(L.interrupted);
4103
+ };
4104
+ handoffStops = [ctx.sessions.list.subscribe(navigationChanged), owner.layout.panelInfo.subscribe(navigationChanged)];
4105
+ publish();
4106
+ const attempt = () => {
4107
+ handoffTimer = 0;
4108
+ if (!mounted || handoff !== task || services !== owner) return;
4109
+ if (!stillSelected()) {
4110
+ cancelHandoff(task.restored ? L.restoredOpenFailed : L.interrupted);
4111
+ return;
4112
+ }
4113
+ const current = currentCatalog();
4114
+ if (current.status !== "ready" || !current.rows.some((item) => item.id === task.id && !item.archived)) {
4115
+ cancelHandoff(task.restored ? L.restoredOpenFailed : L.missing);
4116
+ return;
4117
+ }
4118
+ if (bridge.openFind(task.id, task.query)) {
4119
+ cancelHandoff();
4120
+ return;
4121
+ }
4122
+ if (Date.now() - task.started > 1e4) {
4123
+ cancelHandoff(task.restored ? L.restoredFindFailed : L.chatNeeded);
4124
+ return;
4125
+ }
4126
+ handoffTimer = setTimeout(attempt, 100);
4127
+ };
4128
+ handoffTimer = setTimeout(attempt, 0);
4129
+ }
4130
+ async function restoreAndOpen(row) {
4131
+ if (restoreOperation) return;
4132
+ cancelHandoff();
4133
+ const owner = services, available = currentCatalog();
4134
+ const latest = available.rows.find((item) => item.id === row.id);
4135
+ if (!owner || available.status !== "ready" || !latest) {
4136
+ notice = L.missing;
4137
+ publish();
4138
+ return;
4139
+ }
4140
+ if (!latest.archived) {
4141
+ launch(latest);
4142
+ return;
4143
+ }
4144
+ if (typeof owner.uiWorkspace.unarchiveSession !== "function") {
4145
+ restoreFeedback = { id: row.id, text: L.restoreUnavailable };
4146
+ publish();
4147
+ return;
4148
+ }
4149
+ const operation = { id: row.id, owner, navigate: true };
4150
+ restoreOperation = operation;
4151
+ restoreFeedback = null;
4152
+ notice = "";
4153
+ publish();
4154
+ try {
4155
+ await owner.uiWorkspace.unarchiveSession(row.id);
4156
+ if (!mounted || services !== owner || !operation.navigate || !open2) return;
4157
+ const fresh = currentCatalog(), current = fresh.rows.find((item) => item.id === row.id);
4158
+ if (fresh.status !== "ready" || !current || current.archived) {
4159
+ restoreFeedback = { id: row.id, text: L.restoreUnconfirmed };
4160
+ publish();
4161
+ return;
4162
+ }
4163
+ launch(current, true);
4164
+ } catch (_) {
4165
+ if (mounted && services === owner && operation.navigate && open2) {
4166
+ restoreFeedback = { id: row.id, text: L.restoreUnconfirmed };
4167
+ publish();
4168
+ }
4169
+ } finally {
4170
+ if (restoreOperation === operation) {
4171
+ restoreOperation = null;
4172
+ if (mounted && services === owner) publish();
4173
+ }
4174
+ }
4175
+ }
4176
+ function Panel() {
4177
+ const details = react.useRef(null), list = react.useRef(null);
4178
+ const [helpOpen, setHelpOpen] = react.useState(false);
4179
+ const helpId = react.useId();
4180
+ react.useLayoutEffect(() => {
4181
+ if (list.current) list.current.scrollTop = scroll;
4182
+ const dialog = details.current?.closest('[role="dialog"]');
4183
+ const trigger = focusOrigin;
4184
+ const legacy = typeof ui.useModalLayer !== "function";
4185
+ const topmost = () => dialog && Array.from(document.querySelectorAll('[role="dialog"][aria-modal="true"],[role="menu"]')).pop() === dialog;
4186
+ const items = () => Array.from(dialog.querySelectorAll('button:not(:disabled),a[href],input:not(:disabled),[tabindex="0"]')).filter((item) => !item.closest("[hidden],[inert]"));
4187
+ const focusFirst = () => (items()[0] || dialog)?.focus({ preventScroll: true });
4188
+ function keydown(event) {
4189
+ if (!topmost() || event.defaultPrevented || event.ctrlKey || event.metaKey || event.altKey) return;
4190
+ if (event.key === "Escape") {
4191
+ event.stopPropagation();
4192
+ if (event.isComposing || event.keyCode === 229) return;
4193
+ event.preventDefault();
4194
+ if (!event.repeat) dismiss();
4195
+ } else if (event.key === "Tab") {
4196
+ const controls = items(), first = controls[0] || dialog, last = controls[controls.length - 1] || dialog;
4197
+ if (!dialog.contains(document.activeElement) || document.activeElement === dialog || document.activeElement === (event.shiftKey ? first : last)) {
4198
+ event.preventDefault();
4199
+ (event.shiftKey ? last : first)?.focus({ preventScroll: true });
4200
+ }
4201
+ }
4202
+ }
4203
+ const focusin = (event) => {
4204
+ if (topmost() && !dialog.contains(event.target)) focusFirst();
4205
+ };
4206
+ if (legacy && dialog) {
4207
+ focusFirst();
4208
+ window.addEventListener("keydown", keydown, true);
4209
+ window.addEventListener("focusin", focusin, true);
4210
+ }
4211
+ return () => {
4212
+ window.removeEventListener("keydown", keydown, true);
4213
+ window.removeEventListener("focusin", focusin, true);
4214
+ if (legacy && mounted && trigger?.isConnected) trigger.focus({ preventScroll: true });
4215
+ };
4216
+ }, []);
4217
+ const data = currentCatalog();
4218
+ const results = body === "invalid" ? EMPTY : merge(data.rows, content);
4219
+ const status = data.status !== "ready" ? L[data.status] : body === "invalid" ? L.invalid : !query.trim() ? L.emptyQuery : body === "pending" ? L.pending : body === "unavailable" ? L.unavailable : body === "stopped" ? L.stopped : "";
4220
+ const retryable = data.status === "failedList" || data.status === "ready" && (body === "unavailable" || body === "stopped" || body === "ready" && content.complete && (content.failed > 0 || content.skipped > 0));
4221
+ const pending = data.status === "ready" && body === "pending";
4222
+ const empty = data.status === "ready" && query.trim() && body === "ready" && content.complete && !content.failed && !content.skipped && results.items.length === 0;
4223
+ const progress = content.scanned > 0 || content.total > 0 ? L.progress(content.scanned, content.total) : "";
4224
+ const partial = content.failed || content.skipped ? L.partial(content.failed, content.skipped) : "";
4225
+ const count = L.shown(results.items.length);
4226
+ const ready = data.status === "ready" && body === "ready";
4227
+ let announcement = "";
4228
+ if (restoreOperation?.navigate) announcement = L.restoring;
4229
+ else if (restoreFeedback) announcement = restoreFeedback.text;
4230
+ else if (notice) announcement = notice;
4231
+ else if (data.status === "ready" && body === "invalid") announcement = L.invalid;
4232
+ else if (pending) announcement = [progress || L.pending, partial].filter(Boolean).join(" \xB7 ");
4233
+ else if (ready && content.complete && !partial) announcement = count;
4234
+ else if (ready && content.cursor) announcement = [L.page(results.items.length), partial].filter(Boolean).join(" \xB7 ");
4235
+ else if (ready || body === "stopped" || body === "unavailable") announcement = [status || count, progress, partial].filter(Boolean).join(" \xB7 ");
4236
+ else if (data.status !== "ready") announcement = status;
4237
+ const emptyStatus = body === "invalid" && data.status === "ready" ? L.invalidShort : empty ? L.noMatches : body === "unavailable" && data.status === "ready" ? L.unavailableShort : body === "stopped" && data.status === "ready" ? L.stoppedShort : status || (partial ? L.partialShort : ready && content.cursor ? L.noMatchesYet : "");
4238
+ const requestClose = () => {
4239
+ const dialog = details.current?.closest('[role="dialog"]');
4240
+ if (dialog && Array.from(document.querySelectorAll('[role="dialog"][aria-modal="true"],[role="menu"]')).pop() === dialog) dismiss();
4241
+ };
4242
+ const setTitleOnly = (checked) => {
4243
+ invalidateRestoreNavigation();
4244
+ mode = checked ? "title" : "title-body";
4245
+ scroll = 0;
4246
+ notice = "";
4247
+ cancelHandoff();
4248
+ schedule();
4249
+ };
4250
+ const setIncludeArchived = (checked) => {
4251
+ invalidateRestoreNavigation();
4252
+ includeArchived = checked;
4253
+ scroll = 0;
4254
+ notice = "";
4255
+ cancelHandoff();
4256
+ schedule();
4257
+ };
4258
+ const checkbox = (checked, onChange, label) => ui.Checkbox ? h(ui.Checkbox, { checked, onChange, label, className: "dsh-find-all-conversations-title-only" }) : h("label", { className: "dsh-find-all-conversations-title-only dsh-find-all-conversations-title-only-fallback" }, h("input", { type: "checkbox", checked, onChange: (event) => onChange(event.target.checked) }), " ", label);
4259
+ const actions = retryable || pending || content.cursor ? h(
4260
+ "div",
4261
+ { className: "dsh-find-all-conversations-actions" },
4262
+ retryable ? h(ui.Button, { type: "button", size: "sm", variant: "ghost", onClick: () => {
4263
+ notice = "";
4264
+ schedule();
4265
+ const generation = epoch, owner = services;
4266
+ if (typeof ctx.sessions.refresh === "function") Promise.resolve().then(() => ctx.sessions.refresh()).catch(() => {
4267
+ if (mounted && open2 && epoch === generation && services === owner) {
4268
+ notice = L.failedList;
4269
+ publish();
4270
+ }
4271
+ });
4272
+ } }, L.retry) : null,
4273
+ pending || content.cursor ? h(ui.Button, { type: "button", size: "sm", variant: "ghost", onClick: () => {
4274
+ cancelRequest();
4275
+ body = "stopped";
4276
+ publish();
4277
+ } }, L.cancel) : null,
4278
+ !pending && content.cursor ? h(ui.Button, { type: "button", size: "sm", variant: "ghost", onClick: () => scanBatch(true) }, L.more) : null
4279
+ ) : null;
4280
+ return h(
4281
+ ui.Modal,
4282
+ { open: true, headless: true, title: L.title, onClose: requestClose, className: "dsh-find-all-conversations" },
4283
+ h(
4284
+ "div",
4285
+ { ref: details, className: "dsh-find-all-conversations-layout" },
4286
+ h(
4287
+ "div",
4288
+ { className: "dsh-find-all-conversations-header" },
4289
+ h(ui.Input, {
4290
+ type: "search",
4291
+ value: query,
4292
+ "data-modal-autofocus": true,
4293
+ "aria-label": L.title,
4294
+ placeholder: mode === "title" ? L.titlePlaceholder : L.placeholder,
4295
+ icon: ui.IconSearchOutlineRegular ? h(ui.IconSearchOutlineRegular, { size: 16 }) : void 0,
4296
+ onChange: (event) => change(event.target.value),
4297
+ onKeyDown: (event) => {
4298
+ if (event.key !== "Enter" || event.isComposing || event.nativeEvent?.isComposing || event.keyCode === 229 || event.repeat) return;
4299
+ event.preventDefault();
4300
+ invalidateRestoreNavigation();
4301
+ notice = "";
4302
+ cancelHandoff();
4303
+ schedule();
4304
+ },
4305
+ className: "dsh-find-all-conversations-input"
4306
+ }),
4307
+ h(
4308
+ ui.Button,
4309
+ { type: "button", size: "sm", variant: "ghost", "aria-label": L.close, title: L.close, onClick: requestClose, className: "dsh-find-all-conversations-close" },
4310
+ ui.IconCloseOutlineRegular ? h(ui.IconCloseOutlineRegular, { size: 14 }) : "\xD7"
4311
+ )
4312
+ ),
4313
+ h(
4314
+ "div",
4315
+ { className: "dsh-find-all-conversations-toolbar" },
4316
+ h("span", { className: "dsh-find-all-conversations-scope" }, L.scope),
4317
+ h("div", { className: "dsh-find-all-conversations-options" }, checkbox(mode === "title", setTitleOnly, L.titleOnly), checkbox(includeArchived, setIncludeArchived, L.includeArchived))
4318
+ ),
4319
+ h(
4320
+ "div",
4321
+ { ref: list, onScroll: (event) => {
4322
+ scroll = event.currentTarget.scrollTop;
4323
+ }, className: "dsh-find-all-conversations-list" },
4324
+ !results.items.length && emptyStatus ? h("div", { className: "dsh-find-all-conversations-empty" }, emptyStatus) : null,
4325
+ ...results.items.map((row) => {
4326
+ const title = row.titleMatch ? highlightedText(h, row.title, literalRanges(row.title, query)) : row.title || L.untitled;
4327
+ const titleNode = h("span", { className: "dsh-find-all-conversations-title", title: row.title || L.untitled }, title);
4328
+ const meta = h(
4329
+ "span",
4330
+ { className: "dsh-find-all-conversations-meta" },
4331
+ row.workspace ? h("span", { className: "dsh-find-all-conversations-info", title: row.workspace }, row.workspace) : null,
4332
+ row.snippet ? h("span", { className: "dsh-find-all-conversations-snippet", title: row.snippet }, highlightedText(h, row.snippet, row.ranges)) : null
4333
+ );
4334
+ const error = restoreFeedback?.id === row.id ? h("span", { className: "dsh-find-all-conversations-row-error" }, restoreFeedback.text) : null;
4335
+ if (!row.archived) return h("button", { key: row.id, type: "button", onClick: () => launch(row), className: "dsh-find-all-conversations-row", "aria-current": row.selected ? "true" : void 0 }, titleNode, meta, error);
4336
+ return h(
4337
+ "div",
4338
+ { key: row.id, className: "dsh-find-all-conversations-row dsh-find-all-conversations-archived-row" },
4339
+ h(
4340
+ "div",
4341
+ { className: "dsh-find-all-conversations-row-heading" },
4342
+ titleNode,
4343
+ h("span", { className: "dsh-find-all-conversations-archive-label" }, L.archived),
4344
+ h(ui.Button, { type: "button", size: "sm", variant: "ghost", className: "dsh-find-all-conversations-restore", "aria-disabled": !!restoreOperation, "aria-label": `${L.restore}: ${row.title || L.untitled}`, onClick: () => restoreAndOpen(row) }, restoreOperation?.id === row.id ? L.restoring : L.restore)
4345
+ ),
4346
+ meta,
4347
+ error
4348
+ );
4349
+ })
4350
+ ),
4351
+ h(
4352
+ "div",
4353
+ { className: "dsh-find-all-conversations-footer" },
4354
+ h(
4355
+ "div",
4356
+ { className: "dsh-find-all-conversations-status-actions" },
4357
+ h("div", { role: "status", "aria-live": "polite", className: "dsh-find-all-conversations-status" }, announcement),
4358
+ actions
4359
+ ),
4360
+ h(ui.Button, { type: "button", size: "sm", variant: "ghost", "aria-expanded": helpOpen, "aria-controls": helpId, onClick: () => setHelpOpen((value) => !value), className: "dsh-find-all-conversations-help" }, L.help)
4361
+ ),
4362
+ h(
4363
+ "div",
4364
+ { id: helpId, hidden: !helpOpen, className: "dsh-find-all-conversations-help-content" },
4365
+ h("p", null, L.scopeDetails),
4366
+ h("p", null, L.order),
4367
+ h("p", null, L.snapshot),
4368
+ h("p", null, L.semantics),
4369
+ h("p", null, L.handoff)
4370
+ )
4371
+ )
4372
+ );
4373
+ }
4374
+ function Entry(props) {
4375
+ react.useSyncExternalStore((listener) => {
4376
+ listeners.add(listener);
4377
+ return () => listeners.delete(listener);
4378
+ }, () => revision);
4379
+ const Icon = ui.IconSearchOutlineRegular || ui.IconSearchOutline16;
4380
+ return h(
4381
+ react.Fragment,
4382
+ null,
4383
+ h(ui.Button, { type: "button", size: "sm", variant: "ghost", title: notice || L.title, "aria-label": L.title, onClick: () => show(), style: { width: "100%", justifyContent: props.wide ? "flex-start" : "center", gap: 8 } }, Icon ? h(Icon, { size: 16 }) : null, props.wide ? L.title : null),
4384
+ notice && !open2 ? h("div", { role: "status", style: { fontSize: 12, padding: 8, overflowWrap: "anywhere" } }, notice) : null,
4385
+ open2 && ui.Modal ? h(Panel) : null
4386
+ );
4387
+ }
4388
+ ctx.slots.inject("sidebar.footer.action", () => ctx.slots.register({ name: "sidebar.footer.action", id: "dsh-find-all-search", order: 10 }, Entry));
4389
+ if (typeof ctx.inject === "function") ctx.inject(["uiWorkspace", "workspaces", "layout"], (child) => {
4390
+ child.effect(() => {
4391
+ if (typeof child.uiWorkspace?.openSession !== "function" || typeof child.layout?.panelInfo?.subscribe !== "function" || typeof child.layout?.panelInfo?.getSnapshot !== "function" || typeof child.workspaces?.list?.subscribe !== "function" || typeof ctx.sessions?.list?.subscribe !== "function") return;
4392
+ const owner = { uiWorkspace: child.uiWorkspace, workspaces: child.workspaces, layout: child.layout };
4393
+ cancelRequest();
4394
+ services = owner;
4395
+ content = EMPTY;
4396
+ body = "idle";
4397
+ watchLists();
4398
+ if (open2) schedule();
4399
+ publish();
4400
+ return () => {
4401
+ if (services !== owner) return;
4402
+ invalidateRestoreNavigation();
4403
+ services = null;
4404
+ cancelRequest();
4405
+ stopLists();
4406
+ cancelHandoff(L.interrupted);
4407
+ content = EMPTY;
4408
+ body = "idle";
4409
+ publish();
4410
+ };
4411
+ });
4412
+ });
4413
+ if (typeof ctx.on === "function") ctx.on("connection/reset", () => {
4414
+ invalidateRestoreNavigation();
4415
+ cancelRequest();
4416
+ cancelHandoff(L.interrupted);
4417
+ content = EMPTY;
4418
+ body = "idle";
4419
+ if (open2) {
4420
+ watchLists();
4421
+ schedule();
4422
+ } else publish();
4423
+ });
4424
+ ctx.effect(() => {
4425
+ function interrupt(event) {
4426
+ if (handoff && event.isTrusted) cancelHandoff(L.interrupted);
4427
+ }
4428
+ window.addEventListener("pointerdown", interrupt, true);
4429
+ window.addEventListener("keydown", interrupt, true);
4430
+ return () => {
4431
+ invalidateRestoreNavigation();
4432
+ mounted = false;
4433
+ open2 = false;
4434
+ cancelRequest();
4435
+ stopLists();
4436
+ cancelHandoff();
4437
+ content = EMPTY;
4438
+ query = "";
4439
+ listeners.clear();
4440
+ window.removeEventListener("pointerdown", interrupt, true);
4441
+ window.removeEventListener("keydown", interrupt, true);
4442
+ };
4443
+ });
4444
+ return { open: show, label: () => query ? L.back : L.title, isOpen: () => open2, cancelHandoff };
4445
+ }
4446
+
3711
4447
  // src/updates.js
3712
4448
  var import_semver = __toESM(require_semver(), 1);
3713
4449
  var PACKAGE = "@ryuu-64/dsh-find-all";
3714
- var ENDPOINT = "https://registry.npmjs.org/@ryuu-64%2fdsh-find-all/latest";
4450
+ var ENDPOINT2 = "https://registry.npmjs.org/@ryuu-64%2fdsh-find-all/latest";
3715
4451
  function version(value) {
3716
4452
  if (typeof value !== "string") throw new Error("Invalid version");
3717
4453
  const parsed = new import_semver.default(value);
@@ -3729,7 +4465,7 @@ async function checkLatestVersion(currentVersion, signal) {
3729
4465
  if (signal.aborted) cancel();
3730
4466
  const timeout = setTimeout(cancel, 8e3);
3731
4467
  try {
3732
- const response = await fetch(ENDPOINT, {
4468
+ const response = await fetch(ENDPOINT2, {
3733
4469
  signal: controller.signal,
3734
4470
  mode: "cors",
3735
4471
  credentials: "omit",
@@ -4626,6 +5362,10 @@ function createHistoryReader({ remote, sessionId, generation = 0, onUpdate, proj
4626
5362
  const projection = await pending(project(source));
4627
5363
  assertCurrent();
4628
5364
  if (!object(projection) || !Array.isArray(projection.blocks) || projection.blocks.some((block) => !object(block) || typeof block.text !== "string")) throw failure("invalid-projection", "Text projection returned invalid blocks", source.seq);
5365
+ const projectedSource = projection.source === void 0 ? source : projection.source;
5366
+ if (!object(projectedSource) || ["sessionId", "seq", "id", "kind", "contentIndex"].some((key) => projectedSource[key] !== source[key])) {
5367
+ throw failure("invalid-projection", "Text projection changed durable source identity", source.seq);
5368
+ }
4629
5369
  const localErrors = [...source.contextErrors ?? [], ...Array.isArray(projection.errors) ? projection.errors : []];
4630
5370
  const seenErrors = /* @__PURE__ */ new Set();
4631
5371
  for (const error of localErrors) {
@@ -4635,7 +5375,7 @@ function createHistoryReader({ remote, sessionId, generation = 0, onUpdate, proj
4635
5375
  seenErrors.add(key);
4636
5376
  }
4637
5377
  documents.push({
4638
- ...source,
5378
+ ...projectedSource,
4639
5379
  blocks: projection.blocks,
4640
5380
  ...typeof projection.mapping === "string" ? { mapping: projection.mapping } : {},
4641
5381
  ...typeof projection.rootClass === "string" ? { rootClass: projection.rootClass } : {},
@@ -5033,7 +5773,7 @@ function sameBlocks(expected, actual) {
5033
5773
  function minimumCandidates(candidates) {
5034
5774
  return candidates.filter((x) => !candidates.some((y) => x !== y && x.contains(y)));
5035
5775
  }
5036
- function mapProjectedDocument(source, node, rows) {
5776
+ function mapProjectedDocument(source, node, rows, targetBlockIndex) {
5037
5777
  if (source.transcriptVisible === false) return { reason: source.unavailableReason || "not-rendered" };
5038
5778
  if (source.mapping === "markdown") {
5039
5779
  const reasoning = source.kind === "reasoning" || source.contentType === "reasoning";
@@ -5041,7 +5781,7 @@ function mapProjectedDocument(source, node, rows) {
5041
5781
  const content = node.data?.blocks;
5042
5782
  if (!Array.isArray(content)) return { reason: "node-content-unavailable" };
5043
5783
  const index = source.contentIndex;
5044
- if (content[index]?.kind !== kind || content[index]?.text !== source.raw) return { reason: "source-changed" };
5784
+ if (content[index]?.kind !== kind || content[index]?.text !== (source.storedRaw ?? source.raw)) return { reason: "source-changed" };
5045
5785
  const part = reasoning ? "reasoning" : "response";
5046
5786
  let scoped = rows.filter((row) => row.dataset.chatGroupPart === part);
5047
5787
  if (!scoped.length) scoped = rows.filter((row) => !row.dataset.chatGroupPart);
@@ -5051,7 +5791,14 @@ function mapProjectedDocument(source, node, rows) {
5051
5791
  if (roots.length !== expected.length) return { reason: "renderer-not-expanded" };
5052
5792
  const root = roots[ordinal], blocks = collectProjectedBlocks(root);
5053
5793
  const savedText = source.blocks.filter((b) => !b.imageDescription), actualText = blocks.filter((b) => !b.imageDescription);
5054
- if (!sameBlocks(savedText, actualText)) return { reason: "renderer-text-changed" };
5794
+ if (Number.isInteger(targetBlockIndex)) {
5795
+ const target = source.blocks[targetBlockIndex];
5796
+ if (!target) return { reason: "renderer-text-changed" };
5797
+ if (!target.imageDescription) {
5798
+ const ordinal2 = source.blocks.slice(0, targetBlockIndex + 1).filter((block) => !block.imageDescription).length - 1;
5799
+ if (savedText.length !== actualText.length || actualText[ordinal2]?.text !== target.text) return { reason: "renderer-text-changed" };
5800
+ }
5801
+ } else if (!sameBlocks(savedText, actualText)) return { reason: "renderer-text-changed" };
5055
5802
  let position = 0;
5056
5803
  return { blocks: source.blocks.map((b) => b.imageDescription ? { text: b.text, segments: [] } : actualText[position++]), root };
5057
5804
  }
@@ -5175,6 +5922,58 @@ function mapProjectedDocument(source, node, rows) {
5175
5922
  return { reason: "stored-field-not-rendered" };
5176
5923
  }
5177
5924
 
5925
+ // src/search-content.js
5926
+ var SEARCH_CONTENT_SERVICE = "ryuu.findAllSearchContent";
5927
+ var object2 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
5928
+ function createSearchContentService(onChange) {
5929
+ const registrations = /* @__PURE__ */ new Map();
5930
+ const changed = () => {
5931
+ try {
5932
+ onChange?.();
5933
+ } catch {
5934
+ }
5935
+ };
5936
+ return {
5937
+ register(owner, createRule) {
5938
+ if (typeof owner !== "string" || !owner || typeof createRule !== "function") {
5939
+ throw new TypeError("Search content registration needs an owner and a rule factory");
5940
+ }
5941
+ if (registrations.has(owner)) throw new Error(`Search content rule already registered: ${owner}`);
5942
+ const record3 = { createRule };
5943
+ registrations.set(owner, record3);
5944
+ changed();
5945
+ let active = true;
5946
+ return () => {
5947
+ if (!active) return;
5948
+ active = false;
5949
+ if (registrations.get(owner) === record3) {
5950
+ registrations.delete(owner);
5951
+ changed();
5952
+ }
5953
+ };
5954
+ },
5955
+ createProjector(project) {
5956
+ if (typeof project !== "function") throw new TypeError("Search content needs a text projector");
5957
+ const rules = [...registrations.values()].map(({ createRule }) => createRule()).filter((rule) => typeof rule === "function");
5958
+ return async (source) => {
5959
+ let current = { ...source };
5960
+ try {
5961
+ for (const rule of rules) {
5962
+ const patch = await rule(current);
5963
+ if (patch === void 0 || patch === null) continue;
5964
+ if (!object2(patch)) throw new TypeError("Search content rule returned an invalid change");
5965
+ current = { ...current, ...patch };
5966
+ }
5967
+ } catch (error) {
5968
+ return { source: current, blocks: [], errors: [{ code: "search-content-rule-failed", message: error instanceof Error ? error.message : String(error) }] };
5969
+ }
5970
+ const projection = await project(current);
5971
+ return { ...projection, source: current };
5972
+ };
5973
+ }
5974
+ };
5975
+ }
5976
+
5178
5977
  // src/client.js
5179
5978
  /*! dsh-find-all. Copyright (c) 2026 secyborg; Copyright (c) 2026 Ryuu-64. MIT.
5180
5979
  * Forked from secyborg/dsh-find-bar ce7eb75efe94d768127c5977c649ecd950a9356c. See LICENSE and NOTICE.md. */
@@ -5231,7 +6030,7 @@ var BLOCK_TAGS = {
5231
6030
  UL: 1
5232
6031
  };
5233
6032
  var ZH = typeof navigator !== "undefined" && /^zh/i.test(navigator.language || "");
5234
- var L = ZH ? {
6033
+ var L2 = ZH ? {
5235
6034
  placeholder: "\u5728\u6B64\u4F1A\u8BDD\u4E2D\u67E5\u627E\u2026",
5236
6035
  prev: "\u4E0A\u4E00\u4E2A\u5339\u914D",
5237
6036
  next: "\u4E0B\u4E00\u4E2A\u5339\u914D",
@@ -5495,7 +6294,7 @@ async function runPageIn(opts) {
5495
6294
  }
5496
6295
  }
5497
6296
  function cssText() {
5498
- return "#" + BAR_ID + "{--dsh-find-all-max-width:480px;container:dsh-find-all / inline-size;position:fixed;top:var(--dsh-find-all-bar-top);right:var(--dsh-find-all-bar-right);z-index:2147483000;visibility:hidden;isolation:isolate;box-sizing:border-box;align-items:stretch;gap:4px;padding:6px 8px;display:flex;flex-direction:column;width:min(var(--dsh-find-all-max-width),var(--dsh-find-all-panel-width));max-width:calc(100vw - 16px);max-height:var(--dsh-find-all-max-height);overflow:auto;background:transparent;--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);border:0;border-radius:var(--dsw-radius-md,8px);box-shadow:var(--dsw-elevation-panel,var(--dsw-shadow-lv2))}#" + BAR_ID + "[data-positioned]{visibility:visible}#" + BAR_ID + ":before,#" + BAR_ID + '-content-panel:before{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;border-radius:inherit;background:var(--dsw-menu-surface-fill,var(--dsw-specific-menu,var(--dsw-alias-bg-layer-2)));-webkit-backdrop-filter:var(--dsw-menu-backdrop-filter,blur(40px) saturate(150%));backdrop-filter:var(--dsw-menu-backdrop-filter,blur(40px) saturate(150%))}#' + BAR_ID + " .controls{display:flex;flex-wrap:nowrap;align-items:center;gap:4px;min-width:0}#" + BAR_ID + " input.query{box-sizing:border-box;flex:1 1 0;min-width:64px;max-width:100%;width:auto;height:28px;color:var(--dsw-alias-label-primary);font:13px/1 var(--dsw-font-family);background:var(--dsw-alias-bg-base);border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-sm,6px);outline:none;padding:0 8px}#" + BAR_ID + " input.query:focus-visible{border-color:var(--dsw-alias-state-business-primary)}#" + BAR_ID + " .count{box-sizing:border-box;flex:0 1 80px;width:80px;min-width:64px;max-width:96px;height:28px;line-height:28px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font:12px/28px var(--dsw-font-family);font-variant-numeric:tabular-nums;text-align:center}#" + BAR_ID + " button.count{width:80px;min-width:64px;padding:0 4px;flex:0 1 80px}#" + BAR_ID + " .count[hidden],#" + BAR_ID + " .count-editor[hidden],#" + BAR_ID + " .count-hint[hidden]{display:none}#" + BAR_ID + " .count-editor{display:flex;align-items:center;gap:2px;flex:none;color:var(--dsw-alias-label-tertiary);font:12px/1 var(--dsw-font-family);font-variant-numeric:tabular-nums}#" + BAR_ID + " input.count-input{box-sizing:border-box;width:5.5ch;min-width:0;height:28px;padding:0 3px;text-align:right;font:inherit;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l4);border-radius:4px}#" + BAR_ID + " input.count-input:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}#" + BAR_ID + " input.count-input[aria-invalid=true]{border-color:var(--dsw-alias-state-error-primary,#c33)}#" + BAR_ID + " .count-hint{padding:2px 8px 0 32px;color:var(--dsw-alias-label-secondary);font:12px/1.5 var(--dsw-font-family);overflow-wrap:anywhere}#" + BAR_ID + " .count-hint[data-error]{color:var(--dsw-alias-state-error-primary,#c33)}#" + BAR_ID + " .status{box-sizing:border-box;width:100%;padding:2px 8px 4px 32px;color:var(--dsw-alias-label-tertiary);font:12px/1.5 var(--dsw-font-family);text-align:left;white-space:normal;overflow-wrap:anywhere}#" + BAR_ID + " .status:empty{display:none}#" + BAR_ID + " .position-controls{display:flex;flex-wrap:wrap;align-items:center;gap:4px}#" + BAR_ID + " .position-controls[hidden]{display:none}#" + BAR_ID + " button.drag-handle{touch-action:none;user-select:none;cursor:grab;flex:none}#" + BAR_ID + "[data-dragging] button.drag-handle{cursor:grabbing}#" + BAR_ID + " .status[data-busy]{cursor:pointer;color:var(--dsw-alias-state-business-primary)}#" + BAR_ID + " .navigation-controls{display:flex;align-items:center;gap:4px;flex:none}#" + BAR_ID + " .content-filter{position:relative;width:28px;padding:0}#" + BAR_ID + " .content-filter[aria-expanded=true]{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-button-ghost-active-fill,var(--dsw-alias-interactive-bg-hover))}#" + BAR_ID + " .content-filter[aria-expanded=true]:hover{background:var(--dsw-alias-button-ghost-active-hover,var(--dsw-alias-interactive-bg-active))}#" + BAR_ID + ' .content-filter[data-filtered]:after{content:"";position:absolute;top:3px;right:3px;width:5px;height:5px;border-radius:50%;background:var(--dsw-alias-state-business-primary)}#' + BAR_ID + "-content-panel{position:fixed;z-index:2147483001;isolation:isolate;box-sizing:border-box;display:flex;flex-direction:column;min-width:0;width:320px;max-width:calc(100vw - 16px);margin:0;padding:0;overflow:hidden;--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);box-shadow:var(--dsw-elevation-prominent,var(--dsw-elevation-panel,var(--dsw-shadow-lv2)));color:var(--dsw-alias-label-primary);font:13px/20px var(--dsw-font-family);border:0;border-radius:var(--dsw-radius-md,8px);background:transparent}#" + BAR_ID + "-content-panel[hidden]{display:none}#" + BAR_ID + "-content-panel .content-viewport{min-height:0;overflow:auto;padding:4px;--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2)}#" + BAR_ID + "-content-panel fieldset{min-width:0;margin:0;padding:0;border:0}#" + BAR_ID + "-content-panel legend{box-sizing:border-box;width:100%;padding:4px 8px;font:500 11px/16px var(--dsw-font-family);color:var(--dsw-alias-label-tertiary)}#" + BAR_ID + "-content-panel .content-options{display:grid;grid-template-columns:minmax(0,1fr)}#" + BAR_ID + "-content-panel .content-option{box-sizing:border-box;min-width:0;min-height:28px;padding:4px 8px;align-items:center;gap:6px;display:flex;border-radius:var(--dsw-radius-sm,6px);cursor:pointer}#" + BAR_ID + "-content-panel .content-option:hover{background:var(--dsw-alias-interactive-bg-hover)}#" + BAR_ID + "-content-panel .content-option span{min-width:0;overflow-wrap:anywhere}#" + BAR_ID + "-content-panel .content-option input{appearance:auto;accent-color:var(--dsw-alias-brand-primary,var(--dsw-alias-state-business-primary));flex:none;width:16px;height:16px;margin:0;cursor:inherit}#" + BAR_ID + "-content-panel .content-reset{margin-top:4px;padding:0 8px;font:12px/18px var(--dsw-font-family)}#" + BAR_ID + "-content-panel .scope-group{padding-bottom:4px;margin-bottom:4px;border-bottom:1px solid var(--dsw-alias-border-l1)}#" + BAR_ID + "-content-panel .history-command{margin-top:4px;padding-top:4px;border-top:1px solid var(--dsw-alias-border-l1)}#" + BAR_ID + "-content-panel .update-version,#" + BAR_ID + "-content-panel .update-status{margin:0;padding:4px 8px;font:12px/18px var(--dsw-font-family);color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}#" + BAR_ID + "-content-panel .update-status:empty{padding:0}#" + BAR_ID + "-content-panel .update-command [hidden]{display:none}#" + BAR_ID + "-content-panel .diagnostic-command{display:flex;flex-wrap:wrap;align-items:center;gap:4px}#" + BAR_ID + "-content-panel .diagnostic-command button{flex:1;width:auto}#" + BAR_ID + "-content-panel .diagnostic-feedback{padding:0 8px;font:12px/18px var(--dsw-font-family);color:var(--dsw-alias-label-secondary)}#" + BAR_ID + "-content-panel .feedback-issue{display:flex;align-items:center;gap:6px;box-sizing:border-box;min-height:28px;width:100%;padding:4px 8px;color:var(--dsw-alias-label-secondary);text-decoration:none;border-radius:var(--dsw-radius-sm,6px)}#" + BAR_ID + "-content-panel .feedback-issue:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}#" + BAR_ID + "-content-panel .feedback-privacy{margin:0;padding:0 8px 4px;font:12px/18px var(--dsw-font-family);color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere}#" + BAR_ID + "-content-panel .history-command button{width:100%;height:auto;min-height:28px;justify-content:flex-start;gap:6px;padding:4px 8px;text-align:left;font:13px/20px var(--dsw-font-family)}#" + BAR_ID + " button,#" + BAR_ID + "-content-panel button{box-sizing:border-box;flex:none;height:28px;min-width:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:var(--dsw-radius-sm,6px);align-items:center;justify-content:center;display:inline-flex}#" + BAR_ID + " button[hidden]{display:none}#" + BAR_ID + " button:hover,#" + BAR_ID + "-content-panel button:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}#" + BAR_ID + " button:focus-visible,#" + BAR_ID + "-content-panel :focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}#" + BAR_ID + " button:disabled,#" + BAR_ID + "-content-panel button:disabled,#" + BAR_ID + "-content-panel button[aria-disabled=true]{opacity:.5;cursor:default}#" + BAR_ID + " [data-find-all-return][hidden]{display:none}#" + BAR_ID + " [data-find-all-return]{gap:4px;padding:0 8px;white-space:nowrap}@container dsh-find-all (max-width:550px){#" + BAR_ID + " .return-label{display:none}#" + BAR_ID + " [data-find-all-return]{padding:0 6px}}@container dsh-find-all (max-width:360px){#" + BAR_ID + " .controls,#" + BAR_ID + " .navigation-controls{gap:2px}#" + BAR_ID + " .count,#" + BAR_ID + " button.count{width:64px;min-width:64px;max-width:64px}#" + BAR_ID + " .status{padding-left:30px}}@container dsh-find-all (max-width:330px){#" + BAR_ID + " .controls{flex-wrap:wrap}#" + BAR_ID + " .navigation-controls{margin-left:auto}}#" + BAR_ID + " svg{pointer-events:none}#" + BAR_ID + "[data-about-open]{z-index:999;pointer-events:none}.dsh-find-all-about{max-height:100%;font-family:var(--dsw-font-family)}.dsh-find-all-about-content{min-height:0;overflow:auto}.dsh-find-all-about-details{display:flex;flex-direction:column;gap:16px;color:var(--dsw-alias-label-primary);font:13px/20px var(--dsw-font-family);overflow-wrap:anywhere}.dsh-find-all-about-details p{margin:0}.dsh-find-all-about-details h3{margin:0 0 6px;font:500 13px/20px var(--dsw-font-family)}.dsh-find-all-about-details a{color:var(--dsw-alias-state-business-primary);text-underline-offset:3px}.dsh-find-all-about-links{display:flex;flex-wrap:wrap;gap:6px 16px}.dsh-find-all-about-group{display:flex;align-items:center;flex-wrap:wrap;gap:6px 10px}.dsh-find-all-about-status{color:var(--dsw-alias-label-secondary)}.dsh-find-all-about-details :focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}::highlight(" + HL_ALL + "){background-color:rgba(245,197,24,.42)}::highlight(" + HL_CUR + "){background-color:#f5a623;color:#141414}";
6297
+ return "#" + BAR_ID + "{--dsh-find-all-max-width:480px;container:dsh-find-all / inline-size;position:fixed;top:var(--dsh-find-all-bar-top);right:var(--dsh-find-all-bar-right);z-index:2147483000;visibility:hidden;isolation:isolate;box-sizing:border-box;align-items:stretch;gap:4px;padding:6px 8px;display:flex;flex-direction:column;width:min(var(--dsh-find-all-max-width),var(--dsh-find-all-panel-width));max-width:calc(100vw - 16px);max-height:var(--dsh-find-all-max-height);overflow:auto;background:transparent;--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);border:0;border-radius:var(--dsw-radius-md,8px);box-shadow:var(--dsw-elevation-panel,var(--dsw-shadow-lv2))}#" + BAR_ID + "[data-positioned]{visibility:visible}#" + BAR_ID + ":before,#" + BAR_ID + '-content-panel:before{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;border-radius:inherit;background:var(--dsw-menu-surface-fill,var(--dsw-specific-menu,var(--dsw-alias-bg-layer-2)));-webkit-backdrop-filter:var(--dsw-menu-backdrop-filter,blur(40px) saturate(150%));backdrop-filter:var(--dsw-menu-backdrop-filter,blur(40px) saturate(150%))}#' + BAR_ID + " .controls{display:flex;flex-wrap:nowrap;align-items:center;gap:4px;min-width:0}#" + BAR_ID + " input.query{box-sizing:border-box;flex:1 1 0;min-width:64px;max-width:100%;width:auto;height:28px;color:var(--dsw-alias-label-primary);font:13px/1 var(--dsw-font-family);background:var(--dsw-alias-bg-base);border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-sm,6px);outline:none;padding:0 8px}#" + BAR_ID + " input.query:focus-visible{border-color:var(--dsw-alias-state-business-primary)}#" + BAR_ID + " .count{box-sizing:border-box;flex:0 1 80px;width:80px;min-width:64px;max-width:96px;height:28px;line-height:28px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font:12px/28px var(--dsw-font-family);font-variant-numeric:tabular-nums;text-align:center}#" + BAR_ID + " button.count{width:80px;min-width:64px;padding:0 4px;flex:0 1 80px}#" + BAR_ID + " .count[hidden],#" + BAR_ID + " .count-editor[hidden],#" + BAR_ID + " .count-hint[hidden]{display:none}#" + BAR_ID + " .count-editor{display:flex;align-items:center;gap:2px;flex:none;color:var(--dsw-alias-label-tertiary);font:12px/1 var(--dsw-font-family);font-variant-numeric:tabular-nums}#" + BAR_ID + " input.count-input{box-sizing:border-box;width:5.5ch;min-width:0;height:28px;padding:0 3px;text-align:right;font:inherit;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l4);border-radius:4px}#" + BAR_ID + " input.count-input:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}#" + BAR_ID + " input.count-input[aria-invalid=true]{border-color:var(--dsw-alias-state-error-primary,#c33)}#" + BAR_ID + " .count-hint{padding:2px 8px 0 32px;color:var(--dsw-alias-label-secondary);font:12px/1.5 var(--dsw-font-family);overflow-wrap:anywhere}#" + BAR_ID + " .count-hint[data-error]{color:var(--dsw-alias-state-error-primary,#c33)}#" + BAR_ID + " .status{box-sizing:border-box;width:100%;padding:2px 8px 4px 32px;color:var(--dsw-alias-label-tertiary);font:12px/1.5 var(--dsw-font-family);text-align:left;white-space:normal;overflow-wrap:anywhere}#" + BAR_ID + " .status:empty{display:none}#" + BAR_ID + " .position-controls{display:flex;flex-wrap:wrap;align-items:center;gap:4px}#" + BAR_ID + " .position-controls[hidden]{display:none}#" + BAR_ID + " button.drag-handle{touch-action:none;user-select:none;cursor:grab;flex:none}#" + BAR_ID + "[data-dragging] button.drag-handle{cursor:grabbing}#" + BAR_ID + " .status[data-busy]{cursor:pointer;color:var(--dsw-alias-state-business-primary)}#" + BAR_ID + " .navigation-controls{display:flex;align-items:center;gap:4px;flex:none}#" + BAR_ID + " .content-filter{position:relative;width:28px;padding:0}#" + BAR_ID + " .content-filter[aria-expanded=true]{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-button-ghost-active-fill,var(--dsw-alias-interactive-bg-hover))}#" + BAR_ID + " .content-filter[aria-expanded=true]:hover{background:var(--dsw-alias-button-ghost-active-hover,var(--dsw-alias-interactive-bg-active))}#" + BAR_ID + ' .content-filter[data-filtered]:after{content:"";position:absolute;top:3px;right:3px;width:5px;height:5px;border-radius:50%;background:var(--dsw-alias-state-business-primary)}#' + BAR_ID + "-content-panel{position:fixed;z-index:2147483001;isolation:isolate;box-sizing:border-box;display:flex;flex-direction:column;min-width:0;width:320px;max-width:calc(100vw - 16px);margin:0;padding:0;overflow:hidden;--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);box-shadow:var(--dsw-elevation-prominent,var(--dsw-elevation-panel,var(--dsw-shadow-lv2)));color:var(--dsw-alias-label-primary);font:13px/20px var(--dsw-font-family);border:0;border-radius:var(--dsw-radius-md,8px);background:transparent}#" + BAR_ID + "-content-panel[hidden]{display:none}#" + BAR_ID + "-content-panel .content-viewport{min-height:0;overflow:auto;padding:4px;--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2)}#" + BAR_ID + "-content-panel fieldset{min-width:0;margin:0;padding:0;border:0}#" + BAR_ID + "-content-panel legend{box-sizing:border-box;width:100%;padding:4px 8px;font:500 11px/16px var(--dsw-font-family);color:var(--dsw-alias-label-tertiary)}#" + BAR_ID + "-content-panel .content-options{display:grid;grid-template-columns:minmax(0,1fr)}#" + BAR_ID + "-content-panel .content-option{box-sizing:border-box;min-width:0;min-height:28px;padding:4px 8px;align-items:center;gap:6px;display:flex;border-radius:var(--dsw-radius-sm,6px);cursor:pointer}#" + BAR_ID + "-content-panel .content-option:hover{background:var(--dsw-alias-interactive-bg-hover)}#" + BAR_ID + "-content-panel .content-option span{min-width:0;overflow-wrap:anywhere}#" + BAR_ID + "-content-panel .content-option input{appearance:auto;accent-color:var(--dsw-alias-brand-primary,var(--dsw-alias-state-business-primary));flex:none;width:16px;height:16px;margin:0;cursor:inherit}#" + BAR_ID + "-content-panel .content-reset{margin-top:4px;padding:0 8px;font:12px/18px var(--dsw-font-family)}#" + BAR_ID + "-content-panel .scope-group{padding-bottom:4px;margin-bottom:4px;border-bottom:1px solid var(--dsw-alias-border-l1)}#" + BAR_ID + "-content-panel .history-command{margin-top:4px;padding-top:4px;border-top:1px solid var(--dsw-alias-border-l1)}#" + BAR_ID + "-content-panel .update-version,#" + BAR_ID + "-content-panel .update-status{margin:0;padding:4px 8px;font:12px/18px var(--dsw-font-family);color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}#" + BAR_ID + "-content-panel .update-status:empty{padding:0}#" + BAR_ID + "-content-panel .update-command [hidden]{display:none}#" + BAR_ID + "-content-panel .diagnostic-command{display:flex;flex-wrap:wrap;align-items:center;gap:4px}#" + BAR_ID + "-content-panel .diagnostic-command button{flex:1;width:auto}#" + BAR_ID + "-content-panel .diagnostic-feedback{padding:0 8px;font:12px/18px var(--dsw-font-family);color:var(--dsw-alias-label-secondary)}#" + BAR_ID + "-content-panel .feedback-issue{display:flex;align-items:center;gap:6px;box-sizing:border-box;min-height:28px;width:100%;padding:4px 8px;color:var(--dsw-alias-label-secondary);text-decoration:none;border-radius:var(--dsw-radius-sm,6px)}#" + BAR_ID + "-content-panel .feedback-issue:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}#" + BAR_ID + "-content-panel .feedback-privacy{margin:0;padding:0 8px 4px;font:12px/18px var(--dsw-font-family);color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere}#" + BAR_ID + "-content-panel .history-command button{width:100%;height:auto;min-height:28px;justify-content:flex-start;gap:6px;padding:4px 8px;text-align:left;font:13px/20px var(--dsw-font-family)}#" + BAR_ID + " button,#" + BAR_ID + "-content-panel button{box-sizing:border-box;flex:none;height:28px;min-width:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:var(--dsw-radius-sm,6px);align-items:center;justify-content:center;display:inline-flex}#" + BAR_ID + " button[hidden]{display:none}#" + BAR_ID + " button:hover,#" + BAR_ID + "-content-panel button:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}#" + BAR_ID + " button:focus-visible,#" + BAR_ID + "-content-panel :focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}#" + BAR_ID + " button:disabled,#" + BAR_ID + "-content-panel button:disabled,#" + BAR_ID + "-content-panel button[aria-disabled=true]{opacity:.5;cursor:default}#" + BAR_ID + " [data-find-all-return][hidden]{display:none}#" + BAR_ID + " [data-find-all-return]{gap:4px;padding:0 8px;white-space:nowrap}@container dsh-find-all (max-width:550px){#" + BAR_ID + " .return-label{display:none}#" + BAR_ID + " [data-find-all-return]{padding:0 6px}}@container dsh-find-all (max-width:360px){#" + BAR_ID + " .controls,#" + BAR_ID + " .navigation-controls{gap:2px}#" + BAR_ID + " .count,#" + BAR_ID + " button.count{width:64px;min-width:64px;max-width:64px}#" + BAR_ID + " .status{padding-left:30px}}@container dsh-find-all (max-width:330px){#" + BAR_ID + " .controls{flex-wrap:wrap}#" + BAR_ID + " .navigation-controls{margin-left:auto}}#" + BAR_ID + " svg{pointer-events:none}#" + BAR_ID + "[data-about-open]{z-index:999;pointer-events:none}.dsh-find-all-conversations{width:min(680px,100%);align-self:flex-start;max-height:100%;min-width:0;padding:0;gap:0;font-family:var(--dsw-font-family)}.dsh-find-all-conversations-layout{display:flex;flex-direction:column;min-width:0;min-height:0;flex:1;width:100%;max-width:100%;overflow-y:auto;overflow-x:hidden}.dsh-find-all-conversations-header{display:flex;align-items:center;gap:8px;flex:none;min-width:0;padding:16px 16px 8px}.dsh-find-all-conversations-input{flex:1;min-width:0;box-sizing:border-box}.dsh-find-all-conversations-close{flex:none;width:28px;padding:0;color:var(--dsw-alias-label-secondary)}.dsh-find-all-conversations-toolbar{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:6px 12px;flex:none;min-width:0;padding:0 16px 10px;border-bottom:.5px solid var(--dsw-alias-border-l1)}.dsh-find-all-conversations-scope{min-width:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere}.dsh-find-all-conversations-options{display:flex;align-items:center;flex-wrap:wrap;gap:6px 12px;margin-left:auto;min-width:0;max-width:100%}.dsh-find-all-conversations-title-only{flex:none;font-size:12px;line-height:18px;white-space:nowrap}.dsh-find-all-conversations-title-only-fallback{display:inline-flex;align-items:center;gap:6px}.dsh-find-all-conversations-title-only-fallback input{margin:0;accent-color:var(--dsw-alias-brand-primary)}.dsh-find-all-conversations-list{display:flex;flex-direction:column;flex:0 1 auto;min-height:0;min-width:0;max-width:100%;max-height:416px;box-sizing:border-box;padding:4px 8px;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain}.dsh-find-all-conversations-empty{padding:16px 8px;font-size:13px;line-height:20px;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}.dsh-find-all-conversations-footer{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:4px 8px;flex:none;min-height:0;max-height:35%;padding:8px 12px;border-top:.5px solid var(--dsw-alias-border-l1);overflow-y:auto;overflow-x:hidden}.dsh-find-all-conversations-status-actions{display:flex;align-items:center;flex-wrap:wrap;gap:4px 8px;flex:1;min-width:0}.dsh-find-all-conversations-status{margin:0;min-width:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}.dsh-find-all-conversations-status:empty{display:none}.dsh-find-all-conversations-actions{display:flex;gap:4px;flex-wrap:wrap}.dsh-find-all-conversations-help{flex:none;margin-left:auto;color:var(--dsw-alias-label-tertiary)}.dsh-find-all-conversations-help-content{flex:0 1 auto;min-height:0;max-height:160px;padding:0 16px 12px;overflow-y:auto;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}.dsh-find-all-conversations-help-content[hidden]{display:none}.dsh-find-all-conversations-help-content p{margin:6px 0 0}.dsh-find-all-conversations-match{color:inherit;background:var(--dsw-alias-state-business-tertiary);font-weight:600}.dsh-find-all-conversations-row{display:flex;flex-direction:column;align-items:stretch;flex:none;width:100%;min-width:0;max-width:100%;min-height:48px;box-sizing:border-box;border:none;border-radius:var(--dsw-radius-lg);padding:4px 8px;background:transparent;cursor:pointer;text-align:left;color:var(--dsw-alias-label-primary);font-family:inherit}.dsh-find-all-conversations-row:not(.dsh-find-all-conversations-archived-row):hover,.dsh-find-all-conversations-row:not(.dsh-find-all-conversations-archived-row)[aria-current=true]{background:var(--dsw-alias-interactive-bg-hover)}.dsh-find-all-conversations-row:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.dsh-find-all-conversations-archived-row{cursor:default}.dsh-find-all-conversations-row-heading{display:flex;align-items:center;flex-wrap:wrap;gap:6px;min-width:0;max-width:100%}.dsh-find-all-conversations-row-heading>.dsh-find-all-conversations-title{flex:1;min-width:0}.dsh-find-all-conversations-archive-label{flex:none;font-size:12px;line-height:17px;color:var(--dsw-alias-label-tertiary)}.dsh-find-all-conversations-restore{flex:none}.dsh-find-all-conversations-row-error{min-width:0;max-width:100%;font-size:12px;line-height:17px;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}.dsh-find-all-conversations-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;line-height:20px;font-weight:400}.dsh-find-all-conversations-meta{display:flex;align-items:center;gap:6px;min-width:0;min-height:17px}.dsh-find-all-conversations-info,.dsh-find-all-conversations-snippet{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:17px}.dsh-find-all-conversations-info{flex:none;max-width:40%;color:var(--dsw-alias-label-tertiary)}.dsh-find-all-conversations-info:only-child{max-width:100%}.dsh-find-all-conversations-snippet{flex:1;min-width:0;color:var(--dsw-alias-label-secondary)}.dsh-find-all-about{max-height:100%;font-family:var(--dsw-font-family)}.dsh-find-all-about-content{min-height:0;overflow:auto}.dsh-find-all-about-details{display:flex;flex-direction:column;gap:16px;color:var(--dsw-alias-label-primary);font:13px/20px var(--dsw-font-family);overflow-wrap:anywhere}.dsh-find-all-about-details p{margin:0}.dsh-find-all-about-details h3{margin:0 0 6px;font:500 13px/20px var(--dsw-font-family)}.dsh-find-all-about-details a{color:var(--dsw-alias-state-business-primary);text-underline-offset:3px}.dsh-find-all-about-links{display:flex;flex-wrap:wrap;gap:6px 16px}.dsh-find-all-about-group{display:flex;align-items:center;flex-wrap:wrap;gap:6px 10px}.dsh-find-all-about-status{color:var(--dsw-alias-label-secondary)}.dsh-find-all-about-details :focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}::highlight(" + HL_ALL + "){background-color:rgba(245,197,24,.42)}::highlight(" + HL_CUR + "){background-color:#f5a623;color:#141414}";
5499
6298
  }
5500
6299
  function injectCss() {
5501
6300
  if (typeof document === "undefined") return;
@@ -5575,7 +6374,7 @@ function collectTextBlocks(root, classify) {
5575
6374
  return;
5576
6375
  }
5577
6376
  if (node.nodeType !== 1 && node.nodeType !== 11) return;
5578
- if (SKIP_TAGS[node.tagName] || node.id === BAR_ID || messageActionRow(node, legacyActions) || node.tagName === "BR") {
6377
+ if (SKIP_TAGS[node.tagName] || node.id === BAR_ID || node.hasAttribute?.("data-find-projection-chrome") || messageActionRow(node, legacyActions) || node.tagName === "BR") {
5579
6378
  flush();
5580
6379
  return;
5581
6380
  }
@@ -5622,24 +6421,23 @@ function makeHighlight(ranges) {
5622
6421
  function matchBarRect() {
5623
6422
  return isOpen() && state.bar.hasAttribute("data-positioned") ? state.bar.getBoundingClientRect() : null;
5624
6423
  }
5625
- function visibleMatchRect(range, viewport) {
5626
- if (!viewport || !rangeRect(range, viewport)) return null;
5627
- var clip = clippedViewport(range.startContainer.parentElement, viewport), bar = matchBarRect();
5628
- var rects = range.getClientRects();
5629
- for (var i = 0; i < rects.length; i++) {
5630
- var rect = rects[i], left = Math.max(rect.left, clip.left), right = Math.min(rect.right, clip.right);
5631
- var top = Math.max(rect.top, clip.top), bottom = Math.min(rect.bottom, clip.bottom);
5632
- if (right <= left || bottom <= top) continue;
5633
- if (state.scope === "whole" && (rect.top < clip.top - 1 || rect.bottom > clip.bottom + 1)) continue;
5634
- if (!bar || right <= bar.left || left >= bar.right || bottom <= bar.top || top >= bar.bottom) return rect;
6424
+ function matchAnchorRect(range) {
6425
+ if (!range || !range.startContainer.isConnected || !range.endContainer.isConnected || typeof range.getClientRects !== "function") return null;
6426
+ for (var rect of range.getClientRects()) {
6427
+ if (rect.width > 0 && rect.height > 0 && [rect.top, rect.bottom, rect.left, rect.right].every(Number.isFinite)) return rect;
5635
6428
  }
5636
6429
  return null;
5637
6430
  }
5638
- function scrollRangeWithin(range, scroll, viewport, bar) {
5639
- var rect = rangeRect(range);
5640
- if (!rect) return;
6431
+ function matchScrollPlan(range, scroll, viewport, bar, center) {
6432
+ var rect = matchAnchorRect(range);
6433
+ if (!rect) return null;
5641
6434
  var current = scroll.scrollTop, maximum = Math.max(0, scroll.scrollHeight - scroll.clientHeight);
5642
- var bands = [[viewport.top, viewport.bottom]];
6435
+ var bands = [[viewport.top, viewport.bottom]], margin = 0;
6436
+ if (center) {
6437
+ var lineHeight = window.getComputedStyle(range.startContainer.parentElement).lineHeight;
6438
+ margin = /^\d+(?:\.\d+)?px$/.test(lineHeight) ? parseFloat(lineHeight) : rect.height;
6439
+ if (!Number.isFinite(margin) || margin <= 0) margin = rect.height;
6440
+ }
5643
6441
  if (bar && rect.right > bar.left && rect.left < bar.right && bar.bottom > viewport.top && bar.top < viewport.bottom) {
5644
6442
  bands = [
5645
6443
  [viewport.top, Math.min(viewport.bottom, bar.top - 8)],
@@ -5649,29 +6447,48 @@ function scrollRangeWithin(range, scroll, viewport, bar) {
5649
6447
  var best = null;
5650
6448
  bands.forEach(function(band) {
5651
6449
  if (band[1] <= band[0]) return;
5652
- var delta = rect.top < band[0] ? rect.top - band[0] : rect.bottom > band[1] ? Math.min(rect.top - band[0], rect.bottom - band[1]) : 0;
6450
+ var comfortable = rect.top >= band[0] + margin && rect.bottom <= band[1] - margin;
6451
+ var delta = center ? comfortable ? 0 : (rect.top + rect.bottom - band[0] - band[1]) / 2 : rect.top < band[0] ? rect.top - band[0] : rect.bottom > band[1] ? Math.min(rect.top - band[0], rect.bottom - band[1]) : 0;
5653
6452
  delta = Math.max(0, Math.min(maximum, current + delta)) - current;
5654
6453
  var shown = Math.max(0, Math.min(rect.bottom - delta, band[1]) - Math.max(rect.top - delta, band[0]));
5655
- if (!best || shown > best.shown || shown === best.shown && Math.abs(delta) < Math.abs(best.delta)) best = { delta, shown };
6454
+ var candidate = { delta, shown, comfortable, top: band[0], bottom: band[1] };
6455
+ if (!best || comfortable && !best.comfortable || comfortable === best.comfortable && (shown > best.shown || shown === best.shown && Math.abs(delta) < Math.abs(best.delta))) best = candidate;
5656
6456
  });
5657
- var x = rect.left < viewport.left ? rect.left - viewport.left : rect.right > viewport.right ? Math.min(rect.left - viewport.left, rect.right - viewport.right) : 0;
5658
- if (best && best.delta || x) {
6457
+ if (best) best.x = rect.left < viewport.left ? rect.left - viewport.left : rect.right > viewport.right ? Math.min(rect.left - viewport.left, rect.right - viewport.right) : 0;
6458
+ return best;
6459
+ }
6460
+ function scrollRangeWithin(range, scroll, viewport, bar, center) {
6461
+ var plan = matchScrollPlan(range, scroll, viewport, bar, center);
6462
+ if (plan && (Math.abs(plan.delta) > 1 || Math.abs(plan.x) > 1)) {
5659
6463
  try {
5660
- scroll.scrollBy({ top: best ? best.delta : 0, left: x, behavior: "instant" });
6464
+ scroll.scrollBy({ top: plan.delta, left: plan.x, behavior: "instant" });
5661
6465
  } catch (error) {
5662
6466
  }
5663
6467
  }
5664
6468
  }
6469
+ function matchLanding(range, viewport) {
6470
+ var rect = matchAnchorRect(range);
6471
+ if (!viewport || !rect) return null;
6472
+ var clip = clippedViewport(range.startContainer.parentElement, viewport), bar = matchBarRect();
6473
+ var plan = matchScrollPlan(range, viewport.scroll, viewport, bar, true);
6474
+ var readable = rect.top >= clip.top - 1 && rect.bottom <= clip.bottom + 1 && clip.right > clip.left && Math.min(rect.right, clip.right) - Math.max(rect.left, clip.left) >= Math.min(rect.width, clip.right - clip.left) - 1 && (!bar || rect.right <= bar.left || rect.left >= bar.right || rect.bottom <= bar.top || rect.top >= bar.bottom);
6475
+ return {
6476
+ rect,
6477
+ plan,
6478
+ readable,
6479
+ settled: readable && plan && (plan.comfortable || Math.abs(plan.delta) <= 1)
6480
+ };
6481
+ }
5665
6482
  function scrollToRange(range) {
5666
6483
  var viewport = readingViewport(state.target);
5667
- if (!viewport || visibleMatchRect(range, viewport)) return;
6484
+ if (!viewport) return;
5668
6485
  for (var node = range.startContainer.parentElement; node && node !== viewport.scroll; node = node.parentElement) {
5669
6486
  var style = window.getComputedStyle(node);
5670
6487
  var clipsY = /^(auto|scroll|hidden)$/.test(style.overflowY) && node.scrollHeight > node.clientHeight;
5671
6488
  var clipsX = /^(auto|scroll|hidden)$/.test(style.overflowX) && node.scrollWidth > node.clientWidth;
5672
6489
  if (!clipsX && !clipsY) continue;
5673
- var box = node.getBoundingClientRect(), top = box.top + node.clientTop, left = box.left + node.clientLeft;
5674
- var rect = rangeRect(range);
6490
+ var box = node.getBoundingClientRect(), left = box.left + node.clientLeft;
6491
+ var rect = matchAnchorRect(range);
5675
6492
  if (!rect) return;
5676
6493
  var clip = clippedViewport(node, viewport), local = verticalTextClip(node, style, box);
5677
6494
  var safeTop = Math.max(local.top, clip.top), safeBottom = Math.min(local.bottom, clip.bottom);
@@ -5685,11 +6502,12 @@ function scrollToRange(range) {
5685
6502
  left: clipsX ? left : rect.left,
5686
6503
  right: clipsX ? left + node.clientWidth : rect.right
5687
6504
  },
5688
- clipsY && shown ? matchBarRect() : null
6505
+ clipsY && shown ? matchBarRect() : null,
6506
+ false
5689
6507
  );
5690
6508
  }
5691
6509
  viewport = readingViewport(state.target);
5692
- if (viewport && !visibleMatchRect(range, viewport)) scrollRangeWithin(range, viewport.scroll, viewport, matchBarRect());
6510
+ if (viewport) scrollRangeWithin(range, viewport.scroll, viewport, matchBarRect(), true);
5693
6511
  }
5694
6512
  function visible(element) {
5695
6513
  if (!element || !element.isConnected || !element.getClientRects().length) return false;
@@ -5777,6 +6595,12 @@ function createHostAdapter(ctx, changed) {
5777
6595
  nodes: function(entry) {
5778
6596
  return entry && entry.registration.nodes;
5779
6597
  },
6598
+ forSession: function(id) {
6599
+ var matches = Array.from(entries.values()).filter(function(entry) {
6600
+ return entry.id === id && shown(entry) && resolveScope(entry.anchor, id);
6601
+ });
6602
+ return matches.length === 1 ? choose(matches[0]) : null;
6603
+ },
5780
6604
  refresh: current,
5781
6605
  select: function(target, previous) {
5782
6606
  var direct = Array.from(entries.values()).filter(function(entry) {
@@ -5814,7 +6638,7 @@ function hostNavigationReady(target, face) {
5814
6638
  if (face && (!status || status.reason || pendingLoads.has(face))) return false;
5815
6639
  return !target.root.querySelector(":scope > div:not([data-chat-anchor-key]):not([data-chat-group-key]) > button:disabled");
5816
6640
  }
5817
- function activateLoadedTurn(target, store, preferredTurn) {
6641
+ function activateLoadedTurn(target, store, preferredTurn, exactOnly) {
5818
6642
  if (!store) return false;
5819
6643
  var list = target.root.parentElement, chat = list && list.parentElement, frame = chat && chat.parentElement;
5820
6644
  if (!frame || !target.panel.contains(frame)) return false;
@@ -5822,23 +6646,25 @@ function activateLoadedTurn(target, store, preferredTurn) {
5822
6646
  var label = nav.getAttribute("aria-label");
5823
6647
  return !target.root.contains(nav) && (label === "Turn navigation" || label === "\u8F6E\u6B21\u5BFC\u822A");
5824
6648
  });
6649
+ if (!navs.length) return exactOnly ? null : false;
5825
6650
  if (navs.length !== 1 || !visible(navs[0])) return false;
5826
6651
  var loaded = /* @__PURE__ */ new Set();
5827
6652
  Array.prototype.forEach.call(target.root.querySelectorAll("[data-chat-anchor-key][data-chat-turn]"), function(row) {
5828
6653
  var key = row.getAttribute("data-chat-node-key") || row.getAttribute("data-chat-anchor-key");
5829
6654
  if (store.get(key)) loaded.add(row.getAttribute("data-chat-turn"));
5830
6655
  });
5831
- var candidates = [];
6656
+ var candidates = [], exactMounted = false;
5832
6657
  Array.prototype.forEach.call(navs[0].querySelectorAll("button[data-index]"), function(button2) {
5833
6658
  var match = /^(?:Jump to turn (\d+)|跳转到第 (\d+) 轮)$/.exec(button2.getAttribute("aria-label") || "");
5834
6659
  var turn = match && (match[1] || match[2]);
5835
- if (!turn || !loaded.has(turn) || button2.disabled || button2.getAttribute("aria-busy") === "true" || !visible(button2)) return;
6660
+ if (turn === preferredTurn) exactMounted = true;
6661
+ if (!turn || exactOnly && turn !== preferredTurn || !loaded.has(turn) || button2.disabled || button2.getAttribute("aria-busy") === "true" || !visible(button2)) return;
5836
6662
  candidates.push({ button: button2, rank: turn === preferredTurn ? 0 : button2.getAttribute("aria-current") === "true" ? 1 : 2 });
5837
6663
  });
5838
6664
  candidates.sort(function(a, b) {
5839
6665
  return a.rank - b.rank;
5840
6666
  });
5841
- if (!candidates.length) return false;
6667
+ if (!candidates.length) return exactOnly && !exactMounted ? null : false;
5842
6668
  candidates[0].button.click();
5843
6669
  return true;
5844
6670
  }
@@ -6080,7 +6906,7 @@ function updateReturnButton() {
6080
6906
  var available = originValid(state.origin) && state.origin.navigated;
6081
6907
  state.returnBtn.hidden = !state.restoring && !available;
6082
6908
  state.returnBtn.disabled = !!state.restoring;
6083
- var label = state.restoring ? L.returning : L.returnPosition;
6909
+ var label = state.restoring ? L2.returning : L2.returnPosition;
6084
6910
  state.returnBtn.querySelector(".return-label").textContent = label;
6085
6911
  state.returnBtn.setAttribute("aria-label", label);
6086
6912
  state.returnBtn.title = label;
@@ -6107,77 +6933,139 @@ function discardOrigin() {
6107
6933
  updateReturnButton();
6108
6934
  }
6109
6935
  function navigateToRange(range) {
6110
- cancelReturn(L.returnCancelled);
6936
+ cancelReturn(L2.returnCancelled);
6111
6937
  cancelNavigation();
6112
6938
  var target = state.target, face = state.adapter && state.adapter.face(target);
6113
- if (state.scope !== "whole" && target && state.adapter.valid(target) && hostNavigationReady(target, face)) {
6114
- var row = range.startContainer.parentElement.closest("[data-chat-turn]");
6115
- activateLoadedTurn(target, state.adapter.nodes(target), row && row.getAttribute("data-chat-turn"));
6116
- if (state.target !== target || !state.adapter.valid(target) || state.adapter.face(target) !== face) return;
6117
- }
6118
- var origin = state.origin, token = state.navigationToken, started = Date.now();
6939
+ var origin = state.origin, token = state.navigationToken, queryToken = state.queryToken, query = state.query, started = Date.now();
6119
6940
  var dataHit = state.scope === "whole" ? state.hits[state.index] : null;
6120
- var activated = /* @__PURE__ */ new Set(), announceReturn = false;
6941
+ var selection = state.selection, activated = /* @__PURE__ */ new Set(), announceReturn = false, statusApplied = false;
6942
+ var transferred = false, directAttempted = false, corrections = 0, previous = null, stable = 0;
6943
+ function retry() {
6944
+ state.navigationTimer = setTimeout(check, 100);
6945
+ }
6946
+ function fail() {
6947
+ recordFailure("jump", "render");
6948
+ setStatus(L2.matchRevealFailed, false);
6949
+ if (state.announcement) state.announcement.textContent = L2.matchRevealFailed;
6950
+ }
6121
6951
  function check() {
6122
6952
  state.navigationTimer = 0;
6123
- if (token !== state.navigationToken || state.target !== target || !state.adapter.valid(target) || !isOpen()) return;
6953
+ if (token !== state.navigationToken || queryToken !== state.queryToken || query !== state.query || state.target !== target || !state.adapter.valid(target) || state.adapter.face(target) !== face || !isOpen() || dataHit && state.hits[state.index] !== dataHit) return;
6954
+ if (Date.now() - started >= 1500) {
6955
+ fail();
6956
+ return;
6957
+ }
6958
+ if (!face || !hostNavigationReady(target, face)) {
6959
+ previous = null;
6960
+ stable = 0;
6961
+ retry();
6962
+ return;
6963
+ }
6124
6964
  positionBar();
6125
- var viewport = readingViewport(target);
6126
- var current = state.ranges[state.index];
6965
+ var current = state.ranges[state.index], store = state.adapter.nodes(target);
6127
6966
  if (dataHit) {
6128
- var semanticNode = sourceNode(dataHit.source, state.adapter.nodes(target));
6967
+ current = null;
6968
+ var semanticNode = sourceNode(dataHit.source, store);
6129
6969
  if (semanticNode) {
6130
- var resolved = mapProjectedDocument(dataHit.source, semanticNode, sourceRows(target, semanticNode));
6131
- if (resolved.blocks) {
6132
- current = rangeForBlock(resolved.blocks[dataHit.blockIndex], dataHit.start, dataHit.end);
6133
- if (current && current.toString() === dataHit.text) {
6134
- state.ranges[state.index] = current;
6135
- paint();
6136
- } else current = null;
6137
- } else {
6138
- current = null;
6139
- expandSource(target, semanticNode, dataHit.source, activated);
6140
- }
6141
- }
6142
- }
6143
- var attached = current && target.root.contains(current.startContainer);
6970
+ var resolved = mapProjectedDocument(dataHit.source, semanticNode, sourceRows(target, semanticNode), dataHit.blockIndex);
6971
+ if (resolved.blocks) current = rangeForBlock(resolved.blocks[dataHit.blockIndex], dataHit.start, dataHit.end);
6972
+ else expandSource(target, semanticNode, dataHit.source, activated);
6973
+ if (current && current.toString() !== dataHit.text) current = null;
6974
+ }
6975
+ } else if (selection && selection.position && selection.block && selection.block.isConnected) {
6976
+ var blocks = collectTextBlocks(selection.block);
6977
+ current = blocks.length === selection.texts.length && blocks.every(function(block, i) {
6978
+ return block.text === selection.texts[i];
6979
+ }) ? rangeForBlock(blocks[selection.position.run], selection.position.start, selection.position.end) : null;
6980
+ }
6981
+ var attached = current && target.root.contains(current.startContainer) && target.root.contains(current.endContainer);
6144
6982
  var concealed = attached && hiddenUntilFoundAncestor(current.startContainer, target.root);
6145
- var geometry = attached && !concealed && rangeRect(current);
6146
- if (current && (!geometry || concealed)) revealMatchRange(target, current, activated);
6147
- if (geometry && !visibleMatchRect(current, viewport)) scrollToRange(current);
6148
- if (dataHit && geometry && !visibleMatchRect(current, viewport)) {
6149
- state.avoidMatchRange = current;
6150
- positionBar();
6151
- }
6152
- if (viewport && attached && !concealed && visibleMatchRect(current, viewport)) {
6153
- var firstNavigation = originValid(origin) && !origin.navigated;
6154
- if (originValid(origin)) origin.navigated = true;
6155
- updateReturnButton();
6156
- if (!firstNavigation && state.status && state.status.textContent === L.matchRevealFailed) setStatus("", false);
6157
- if (firstNavigation) {
6158
- if (state.jumpStatus !== null) {
6159
- var priorStatus = state.jumpStatus;
6160
- setStatus(priorStatus, false);
6161
- } else if (dataHit) historyStatus();
6162
- else setStatus("", false);
6163
- announceReturn = true;
6164
- state.navigationTimer = setTimeout(check, 0);
6983
+ var geometry = attached && !concealed && matchAnchorRect(current);
6984
+ if (attached && (!geometry || concealed)) revealMatchRange(target, current, activated);
6985
+ if (!geometry) {
6986
+ previous = null;
6987
+ stable = 0;
6988
+ retry();
6989
+ return;
6990
+ }
6991
+ state.ranges[state.index] = current;
6992
+ paint();
6993
+ var viewport = readingViewport(target), landing = matchLanding(current, viewport);
6994
+ if (!landing) {
6995
+ retry();
6996
+ return;
6997
+ }
6998
+ if (!transferred && !landing.settled) {
6999
+ var row = current.startContainer.parentElement.closest("[data-chat-turn]");
7000
+ var turn = row && row.getAttribute("data-chat-turn");
7001
+ if (directAttempted) {
7002
+ fail();
7003
+ return;
7004
+ }
7005
+ var handoff = turn ? activateLoadedTurn(target, store, turn, true) : null;
7006
+ if (handoff === false) {
7007
+ retry();
6165
7008
  return;
6166
7009
  }
6167
- if (dataHit && Date.now() - started < 700) {
6168
- state.navigationTimer = setTimeout(check, 100);
7010
+ if (handoff === true) {
7011
+ transferred = true;
7012
+ previous = null;
7013
+ stable = 0;
7014
+ retry();
6169
7015
  return;
6170
7016
  }
6171
- if (announceReturn && state.announcement) state.announcement.textContent = L.returnAvailable;
7017
+ directAttempted = true;
7018
+ }
7019
+ if (!landing.settled) {
7020
+ if (corrections >= 2) {
7021
+ fail();
7022
+ return;
7023
+ }
7024
+ corrections++;
7025
+ scrollToRange(current);
7026
+ viewport = readingViewport(target);
7027
+ landing = matchLanding(current, viewport);
7028
+ if (dataHit && landing && !landing.readable) {
7029
+ state.avoidMatchRange = current;
7030
+ positionBar();
7031
+ landing = matchLanding(current, readingViewport(target));
7032
+ }
7033
+ previous = null;
7034
+ stable = 0;
7035
+ retry();
6172
7036
  return;
6173
7037
  }
6174
- if (Date.now() - started < 1500) {
6175
- state.navigationTimer = setTimeout(check, 100);
7038
+ if (!statusApplied) {
7039
+ statusApplied = true;
7040
+ announceReturn = originValid(origin) && !origin.navigated;
7041
+ if (originValid(origin)) origin.navigated = true;
7042
+ updateReturnButton();
7043
+ if (state.jumpStatus !== null) setStatus(state.jumpStatus, false);
7044
+ else if (dataHit) historyStatus();
7045
+ else if (state.status.textContent === L2.matchRevealFailed || announceReturn) setStatus("", false);
7046
+ previous = null;
7047
+ stable = 0;
7048
+ retry();
6176
7049
  return;
6177
7050
  }
6178
- recordFailure("jump", "render");
6179
- setStatus(L.matchRevealFailed, false);
6180
- if (state.announcement) state.announcement.textContent = L.matchRevealFailed;
7051
+ var sample = [
7052
+ landing.rect.top,
7053
+ landing.rect.bottom,
7054
+ landing.rect.left,
7055
+ landing.rect.right,
7056
+ viewport.scroll.scrollTop,
7057
+ landing.plan.top,
7058
+ landing.plan.bottom
7059
+ ];
7060
+ stable = previous && sample.every(function(value, i) {
7061
+ return Math.abs(value - previous[i]) <= 1;
7062
+ }) ? stable + 1 : 0;
7063
+ previous = sample;
7064
+ if (stable < 2) {
7065
+ retry();
7066
+ return;
7067
+ }
7068
+ if (announceReturn && state.announcement) state.announcement.textContent = L2.returnAvailable;
6181
7069
  }
6182
7070
  check();
6183
7071
  }
@@ -6233,7 +7121,7 @@ function revealMatchRange(target, range, activated) {
6233
7121
  return changed;
6234
7122
  }
6235
7123
  function returnFailure(reason) {
6236
- return L.returnFailed + " " + (L["return_" + reason] || L.return_unavailable);
7124
+ return L2.returnFailed + " " + (L2["return_" + reason] || L2.return_unavailable);
6237
7125
  }
6238
7126
  async function returnToOrigin() {
6239
7127
  cancelCountEdit(false);
@@ -6244,7 +7132,7 @@ async function returnToOrigin() {
6244
7132
  cancelNavigation();
6245
7133
  var task = { origin };
6246
7134
  state.restoring = task;
6247
- setStatus(L.returning, false);
7135
+ setStatus(L2.returning, false);
6248
7136
  updateReturnButton();
6249
7137
  function cancelled() {
6250
7138
  return state.restoring !== task || !originValid(origin);
@@ -6398,7 +7286,7 @@ async function returnToOrigin() {
6398
7286
  if (state.scope === "whole") historyStatus();
6399
7287
  else setStatus("", false);
6400
7288
  updateReturnButton();
6401
- if (state.announcement) state.announcement.textContent = L.returned;
7289
+ if (state.announcement) state.announcement.textContent = L2.returned;
6402
7290
  } catch (error) {
6403
7291
  finishFailure("error");
6404
7292
  } finally {
@@ -6412,6 +7300,10 @@ async function returnToOrigin() {
6412
7300
  }
6413
7301
  var state = {
6414
7302
  ctx: null,
7303
+ conversationSearch: null,
7304
+ crossSearch: null,
7305
+ crossSearchReturn: null,
7306
+ crossSearchHint: null,
6415
7307
  updateTask: null,
6416
7308
  updateResult: null,
6417
7309
  updateBtn: null,
@@ -6432,6 +7324,7 @@ var state = {
6432
7324
  history: null,
6433
7325
  historySnapshot: null,
6434
7326
  projector: null,
7327
+ searchContent: null,
6435
7328
  hits: [],
6436
7329
  total: 0,
6437
7330
  queryToken: 0,
@@ -6617,17 +7510,17 @@ async function copyDiagnostics() {
6617
7510
  var epoch = ++state.copyEpoch, feedback = state.diagnosticFeedback;
6618
7511
  state.copyPending = true;
6619
7512
  state.diagnosticBtn.setAttribute("aria-busy", "true");
6620
- feedback.textContent = L.copyingDiagnostics;
7513
+ feedback.textContent = L2.copyingDiagnostics;
6621
7514
  var copied = false;
6622
7515
  try {
6623
- var summary = { schemaVersion: 1, pluginVersion: "0.1.11", current: diagnosticState(), lastFailure: state.lastFailure };
7516
+ var summary = { schemaVersion: 1, pluginVersion: "0.1.12", current: diagnosticState(), lastFailure: state.lastFailure };
6624
7517
  copied = typeof state.writeClipboard === "function" && await state.writeClipboard(JSON.stringify(summary, null, 2)) === true;
6625
7518
  } catch (error) {
6626
7519
  }
6627
7520
  if (!state.mounted || epoch !== state.copyEpoch || state.diagnosticFeedback !== feedback || !feedback.isConnected) return;
6628
7521
  state.copyPending = false;
6629
7522
  state.diagnosticBtn.removeAttribute("aria-busy");
6630
- feedback.textContent = copied ? L.copiedDiagnostics : L.copyDiagnosticsFailed;
7523
+ feedback.textContent = copied ? L2.copiedDiagnostics : L2.copyDiagnosticsFailed;
6631
7524
  }
6632
7525
  function barAnchor(target) {
6633
7526
  if (!target || !target.anchor || !target.panel || !target.anchor.closest) return null;
@@ -6717,7 +7610,7 @@ function buildPositionControls(controls, bar) {
6717
7610
  moves.className = "position-controls";
6718
7611
  moves.id = BAR_ID + "-position";
6719
7612
  moves.hidden = true;
6720
- var handle = button(L.move, "M9 5h.01M15 5h.01M9 12h.01M15 12h.01M9 19h.01M15 19h.01", function(event) {
7613
+ var handle = button(L2.move, "M9 5h.01M15 5h.01M9 12h.01M15 12h.01M9 19h.01M15 19h.01", function(event) {
6721
7614
  if (event.detail && state.suppressMoveClick) {
6722
7615
  state.suppressMoveClick = false;
6723
7616
  return;
@@ -6755,19 +7648,19 @@ function buildPositionControls(controls, bar) {
6755
7648
  ["pointerup", "pointercancel", "lostpointercapture"].forEach(function(type) {
6756
7649
  handle.addEventListener(type, finishBarDrag);
6757
7650
  });
6758
- moves.appendChild(button(L.moveLeft, "m14 6-6 6 6 6", function() {
7651
+ moves.appendChild(button(L2.moveLeft, "m14 6-6 6 6 6", function() {
6759
7652
  moveBarBy(-32, 0);
6760
7653
  }));
6761
- moves.appendChild(button(L.moveRight, "m10 6 6 6-6 6", function() {
7654
+ moves.appendChild(button(L2.moveRight, "m10 6 6 6-6 6", function() {
6762
7655
  moveBarBy(32, 0);
6763
7656
  }));
6764
- moves.appendChild(button(L.moveUp, "m6 14 6-6 6 6", function() {
7657
+ moves.appendChild(button(L2.moveUp, "m6 14 6-6 6 6", function() {
6765
7658
  moveBarBy(0, -32);
6766
7659
  }));
6767
- moves.appendChild(button(L.moveDown, "m6 10 6 6 6-6", function() {
7660
+ moves.appendChild(button(L2.moveDown, "m6 10 6 6 6-6", function() {
6768
7661
  moveBarBy(0, 32);
6769
7662
  }));
6770
- var reset = button(L.resetPosition, "M3 10a9 9 0 1 1 2 8M3 4v6h6", resetBarPosition);
7663
+ var reset = button(L2.resetPosition, "M3 10a9 9 0 1 1 2 8M3 4v6h6", resetBarPosition);
6771
7664
  moves.appendChild(reset);
6772
7665
  state.dragHandle = handle;
6773
7666
  state.positionControls = moves;
@@ -6838,20 +7731,26 @@ function updateCount() {
6838
7731
  var complete = whole ? state.scanComplete : valid;
6839
7732
  var searching = whole && valid && wholeAvailable && !state.scanCancelled && (state.paging || state.scanBusy || !state.historySnapshot || state.historySnapshot.status === "reading" || state.historySnapshot.status === "projecting");
6840
7733
  var label;
6841
- if (!state.query) label = L.countReady;
6842
- else if (!n) label = complete ? L.countEmpty : searching ? L.countSearching : !valid || whole && !wholeAvailable ? L.countUnavailable : L.countIncomplete;
6843
- else if (state.index < 0) label = L.resultCount.replace("{n}", String(total) + suffix);
7734
+ if (!state.query) label = L2.countReady;
7735
+ else if (!n) label = complete ? L2.countEmpty : searching ? L2.countSearching : !valid || whole && !wholeAvailable ? L2.countUnavailable : L2.countIncomplete;
7736
+ else if (state.index < 0) label = L2.resultCount.replace("{n}", String(total) + suffix);
6844
7737
  else label = state.index + 1 + "/" + total + suffix;
6845
- var cap = state.capped ? L.cap.replace("{n}", String(MAX_MATCHES)) : "";
7738
+ var cap = state.capped ? L2.cap.replace("{n}", String(MAX_MATCHES)) : "";
6846
7739
  state.count.textContent = label;
6847
7740
  state.count.title = label + (cap ? "; " + cap : "");
6848
- state.count.setAttribute("aria-label", state.count.title + "; " + L.jumpNumber);
7741
+ state.count.setAttribute("aria-label", state.count.title + "; " + L2.jumpNumber);
6849
7742
  state.count.setAttribute("aria-disabled", String(!available));
6850
7743
  if (state.countEdit && !available) cancelCountEdit(false);
6851
7744
  state.count.hidden = !available || !!state.countEdit;
6852
7745
  state.countState.hidden = available;
6853
7746
  state.countState.textContent = label;
6854
7747
  state.countState.title = label;
7748
+ if (state.crossSearchReturn) {
7749
+ var fromSearch = state.crossSearch && state.crossSearch.id === state.target?.id;
7750
+ state.crossSearchReturn.hidden = !fromSearch;
7751
+ state.crossSearchHint.hidden = !fromSearch;
7752
+ state.crossSearchHint.textContent = fromSearch && complete && !n ? ZH ? "\u6B64\u4F1A\u8BDD\u7684\u5F53\u524D\u641C\u7D22\u8303\u56F4\u5185\u672A\u627E\u5230\u8BE5\u5173\u952E\u8BCD\uFF1B\u8DE8\u5BF9\u8BDD\u5339\u914D\u89C4\u5219\u53EF\u80FD\u4E0D\u540C\u3002\u53EF\u8FD4\u56DE\u641C\u7D22\u7ED3\u679C\u3002" : "No match in this conversation\u2019s current search scope. Cross-conversation matching differs; you can return to the results." : ZH ? "\u6B63\u5728\u6B64\u5BF9\u8BDD\u5185\u67E5\u627E\u3002" : "Finding in this conversation.";
7753
+ }
6855
7754
  var announcement = !state.query || available || complete ? label : "";
6856
7755
  if (state.countLive && state.countLive.textContent !== announcement) state.countLive.textContent = announcement;
6857
7756
  if (state.countEdit) {
@@ -6862,8 +7761,8 @@ function updateCount() {
6862
7761
  function updateCountHint() {
6863
7762
  if (!state.countEdit) return;
6864
7763
  var invalid = state.countInput.getAttribute("aria-invalid") === "true";
6865
- state.countHint.textContent = (invalid ? L.jumpInvalid : L.jumpRange).replace("{n}", String(resultLength()));
6866
- if (state.capped) state.countHint.textContent += " " + L.cap.replace("{n}", String(resultLength()));
7764
+ state.countHint.textContent = (invalid ? L2.jumpInvalid : L2.jumpRange).replace("{n}", String(resultLength()));
7765
+ if (state.capped) state.countHint.textContent += " " + L2.cap.replace("{n}", String(resultLength()));
6867
7766
  }
6868
7767
  function cancelCountEdit(restoreFocus) {
6869
7768
  if (!state.countEdit) return;
@@ -6878,7 +7777,7 @@ function beginCountEdit() {
6878
7777
  if (state.scope === "page" && state.observer?.takeRecords().length) scheduleRescan();
6879
7778
  if (state.scope === "page" && state.pageDirty) runSearch(true);
6880
7779
  if (!resultLength() || !state.adapter?.valid(state.target)) return;
6881
- cancelReturn(L.returnCancelled);
7780
+ cancelReturn(L2.returnCancelled);
6882
7781
  cancelNavigation();
6883
7782
  closeContentPanel();
6884
7783
  state.countEdit = { target: state.target, query: state.query, scope: state.scope, revision: state.resultsRevision, composing: false };
@@ -6938,7 +7837,7 @@ function setStatus(text, busy) {
6938
7837
  if (!state.status) return;
6939
7838
  state.jumpStatus = null;
6940
7839
  state.status.textContent = text || "";
6941
- state.status.title = busy ? L.stopTip : text || "";
7840
+ state.status.title = busy ? L2.stopTip : text || "";
6942
7841
  if (busy) state.status.setAttribute("data-busy", "1");
6943
7842
  else state.status.removeAttribute("data-busy");
6944
7843
  updateCount();
@@ -6949,7 +7848,7 @@ function updateScopeButton() {
6949
7848
  state.scopeInputs.page.checked = state.scope === "page";
6950
7849
  if (state.refreshBtn) {
6951
7850
  state.refreshBtn.disabled = state.scope !== "whole";
6952
- state.refreshBtn.title = state.scope === "whole" ? L.refreshHistory : L.refreshUnavailable;
7851
+ state.refreshBtn.title = state.scope === "whole" ? L2.refreshHistory : L2.refreshUnavailable;
6953
7852
  }
6954
7853
  updateContentButton();
6955
7854
  }
@@ -6967,7 +7866,7 @@ function updateContentButton() {
6967
7866
  if (!state.contentBtn) return;
6968
7867
  var count = selectedContentCount();
6969
7868
  var changed = state.scope !== "whole" || !contentSelectionIsDefault();
6970
- var label = L.contentButtonLabel.replace("{n}", String(count)).replace("{scope}", state.scope === "whole" ? L.scopeWhole : L.scopePage).replace("{changed}", changed ? L.optionsChanged : "");
7869
+ var label = L2.contentButtonLabel.replace("{n}", String(count)).replace("{scope}", state.scope === "whole" ? L2.scopeWhole : L2.scopePage).replace("{changed}", changed ? L2.optionsChanged : "");
6971
7870
  state.contentBtn.setAttribute("aria-label", label);
6972
7871
  state.contentBtn.title = label;
6973
7872
  if (!changed) state.contentBtn.removeAttribute("data-filtered");
@@ -7019,9 +7918,9 @@ function closeContentPanel(restoreFocus) {
7019
7918
  function renderUpdateCheck() {
7020
7919
  if (!state.updateBtn) return;
7021
7920
  state.updateBtn.setAttribute("aria-disabled", state.updateTask ? "true" : "false");
7022
- if (state.updateBtn.textContent !== L.checkUpdate) state.updateBtn.textContent = L.checkUpdate;
7921
+ if (state.updateBtn.textContent !== L2.checkUpdate) state.updateBtn.textContent = L2.checkUpdate;
7023
7922
  var result = state.updateResult;
7024
- var message = state.updateTask ? L.checkingUpdate : !result ? "" : result.status === "available" ? L.updateAvailable.replace("{v}", result.version) : result.status === "current" ? L.updateCurrent : result.status === "ahead" ? L.updateAhead.replace("{v}", result.version) : L.updateFailed;
7923
+ var message = state.updateTask ? L2.checkingUpdate : !result ? "" : result.status === "available" ? L2.updateAvailable.replace("{v}", result.version) : result.status === "current" ? L2.updateCurrent : result.status === "ahead" ? L2.updateAhead.replace("{v}", result.version) : L2.updateFailed;
7025
7924
  if (state.updateStatus.textContent !== message) state.updateStatus.textContent = message;
7026
7925
  state.updateGuide.hidden = !result || result.status !== "available" || !!state.updateTask;
7027
7926
  }
@@ -7041,7 +7940,7 @@ async function checkForUpdates() {
7041
7940
  state.updateResult = null;
7042
7941
  renderUpdateCheck();
7043
7942
  try {
7044
- var result = await checkLatestVersion("0.1.11", task.signal);
7943
+ var result = await checkLatestVersion("0.1.12", task.signal);
7045
7944
  if (state.mounted && state.updateTask === task) state.updateResult = result;
7046
7945
  } catch (error) {
7047
7946
  if (state.mounted && state.updateTask === task) state.updateResult = { status: "failed" };
@@ -7066,7 +7965,7 @@ function openAbout() {
7066
7965
  var owner = state.target && state.aboutViews.get(state.target.anchor);
7067
7966
  if (!state.aboutAvailable || !owner || state.aboutOwner || !state.mounted) return;
7068
7967
  cancelCountEdit(false);
7069
- cancelReturn(L.returnCancelled);
7968
+ cancelReturn(L2.returnCancelled);
7070
7969
  cancelNavigation();
7071
7970
  closeContentPanel(true);
7072
7971
  state.aboutOwner = owner;
@@ -7137,7 +8036,7 @@ function loadedContentType(node, store) {
7137
8036
  }
7138
8037
  function contentSelectionChanged() {
7139
8038
  cancelCountEdit(false);
7140
- cancelReturn(L.returnCancelled);
8039
+ cancelReturn(L2.returnCancelled);
7141
8040
  cancelNavigation();
7142
8041
  state.selection = null;
7143
8042
  state.ranges = [];
@@ -7148,7 +8047,7 @@ function contentSelectionChanged() {
7148
8047
  if (state.scope === "whole" && state.query) schedulePageIn();
7149
8048
  }
7150
8049
  function unavailableStatus() {
7151
- return state.target || state.adapter && state.adapter.scopeUnavailable() ? L.noRoot : L.noTarget;
8050
+ return state.target || state.adapter && state.adapter.scopeUnavailable() ? L2.noRoot : L2.noTarget;
7152
8051
  }
7153
8052
  function selectionBlock(range, root) {
7154
8053
  var nearest = null;
@@ -7271,7 +8170,7 @@ function goTo(delta) {
7271
8170
  }
7272
8171
  function activateMatch(index) {
7273
8172
  if (!Number.isInteger(index) || index < 0 || index >= resultLength()) return;
7274
- cancelReturn(L.returnCancelled);
8173
+ cancelReturn(L2.returnCancelled);
7275
8174
  cancelNavigation();
7276
8175
  if (!state.adapter?.valid(state.target)) {
7277
8176
  runSearch(false);
@@ -7300,6 +8199,10 @@ function scheduleRescan() {
7300
8199
  if (state.paging) return;
7301
8200
  clearTimeout(state.debounce);
7302
8201
  state.debounce = setTimeout(function() {
8202
+ if (state.scope === "page" && state.navigationTimer) {
8203
+ scheduleRescan();
8204
+ return;
8205
+ }
7303
8206
  if (isOpen()) runSearch(true);
7304
8207
  }, 250);
7305
8208
  }
@@ -7343,6 +8246,20 @@ function schedulePageIn() {
7343
8246
  startPageIn();
7344
8247
  }, 150);
7345
8248
  }
8249
+ function searchContentChanged() {
8250
+ cancelPageIn();
8251
+ state.history = null;
8252
+ state.historySnapshot = null;
8253
+ state.scanQuery = null;
8254
+ state.hits = [];
8255
+ state.total = 0;
8256
+ state.ranges = [];
8257
+ state.index = -1;
8258
+ state.sourceNotice = "";
8259
+ paint();
8260
+ updateCount();
8261
+ if (isOpen() && state.scope === "whole" && state.query) schedulePageIn();
8262
+ }
7346
8263
  function historyStatus() {
7347
8264
  if (state.scope !== "whole" || !state.status) return;
7348
8265
  var snapshot = state.historySnapshot;
@@ -7355,12 +8272,12 @@ function historyStatus() {
7355
8272
  else if (snapshot.readComplete && snapshot.status === "partial" && !state.scanCancelled && state.scanCursor >= snapshot.documents.length && relevantErrors.length && relevantErrors.every(function(error) {
7356
8273
  return error.code === "truncated-tool-output";
7357
8274
  })) text = ZH ? "\u90E8\u5206\u5185\u5BB9\u6CA1\u6709\u5B8C\u6574\u4FDD\u5B58\uFF0C\u641C\u7D22\u7ED3\u679C\u53EF\u80FD\u4E0D\u5B8C\u6574\u3002" : "Some content was not saved in full, so results may be incomplete.";
7358
- else if (!snapshot.readComplete || !projectionComplete || !state.scanComplete) text = L.incomplete;
8275
+ else if (!snapshot.readComplete || !projectionComplete || !state.scanComplete) text = L2.incomplete;
7359
8276
  else text = "";
7360
8277
  function add(part) {
7361
8278
  if (part) text += (text ? " \xB7 " : "") + part;
7362
8279
  }
7363
- if (state.capped) add(L.cap.replace("{n}", String(MAX_MATCHES)));
8280
+ if (state.capped) add(L2.cap.replace("{n}", String(MAX_MATCHES)));
7364
8281
  add(state.sourceNotice);
7365
8282
  if (state.liveCount) add((ZH ? "\u5F53\u524D\u6B63\u5728\u751F\u6210\u7684\u56DE\u590D\u4E2D\u53E6\u6709 " : "The reply being generated contains ") + state.liveCount + (state.liveCapped ? "+" : "") + (ZH ? " \u4E2A\u5339\u914D\u3002" : " additional matches."));
7366
8283
  setStatus(text, state.paging || state.scanBusy);
@@ -7387,7 +8304,8 @@ function startPageIn() {
7387
8304
  state.sourceNotice = "";
7388
8305
  state.historySnapshot = null;
7389
8306
  searchHistory(true);
7390
- state.history = createHistoryReader({ remote: state.remote, sessionId: target.id, generation: token, project: state.projector, onUpdate: function(snapshot) {
8307
+ var project = state.searchContent ? state.searchContent.createProjector(state.projector) : state.projector;
8308
+ state.history = createHistoryReader({ remote: state.remote, sessionId: target.id, generation: token, project, onUpdate: function(snapshot) {
7391
8309
  if (token !== state.pageToken || state.target !== target || !isOpen() || state.scope !== "whole" || !state.adapter.valid(target)) return;
7392
8310
  state.historySnapshot = snapshot;
7393
8311
  state.paging = ["reading", "projecting", "idle"].includes(snapshot.status);
@@ -7506,6 +8424,7 @@ function scanLiveCount() {
7506
8424
  }
7507
8425
  }
7508
8426
  function sourceNode(source, store) {
8427
+ if (!store) return null;
7509
8428
  var found = store.values().filter(function(node) {
7510
8429
  if (source.kind === "user" || source.kind === "context") return node.data?.seq === source.seq;
7511
8430
  if (source.callId) return node.kind === "tool-call" && node.data?.root?.callId === (source.rootCallId || source.callId);
@@ -7569,27 +8488,24 @@ async function navigateHistoryHit(hit) {
7569
8488
  }
7570
8489
  if (!face || typeof face.loadThrough !== "function" || !store) {
7571
8490
  if (current()) recordFailure("jump", "unavailable");
7572
- setStatus(L.matchRevealFailed, false);
8491
+ setStatus(L2.matchRevealFailed, false);
7573
8492
  return;
7574
8493
  }
7575
8494
  state.historyNavigating = true;
7576
8495
  try {
7577
8496
  if (!sourceNode(source, store)) await face.loadThrough(source.seq);
7578
8497
  if (!current()) return;
7579
- var started = Date.now(), mapped, node, turnActivated = false;
8498
+ var started = Date.now(), mapped, node;
7580
8499
  while (current() && Date.now() - started < 5e3) {
8500
+ store = state.adapter.nodes(target);
7581
8501
  node = sourceNode(source, store);
7582
8502
  if (node) {
7583
- if (!turnActivated && hostNavigationReady(target, face)) {
7584
- turnActivated = activateLoadedTurn(target, store, String(source.turn || ""));
7585
- if (turnActivated) {
7586
- await pause();
7587
- if (!current()) return;
7588
- }
8503
+ if (!hostNavigationReady(target, face)) {
8504
+ await pause();
8505
+ continue;
7589
8506
  }
7590
- if (!current()) return;
7591
8507
  var rows = sourceRows(target, node);
7592
- mapped = mapProjectedDocument(source, node, rows);
8508
+ mapped = mapProjectedDocument(source, node, rows, hit.blockIndex);
7593
8509
  if (mapped.blocks) {
7594
8510
  var range = rangeForBlock(mapped.blocks[hit.blockIndex], hit.start, hit.end);
7595
8511
  if (!range || range.toString() !== hit.text) break;
@@ -7607,14 +8523,14 @@ async function navigateHistoryHit(hit) {
7607
8523
  if (current()) {
7608
8524
  recordFailure("jump", "render");
7609
8525
  state.historyNavigating = false;
7610
- state.sourceNotice = L.matchRevealFailed;
8526
+ state.sourceNotice = L2.matchRevealFailed;
7611
8527
  historyStatus();
7612
8528
  }
7613
8529
  } catch (error) {
7614
8530
  if (current()) {
7615
8531
  recordFailure("jump", "error");
7616
8532
  state.historyNavigating = false;
7617
- state.sourceNotice = L.matchRevealFailed;
8533
+ state.sourceNotice = L2.matchRevealFailed;
7618
8534
  historyStatus();
7619
8535
  }
7620
8536
  }
@@ -7714,7 +8630,7 @@ function button(label, d, onClick) {
7714
8630
  }
7715
8631
  function onQueryInput(input) {
7716
8632
  cancelCountEdit(false);
7717
- cancelReturn(L.returnCancelled);
8633
+ cancelReturn(L2.returnCancelled);
7718
8634
  cancelNavigation();
7719
8635
  state.query = input.value;
7720
8636
  if (state.scope === "whole") {
@@ -7729,7 +8645,7 @@ function onQueryInput(input) {
7729
8645
  function setScope(scope) {
7730
8646
  if (state.scope === scope) return;
7731
8647
  cancelCountEdit(false);
7732
- cancelReturn(L.returnCancelled);
8648
+ cancelReturn(L2.returnCancelled);
7733
8649
  cancelNavigation();
7734
8650
  cancelPageIn();
7735
8651
  state.scope = scope;
@@ -7752,8 +8668,8 @@ function buildBar() {
7752
8668
  var input = document.createElement("input");
7753
8669
  input.type = "text";
7754
8670
  input.className = "query";
7755
- input.placeholder = L.placeholder;
7756
- input.setAttribute("aria-label", L.placeholder);
8671
+ input.placeholder = L2.placeholder;
8672
+ input.setAttribute("aria-label", L2.placeholder);
7757
8673
  input.addEventListener("input", function() {
7758
8674
  onQueryInput(input);
7759
8675
  });
@@ -7769,13 +8685,13 @@ function buildBar() {
7769
8685
  contentPanel.className = "content-panel";
7770
8686
  contentPanel.hidden = true;
7771
8687
  contentPanel.setAttribute("role", "group");
7772
- contentPanel.setAttribute("aria-label", L.contentButton);
8688
+ contentPanel.setAttribute("aria-label", L2.contentButton);
7773
8689
  var contentViewport = document.createElement("div");
7774
8690
  contentViewport.className = "content-viewport";
7775
8691
  var scopeGroup = document.createElement("fieldset");
7776
8692
  scopeGroup.className = "scope-group";
7777
8693
  var scopeLegend = document.createElement("legend");
7778
- scopeLegend.textContent = L.scopeLegend;
8694
+ scopeLegend.textContent = L2.scopeLegend;
7779
8695
  scopeGroup.appendChild(scopeLegend);
7780
8696
  var scopeInputs = {};
7781
8697
  ["whole", "page"].forEach(function(scope) {
@@ -7790,7 +8706,7 @@ function buildBar() {
7790
8706
  if (radio.checked) setScope(scope);
7791
8707
  });
7792
8708
  var label = document.createElement("span");
7793
- label.textContent = scope === "whole" ? L.scopeWhole : L.scopePage;
8709
+ label.textContent = scope === "whole" ? L2.scopeWhole : L2.scopePage;
7794
8710
  option.appendChild(radio);
7795
8711
  option.appendChild(label);
7796
8712
  scopeGroup.appendChild(option);
@@ -7799,7 +8715,7 @@ function buildBar() {
7799
8715
  contentViewport.appendChild(scopeGroup);
7800
8716
  var contentGroup = document.createElement("fieldset");
7801
8717
  var legend = document.createElement("legend");
7802
- legend.textContent = L.contentLegend;
8718
+ legend.textContent = L2.contentLegend;
7803
8719
  contentGroup.appendChild(legend);
7804
8720
  var contentOptions = document.createElement("div");
7805
8721
  contentOptions.className = "content-options";
@@ -7817,7 +8733,7 @@ function buildBar() {
7817
8733
  contentSelectionChanged();
7818
8734
  });
7819
8735
  var label = document.createElement("span");
7820
- label.textContent = L.contentTypes[type];
8736
+ label.textContent = L2.contentTypes[type];
7821
8737
  option.appendChild(checkbox);
7822
8738
  option.appendChild(label);
7823
8739
  contentOptions.appendChild(option);
@@ -7828,7 +8744,7 @@ function buildBar() {
7828
8744
  var resetContent = document.createElement("button");
7829
8745
  resetContent.type = "button";
7830
8746
  resetContent.className = "content-reset";
7831
- resetContent.textContent = L.contentReset;
8747
+ resetContent.textContent = L2.contentReset;
7832
8748
  resetContent.addEventListener("click", function() {
7833
8749
  CONTENT_TYPES.forEach(function(type) {
7834
8750
  state.contentTypes[type] = DEFAULT_CONTENT_TYPES[type];
@@ -7855,7 +8771,7 @@ function buildBar() {
7855
8771
  countInput.type = "text";
7856
8772
  countInput.inputMode = "numeric";
7857
8773
  countInput.autocomplete = "off";
7858
- countInput.setAttribute("aria-label", L.jumpNumber);
8774
+ countInput.setAttribute("aria-label", L2.jumpNumber);
7859
8775
  countInput.setAttribute("aria-describedby", BAR_ID + "-count-hint");
7860
8776
  countInput.addEventListener("input", function() {
7861
8777
  countInput.removeAttribute("aria-invalid");
@@ -7895,18 +8811,18 @@ function buildBar() {
7895
8811
  status.setAttribute("role", "status");
7896
8812
  status.setAttribute("aria-live", "polite");
7897
8813
  status.setAttribute("aria-atomic", "true");
7898
- status.title = L.stopTip;
8814
+ status.title = L2.stopTip;
7899
8815
  status.addEventListener("click", function() {
7900
8816
  if (!state.paging && !state.scanBusy) return;
7901
8817
  cancelPageIn();
7902
- setStatus(L.incomplete, false);
8818
+ setStatus(L2.incomplete, false);
7903
8819
  });
7904
8820
  buildPositionControls(controls, bar);
7905
8821
  controls.appendChild(input);
7906
8822
  controls.appendChild(countState);
7907
8823
  controls.appendChild(count);
7908
8824
  controls.appendChild(countEditor);
7909
- var refreshBtn = button(L.refreshHistory, "M20 7v5h-5M4 17v-5h5M6 8a7 7 0 0 1 12-2l2 3M4 15l2 3a7 7 0 0 0 12-2", function() {
8825
+ var refreshBtn = button(L2.refreshHistory, "M20 7v5h-5M4 17v-5h5M6 8a7 7 0 0 1 12-2l2 3M4 15l2 3a7 7 0 0 0 12-2", function() {
7910
8826
  if (state.scope !== "whole") return;
7911
8827
  closeContentPanel(true);
7912
8828
  cancelPageIn();
@@ -7917,25 +8833,35 @@ function buildBar() {
7917
8833
  startPageIn();
7918
8834
  });
7919
8835
  var refreshLabel = document.createElement("span");
7920
- refreshLabel.textContent = L.refreshHistory;
8836
+ refreshLabel.textContent = L2.refreshHistory;
7921
8837
  refreshBtn.appendChild(refreshLabel);
7922
8838
  var historyCommand = document.createElement("div");
7923
8839
  historyCommand.className = "history-command";
7924
8840
  historyCommand.appendChild(refreshBtn);
7925
8841
  contentViewport.appendChild(historyCommand);
8842
+ var searchCommand = document.createElement("div");
8843
+ searchCommand.className = "history-command";
8844
+ var searchConversations = document.createElement("button");
8845
+ searchConversations.type = "button";
8846
+ searchConversations.textContent = ZH ? "\u5BF9\u8BDD\u5168\u6587\u641C\u7D22" : "Full-text conversation search";
8847
+ searchConversations.addEventListener("click", function() {
8848
+ state.conversationSearch?.open(state.query);
8849
+ });
8850
+ searchCommand.appendChild(searchConversations);
8851
+ contentViewport.appendChild(searchCommand);
7926
8852
  state.refreshBtn = refreshBtn;
7927
8853
  var updateCommand = document.createElement("div");
7928
8854
  updateCommand.className = "history-command update-command";
7929
8855
  var currentVersion = document.createElement("p");
7930
8856
  currentVersion.className = "update-version";
7931
- currentVersion.textContent = L.currentVersion + " 0.1.11";
8857
+ currentVersion.textContent = L2.currentVersion + " 0.1.12";
7932
8858
  var updateBtn = document.createElement("button");
7933
8859
  updateBtn.type = "button";
7934
8860
  updateBtn.className = "check-update";
7935
8861
  updateBtn.addEventListener("click", checkForUpdates);
7936
8862
  var updateSource = document.createElement("p");
7937
8863
  updateSource.className = "feedback-privacy";
7938
- updateSource.textContent = L.updateSource;
8864
+ updateSource.textContent = L2.updateSource;
7939
8865
  updateSource.id = BAR_ID + "-update-source";
7940
8866
  updateBtn.setAttribute("aria-describedby", updateSource.id);
7941
8867
  var updateStatus = document.createElement("p");
@@ -7944,7 +8870,7 @@ function buildBar() {
7944
8870
  updateStatus.setAttribute("aria-atomic", "true");
7945
8871
  var updateGuide = document.createElement("a");
7946
8872
  updateGuide.className = "feedback-issue";
7947
- updateGuide.textContent = L.updateGuide;
8873
+ updateGuide.textContent = L2.updateGuide;
7948
8874
  updateGuide.href = "https://github.com/Ryuu-64/dsh-find-all#\u66F4\u65B0";
7949
8875
  updateGuide.target = "_blank";
7950
8876
  updateGuide.rel = "noopener noreferrer";
@@ -7957,23 +8883,23 @@ function buildBar() {
7957
8883
  renderUpdateCheck();
7958
8884
  var diagnosticCommand = document.createElement("div");
7959
8885
  diagnosticCommand.className = "history-command diagnostic-command";
7960
- var diagnosticBtn = button(L.copyDiagnostics, "M9 5H5v16h12v-4M9 3h12v12H9z", copyDiagnostics);
8886
+ var diagnosticBtn = button(L2.copyDiagnostics, "M9 5H5v16h12v-4M9 3h12v12H9z", copyDiagnostics);
7961
8887
  var diagnosticLabel = document.createElement("span");
7962
- diagnosticLabel.textContent = L.copyDiagnostics;
8888
+ diagnosticLabel.textContent = L2.copyDiagnostics;
7963
8889
  diagnosticBtn.appendChild(diagnosticLabel);
7964
8890
  var diagnosticFeedback = document.createElement("span");
7965
8891
  diagnosticFeedback.className = "diagnostic-feedback";
7966
8892
  diagnosticFeedback.setAttribute("role", "status");
7967
8893
  var feedbackIssue = document.createElement("a");
7968
8894
  feedbackIssue.className = "feedback-issue";
7969
- feedbackIssue.textContent = L.feedbackIssue;
8895
+ feedbackIssue.textContent = L2.feedbackIssue;
7970
8896
  feedbackIssue.href = "https://github.com/Ryuu-64/dsh-find-all/issues/new";
7971
8897
  feedbackIssue.target = "_blank";
7972
8898
  feedbackIssue.rel = "noopener noreferrer";
7973
8899
  feedbackIssue.appendChild(icon("M14 3h7v7M21 3l-9 9M10 5H5v14h14v-5", 14));
7974
8900
  var feedbackPrivacy = document.createElement("p");
7975
8901
  feedbackPrivacy.className = "feedback-privacy";
7976
- feedbackPrivacy.textContent = L.feedbackPrivacy;
8902
+ feedbackPrivacy.textContent = L2.feedbackPrivacy;
7977
8903
  feedbackPrivacy.id = BAR_ID + "-feedback-privacy";
7978
8904
  feedbackIssue.setAttribute("aria-describedby", feedbackPrivacy.id);
7979
8905
  diagnosticCommand.append(diagnosticBtn, diagnosticFeedback, feedbackIssue, feedbackPrivacy);
@@ -7982,19 +8908,19 @@ function buildBar() {
7982
8908
  aboutCommand.className = "history-command";
7983
8909
  var aboutBtn = document.createElement("button");
7984
8910
  aboutBtn.type = "button";
7985
- aboutBtn.textContent = L.about;
8911
+ aboutBtn.textContent = L2.about;
7986
8912
  aboutBtn.disabled = !state.aboutAvailable;
7987
- if (!state.aboutAvailable) aboutBtn.title = L.aboutUnavailable;
8913
+ if (!state.aboutAvailable) aboutBtn.title = L2.aboutUnavailable;
7988
8914
  aboutBtn.setAttribute("aria-haspopup", "dialog");
7989
8915
  aboutBtn.addEventListener("click", openAbout);
7990
8916
  aboutCommand.appendChild(aboutBtn);
7991
8917
  contentViewport.appendChild(aboutCommand);
7992
8918
  state.diagnosticBtn = diagnosticBtn;
7993
8919
  state.diagnosticFeedback = diagnosticFeedback;
7994
- navigation.appendChild(button(L.prev, "m18 15-6-6-6 6", function() {
8920
+ navigation.appendChild(button(L2.prev, "m18 15-6-6-6 6", function() {
7995
8921
  goTo(-1);
7996
8922
  }));
7997
- navigation.appendChild(button(L.next, "m6 9 6 6 6-6", function() {
8923
+ navigation.appendChild(button(L2.next, "m6 9 6 6 6-6", function() {
7998
8924
  goTo(1);
7999
8925
  }));
8000
8926
  var returnBtn = document.createElement("button");
@@ -8009,7 +8935,7 @@ function buildBar() {
8009
8935
  state.returnBtn = returnBtn;
8010
8936
  navigation.appendChild(returnBtn);
8011
8937
  navigation.appendChild(contentBtn);
8012
- var closeBtn = button(L.close, "M18 6 6 18M6 6l12 12", close);
8938
+ var closeBtn = button(L2.close, "M18 6 6 18M6 6l12 12", close);
8013
8939
  navigation.appendChild(closeBtn);
8014
8940
  contentPanel.addEventListener("keydown", function(event) {
8015
8941
  if (event.key !== "Tab") return;
@@ -8027,6 +8953,20 @@ function buildBar() {
8027
8953
  bar.appendChild(countHint);
8028
8954
  bar.appendChild(status);
8029
8955
  bar.appendChild(countLive);
8956
+ var searchReturn = document.createElement("button");
8957
+ searchReturn.type = "button";
8958
+ searchReturn.hidden = true;
8959
+ searchReturn.textContent = ZH ? "\u8FD4\u56DE\u641C\u7D22\u7ED3\u679C" : "Back to search results";
8960
+ searchReturn.style.cssText = "align-self:flex-start;background:transparent;color:inherit;border:0;text-decoration:underline;cursor:pointer;font-size:12px";
8961
+ searchReturn.addEventListener("click", function() {
8962
+ state.conversationSearch?.open();
8963
+ });
8964
+ var searchHint = document.createElement("span");
8965
+ searchHint.hidden = true;
8966
+ searchHint.style.cssText = "font-size:12px;white-space:normal;max-width:420px";
8967
+ state.crossSearchReturn = searchReturn;
8968
+ state.crossSearchHint = searchHint;
8969
+ bar.append(searchHint, searchReturn);
8030
8970
  state.bar = bar;
8031
8971
  state.input = input;
8032
8972
  state.count = count;
@@ -8047,7 +8987,7 @@ function buildBar() {
8047
8987
  state.announcement = announcement;
8048
8988
  document.body.appendChild(announcement);
8049
8989
  }
8050
- function open(target) {
8990
+ function open(target, seed) {
8051
8991
  if (typeof document === "undefined" || document.body === null) return;
8052
8992
  var wasOpen = isOpen();
8053
8993
  syncTarget(target || document.activeElement, false);
@@ -8062,7 +9002,8 @@ function open(target) {
8062
9002
  selection = String(window.getSelection()).trim();
8063
9003
  } catch (error) {
8064
9004
  }
8065
- if (state.target && selection && selection.length <= 200 && selection !== state.query) {
9005
+ if (typeof seed === "string") state.query = seed;
9006
+ if (typeof seed !== "string" && state.target && selection && selection.length <= 200 && selection !== state.query) {
8066
9007
  state.query = selection;
8067
9008
  }
8068
9009
  state.input.value = state.query;
@@ -8070,13 +9011,15 @@ function open(target) {
8070
9011
  state.input.select();
8071
9012
  runSearch(false);
8072
9013
  if (!state.query && state.target && state.adapter && state.adapter.valid(state.target) && !state.origin) {
8073
- setStatus(L.originUnavailable, false);
9014
+ setStatus(L2.originUnavailable, false);
8074
9015
  }
8075
9016
  startObserver();
8076
9017
  watchSession();
8077
9018
  if (state.scope === "whole" && state.query) schedulePageIn();
8078
9019
  }
8079
9020
  function close() {
9021
+ state.conversationSearch?.cancelHandoff();
9022
+ state.crossSearch = null;
8080
9023
  cancelUpdateCheck();
8081
9024
  closeAbout();
8082
9025
  cancelCountEdit(false);
@@ -8114,6 +9057,8 @@ function apply(ctx) {
8114
9057
  state.aboutAvailable = !!ui.Modal;
8115
9058
  var SearchIcon = ui.IconSearchOutlineRegular || ui.IconSearchOutline16;
8116
9059
  state.ctx = ctx;
9060
+ state.searchContent = createSearchContentService(searchContentChanged);
9061
+ if (typeof ctx.provide === "function") ctx.provide(SEARCH_CONTENT_SERVICE, state.searchContent);
8117
9062
  state.writeClipboard = typeof ui.writeClipboard === "function" ? ui.writeClipboard : null;
8118
9063
  if (typeof ctx.inject === "function") ctx.inject(["remote", "remote.session"], function(remoteCtx) {
8119
9064
  remoteCtx.effect(function() {
@@ -8134,7 +9079,7 @@ function apply(ctx) {
8134
9079
  state.ranges = [];
8135
9080
  state.index = -1;
8136
9081
  paint();
8137
- if (isOpen()) setStatus(L.noService, false);
9082
+ if (isOpen()) setStatus(L2.noService, false);
8138
9083
  }
8139
9084
  };
8140
9085
  });
@@ -8147,6 +9092,17 @@ function apply(ctx) {
8147
9092
  state.adapter = createHostAdapter(ctx, function() {
8148
9093
  if (isOpen()) syncTarget(null, true);
8149
9094
  });
9095
+ if (typeof ctx.inject === "function") state.conversationSearch = installConversationSearch(ctx, react, ui, {
9096
+ closeFind: close,
9097
+ openFind: function(sessionId, query) {
9098
+ if (!state.mounted || !state.adapter) return false;
9099
+ var target = state.adapter.forSession(sessionId);
9100
+ if (!target || !state.adapter.valid(target)) return false;
9101
+ state.crossSearch = { id: sessionId, query };
9102
+ open(target.anchor, query);
9103
+ return state.target?.id === sessionId;
9104
+ }
9105
+ });
8150
9106
  function AboutPanel() {
8151
9107
  var copy = react.useState(""), copyStatus = copy[0], setCopyStatus = copy[1];
8152
9108
  var details = react.useRef(null);
@@ -8219,39 +9175,39 @@ function apply(ctx) {
8219
9175
  open: true,
8220
9176
  onClose: requestClose,
8221
9177
  title: "dsh-find-all",
8222
- closeLabel: L.aboutClose,
8223
- description: L.aboutDescription,
9178
+ closeLabel: L2.aboutClose,
9179
+ description: L2.aboutDescription,
8224
9180
  className: "dsh-find-all-about",
8225
9181
  contentClassName: "dsh-find-all-about-content"
8226
9182
  }, react.createElement(
8227
9183
  "div",
8228
9184
  { ref: details, className: "dsh-find-all-about-details" },
8229
- react.createElement("p", null, L.aboutAuthor + ": ", link("Ryuu-64", "https://github.com/Ryuu-64")),
9185
+ react.createElement("p", null, L2.aboutAuthor + ": ", link("Ryuu-64", "https://github.com/Ryuu-64")),
8230
9186
  react.createElement(
8231
9187
  "section",
8232
9188
  null,
8233
- react.createElement("h3", null, L.aboutSupport),
8234
- react.createElement("div", { className: "dsh-find-all-about-links" }, link(L.feedbackIssue, repository + "/issues/new"), link(L.aboutRepository, repository)),
8235
- react.createElement("p", { className: "dsh-find-all-about-status" }, L.feedbackPrivacy),
9189
+ react.createElement("h3", null, L2.aboutSupport),
9190
+ react.createElement("div", { className: "dsh-find-all-about-links" }, link(L2.feedbackIssue, repository + "/issues/new"), link(L2.aboutRepository, repository)),
9191
+ react.createElement("p", { className: "dsh-find-all-about-status" }, L2.feedbackPrivacy),
8236
9192
  react.createElement(
8237
9193
  "div",
8238
9194
  { className: "dsh-find-all-about-group" },
8239
- react.createElement("span", null, L.aboutGroup + ": 1129212995"),
8240
- react.createElement(ui.Button, { type: "button", size: "sm", variant: "ghost", disabled: copyStatus === "pending", onClick: copyGroup }, L.aboutCopy)
9195
+ react.createElement("span", null, L2.aboutGroup + ": 1129212995"),
9196
+ react.createElement(ui.Button, { type: "button", size: "sm", variant: "ghost", disabled: copyStatus === "pending", onClick: copyGroup }, L2.aboutCopy)
8241
9197
  ),
8242
- react.createElement("p", { role: "status", className: "dsh-find-all-about-status" }, copyStatus === "pending" ? L.aboutCopying : copyStatus === "copied" ? L.aboutCopied : copyStatus === "failed" ? L.aboutCopyFailed : "")
9198
+ react.createElement("p", { role: "status", className: "dsh-find-all-about-status" }, copyStatus === "pending" ? L2.aboutCopying : copyStatus === "copied" ? L2.aboutCopied : copyStatus === "failed" ? L2.aboutCopyFailed : "")
8243
9199
  ),
8244
9200
  react.createElement(
8245
9201
  "section",
8246
9202
  null,
8247
- react.createElement("h3", null, L.aboutCredits),
8248
- react.createElement("p", null, L.aboutUpstream),
9203
+ react.createElement("h3", null, L2.aboutCredits),
9204
+ react.createElement("p", null, L2.aboutUpstream),
8249
9205
  react.createElement(
8250
9206
  "div",
8251
9207
  { className: "dsh-find-all-about-links" },
8252
9208
  link("secyborg/dsh-find-bar", "https://github.com/secyborg/dsh-find-bar"),
8253
9209
  link("MIT", repository + "/blob/main/LICENSE"),
8254
- link(L.aboutNotices, repository + "/blob/main/NOTICE.md")
9210
+ link(L2.aboutNotices, repository + "/blob/main/NOTICE.md")
8255
9211
  )
8256
9212
  )
8257
9213
  ));
@@ -8284,8 +9240,8 @@ function apply(ctx) {
8284
9240
  type: "button",
8285
9241
  size: "sm",
8286
9242
  variant: "ghost",
8287
- title: L.find,
8288
- "aria-label": L.find,
9243
+ title: L2.find,
9244
+ "aria-label": L2.find,
8289
9245
  style: { flex: "none", width: 28, padding: 0, color: "var(--dsw-alias-label-secondary)" },
8290
9246
  "data-find-all-session": props.sessionId,
8291
9247
  onClick: function(event) {
@@ -8310,7 +9266,7 @@ function apply(ctx) {
8310
9266
  goTo,
8311
9267
  isOpen,
8312
9268
  ownsKeys: function(event) {
8313
- if (state.aboutOwner) return false;
9269
+ if (state.aboutOwner || state.conversationSearch?.isOpen()) return false;
8314
9270
  var path = typeof event.composedPath === "function" ? event.composedPath() : [event.target];
8315
9271
  return !path.some(function(node) {
8316
9272
  return node && node.closest && node.closest('dialog[open], [aria-modal="true"], .monaco-editor, .cm-editor, .CodeMirror');
@@ -8321,7 +9277,7 @@ function apply(ctx) {
8321
9277
  }
8322
9278
  });
8323
9279
  function focus(event) {
8324
- if (state.aboutOwner) return;
9280
+ if (state.aboutOwner || state.conversationSearch?.isOpen()) return;
8325
9281
  if (state.countEdit && !state.countEditor.contains(event.target)) cancelCountEdit(false);
8326
9282
  var inContent = state.contentPanel && state.contentPanel.contains(event.target);
8327
9283
  if (!inContent && !state.contentBtn?.contains(event.target)) closeContentPanel();
@@ -8336,7 +9292,7 @@ function apply(ctx) {
8336
9292
  if (!viewport || !viewport.scroll.contains(event.target)) return;
8337
9293
  if (event.type === "keydown" && !/^(ArrowUp|ArrowDown|PageUp|PageDown|Home|End| )$/.test(event.key)) return;
8338
9294
  if (event.target.closest('input, textarea, [contenteditable="true"]')) return;
8339
- cancelReturn(L.returnCancelled);
9295
+ cancelReturn(L2.returnCancelled);
8340
9296
  cancelNavigation();
8341
9297
  }
8342
9298
  ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function(type) {
@@ -8380,8 +9336,9 @@ function apply(ctx) {
8380
9336
  if (style) style.remove();
8381
9337
  state.countState = state.countEditor = state.countInput = state.countTotal = state.countHint = state.countLive = null;
8382
9338
  state.bar = state.input = state.count = state.status = state.scopeInputs = state.contentBtn = state.contentPanel = state.contentInputs = null;
9339
+ state.conversationSearch = state.crossSearch = state.crossSearchReturn = state.crossSearchHint = null;
8383
9340
  state.adapter.clear();
8384
- state.target = state.ctx = state.remote = state.history = state.historySnapshot = state.projector = null;
9341
+ state.target = state.ctx = state.remote = state.history = state.historySnapshot = state.projector = state.searchContent = null;
8385
9342
  };
8386
9343
  }, "find-all: browser lifecycle");
8387
9344
  }