@poovit-banton/speech-recognition-sdk 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +337 -59
- package/dist/lib/speech-recognition-sdk.cjs.js +2 -7
- package/dist/lib/speech-recognition-sdk.cjs.js.map +1 -1
- package/dist/lib/speech-recognition-sdk.es.js +341 -600
- package/dist/lib/speech-recognition-sdk.es.js.map +1 -1
- package/dist/lib/speech-recognition-sdk.umd.js +2 -7
- package/dist/lib/speech-recognition-sdk.umd.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,73 +1,351 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 🎙️ Speech Recognition SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React SDK สำหรับ Speech Recognition ใช้ Web Speech API พร้อม Widget สวยๆ ใช้งานง่าย
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+

|
|
6
|
+

|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
8
|
+
## ✨ Features
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
- 🎤 **Speech to Text** - แปลงเสียงพูดเป็นข้อความแบบ Real-time
|
|
11
|
+
- 🌏 **รองรับภาษาไทย** - ตั้งค่า `th-TH` ได้เลย
|
|
12
|
+
- 🎨 **Floating Widget** - ปุ่มลอยพร้อม Modal สวยงาม
|
|
13
|
+
- ⚡ **React Hooks** - ใช้งานง่ายด้วย `useSpeechRecognition`
|
|
14
|
+
- 📦 **TypeScript** - รองรับ TypeScript 100%
|
|
15
|
+
- 🔧 **Customizable** - ปรับแต่งได้ตามต้องการ
|
|
11
16
|
|
|
12
|
-
|
|
17
|
+
## 📦 Installation
|
|
13
18
|
|
|
14
|
-
|
|
19
|
+
```bash
|
|
20
|
+
npm install @poovit-banton/speech-recognition-sdk
|
|
21
|
+
```
|
|
15
22
|
|
|
16
|
-
|
|
23
|
+
หรือ
|
|
17
24
|
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
{
|
|
22
|
-
files: ['**/*.{ts,tsx}'],
|
|
23
|
-
extends: [
|
|
24
|
-
// Other configs...
|
|
25
|
+
```bash
|
|
26
|
+
yarn add @poovit-banton/speech-recognition-sdk
|
|
27
|
+
```
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
tseslint.configs.recommendedTypeChecked,
|
|
28
|
-
// Alternatively, use this for stricter rules
|
|
29
|
-
tseslint.configs.strictTypeChecked,
|
|
30
|
-
// Optionally, add this for stylistic rules
|
|
31
|
-
tseslint.configs.stylisticTypeChecked,
|
|
29
|
+
## 🚀 Quick Start
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
### วิธีที่ 1: ใช้ Widget (แนะนำ - ง่ายสุด)
|
|
32
|
+
|
|
33
|
+
แค่ครอบ App ด้วย `SpeechProvider` แล้วได้ปุ่มลอย + Modal มาเลย!
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
import { SpeechProvider } from "@poovit-banton/speech-recognition-sdk";
|
|
37
|
+
|
|
38
|
+
function App() {
|
|
39
|
+
return (
|
|
40
|
+
<SpeechProvider
|
|
41
|
+
showWidget
|
|
42
|
+
widgetEnabled
|
|
43
|
+
widgetPosition="bottom-left"
|
|
44
|
+
config={{ language: "th-TH" }}
|
|
45
|
+
onGenerate={async (transcript) => {
|
|
46
|
+
// เรียก API ของคุณตรงนี้
|
|
47
|
+
const response = await fetch("/api/process", {
|
|
48
|
+
method: "POST",
|
|
49
|
+
headers: { "Content-Type": "application/json" },
|
|
50
|
+
body: JSON.stringify({ text: transcript }),
|
|
51
|
+
});
|
|
52
|
+
return await response.json();
|
|
53
|
+
}}
|
|
54
|
+
onGenerateComplete={(response) => {
|
|
55
|
+
console.log("ผลลัพธ์:", response);
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
<YourApp />
|
|
59
|
+
</SpeechProvider>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### วิธีที่ 2: ใช้ Hook (ยืดหยุ่นกว่า)
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
import { useSpeechRecognition } from "@poovit-banton/speech-recognition-sdk";
|
|
68
|
+
|
|
69
|
+
function MyComponent() {
|
|
70
|
+
const {
|
|
71
|
+
transcript, // ข้อความที่พูด
|
|
72
|
+
isListening, // กำลังฟังอยู่ไหม
|
|
73
|
+
isSupported, // browser รองรับไหม
|
|
74
|
+
startListening, // เริ่มฟัง
|
|
75
|
+
stopListening, // หยุดฟัง
|
|
76
|
+
resetTranscript, // ล้างข้อความ
|
|
77
|
+
} = useSpeechRecognition({
|
|
78
|
+
config: { language: "th-TH" },
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
if (!isSupported) {
|
|
82
|
+
return <p>Browser ไม่รองรับ Speech Recognition</p>;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<div>
|
|
87
|
+
<button onClick={isListening ? stopListening : startListening}>
|
|
88
|
+
{isListening ? "🛑 หยุด" : "🎤 เริ่มพูด"}
|
|
89
|
+
</button>
|
|
90
|
+
<p>{transcript}</p>
|
|
91
|
+
<button onClick={resetTranscript}>ล้าง</button>
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### วิธีที่ 3: ควบคุม Widget จาก Component
|
|
98
|
+
|
|
99
|
+
```tsx
|
|
100
|
+
import {
|
|
101
|
+
SpeechProvider,
|
|
102
|
+
useSpeechContext,
|
|
103
|
+
} from "@poovit-banton/speech-recognition-sdk";
|
|
104
|
+
|
|
105
|
+
function App() {
|
|
106
|
+
return (
|
|
107
|
+
<SpeechProvider showWidget widgetEnabled>
|
|
108
|
+
<ControlPanel />
|
|
109
|
+
</SpeechProvider>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function ControlPanel() {
|
|
114
|
+
const { isWidgetEnabled, toggleWidget } = useSpeechContext();
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<button onClick={toggleWidget}>
|
|
118
|
+
{isWidgetEnabled ? "🔇 ปิด" : "🔊 เปิด"} Voice Widget
|
|
119
|
+
</button>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
44
122
|
```
|
|
45
123
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
124
|
+
## 📖 API Reference
|
|
125
|
+
|
|
126
|
+
### `<SpeechProvider>`
|
|
127
|
+
|
|
128
|
+
Provider component สำหรับครอบ App
|
|
129
|
+
|
|
130
|
+
| Prop | Type | Default | Description |
|
|
131
|
+
| -------------------- | ------------------ | --------------------- | ----------------------------- |
|
|
132
|
+
| `showWidget` | `boolean` | `false` | แสดง Floating Widget |
|
|
133
|
+
| `widgetEnabled` | `boolean` | `true` | เปิด/ปิด Widget |
|
|
134
|
+
| `widgetPosition` | `string \| object` | `"bottom-left"` | ตำแหน่ง Widget |
|
|
135
|
+
| `widgetButtonSize` | `number` | `60` | ขนาดปุ่ม (px) |
|
|
136
|
+
| `config` | `object` | `{}` | ตั้งค่า Speech Recognition |
|
|
137
|
+
| `onGenerate` | `function` | - | Callback เมื่อกด Generate |
|
|
138
|
+
| `onGenerateComplete` | `function` | - | Callback เมื่อ Generate เสร็จ |
|
|
139
|
+
| `onGenerateError` | `function` | - | Callback เมื่อเกิด Error |
|
|
140
|
+
| `modalTitle` | `string` | `"AI Speech-to-Data"` | หัวข้อ Modal |
|
|
141
|
+
| `generateButtonText` | `string` | `"Generate"` | ข้อความปุ่ม Generate |
|
|
142
|
+
|
|
143
|
+
#### Widget Position Options
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
// Preset positions
|
|
147
|
+
widgetPosition="bottom-left" // ซ้ายล่าง
|
|
148
|
+
widgetPosition="bottom-right" // ขวาล่าง
|
|
149
|
+
widgetPosition="top-left" // ซ้ายบน
|
|
150
|
+
widgetPosition="top-right" // ขวาบน
|
|
151
|
+
|
|
152
|
+
// Custom position
|
|
153
|
+
widgetPosition={{ bottom: 20, left: 20 }}
|
|
154
|
+
widgetPosition={{ top: 100, right: 50 }}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### `useSpeechRecognition(options)`
|
|
158
|
+
|
|
159
|
+
Hook สำหรับใช้งาน Speech Recognition
|
|
160
|
+
|
|
161
|
+
#### Options
|
|
162
|
+
|
|
163
|
+
```tsx
|
|
164
|
+
const options = {
|
|
165
|
+
config: {
|
|
166
|
+
language: "th-TH", // ภาษา
|
|
167
|
+
continuous: true, // ฟังต่อเนื่อง
|
|
168
|
+
interimResults: true, // แสดงผลระหว่างพูด
|
|
71
169
|
},
|
|
72
|
-
|
|
170
|
+
callbacks: {
|
|
171
|
+
onStart: () => {}, // เริ่มฟัง
|
|
172
|
+
onEnd: () => {}, // หยุดฟัง
|
|
173
|
+
onResult: (result) => {}, // ได้ผลลัพธ์
|
|
174
|
+
onError: (error) => {}, // เกิด error
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
#### Return Values
|
|
180
|
+
|
|
181
|
+
```tsx
|
|
182
|
+
const {
|
|
183
|
+
// State
|
|
184
|
+
transcript, // string - ข้อความทั้งหมด
|
|
185
|
+
interimTranscript, // string - ข้อความระหว่างพูด
|
|
186
|
+
finalTranscript, // string - ข้อความที่ยืนยันแล้ว
|
|
187
|
+
isListening, // boolean - กำลังฟังอยู่
|
|
188
|
+
isSupported, // boolean - browser รองรับ
|
|
189
|
+
isMicrophoneAvailable, // boolean - มีไมค์
|
|
190
|
+
error, // string | null - error message
|
|
191
|
+
|
|
192
|
+
// Actions
|
|
193
|
+
startListening, // (config?) => Promise<void>
|
|
194
|
+
stopListening, // () => void
|
|
195
|
+
abortListening, // () => void
|
|
196
|
+
resetTranscript, // () => void
|
|
197
|
+
} = useSpeechRecognition(options);
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### `useSpeechContext()`
|
|
201
|
+
|
|
202
|
+
Hook สำหรับเข้าถึง context ภายใน `SpeechProvider`
|
|
203
|
+
|
|
204
|
+
```tsx
|
|
205
|
+
const {
|
|
206
|
+
// ทุกอย่างจาก useSpeechRecognition +
|
|
207
|
+
isWidgetEnabled, // boolean - Widget เปิดอยู่ไหม
|
|
208
|
+
setWidgetEnabled, // (enabled: boolean) => void
|
|
209
|
+
toggleWidget, // () => void
|
|
210
|
+
} = useSpeechContext();
|
|
73
211
|
```
|
|
212
|
+
|
|
213
|
+
### Components
|
|
214
|
+
|
|
215
|
+
| Component | Description |
|
|
216
|
+
| --------------------- | ----------------------- |
|
|
217
|
+
| `<SpeechWidget>` | Floating button + Modal |
|
|
218
|
+
| `<SpeechButton>` | ปุ่ม Microphone |
|
|
219
|
+
| `<SpeechModal>` | Modal สำหรับพูด |
|
|
220
|
+
| `<TranscriptDisplay>` | แสดงข้อความ |
|
|
221
|
+
|
|
222
|
+
## 🌍 Supported Languages
|
|
223
|
+
|
|
224
|
+
```tsx
|
|
225
|
+
// ตั้งค่าภาษาใน config
|
|
226
|
+
config={{ language: 'th-TH' }}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
| Code | Language |
|
|
230
|
+
| ------- | ------------ |
|
|
231
|
+
| `th-TH` | ไทย |
|
|
232
|
+
| `en-US` | English (US) |
|
|
233
|
+
| `en-GB` | English (UK) |
|
|
234
|
+
| `zh-CN` | 中文 (简体) |
|
|
235
|
+
| `zh-TW` | 中文 (繁體) |
|
|
236
|
+
| `ja-JP` | 日本語 |
|
|
237
|
+
| `ko-KR` | 한국어 |
|
|
238
|
+
| `vi-VN` | Tiếng Việt |
|
|
239
|
+
|
|
240
|
+
## 🌐 Browser Support
|
|
241
|
+
|
|
242
|
+
| Browser | Support |
|
|
243
|
+
| ------- | ---------------- |
|
|
244
|
+
| Chrome | ✅ Full |
|
|
245
|
+
| Edge | ✅ Full |
|
|
246
|
+
| Safari | ⚠️ Partial |
|
|
247
|
+
| Firefox | ❌ Not supported |
|
|
248
|
+
|
|
249
|
+
> ⚠️ Web Speech API ไม่รองรับทุก browser ควรเช็ค `isSupported` ก่อนใช้งาน
|
|
250
|
+
|
|
251
|
+
## 📝 Example: Full Integration
|
|
252
|
+
|
|
253
|
+
```tsx
|
|
254
|
+
import React, { useState } from "react";
|
|
255
|
+
import {
|
|
256
|
+
SpeechProvider,
|
|
257
|
+
useSpeechContext,
|
|
258
|
+
} from "@poovit-banton/speech-recognition-sdk";
|
|
259
|
+
|
|
260
|
+
// Main App
|
|
261
|
+
function App() {
|
|
262
|
+
const [results, setResults] = useState<string[]>([]);
|
|
263
|
+
|
|
264
|
+
const handleGenerate = async (transcript: string) => {
|
|
265
|
+
// เรียก API
|
|
266
|
+
const response = await fetch("/api/ai/process", {
|
|
267
|
+
method: "POST",
|
|
268
|
+
headers: { "Content-Type": "application/json" },
|
|
269
|
+
body: JSON.stringify({ text: transcript }),
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
const data = await response.json();
|
|
273
|
+
return data.result;
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
return (
|
|
277
|
+
<SpeechProvider
|
|
278
|
+
showWidget
|
|
279
|
+
widgetEnabled
|
|
280
|
+
widgetPosition="bottom-left"
|
|
281
|
+
config={{ language: "th-TH", continuous: true }}
|
|
282
|
+
modalTitle="พูดข้อความ"
|
|
283
|
+
generateButtonText="สร้าง"
|
|
284
|
+
onGenerate={handleGenerate}
|
|
285
|
+
onGenerateComplete={(result) => {
|
|
286
|
+
setResults((prev) => [...prev, result]);
|
|
287
|
+
}}
|
|
288
|
+
onGenerateError={(error) => {
|
|
289
|
+
console.error("Error:", error);
|
|
290
|
+
}}
|
|
291
|
+
>
|
|
292
|
+
<MainContent results={results} />
|
|
293
|
+
</SpeechProvider>
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// Content Component
|
|
298
|
+
function MainContent({ results }: { results: string[] }) {
|
|
299
|
+
const { isWidgetEnabled, toggleWidget } = useSpeechContext();
|
|
300
|
+
|
|
301
|
+
return (
|
|
302
|
+
<div style={{ padding: 20 }}>
|
|
303
|
+
<h1>🎙️ Speech Recognition Demo</h1>
|
|
304
|
+
|
|
305
|
+
<button onClick={toggleWidget}>
|
|
306
|
+
{isWidgetEnabled ? "ปิด" : "เปิด"} Voice Widget
|
|
307
|
+
</button>
|
|
308
|
+
|
|
309
|
+
<h2>Results:</h2>
|
|
310
|
+
<ul>
|
|
311
|
+
{results.map((r, i) => (
|
|
312
|
+
<li key={i}>{r}</li>
|
|
313
|
+
))}
|
|
314
|
+
</ul>
|
|
315
|
+
|
|
316
|
+
<p>👈 กดปุ่มไมค์ที่มุมซ้ายล่างเพื่อเริ่มพูด</p>
|
|
317
|
+
</div>
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export default App;
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
## 🔧 Utilities
|
|
325
|
+
|
|
326
|
+
```tsx
|
|
327
|
+
import {
|
|
328
|
+
isSpeechRecognitionSupported,
|
|
329
|
+
requestMicrophonePermission,
|
|
330
|
+
getSupportedLanguages,
|
|
331
|
+
} from "@poovit-banton/speech-recognition-sdk";
|
|
332
|
+
|
|
333
|
+
// เช็คว่า browser รองรับไหม
|
|
334
|
+
if (isSpeechRecognitionSupported()) {
|
|
335
|
+
console.log("รองรับ!");
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// ขอ permission ไมค์
|
|
339
|
+
const hasPermission = await requestMicrophonePermission();
|
|
340
|
+
|
|
341
|
+
// ดูภาษาที่รองรับ
|
|
342
|
+
const languages = getSupportedLanguages();
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
## 📄 License
|
|
346
|
+
|
|
347
|
+
MIT © Poovit Banton
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
Made with ❤️ by DFM Team
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react");function ie(){return typeof window>"u"?!1:!!(window.SpeechRecognition||window.webkitSpeechRecognition)}function ae(){return typeof window>"u"?null:window.SpeechRecognition||window.webkitSpeechRecognition||null}async function se(){try{return(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(a=>a.stop()),!0}catch{return!1}}async function fe(){try{return(await navigator.mediaDevices.enumerateDevices()).some(a=>a.kind==="audioinput")}catch{return!1}}function he(){return["th-TH","en-US","en-GB","en-AU","zh-CN","zh-TW","ja-JP","ko-KR","vi-VN","id-ID","ms-MY","fr-FR","de-DE","es-ES","pt-BR","ru-RU","ar-SA","hi-IN"]}function ge(r){return`${Math.round(r*100)}%`}const xe={language:"th-TH",continuous:!0,interimResults:!0,maxAlternatives:1};function q(r={}){const{config:a={},callbacks:d={}}=r,[i,s]=c.useState(!1),[p,m]=c.useState(""),[_,l]=c.useState(""),[j,v]=c.useState(""),[T,b]=c.useState(null),[y,C]=c.useState(!0),h=c.useRef(null),n=c.useRef(d);c.useEffect(()=>{n.current=d},[d]);const k=ie(),M=c.useCallback(async I=>{if(!k){b("Speech recognition is not supported in this browser");return}if(!await se()){b("Microphone permission denied"),C(!1);return}h.current&&h.current.abort();const z=ae();if(!z)return;const w=new z,S={...xe,...a,...I};w.lang=S.language||"th-TH",w.continuous=S.continuous??!0,w.interimResults=S.interimResults??!0,w.maxAlternatives=S.maxAlternatives??1,w.onstart=()=>{s(!0),b(null),n.current.onStart?.()},w.onend=()=>{s(!1),n.current.onEnd?.()},w.onerror=E=>{const A=me(E.error);b(A),s(!1),n.current.onError?.(A)},w.onresult=E=>{let A="",N="";for(let P=E.resultIndex;P<E.results.length;P++){const F=E.results[P],O=F[0].transcript;F.isFinal?(N+=O,n.current.onResult?.({transcript:O,confidence:F[0].confidence,isFinal:!0})):A+=O}l(A),v(P=>{const F=P+N,O=F+A;return m(O),n.current.onTranscriptChange?.(O),F})},h.current=w,w.start()},[k,a]),R=c.useCallback(()=>{h.current&&h.current.stop()},[]),B=c.useCallback(()=>{h.current&&h.current.abort(),s(!1)},[]),G=c.useCallback(()=>{m(""),l(""),v("")},[]);return c.useEffect(()=>()=>{h.current&&h.current.abort()},[]),{isListening:i,transcript:p,interimTranscript:_,finalTranscript:j,isSupported:k,isMicrophoneAvailable:y,error:T,startListening:M,stopListening:R,abortListening:B,resetTranscript:G}}function me(r){return{"not-allowed":"Microphone permission was denied","no-speech":"No speech was detected","audio-capture":"No microphone was found",network:"Network error occurred",aborted:"Speech recognition was aborted","language-not-supported":"Language is not supported","service-not-allowed":"Speech recognition service is not allowed"}[r]||`Speech recognition error: ${r}`}var Y={exports:{}},L={};var te;function ye(){if(te)return L;te=1;var r=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function d(i,s,p){var m=null;if(p!==void 0&&(m=""+p),s.key!==void 0&&(m=""+s.key),"key"in s){p={};for(var _ in s)_!=="key"&&(p[_]=s[_])}else p=s;return s=p.ref,{$$typeof:r,type:i,key:m,ref:s!==void 0?s:null,props:p}}return L.Fragment=a,L.jsx=d,L.jsxs=d,L}var V={};var re;function _e(){return re||(re=1,process.env.NODE_ENV!=="production"&&(function(){function r(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===E?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case n:return"Fragment";case M:return"Profiler";case k:return"StrictMode";case I:return"Suspense";case H:return"SuspenseList";case S:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case h:return"Portal";case B:return e.displayName||"Context";case R:return(e._context.displayName||"Context")+".Consumer";case G:var o=e.render;return e=e.displayName,e||(e=o.displayName||o.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case z:return o=e.displayName||null,o!==null?o:r(e.type)||"Memo";case w:o=e._payload,e=e._init;try{return r(e(o))}catch{}}return null}function a(e){return""+e}function d(e){try{a(e);var o=!1}catch{o=!0}if(o){o=console;var f=o.error,g=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return f.call(o,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",g),a(e)}}function i(e){if(e===n)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===w)return"<...>";try{var o=r(e);return o?"<"+o+">":"<...>"}catch{return"<...>"}}function s(){var e=A.A;return e===null?null:e.getOwner()}function p(){return Error("react-stack-top-frame")}function m(e){if(N.call(e,"key")){var o=Object.getOwnPropertyDescriptor(e,"key").get;if(o&&o.isReactWarning)return!1}return e.key!==void 0}function _(e,o){function f(){O||(O=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",o))}f.isReactWarning=!0,Object.defineProperty(e,"key",{get:f,configurable:!0})}function l(){var e=r(this.type);return X[e]||(X[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function j(e,o,f,g,W,$){var x=f.ref;return e={$$typeof:C,type:e,key:o,props:f,_owner:g},(x!==void 0?x:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:l}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:W}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:$}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function v(e,o,f,g,W,$){var x=o.children;if(x!==void 0)if(g)if(P(x)){for(g=0;g<x.length;g++)T(x[g]);Object.freeze&&Object.freeze(x)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else T(x);if(N.call(o,"key")){x=r(e);var D=Object.keys(o).filter(function(pe){return pe!=="key"});g=0<D.length?"{key: someKey, "+D.join(": ..., ")+": ...}":"{key: someKey}",ee[x+g]||(D=0<D.length?"{"+D.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
|
-
let props = %s;
|
|
3
|
-
<%s {...props} />
|
|
4
|
-
React keys must be passed directly to JSX without using spread:
|
|
5
|
-
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,g,x,D,x),ee[x+g]=!0)}if(x=null,f!==void 0&&(d(f),x=""+f),m(o)&&(d(o.key),x=""+o.key),"key"in o){f={};for(var Z in o)Z!=="key"&&(f[Z]=o[Z])}else f=o;return x&&_(f,typeof e=="function"?e.displayName||e.name||"Unknown":e),j(e,x,f,s(),W,$)}function T(e){b(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===w&&(e._payload.status==="fulfilled"?b(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function b(e){return typeof e=="object"&&e!==null&&e.$$typeof===C}var y=c,C=Symbol.for("react.transitional.element"),h=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),B=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),H=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),E=Symbol.for("react.client.reference"),A=y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=Object.prototype.hasOwnProperty,P=Array.isArray,F=console.createTask?console.createTask:function(){return null};y={react_stack_bottom_frame:function(e){return e()}};var O,X={},Q=y.react_stack_bottom_frame.bind(y,p)(),K=F(i(p)),ee={};V.Fragment=n,V.jsx=function(e,o,f){var g=1e4>A.recentlyCreatedOwnerStacks++;return v(e,o,f,!1,g?Error("react-stack-top-frame"):Q,g?F(i(e)):K)},V.jsxs=function(e,o,f){var g=1e4>A.recentlyCreatedOwnerStacks++;return v(e,o,f,!0,g?Error("react-stack-top-frame"):Q,g?F(i(e)):K)}})()),V}var oe;function be(){return oe||(oe=1,process.env.NODE_ENV==="production"?Y.exports=ye():Y.exports=_e()),Y.exports}var t=be();const J="data:image/svg+xml,%3csvg%20width='117'%20height='120'%20viewBox='0%200%20117%20120'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%20%3e%3crect%20y='3.63672'%20width='116.364'%20height='116.364'%20rx='58.1818'%20fill='%23FF8800'%20/%3e%3crect%20y='3.63672'%20width='116.364'%20height='116.364'%20rx='58.1818'%20fill='url(%23paint0_radial_6015_131977)'%20/%3e%3crect%20y='3.63672'%20width='116.364'%20height='116.364'%20rx='58.1818'%20fill='url(%23paint1_radial_6015_131977)'%20fill-opacity='0.4'%20/%3e%3crect%20x='0.909091'%20y='0.909091'%20width='114.545'%20height='114.545'%20rx='57.2727'%20fill='%23FF8800'%20/%3e%3crect%20x='0.909091'%20y='0.909091'%20width='114.545'%20height='114.545'%20rx='57.2727'%20fill='url(%23paint2_radial_6015_131977)'%20/%3e%3crect%20x='0.909091'%20y='0.909091'%20width='114.545'%20height='114.545'%20rx='57.2727'%20fill='url(%23paint3_radial_6015_131977)'%20/%3e%3crect%20x='0.909091'%20y='0.909091'%20width='114.545'%20height='114.545'%20rx='57.2727'%20fill='url(%23paint4_radial_6015_131977)'%20fill-opacity='0.3'%20/%3e%3crect%20x='0.909091'%20y='0.909091'%20width='114.545'%20height='114.545'%20rx='57.2727'%20stroke='url(%23paint5_linear_6015_131977)'%20stroke-width='1.81818'%20/%3e%3cg%20opacity='0.4'%3e%3cpath%20d='M27.2731%20104.474C27.0272%2082.1726%209.92689%2079.0823%203.63672%2079.4341C25.2722%2077.2252%2027.1558%2041.2543%2027.2731%2031.9004C27.4055%2041.4094%2029.3496%2077.2327%2050.9094%2079.4379C44.6231%2079.0861%2027.5341%2082.2028%2027.2731%20104.478V104.474Z'%20fill='url(%23paint6_radial_6015_131977)'%20/%3e%3c/g%3e%3cg%20opacity='0.4'%3e%3cg%20clip-path='url(%23clip0_6015_131977)'%3e%3cpath%20d='M87.2716%2014.546C87.4985%2035.1318%20103.284%2037.9843%20109.09%2037.6596C89.1186%2039.6987%2087.3798%2072.9027%2087.2716%2081.5371C87.1494%2072.7595%2085.3547%2039.6917%2065.4533%2037.6561C71.2561%2037.9809%2087.0306%2035.1039%2087.2716%2014.5425L87.2716%2014.546Z'%20fill='url(%23paint7_radial_6015_131977)'%20/%3e%3c/g%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_6015_131977)'%20filter='url(%23filter0_i_6015_131977)'%20%3e%3cpath%20d='M77.1274%2060.0186C77.1274%2058.8913%2076.2654%2058.0293%2075.1381%2058.0293C74.0108%2058.0293%2073.1488%2058.8913%2073.1488%2060.0186C73.1488%2067.7769%2066.8493%2074.0764%2059.0911%2074.0764C51.3328%2074.0764%2045.0333%2067.7769%2045.0333%2060.0186C45.0333%2058.8913%2044.1713%2058.0293%2043.044%2058.0293C41.9167%2058.0293%2041.0547%2058.8913%2041.0547%2060.0186C41.0547%2069.2357%2047.9509%2076.994%2057.1017%2077.9887V83.2935H49.8739C48.7467%2083.2935%2047.8846%2084.1555%2047.8846%2085.2828C47.8846%2086.41%2048.7467%2087.2721%2049.8739%2087.2721H68.3082C69.4354%2087.2721%2070.2975%2086.41%2070.2975%2085.2828C70.2975%2084.1555%2069.4354%2083.2935%2068.3082%2083.2935H61.0804V77.9887C70.2312%2076.994%2077.1274%2069.2357%2077.1274%2060.0186Z'%20fill='white'%20/%3e%3cpath%20d='M59.0933%2030.9082C52.9928%2030.9082%2048.0195%2035.8815%2048.0195%2041.982V59.9521C48.0195%2066.1189%2052.9928%2071.0259%2059.0933%2071.0922C65.1939%2071.0922%2070.1671%2066.1189%2070.1671%2060.0184V41.982C70.1671%2035.8815%2065.1939%2030.9082%2059.0933%2030.9082Z'%20fill='white'%20/%3e%3c/g%3e%3cdefs%3e%3cfilter%20id='filter0_i_6015_131977'%20x='30.9102'%20y='30.9082'%20width='56.3633'%20height='58.1815'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%20%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'%20/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'%20/%3e%3cfeColorMatrix%20in='SourceAlpha'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20127%200'%20result='hardAlpha'%20/%3e%3cfeOffset%20dy='1.81818'%20/%3e%3cfeGaussianBlur%20stdDeviation='0.909091'%20/%3e%3cfeComposite%20in2='hardAlpha'%20operator='arithmetic'%20k2='-1'%20k3='1'%20/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%200.937087%200%200%200%200%200.449802%200%200%200%200%200%200%200%200%201%200'%20/%3e%3cfeBlend%20mode='normal'%20in2='shape'%20result='effect1_innerShadow_6015_131977'%20/%3e%3c/filter%3e%3cradialGradient%20id='paint0_radial_6015_131977'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='matrix(-107.107%20232.727%20-57.2274%20-199.178%20110.413%20-150.909)'%20gradientUnits='userSpaceOnUse'%20%3e%3cstop%20offset='0.67589'%20stop-color='%23FF7A00'%20/%3e%3cstop%20offset='1'%20stop-color='%23DBFF00'%20stop-opacity='0.38'%20/%3e%3c/radialGradient%3e%3cradialGradient%20id='paint1_radial_6015_131977'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='matrix(25.124%20-134.545%2037.8392%2053.435%2043.6364%20120)'%20gradientUnits='userSpaceOnUse'%20%3e%3cstop%20stop-color='white'%20stop-opacity='0.73'%20/%3e%3cstop%20offset='1'%20stop-color='white'%20stop-opacity='0.12'%20/%3e%3c/radialGradient%3e%3cradialGradient%20id='paint2_radial_6015_131977'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='matrix(-107.107%20232.727%20-57.2274%20-199.178%20110.413%20-154.545)'%20gradientUnits='userSpaceOnUse'%20%3e%3cstop%20offset='0.67589'%20stop-color='%23FF7A00'%20/%3e%3cstop%20offset='1'%20stop-color='%23FFC700'%20stop-opacity='0.38'%20/%3e%3c/radialGradient%3e%3cradialGradient%20id='paint3_radial_6015_131977'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='matrix(45.6198%20-45.4545%2027.7487%20210.613%206.61157%20116.364)'%20gradientUnits='userSpaceOnUse'%20%3e%3cstop%20stop-color='%23F6FB22'%20stop-opacity='0.51'%20/%3e%3cstop%20offset='1'%20stop-color='%23FF9E45'%20stop-opacity='0'%20/%3e%3c/radialGradient%3e%3cradialGradient%20id='paint4_radial_6015_131977'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='matrix(-36.3636%2036.3636%20-36.3636%20-275%20112.397%2036.3637)'%20gradientUnits='userSpaceOnUse'%20%3e%3cstop%20stop-color='white'%20/%3e%3cstop%20offset='1'%20stop-color='white'%20stop-opacity='0'%20/%3e%3c/radialGradient%3e%3clinearGradient%20id='paint5_linear_6015_131977'%20x1='58.1818'%20y1='0'%20x2='58.1818'%20y2='116.364'%20gradientUnits='userSpaceOnUse'%20%3e%3cstop%20stop-color='%23FF7A00'%20/%3e%3cstop%20offset='1'%20stop-color='%23FF7A00'%20stop-opacity='0'%20/%3e%3c/linearGradient%3e%3cradialGradient%20id='paint6_radial_6015_131977'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='matrix(10.2066%20-83.9173%2015.3722%2033.328%2021.364%20104.478)'%20gradientUnits='userSpaceOnUse'%20%3e%3cstop%20stop-color='white'%20/%3e%3cstop%20offset='1'%20stop-color='white'%20stop-opacity='0.2'%20/%3e%3c/radialGradient%3e%3cradialGradient%20id='paint7_radial_6015_131977'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='matrix(-9.42152%2077.4625%20-14.1898%20-30.7644%2092.7261%2014.5425)'%20gradientUnits='userSpaceOnUse'%20%3e%3cstop%20stop-color='white'%20/%3e%3cstop%20offset='1'%20stop-color='white'%20stop-opacity='0.1'%20/%3e%3c/radialGradient%3e%3cclipPath%20id='clip0_6015_131977'%3e%3crect%20width='43.6366'%20height='66.9911'%20fill='white'%20transform='translate(109.09%2081.5371)%20rotate(180)'%20/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_6015_131977'%3e%3crect%20width='56.3636'%20height='56.3636'%20fill='white'%20transform='translate(30.9102%2030.9082)'%20/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",le="data:image/svg+xml,%3csvg%20width='117'%20height='120'%20viewBox='0%200%20117%20120'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%20%3e%3cg%20filter='url(%23filter0_i_6104_131024)'%3e%3crect%20y='3.63672'%20width='116.364'%20height='116.364'%20rx='58.1818'%20fill='%23FF8800'%20/%3e%3crect%20y='3.63672'%20width='116.364'%20height='116.364'%20rx='58.1818'%20fill='url(%23paint0_radial_6104_131024)'%20/%3e%3crect%20y='3.63672'%20width='116.364'%20height='116.364'%20rx='58.1818'%20fill='url(%23paint1_radial_6104_131024)'%20fill-opacity='0.4'%20/%3e%3c/g%3e%3crect%20x='1.08067'%20y='1.08067'%20width='114.202'%20height='114.202'%20rx='57.1011'%20fill='white'%20stroke='url(%23paint2_linear_6104_131024)'%20stroke-width='2.16135'%20/%3e%3cg%20filter='url(%23filter1_d_6104_131024)'%3e%3cpath%20d='M49.7119%2041.0605C52.0993%2041.0605%2054.0352%2042.9964%2054.0352%2045.3838V75.6426C54.0351%2078.0299%2052.0992%2079.9648%2049.7119%2079.9648H41.0664C38.6793%2079.9646%2036.7442%2078.0297%2036.7441%2075.6426V45.3838C36.7441%2042.9966%2038.6793%2041.0608%2041.0664%2041.0605H49.7119ZM75.6484%2041.0605C78.0358%2041.0605%2079.9707%2042.9964%2079.9707%2045.3838V75.6426C79.9706%2078.0299%2078.0357%2079.9648%2075.6484%2079.9648H67.0029C64.6157%2079.9648%2062.6808%2078.0298%2062.6807%2075.6426V45.3838C62.6807%2042.9965%2064.6156%2041.0606%2067.0029%2041.0605H75.6484Z'%20fill='%23FBEDD9'%20/%3e%3cpath%20d='M49.7119%2041.0605C52.0993%2041.0605%2054.0352%2042.9964%2054.0352%2045.3838V75.6426C54.0351%2078.0299%2052.0992%2079.9648%2049.7119%2079.9648H41.0664C38.6793%2079.9646%2036.7442%2078.0297%2036.7441%2075.6426V45.3838C36.7441%2042.9966%2038.6793%2041.0608%2041.0664%2041.0605H49.7119ZM75.6484%2041.0605C78.0358%2041.0605%2079.9707%2042.9964%2079.9707%2045.3838V75.6426C79.9706%2078.0299%2078.0357%2079.9648%2075.6484%2079.9648H67.0029C64.6157%2079.9648%2062.6808%2078.0298%2062.6807%2075.6426V45.3838C62.6807%2042.9965%2064.6156%2041.0606%2067.0029%2041.0605H75.6484Z'%20fill='%23FF7A00'%20/%3e%3cpath%20d='M49.7119%2041.0605C52.0993%2041.0605%2054.0352%2042.9964%2054.0352%2045.3838V75.6426C54.0351%2078.0299%2052.0992%2079.9648%2049.7119%2079.9648H41.0664C38.6793%2079.9646%2036.7442%2078.0297%2036.7441%2075.6426V45.3838C36.7441%2042.9966%2038.6793%2041.0608%2041.0664%2041.0605H49.7119ZM75.6484%2041.0605C78.0358%2041.0605%2079.9707%2042.9964%2079.9707%2045.3838V75.6426C79.9706%2078.0299%2078.0357%2079.9648%2075.6484%2079.9648H67.0029C64.6157%2079.9648%2062.6808%2078.0298%2062.6807%2075.6426V45.3838C62.6807%2042.9965%2064.6156%2041.0606%2067.0029%2041.0605H75.6484Z'%20fill='url(%23paint3_radial_6104_131024)'%20fill-opacity='0.4'%20/%3e%3c/g%3e%3cdefs%3e%3cfilter%20id='filter0_i_6104_131024'%20x='0'%20y='3.63672'%20width='116.363'%20height='116.363'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%20%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'%20/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'%20/%3e%3cfeColorMatrix%20in='SourceAlpha'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20127%200'%20result='hardAlpha'%20/%3e%3cfeOffset%20/%3e%3cfeGaussianBlur%20stdDeviation='3.63636'%20/%3e%3cfeComposite%20in2='hardAlpha'%20operator='arithmetic'%20k2='-1'%20k3='1'%20/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%201%200%200%200%200%201%200%200%200%200%201%200%200%200%201%200'%20/%3e%3cfeBlend%20mode='normal'%20in2='shape'%20result='effect1_innerShadow_6104_131024'%20/%3e%3c/filter%3e%3cfilter%20id='filter1_d_6104_131024'%20x='34.5828'%20y='38.8992'%20width='47.5493'%20height='43.227'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%20%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'%20/%3e%3cfeColorMatrix%20in='SourceAlpha'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20127%200'%20result='hardAlpha'%20/%3e%3cfeOffset%20/%3e%3cfeGaussianBlur%20stdDeviation='1.08067'%20/%3e%3cfeComposite%20in2='hardAlpha'%20operator='out'%20/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%201%200%200%200%200%200.565%200%200%200%200%200%200%200%200%201%200'%20/%3e%3cfeBlend%20mode='normal'%20in2='BackgroundImageFix'%20result='effect1_dropShadow_6104_131024'%20/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='effect1_dropShadow_6104_131024'%20result='shape'%20/%3e%3c/filter%3e%3cradialGradient%20id='paint0_radial_6104_131024'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='matrix(-107.107%20232.727%20-57.2274%20-199.178%20110.413%20-150.909)'%20gradientUnits='userSpaceOnUse'%20%3e%3cstop%20offset='0.67589'%20stop-color='%23FF7A00'%20/%3e%3cstop%20offset='1'%20stop-color='%23DBFF00'%20stop-opacity='0.38'%20/%3e%3c/radialGradient%3e%3cradialGradient%20id='paint1_radial_6104_131024'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='matrix(25.124%20-134.545%2037.8392%2053.435%2043.6364%20120)'%20gradientUnits='userSpaceOnUse'%20%3e%3cstop%20stop-color='white'%20stop-opacity='0.73'%20/%3e%3cstop%20offset='1'%20stop-color='white'%20stop-opacity='0.12'%20/%3e%3c/radialGradient%3e%3clinearGradient%20id='paint2_linear_6104_131024'%20x1='58.1818'%20y1='0'%20x2='58.1818'%20y2='116.364'%20gradientUnits='userSpaceOnUse'%20%3e%3cstop%20stop-color='%23FF7A00'%20/%3e%3cstop%20offset='0.515'%20stop-color='%23FCEAD2'%20/%3e%3cstop%20offset='1'%20stop-color='%23FF7A00'%20/%3e%3c/linearGradient%3e%3cradialGradient%20id='paint3_radial_6104_131024'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='matrix(9.33301%20-44.9831%2014.0564%2017.8651%2052.9541%2079.9648)'%20gradientUnits='userSpaceOnUse'%20%3e%3cstop%20stop-color='white'%20stop-opacity='0.73'%20/%3e%3cstop%20offset='1'%20stop-color='white'%20stop-opacity='0.12'%20/%3e%3c/radialGradient%3e%3c/defs%3e%3c/svg%3e",we="data:image/svg+xml,%3csvg%20width='640'%20height='640'%20viewBox='0%200%20640%20640'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20filter='url(%23filter0_f_5207_91652)'%3e%3cg%20filter='url(%23filter1_f_5207_91652)'%3e%3crect%20x='45'%20y='45'%20width='550'%20height='550'%20rx='275'%20fill='url(%23paint0_linear_5207_91652)'/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cfilter%20id='filter0_f_5207_91652'%20x='-32'%20y='-32'%20width='704'%20height='704'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'/%3e%3cfeGaussianBlur%20stdDeviation='16'%20result='effect1_foregroundBlur_5207_91652'/%3e%3c/filter%3e%3cfilter%20id='filter1_f_5207_91652'%20x='41.4052'%20y='41.4052'%20width='557.19'%20height='557.19'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'/%3e%3cfeGaussianBlur%20stdDeviation='1.79739'%20result='effect1_foregroundBlur_5207_91652'/%3e%3c/filter%3e%3clinearGradient%20id='paint0_linear_5207_91652'%20x1='320'%20y1='45'%20x2='326.74'%20y2='605.784'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0.177383'%20stop-color='%23EBDDFF'/%3e%3cstop%20offset='0.755511'%20stop-color='%23FEBB63'/%3e%3cstop%20offset='1'%20stop-color='%23FF7A00'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",u={overlay:{position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.5)",backdropFilter:"blur(8px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999,padding:"20px"},modal:{backgroundColor:"#ffffff",borderRadius:"32px",padding:"40px",width:"100%",maxWidth:"480px",maxHeight:"90vh",overflow:"auto",boxShadow:"0 25px 80px rgba(0, 0, 0, 0.15)",position:"relative"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"32px"},title:{fontSize:"18px",fontWeight:600,color:"#1f2937",margin:0,display:"flex",alignItems:"center",gap:"8px"},closeButton:{background:"transparent",border:"none",color:"#9ca3af",cursor:"pointer",padding:"8px",borderRadius:"8px",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s"},micSection:{display:"flex",flexDirection:"column",alignItems:"center",gap:"24px",marginBottom:"32px",position:"relative"},bgCircle:{position:"absolute",width:"280px",height:"280px",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:0,opacity:.8,transition:"opacity 0.3s ease"},micButton:{width:"120px",height:"120px",borderRadius:"50%",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",background:"transparent",padding:0,position:"relative",zIndex:1,transition:"transform 0.2s ease"},micImage:{width:"100%",height:"100%",objectFit:"contain"},statusText:{fontSize:"16px",fontWeight:500,color:"#6b7280",textAlign:"center",position:"relative",zIndex:1},statusTextActive:{color:"#FF7A00",fontWeight:600},transcriptBox:{background:"#f9fafb",border:"1px solid #e5e7eb",borderRadius:"16px",padding:"20px",minHeight:"100px",maxHeight:"160px",overflow:"auto",marginBottom:"24px"},transcriptText:{fontSize:"15px",lineHeight:1.7,color:"#1f2937",margin:0,wordWrap:"break-word"},placeholderText:{fontSize:"14px",color:"#9ca3af",textAlign:"center",margin:0,padding:"16px 0"},actions:{display:"flex",justifyContent:"center"},generateButton:{padding:"14px 48px",borderRadius:"100px",border:"2px solid #9333ea",background:"transparent",color:"#9333ea",fontSize:"15px",fontWeight:600,cursor:"pointer",transition:"all 0.2s ease",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},generateButtonDisabled:{opacity:.4,cursor:"not-allowed",borderColor:"#d1d5db",color:"#9ca3af"},loadingOverlay:{position:"absolute",inset:0,background:"rgba(255, 255, 255, 0.95)",borderRadius:"32px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"24px",zIndex:10},loadingBars:{display:"flex",flexDirection:"column",gap:"12px",width:"200px"},loadingBar:{height:"12px",borderRadius:"6px",background:"linear-gradient(90deg, #e5e7eb 0%, #d1d5db 50%, #e5e7eb 100%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s ease-in-out infinite"},loadingText:{fontSize:"16px",fontWeight:600,color:"#6b7280",display:"flex",alignItems:"center",gap:"8px"},sparkleIcon:{color:"#9333ea"},footer:{marginTop:"24px",textAlign:"center",fontSize:"12px",color:"#9ca3af"}},ve=`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react"),e=require("react/jsx-runtime");function E(){return typeof window>"u"?!1:!!(window.SpeechRecognition||window.webkitSpeechRecognition)}function V(){return typeof window>"u"?null:window.SpeechRecognition||window.webkitSpeechRecognition||null}async function L(){try{return(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(a=>a.stop()),!0}catch{return!1}}async function q(){try{return(await navigator.mediaDevices.enumerateDevices()).some(a=>a.kind==="audioinput")}catch{return!1}}function $(){return["th-TH","en-US","en-GB","en-AU","zh-CN","zh-TW","ja-JP","ko-KR","vi-VN","id-ID","ms-MY","fr-FR","de-DE","es-ES","pt-BR","ru-RU","ar-SA","hi-IN"]}function Y(t){return`${Math.round(t*100)}%`}const J={language:"th-TH",continuous:!0,interimResults:!0,maxAlternatives:1};function O(t={}){const{config:a={},callbacks:c={}}=t,[s,l]=i.useState(!1),[p,g]=i.useState(""),[w,o]=i.useState(""),[b,x]=i.useState(""),[S,u]=i.useState(null),[f,_]=i.useState(!0),d=i.useRef(null),r=i.useRef(c);i.useEffect(()=>{r.current=c},[c]);const y=E(),T=i.useCallback(async B=>{if(!y){u("Speech recognition is not supported in this browser");return}if(!await L()){u("Microphone permission denied"),_(!1);return}d.current&&d.current.abort();const U=V();if(!U)return;const m=new U,h={...J,...a,...B};m.lang=h.language||"th-TH",m.continuous=h.continuous??!0,m.interimResults=h.interimResults??!0,m.maxAlternatives=h.maxAlternatives??1,m.onstart=()=>{l(!0),u(null),r.current.onStart?.()},m.onend=()=>{l(!1),r.current.onEnd?.()},m.onerror=v=>{const F=K(v.error);u(F),l(!1),r.current.onError?.(F)},m.onresult=v=>{let F="",D="";for(let A=v.resultIndex;A<v.results.length;A++){const M=v.results[A],I=M[0].transcript;M.isFinal?(D+=I,r.current.onResult?.({transcript:I,confidence:M[0].confidence,isFinal:!0})):F+=I}o(F),x(A=>{const M=A+D,I=M+F;return g(I),r.current.onTranscriptChange?.(I),M})},d.current=m,m.start()},[y,a]),C=i.useCallback(()=>{d.current&&d.current.stop()},[]),j=i.useCallback(()=>{d.current&&d.current.abort(),l(!1)},[]),R=i.useCallback(()=>{g(""),o(""),x("")},[]);return i.useEffect(()=>()=>{d.current&&d.current.abort()},[]),{isListening:s,transcript:p,interimTranscript:w,finalTranscript:b,isSupported:y,isMicrophoneAvailable:f,error:S,startListening:T,stopListening:C,abortListening:j,resetTranscript:R}}function K(t){return{"not-allowed":"Microphone permission was denied","no-speech":"No speech was detected","audio-capture":"No microphone was found",network:"Network error occurred",aborted:"Speech recognition was aborted","language-not-supported":"Language is not supported","service-not-allowed":"Speech recognition service is not allowed"}[t]||`Speech recognition error: ${t}`}const G="data:image/svg+xml,%3csvg%20width='117'%20height='120'%20viewBox='0%200%20117%20120'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%20%3e%3crect%20y='3.63672'%20width='116.364'%20height='116.364'%20rx='58.1818'%20fill='%23FF8800'%20/%3e%3crect%20y='3.63672'%20width='116.364'%20height='116.364'%20rx='58.1818'%20fill='url(%23paint0_radial_6015_131977)'%20/%3e%3crect%20y='3.63672'%20width='116.364'%20height='116.364'%20rx='58.1818'%20fill='url(%23paint1_radial_6015_131977)'%20fill-opacity='0.4'%20/%3e%3crect%20x='0.909091'%20y='0.909091'%20width='114.545'%20height='114.545'%20rx='57.2727'%20fill='%23FF8800'%20/%3e%3crect%20x='0.909091'%20y='0.909091'%20width='114.545'%20height='114.545'%20rx='57.2727'%20fill='url(%23paint2_radial_6015_131977)'%20/%3e%3crect%20x='0.909091'%20y='0.909091'%20width='114.545'%20height='114.545'%20rx='57.2727'%20fill='url(%23paint3_radial_6015_131977)'%20/%3e%3crect%20x='0.909091'%20y='0.909091'%20width='114.545'%20height='114.545'%20rx='57.2727'%20fill='url(%23paint4_radial_6015_131977)'%20fill-opacity='0.3'%20/%3e%3crect%20x='0.909091'%20y='0.909091'%20width='114.545'%20height='114.545'%20rx='57.2727'%20stroke='url(%23paint5_linear_6015_131977)'%20stroke-width='1.81818'%20/%3e%3cg%20opacity='0.4'%3e%3cpath%20d='M27.2731%20104.474C27.0272%2082.1726%209.92689%2079.0823%203.63672%2079.4341C25.2722%2077.2252%2027.1558%2041.2543%2027.2731%2031.9004C27.4055%2041.4094%2029.3496%2077.2327%2050.9094%2079.4379C44.6231%2079.0861%2027.5341%2082.2028%2027.2731%20104.478V104.474Z'%20fill='url(%23paint6_radial_6015_131977)'%20/%3e%3c/g%3e%3cg%20opacity='0.4'%3e%3cg%20clip-path='url(%23clip0_6015_131977)'%3e%3cpath%20d='M87.2716%2014.546C87.4985%2035.1318%20103.284%2037.9843%20109.09%2037.6596C89.1186%2039.6987%2087.3798%2072.9027%2087.2716%2081.5371C87.1494%2072.7595%2085.3547%2039.6917%2065.4533%2037.6561C71.2561%2037.9809%2087.0306%2035.1039%2087.2716%2014.5425L87.2716%2014.546Z'%20fill='url(%23paint7_radial_6015_131977)'%20/%3e%3c/g%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_6015_131977)'%20filter='url(%23filter0_i_6015_131977)'%20%3e%3cpath%20d='M77.1274%2060.0186C77.1274%2058.8913%2076.2654%2058.0293%2075.1381%2058.0293C74.0108%2058.0293%2073.1488%2058.8913%2073.1488%2060.0186C73.1488%2067.7769%2066.8493%2074.0764%2059.0911%2074.0764C51.3328%2074.0764%2045.0333%2067.7769%2045.0333%2060.0186C45.0333%2058.8913%2044.1713%2058.0293%2043.044%2058.0293C41.9167%2058.0293%2041.0547%2058.8913%2041.0547%2060.0186C41.0547%2069.2357%2047.9509%2076.994%2057.1017%2077.9887V83.2935H49.8739C48.7467%2083.2935%2047.8846%2084.1555%2047.8846%2085.2828C47.8846%2086.41%2048.7467%2087.2721%2049.8739%2087.2721H68.3082C69.4354%2087.2721%2070.2975%2086.41%2070.2975%2085.2828C70.2975%2084.1555%2069.4354%2083.2935%2068.3082%2083.2935H61.0804V77.9887C70.2312%2076.994%2077.1274%2069.2357%2077.1274%2060.0186Z'%20fill='white'%20/%3e%3cpath%20d='M59.0933%2030.9082C52.9928%2030.9082%2048.0195%2035.8815%2048.0195%2041.982V59.9521C48.0195%2066.1189%2052.9928%2071.0259%2059.0933%2071.0922C65.1939%2071.0922%2070.1671%2066.1189%2070.1671%2060.0184V41.982C70.1671%2035.8815%2065.1939%2030.9082%2059.0933%2030.9082Z'%20fill='white'%20/%3e%3c/g%3e%3cdefs%3e%3cfilter%20id='filter0_i_6015_131977'%20x='30.9102'%20y='30.9082'%20width='56.3633'%20height='58.1815'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%20%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'%20/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'%20/%3e%3cfeColorMatrix%20in='SourceAlpha'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20127%200'%20result='hardAlpha'%20/%3e%3cfeOffset%20dy='1.81818'%20/%3e%3cfeGaussianBlur%20stdDeviation='0.909091'%20/%3e%3cfeComposite%20in2='hardAlpha'%20operator='arithmetic'%20k2='-1'%20k3='1'%20/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%200.937087%200%200%200%200%200.449802%200%200%200%200%200%200%200%200%201%200'%20/%3e%3cfeBlend%20mode='normal'%20in2='shape'%20result='effect1_innerShadow_6015_131977'%20/%3e%3c/filter%3e%3cradialGradient%20id='paint0_radial_6015_131977'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='matrix(-107.107%20232.727%20-57.2274%20-199.178%20110.413%20-150.909)'%20gradientUnits='userSpaceOnUse'%20%3e%3cstop%20offset='0.67589'%20stop-color='%23FF7A00'%20/%3e%3cstop%20offset='1'%20stop-color='%23DBFF00'%20stop-opacity='0.38'%20/%3e%3c/radialGradient%3e%3cradialGradient%20id='paint1_radial_6015_131977'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='matrix(25.124%20-134.545%2037.8392%2053.435%2043.6364%20120)'%20gradientUnits='userSpaceOnUse'%20%3e%3cstop%20stop-color='white'%20stop-opacity='0.73'%20/%3e%3cstop%20offset='1'%20stop-color='white'%20stop-opacity='0.12'%20/%3e%3c/radialGradient%3e%3cradialGradient%20id='paint2_radial_6015_131977'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='matrix(-107.107%20232.727%20-57.2274%20-199.178%20110.413%20-154.545)'%20gradientUnits='userSpaceOnUse'%20%3e%3cstop%20offset='0.67589'%20stop-color='%23FF7A00'%20/%3e%3cstop%20offset='1'%20stop-color='%23FFC700'%20stop-opacity='0.38'%20/%3e%3c/radialGradient%3e%3cradialGradient%20id='paint3_radial_6015_131977'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='matrix(45.6198%20-45.4545%2027.7487%20210.613%206.61157%20116.364)'%20gradientUnits='userSpaceOnUse'%20%3e%3cstop%20stop-color='%23F6FB22'%20stop-opacity='0.51'%20/%3e%3cstop%20offset='1'%20stop-color='%23FF9E45'%20stop-opacity='0'%20/%3e%3c/radialGradient%3e%3cradialGradient%20id='paint4_radial_6015_131977'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='matrix(-36.3636%2036.3636%20-36.3636%20-275%20112.397%2036.3637)'%20gradientUnits='userSpaceOnUse'%20%3e%3cstop%20stop-color='white'%20/%3e%3cstop%20offset='1'%20stop-color='white'%20stop-opacity='0'%20/%3e%3c/radialGradient%3e%3clinearGradient%20id='paint5_linear_6015_131977'%20x1='58.1818'%20y1='0'%20x2='58.1818'%20y2='116.364'%20gradientUnits='userSpaceOnUse'%20%3e%3cstop%20stop-color='%23FF7A00'%20/%3e%3cstop%20offset='1'%20stop-color='%23FF7A00'%20stop-opacity='0'%20/%3e%3c/linearGradient%3e%3cradialGradient%20id='paint6_radial_6015_131977'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='matrix(10.2066%20-83.9173%2015.3722%2033.328%2021.364%20104.478)'%20gradientUnits='userSpaceOnUse'%20%3e%3cstop%20stop-color='white'%20/%3e%3cstop%20offset='1'%20stop-color='white'%20stop-opacity='0.2'%20/%3e%3c/radialGradient%3e%3cradialGradient%20id='paint7_radial_6015_131977'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='matrix(-9.42152%2077.4625%20-14.1898%20-30.7644%2092.7261%2014.5425)'%20gradientUnits='userSpaceOnUse'%20%3e%3cstop%20stop-color='white'%20/%3e%3cstop%20offset='1'%20stop-color='white'%20stop-opacity='0.1'%20/%3e%3c/radialGradient%3e%3cclipPath%20id='clip0_6015_131977'%3e%3crect%20width='43.6366'%20height='66.9911'%20fill='white'%20transform='translate(109.09%2081.5371)%20rotate(180)'%20/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_6015_131977'%3e%3crect%20width='56.3636'%20height='56.3636'%20fill='white'%20transform='translate(30.9102%2030.9082)'%20/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",P="data:image/svg+xml,%3csvg%20width='117'%20height='120'%20viewBox='0%200%20117%20120'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%20%3e%3cg%20filter='url(%23filter0_i_6104_131024)'%3e%3crect%20y='3.63672'%20width='116.364'%20height='116.364'%20rx='58.1818'%20fill='%23FF8800'%20/%3e%3crect%20y='3.63672'%20width='116.364'%20height='116.364'%20rx='58.1818'%20fill='url(%23paint0_radial_6104_131024)'%20/%3e%3crect%20y='3.63672'%20width='116.364'%20height='116.364'%20rx='58.1818'%20fill='url(%23paint1_radial_6104_131024)'%20fill-opacity='0.4'%20/%3e%3c/g%3e%3crect%20x='1.08067'%20y='1.08067'%20width='114.202'%20height='114.202'%20rx='57.1011'%20fill='white'%20stroke='url(%23paint2_linear_6104_131024)'%20stroke-width='2.16135'%20/%3e%3cg%20filter='url(%23filter1_d_6104_131024)'%3e%3cpath%20d='M49.7119%2041.0605C52.0993%2041.0605%2054.0352%2042.9964%2054.0352%2045.3838V75.6426C54.0351%2078.0299%2052.0992%2079.9648%2049.7119%2079.9648H41.0664C38.6793%2079.9646%2036.7442%2078.0297%2036.7441%2075.6426V45.3838C36.7441%2042.9966%2038.6793%2041.0608%2041.0664%2041.0605H49.7119ZM75.6484%2041.0605C78.0358%2041.0605%2079.9707%2042.9964%2079.9707%2045.3838V75.6426C79.9706%2078.0299%2078.0357%2079.9648%2075.6484%2079.9648H67.0029C64.6157%2079.9648%2062.6808%2078.0298%2062.6807%2075.6426V45.3838C62.6807%2042.9965%2064.6156%2041.0606%2067.0029%2041.0605H75.6484Z'%20fill='%23FBEDD9'%20/%3e%3cpath%20d='M49.7119%2041.0605C52.0993%2041.0605%2054.0352%2042.9964%2054.0352%2045.3838V75.6426C54.0351%2078.0299%2052.0992%2079.9648%2049.7119%2079.9648H41.0664C38.6793%2079.9646%2036.7442%2078.0297%2036.7441%2075.6426V45.3838C36.7441%2042.9966%2038.6793%2041.0608%2041.0664%2041.0605H49.7119ZM75.6484%2041.0605C78.0358%2041.0605%2079.9707%2042.9964%2079.9707%2045.3838V75.6426C79.9706%2078.0299%2078.0357%2079.9648%2075.6484%2079.9648H67.0029C64.6157%2079.9648%2062.6808%2078.0298%2062.6807%2075.6426V45.3838C62.6807%2042.9965%2064.6156%2041.0606%2067.0029%2041.0605H75.6484Z'%20fill='%23FF7A00'%20/%3e%3cpath%20d='M49.7119%2041.0605C52.0993%2041.0605%2054.0352%2042.9964%2054.0352%2045.3838V75.6426C54.0351%2078.0299%2052.0992%2079.9648%2049.7119%2079.9648H41.0664C38.6793%2079.9646%2036.7442%2078.0297%2036.7441%2075.6426V45.3838C36.7441%2042.9966%2038.6793%2041.0608%2041.0664%2041.0605H49.7119ZM75.6484%2041.0605C78.0358%2041.0605%2079.9707%2042.9964%2079.9707%2045.3838V75.6426C79.9706%2078.0299%2078.0357%2079.9648%2075.6484%2079.9648H67.0029C64.6157%2079.9648%2062.6808%2078.0298%2062.6807%2075.6426V45.3838C62.6807%2042.9965%2064.6156%2041.0606%2067.0029%2041.0605H75.6484Z'%20fill='url(%23paint3_radial_6104_131024)'%20fill-opacity='0.4'%20/%3e%3c/g%3e%3cdefs%3e%3cfilter%20id='filter0_i_6104_131024'%20x='0'%20y='3.63672'%20width='116.363'%20height='116.363'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%20%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'%20/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'%20/%3e%3cfeColorMatrix%20in='SourceAlpha'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20127%200'%20result='hardAlpha'%20/%3e%3cfeOffset%20/%3e%3cfeGaussianBlur%20stdDeviation='3.63636'%20/%3e%3cfeComposite%20in2='hardAlpha'%20operator='arithmetic'%20k2='-1'%20k3='1'%20/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%201%200%200%200%200%201%200%200%200%200%201%200%200%200%201%200'%20/%3e%3cfeBlend%20mode='normal'%20in2='shape'%20result='effect1_innerShadow_6104_131024'%20/%3e%3c/filter%3e%3cfilter%20id='filter1_d_6104_131024'%20x='34.5828'%20y='38.8992'%20width='47.5493'%20height='43.227'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%20%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'%20/%3e%3cfeColorMatrix%20in='SourceAlpha'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20127%200'%20result='hardAlpha'%20/%3e%3cfeOffset%20/%3e%3cfeGaussianBlur%20stdDeviation='1.08067'%20/%3e%3cfeComposite%20in2='hardAlpha'%20operator='out'%20/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%201%200%200%200%200%200.565%200%200%200%200%200%200%200%200%201%200'%20/%3e%3cfeBlend%20mode='normal'%20in2='BackgroundImageFix'%20result='effect1_dropShadow_6104_131024'%20/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='effect1_dropShadow_6104_131024'%20result='shape'%20/%3e%3c/filter%3e%3cradialGradient%20id='paint0_radial_6104_131024'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='matrix(-107.107%20232.727%20-57.2274%20-199.178%20110.413%20-150.909)'%20gradientUnits='userSpaceOnUse'%20%3e%3cstop%20offset='0.67589'%20stop-color='%23FF7A00'%20/%3e%3cstop%20offset='1'%20stop-color='%23DBFF00'%20stop-opacity='0.38'%20/%3e%3c/radialGradient%3e%3cradialGradient%20id='paint1_radial_6104_131024'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='matrix(25.124%20-134.545%2037.8392%2053.435%2043.6364%20120)'%20gradientUnits='userSpaceOnUse'%20%3e%3cstop%20stop-color='white'%20stop-opacity='0.73'%20/%3e%3cstop%20offset='1'%20stop-color='white'%20stop-opacity='0.12'%20/%3e%3c/radialGradient%3e%3clinearGradient%20id='paint2_linear_6104_131024'%20x1='58.1818'%20y1='0'%20x2='58.1818'%20y2='116.364'%20gradientUnits='userSpaceOnUse'%20%3e%3cstop%20stop-color='%23FF7A00'%20/%3e%3cstop%20offset='0.515'%20stop-color='%23FCEAD2'%20/%3e%3cstop%20offset='1'%20stop-color='%23FF7A00'%20/%3e%3c/linearGradient%3e%3cradialGradient%20id='paint3_radial_6104_131024'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='matrix(9.33301%20-44.9831%2014.0564%2017.8651%2052.9541%2079.9648)'%20gradientUnits='userSpaceOnUse'%20%3e%3cstop%20stop-color='white'%20stop-opacity='0.73'%20/%3e%3cstop%20offset='1'%20stop-color='white'%20stop-opacity='0.12'%20/%3e%3c/radialGradient%3e%3c/defs%3e%3c/svg%3e",Q="data:image/svg+xml,%3csvg%20width='640'%20height='640'%20viewBox='0%200%20640%20640'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20filter='url(%23filter0_f_5207_91652)'%3e%3cg%20filter='url(%23filter1_f_5207_91652)'%3e%3crect%20x='45'%20y='45'%20width='550'%20height='550'%20rx='275'%20fill='url(%23paint0_linear_5207_91652)'/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cfilter%20id='filter0_f_5207_91652'%20x='-32'%20y='-32'%20width='704'%20height='704'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'/%3e%3cfeGaussianBlur%20stdDeviation='16'%20result='effect1_foregroundBlur_5207_91652'/%3e%3c/filter%3e%3cfilter%20id='filter1_f_5207_91652'%20x='41.4052'%20y='41.4052'%20width='557.19'%20height='557.19'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'/%3e%3cfeGaussianBlur%20stdDeviation='1.79739'%20result='effect1_foregroundBlur_5207_91652'/%3e%3c/filter%3e%3clinearGradient%20id='paint0_linear_5207_91652'%20x1='320'%20y1='45'%20x2='326.74'%20y2='605.784'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0.177383'%20stop-color='%23EBDDFF'/%3e%3cstop%20offset='0.755511'%20stop-color='%23FEBB63'/%3e%3cstop%20offset='1'%20stop-color='%23FF7A00'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",n={overlay:{position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.5)",backdropFilter:"blur(8px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999,padding:"20px"},modal:{backgroundColor:"#ffffff",borderRadius:"32px",padding:"40px",width:"100%",maxWidth:"480px",maxHeight:"90vh",overflow:"auto",boxShadow:"0 25px 80px rgba(0, 0, 0, 0.15)",position:"relative"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"32px"},title:{fontSize:"18px",fontWeight:600,color:"#1f2937",margin:0,display:"flex",alignItems:"center",gap:"8px"},closeButton:{background:"transparent",border:"none",color:"#9ca3af",cursor:"pointer",padding:"8px",borderRadius:"8px",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s"},micSection:{display:"flex",flexDirection:"column",alignItems:"center",gap:"24px",marginBottom:"32px",position:"relative"},bgCircle:{position:"absolute",width:"280px",height:"280px",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:0,opacity:.8,transition:"opacity 0.3s ease"},micButton:{width:"120px",height:"120px",borderRadius:"50%",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",background:"transparent",padding:0,position:"relative",zIndex:1,transition:"transform 0.2s ease"},micImage:{width:"100%",height:"100%",objectFit:"contain"},statusText:{fontSize:"16px",fontWeight:500,color:"#6b7280",textAlign:"center",position:"relative",zIndex:1},statusTextActive:{color:"#FF7A00",fontWeight:600},transcriptBox:{background:"#f9fafb",border:"1px solid #e5e7eb",borderRadius:"16px",padding:"20px",minHeight:"100px",maxHeight:"160px",overflow:"auto",marginBottom:"24px"},transcriptText:{fontSize:"15px",lineHeight:1.7,color:"#1f2937",margin:0,wordWrap:"break-word"},placeholderText:{fontSize:"14px",color:"#9ca3af",textAlign:"center",margin:0,padding:"16px 0"},actions:{display:"flex",justifyContent:"center"},generateButton:{padding:"14px 48px",borderRadius:"100px",border:"2px solid #9333ea",background:"transparent",color:"#9333ea",fontSize:"15px",fontWeight:600,cursor:"pointer",transition:"all 0.2s ease",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},generateButtonDisabled:{opacity:.4,cursor:"not-allowed",borderColor:"#d1d5db",color:"#9ca3af"},loadingOverlay:{position:"absolute",inset:0,background:"rgba(255, 255, 255, 0.95)",borderRadius:"32px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"24px",zIndex:10},loadingBars:{display:"flex",flexDirection:"column",gap:"12px",width:"200px"},loadingBar:{height:"12px",borderRadius:"6px",background:"linear-gradient(90deg, #e5e7eb 0%, #d1d5db 50%, #e5e7eb 100%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s ease-in-out infinite"},loadingText:{fontSize:"16px",fontWeight:600,color:"#6b7280",display:"flex",alignItems:"center",gap:"8px"},sparkleIcon:{color:"#9333ea"},footer:{marginTop:"24px",textAlign:"center",fontSize:"12px",color:"#9ca3af"}},X=`
|
|
7
2
|
@keyframes shimmer {
|
|
8
3
|
0% { background-position: 200% 0; }
|
|
9
4
|
100% { background-position: -200% 0; }
|
|
@@ -16,5 +11,5 @@ React keys must be passed directly to JSX without using spread:
|
|
|
16
11
|
0%, 100% { opacity: 0.8; transform: translate(-50%, -50%) scale(1); }
|
|
17
12
|
50% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
|
|
18
13
|
}
|
|
19
|
-
`,Se=()=>t.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:"24",height:"24",children:t.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})}),Ce=()=>t.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:"20",height:"20",children:t.jsx("path",{d:"M12 2L9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2z"})}),ke=()=>t.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",children:[t.jsx("path",{d:"M12 2L10.5 8.5L4 10L10.5 11.5L12 18L13.5 11.5L20 10L13.5 8.5L12 2Z",fill:"#9333ea"}),t.jsx("path",{d:"M5 14L4 17L7 16L5 14Z",fill:"#9333ea",opacity:"0.6"}),t.jsx("path",{d:"M19 14L20 17L17 16L19 14Z",fill:"#9333ea",opacity:"0.6"})]});function ce({isOpen:r,onClose:a,isListening:d,transcript:i,onStartListening:s,onStopListening:p,onResetTranscript:m,onGenerate:_,isGenerating:l=!1,title:j="AI Speech-to-Data",generateButtonText:v="Generate",placeholder:T="Click the microphone and start speaking..."}){const b=c.useRef(null);c.useEffect(()=>{const n=k=>{k.key==="Escape"&&r&&!l&&a()};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[r,a,l]);const y=n=>{n.target===n.currentTarget&&!l&&a()};if(!r)return null;const C=()=>{l||(d?p():(m(),s()))},h=()=>{i&&!l&&_(i)};return t.jsxs(t.Fragment,{children:[t.jsx("style",{children:ve}),t.jsx("div",{style:u.overlay,onClick:y,children:t.jsxs("div",{ref:b,style:{...u.modal,animation:"fadeIn 0.25s ease-out"},onClick:n=>n.stopPropagation(),children:[l&&t.jsxs("div",{style:u.loadingOverlay,children:[t.jsx(ke,{}),t.jsxs("div",{style:u.loadingBars,children:[t.jsx("div",{style:{...u.loadingBar,width:"100%"}}),t.jsx("div",{style:{...u.loadingBar,width:"80%"}}),t.jsx("div",{style:{...u.loadingBar,width:"90%"}}),t.jsx("div",{style:{...u.loadingBar,width:"70%"}})]}),t.jsxs("span",{style:u.loadingText,children:[t.jsx("span",{style:u.sparkleIcon,children:"✨"}),"AI Analyzing"]})]}),t.jsxs("div",{style:u.header,children:[t.jsxs("h2",{style:u.title,children:[t.jsx("span",{style:{fontSize:"20px"},children:"✨"}),j]}),t.jsx("button",{style:u.closeButton,onClick:a,disabled:l,onMouseOver:n=>{l||(n.currentTarget.style.background="#f3f4f6")},onMouseOut:n=>{n.currentTarget.style.background="transparent"},children:t.jsx(Se,{})})]}),t.jsxs("div",{style:u.micSection,children:[t.jsx("img",{src:we,alt:"",style:{...u.bgCircle,opacity:d?1:.6,animation:d?"pulse-glow 2s ease-in-out infinite":"none"}}),t.jsx("button",{style:u.micButton,onClick:C,disabled:l,onMouseOver:n=>{l||(n.currentTarget.style.transform="scale(1.05)")},onMouseOut:n=>{n.currentTarget.style.transform="scale(1)"},children:t.jsx("img",{src:d?le:J,alt:d?"Stop":"Start recording",style:u.micImage})}),t.jsx("p",{style:{...u.statusText,...d?u.statusTextActive:{}},children:d?"AI is listening.":"Generate result"})]}),(i||!d)&&!l&&t.jsx("div",{style:u.transcriptBox,children:i?t.jsx("p",{style:u.transcriptText,children:i}):t.jsx("p",{style:u.placeholderText,children:T})}),!l&&t.jsx("div",{style:u.actions,children:t.jsxs("button",{style:{...u.generateButton,...i?{}:u.generateButtonDisabled},onClick:h,disabled:!i||l,onMouseOver:n=>{i&&!l&&(n.currentTarget.style.background="#9333ea",n.currentTarget.style.color="white")},onMouseOut:n=>{n.currentTarget.style.background="transparent",n.currentTarget.style.color=i?"#9333ea":"#9ca3af"},children:[t.jsx(Ce,{}),v]})}),t.jsx("div",{style:u.footer,children:t.jsxs("span",{children:["Powered by ",t.jsx("strong",{children:"DFM"})]})})]})})]})}const je=r=>{if(typeof r=="object")return{top:r.top,right:r.right,bottom:r.bottom,left:r.left};const a={"bottom-left":{bottom:"24px",left:"24px"},"bottom-right":{bottom:"24px",right:"24px"},"top-left":{top:"24px",left:"24px"},"top-right":{top:"24px",right:"24px"}};return a[r]||a["bottom-left"]};function de({enabled:r=!0,position:a="bottom-left",config:d={language:"th-TH",continuous:!0},onGenerate:i,onGenerateComplete:s,onGenerateError:p,modalTitle:m="AI Speech-to-Data",generateButtonText:_="Generate",buttonContent:l,buttonSize:j=64,buttonStyle:v,zIndex:T=9998}){const[b,y]=c.useState(!1),[C,h]=c.useState(!1),{transcript:n,isListening:k,startListening:M,stopListening:R,resetTranscript:B}=q({config:d}),G=c.useCallback(()=>{y(!0)},[]),I=c.useCallback(()=>{y(!1),k&&R()},[k,R]),H=c.useCallback(async S=>{if(!i){s?.(S),I(),B();return}h(!0);try{const E=await i(S);s?.(E),I(),B()}catch(E){p?.(E)}finally{h(!1)}},[i,s,p,I,B]);if(!r)return null;const w={position:"fixed",...je(a),zIndex:T,width:j,height:j,borderRadius:"50%",border:"none",cursor:"pointer",background:"transparent",padding:0,transition:"all 0.3s ease",filter:"drop-shadow(0 4px 12px rgba(255, 122, 0, 0.4))",...v};return t.jsxs(t.Fragment,{children:[t.jsx("button",{style:w,onClick:G,"aria-label":"Open voice input",onMouseOver:S=>{S.currentTarget.style.transform="scale(1.1)",S.currentTarget.style.filter="drop-shadow(0 6px 20px rgba(255, 122, 0, 0.5))"},onMouseOut:S=>{S.currentTarget.style.transform="scale(1)",S.currentTarget.style.filter="drop-shadow(0 4px 12px rgba(255, 122, 0, 0.4))"},children:l||t.jsx("img",{src:J,alt:"Voice input",style:{width:"100%",height:"100%"}})}),t.jsx(ce,{isOpen:b,onClose:I,isListening:k,transcript:n,onStartListening:M,onStopListening:R,onResetTranscript:B,onGenerate:H,isGenerating:C,title:m,generateButtonText:_})]})}const ue=c.createContext(null);function Te({children:r,config:a,callbacks:d,showWidget:i=!1,widgetEnabled:s=!0,widgetPosition:p="bottom-left",widgetButtonSize:m=60,widgetZIndex:_=9998,modalTitle:l,generateButtonText:j,onGenerate:v,onGenerateComplete:T,onGenerateError:b}){const[y,C]=c.useState(s),h=q({config:a,callbacks:d}),n=c.useCallback(R=>{C(R)},[]),k=c.useCallback(()=>{C(R=>!R)},[]),M=c.useMemo(()=>({...h,isWidgetEnabled:y,setWidgetEnabled:n,toggleWidget:k}),[h,y,n,k]);return t.jsxs(ue.Provider,{value:M,children:[r,i&&t.jsx(de,{enabled:y,position:p,config:a,buttonSize:m,zIndex:_,modalTitle:l,generateButtonText:j,onGenerate:v,onGenerateComplete:T,onGenerateError:b})]})}function Re(){const r=c.useContext(ue);if(!r)throw new Error("useSpeechContext must be used within a SpeechProvider");return r}const Ee={sm:60,md:100,lg:140},ne={button:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:"8px",border:"none",borderRadius:"50%",cursor:"pointer",transition:"all 0.2s ease",background:"transparent",padding:0},disabled:{opacity:.5,cursor:"not-allowed"}},Ae=()=>t.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:"32",height:"32",children:[t.jsx("path",{d:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm-1-9c0-.55.45-1 1-1s1 .45 1 1v6c0 .55-.45 1-1 1s-1-.45-1-1V5z"}),t.jsx("path",{d:"M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"})]}),Fe=()=>t.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:"32",height:"32",children:t.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})});function Oe({isListening:r,onStart:a,onStop:d,disabled:i=!1,className:s,style:p,startIcon:m,stopIcon:_,startLabel:l,stopLabel:j,size:v="md",useAssets:T=!0}){const b=()=>{i||(r?d():a())},y=Ee[v],C={...ne.button,width:y,height:y,...i&&ne.disabled,filter:T?"drop-shadow(0 4px 12px rgba(255, 122, 0, 0.4))":void 0,...p};return T?t.jsx("button",{type:"button",onClick:b,disabled:i,className:s,style:C,"aria-label":r?"Stop recording":"Start recording",children:t.jsx("img",{src:r?le:J,alt:r?"Stop":"Start",style:{width:"100%",height:"100%"}})}):t.jsx("button",{type:"button",onClick:b,disabled:i,className:s,style:{...C,background:r?"linear-gradient(135deg, #ef4444 0%, #dc2626 100%)":"linear-gradient(135deg, #667eea 0%, #764ba2 100%)",color:"white",boxShadow:r?"0 10px 40px rgba(239, 68, 68, 0.4)":"0 10px 40px rgba(102, 126, 234, 0.4)"},"aria-label":r?"Stop recording":"Start recording",children:t.jsxs("span",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px"},children:[r?_||t.jsx(Fe,{}):m||t.jsx(Ae,{}),(l||j)&&t.jsx("span",{style:{fontSize:v==="sm"?"10px":v==="md"?"12px":"14px"},children:r?j||"Stop":l||"Start"})]})})}const U={container:{width:"100%"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},title:{fontSize:"18px",fontWeight:600,margin:0},resetButton:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 16px",borderRadius:"8px",border:"1px solid #374151",background:"transparent",color:"#9ca3af",fontSize:"14px",cursor:"pointer"},box:{background:"rgba(255, 255, 255, 0.03)",border:"1px solid #374151",borderRadius:"16px",padding:"24px",minHeight:"150px",overflowY:"auto"},text:{fontSize:"18px",lineHeight:1.75,margin:0,wordWrap:"break-word"},placeholder:{color:"#6b7280",fontSize:"16px",textAlign:"center",margin:0,padding:"32px 0"}},Be=()=>t.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:"16",height:"16",children:t.jsx("path",{d:"M17.65 6.35A7.958 7.958 0 0012 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08A5.99 5.99 0 0112 18c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"})});function Ie({transcript:r,placeholder:a="Click the microphone to start speaking...",isListening:d=!1,className:i,style:s,onReset:p,showResetButton:m=!0,maxHeight:_="300px"}){const l={...U.box,maxHeight:_,...s};return t.jsxs("div",{className:i,style:U.container,children:[t.jsxs("div",{style:U.header,children:[t.jsx("h2",{style:U.title,children:"📝 Transcript"}),m&&p&&t.jsxs("button",{type:"button",onClick:p,disabled:!r,style:{...U.resetButton,opacity:r?1:.5,cursor:r?"pointer":"not-allowed"},children:[t.jsx(Be,{}),"Clear"]})]}),t.jsx("div",{style:l,children:r?t.jsx("p",{style:U.text,children:r}):t.jsx("p",{style:U.placeholder,children:d?"🎧 Listening... Speak now!":a})})]})}exports.SpeechButton=Oe;exports.SpeechModal=ce;exports.SpeechProvider=Te;exports.SpeechWidget=de;exports.TranscriptDisplay=Ie;exports.formatConfidence=ge;exports.getSpeechRecognition=ae;exports.getSupportedLanguages=he;exports.isMicrophoneAvailable=fe;exports.isSpeechRecognitionSupported=ie;exports.requestMicrophonePermission=se;exports.useSpeechContext=Re;exports.useSpeechRecognition=q;
|
|
14
|
+
`,e0=()=>e.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:"24",height:"24",children:e.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})}),t0=()=>e.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:"20",height:"20",children:e.jsx("path",{d:"M12 2L9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2z"})}),r0=()=>e.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("path",{d:"M12 2L10.5 8.5L4 10L10.5 11.5L12 18L13.5 11.5L20 10L13.5 8.5L12 2Z",fill:"#9333ea"}),e.jsx("path",{d:"M5 14L4 17L7 16L5 14Z",fill:"#9333ea",opacity:"0.6"}),e.jsx("path",{d:"M19 14L20 17L17 16L19 14Z",fill:"#9333ea",opacity:"0.6"})]});function W({isOpen:t,onClose:a,isListening:c,transcript:s,onStartListening:l,onStopListening:p,onResetTranscript:g,onGenerate:w,isGenerating:o=!1,title:b="AI Speech-to-Data",generateButtonText:x="Generate",placeholder:S="Click the microphone and start speaking..."}){const u=i.useRef(null);i.useEffect(()=>{const r=y=>{y.key==="Escape"&&t&&!o&&a()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[t,a,o]);const f=r=>{r.target===r.currentTarget&&!o&&a()};if(!t)return null;const _=()=>{o||(c?p():(g(),l()))},d=()=>{s&&!o&&w(s)};return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:X}),e.jsx("div",{style:n.overlay,onClick:f,children:e.jsxs("div",{ref:u,style:{...n.modal,animation:"fadeIn 0.25s ease-out"},onClick:r=>r.stopPropagation(),children:[o&&e.jsxs("div",{style:n.loadingOverlay,children:[e.jsx(r0,{}),e.jsxs("div",{style:n.loadingBars,children:[e.jsx("div",{style:{...n.loadingBar,width:"100%"}}),e.jsx("div",{style:{...n.loadingBar,width:"80%"}}),e.jsx("div",{style:{...n.loadingBar,width:"90%"}}),e.jsx("div",{style:{...n.loadingBar,width:"70%"}})]}),e.jsxs("span",{style:n.loadingText,children:[e.jsx("span",{style:n.sparkleIcon,children:"✨"}),"AI Analyzing"]})]}),e.jsxs("div",{style:n.header,children:[e.jsxs("h2",{style:n.title,children:[e.jsx("span",{style:{fontSize:"20px"},children:"✨"}),b]}),e.jsx("button",{style:n.closeButton,onClick:a,disabled:o,onMouseOver:r=>{o||(r.currentTarget.style.background="#f3f4f6")},onMouseOut:r=>{r.currentTarget.style.background="transparent"},children:e.jsx(e0,{})})]}),e.jsxs("div",{style:n.micSection,children:[e.jsx("img",{src:Q,alt:"",style:{...n.bgCircle,opacity:c?1:.6,animation:c?"pulse-glow 2s ease-in-out infinite":"none"}}),e.jsx("button",{style:n.micButton,onClick:_,disabled:o,onMouseOver:r=>{o||(r.currentTarget.style.transform="scale(1.05)")},onMouseOut:r=>{r.currentTarget.style.transform="scale(1)"},children:e.jsx("img",{src:c?P:G,alt:c?"Stop":"Start recording",style:n.micImage})}),e.jsx("p",{style:{...n.statusText,...c?n.statusTextActive:{}},children:c?"AI is listening.":"Generate result"})]}),(s||!c)&&!o&&e.jsx("div",{style:n.transcriptBox,children:s?e.jsx("p",{style:n.transcriptText,children:s}):e.jsx("p",{style:n.placeholderText,children:S})}),!o&&e.jsx("div",{style:n.actions,children:e.jsxs("button",{style:{...n.generateButton,...s?{}:n.generateButtonDisabled},onClick:d,disabled:!s||o,onMouseOver:r=>{s&&!o&&(r.currentTarget.style.background="#9333ea",r.currentTarget.style.color="white")},onMouseOut:r=>{r.currentTarget.style.background="transparent",r.currentTarget.style.color=s?"#9333ea":"#9ca3af"},children:[e.jsx(t0,{}),x]})}),e.jsx("div",{style:n.footer,children:e.jsxs("span",{children:["Powered by ",e.jsx("strong",{children:"DFM"})]})})]})})]})}const i0=t=>{if(typeof t=="object")return{top:t.top,right:t.right,bottom:t.bottom,left:t.left};const a={"bottom-left":{bottom:"24px",left:"24px"},"bottom-right":{bottom:"24px",right:"24px"},"top-left":{top:"24px",left:"24px"},"top-right":{top:"24px",right:"24px"}};return a[t]||a["bottom-left"]};function Z({enabled:t=!0,position:a="bottom-left",config:c={language:"th-TH",continuous:!0},onGenerate:s,onGenerateComplete:l,onGenerateError:p,modalTitle:g="AI Speech-to-Data",generateButtonText:w="Generate",buttonContent:o,buttonSize:b=64,buttonStyle:x,zIndex:S=9998}){const[u,f]=i.useState(!1),[_,d]=i.useState(!1),{transcript:r,isListening:y,startListening:T,stopListening:C,resetTranscript:j}=O({config:c}),R=i.useCallback(()=>{f(!0)},[]),B=i.useCallback(()=>{f(!1),y&&C()},[y,C]),z=i.useCallback(async h=>{if(!s){l?.(h),B(),j();return}d(!0);try{const v=await s(h);l?.(v),B(),j()}catch(v){p?.(v)}finally{d(!1)}},[s,l,p,B,j]);if(!t)return null;const m={position:"fixed",...i0(a),zIndex:S,width:b,height:b,borderRadius:"50%",border:"none",cursor:"pointer",background:"transparent",padding:0,transition:"all 0.3s ease",filter:"drop-shadow(0 4px 12px rgba(255, 122, 0, 0.4))",...x};return e.jsxs(e.Fragment,{children:[e.jsx("button",{style:m,onClick:R,"aria-label":"Open voice input",onMouseOver:h=>{h.currentTarget.style.transform="scale(1.1)",h.currentTarget.style.filter="drop-shadow(0 6px 20px rgba(255, 122, 0, 0.5))"},onMouseOut:h=>{h.currentTarget.style.transform="scale(1)",h.currentTarget.style.filter="drop-shadow(0 4px 12px rgba(255, 122, 0, 0.4))"},children:o||e.jsx("img",{src:G,alt:"Voice input",style:{width:"100%",height:"100%"}})}),e.jsx(W,{isOpen:u,onClose:B,isListening:y,transcript:r,onStartListening:T,onStopListening:C,onResetTranscript:j,onGenerate:z,isGenerating:_,title:g,generateButtonText:w})]})}const N=i.createContext(null);function o0({children:t,config:a,callbacks:c,showWidget:s=!1,widgetEnabled:l=!0,widgetPosition:p="bottom-left",widgetButtonSize:g=60,widgetZIndex:w=9998,modalTitle:o,generateButtonText:b,onGenerate:x,onGenerateComplete:S,onGenerateError:u}){const[f,_]=i.useState(l),d=O({config:a,callbacks:c}),r=i.useCallback(C=>{_(C)},[]),y=i.useCallback(()=>{_(C=>!C)},[]),T=i.useMemo(()=>({...d,isWidgetEnabled:f,setWidgetEnabled:r,toggleWidget:y}),[d,f,r,y]);return e.jsxs(N.Provider,{value:T,children:[t,s&&e.jsx(Z,{enabled:f,position:p,config:a,buttonSize:g,zIndex:w,modalTitle:o,generateButtonText:b,onGenerate:x,onGenerateComplete:S,onGenerateError:u})]})}function n0(){const t=i.useContext(N);if(!t)throw new Error("useSpeechContext must be used within a SpeechProvider");return t}const a0={sm:60,md:100,lg:140},H={button:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:"8px",border:"none",borderRadius:"50%",cursor:"pointer",transition:"all 0.2s ease",background:"transparent",padding:0},disabled:{opacity:.5,cursor:"not-allowed"}},s0=()=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:"32",height:"32",children:[e.jsx("path",{d:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm-1-9c0-.55.45-1 1-1s1 .45 1 1v6c0 .55-.45 1-1 1s-1-.45-1-1V5z"}),e.jsx("path",{d:"M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"})]}),c0=()=>e.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:"32",height:"32",children:e.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})});function l0({isListening:t,onStart:a,onStop:c,disabled:s=!1,className:l,style:p,startIcon:g,stopIcon:w,startLabel:o,stopLabel:b,size:x="md",useAssets:S=!0}){const u=()=>{s||(t?c():a())},f=a0[x],_={...H.button,width:f,height:f,...s&&H.disabled,filter:S?"drop-shadow(0 4px 12px rgba(255, 122, 0, 0.4))":void 0,...p};return S?e.jsx("button",{type:"button",onClick:u,disabled:s,className:l,style:_,"aria-label":t?"Stop recording":"Start recording",children:e.jsx("img",{src:t?P:G,alt:t?"Stop":"Start",style:{width:"100%",height:"100%"}})}):e.jsx("button",{type:"button",onClick:u,disabled:s,className:l,style:{..._,background:t?"linear-gradient(135deg, #ef4444 0%, #dc2626 100%)":"linear-gradient(135deg, #667eea 0%, #764ba2 100%)",color:"white",boxShadow:t?"0 10px 40px rgba(239, 68, 68, 0.4)":"0 10px 40px rgba(102, 126, 234, 0.4)"},"aria-label":t?"Stop recording":"Start recording",children:e.jsxs("span",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px"},children:[t?w||e.jsx(c0,{}):g||e.jsx(s0,{}),(o||b)&&e.jsx("span",{style:{fontSize:x==="sm"?"10px":x==="md"?"12px":"14px"},children:t?b||"Stop":o||"Start"})]})})}const k={container:{width:"100%"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},title:{fontSize:"18px",fontWeight:600,margin:0},resetButton:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 16px",borderRadius:"8px",border:"1px solid #374151",background:"transparent",color:"#9ca3af",fontSize:"14px",cursor:"pointer"},box:{background:"rgba(255, 255, 255, 0.03)",border:"1px solid #374151",borderRadius:"16px",padding:"24px",minHeight:"150px",overflowY:"auto"},text:{fontSize:"18px",lineHeight:1.75,margin:0,wordWrap:"break-word"},placeholder:{color:"#6b7280",fontSize:"16px",textAlign:"center",margin:0,padding:"32px 0"}},d0=()=>e.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:"16",height:"16",children:e.jsx("path",{d:"M17.65 6.35A7.958 7.958 0 0012 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08A5.99 5.99 0 0112 18c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"})});function p0({transcript:t,placeholder:a="Click the microphone to start speaking...",isListening:c=!1,className:s,style:l,onReset:p,showResetButton:g=!0,maxHeight:w="300px"}){const o={...k.box,maxHeight:w,...l};return e.jsxs("div",{className:s,style:k.container,children:[e.jsxs("div",{style:k.header,children:[e.jsx("h2",{style:k.title,children:"📝 Transcript"}),g&&p&&e.jsxs("button",{type:"button",onClick:p,disabled:!t,style:{...k.resetButton,opacity:t?1:.5,cursor:t?"pointer":"not-allowed"},children:[e.jsx(d0,{}),"Clear"]})]}),e.jsx("div",{style:o,children:t?e.jsx("p",{style:k.text,children:t}):e.jsx("p",{style:k.placeholder,children:c?"🎧 Listening... Speak now!":a})})]})}exports.SpeechButton=l0;exports.SpeechModal=W;exports.SpeechProvider=o0;exports.SpeechWidget=Z;exports.TranscriptDisplay=p0;exports.formatConfidence=Y;exports.getSpeechRecognition=V;exports.getSupportedLanguages=$;exports.isMicrophoneAvailable=q;exports.isSpeechRecognitionSupported=E;exports.requestMicrophonePermission=L;exports.useSpeechContext=n0;exports.useSpeechRecognition=O;
|
|
20
15
|
//# sourceMappingURL=speech-recognition-sdk.cjs.js.map
|