wecool-chat 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.ja.md +78 -20
  3. package/README.md +145 -23
  4. package/dist/CopyIndicator-RR3hSsBA.js +51 -0
  5. package/dist/MarkdownBody-EIz0jnQy.js +14910 -0
  6. package/dist/VoiceControls-A7N4uPTo.js +146 -0
  7. package/dist/VoiceRuntime-DrYjNkZK.js +459 -0
  8. package/dist/blank-line-CUDmZ-mX.js +143 -0
  9. package/dist/{browser-D1aZQhQL.js → browser-M7mS-hAN.js} +5 -5
  10. package/dist/clsx-Cf23UI1w.js +16 -0
  11. package/dist/core/client.d.ts +11 -3
  12. package/dist/core/client.d.ts.map +1 -1
  13. package/dist/core/error-reporter.d.ts +1 -1
  14. package/dist/core/error-reporter.d.ts.map +1 -1
  15. package/dist/core/i18n/messages.d.ts +77 -1
  16. package/dist/core/i18n/messages.d.ts.map +1 -1
  17. package/dist/core/tool-runner.d.ts.map +1 -1
  18. package/dist/core/types.d.ts +23 -1
  19. package/dist/core/types.d.ts.map +1 -1
  20. package/dist/createLucideIcon-C7wGkK-Q.js +43 -0
  21. package/dist/default-sNAxTmdF.js +8 -0
  22. package/dist/index.css +2 -2
  23. package/dist/index.js +5181 -4871
  24. package/dist/jsx-runtime-Cyy0mp0f.js +328 -0
  25. package/dist/lib-DG_DjiCr.js +15 -0
  26. package/dist/{messages-CveZLPSJ.js → messages-FvtWi3lI.js} +99 -27
  27. package/dist/plugins/qrcode.js +2 -2
  28. package/dist/remark-gfm-Bzy1u34W.js +1962 -0
  29. package/dist/remark-parse-BnwSmQr-.js +2486 -0
  30. package/dist/stable-prefix-BHsGj4tL.js +21 -0
  31. package/dist/ui/components/ChatFooter.d.ts +16 -2
  32. package/dist/ui/components/ChatFooter.d.ts.map +1 -1
  33. package/dist/ui/components/ChatHeader.d.ts +9 -2
  34. package/dist/ui/components/ChatHeader.d.ts.map +1 -1
  35. package/dist/ui/components/ChatHeaderMenu.d.ts +23 -2
  36. package/dist/ui/components/ChatHeaderMenu.d.ts.map +1 -1
  37. package/dist/ui/components/ChatPanel.d.ts +13 -3
  38. package/dist/ui/components/ChatPanel.d.ts.map +1 -1
  39. package/dist/ui/components/ChatWidget.d.ts.map +1 -1
  40. package/dist/ui/components/CommandConfirmationCard.d.ts +7 -1
  41. package/dist/ui/components/CommandConfirmationCard.d.ts.map +1 -1
  42. package/dist/ui/components/CommandOverlays.d.ts +13 -1
  43. package/dist/ui/components/CommandOverlays.d.ts.map +1 -1
  44. package/dist/ui/components/FooterActions.d.ts +18 -0
  45. package/dist/ui/components/FooterActions.d.ts.map +1 -0
  46. package/dist/ui/components/MessageList.d.ts +7 -1
  47. package/dist/ui/components/MessageList.d.ts.map +1 -1
  48. package/dist/ui/components/MessageRow.d.ts +7 -1
  49. package/dist/ui/components/MessageRow.d.ts.map +1 -1
  50. package/dist/ui/components/MessageRowActions.d.ts +9 -3
  51. package/dist/ui/components/MessageRowActions.d.ts.map +1 -1
  52. package/dist/ui/components/MicButton.d.ts +11 -0
  53. package/dist/ui/components/MicButton.d.ts.map +1 -0
  54. package/dist/ui/components/VoiceControls.d.ts +22 -0
  55. package/dist/ui/components/VoiceControls.d.ts.map +1 -0
  56. package/dist/ui/components/VoiceLoopStatusBar.d.ts +17 -0
  57. package/dist/ui/components/VoiceLoopStatusBar.d.ts.map +1 -0
  58. package/dist/ui/components/VoiceLoopToggle.d.ts +15 -0
  59. package/dist/ui/components/VoiceLoopToggle.d.ts.map +1 -0
  60. package/dist/ui/components/VoiceRuntime.d.ts +16 -0
  61. package/dist/ui/components/VoiceRuntime.d.ts.map +1 -0
  62. package/dist/ui/components/lazy-voice.d.ts +19 -0
  63. package/dist/ui/components/lazy-voice.d.ts.map +1 -0
  64. package/dist/ui/hooks/use-command-execution.d.ts +23 -1
  65. package/dist/ui/hooks/use-command-execution.d.ts.map +1 -1
  66. package/dist/ui/hooks/use-message-history.d.ts +14 -0
  67. package/dist/ui/hooks/use-message-history.d.ts.map +1 -1
  68. package/dist/ui/hooks/use-mic-button.d.ts +29 -0
  69. package/dist/ui/hooks/use-mic-button.d.ts.map +1 -0
  70. package/dist/ui/hooks/use-send-message.d.ts.map +1 -1
  71. package/dist/ui/hooks/use-speak-message.d.ts +26 -0
  72. package/dist/ui/hooks/use-speak-message.d.ts.map +1 -0
  73. package/dist/ui/hooks/use-visitor-id.d.ts +15 -3
  74. package/dist/ui/hooks/use-visitor-id.d.ts.map +1 -1
  75. package/dist/ui/hooks/use-voice-input.d.ts +38 -0
  76. package/dist/ui/hooks/use-voice-input.d.ts.map +1 -0
  77. package/dist/ui/hooks/use-voice-loop-speech.d.ts +38 -0
  78. package/dist/ui/hooks/use-voice-loop-speech.d.ts.map +1 -0
  79. package/dist/ui/hooks/use-voice-loop.d.ts +12 -0
  80. package/dist/ui/hooks/use-voice-loop.d.ts.map +1 -0
  81. package/dist/ui/hooks/use-voice-runtime-snapshot.d.ts +19 -0
  82. package/dist/ui/hooks/use-voice-runtime-snapshot.d.ts.map +1 -0
  83. package/dist/ui/hooks/use-voice-runtime.d.ts +29 -0
  84. package/dist/ui/hooks/use-voice-runtime.d.ts.map +1 -0
  85. package/dist/ui/hooks/useChatStream.d.ts +5 -0
  86. package/dist/ui/hooks/useChatStream.d.ts.map +1 -1
  87. package/dist/ui/hooks/useConversationList.d.ts +7 -0
  88. package/dist/ui/hooks/useConversationList.d.ts.map +1 -1
  89. package/dist/ui/utils/speech-text.d.ts +29 -0
  90. package/dist/ui/utils/speech-text.d.ts.map +1 -0
  91. package/dist/ui/utils/voice-locale.d.ts +3 -0
  92. package/dist/ui/utils/voice-locale.d.ts.map +1 -0
  93. package/dist/ui/utils/voice-loop-cue.d.ts +23 -0
  94. package/dist/ui/utils/voice-loop-cue.d.ts.map +1 -0
  95. package/dist/ui/utils/voice-loop-status.d.ts +17 -0
  96. package/dist/ui/utils/voice-loop-status.d.ts.map +1 -0
  97. package/dist/ui/utils/voice-loop-types.d.ts +40 -0
  98. package/dist/ui/utils/voice-loop-types.d.ts.map +1 -0
  99. package/dist/ui/utils/voice-runtime.d.ts +38 -0
  100. package/dist/ui/utils/voice-runtime.d.ts.map +1 -0
  101. package/dist/ui/utils/voice-support.d.ts +9 -0
  102. package/dist/ui/utils/voice-support.d.ts.map +1 -0
  103. package/dist/unified-DctkAd9P.js +518 -0
  104. package/dist/use-voice-input-LtJJz-zQ.js +102 -0
  105. package/dist/version.d.ts +17 -0
  106. package/dist/version.d.ts.map +1 -0
  107. package/dist/voice-runtime-F5NxN_0m.js +11 -0
  108. package/dist/voice-support-BeOiOzcn.js +9 -0
  109. package/package.json +27 -25
  110. package/dist/CopyIndicator-D50ixqNB.js +0 -407
  111. package/dist/MarkdownBody-eopKrDot.js +0 -19983
@@ -0,0 +1,518 @@
1
+ import { a as B, i as M, r as H } from "./messages-FvtWi3lI.js";
2
+ import { t as b } from "./default-sNAxTmdF.js";
3
+ import { t as q } from "./lib-DG_DjiCr.js";
4
+ function C(e) {
5
+ if (e) throw e;
6
+ }
7
+ var J = /* @__PURE__ */ H(((e, t) => {
8
+ var n = Object.prototype.hasOwnProperty, r = Object.prototype.toString, i = Object.defineProperty, c = Object.getOwnPropertyDescriptor, s = function(o) {
9
+ return typeof Array.isArray == "function" ? Array.isArray(o) : r.call(o) === "[object Array]";
10
+ }, f = function(o) {
11
+ if (!o || r.call(o) !== "[object Object]") return !1;
12
+ var l = n.call(o, "constructor"), p = o.constructor && o.constructor.prototype && n.call(o.constructor.prototype, "isPrototypeOf");
13
+ if (o.constructor && !l && !p) return !1;
14
+ var d;
15
+ for (d in o) ;
16
+ return typeof d > "u" || n.call(o, d);
17
+ }, u = function(o, l) {
18
+ i && l.name === "__proto__" ? i(o, l.name, {
19
+ enumerable: !0,
20
+ configurable: !0,
21
+ value: l.newValue,
22
+ writable: !0
23
+ }) : o[l.name] = l.newValue;
24
+ }, a = function(o, l) {
25
+ if (l === "__proto__")
26
+ if (n.call(o, l)) {
27
+ if (c) return c(o, l).value;
28
+ } else return;
29
+ return o[l];
30
+ };
31
+ t.exports = function h() {
32
+ var o, l, p, d, w, A, m = arguments[0], x = 1, U = arguments.length, I = !1;
33
+ for (typeof m == "boolean" && (I = m, m = arguments[1] || {}, x = 2), (m == null || typeof m != "object" && typeof m != "function") && (m = {}); x < U; ++x)
34
+ if (o = arguments[x], o != null) for (l in o)
35
+ p = a(m, l), d = a(o, l), m !== d && (I && d && (f(d) || (w = s(d))) ? (w ? (w = !1, A = p && s(p) ? p : []) : A = p && f(p) ? p : {}, u(m, {
36
+ name: l,
37
+ newValue: h(I, A, d)
38
+ })) : typeof d < "u" && u(m, {
39
+ name: l,
40
+ newValue: d
41
+ }));
42
+ return m;
43
+ };
44
+ })), _ = /* @__PURE__ */ B(J(), 1);
45
+ function R(e) {
46
+ if (typeof e != "object" || e === null) return !1;
47
+ const t = Object.getPrototypeOf(e);
48
+ return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(Symbol.toStringTag in e) && !(Symbol.iterator in e);
49
+ }
50
+ function Y() {
51
+ const e = [], t = {
52
+ run: n,
53
+ use: r
54
+ };
55
+ return t;
56
+ function n(...i) {
57
+ let c = -1;
58
+ const s = i.pop();
59
+ if (typeof s != "function") throw new TypeError("Expected function as last argument, not " + s);
60
+ f(null, ...i);
61
+ function f(u, ...a) {
62
+ const h = e[++c];
63
+ let o = -1;
64
+ if (u) {
65
+ s(u);
66
+ return;
67
+ }
68
+ for (; ++o < i.length; ) (a[o] === null || a[o] === void 0) && (a[o] = i[o]);
69
+ i = a, h ? $(h, f)(...a) : s(null, ...a);
70
+ }
71
+ }
72
+ function r(i) {
73
+ if (typeof i != "function") throw new TypeError("Expected `middelware` to be a function, not " + i);
74
+ return e.push(i), t;
75
+ }
76
+ }
77
+ function $(e, t) {
78
+ let n;
79
+ return r;
80
+ function r(...s) {
81
+ const f = e.length > s.length;
82
+ let u;
83
+ f && s.push(i);
84
+ try {
85
+ u = e.apply(this, s);
86
+ } catch (a) {
87
+ const h = a;
88
+ if (f && n) throw h;
89
+ return i(h);
90
+ }
91
+ f || (u && u.then && typeof u.then == "function" ? u.then(c, i) : u instanceof Error ? i(u) : c(u));
92
+ }
93
+ function i(s, ...f) {
94
+ n || (n = !0, t(s, ...f));
95
+ }
96
+ function c(s) {
97
+ i(null, s);
98
+ }
99
+ }
100
+ var y = class extends Error {
101
+ constructor(e, t, n) {
102
+ super(), typeof t == "string" && (n = t, t = void 0);
103
+ let r = "", i = {}, c = !1;
104
+ if (t && ("line" in t && "column" in t ? i = { place: t } : "start" in t && "end" in t ? i = { place: t } : "type" in t ? i = {
105
+ ancestors: [t],
106
+ place: t.position
107
+ } : i = { ...t }), typeof e == "string" ? r = e : !i.cause && e && (c = !0, r = e.message, i.cause = e), !i.ruleId && !i.source && typeof n == "string") {
108
+ const f = n.indexOf(":");
109
+ f === -1 ? i.ruleId = n : (i.source = n.slice(0, f), i.ruleId = n.slice(f + 1));
110
+ }
111
+ if (!i.place && i.ancestors && i.ancestors) {
112
+ const f = i.ancestors[i.ancestors.length - 1];
113
+ f && (i.place = f.position);
114
+ }
115
+ const s = i.place && "start" in i.place ? i.place.start : i.place;
116
+ this.ancestors = i.ancestors || void 0, this.cause = i.cause || void 0, this.column = s ? s.column : void 0, this.fatal = void 0, this.file = "", this.message = r, this.line = s ? s.line : void 0, this.name = q(i.place) || "1:1", this.place = i.place || void 0, this.reason = this.message, this.ruleId = i.ruleId || void 0, this.source = i.source || void 0, this.stack = c && i.cause && typeof i.cause.stack == "string" ? i.cause.stack : "", this.actual = void 0, this.expected = void 0, this.note = void 0, this.url = void 0;
117
+ }
118
+ };
119
+ y.prototype.file = "";
120
+ y.prototype.name = "";
121
+ y.prototype.reason = "";
122
+ y.prototype.message = "";
123
+ y.prototype.stack = "";
124
+ y.prototype.column = void 0;
125
+ y.prototype.line = void 0;
126
+ y.prototype.ancestors = void 0;
127
+ y.prototype.cause = void 0;
128
+ y.prototype.fatal = void 0;
129
+ y.prototype.place = void 0;
130
+ y.prototype.ruleId = void 0;
131
+ y.prototype.source = void 0;
132
+ var g = {
133
+ basename: G,
134
+ dirname: K,
135
+ extname: Q,
136
+ join: W,
137
+ sep: "/"
138
+ };
139
+ function G(e, t) {
140
+ if (t !== void 0 && typeof t != "string") throw new TypeError('"ext" argument must be a string');
141
+ v(e);
142
+ let n = 0, r = -1, i = e.length, c;
143
+ if (t === void 0 || t.length === 0 || t.length > e.length) {
144
+ for (; i--; ) if (e.codePointAt(i) === 47) {
145
+ if (c) {
146
+ n = i + 1;
147
+ break;
148
+ }
149
+ } else r < 0 && (c = !0, r = i + 1);
150
+ return r < 0 ? "" : e.slice(n, r);
151
+ }
152
+ if (t === e) return "";
153
+ let s = -1, f = t.length - 1;
154
+ for (; i--; ) if (e.codePointAt(i) === 47) {
155
+ if (c) {
156
+ n = i + 1;
157
+ break;
158
+ }
159
+ } else
160
+ s < 0 && (c = !0, s = i + 1), f > -1 && (e.codePointAt(i) === t.codePointAt(f--) ? f < 0 && (r = i) : (f = -1, r = s));
161
+ return n === r ? r = s : r < 0 && (r = e.length), e.slice(n, r);
162
+ }
163
+ function K(e) {
164
+ if (v(e), e.length === 0) return ".";
165
+ let t = -1, n = e.length, r;
166
+ for (; --n; ) if (e.codePointAt(n) === 47) {
167
+ if (r) {
168
+ t = n;
169
+ break;
170
+ }
171
+ } else r || (r = !0);
172
+ return t < 0 ? e.codePointAt(0) === 47 ? "/" : "." : t === 1 && e.codePointAt(0) === 47 ? "//" : e.slice(0, t);
173
+ }
174
+ function Q(e) {
175
+ v(e);
176
+ let t = e.length, n = -1, r = 0, i = -1, c = 0, s;
177
+ for (; t--; ) {
178
+ const f = e.codePointAt(t);
179
+ if (f === 47) {
180
+ if (s) {
181
+ r = t + 1;
182
+ break;
183
+ }
184
+ continue;
185
+ }
186
+ n < 0 && (s = !0, n = t + 1), f === 46 ? i < 0 ? i = t : c !== 1 && (c = 1) : i > -1 && (c = -1);
187
+ }
188
+ return i < 0 || n < 0 || c === 0 || c === 1 && i === n - 1 && i === r + 1 ? "" : e.slice(i, n);
189
+ }
190
+ function W(...e) {
191
+ let t = -1, n;
192
+ for (; ++t < e.length; )
193
+ v(e[t]), e[t] && (n = n === void 0 ? e[t] : n + "/" + e[t]);
194
+ return n === void 0 ? "." : X(n);
195
+ }
196
+ function X(e) {
197
+ v(e);
198
+ const t = e.codePointAt(0) === 47;
199
+ let n = Z(e, !t);
200
+ return n.length === 0 && !t && (n = "."), n.length > 0 && e.codePointAt(e.length - 1) === 47 && (n += "/"), t ? "/" + n : n;
201
+ }
202
+ function Z(e, t) {
203
+ let n = "", r = 0, i = -1, c = 0, s = -1, f, u;
204
+ for (; ++s <= e.length; ) {
205
+ if (s < e.length) f = e.codePointAt(s);
206
+ else {
207
+ if (f === 47) break;
208
+ f = 47;
209
+ }
210
+ if (f === 47) {
211
+ if (!(i === s - 1 || c === 1))
212
+ if (i !== s - 1 && c === 2) {
213
+ if (n.length < 2 || r !== 2 || n.codePointAt(n.length - 1) !== 46 || n.codePointAt(n.length - 2) !== 46) {
214
+ if (n.length > 2) {
215
+ if (u = n.lastIndexOf("/"), u !== n.length - 1) {
216
+ u < 0 ? (n = "", r = 0) : (n = n.slice(0, u), r = n.length - 1 - n.lastIndexOf("/")), i = s, c = 0;
217
+ continue;
218
+ }
219
+ } else if (n.length > 0) {
220
+ n = "", r = 0, i = s, c = 0;
221
+ continue;
222
+ }
223
+ }
224
+ t && (n = n.length > 0 ? n + "/.." : "..", r = 2);
225
+ } else
226
+ n.length > 0 ? n += "/" + e.slice(i + 1, s) : n = e.slice(i + 1, s), r = s - i - 1;
227
+ i = s, c = 0;
228
+ } else f === 46 && c > -1 ? c++ : c = -1;
229
+ }
230
+ return n;
231
+ }
232
+ function v(e) {
233
+ if (typeof e != "string") throw new TypeError("Path must be a string. Received " + JSON.stringify(e));
234
+ }
235
+ var O = { cwd: ee };
236
+ function ee() {
237
+ return "/";
238
+ }
239
+ function k(e) {
240
+ return !!(e !== null && typeof e == "object" && "href" in e && e.href && "protocol" in e && e.protocol && e.auth === void 0);
241
+ }
242
+ function te(e) {
243
+ if (typeof e == "string") e = new URL(e);
244
+ else if (!k(e)) {
245
+ const t = /* @__PURE__ */ new TypeError('The "path" argument must be of type string or an instance of URL. Received `' + e + "`");
246
+ throw t.code = "ERR_INVALID_ARG_TYPE", t;
247
+ }
248
+ if (e.protocol !== "file:") {
249
+ const t = /* @__PURE__ */ new TypeError("The URL must be of scheme file");
250
+ throw t.code = "ERR_INVALID_URL_SCHEME", t;
251
+ }
252
+ return ne(e);
253
+ }
254
+ function ne(e) {
255
+ if (e.hostname !== "") {
256
+ const r = /* @__PURE__ */ new TypeError('File URL host must be "localhost" or empty on darwin');
257
+ throw r.code = "ERR_INVALID_FILE_URL_HOST", r;
258
+ }
259
+ const t = e.pathname;
260
+ let n = -1;
261
+ for (; ++n < t.length; ) if (t.codePointAt(n) === 37 && t.codePointAt(n + 1) === 50) {
262
+ const r = t.codePointAt(n + 2);
263
+ if (r === 70 || r === 102) {
264
+ const i = /* @__PURE__ */ new TypeError("File URL path must not include encoded / characters");
265
+ throw i.code = "ERR_INVALID_FILE_URL_PATH", i;
266
+ }
267
+ }
268
+ return decodeURIComponent(t);
269
+ }
270
+ var S = [
271
+ "history",
272
+ "path",
273
+ "basename",
274
+ "stem",
275
+ "extname",
276
+ "dirname"
277
+ ], ie = class {
278
+ constructor(e) {
279
+ let t;
280
+ e ? k(e) ? t = { path: e } : typeof e == "string" || re(e) ? t = { value: e } : t = e : t = {}, this.cwd = "cwd" in t ? "" : O.cwd(), this.data = {}, this.history = [], this.messages = [], this.value, this.map, this.result, this.stored;
281
+ let n = -1;
282
+ for (; ++n < S.length; ) {
283
+ const i = S[n];
284
+ i in t && t[i] !== void 0 && t[i] !== null && (this[i] = i === "history" ? [...t[i]] : t[i]);
285
+ }
286
+ let r;
287
+ for (r in t) S.includes(r) || (this[r] = t[r]);
288
+ }
289
+ get basename() {
290
+ return typeof this.path == "string" ? g.basename(this.path) : void 0;
291
+ }
292
+ set basename(e) {
293
+ T(e, "basename"), P(e, "basename"), this.path = g.join(this.dirname || "", e);
294
+ }
295
+ get dirname() {
296
+ return typeof this.path == "string" ? g.dirname(this.path) : void 0;
297
+ }
298
+ set dirname(e) {
299
+ D(this.basename, "dirname"), this.path = g.join(e || "", this.basename);
300
+ }
301
+ get extname() {
302
+ return typeof this.path == "string" ? g.extname(this.path) : void 0;
303
+ }
304
+ set extname(e) {
305
+ if (P(e, "extname"), D(this.dirname, "extname"), e) {
306
+ if (e.codePointAt(0) !== 46) throw new Error("`extname` must start with `.`");
307
+ if (e.includes(".", 1)) throw new Error("`extname` cannot contain multiple dots");
308
+ }
309
+ this.path = g.join(this.dirname, this.stem + (e || ""));
310
+ }
311
+ get path() {
312
+ return this.history[this.history.length - 1];
313
+ }
314
+ set path(e) {
315
+ k(e) && (e = te(e)), T(e, "path"), this.path !== e && this.history.push(e);
316
+ }
317
+ get stem() {
318
+ return typeof this.path == "string" ? g.basename(this.path, this.extname) : void 0;
319
+ }
320
+ set stem(e) {
321
+ T(e, "stem"), P(e, "stem"), this.path = g.join(this.dirname || "", e + (this.extname || ""));
322
+ }
323
+ fail(e, t, n) {
324
+ const r = this.message(e, t, n);
325
+ throw r.fatal = !0, r;
326
+ }
327
+ info(e, t, n) {
328
+ const r = this.message(e, t, n);
329
+ return r.fatal = void 0, r;
330
+ }
331
+ message(e, t, n) {
332
+ const r = new y(e, t, n);
333
+ return this.path && (r.name = this.path + ":" + r.name, r.file = this.path), r.fatal = !1, this.messages.push(r), r;
334
+ }
335
+ toString(e) {
336
+ return this.value === void 0 ? "" : typeof this.value == "string" ? this.value : new TextDecoder(e || void 0).decode(this.value);
337
+ }
338
+ };
339
+ function P(e, t) {
340
+ if (e && e.includes(g.sep)) throw new Error("`" + t + "` cannot be a path: did not expect `" + g.sep + "`");
341
+ }
342
+ function T(e, t) {
343
+ if (!e) throw new Error("`" + t + "` cannot be empty");
344
+ }
345
+ function D(e, t) {
346
+ if (!e) throw new Error("Setting `" + t + "` requires `path` to be set too");
347
+ }
348
+ function re(e) {
349
+ return !!(e && typeof e == "object" && "byteLength" in e && "byteOffset" in e);
350
+ }
351
+ var se = (function(e) {
352
+ const t = this.constructor.prototype, n = t[e], r = function() {
353
+ return n.apply(r, arguments);
354
+ };
355
+ return Object.setPrototypeOf(r, t), r;
356
+ }), oe = {}.hasOwnProperty, ce = class N extends se {
357
+ constructor() {
358
+ super("copy"), this.Compiler = void 0, this.Parser = void 0, this.attachers = [], this.compiler = void 0, this.freezeIndex = -1, this.frozen = void 0, this.namespace = {}, this.parser = void 0, this.transformers = Y();
359
+ }
360
+ copy() {
361
+ const t = new N();
362
+ let n = -1;
363
+ for (; ++n < this.attachers.length; ) {
364
+ const r = this.attachers[n];
365
+ t.use(...r);
366
+ }
367
+ return t.data((0, _.default)(!0, {}, this.namespace)), t;
368
+ }
369
+ data(t, n) {
370
+ return typeof t == "string" ? arguments.length === 2 ? (j("data", this.frozen), this.namespace[t] = n, this) : oe.call(this.namespace, t) && this.namespace[t] || void 0 : t ? (j("data", this.frozen), this.namespace = t, this) : this.namespace;
371
+ }
372
+ freeze() {
373
+ if (this.frozen) return this;
374
+ const t = this;
375
+ for (; ++this.freezeIndex < this.attachers.length; ) {
376
+ const [n, ...r] = this.attachers[this.freezeIndex];
377
+ if (r[0] === !1) continue;
378
+ r[0] === !0 && (r[0] = void 0);
379
+ const i = n.call(t, ...r);
380
+ typeof i == "function" && this.transformers.use(i);
381
+ }
382
+ return this.frozen = !0, this.freezeIndex = Number.POSITIVE_INFINITY, this;
383
+ }
384
+ parse(t) {
385
+ this.freeze();
386
+ const n = E(t), r = this.parser || this.Parser;
387
+ return z("parse", r), r(String(n), n);
388
+ }
389
+ process(t, n) {
390
+ const r = this;
391
+ return this.freeze(), z("process", this.parser || this.Parser), L("process", this.compiler || this.Compiler), n ? i(void 0, n) : new Promise(i);
392
+ function i(c, s) {
393
+ const f = E(t), u = r.parse(f);
394
+ r.run(u, f, function(h, o, l) {
395
+ if (h || !o || !l) return a(h);
396
+ const p = o, d = r.stringify(p, l);
397
+ le(d) ? l.value = d : l.result = d, a(h, l);
398
+ });
399
+ function a(h, o) {
400
+ h || !o ? s(h) : c ? c(o) : n(void 0, o);
401
+ }
402
+ }
403
+ }
404
+ processSync(t) {
405
+ let n = !1, r;
406
+ return this.freeze(), z("processSync", this.parser || this.Parser), L("processSync", this.compiler || this.Compiler), this.process(t, i), V("processSync", "process", n), r;
407
+ function i(c, s) {
408
+ n = !0, C(c), r = s;
409
+ }
410
+ }
411
+ run(t, n, r) {
412
+ F(t), this.freeze();
413
+ const i = this.transformers;
414
+ return !r && typeof n == "function" && (r = n, n = void 0), r ? c(void 0, r) : new Promise(c);
415
+ function c(s, f) {
416
+ const u = E(n);
417
+ i.run(t, u, a);
418
+ function a(h, o, l) {
419
+ const p = o || t;
420
+ h ? f(h) : s ? s(p) : r(void 0, p, l);
421
+ }
422
+ }
423
+ }
424
+ runSync(t, n) {
425
+ let r = !1, i;
426
+ return this.run(t, n, c), V("runSync", "run", r), i;
427
+ function c(s, f) {
428
+ C(s), i = f, r = !0;
429
+ }
430
+ }
431
+ stringify(t, n) {
432
+ this.freeze();
433
+ const r = E(n), i = this.compiler || this.Compiler;
434
+ return L("stringify", i), F(t), i(t, r);
435
+ }
436
+ use(t, ...n) {
437
+ const r = this.attachers, i = this.namespace;
438
+ if (j("use", this.frozen), t != null)
439
+ if (typeof t == "function") u(t, n);
440
+ else if (typeof t == "object")
441
+ Array.isArray(t) ? f(t) : s(t);
442
+ else throw new TypeError("Expected usable value, not `" + t + "`");
443
+ return this;
444
+ function c(a) {
445
+ if (typeof a == "function") u(a, []);
446
+ else if (typeof a == "object")
447
+ if (Array.isArray(a)) {
448
+ const [h, ...o] = a;
449
+ u(h, o);
450
+ } else s(a);
451
+ else throw new TypeError("Expected usable value, not `" + a + "`");
452
+ }
453
+ function s(a) {
454
+ if (!("plugins" in a) && !("settings" in a)) throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");
455
+ f(a.plugins), a.settings && (i.settings = (0, _.default)(!0, i.settings, a.settings));
456
+ }
457
+ function f(a) {
458
+ let h = -1;
459
+ if (a != null)
460
+ if (Array.isArray(a)) for (; ++h < a.length; ) {
461
+ const o = a[h];
462
+ c(o);
463
+ }
464
+ else throw new TypeError("Expected a list of plugins, not `" + a + "`");
465
+ }
466
+ function u(a, h) {
467
+ let o = -1, l = -1;
468
+ for (; ++o < r.length; ) if (r[o][0] === a) {
469
+ l = o;
470
+ break;
471
+ }
472
+ if (l === -1) r.push([a, ...h]);
473
+ else if (h.length > 0) {
474
+ let [p, ...d] = h;
475
+ const w = r[l][1];
476
+ R(w) && R(p) && (p = (0, _.default)(!0, w, p)), r[l] = [
477
+ a,
478
+ p,
479
+ ...d
480
+ ];
481
+ }
482
+ }
483
+ }
484
+ }, fe = new ce().freeze();
485
+ function z(e, t) {
486
+ if (typeof t != "function") throw new TypeError("Cannot `" + e + "` without `parser`");
487
+ }
488
+ function L(e, t) {
489
+ if (typeof t != "function") throw new TypeError("Cannot `" + e + "` without `compiler`");
490
+ }
491
+ function j(e, t) {
492
+ if (t) throw new Error("Cannot call `" + e + "` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.");
493
+ }
494
+ function F(e) {
495
+ if (!R(e) || typeof e.type != "string") throw new TypeError("Expected node, got `" + e + "`");
496
+ }
497
+ function V(e, t, n) {
498
+ if (!n) throw new Error("`" + e + "` finished async. Use `" + t + "` instead");
499
+ }
500
+ function E(e) {
501
+ return ae(e) ? e : new ie(e);
502
+ }
503
+ function ae(e) {
504
+ return !!(e && typeof e == "object" && "message" in e && "messages" in e);
505
+ }
506
+ function le(e) {
507
+ return typeof e == "string" || he(e);
508
+ }
509
+ function he(e) {
510
+ return !!(e && typeof e == "object" && "byteLength" in e && "byteOffset" in e);
511
+ }
512
+ var ye = /* @__PURE__ */ M({ unified: () => fe });
513
+ export {
514
+ y as i,
515
+ fe as n,
516
+ ie as r,
517
+ ye as t
518
+ };
@@ -0,0 +1,102 @@
1
+ import { a as v } from "./messages-FvtWi3lI.js";
2
+ import { i as T } from "./jsx-runtime-Cyy0mp0f.js";
3
+ import { i as C } from "./voice-support-BeOiOzcn.js";
4
+ var o = /* @__PURE__ */ v(T(), 1), E = {
5
+ ja: "ja-JP",
6
+ en: "en-US"
7
+ }, I = 3e4, L = () => {
8
+ if (!(typeof window > "u"))
9
+ return window.SpeechRecognition ?? window.webkitSpeechRecognition;
10
+ }, j = () => {
11
+ const d = C(), [g, i] = (0, o.useState)(!1), [h, u] = (0, o.useState)(null), t = (0, o.useRef)(null), a = (0, o.useRef)(!1), l = (0, o.useCallback)(() => {
12
+ t.current && (a.current = !0, t.current.abort());
13
+ }, []);
14
+ return (0, o.useEffect)(() => l, [l]), {
15
+ isListening: g,
16
+ error: h,
17
+ start: (0, o.useCallback)((_, R) => {
18
+ const { isContinuous: p = !1, onNoResult: b } = R ?? {};
19
+ if (t.current) return;
20
+ const w = L();
21
+ if (!w) {
22
+ u("unsupported");
23
+ return;
24
+ }
25
+ const e = new w();
26
+ t.current = e, a.current = !1, e.lang = E[d], e.continuous = !1, e.interimResults = !1;
27
+ let r = !1;
28
+ const c = p ? void 0 : window.setTimeout(() => {
29
+ r || (r = !0, e.abort(), t.current = null, i(!1), u("timeout"));
30
+ }, I), s = (n) => {
31
+ r || (r = !0, window.clearTimeout(c), t.current = null, i(!1), n.ok ? (u(null), _(n.transcript)) : u(n.error));
32
+ }, S = () => {
33
+ r || (r = !0, window.clearTimeout(c), t.current = null, i(!1), b?.());
34
+ }, f = () => {
35
+ p ? S() : s({
36
+ ok: !1,
37
+ error: "no_match"
38
+ });
39
+ };
40
+ e.onresult = (n) => {
41
+ const k = n.results[0][0].transcript.trim();
42
+ if (e.stop(), k.length === 0) {
43
+ f();
44
+ return;
45
+ }
46
+ s({
47
+ ok: !0,
48
+ transcript: k
49
+ });
50
+ };
51
+ const m = () => {
52
+ r || (r = !0, window.clearTimeout(c), t.current = null, i(!1));
53
+ };
54
+ e.onerror = (n) => {
55
+ if (a.current) {
56
+ m();
57
+ return;
58
+ }
59
+ switch (n.error) {
60
+ case "not-allowed":
61
+ case "service-not-allowed":
62
+ s({
63
+ ok: !1,
64
+ error: "permission_denied"
65
+ });
66
+ break;
67
+ case "network":
68
+ s({
69
+ ok: !1,
70
+ error: "network_error"
71
+ });
72
+ break;
73
+ case "audio-capture":
74
+ s({
75
+ ok: !1,
76
+ error: "device_unavailable"
77
+ });
78
+ break;
79
+ case "language-not-supported":
80
+ s({
81
+ ok: !1,
82
+ error: "language_unsupported"
83
+ });
84
+ break;
85
+ default:
86
+ f();
87
+ }
88
+ }, e.onend = () => {
89
+ if (a.current) {
90
+ m();
91
+ return;
92
+ }
93
+ r || f();
94
+ }, u(null), i(!0), e.start();
95
+ }, [d]),
96
+ stop: l
97
+ };
98
+ };
99
+ export {
100
+ E as n,
101
+ j as t
102
+ };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * ウィジェット(wecool-chat)が叩く API のバージョン定義(issue #59)。
3
+ *
4
+ * URL にバージョンを含める方式のため、バージョン値を単一の真実として持ち、
5
+ * エンドポイント URL の組み立てと廃止通知の警告メッセージに使う。パスへ `"v1"` を
6
+ * 直書きせず、必ずこの定数から組み立てて表記の乖離を防ぐ。
7
+ */
8
+ export declare const API_VERSION = "v1";
9
+ /** API パスのバージョンプレフィックス(例: `"/api/v1"`)。エンドポイント組み立てに使う。 */
10
+ export declare const API_BASE_PATH = "/api/v1";
11
+ /**
12
+ * ビルド時に注入される SDK(wecool-chat)の版数。
13
+ * 廃止通知の警告で「どの版の SDK が古い入口を叩いているか」を開発者に示すために使う。
14
+ * 注入の仕組みは既存の error-reporter と共通(vite.config.ts の define)。
15
+ */
16
+ export declare const SDK_VERSION: string;
17
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,OAAO,CAAC;AAEhC,0DAA0D;AAC1D,eAAO,MAAM,aAAa,YAAwB,CAAC;AAEnD;;;;GAIG;AACH,eAAO,MAAM,WAAW,QAC2D,CAAC"}
@@ -0,0 +1,11 @@
1
+ var o = () => {
2
+ }, e = {
3
+ speakingMessageId: null,
4
+ toggleSpeak: o,
5
+ stopSpeaking: o,
6
+ stopVoice: o,
7
+ voiceLoop: void 0
8
+ };
9
+ export {
10
+ e as t
11
+ };
@@ -0,0 +1,9 @@
1
+ import { a as i } from "./messages-FvtWi3lI.js";
2
+ import { i as t } from "./jsx-runtime-Cyy0mp0f.js";
3
+ var e = /* @__PURE__ */ i(t(), 1), o = (0, e.createContext)("ja"), a = o.Provider, d = () => (0, e.useContext)(o), p = () => typeof window < "u" && (typeof window.SpeechRecognition < "u" || typeof window.webkitSpeechRecognition < "u"), s = () => typeof window < "u" && typeof window.speechSynthesis < "u";
4
+ export {
5
+ d as i,
6
+ s as n,
7
+ a as r,
8
+ p as t
9
+ };