@wanji_dsh/dsh-sales 0.11.4 → 0.11.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.js CHANGED
@@ -158,7 +158,7 @@ var import_react3 = __toESM(require("react"), 1);
158
158
  // src/reply-content.tsx
159
159
  var import_react2 = __toESM(require("react"), 1);
160
160
 
161
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-to-string/lib/index.js
161
+ // ../../node_modules/mdast-util-to-string/lib/index.js
162
162
  var emptyOptions = {};
163
163
  function toString(value, options) {
164
164
  const settings = options || emptyOptions;
@@ -195,7 +195,7 @@ function node(value) {
195
195
  return Boolean(value && typeof value === "object");
196
196
  }
197
197
 
198
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/decode-named-character-reference/index.dom.js
198
+ // ../../node_modules/decode-named-character-reference/index.dom.js
199
199
  var element = document.createElement("i");
200
200
  function decodeNamedCharacterReference(value) {
201
201
  const characterReference2 = "&" + value + ";";
@@ -207,7 +207,7 @@ function decodeNamedCharacterReference(value) {
207
207
  return character === characterReference2 ? false : character;
208
208
  }
209
209
 
210
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-chunked/index.js
210
+ // ../../node_modules/micromark-util-chunked/index.js
211
211
  function splice(list2, start, remove, items) {
212
212
  const end = list2.length;
213
213
  let chunkStart = 0;
@@ -241,7 +241,7 @@ function push(list2, items) {
241
241
  return items;
242
242
  }
243
243
 
244
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-combine-extensions/index.js
244
+ // ../../node_modules/micromark-util-combine-extensions/index.js
245
245
  var hasOwnProperty = {}.hasOwnProperty;
246
246
  function combineExtensions(extensions) {
247
247
  const all2 = {};
@@ -281,7 +281,7 @@ function constructs(existing, list2) {
281
281
  splice(existing, 0, 0, before);
282
282
  }
283
283
 
284
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-decode-numeric-character-reference/index.js
284
+ // ../../node_modules/micromark-util-decode-numeric-character-reference/index.js
285
285
  function decodeNumericCharacterReference(value, base) {
286
286
  const code2 = Number.parseInt(value, base);
287
287
  if (
@@ -299,12 +299,12 @@ function decodeNumericCharacterReference(value, base) {
299
299
  return String.fromCodePoint(code2);
300
300
  }
301
301
 
302
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-normalize-identifier/index.js
302
+ // ../../node_modules/micromark-util-normalize-identifier/index.js
303
303
  function normalizeIdentifier(value) {
304
304
  return value.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
305
305
  }
306
306
 
307
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-character/index.js
307
+ // ../../node_modules/micromark-util-character/index.js
308
308
  var asciiAlpha = regexCheck(/[A-Za-z]/);
309
309
  var asciiAlphanumeric = regexCheck(/[\dA-Za-z]/);
310
310
  var asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/);
@@ -336,7 +336,7 @@ function regexCheck(regex) {
336
336
  }
337
337
  }
338
338
 
339
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-factory-space/index.js
339
+ // ../../node_modules/micromark-factory-space/index.js
340
340
  function factorySpace(effects, ok3, type, max) {
341
341
  const limit = max ? max - 1 : Infinity;
342
342
  let size = 0;
@@ -381,7 +381,7 @@ function factorySpaceMinMax(effects, ok3, nok, type, min, max) {
381
381
  }
382
382
  }
383
383
 
384
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/initialize/content.js
384
+ // ../../node_modules/micromark/lib/initialize/content.js
385
385
  var content = {
386
386
  tokenize: initializeContent
387
387
  };
@@ -431,7 +431,7 @@ function initializeContent(effects) {
431
431
  }
432
432
  }
433
433
 
434
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-edit-map/index.js
434
+ // ../../node_modules/micromark-util-edit-map/index.js
435
435
  var EditMap = class {
436
436
  /**
437
437
  * Create a new edit map.
@@ -529,7 +529,7 @@ function addImplementation(editMap, at, remove, add, before) {
529
529
  editMap.index.set(at, change);
530
530
  }
531
531
 
532
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/initialize/document.js
532
+ // ../../node_modules/micromark/lib/initialize/document.js
533
533
  var document2 = {
534
534
  tokenize: initializeDocument
535
535
  };
@@ -723,7 +723,7 @@ function tokenizeContainer(effects, ok3, nok) {
723
723
  return factorySpace(effects, effects.attempt(this.parser.constructs.document, ok3, nok), "linePrefix", this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4);
724
724
  }
725
725
 
726
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-classify-character/index.js
726
+ // ../../node_modules/micromark-util-classify-character/index.js
727
727
  function classifyCharacter(code2) {
728
728
  if (code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) {
729
729
  return 1;
@@ -733,7 +733,7 @@ function classifyCharacter(code2) {
733
733
  }
734
734
  }
735
735
 
736
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-resolve-all/index.js
736
+ // ../../node_modules/micromark-util-resolve-all/index.js
737
737
  function resolveAll(constructs2, events, context) {
738
738
  const called = [];
739
739
  let index2 = -1;
@@ -747,7 +747,7 @@ function resolveAll(constructs2, events, context) {
747
747
  return events;
748
748
  }
749
749
 
750
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/attention.js
750
+ // ../../node_modules/micromark-core-commonmark/lib/attention.js
751
751
  var attention = {
752
752
  name: "attention",
753
753
  resolveAll: resolveAllAttention,
@@ -870,7 +870,7 @@ function movePoint(point3, offset) {
870
870
  point3._bufferIndex += offset;
871
871
  }
872
872
 
873
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/autolink.js
873
+ // ../../node_modules/micromark-core-commonmark/lib/autolink.js
874
874
  var autolink = {
875
875
  name: "autolink",
876
876
  tokenize: tokenizeAutolink
@@ -971,7 +971,7 @@ function tokenizeAutolink(effects, ok3, nok) {
971
971
  }
972
972
  }
973
973
 
974
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/blank-line.js
974
+ // ../../node_modules/micromark-core-commonmark/lib/blank-line.js
975
975
  var blankLine = {
976
976
  partial: true,
977
977
  tokenize: tokenizeBlankLine
@@ -986,7 +986,7 @@ function tokenizeBlankLine(effects, ok3, nok) {
986
986
  }
987
987
  }
988
988
 
989
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/block-quote.js
989
+ // ../../node_modules/micromark-core-commonmark/lib/block-quote.js
990
990
  var blockQuote = {
991
991
  continuation: {
992
992
  tokenize: tokenizeBlockQuoteContinuation
@@ -1044,7 +1044,7 @@ function exit(effects) {
1044
1044
  effects.exit("blockQuote");
1045
1045
  }
1046
1046
 
1047
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/character-escape.js
1047
+ // ../../node_modules/micromark-core-commonmark/lib/character-escape.js
1048
1048
  var characterEscape = {
1049
1049
  name: "characterEscape",
1050
1050
  tokenize: tokenizeCharacterEscape
@@ -1070,7 +1070,7 @@ function tokenizeCharacterEscape(effects, ok3, nok) {
1070
1070
  }
1071
1071
  }
1072
1072
 
1073
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/character-reference.js
1073
+ // ../../node_modules/micromark-core-commonmark/lib/character-reference.js
1074
1074
  var characterReference = {
1075
1075
  name: "characterReference",
1076
1076
  tokenize: tokenizeCharacterReference
@@ -1135,7 +1135,7 @@ function tokenizeCharacterReference(effects, ok3, nok) {
1135
1135
  }
1136
1136
  }
1137
1137
 
1138
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.js
1138
+ // ../../node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.js
1139
1139
  var nonLazyContinuation = {
1140
1140
  partial: true,
1141
1141
  tokenize: tokenizeNonLazyContinuation
@@ -1157,7 +1157,7 @@ function tokenizeNonLazyContinuation(effects, ok3, nok) {
1157
1157
  }
1158
1158
  }
1159
1159
 
1160
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/code-fenced.js
1160
+ // ../../node_modules/micromark-core-commonmark/lib/code-fenced.js
1161
1161
  var codeFenced = {
1162
1162
  concrete: true,
1163
1163
  name: "codeFenced",
@@ -1320,7 +1320,7 @@ function tokenizeCodeFenced(effects, ok3, nok) {
1320
1320
  }
1321
1321
  }
1322
1322
 
1323
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/code-indented.js
1323
+ // ../../node_modules/micromark-core-commonmark/lib/code-indented.js
1324
1324
  var codeIndented = {
1325
1325
  name: "codeIndented",
1326
1326
  tokenize: tokenizeCodeIndented
@@ -1378,7 +1378,7 @@ function tokenizeFurtherStart(effects, ok3, nok) {
1378
1378
  }
1379
1379
  }
1380
1380
 
1381
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/code-text.js
1381
+ // ../../node_modules/micromark-core-commonmark/lib/code-text.js
1382
1382
  var codeText = {
1383
1383
  name: "codeText",
1384
1384
  previous,
@@ -1493,7 +1493,7 @@ function tokenizeCodeText(effects, ok3, nok) {
1493
1493
  }
1494
1494
  }
1495
1495
 
1496
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-subtokenize/lib/splice-buffer.js
1496
+ // ../../node_modules/micromark-util-subtokenize/lib/splice-buffer.js
1497
1497
  var SpliceBuffer = class {
1498
1498
  /**
1499
1499
  * @param {ReadonlyArray<T> | null | undefined} [initial]
@@ -1686,7 +1686,7 @@ function chunkedPush(list2, right) {
1686
1686
  }
1687
1687
  }
1688
1688
 
1689
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-subtokenize/index.js
1689
+ // ../../node_modules/micromark-util-subtokenize/index.js
1690
1690
  function subtokenize(eventsArray) {
1691
1691
  const jumps = {};
1692
1692
  let index2 = -1;
@@ -1839,7 +1839,7 @@ function subcontent(events, eventIndex) {
1839
1839
  return gaps;
1840
1840
  }
1841
1841
 
1842
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/content.js
1842
+ // ../../node_modules/micromark-core-commonmark/lib/content.js
1843
1843
  var content2 = {
1844
1844
  resolve: resolveContent,
1845
1845
  tokenize: tokenizeContent
@@ -1910,7 +1910,7 @@ function tokenizeContinuation(effects, ok3, nok) {
1910
1910
  }
1911
1911
  }
1912
1912
 
1913
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-factory-destination/index.js
1913
+ // ../../node_modules/micromark-factory-destination/index.js
1914
1914
  function factoryDestination(effects, ok3, nok, type, literalType, literalMarkerType, rawType, stringType, max) {
1915
1915
  const limit = max || Number.POSITIVE_INFINITY;
1916
1916
  let balance = 0;
@@ -2002,7 +2002,7 @@ function factoryDestination(effects, ok3, nok, type, literalType, literalMarkerT
2002
2002
  }
2003
2003
  }
2004
2004
 
2005
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-factory-label/index.js
2005
+ // ../../node_modules/micromark-factory-label/index.js
2006
2006
  function factoryLabel(effects, ok3, nok, type, markerType, stringType) {
2007
2007
  const self = this;
2008
2008
  let size = 0;
@@ -2063,7 +2063,7 @@ function factoryLabel(effects, ok3, nok, type, markerType, stringType) {
2063
2063
  }
2064
2064
  }
2065
2065
 
2066
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-factory-title/index.js
2066
+ // ../../node_modules/micromark-factory-title/index.js
2067
2067
  function factoryTitle(effects, ok3, nok, type, markerType, stringType) {
2068
2068
  let marker;
2069
2069
  return start;
@@ -2125,7 +2125,7 @@ function factoryTitle(effects, ok3, nok, type, markerType, stringType) {
2125
2125
  }
2126
2126
  }
2127
2127
 
2128
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-factory-whitespace/index.js
2128
+ // ../../node_modules/micromark-factory-whitespace/index.js
2129
2129
  function factoryWhitespace(effects, ok3) {
2130
2130
  let seen;
2131
2131
  return start;
@@ -2144,7 +2144,7 @@ function factoryWhitespace(effects, ok3) {
2144
2144
  }
2145
2145
  }
2146
2146
 
2147
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/definition.js
2147
+ // ../../node_modules/micromark-core-commonmark/lib/definition.js
2148
2148
  var definition = {
2149
2149
  name: "definition",
2150
2150
  tokenize: tokenizeDefinition
@@ -2230,7 +2230,7 @@ function tokenizeTitleBefore(effects, ok3, nok) {
2230
2230
  }
2231
2231
  }
2232
2232
 
2233
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/hard-break-escape.js
2233
+ // ../../node_modules/micromark-core-commonmark/lib/hard-break-escape.js
2234
2234
  var hardBreakEscape = {
2235
2235
  name: "hardBreakEscape",
2236
2236
  tokenize: tokenizeHardBreakEscape
@@ -2251,7 +2251,7 @@ function tokenizeHardBreakEscape(effects, ok3, nok) {
2251
2251
  }
2252
2252
  }
2253
2253
 
2254
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/heading-atx.js
2254
+ // ../../node_modules/micromark-core-commonmark/lib/heading-atx.js
2255
2255
  var headingAtx = {
2256
2256
  name: "headingAtx",
2257
2257
  resolve: resolveHeadingAtx,
@@ -2340,7 +2340,7 @@ function tokenizeHeadingAtx(effects, ok3, nok) {
2340
2340
  }
2341
2341
  }
2342
2342
 
2343
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-html-tag-name/index.js
2343
+ // ../../node_modules/micromark-util-html-tag-name/index.js
2344
2344
  var htmlBlockNames = [
2345
2345
  "address",
2346
2346
  "article",
@@ -2407,7 +2407,7 @@ var htmlBlockNames = [
2407
2407
  ];
2408
2408
  var htmlRawNames = ["pre", "script", "style", "textarea"];
2409
2409
 
2410
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/html-flow.js
2410
+ // ../../node_modules/micromark-core-commonmark/lib/html-flow.js
2411
2411
  var htmlFlow = {
2412
2412
  concrete: true,
2413
2413
  name: "htmlFlow",
@@ -2766,7 +2766,7 @@ function tokenizeBlankLineBefore(effects, ok3, nok) {
2766
2766
  }
2767
2767
  }
2768
2768
 
2769
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/html-text.js
2769
+ // ../../node_modules/micromark-core-commonmark/lib/html-text.js
2770
2770
  var htmlText = {
2771
2771
  name: "htmlText",
2772
2772
  tokenize: tokenizeHtmlText
@@ -3072,7 +3072,7 @@ function tokenizeHtmlText(effects, ok3, nok) {
3072
3072
  }
3073
3073
  }
3074
3074
 
3075
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/label-end.js
3075
+ // ../../node_modules/micromark-core-commonmark/lib/label-end.js
3076
3076
  var labelEnd = {
3077
3077
  name: "labelEnd",
3078
3078
  resolveAll: resolveAllLabelEnd,
@@ -3298,7 +3298,7 @@ function tokenizeReferenceCollapsed(effects, ok3, nok) {
3298
3298
  }
3299
3299
  }
3300
3300
 
3301
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/label-start-image.js
3301
+ // ../../node_modules/micromark-core-commonmark/lib/label-start-image.js
3302
3302
  var labelStartImage = {
3303
3303
  name: "labelStartImage",
3304
3304
  resolveAll: labelEnd.resolveAll,
@@ -3335,7 +3335,7 @@ function tokenizeLabelStartImage(effects, ok3, nok) {
3335
3335
  }
3336
3336
  }
3337
3337
 
3338
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/label-start-link.js
3338
+ // ../../node_modules/micromark-core-commonmark/lib/label-start-link.js
3339
3339
  var labelStartLink = {
3340
3340
  name: "labelStartLink",
3341
3341
  resolveAll: labelEnd.resolveAll,
@@ -3363,7 +3363,7 @@ function tokenizeLabelStartLink(effects, ok3, nok) {
3363
3363
  }
3364
3364
  }
3365
3365
 
3366
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/line-ending.js
3366
+ // ../../node_modules/micromark-core-commonmark/lib/line-ending.js
3367
3367
  var lineEnding = {
3368
3368
  name: "lineEnding",
3369
3369
  tokenize: tokenizeLineEnding
@@ -3378,7 +3378,7 @@ function tokenizeLineEnding(effects, ok3) {
3378
3378
  }
3379
3379
  }
3380
3380
 
3381
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/thematic-break.js
3381
+ // ../../node_modules/micromark-core-commonmark/lib/thematic-break.js
3382
3382
  var thematicBreak = {
3383
3383
  name: "thematicBreak",
3384
3384
  tokenize: tokenizeThematicBreak
@@ -3417,7 +3417,7 @@ function tokenizeThematicBreak(effects, ok3, nok) {
3417
3417
  }
3418
3418
  }
3419
3419
 
3420
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/list.js
3420
+ // ../../node_modules/micromark-core-commonmark/lib/list.js
3421
3421
  var list = {
3422
3422
  continuation: {
3423
3423
  tokenize: tokenizeListContinuation
@@ -3547,7 +3547,7 @@ function tokenizeListItemPrefixWhitespace(effects, ok3, nok) {
3547
3547
  }
3548
3548
  }
3549
3549
 
3550
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/setext-underline.js
3550
+ // ../../node_modules/micromark-core-commonmark/lib/setext-underline.js
3551
3551
  var setextUnderline = {
3552
3552
  name: "setextUnderline",
3553
3553
  resolveTo: resolveToSetextUnderline,
@@ -3641,7 +3641,7 @@ function tokenizeSetextUnderline(effects, ok3, nok) {
3641
3641
  }
3642
3642
  }
3643
3643
 
3644
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/initialize/flow.js
3644
+ // ../../node_modules/micromark/lib/initialize/flow.js
3645
3645
  var flow = {
3646
3646
  tokenize: initializeFlow
3647
3647
  };
@@ -3679,7 +3679,7 @@ function initializeFlow(effects) {
3679
3679
  }
3680
3680
  }
3681
3681
 
3682
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/initialize/text.js
3682
+ // ../../node_modules/micromark/lib/initialize/text.js
3683
3683
  var resolver = {
3684
3684
  resolveAll: createResolver()
3685
3685
  };
@@ -3821,7 +3821,7 @@ function resolveAllLineSuffixes(events, context) {
3821
3821
  return events;
3822
3822
  }
3823
3823
 
3824
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/constructs.js
3824
+ // ../../node_modules/micromark/lib/constructs.js
3825
3825
  var constructs_exports = {};
3826
3826
  __export(constructs_exports, {
3827
3827
  attentionMarkers: () => attentionMarkers,
@@ -3896,7 +3896,7 @@ var disable = {
3896
3896
  null: []
3897
3897
  };
3898
3898
 
3899
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/create-tokenizer.js
3899
+ // ../../node_modules/micromark/lib/create-tokenizer.js
3900
3900
  function createTokenizer(parser, initialize, from) {
3901
3901
  let point3 = {
3902
3902
  _bufferIndex: -1,
@@ -4222,7 +4222,7 @@ function serializeChunks(chunks, expandTabs) {
4222
4222
  return result.join("");
4223
4223
  }
4224
4224
 
4225
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/parse.js
4225
+ // ../../node_modules/micromark/lib/parse.js
4226
4226
  function parse(options) {
4227
4227
  const settings = options || {};
4228
4228
  const constructs2 = (
@@ -4248,14 +4248,14 @@ function parse(options) {
4248
4248
  }
4249
4249
  }
4250
4250
 
4251
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/postprocess.js
4251
+ // ../../node_modules/micromark/lib/postprocess.js
4252
4252
  function postprocess(events) {
4253
4253
  while (!subtokenize(events)) {
4254
4254
  }
4255
4255
  return events;
4256
4256
  }
4257
4257
 
4258
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/preprocess.js
4258
+ // ../../node_modules/micromark/lib/preprocess.js
4259
4259
  var search = /[\0\t\n\r]/g;
4260
4260
  function preprocess() {
4261
4261
  let column = 1;
@@ -4335,7 +4335,7 @@ function preprocess() {
4335
4335
  }
4336
4336
  }
4337
4337
 
4338
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-decode-string/index.js
4338
+ // ../../node_modules/micromark-util-decode-string/index.js
4339
4339
  var characterEscapeOrReference = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
4340
4340
  function decodeString(value) {
4341
4341
  return value.replace(characterEscapeOrReference, decode);
@@ -4353,7 +4353,7 @@ function decode($0, $1, $2) {
4353
4353
  return decodeNamedCharacterReference($2) || $0;
4354
4354
  }
4355
4355
 
4356
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/unist-util-stringify-position/lib/index.js
4356
+ // ../../node_modules/unist-util-stringify-position/lib/index.js
4357
4357
  function stringifyPosition(value) {
4358
4358
  if (!value || typeof value !== "object") {
4359
4359
  return "";
@@ -4379,7 +4379,7 @@ function index(value) {
4379
4379
  return value && typeof value === "number" ? value : 1;
4380
4380
  }
4381
4381
 
4382
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-from-markdown/lib/index.js
4382
+ // ../../node_modules/mdast-util-from-markdown/lib/index.js
4383
4383
  var own = {}.hasOwnProperty;
4384
4384
  function fromMarkdown(value, encoding, options) {
4385
4385
  if (encoding && typeof encoding === "object") {
@@ -5088,7 +5088,7 @@ function defaultOnError(left, right) {
5088
5088
  }
5089
5089
  }
5090
5090
 
5091
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/ccount/index.js
5091
+ // ../../node_modules/ccount/index.js
5092
5092
  function ccount(value, character) {
5093
5093
  const source = String(value);
5094
5094
  if (typeof character !== "string") {
@@ -5103,11 +5103,11 @@ function ccount(value, character) {
5103
5103
  return count;
5104
5104
  }
5105
5105
 
5106
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/devlop/lib/default.js
5106
+ // ../../node_modules/devlop/lib/default.js
5107
5107
  function ok() {
5108
5108
  }
5109
5109
 
5110
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/escape-string-regexp/index.js
5110
+ // ../../node_modules/escape-string-regexp/index.js
5111
5111
  function escapeStringRegexp(string5) {
5112
5112
  if (typeof string5 !== "string") {
5113
5113
  throw new TypeError("Expected a string");
@@ -5115,7 +5115,7 @@ function escapeStringRegexp(string5) {
5115
5115
  return string5.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
5116
5116
  }
5117
5117
 
5118
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/unist-util-is/lib/index.js
5118
+ // ../../node_modules/unist-util-is/lib/index.js
5119
5119
  var convert = (
5120
5120
  // Note: overloads in JSDoc can’t yet use different `@template`s.
5121
5121
  /**
@@ -5214,12 +5214,12 @@ function looksLikeANode(value) {
5214
5214
  return value !== null && typeof value === "object" && "type" in value;
5215
5215
  }
5216
5216
 
5217
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/unist-util-visit-parents/lib/color.js
5217
+ // ../../node_modules/unist-util-visit-parents/lib/color.js
5218
5218
  function color(d) {
5219
5219
  return d;
5220
5220
  }
5221
5221
 
5222
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/unist-util-visit-parents/lib/index.js
5222
+ // ../../node_modules/unist-util-visit-parents/lib/index.js
5223
5223
  var empty = [];
5224
5224
  var CONTINUE = true;
5225
5225
  var EXIT = false;
@@ -5339,7 +5339,7 @@ function toResult(value) {
5339
5339
  return value === null || value === void 0 ? empty : [value];
5340
5340
  }
5341
5341
 
5342
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-find-and-replace/lib/index.js
5342
+ // ../../node_modules/mdast-util-find-and-replace/lib/index.js
5343
5343
  function findAndReplace(tree, list2, options) {
5344
5344
  const settings = options || {};
5345
5345
  const ignored = convert(settings.ignore || []);
@@ -5440,7 +5440,7 @@ function toFunction(replace2) {
5440
5440
  };
5441
5441
  }
5442
5442
 
5443
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-gfm-autolink-literal/lib/index.js
5443
+ // ../../node_modules/mdast-util-gfm-autolink-literal/lib/index.js
5444
5444
  function gfmAutolinkLiteralFromMarkdown() {
5445
5445
  return {
5446
5446
  transforms: [transformGfmAutolinkLiterals],
@@ -5605,7 +5605,7 @@ function previous2(match) {
5605
5605
  return match.index === 0 || unicodeWhitespace(code2) || unicodePunctuation(code2);
5606
5606
  }
5607
5607
 
5608
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-gfm-footnote/lib/index.js
5608
+ // ../../node_modules/mdast-util-gfm-footnote/lib/index.js
5609
5609
  footnoteReference.peek = footnoteReferencePeek;
5610
5610
  function enterFootnoteCallString() {
5611
5611
  this.buffer();
@@ -5679,7 +5679,7 @@ function gfmFootnoteFromMarkdown() {
5679
5679
  };
5680
5680
  }
5681
5681
 
5682
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-gfm-strikethrough/lib/index.js
5682
+ // ../../node_modules/mdast-util-gfm-strikethrough/lib/index.js
5683
5683
  handleDelete.attention = attentionDelete;
5684
5684
  handleDelete.peek = peekDelete;
5685
5685
  function gfmStrikethroughFromMarkdown() {
@@ -5716,7 +5716,7 @@ function peekDelete() {
5716
5716
  return "~";
5717
5717
  }
5718
5718
 
5719
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-gfm-table/lib/index.js
5719
+ // ../../node_modules/mdast-util-gfm-table/lib/index.js
5720
5720
  function gfmTableFromMarkdown() {
5721
5721
  return {
5722
5722
  enter: {
@@ -5777,7 +5777,7 @@ function replace($0, $1) {
5777
5777
  return $1 === "|" ? $1 : $0;
5778
5778
  }
5779
5779
 
5780
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-gfm-task-list-item/lib/index.js
5780
+ // ../../node_modules/mdast-util-gfm-task-list-item/lib/index.js
5781
5781
  function gfmTaskListItemFromMarkdown() {
5782
5782
  return {
5783
5783
  exit: {
@@ -5824,7 +5824,7 @@ function exitParagraphWithTaskListItem(token) {
5824
5824
  this.exit(token);
5825
5825
  }
5826
5826
 
5827
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-gfm/lib/index.js
5827
+ // ../../node_modules/mdast-util-gfm/lib/index.js
5828
5828
  function gfmFromMarkdown() {
5829
5829
  return [
5830
5830
  gfmAutolinkLiteralFromMarkdown(),
@@ -5835,7 +5835,7 @@ function gfmFromMarkdown() {
5835
5835
  ];
5836
5836
  }
5837
5837
 
5838
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-autolink-literal/lib/syntax.js
5838
+ // ../../node_modules/micromark-extension-gfm-autolink-literal/lib/syntax.js
5839
5839
  var wwwPrefix = {
5840
5840
  tokenize: tokenizeWwwPrefix,
5841
5841
  partial: true
@@ -6177,7 +6177,7 @@ function previousUnbalanced(events) {
6177
6177
  return result;
6178
6178
  }
6179
6179
 
6180
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-footnote/lib/syntax.js
6180
+ // ../../node_modules/micromark-extension-gfm-footnote/lib/syntax.js
6181
6181
  var indent = {
6182
6182
  tokenize: tokenizeIndent2,
6183
6183
  partial: true
@@ -6452,7 +6452,7 @@ function tokenizeIndent2(effects, ok3, nok) {
6452
6452
  }
6453
6453
  }
6454
6454
 
6455
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-strikethrough/lib/syntax.js
6455
+ // ../../node_modules/micromark-extension-gfm-strikethrough/lib/syntax.js
6456
6456
  function gfmStrikethrough(options) {
6457
6457
  const options_ = options || {};
6458
6458
  let single = options_.singleTilde;
@@ -6546,7 +6546,7 @@ function gfmStrikethrough(options) {
6546
6546
  }
6547
6547
  }
6548
6548
 
6549
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-table/lib/edit-map.js
6549
+ // ../../node_modules/micromark-extension-gfm-table/lib/edit-map.js
6550
6550
  var EditMap2 = class {
6551
6551
  /**
6552
6552
  * Create a new edit map.
@@ -6632,7 +6632,7 @@ function addImplementation2(editMap, at, remove, add) {
6632
6632
  editMap.index.set(at, change);
6633
6633
  }
6634
6634
 
6635
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-table/lib/infer.js
6635
+ // ../../node_modules/micromark-extension-gfm-table/lib/infer.js
6636
6636
  function gfmTableAlign(events, index2) {
6637
6637
  let inDelimiterRow = false;
6638
6638
  const align = [];
@@ -6659,7 +6659,7 @@ function gfmTableAlign(events, index2) {
6659
6659
  return align;
6660
6660
  }
6661
6661
 
6662
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-table/lib/syntax.js
6662
+ // ../../node_modules/micromark-extension-gfm-table/lib/syntax.js
6663
6663
  function gfmTable() {
6664
6664
  return {
6665
6665
  flow: {
@@ -7050,7 +7050,7 @@ function getPoint(events, index2) {
7050
7050
  return event[1][side];
7051
7051
  }
7052
7052
 
7053
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-task-list-item/lib/syntax.js
7053
+ // ../../node_modules/micromark-extension-gfm-task-list-item/lib/syntax.js
7054
7054
  var tasklistCheck = {
7055
7055
  name: "tasklistCheck",
7056
7056
  tokenize: tokenizeTasklistCheck
@@ -7124,7 +7124,7 @@ function spaceThenNonSpace(effects, ok3, nok) {
7124
7124
  }
7125
7125
  }
7126
7126
 
7127
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm/index.js
7127
+ // ../../node_modules/micromark-extension-gfm/index.js
7128
7128
  function gfm(options) {
7129
7129
  return combineExtensions([
7130
7130
  gfmAutolinkLiteral(),
@@ -8109,8 +8109,9 @@ var voicePlayback = new VoicePlaybackCoordinator();
8109
8109
  function WechatMessageBody({ message, client, contactId, revision: revision2, t, onPrioritize }) {
8110
8110
  const attachment = message.kind === "image" || message.kind === "voice" || message.kind === "audio" || message.kind === "video";
8111
8111
  const text4 = attachment ? /^\[(?:image|图片|video|视频|(?:voice|audio|语音)(?:\s*\d+(?:\.\d+)?\s*(?:秒|s|["″”]))?)\]$/i.test(message.text?.trim() ?? "") ? "" : message.text : message.text || `[${message.kind}]`;
8112
- const transcribe = contactId && message.kind === "voice" ? (signal) => client.transcribeVoice(contactId, message.id, signal) : void 0;
8113
- return /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, text4 && /* @__PURE__ */ import_react8.default.createElement("div", null, text4), message.mediaId ? /* @__PURE__ */ import_react8.default.createElement(NativeMedia, { client, mediaId: message.mediaId, kind: message.kind, revision: revision2, t, transcribe }) : attachment && /* @__PURE__ */ import_react8.default.createElement(PendingAttachment, { kind: message.kind, t, prioritize: message.kind === "video" ? void 0 : onPrioritize }));
8112
+ const voiceMenu = !!contactId && message.kind === "voice";
8113
+ const media = message.mediaId ? /* @__PURE__ */ import_react8.default.createElement(NativeMedia, { client, mediaId: message.mediaId, kind: message.kind, revision: revision2, t, voiceMenu }) : attachment && /* @__PURE__ */ import_react8.default.createElement(PendingAttachment, { kind: message.kind, t, prioritize: message.kind === "video" ? void 0 : onPrioritize });
8114
+ return /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, text4 && /* @__PURE__ */ import_react8.default.createElement("div", null, text4), voiceMenu ? /* @__PURE__ */ import_react8.default.createElement(VoiceTranscription, { key: message.mediaId, t, pending: !message.mediaId, transcribe: (signal) => client.transcribeVoice(contactId, message.id, signal) }, media) : media);
8114
8115
  }
8115
8116
  function PendingAttachment({ kind, t, prioritize }) {
8116
8117
  const [state, setState] = (0, import_react8.useState)("idle");
@@ -8130,7 +8131,7 @@ function PendingAttachment({ kind, t, prioritize }) {
8130
8131
  function NativeMedia(props) {
8131
8132
  return /* @__PURE__ */ import_react8.default.createElement(MediaAttachment, { key: props.mediaId, ...props });
8132
8133
  }
8133
- function MediaAttachment({ client, mediaId, kind, revision: revision2, t, transcribe }) {
8134
+ function MediaAttachment({ client, mediaId, kind, revision: revision2, t, voiceMenu }) {
8134
8135
  const [result, setResult] = (0, import_react8.useState)({ mediaId });
8135
8136
  const [requested, setRequested] = (0, import_react8.useState)(kind !== "video");
8136
8137
  const [retry, setRetry] = (0, import_react8.useState)(0), element2 = (0, import_react8.useRef)(null), loaded = (0, import_react8.useRef)(false);
@@ -8166,7 +8167,7 @@ function MediaAttachment({ client, mediaId, kind, revision: revision2, t, transc
8166
8167
  if (kind === "video") {
8167
8168
  return /* @__PURE__ */ import_react8.default.createElement("div", { ref: element2, className: "ws-native-media" }, result.url ? /* @__PURE__ */ import_react8.default.createElement("video", { src: result.url, controls: true, playsInline: true, preload: "metadata", "aria-label": t("wxVideoMessage"), onError: failed }) : result.error ? /* @__PURE__ */ import_react8.default.createElement("span", { role: "status" }, t("wxVideoUnavailable"), " ", /* @__PURE__ */ import_react8.default.createElement("button", { type: "button", className: "ws-text-button", onClick: () => setRetry((value) => value + 1) }, t("wxMediaRetry"))) : requested ? /* @__PURE__ */ import_react8.default.createElement("span", { className: "ws-media-placeholder", role: "status" }, t("wxVideoLoading")) : /* @__PURE__ */ import_react8.default.createElement("button", { type: "button", className: "ws-button ws-video-load", onClick: () => setRequested(true) }, t("wxVideoLoad")));
8168
8169
  }
8169
- return /* @__PURE__ */ import_react8.default.createElement("div", { ref: element2, className: "ws-native-media" }, result.url ? result.url.startsWith("data:image/") ? /* @__PURE__ */ import_react8.default.createElement(ImageAttachment, { src: result.url, t, onError: failed }) : /* @__PURE__ */ import_react8.default.createElement(VoiceAttachment, { key: result.url, src: result.url, t, onError: failed, transcribe }) : result.error ? kind === "voice" || kind === "audio" ? /* @__PURE__ */ import_react8.default.createElement(VoicePlaceholder, { state: "error", t, retry: () => setRetry((value) => value + 1) }) : /* @__PURE__ */ import_react8.default.createElement("span", { role: "status" }, t(kind === "image" ? "wxImageUnavailable" : "wxAudioUnavailable"), " ", /* @__PURE__ */ import_react8.default.createElement("button", { className: "ws-text-button", onClick: () => setRetry((value) => value + 1) }, t("wxMediaRetry"))) : kind === "voice" || kind === "audio" ? /* @__PURE__ */ import_react8.default.createElement(VoicePlaceholder, { state: "loading", t }) : /* @__PURE__ */ import_react8.default.createElement("span", { className: "ws-media-placeholder", role: "status" }, t("wxImageLoading")));
8170
+ return /* @__PURE__ */ import_react8.default.createElement("div", { ref: element2, className: "ws-native-media" }, result.url ? result.url.startsWith("data:image/") ? /* @__PURE__ */ import_react8.default.createElement(ImageAttachment, { src: result.url, t, onError: failed }) : /* @__PURE__ */ import_react8.default.createElement(VoiceAttachment, { key: result.url, src: result.url, t, onError: failed, voiceMenu }) : result.error ? kind === "voice" || kind === "audio" ? /* @__PURE__ */ import_react8.default.createElement(VoicePlaceholder, { state: "error", t, retry: () => setRetry((value) => value + 1) }) : /* @__PURE__ */ import_react8.default.createElement("span", { role: "status" }, t(kind === "image" ? "wxImageUnavailable" : "wxAudioUnavailable"), " ", /* @__PURE__ */ import_react8.default.createElement("button", { className: "ws-text-button", onClick: () => setRetry((value) => value + 1) }, t("wxMediaRetry"))) : kind === "voice" || kind === "audio" ? /* @__PURE__ */ import_react8.default.createElement(VoicePlaceholder, { state: "loading", t }) : /* @__PURE__ */ import_react8.default.createElement("span", { className: "ws-media-placeholder", role: "status" }, t("wxImageLoading")));
8170
8171
  }
8171
8172
  function ImageAttachment({ src, t, onError }) {
8172
8173
  const [open, setOpen] = (0, import_react8.useState)(false), trigger = (0, import_react8.useRef)(null);
@@ -8178,18 +8179,14 @@ function VoiceWaves() {
8178
8179
  function VoicePlaceholder({ state, t, retry }) {
8179
8180
  return /* @__PURE__ */ import_react8.default.createElement("div", { className: `ws-voice-placeholder is-${state}`, role: "status", title: t(state === "pending" ? "wxAudioPending" : state === "loading" ? "wxAudioLoading" : "wxAudioUnavailable") }, /* @__PURE__ */ import_react8.default.createElement(VoiceWaves, null), /* @__PURE__ */ import_react8.default.createElement("span", { className: "ws-voice-status" }, /* @__PURE__ */ import_react8.default.createElement("strong", null, t("wxVoiceMessage")), /* @__PURE__ */ import_react8.default.createElement("span", null, t(state === "pending" ? "wxVoicePending" : state === "loading" ? "wxAudioLoading" : "wxAudioUnavailable"))), retry && /* @__PURE__ */ import_react8.default.createElement("button", { type: "button", className: "ws-text-button ws-voice-retry", onClick: retry }, t("wxMediaRetry")));
8180
8181
  }
8181
- function VoiceAttachment({ src, t, onError, transcribe }) {
8182
+ function VoiceAttachment({ src, t, onError, voiceMenu }) {
8182
8183
  const audio = (0, import_react8.useRef)(null), alive = (0, import_react8.useRef)(true);
8183
- const trigger = (0, import_react8.useRef)(null), menu = (0, import_react8.useRef)(null);
8184
- const request = (0, import_react8.useRef)(null);
8185
8184
  const [playing, setPlaying] = (0, import_react8.useState)(false), [duration, setDuration] = (0, import_react8.useState)(), [playError, setPlayError] = (0, import_react8.useState)(false);
8186
- const [transcription, setTranscription] = (0, import_react8.useState)();
8187
8185
  (0, import_react8.useEffect)(() => {
8188
8186
  alive.current = true;
8189
8187
  const element2 = audio.current;
8190
8188
  return () => {
8191
8189
  alive.current = false;
8192
- request.current?.abort();
8193
8190
  if (element2) voicePlayback.stop(element2);
8194
8191
  };
8195
8192
  }, []);
@@ -8203,6 +8200,38 @@ function VoiceAttachment({ src, t, onError, transcribe }) {
8203
8200
  if (alive.current) setPlayError(true);
8204
8201
  }
8205
8202
  };
8203
+ const durationLabel = voiceDurationLabel(duration);
8204
+ return /* @__PURE__ */ import_react8.default.createElement("div", { className: "ws-voice-message" }, /* @__PURE__ */ import_react8.default.createElement("audio", { ref: audio, hidden: true, preload: "metadata", src, onLoadedMetadata: (event) => setDuration(event.currentTarget.duration), onDurationChange: (event) => setDuration(event.currentTarget.duration), onPlaying: () => setPlaying(true), onPause: () => setPlaying(false), onEnded: (event) => {
8205
+ voicePlayback.stop(event.currentTarget);
8206
+ setPlaying(false);
8207
+ }, onError }), /* @__PURE__ */ import_react8.default.createElement(
8208
+ "button",
8209
+ {
8210
+ type: "button",
8211
+ className: `ws-voice-button${playing ? " is-playing" : ""}`,
8212
+ style: { width: Math.min(240, 112 + (duration && Number.isFinite(duration) ? duration : 0) * 2) },
8213
+ onClick: () => void toggle(),
8214
+ "aria-label": `${t(playing ? "wxPauseVoice" : "wxPlayVoice")}${durationLabel ? " \xB7 " + durationLabel : ""}`,
8215
+ "aria-pressed": playing,
8216
+ "aria-haspopup": voiceMenu ? "menu" : void 0
8217
+ },
8218
+ /* @__PURE__ */ import_react8.default.createElement(VoiceWaves, null),
8219
+ /* @__PURE__ */ import_react8.default.createElement("span", { className: "ws-voice-duration", "aria-hidden": "true" }, durationLabel)
8220
+ ), playError && /* @__PURE__ */ import_react8.default.createElement("span", { className: "ws-voice-error", role: "status" }, t("wxVoicePlaybackFailed")));
8221
+ }
8222
+ var transcriptionErrors = {
8223
+ WECHAT_VOICE_NOT_AVAILABLE: "wxTranscriptVoicePending",
8224
+ WECHAT_TRANSCRIPTION_NOT_CONFIGURED: "wxTranscriptNotConfigured",
8225
+ WECHAT_TRANSCRIPTION_AUTH_FAILED: "wxTranscriptAuthFailed",
8226
+ WECHAT_TRANSCRIPTION_TIMEOUT: "wxTranscriptTimeout",
8227
+ WECHAT_TRANSCRIPTION_EMPTY: "wxTranscriptEmpty",
8228
+ WECHAT_TRANSCRIPTION_INVALID_AUDIO: "wxAudioUnavailable"
8229
+ };
8230
+ function VoiceTranscription({ children, pending, t, transcribe }) {
8231
+ const trigger = (0, import_react8.useRef)(null), menu = (0, import_react8.useRef)(null);
8232
+ const request = (0, import_react8.useRef)(null);
8233
+ const [transcription, setTranscription] = (0, import_react8.useState)();
8234
+ (0, import_react8.useEffect)(() => () => request.current?.abort(), []);
8206
8235
  const showMenu = (x, y) => {
8207
8236
  const element2 = menu.current;
8208
8237
  if (!element2) return;
@@ -8217,64 +8246,62 @@ function VoiceAttachment({ src, t, onError, transcribe }) {
8217
8246
  };
8218
8247
  const convert2 = async () => {
8219
8248
  closeMenu();
8220
- if (!transcribe || request.current || transcription?.state === "done") return;
8249
+ if (request.current || transcription?.state === "done") return;
8221
8250
  const controller = new AbortController();
8222
8251
  request.current = controller;
8223
- setTranscription({ state: "loading" });
8252
+ setTranscription({ state: "loading", text: t("wxTranscribingVoice") });
8224
8253
  try {
8225
8254
  const { text: text4 } = await transcribe(controller.signal);
8226
8255
  if (!controller.signal.aborted) setTranscription({ state: "done", text: text4 });
8227
- } catch {
8228
- if (!controller.signal.aborted) setTranscription({ state: "error" });
8256
+ } catch (error) {
8257
+ const code2 = error instanceof Error && "code" in error ? error.code : void 0;
8258
+ const key = typeof code2 === "string" && Object.hasOwn(transcriptionErrors, code2) ? transcriptionErrors[code2] : "wxTranscriptUnavailable";
8259
+ if (!controller.signal.aborted) setTranscription({ state: "error", text: t(key) });
8229
8260
  } finally {
8230
8261
  request.current = null;
8231
8262
  }
8232
8263
  };
8233
- const durationLabel = voiceDurationLabel(duration);
8234
- return /* @__PURE__ */ import_react8.default.createElement("div", { className: "ws-voice-message" }, /* @__PURE__ */ import_react8.default.createElement("audio", { ref: audio, hidden: true, preload: "metadata", src, onLoadedMetadata: (event) => setDuration(event.currentTarget.duration), onDurationChange: (event) => setDuration(event.currentTarget.duration), onPlaying: () => setPlaying(true), onPause: () => setPlaying(false), onEnded: (event) => {
8235
- voicePlayback.stop(event.currentTarget);
8236
- setPlaying(false);
8237
- }, onError }), /* @__PURE__ */ import_react8.default.createElement(
8238
- "button",
8264
+ return /* @__PURE__ */ import_react8.default.createElement(
8265
+ "div",
8239
8266
  {
8240
- ref: trigger,
8241
- type: "button",
8242
- className: `ws-voice-button${playing ? " is-playing" : ""}`,
8243
- style: { width: Math.min(240, 112 + (duration && Number.isFinite(duration) ? duration : 0) * 2) },
8244
- onClick: () => void toggle(),
8245
- "aria-label": `${t(playing ? "wxPauseVoice" : "wxPlayVoice")}${durationLabel ? " \xB7 " + durationLabel : ""}`,
8246
- "aria-pressed": playing,
8247
- "aria-haspopup": transcribe ? "menu" : void 0,
8248
- onContextMenu: transcribe ? (event) => {
8267
+ tabIndex: pending ? 0 : void 0,
8268
+ "aria-haspopup": pending ? "menu" : void 0,
8269
+ onContextMenu: (event) => {
8270
+ if (menu.current?.contains(event.target)) return;
8249
8271
  event.preventDefault();
8272
+ event.stopPropagation();
8273
+ trigger.current = event.currentTarget.querySelector(".ws-voice-button") ?? event.currentTarget;
8250
8274
  showMenu(event.clientX, event.clientY);
8251
- } : void 0,
8252
- onKeyDown: transcribe ? (event) => {
8275
+ },
8276
+ onKeyDown: (event) => {
8253
8277
  if (event.key !== "ContextMenu" && !(event.shiftKey && event.key === "F10")) return;
8278
+ if (!(event.target instanceof HTMLElement) || menu.current?.contains(event.target)) return;
8254
8279
  event.preventDefault();
8255
- const position2 = event.currentTarget.getBoundingClientRect();
8280
+ trigger.current = event.target;
8281
+ const position2 = event.target.getBoundingClientRect();
8256
8282
  showMenu(position2.left, position2.bottom);
8257
- } : void 0
8258
- },
8259
- /* @__PURE__ */ import_react8.default.createElement(VoiceWaves, null),
8260
- /* @__PURE__ */ import_react8.default.createElement("span", { className: "ws-voice-duration", "aria-hidden": "true" }, durationLabel)
8261
- ), transcribe && /* @__PURE__ */ import_react8.default.createElement(
8262
- "div",
8263
- {
8264
- ref: menu,
8265
- ...{ popover: "auto" },
8266
- className: "ws-voice-menu",
8267
- role: "menu",
8268
- onKeyDown: (event) => {
8269
- if (event.key === "Escape") {
8270
- event.preventDefault();
8271
- event.stopPropagation();
8272
- closeMenu();
8273
- }
8274
8283
  }
8275
8284
  },
8276
- /* @__PURE__ */ import_react8.default.createElement("button", { type: "button", role: "menuitem", "aria-disabled": transcription?.state === "loading" || transcription?.state === "done", onClick: () => void convert2() }, t("wxTranscribeVoice"))
8277
- ), transcription && /* @__PURE__ */ import_react8.default.createElement("div", { className: "ws-voice-transcript", role: "status" }, transcription.state === "done" ? transcription.text : transcription.state === "loading" ? t("wxTranscribingVoice") : t("wxTranscriptUnavailable")), playError && /* @__PURE__ */ import_react8.default.createElement("span", { className: "ws-voice-error", role: "status" }, t("wxVoicePlaybackFailed")));
8285
+ children,
8286
+ /* @__PURE__ */ import_react8.default.createElement(
8287
+ "div",
8288
+ {
8289
+ ref: menu,
8290
+ ...{ popover: "auto" },
8291
+ className: "ws-voice-menu",
8292
+ role: "menu",
8293
+ onKeyDown: (event) => {
8294
+ if (event.key === "Escape") {
8295
+ event.preventDefault();
8296
+ event.stopPropagation();
8297
+ closeMenu();
8298
+ }
8299
+ }
8300
+ },
8301
+ /* @__PURE__ */ import_react8.default.createElement("button", { type: "button", role: "menuitem", "aria-disabled": transcription?.state === "loading" || transcription?.state === "done", onClick: () => void convert2() }, t("wxTranscribeVoice"))
8302
+ ),
8303
+ transcription && /* @__PURE__ */ import_react8.default.createElement("div", { className: "ws-voice-transcript", role: "status" }, transcription.text)
8304
+ );
8278
8305
  }
8279
8306
 
8280
8307
  // src/wechat/sync-panel.tsx
@@ -10208,6 +10235,11 @@ var zh = {
10208
10235
  wxTranscribeVoice: "\u8F6C\u4E3A\u6587\u5B57",
10209
10236
  wxTranscribingVoice: "\u6B63\u5728\u8F6C\u5199\u8BED\u97F3\u2026",
10210
10237
  wxTranscriptUnavailable: "\u8BED\u97F3\u8F6C\u5199\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u8BED\u97F3\u8BC6\u522B\u670D\u52A1\u540E\u91CD\u8BD5\u3002",
10238
+ wxTranscriptVoicePending: "\u8BED\u97F3\u5C1A\u672A\u540C\u6B65\u5230\u672C\u673A\u3002\u8BF7\u540C\u6B65\u540E\u91CD\u8BD5\u3002",
10239
+ wxTranscriptNotConfigured: "\u8BED\u97F3\u8BC6\u522B\u672A\u914D\u7F6E\u3002\u8BF7\u5728\u4E07\u673A\u5927\u8111\u7684\u6A21\u578B\u51ED\u636E\u4E2D\u914D\u7F6E\u963F\u91CC\u4E91\u767E\u70BC API Key\u3002",
10240
+ wxTranscriptAuthFailed: "\u8BED\u97F3\u8BC6\u522B\u9274\u6743\u5931\u8D25\u3002\u8BF7\u68C0\u67E5\u963F\u91CC\u4E91\u767E\u70BC API Key \u548C\u6A21\u578B\u6743\u9650\u3002",
10241
+ wxTranscriptTimeout: "\u8BED\u97F3\u8BC6\u522B\u8D85\u65F6\uFF0C\u8BF7\u91CD\u8BD5\u3002",
10242
+ wxTranscriptEmpty: "\u8FD9\u6761\u8BED\u97F3\u6CA1\u6709\u8BC6\u522B\u51FA\u6587\u5B57\u3002",
10211
10243
  wxPrioritizeMedia: "\u4F18\u5148\u540C\u6B65",
10212
10244
  wxMediaPriorityQueued: "\u5DF2\u5B89\u6392\u4F18\u5148\u540C\u6B65",
10213
10245
  wxMediaPriorityFailed: "\u6682\u65F6\u65E0\u6CD5\u4F18\u5148\u540C\u6B65\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5",
@@ -10537,6 +10569,11 @@ var en = {
10537
10569
  wxTranscribeVoice: "Transcribe",
10538
10570
  wxTranscribingVoice: "Transcribing\u2026",
10539
10571
  wxTranscriptUnavailable: "Could not transcribe. Check the speech recognition service and retry.",
10572
+ wxTranscriptVoicePending: "This voice message has not synced yet. Sync it and try again.",
10573
+ wxTranscriptNotConfigured: "Speech recognition needs an Alibaba Cloud Model Studio API key in the app\u2019s model credentials.",
10574
+ wxTranscriptAuthFailed: "Speech recognition was denied. Check the Alibaba Cloud Model Studio API key and model access.",
10575
+ wxTranscriptTimeout: "Speech recognition timed out. Try again.",
10576
+ wxTranscriptEmpty: "No speech was recognized in this message.",
10540
10577
  wxPrioritizeMedia: "Sync first",
10541
10578
  wxMediaPriorityQueued: "Marked for priority sync",
10542
10579
  wxMediaPriorityFailed: "Priority sync unavailable. Try again shortly.",
@@ -12322,6 +12359,9 @@ async function reviewTurn(turn, prompt, parse2, maxAttempts, correction, signal)
12322
12359
  throw new ReviewProtocolError(true);
12323
12360
  }
12324
12361
 
12362
+ // src/generation-progress.ts
12363
+ var GENERATION_MODEL_ENDPOINT = "wanji-sales-generation/model";
12364
+
12325
12365
  // src/agent.ts
12326
12366
  var object2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
12327
12367
  function terminalGenerationFailure(response, afterSeq, throughSeq) {
@@ -12330,7 +12370,24 @@ function terminalGenerationFailure(response, afterSeq, throughSeq) {
12330
12370
  if (!object2(ending) || !object2(ending.data) || !object2(ending.data.reason)) return;
12331
12371
  const reason = ending.data.reason;
12332
12372
  if (reason.kind !== "error" || !object2(reason.error)) return;
12333
- switch (reason.error.code) {
12373
+ return generationFailure(reason.error.code);
12374
+ }
12375
+ function generationFailure(code2) {
12376
+ switch (code2) {
12377
+ case "GENERATION_COMPANY_MODEL_UNAVAILABLE":
12378
+ return "\u516C\u53F8\u9500\u552E\u8EAB\u4EFD\u5DF2\u9A8C\u8BC1\uFF0C\u6A21\u578B\u901A\u9053\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6216\u7A0D\u540E\u91CD\u8BD5\u3002";
12379
+ case "GENERATION_MODEL_NOT_CONFIGURED":
12380
+ return "\u9500\u552E\u6A21\u578B\u5C1A\u672A\u914D\u7F6E\u3002\u8BF7\u5728\u4E07\u673A\u5927\u8111\u8BBE\u7F6E\u4E2D\u9009\u7528\u5DF2\u6388\u6743\u7684 DeepSeek V4.1 Flash\uFF0C\u518D\u751F\u6210\u56DE\u590D\u3002";
12381
+ case "GENERATION_MODEL_INCOMPATIBLE":
12382
+ return "\u5F53\u524D\u9500\u552E\u6A21\u578B\u65E0\u6CD5\u7528\u4E8E\u8D77\u8349\u3002\u8BF7\u5728\u4E07\u673A\u5927\u8111\u8BBE\u7F6E\u4E2D\u9009\u62E9 DeepSeek V4.1 Flash\u3002\u6709\u72EC\u7ACB\u9500\u552E\u6A21\u578B\u914D\u7F6E\u65F6\uFF0C\u8BF7\u7BA1\u7406\u5458\u68C0\u67E5\u8BE5\u914D\u7F6E\u3002";
12383
+ case "GENERATION_WORKSPACE":
12384
+ return "\u9500\u552E\u52A9\u624B\u627E\u4E0D\u5230\u672C\u8F6E\u5DE5\u4F5C\u533A\u3002\u8BF7\u91CD\u65B0\u6253\u5F00\u9500\u552E\u52A9\u624B\uFF0C\u7B49\u5F85\u5DE5\u4F5C\u533A\u8F7D\u5165\u540E\u91CD\u8BD5\u3002";
12385
+ case "GENERATION_SKILL_UNAVAILABLE":
12386
+ return "\u9500\u552E\u52A9\u624B\u6280\u80FD\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u5B89\u88C5\u3002";
12387
+ case "GENERATION_BUSY":
12388
+ return "\u9500\u552E\u52A9\u624B\u6B63\u5728\u5904\u7406\u5176\u4ED6\u8349\u7A3F\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002";
12389
+ case "GENERATION_TIMEOUT":
12390
+ return "\u7B49\u5F85\u9500\u552E\u56DE\u590D\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002";
12334
12391
  case "QUOTA":
12335
12392
  case "ACCOUNT_QUOTA":
12336
12393
  return "\u9500\u552E\u6A21\u578B\u989D\u5EA6\u4E0D\u8DB3\uFF0C\u8BF7\u68C0\u67E5\u6A21\u578B\u901A\u9053\u7684\u53EF\u7528\u989D\u5EA6\u540E\u91CD\u8BD5\u3002";
@@ -12464,22 +12521,16 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
12464
12521
  };
12465
12522
  throw new Error("\u8FD9\u6B21\u56DE\u590D\u9700\u8981\u7684\u8D44\u6599\u6682\u4E0D\u53EF\u7528\uFF1A" + (reasons[errorCode(error)] ?? "\u672A\u80FD\u8FDE\u63A5\u77E5\u8BC6\u68C0\u7D22\u670D\u52A1\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002") + "\u672C\u6B21\u672A\u751F\u6210\u8349\u7A3F\u3002");
12466
12523
  }
12524
+ const modelLifetime = rpc.draftModel ? new AbortController() : void 0;
12525
+ const modelSignal = modelLifetime ? AbortSignal.any([signal, modelLifetime.signal]) : signal;
12467
12526
  let generationLease;
12468
12527
  const createSession = async (title) => {
12469
12528
  let created;
12470
12529
  if (knowledge.generationSessionsSupported) {
12471
12530
  const result = await invoke("/api", "wanji-sales-generation/session", { operation: "create", workspaceId, title, ...generationLease ? { leaseId: generationLease } : {} });
12472
12531
  if (object2(result) && result.ok === false && object2(result.error)) {
12473
- switch (result.error.code) {
12474
- case "GENERATION_COMPANY_MODEL_UNAVAILABLE":
12475
- throw Error("\u516C\u53F8\u9500\u552E\u8EAB\u4EFD\u5DF2\u9A8C\u8BC1\uFF0C\u6A21\u578B\u901A\u9053\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6216\u7A0D\u540E\u91CD\u8BD5\u3002");
12476
- case "GENERATION_MODEL_NOT_CONFIGURED":
12477
- throw Error("\u9500\u552E\u6A21\u578B\u5C1A\u672A\u914D\u7F6E\u3002\u8BF7\u5728\u4E07\u673A\u5927\u8111\u8BBE\u7F6E\u4E2D\u9009\u7528\u5DF2\u6388\u6743\u7684 DeepSeek V4.1 Flash\uFF0C\u518D\u751F\u6210\u56DE\u590D\u3002");
12478
- case "GENERATION_MODEL_INCOMPATIBLE":
12479
- throw Error("\u5F53\u524D\u9500\u552E\u6A21\u578B\u65E0\u6CD5\u7528\u4E8E\u8D77\u8349\u3002\u8BF7\u5728\u4E07\u673A\u5927\u8111\u8BBE\u7F6E\u4E2D\u9009\u62E9 DeepSeek V4.1 Flash\u3002\u6709\u72EC\u7ACB\u9500\u552E\u6A21\u578B\u914D\u7F6E\u65F6\uFF0C\u8BF7\u7BA1\u7406\u5458\u68C0\u67E5\u8BE5\u914D\u7F6E\u3002");
12480
- case "GENERATION_WORKSPACE":
12481
- throw Error("\u9500\u552E\u52A9\u624B\u627E\u4E0D\u5230\u672C\u8F6E\u5DE5\u4F5C\u533A\u3002\u8BF7\u91CD\u65B0\u6253\u5F00\u9500\u552E\u52A9\u624B\uFF0C\u7B49\u5F85\u5DE5\u4F5C\u533A\u8F7D\u5165\u540E\u91CD\u8BD5\u3002");
12482
- }
12532
+ const failure = generationFailure(result.error.code);
12533
+ if (failure) throw Error(failure);
12483
12534
  }
12484
12535
  if (!object2(result) || result.ok !== true || !object2(result.value) || typeof result.value.leaseId !== "string" || generationLease && generationLease !== result.value.leaseId) throw Error("\u672C\u8F6E\u4E34\u65F6\u9500\u552E\u4F1A\u8BDD\u6682\u672A\u5C31\u7EEA\uFF0C\u8BF7\u68C0\u67E5\u8FDE\u63A5\u3002");
12485
12536
  generationLease = result.value.leaseId;
@@ -12550,18 +12601,78 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
12550
12601
  observer?.stop();
12551
12602
  }
12552
12603
  };
12604
+ const openTurn = async (title, requireSkill = false) => {
12605
+ if (!rpc.draftModel) {
12606
+ const sessionId = await createSession(title);
12607
+ if (requireSkill) {
12608
+ const skills = await call("skills/list", { sessionId });
12609
+ if (!Array.isArray(skills.skills) || !skills.skills.some((s) => object2(s) && s.name === "wanji-sales-assistant")) {
12610
+ throw Error("\u6B64\u5DE5\u4F5C\u533A\u6CA1\u6709\u5B89\u88C5\u4E07\u673A\u9500\u552E\u6280\u80FD\uFF0C\u8BF7\u9009\u62E9\u9879\u76EE\u5DE5\u4F5C\u533A\u6216\u5148\u5B89\u88C5\u6280\u80FD\u3002");
12611
+ }
12612
+ }
12613
+ return (prompt, writer = false) => turn(sessionId, prompt, writer);
12614
+ }
12615
+ const history = [];
12616
+ return async (prompt, writer = false) => {
12617
+ modelSignal.throwIfAborted();
12618
+ const requestId = crypto.randomUUID();
12619
+ const preview = writer && !!options.onProgress;
12620
+ const stopped = new AbortController();
12621
+ const previewSignal = AbortSignal.any([modelSignal, stopped.signal]);
12622
+ const submitted = performance.now();
12623
+ let lastPreview = "";
12624
+ const show = (value) => {
12625
+ if (typeof value.firstTokenMs === "number") {
12626
+ timings.writerFirstTokenMs ??= value.firstTokenMs;
12627
+ timings.firstTokenMs ??= submitted - started + value.firstTokenMs;
12628
+ }
12629
+ if (typeof value.text === "string" && value.text !== lastPreview) {
12630
+ lastPreview = value.text;
12631
+ progress("writing", lastPreview);
12632
+ }
12633
+ };
12634
+ const payload = { workspaceId, requestId };
12635
+ let previewTimer;
12636
+ const pollPreview = async () => {
12637
+ if (stopped.signal.aborted || modelSignal.aborted) return;
12638
+ try {
12639
+ const result = await invoke("/api", GENERATION_MODEL_ENDPOINT, { ...payload, operation: "preview" }, previewSignal);
12640
+ if (stopped.signal.aborted || modelSignal.aborted) return;
12641
+ if (object2(result) && result.ok === true && object2(result.value)) show(result.value);
12642
+ previewTimer = setTimeout(() => void pollPreview(), 250);
12643
+ } catch {
12644
+ }
12645
+ };
12646
+ if (preview) previewTimer = setTimeout(() => void pollPreview(), 250);
12647
+ try {
12648
+ const result = await invoke("/api", GENERATION_MODEL_ENDPOINT, { ...payload, operation: "run", prompt, history, preview }, modelSignal);
12649
+ modelSignal.throwIfAborted();
12650
+ if (!object2(result) || result.ok !== true || !object2(result.value) || typeof result.value.text !== "string" || !result.value.text.trim() || result.value.text.length > 64e3) {
12651
+ const code2 = object2(result) && object2(result.error) ? result.error.code : void 0;
12652
+ throw Error(generationFailure(code2) ?? "\u672A\u53D6\u5F97\u6709\u6548\u7684\u9500\u552E\u56DE\u590D\uFF0C\u8BF7\u91CD\u8BD5\u3002");
12653
+ }
12654
+ if (preview) show({ firstTokenMs: result.value.firstTokenMs, text: wechatPreview(result.value.text) });
12655
+ history.push({ prompt, text: result.value.text });
12656
+ return result.value.text;
12657
+ } catch (error) {
12658
+ if (preview) show({ text: "" });
12659
+ throw error;
12660
+ } finally {
12661
+ stopped.abort();
12662
+ clearTimeout(previewTimer);
12663
+ }
12664
+ };
12665
+ };
12553
12666
  try {
12554
12667
  const selectMaterial = () => selectReplyMaterial(
12555
12668
  rpc,
12556
12669
  materialQuery,
12557
- async (prompt) => turn(await createSession("\u9500\u552E\u7D20\u6750\u5339\u914D\uFF5C" + contact.name), prompt),
12670
+ async (prompt) => (await openTurn("\u9500\u552E\u7D20\u6750\u5339\u914D\uFF5C" + contact.name))(prompt),
12558
12671
  signal,
12559
12672
  allowMaterialResend(latest) ? [] : sentMaterialUrls(buildTurnPacket(contact, latest))
12560
12673
  );
12561
12674
  if (knowledge.catalogMaterialsAvailable && contact.replyMode !== "source-bound" && materialOnly) return materialOnlyReply(await selectMaterial());
12562
- const sessionId = await createSession("\u9500\u552E\u56DE\u590D\uFF5C" + contact.name);
12563
- const skills = await call("skills/list", { sessionId });
12564
- if (!Array.isArray(skills.skills) || !skills.skills.some((s) => object2(s) && s.name === "wanji-sales-assistant")) throw new Error("\u6B64\u5DE5\u4F5C\u533A\u6CA1\u6709\u5B89\u88C5\u4E07\u673A\u9500\u552E\u6280\u80FD\uFF0C\u8BF7\u9009\u62E9\u9879\u76EE\u5DE5\u4F5C\u533A\u6216\u5148\u5B89\u88C5\u6280\u80FD\u3002");
12675
+ const replyTurn = await openTurn("\u9500\u552E\u56DE\u590D\uFF5C" + contact.name, true);
12565
12676
  const bound = contact.replyMode === "source-bound" ? buildSourceContext(contact, latest) : void 0;
12566
12677
  const catalogMaterial = knowledge.catalogMaterialsAvailable && !bound && !isExplicitStop(latest) && (explicitMaterial || isMaterialReferenceQuestion(latest)) ? await selectMaterial() : void 0;
12567
12678
  if (bound && contact.replyMode === "source-bound") {
@@ -12569,7 +12680,7 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
12569
12680
  let feedback = "", planned;
12570
12681
  let rendered;
12571
12682
  for (let attempt = 0; attempt < 3; attempt++) {
12572
- const text4 = await turn(sessionId, sourcePlanPrompt(contact, latest, bound, knowledge) + feedback);
12683
+ const text4 = await replyTurn(sourcePlanPrompt(contact, latest, bound, knowledge) + feedback);
12573
12684
  try {
12574
12685
  planned = parseSourcePlan(text4);
12575
12686
  assertSourceSelection(bound, planned);
@@ -12601,7 +12712,7 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
12601
12712
  let plan, recoveredPlan, planFeedback = "";
12602
12713
  progress("planning");
12603
12714
  for (let attempt = 0; attempt < 2; attempt++) {
12604
- const text4 = await turn(sessionId, buildTurnPlanPrompt(contact, latest, knowledge.contextId, packet) + planFeedback);
12715
+ const text4 = await replyTurn(buildTurnPlanPrompt(contact, latest, knowledge.contextId, packet) + planFeedback);
12605
12716
  try {
12606
12717
  plan = parseTurnPlan(text4, contact, latest, packet);
12607
12718
  break;
@@ -12641,9 +12752,9 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
12641
12752
  },
12642
12753
  async revise(draft, issues) {
12643
12754
  progress("writing", "");
12644
- const id = await createSession("\u9500\u552E\u5C40\u90E8\u6539\u7A3F\uFF5C" + contact.name), prompt = buildDraftEditPrompt(packet, plan, draft, issues);
12755
+ const rewrite = await openTurn("\u9500\u552E\u5C40\u90E8\u6539\u7A3F\uFF5C" + contact.name), prompt = buildDraftEditPrompt(packet, plan, draft, issues);
12645
12756
  for (let n = 0; n < 2; n++) {
12646
- const result = await turn(id, prompt + (n ? "\n\u4E0A\u6B21\u4FEE\u6539\u672A\u901A\u8FC7\u3002\u53EA\u8FD4\u56DEedits\uFF0C\u6BCF\u9879\u53EA\u9009\u5F53\u524Dedit_units\u7684id\u53CAafter\uFF1B\u4E0D\u53EF\u9020\u7F16\u53F7\u6216\u91CD\u5199\u5168\u6587\u3002" : ""));
12757
+ const result = await rewrite(prompt + (n ? "\n\u4E0A\u6B21\u4FEE\u6539\u672A\u901A\u8FC7\u3002\u53EA\u8FD4\u56DEedits\uFF0C\u6BCF\u9879\u53EA\u9009\u5F53\u524Dedit_units\u7684id\u53CAafter\uFF1B\u4E0D\u53EF\u9020\u7F16\u53F7\u6216\u91CD\u5199\u5168\u6587\u3002" : ""));
12647
12758
  try {
12648
12759
  return applyDraftEdits(draft, result);
12649
12760
  } catch (error) {
@@ -12654,22 +12765,22 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
12654
12765
  },
12655
12766
  async generate(prompt) {
12656
12767
  progress("writing", "");
12657
- const writer = firstDraft ? sessionId : await createSession("\u9500\u552E\u6539\u7A3F\uFF5C" + contact.name);
12768
+ const writer = firstDraft ? replyTurn : await openTurn("\u9500\u552E\u6539\u7A3F\uFF5C" + contact.name);
12658
12769
  firstDraft = false;
12659
- return turn(writer, prompt, true);
12770
+ return writer(prompt, true);
12660
12771
  },
12661
12772
  async review(kind, draft) {
12662
12773
  progress("reviewing");
12663
- const own2 = await createSession((kind === "facts" ? "\u9500\u552E\u4E8B\u5B9E\u6838\u5BF9\uFF5C" : "\u9500\u552E\u63A5\u8BDD\u6838\u5BF9\uFF5C") + contact.name);
12774
+ const own2 = await openTurn((kind === "facts" ? "\u9500\u552E\u4E8B\u5B9E\u6838\u5BF9\uFF5C" : "\u9500\u552E\u63A5\u8BDD\u6838\u5BF9\uFF5C") + contact.name);
12664
12775
  const prompt = kind === "facts" ? buildFactProofPrompt(packet, draft, true) : buildConversationReviewPrompt(contact, latest, draft, packet, plan, true);
12665
12776
  if (kind !== "facts") {
12666
- return reviewTurn((p) => turn(own2, p), prompt, (text4) => parseConversationReview(text4, draft), 4, "\u4EC5\u62A5\u544A\u5F53\u524Dreview_units\u7F16\u53F7\u3001severity\u548Creason\uFF0C\u539F\u53E5\u7531\u7A0B\u5E8F\u7ED1\u5B9A\u3002", signal);
12777
+ return reviewTurn(own2, prompt, (text4) => parseConversationReview(text4, draft), 4, "\u4EC5\u62A5\u544A\u5F53\u524Dreview_units\u7F16\u53F7\u3001severity\u548Creason\uFF0C\u539F\u53E5\u7531\u7A0B\u5E8F\u7ED1\u5B9A\u3002", signal);
12667
12778
  }
12668
- const proof = await reviewTurn((p) => turn(own2, p), prompt, (text4) => parseFactProof(text4, draft, packet, true), 4, "\u53EA\u8FD4\u56DEchecks\uFF0C\u9010\u4E2A\u8986\u76D6\uFF0C\u6765\u6E90\u53EA\u9009evidence_basis\u7F16\u53F7\uFF0C\u4E0D\u6284\u957F\u5F15\u6587\u3002", signal);
12779
+ const proof = await reviewTurn(own2, prompt, (text4) => parseFactProof(text4, draft, packet, true), 4, "\u53EA\u8FD4\u56DEchecks\uFF0C\u9010\u4E2A\u8986\u76D6\uFF0C\u6765\u6E90\u53EA\u9009evidence_basis\u7F16\u53F7\uFF0C\u4E0D\u6284\u957F\u5F15\u6587\u3002", signal);
12669
12780
  if (proof.issues.length) return proof.issues;
12670
- const verifier = await createSession("\u9500\u552E\u8BC1\u636E\u590D\u6838\uFF5C" + contact.name);
12781
+ const verifier = await openTurn("\u9500\u552E\u8BC1\u636E\u590D\u6838\uFF5C" + contact.name);
12671
12782
  const verificationPrompt = buildEntailmentPrompt(proof.claims, latest, packet.selection_rule, packet);
12672
- return reviewTurn((p) => turn(verifier, p), verificationPrompt, (text4) => parseFactReview(text4, draft, contact, latest), 2, "\u53EA\u8FD4\u56DEissues\u6570\u7EC4\uFF0Cid\u4EC5\u9009\u5F53\u524Dassertion_units\u7F16\u53F7\uFF0Creason\u89E3\u91CA\u7F3A\u53E3\uFF1B\u6CA1\u6709\u95EE\u9898\u8FD4\u56DE\u7A7A\u6570\u7EC4\u3002", signal);
12783
+ return reviewTurn(verifier, verificationPrompt, (text4) => parseFactReview(text4, draft, contact, latest), 2, "\u53EA\u8FD4\u56DEissues\u6570\u7EC4\uFF0Cid\u4EC5\u9009\u5F53\u524Dassertion_units\u7F16\u53F7\uFF0Creason\u89E3\u91CA\u7F3A\u53E3\uFF1B\u6CA1\u6709\u95EE\u9898\u8FD4\u56DE\u7A7A\u6570\u7EC4\u3002", signal);
12673
12784
  },
12674
12785
  validate(value) {
12675
12786
  const delivery = bindDeliveryToAction(plan.action ?? "answer", value);
@@ -12715,6 +12826,7 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
12715
12826
  }
12716
12827
  return includeReplyMaterial({ ...reply, next_step: nextStep, progress: plan.progress ? advanceDialogueTasks(plan.progress, packet, plan.action ?? "answer") : void 0, knowledge, timings }, material);
12717
12828
  } finally {
12829
+ modelLifetime?.abort();
12718
12830
  if (generationLease) try {
12719
12831
  await invoke("/api", "wanji-sales-generation/session", { operation: "release", workspaceId, leaseId: generationLease, background: true }, AbortSignal.timeout(1e4));
12720
12832
  } catch {
@@ -12732,8 +12844,7 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
12732
12844
  var PANEL_ID = "wanji-sales.workspace";
12733
12845
  var NS = "wanji-sales";
12734
12846
  function createGenerationTransport(ctx) {
12735
- const session = ctx.remote?.session;
12736
- return { call: (channel, endpoint, payload, signal) => ctx.connection.rpc.call(channel, endpoint, payload, signal), ...session ? { follow: (sessionId, signal) => session.follow({ address: { kind: "session", sessionId }, assistantStream: true, maxMessages: 1 }, signal) } : {} };
12847
+ return { draftModel: true, call: (channel, endpoint, payload, signal) => ctx.connection.rpc.call(channel, endpoint, payload, signal) };
12737
12848
  }
12738
12849
  function selectSalesWorkspace(items, connectedWorkspaceId) {
12739
12850
  return items.find((w) => w.workspaceId === connectedWorkspaceId)?.workspaceId ?? items[0]?.workspaceId ?? "";
@@ -12943,7 +13054,7 @@ function mountSales(ctx, Page, Icon) {
12943
13054
  return source?.autoDraftMessageId === auto?.job.messageId && source?.version === auto?.job.version;
12944
13055
  };
12945
13056
  const question = (contact.wechat ? contact.messages.filter((m) => m.direction === "in").at(-1)?.text : state.latest[id])?.trim();
12946
- const trace = !auto && question && contact.wechat?.latestInbound?.hasText !== false ? { workspaceId, contactId: id, requestId, question: question.slice(0, 8e3), startedAt: Date.now() } : void 0;
13057
+ const trace = question && contact.wechat?.latestInbound?.hasText !== false ? { workspaceId, contactId: id, requestId, question: question.slice(0, 8e3), startedAt: Date.now() } : void 0;
12947
13058
  const observe = (params) => ctx.connection.rpc.call("/api", "wanji-sales-observation/question", { ...trace, ...params }, AbortSignal.timeout(5e3));
12948
13059
  const capture = trace ? observe({ operation: "begin" }).catch(() => {
12949
13060
  }) : void 0;
@@ -13172,6 +13283,7 @@ var mediaStyles = `
13172
13283
  .ws-voice-menu button:hover,.ws-voice-menu button:focus-visible{background:var(--ws-soft)}
13173
13284
  .ws-voice-menu button[aria-disabled=true]{color:var(--ws-muted)}
13174
13285
  .ws-voice-transcript{width:fit-content;max-width:min(360px,100%);margin-top:5px;padding:8px 12px;border:1px solid var(--ws-line);border-radius:6px;background:var(--ws-soft);color:var(--ws-ink);white-space:pre-wrap;overflow-wrap:anywhere;text-align:start}
13286
+ .ws-out .ws-voice-button,.ws-out .ws-voice-transcript{margin-inline-start:auto}
13175
13287
  .ws-voice-error{display:block;max-width:240px;margin-top:5px;font-size:11px;color:var(--ws-muted)}
13176
13288
  @media(prefers-reduced-motion:reduce){.ws-voice-button.is-playing .ws-voice-wave-mid,.ws-voice-button.is-playing .ws-voice-wave-outer{animation:none}.ws-voice-button.is-playing{box-shadow:inset 3px 0 0 var(--ws-accent,var(--ws-ink))}}
13177
13289
  `;
@@ -13501,7 +13613,7 @@ function SalesPage({ t, useSales, useWorkspaces, dispatch, generate, loadConvers
13501
13613
  void copy();
13502
13614
  } }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: copyResult?.id === contact.id && copyResult.success ? "check" : "copy", size: 15 }), copyResult?.id === contact.id && copyResult.success ? t("copied") : t("copy"))), wechatSendingEnabled && contact.wechat && /* @__PURE__ */ import_react12.default.createElement("p", { role: "status", "aria-live": "polite" }, !delivery.available ? t("wxCuaRequired") : delivery.status === "sending" ? t("wxSending") : delivery.status === "awaiting-receipt" ? t("wxAwaitReceipt") : delivery.status === "sent" ? t("wxSent") : ["unknown", "claimed", "stopped", "blocked"].includes(delivery.status) ? t("wxSendStopped") : t("wxManualNote")), state.historyErrors?.[contact.id] && /* @__PURE__ */ import_react12.default.createElement("p", { role: "status" }, state.historyErrors[contact.id]), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-notice", role: "status" }, copyResult?.id === contact.id && !copyResult.success ? t("copyError") : notice)))), contact.id && /* @__PURE__ */ import_react12.default.createElement("aside", { id: profileId, className: "ws-profile", "aria-label": t("profile") }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-profile-head" }, /* @__PURE__ */ import_react12.default.createElement("h2", null, t("profile")), /* @__PURE__ */ import_react12.default.createElement("button", { type: "button", className: "ws-icon-button ws-profile-close", ref: closeProfileButton, "aria-label": t("closeProfile"), title: t("closeProfile"), onClick: () => setProfileVisibility("closed") }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "close", size: 17 }))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-profile-person" }, /* @__PURE__ */ import_react12.default.createElement(WechatAvatar, { client: wechat, scope: JSON.stringify([selectedWorkspace, contact.wechat?.accountId]), owner: contact.wechat?.chatKey ?? contact.id, mediaId: contact.wechat?.avatarId, fallback: contact.initials, className: "ws-profile-avatar" }), /* @__PURE__ */ import_react12.default.createElement("h3", null, contact.name), /* @__PURE__ */ import_react12.default.createElement("p", null, contact.segment), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-tags" }, contact.tags.map((tag) => /* @__PURE__ */ import_react12.default.createElement("span", { key: tag }, tag)))), contact.wechat && bindWechat && /* @__PURE__ */ import_react12.default.createElement(CrmForm, { key: contact.id, contact, t, frozen, dirty: updateFormDirty, bind: (binding) => bindWechat(selectedWorkspace, contact.id, binding) }), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-profile-section" }, /* @__PURE__ */ import_react12.default.createElement("h3", null, t("interest")), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-product" }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "chat", size: 18 }), /* @__PURE__ */ import_react12.default.createElement("div", null, /* @__PURE__ */ import_react12.default.createElement("strong", null, contact.product), /* @__PURE__ */ import_react12.default.createElement("p", null, contact.wechat ? t("wxContext") : t("contextHint")))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-budget" }, /* @__PURE__ */ import_react12.default.createElement("span", null, t("budget")), /* @__PURE__ */ import_react12.default.createElement("strong", null, contact.budget))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-profile-section" }, /* @__PURE__ */ import_react12.default.createElement("h3", null, t("facts")), /* @__PURE__ */ import_react12.default.createElement("dl", null, contact.facts.map((fact) => /* @__PURE__ */ import_react12.default.createElement("div", { key: fact.label }, /* @__PURE__ */ import_react12.default.createElement("dt", null, fact.label), /* @__PURE__ */ import_react12.default.createElement("dd", null, fact.value))))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-profile-caption" }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "spark", size: 14 }), /* @__PURE__ */ import_react12.default.createElement("span", null, contact.wechat ? t("wxSources") : t("profileNote"))))));
13503
13615
  }
13504
- var inject = ["slots", "layout", "locale", "connection", "remote", "remote.session"];
13616
+ var inject = ["slots", "layout", "locale", "connection"];
13505
13617
  function apply(ctx) {
13506
13618
  mountSales(ctx, SalesPage, SalesIcon);
13507
13619
  }