import"./chunk-QTnfLwEv.js";import{n as e}from"./index-7yDgay5u.js";import{i as t,o as n,t as r}from"./jsx-runtime-DHSfUA5-.js";import{P as i,j as a}from"./test.id-DxQrYxPk.js";import{t as o}from"./navigationService-BNBSAd9W.js";import{t as s}from"./useSuccessToast-CW8oLO3e.js";import{t as c}from"./speechRecognitionConfig-BofzFyKP.js";import{t as l}from"./usePreference-3fMY0uE5.js";import{t as u}from"./HeaderLayoutPage-CDZOzzod.js";import{t as d}from"./useDialog-CjsjDZgz.js";import{n as f,t as p}from"./FormPage-B0BqbKo9.js";n();var m=r();function h(){let n=i(o),r=d(),h=s(),[_,v]=l(c),y=()=>{r({message:e(`settings.speechRecognition.deleteConfirm`,`Delete voice-to-text configuration? You can still send voice messages.`),confirmLabel:e(`common.delete`,`Delete`),cancelLabel:e(`common.cancel`,`Cancel`),tone:`danger`,onConfirm:()=>void b()})},b=async()=>{await v(void 0),h({message:e(`settings.speechRecognition.deleted`,`Deleted`)})},x=async e=>{!_||_.autoTranscribe===e||await v({..._,autoTranscribe:e})},S=_?[{label:e(`settings.speechRecognition.provider`,`Provider`),value:e(`settings.speechRecognition.providerBaidu`,`Baidu AI Cloud`)},{label:`API Key`,value:g(_.apiKey)},{label:`Secret Key`,value:g(_.secretKey)},{label:e(`settings.speechRecognition.dataSharing`,`Data sharing`),value:e(`settings.speechRecognition.dataSharingSummary`,`Voice audio is sent to Baidu AI Cloud for transcription.`)},{name:`autoTranscribe`,label:e(`settings.speechRecognition.autoTranscribe`,`Auto-transcribe voice`),type:`checkbox`,testId:a.autoTranscribe,value:_.autoTranscribe,onChange:e=>void x(!!e)}]:[{type:`navigation`,icon:(0,m.jsx)(`img`,{className:t.SpeechRecognitionSettingsPage.ProviderIcon,src:`/icons/baiducloud-color.png`,alt:``,"aria-hidden":`true`}),title:e(`settings.speechRecognition.providerBaidu`,`Baidu AI Cloud`),description:e(`settings.speechRecognition.baiduDesc`,`Short Speech Recognition Pro`),testId:a.add,onClick:()=>n.navigate({path:`/settings/speech-recognition/add`})}];return(0,m.jsx)(u,{rootClassName:t.Page.SurfaceRoot,contentClassName:t.WeuiForm.PageMain,pageTestId:a.page,contentTestId:a.content,header:{showBack:!0,tone:`surface`},children:(0,m.jsxs)(p,{title:e(`settings.speechRecognition.title`,`Voice to text`),description:_?e(`settings.speechRecognition.configuredDesc`,`Voice to text is ready to use.`):e(`settings.speechRecognition.emptyDesc`,`Configure a service to turn voice messages into text.`),actions:_?[{label:e(`settings.speechRecognition.delete`,`Delete configuration`),variant:`warn`,testId:a.delete,onClick:y}]:void 0,children:[(0,m.jsx)(f,{title:_?e(`settings.speechRecognition.current`,`Current service`):e(`settings.speechRecognition.service`,`Service`),items:S}),!_&&(0,m.jsx)(`p`,{className:t.WeuiForm.Description,children:e(`settings.speechRecognition.emptyHint`,`You can still send voice messages without voice to text.`)})]})})}function g(e){let t=e.trim();return t.length<=2?`${t}********`:t.length<=4?`${t.slice(0,2)}********`:`${t.slice(0,2)}********${t.slice(-2)}`}export{h as SettingsSpeechRecognitionPage};
//# sourceMappingURL=speech-recognition-BiJpBqjB.js.map